Dunjunz1: the game loader
Dunjunz, the 1986 cassette
Updated 9 Nov 2026
This disassembly
Files
| File | Load | Exec | Length | SHA-256 |
|---|---|---|---|---|
| Dunjunz1 | &2000 | &2000 | &0169 | 6991c255d042eeeb59cec752d07fdf89eb467bd8a9b38b717d529e726140fcc5 |
Prepare the screen and load the gameEntered from DUNK's loader at &0740, which loads this file to &2000 and jumps here. It does *FX 200,3 (clear memory on BREAK), selects MODE 2 with the cursor off and the 6845 showing 25 character rows, as in play, and makes logical colours 1-7 black and colour 8 green, so the loading screen arrives unseen. It sets a three-row text window at the bottom, rows 22-24, in colour 8, then calls load_files and jumps to load_core in the game, which loads the last file and starts it.
|
||||||||
| 2000 | .loader_start | |||||||
| LDA #&78 ; A = &78... | ||||||||
| 2002 | CLC ; ...clear the carry... | |||||||
| 2003 | ADC #&50 ; ...plus &50: OSBYTE &C8, the BREAK and ESCAPE effect | |||||||
| 2005 | LDX #2 ; X = 2... | |||||||
| 2007 | INX ; ...plus 1: 3, clear memory on BREAK | |||||||
| 2008 | JSR osbyte ; *FX 200,3 | |||||||
| ; MODE 2, with the cursor off and 25 rows of text shown | ||||||||
| 200B | LDA #&16 ; VDU 22: select a mode... | |||||||
| 200D | JSR oswrch ; ...send it | |||||||
| 2010 | LDA #2 ; ...2 | |||||||
| 2012 | JSR oswrch ; ...send it: MODE 2 | |||||||
| 2015 | LDA #&17 ; VDU 23,0: write a 6845 register... | |||||||
| 2017 | JSR oswrch ; ...send the 23 | |||||||
| 201A | LDA #0 ; ...0: a 6845 register follows | |||||||
| 201C | JSR oswrch ; ...send it | |||||||
| 201F | LDA #&0a ; ...register 10, cursor start... | |||||||
| 2021 | JSR oswrch ; ...send the number | |||||||
| 2024 | LDA #&20 ; ...&20: cursor off | |||||||
| 2026 | JSR oswrch ; ...send the value | |||||||
| 2029 | LDA #0 ; ...then six zeros to finish the command | |||||||
| 202B | JSR oswrch ; ...the first | |||||||
| 202E | JSR oswrch ; ...the second | |||||||
| 2031 | JSR oswrch ; ...the third | |||||||
| 2034 | JSR oswrch ; ...the fourth | |||||||
| 2037 | JSR oswrch ; ...the fifth | |||||||
| 203A | JSR oswrch ; ...the sixth | |||||||
| 203D | JSR oswrch ; A seventh 0: a VDU 0, which does nothing | |||||||
| 2040 | LDA #&17 ; VDU 23,0: write another 6845 register... | |||||||
| 2042 | JSR oswrch ; ...send the 23 | |||||||
| 2045 | LDA #0 ; ...0: a 6845 register follows | |||||||
| 2047 | JSR oswrch ; ...send it | |||||||
| 204A | LDA #6 ; ...register 6, character rows displayed... | |||||||
| 204C | JSR oswrch ; ...send the number | |||||||
| 204F | LDA #&19 ; ...25 rows, as in play | |||||||
| 2051 | JSR oswrch ; ...send the value | |||||||
| 2054 | LDA #0 ; ...then six zeros to finish the command | |||||||
| 2056 | JSR oswrch ; ...the first | |||||||
| 2059 | JSR oswrch ; ...the second | |||||||
| 205C | JSR oswrch ; ...the third | |||||||
| 205F | JSR oswrch ; ...the fourth | |||||||
| 2062 | JSR oswrch ; ...the fifth | |||||||
| 2065 | JSR oswrch ; ...the sixth | |||||||
| ; Logical colours 7 down to 1 black, colour 8 green: the loading ; screen is drawn unseen | ||||||||
| 2068 | LDX #7 ; From logical colour 7 down to 1... | |||||||
| 206A | .blacken_colour←1← 2082 BNE | |||||||
| LDA #&13 ; VDU 19: set a logical colour... | ||||||||
| 206C | JSR oswrch ; ...send the 19 | |||||||
| 206F | TXA ; ...this one... | |||||||
| 2070 | JSR oswrch ; ...send its number | |||||||
| 2073 | LDA #0 ; ...to physical colour 0, black, and three zeros | |||||||
| 2075 | JSR oswrch ; ...send the black | |||||||
| 2078 | JSR oswrch ; ...the first zero | |||||||
| 207B | JSR oswrch ; ...the second | |||||||
| 207E | JSR oswrch ; ...the third | |||||||
| 2081 | DEX ; Next colour down... | |||||||
| 2082 | BNE blacken_colour ; ...until colour 1 is black | |||||||
| 2084 | LDA #&13 ; VDU 19: set a logical colour... | |||||||
| 2086 | JSR oswrch ; ...send the 19 | |||||||
| 2089 | LDA #8 ; ...colour 8... | |||||||
| 208B | JSR oswrch ; ...send its number | |||||||
| 208E | LDA #2 ; ...to physical colour 2, green... | |||||||
| 2090 | JSR oswrch ; ...send it | |||||||
| 2093 | LDA #0 ; ...then three zeros | |||||||
| 2095 | JSR oswrch ; ...the first | |||||||
| 2098 | JSR oswrch ; ...the second | |||||||
| 209B | JSR oswrch ; ...the third | |||||||
| 209E | LDA #&11 ; VDU 17: set the text colour... | |||||||
| 20A0 | JSR oswrch ; ...send the 17 | |||||||
| 20A3 | LDA #8 ; ...colour 8, green | |||||||
| 20A5 | JSR oswrch ; ...send it | |||||||
| ; A text window at the bottom, columns 0-19, rows 22-24 | ||||||||
| 20A8 | LDA #&1c ; VDU 28: set a text window... | |||||||
| 20AA | JSR oswrch ; ...send the 28 | |||||||
| 20AD | LDA #0 ; ...left column 0 | |||||||
| 20AF | JSR oswrch ; ...send it | |||||||
| 20B2 | LDA #&18 ; ...bottom row 24 | |||||||
| 20B4 | JSR oswrch ; ...send it | |||||||
| 20B7 | LDA #&13 ; ...right column 19 | |||||||
| 20B9 | JSR oswrch ; ...send it | |||||||
| 20BC | LDA #&16 ; ...top row 22 | |||||||
| 20BE | JSR oswrch ; ...send it: the window is set | |||||||
| 20C1 | JSR load_files ; Load the loading screen, Dunjunz3 and Dunjunz4 | |||||||
| 20C4 | JMP load_core ; Load Dunjunz5 and start the game; this file is overwritten | |||||||
Load a file through FILEVLoad the file that osfile_block names to the load address in it, by calling the filing system's FILEV routine directly: its address is copied into the operand of this routine's own JSR, then called with A = &FF (load). With *TAPE selected, as TITLE left it, the file comes from the cassette. The caller sets the filename's address and the load address's low two bytes; this routine clears the top two.
|
|||||||||||
| 20C7 | .load_file←3← 20F9 JSR← 211F JSR← 2131 JSR | ||||||||||
| LDX #<(osfile_block) ; X, Y = osfile_block... | |||||||||||
| 20C9 | LDY #>(osfile_block) ; ...its page | ||||||||||
| 20CB | LDA #0 ; The load address's top two bytes are 0... | ||||||||||
| 20CD | STA osfile_load_addr_high ; ...byte 4... | ||||||||||
| 20D0 | STA osfile_load_addr_high + 1 ; ...and byte 5: the I/O processor | ||||||||||
| 20D3 | LDA filev ; Copy FILEV into the JSR below... | ||||||||||
| 20D6 | STA load_file_call_address ; ...its low byte... | ||||||||||
| 20D9 | LDA filev + 1 ; ...and its high byte... | ||||||||||
| 20DC | STA load_file_call_address + 1 ; ...so the JSR calls the filing system's routine | ||||||||||
| 20DF | LDA #&ff ; A = &FF: load the file | ||||||||||
| 20E1 | .load_file_call | ||||||||||
| JSR &3000 ; Call FILEV's routine; the operand, &3000 as stored, is set above | |||||||||||
| 20E4 | RTS ; Return with the file loaded | ||||||||||
Load the loading screen and two game filesLoad Dunjunz2, the loading screen, to &3280; restore the default colours (VDU 20), which shows it at once, clear the text window and set colour 2; then load Dunjunz3 to &6E80 and Dunjunz4 to &08C0. Each file is named by one of the filenames after the code and loaded by load_file.
|
||||||||
| 20E5 | .load_files←1← 20C1 JSR | |||||||
| LDA #<(screen_filename) ; Filename: screen_filename, "Dunjunz2"... | ||||||||
| 20E7 | STA osfile_block ; ...its low byte into the block... | |||||||
| 20EA | LDA #>(screen_filename) ; ...and its page... | |||||||
| 20EC | STA osfile_block + 1 ; ...into byte 1 | |||||||
| 20EF | LDA #<(loading_screen) ; Load address &3280, loading_screen... | |||||||
| 20F1 | STA osfile_load_addr ; ...low byte... | |||||||
| 20F4 | LDA #>(loading_screen) ; ...and page... | |||||||
| 20F6 | STA osfile_load_addr + 1 ; ...into bytes 2-3 | |||||||
| 20F9 | JSR load_file ; Load the loading screen, in black | |||||||
| 20FC | LDA #&14 ; VDU 20: the default colours... | |||||||
| 20FE | JSR oswrch ; ...so the loading screen appears | |||||||
| 2101 | LDA #&0c ; VDU 12: clear the text window... | |||||||
| 2103 | JSR oswrch ; ...send it | |||||||
| 2106 | LDA #&11 ; VDU 17: set the text colour... | |||||||
| 2108 | JSR oswrch ; ...send the 17 | |||||||
| 210B | LDA #2 ; ...colour 2, green | |||||||
| 210D | JSR oswrch ; ...send it | |||||||
| 2110 | LDA #<(dunjunz3_filename) ; Filename: dunjunz3_filename (same page)... | |||||||
| 2112 | STA osfile_block ; ...into the block | |||||||
| 2115 | LDA #<(dunjunz3_start) ; Load address &6E80, dunjunz3_start... | |||||||
| 2117 | STA osfile_load_addr ; ...low byte... | |||||||
| 211A | LDA #>(dunjunz3_start) ; ...and page... | |||||||
| 211C | STA osfile_load_addr + 1 ; ...into bytes 2-3 | |||||||
| 211F | JSR load_file ; Load Dunjunz3, the game's &6E80-&7FFF | |||||||
| 2122 | LDA #<(dunjunz4_filename) ; Filename: dunjunz4_filename (same page)... | |||||||
| 2124 | STA osfile_block ; ...into the block | |||||||
| 2127 | LDA #<(dunjunz4_start) ; Load address &08C0, dunjunz4_start... | |||||||
| 2129 | STA osfile_load_addr ; ...low byte... | |||||||
| 212C | LDA #>(dunjunz4_start) ; ...and page... | |||||||
| 212E | STA osfile_load_addr + 1 ; ...into bytes 2-3 | |||||||
| 2131 | JSR load_file ; Load Dunjunz4, the game's &08C0-&1FFF | |||||||
| 2134 | RTS ; Return to loader_start | |||||||
UnusedLeftover bytes from the machine the file was saved on: the end of a filename and fragments of code. |
|
| 2135 | EQUB &6F, &6E, &32, &0D, ; Not referenced: "on2", a CR, &F4, &FF, &A9, &D5, ; then leftover bytes &A2, &64, &20 |
Filename: Dunjunz2The name of Dunjunz2, the loading screen, CR-terminated. |
|
| 2140 | .screen_filename |
| EQUS "Dunjunz2", &0D ; "Dunjunz2" and a CR | |
UnusedLeftover bytes. |
|
| 2149 | EQUB &AD, &0E, &02, &8D, &D3, &12, &AD ; Not referenced |
Filename: Dunjunz3The name of Dunjunz3, the game's &6E80-&7FFF, CR-terminated. |
|
| 2150 | .dunjunz3_filename |
| EQUS "Dunjunz3", &0D ; "Dunjunz3" and a CR | |
UnusedLeftover bytes. |
|
| 2159 | EQUB &02, &A9, &7F, &8D, &0F, &02, &60 ; Not referenced |
Filename: Dunjunz4The name of Dunjunz4, the game's &08C0-&1FFF, CR-terminated. |
|
| 2160 | .dunjunz4_filename |
| EQUS "Dunjunz4", &0D ; "Dunjunz4" and a CR | |
