--- title: "8K/12K Disassembler" id: 81991 type: "computer_media" slug: "8k-12k-disassembler" url: "http://localhost/computer_media/8k-12k-disassembler/" markdown_url: "http://localhost/computer_media/8k-12k-disassembler.md" published_at: "2026-11-28T11:37:17+00:00" modified_at: "2026-11-28T11:37:17+00:00" author: "David Anderson" featured_image: url: "http://localhost/wp-content/uploads/2026/11/DA1.png" excerpt: "Z80 disassembler in BASIC that prints address, decimal and hex bytes and mnemonics a screen at a time, with a volume-setting test program that loads it automatically." post_tag: - name: "Downloadable" slug: "downloadable" taxonomy: "post_tag" url: "http://localhost/tag/downloadable/" model: - name: "Sinclair ZX81" slug: "zx81" taxonomy: "model" url: "http://localhost/model/zx81/" - name: "Timex/Sinclair 1000" slug: "ts-1000" taxonomy: "model" url: "http://localhost/model/ts-1000/" indiv: - name: "Martin Irons (K2MI)" slug: "martin-irons-k2mi" taxonomy: "indiv" url: "http://localhost/indiv/martin-irons-k2mi/" media_type: "Cassette" programmers: - name: "Martin Irons (K2MI)" slug: "martin-irons-k2mi" taxonomy: "indiv" url: "http://localhost/indiv/martin-irons-k2mi/" download_url: "https://archive.org/download/timex-sinclair-software-archive/8K-12K%20Disassembler%20%281983%29%28Irons%2C%20Martin%29%28TS1000%29%28US%29%28Cassette%29.zip" mediadate: "1983" producer_company: - id: 81990 title: "MICRO-80" type: "company" url: "http://localhost/?post_type=company&p=81990" images: - url: "http://localhost/wp-content/uploads/2026/11/DA1.png" - url: "http://localhost/wp-content/uploads/2026/11/Disassembler-scaled.jpg" license: false --- # 8K/12K Disassembler A Z80 disassembler written in BASIC. You give it a start address. For each instruction it prints the address, the bytes in decimal and hex, and the mnemonic, with the operands filled in: 8- and 16-bit values, relative jumps shown as an offset and a target address, and the IX and IY indexed forms. Each time the screen fills it waits for input. ENTER carries on, `C` copies the screen to the printer, `Q` stops, and typing an address starts again from there. Lines 9920–9944 also hold a small machine code loader for POKEing bytes from the keyboard. The cassette is a MICRO-80 Incorporated tape with a printed label reading "8k/16k Disassembler "DA1" All Rights Reserved By Martin H. Irons, Goshen, NY". The REM at line 8000 says "SINCLAIR ZX80/ZX81 8K/12K DISASSEMBLER ALL RIGHTS RESERVED MARTIN H. IRONS", and line 8010 reads "12/20/82 MOD 3 12 K". The tape opens with TESTLOAD, a short program for setting the recorder's volume. When it loads, it says so on screen and then loads DA1 automatically: "LEAVE RECORDER RUNNING … DA1 WILL LOAD ITSELF." The program's own instructions (lines 8100–8190) are: enter `GOTO 9000`, enter the start address, then use ENTER, C, Q or a new address. Never use RUN, and don't disassemble data, because "IT PRINTS GARBAGE". ## Program Analysis ### Program Structure - Lines 7990–7995: `STOP`, then `SAVE "DA1"`. - Lines 8100–8200: the instructions screen. - Lines 9000–9062: the main loop. It prints each address, calls the decimal and hex dump routines, then decodes the opcode. A counter `D` skips the operand bytes of instructions longer than one byte. - Lines 9050–9058: look up the opcode in a table. The first character of each entry is the instruction length. Characters with codes below 21 are placeholders that send control to a formatter at `9200+O*20`. - Lines 9339–9706: the formatters. They print 16-bit addresses, (IX+d) and (IY+d), (HL), immediate bytes and relative jump targets, and they handle the CB, ED, DD and FD prefixes through their own tables. - Lines 9950–9994: subroutines for the decimal dump, hex dump, page prompt and start address. ### Notable Techniques - Line numbers and constants are kept in variables (`GOSUB IP`, `GOTO PR`, `C0`, `C1`, `C12`) or written as `VAL "9060"`, which saves memory on an 8K-ROM machine. This is why the program must never be started with RUN, which would clear those variables. - The instruction tables are string arrays. One entry holds the length digit plus the mnemonic text, with control codes marking where operands go. Each table is indexed directly by the opcode byte. - Line 9014 tests the scroll counter at 16442 to decide when a screenful has been printed. ### Potential Issues - The recovered DA1 file is about 2.3 KB and holds no variables. The constants, line-number variables and instruction tables that the program depends on are missing. The program also has no lines below 7990 that could rebuild them. As recovered, it stops with report 2 at line 8200 (`GOSUB IP`), and Joe's screenshot shows this. A complete copy saved with its variables would be needed to use it. - The cassette label says "8k/16k", but the REM says "8K/12K". ## Source Code ``` 7990 STOP 7995 SAVE "DA[1]" 8000 REM SINCLAIR ZX80/ZX81 8K/12K DISASSEMBLER ALL RIGHTS RESERVED MARTIN H. IRONS 46 MAGIC CIRCLE DR. GOSHEN , NY 10924 8010 REM 12/20/82 MOD 3 12 K 8100 PRINT "HOW TO USE THIS DISASSEMBLER:" 8110 PRINT ,," 1 - INPUT ""GOTO 9000""." 8120 PRINT ,," 2 - INPUT STARTING ADDRESS." 8130 PRINT ,," 3 - HIT ENTER TO CONT , OR " 8140 PRINT ,," INPUT ""C"" TO COPY, OR " 8150 PRINT ,," INPUT ""Q"" TO STOP, OR " 8160 PRINT ,," INPUT A NEW ADDRESS." 8170 PRINT ,," 4 - NEVER RUN THIS PROGRAM." 8180 PRINT ,," 5 - DO NOT DISASSEMBLE DATA - IT PRINTS GARBAGE." 8190 PRINT ,,,," NOW HIT ENTER TO GOTO 9000" 8200 GOSUB IP 9000 GOSUB ESA 9001 LET D=C0 9002 FOR I=N TO N+TOP 9005 PRINT I;TAB VAL "6"; 9006 GOSUB DEC 9007 GOSUB HX 9008 IF D>C0 THEN GOTO VAL "9060" 9010 GOSUB VAL "9050" 9013 LET D=D-C1 9014 IF PEEK VAL "16442">C2 THEN NEXT I 9016 GOSUB IP 9018 LET N=I+C1 9020 IF Z$="" OR Z$="C" THEN GOTO VAL "9002" 9030 LET N=VAL Z$ 9040 GOTO VAL "9001" 9050 IF PEEK I>C0 THEN LET W$=L$(PEEK I) 9051 IF PEEK I=C0 THEN LET W$="1NOP" 9052 LET I1=I+C1 9053 LET D=VAL W$(C1) 9054 LET W$=W$(C2 TO ) 9055 IF W$="" THEN GOTO EOL 9056 LET O=CODE W$ 9057 IF O>VAL "20" THEN GOTO PR 9058 GOTO VAL "9200"+O*VAL "20" 9060 PRINT 9062 GOTO VAL "9013" 9339 GOTO PR 9340 PRINT STR$ (PEEK (I+C2)+VAL "256"*(PEEK (I+C3))); 9342 GOTO TR 9384 PRINT "(";X$;"+";PEEK (I+C2);")"; 9386 GOTO TR 9400 PRINT "(HL)"; 9402 GOTO TR 9420 PRINT "EX (SP),"; 9422 GOTO TR 9442 GOTO VAL W$(C2 TO ) 9460 PRINT X$; 9462 GOTO TR 9480 PRINT PEEK (I+C3); 9484 GOTO TR 9500 IF PEEK (I+C3)<>VAL "118" THEN LET W$=C$(PEEK (I+C3)+C1) 9502 IF PEEK (I+C3)=VAL "118" THEN LET W$=C$(VAL "120") 9504 GOTO GS 9559 GOTO PR 9560 PRINT STR$ (PEEK (I1)); 9564 GOTO TR 9580 IF PEEK (I1)VAL "127" THEN PRINT "-";STR$ (VAL "256"-PEEK (I1));" (";STR$ (I+PEEK (I1)-VAL "254");")"; 9586 GOTO TR 9600 PRINT STR$ (PEEK (I1)+VAL "256"*(PEEK (I+C2))); 9604 GOTO TR 9620 PRINT CHR$ O; 9622 LET W$=W$(C2 TO ) 9624 GOTO NC 9630 PRINT 9632 RETURN 9640 LET W$="2RLC B" 9642 IF PEEK (I1)>C0 THEN LET W$=A$(PEEK (I1)) 9644 GOTO GS 9660 LET X$="IX" 9662 LET W$=C$(PEEK (I1)) 9664 GOTO GS 9680 LET W$=B$(PEEK (I1)-63) 9682 GOTO GS 9700 LET X$="IY" 9702 LET W$=C$(PEEK (I1)) 9706 GOTO GS 9920 REM MACHINE LANGUAGE LOADER 9922 INPUT Z$ 9924 IF Z$="Q" THEN GOTO END 9926 IF Z$="" THEN GOTO VAL "9942" 9928 IF VAL Z$