; Phoenix (Nova 800) ROM Disassembly ; 0000-049b First stage of initialization ; 049c-04bf BIOS Entry point in ROM, call a BIOS function by its number ; 04c0-0513 Address table of BIOS functions ; 0514-054c Global Interrupt Handler ; 054d-061c Init BIOS devices redirectors, following I/O byte ; 061d-0670 TTY driver routines ; 0671-0724 ... two CRT output routines inserted here... ; 0725-07bb TTY Receive Interrupt Handler ; 07bc-07ff UC1 driver routines ; 0800-087f UC1 Receive Interrupt Handler ; 0880-08d0 BAT(ch) driver routines ; 08d1-0936 LPT Interrupt Handler ; 0937-0a7f Second stage of initialization ; 0a80-103e Floppy driver (and Ramdisk routines) ; 103f-1821 CRT driver routines ; 1822-1c80 RTC routines (time/date and backup-ed configuration) ; 1c81-2142 Initialize the user-defined set of characters ; 2143-31b4 BDOS functions (transfered to e406) ; 31b5-32b4 Page #ff (transfered to ff00) ; 32b5-3fff Unused ;****************************************************************************** ; Initialization 0000 c30001 jp #0100 0003 a0 and b 0004 00 nop 0005 00 nop ... 005c 00 nop 005d 50 48 45 20 20 20 20 52 4f 4d "PHE ROM" 0068 00 nop ... 006c 00 nop 006d 20 20 20 20 20 20 20 20 20 20 " " 0078 00 nop ... 007f 00 nop 0080 07 0081 50 48 45 2E 52 4F 4D "PHE.ROM" 0088 0d 0089 00 nop ... 00ff 00 nop 0100 f3 di 0101 0600 ld b,#00 0103 10fe djnz #0103 ; wait a millisecond 0105 ed3854 in0 a,(#54) ; ROM select ?? (but we are already running rom...) 0108 ed3880 in0 a,(#80) ; ?? ; This rom must be a development version : parallel port is used ; during boot time as a debugging port. ; As checkpoints are passed, successive values are written to it ; to show last checkpoint attained. Could be very practical with a ; small LED or LCD device on parallel port... 010b af xor a 010c ed3964 out0 (PARPORT),a ; Checkpoint #0 passed 010f 21b803 ld hl,#03b8 0112 0e3f ld c,#3f 0114 0640 ld b,#40 0116 ed9b otdmr ; init all internal I/O ports (see table in #378-#3b8) 0118 3e28 ld a,#28 ; access VDP command register 011a ed3944 out0 (VDP_REGSEL),a 011d 3e91 ld a,#91 ; VDP NOP command, allows to stop command currently executing 011f ed3946 out0 (VDP_WRITE),a ; for now, ram hasn't been checked, hence the stack can not be used ; and no subroutine calls can be done. So, jumps are used instead with ; HL initialized as the return address... 0122 0e95 ld c,#95 ; vertical sync mask reset command 0124 212901 ld hl,#0129 ; go to address #0129 after the routine in #0154 0127 182b jr #0154 0129 0ed0 ld c,#d0 ; 625 lines, non interlaced, composite sync, 80 char long codes 012b 3e81 ld a,#81 ; written to indirect register 1 (TGS) 012d 213201 ld hl,#0132 0130 1819 jr #014b 0132 0e70 ld c,#70 ; no service row, no upper or lower bulk, active area mark, flashing enabled 0134 3e83 ld a,#83 ; written to indirect register 3 (PAT) 0136 213b01 ld hl,#013b 0139 1810 jr #014b 013b 0e76 ld c,#76 ; color c0 = cyan, color c1 = white 013d 3e84 ld a,#84 ; written to indirect register 4 (DOR) 013f 214401 ld hl,#0144 0142 1807 jr #014b 0144 0e00 ld c,#00 ; no margin, cursor disabled, single height 0146 3e82 ld a,#82 ; written to indirect register 2 (MAT) 0148 216901 ld hl,#0169 ; go on to address #0169 after the following routine ; send a command to the EF9345 and first initialize the parameter ; parameter in register C is written to R1 ; then command in register A is written to R0 (command register) 014b 1e21 ld e,#21 014d ed1944 out0 (VDP_REGSEL),e 0150 ed0946 out0 (VDP_WRITE),c 0153 4f ld c,a ; send a command to the EF9345 with no parameter ; (command in register C) 0154 1e28 ld e,#28 ; access command register 0156 ed1944 out0 (VDP_REGSEL),e 0159 ed0946 out0 (VDP_WRITE),c 015c 3e20 ld a,#20 ; access status register (XQR=0) 015e ed3944 out0 (VDP_REGSEL),a 0161 ed3845 in0 a,(VDP_READ) ; read status register 0164 e680 and #80 0166 20f9 jr nz,#0161 ; repeat until busy bit not set 0168 e9 jp (hl) ; ram test : first test #4000-#FFFF 0169 3e01 ld a,#01 016b ed3964 out0 (PARPORT),a ; Checkpoint #1 passed, now start ram test... 016e 1100c0 ld de,#c000 0171 210040 ld hl,#4000 0174 3eaa ld a,#aa 0176 77 ld (hl),a 0177 be cp (hl) 0178 c20f03 jp nz,#030f 017b cb3f srl a 017d 77 ld (hl),a 017e be cp (hl) 017f c20f03 jp nz,#030f 0182 7d ld a,l 0183 84 add a,h 0184 77 ld (hl),a 0185 23 inc hl 0186 1b dec de 0187 7b ld a,e 0188 b2 or d 0189 20e9 jr nz,#0174 018b 1100c0 ld de,#c000 018e 210040 ld hl,#4000 0191 7d ld a,l 0192 84 add a,h 0193 be cp (hl) 0194 c20f03 jp nz,#030f 0197 af xor a 0198 77 ld (hl),a 0199 23 inc hl 019a 1b dec de 019b 7b ld a,e 019c b2 or d 019d 20f2 jr nz,#0191 019f 3e02 ld a,#02 01a1 ed3964 out0 (PARPORT),a ; Checkpoint #2 : ram test ok ; ram is ok, stack can be set to end of memory ; and some parts of the rom can be copied too 01a4 31fdfe ld sp,#fefd 01a7 dd2178f4 ld ix,#f478 01ab 3eff ld a,#ff 01ad ed47 ld i,a ; interrupt vectors in #ffxx 01af 21b531 ld hl,#31b5 01b2 1100ff ld de,#ff00 01b5 010001 ld bc,#0100 01b8 edb0 ldir ; copy 256 bytes from #31b5 to #ff00 (interrupt vectors and handlers) ; zero ram from #f478 to #f5e3 01ba 2178f4 ld hl,#f478 01bd 016b01 ld bc,#016b 01c0 af xor a 01c1 77 ld (hl),a 01c2 23 inc hl 01c3 0b dec bc 01c4 b0 or b 01c5 b1 or c 01c6 20f8 jr nz,#01c0 01c8 3e03 ld a,#03 01ca ed3964 out0 (PARPORT),a ; checkpoint #3 passed 01cd 3e54 ld a,#54 01cf ed393a out0 (MMU_CBAR),a ; set up a 4K Bank Area in #4000 ; put a signature in every 64K block of physical memory 01d2 0608 ld b,#08 ; loop for 8 x 64K 01d4 cd3003 call #0330 01d7 320040 ld (#4000),a 01da eee5 xor #e5 01dc 320140 ld (#4001),a 01df 10f3 djnz #01d4 ; test if 256 or 512 K are installed 01e1 3e40 ld a,#40 01e3 ed3939 out0 (MMU_BBR),a ; show ram after first 256K in the bank area 01e6 3a0140 ld a,(#4001) 01e9 eee5 xor #e5 01eb 0604 ld b,#04 ; 4 x 64 K = 256 K 01ed b8 cp b 01ee 2002 jr nz,#01f2 01f0 0608 ld b,#08 ; 8 x 64 K = 512 K 01f2 af xor a 01f3 4f ld c,a 01f4 cd3003 call #0330 01f7 6f ld l,a 01f8 3a0040 ld a,(#4000) 01fb 67 ld h,a 01fc ed6c mlt hl 01fe 79 ld a,c 01ff 85 add a,l 0200 10f1 djnz #01f3 0202 0605 ld b,#05 0204 211503 ld hl,#0315 0207 be cp (hl) 0208 2809 jr z,#0213 020a 23 inc hl 020b 23 inc hl 020c 23 inc hl 020d 10f8 djnz #0207 020f cbf8 set 7,b 0211 180a jr #021d 0213 23 inc hl 0214 7e ld a,(hl) 0215 dd7719 ld (ix+#19),a 0218 23 inc hl 0219 7e ld a,(hl) 021a dd771a ld (ix+#1a),a 021d 78 ld a,b 021e dd7718 ld (ix+#18),a 0221 0e04 ld c,#04 0223 ed0964 out0 (PARPORT),c ; checkpoint #4 passed ; transfer rom from #2143-#31b4 to #e406-#f477 0226 214321 ld hl,#2143 0229 1106e4 ld de,#e406 022c 017210 ld bc,#1072 022f edb0 ldir ; check the extended memory 0231 b7 or a 0232 fad902 jp m,#02d9 0235 3e05 ld a,#05 0237 ed3964 out0 (PARPORT),a ; checkpoint #5 passed 023a ddcb17ee set 5,(ix+#17) ; page 1 => no status line 023e 214003 ld hl,#0340 0241 cd7106 call #0671 ; display "Testing " message 0244 0e00 ld c,#00 0246 3e84 ld a,#84 0248 ed393a out0 (MMU_CBAR),a ; set up a Bank Area in #4000-#7fff 024b dd7e19 ld a,(ix+#19) 024e cb27 sla a 0250 cb27 sla a 0252 cb27 sla a 0254 cb27 sla a 0256 47 ld b,a 0257 d604 sub #04 0259 ed3939 out0 (MMU_BBR),a 025c e60f and #0f 025e fe0c cp #0c 0260 2015 jr nz,#0277 0262 c5 push bc 0263 215103 ld hl,#0351 0266 0600 ld b,#00 0268 09 add hl,bc 0269 cd7106 call #0671 ; display 128,192,256... message 026c 216d03 ld hl,#036d 026f cd7106 call #0671 ; and " K" message 0272 c1 pop bc 0273 0c inc c 0274 0c inc c 0275 0c inc c 0276 0c inc c 0277 cd8602 call #0286 027a 2059 jr nz,#02d5 027c 78 ld a,b 027d c604 add a,#04 027f ddbe1a cp (ix+#1a) 0282 38d2 jr c,#0256 0284 1831 jr #02b7 ; check 16K of extended ram, first make sure contents can be set 0286 210040 ld hl,#4000 0289 110040 ld de,#4000 028c 3eaa ld a,#aa ; 10101010 bit pattern 028e 77 ld (hl),a 028f be cp (hl) 0290 c0 ret nz 0291 cb3f srl a ; 01010101 bit pattern 0293 77 ld (hl),a 0294 be cp (hl) 0295 c0 ret nz 0296 78 ld a,b ; then a bank dependent value 0297 85 add a,l 0298 84 add a,h 0299 77 ld (hl),a 029a 23 inc hl 029b 1b dec de 029c 7b ld a,e 029d b2 or d 029e c28c02 jp nz,#028c ; then verify ram keeps its contents, and fill it with $e5 values ; (empty directory marker) 02a1 210040 ld hl,#4000 02a4 110040 ld de,#4000 02a7 78 ld a,b 02a8 85 add a,l 02a9 84 add a,h 02aa be cp (hl) 02ab c0 ret nz 02ac 3ee5 ld a,#e5 02ae 77 ld (hl),a 02af 23 inc hl 02b0 1b dec de 02b1 7b ld a,e 02b2 b2 or d 02b3 c2a702 jp nz,#02a7 02b6 c9 ret ; 02b7 3e06 ld a,#06 ; extended ram check finished, checkpoint #6 passed 02b9 ed3964 out0 (PARPORT),a ; initialize ramdisk size 02bc dd5e18 ld e,(ix+#18) 02bf 1600 ld d,#00 02c1 cb23 sla e 02c3 212403 ld hl,#0324 02c6 19 add hl,de 02c7 7e ld a,(hl) 02c8 23 inc hl 02c9 66 ld h,(hl) 02ca 6f ld l,a 02cb 225af4 ld (#f45a),hl ; update max allocation block number of ramdisk 02ce 3e2c ld a,#2c 02d0 3274f4 ld (#f474),a ; set drive M as of RAMDISK type 02d3 1804 jr #02d9 02d5 ddcb16fe set 7,(ix+#16) 02d9 af xor a 02da ed3939 out0 (MMU_BBR),a 02dd 217503 ld hl,#0375 ; clear screen sequence 02e0 cd7106 call #0671 ; display this sequence => clear screen 02e3 cd4b1b call #1b4b ; read the BIOS configuration data from RTC's RAM, return Carry if RTC was erroneous 02e6 cd2218 call #1822 ; init RTC time/date with defaults (if previous read was unsuccessful) 02e9 cd5e1c call #1c5e ; initialize Disk Parameter Block from BIOS configuration 02ec cd811c call #1c81 ; transfer character definitions to the VDP 02ef af xor a ; reset floppy command 02f0 cda30d call #0da3 ; floppy routine 02f3 cd4d05 call #054d ; init BIOS redirectors depending on I/O byte 02f6 cd1d06 call #061d ; init ASCI channel 0 02f9 3e3e ld a,#3e 02fb ed3934 out0 (INT_ITC),a ; enable INT1 (parallel port) and INT2 (RTC) interrupts 02fe fb ei 02ff cdb903 call #03b9 ; if skip boot screen flag is set, returns with value 0 to 7 in BC ; and crash with any value from 1 to 7 since only a single address ; is in the table at 030d, ; otherwise display NOVA800 screen and insert disk message, returns with bc=0000 0302 cb21 sla c 0304 210d03 ld hl,#030d ; indirect jump to (030d)=0944 0307 09 add hl,bc 0308 7e ld a,(hl) 0309 23 inc hl 030a 66 ld h,(hl) 030b 6f ld l,a 030c e9 jp (hl) 030d dw #0944 ; goes here in case ram check fails ; and shows #81 on the parallel port 030f 3e81 ld a,#81 0311 ed3964 out0 (PARPORT),a 0314 76 halt ; table of five key-values entries, ; second byte is stored in (ix+#19), third byte in (ix+#1a) 0315 byte #8c, #01, #80 byte #66, #01, #50 byte #7e, #04, #80 byte #0e, #01, #40 byte #58, #04, #50 ; Maximum allocation block number table for ramdisk, ; depending on detected memory size ; => 176 KB ramdisk when 256 KB ram total 0324 dw #0000, #0017, #0057, #0077, #0077, #00d7 ; set up the Bank Base Register to (B-1) x 64 K 0330 78 ld a,b 0331 3d dec a 0332 f5 push af 0333 cb27 sla a 0335 cb27 sla a 0337 cb27 sla a 0339 cb27 sla a 033b ed3939 out0 (MMU_BBR),a 033e f1 pop af 033f c9 ret 0340 14 0341 1b 43 33 0344 1b 43 30 0347 20 54 65 73 74 69 6e 67 20 00 " Testing " 0351 31 32 38 00 "128" 0355 31 39 32 00 "192" 0359 32 35 36 00 "256" 035d 33 32 30 00 "320" 0361 33 38 34 00 "384" 0365 34 34 38 00 "448" 0369 35 31 32 00 "512" 036d 4b 20 08 08 08 08 08 00 "K " 0375 1A 1B 31 00 ; clear screen sequence ; table for the setup of internal I/O ports : 0379 db 10 ; ASCI_CNTLA0 : channel 0 receiver & transmitter disabled for now, -RTS=1 db 64 ; ASCI_CNTLA1 : channel 1 receiver & transmitter enabled, -RTS=0, 8-bit data, no parity, 1 stop bit db 01 ; ASCI_CNTLB0 : channel 0 configured at 6.144MHz / 10 / 16 / 2 = 19200 bauds db 01 ; ASCI_CNTLB1 : channel 1 divide ratio = 2 => 19200 bauds db 00 ; ASCI_STAT0 : channel 0 receive interrupt disabled for now db 08 ; ASCI_STAT1 : channel 1 receive interrupt enabled db 00 ; ASCI_TDR0 db 00 ; ASCI_TDR1 db 00 ; ASCI_RDR0 db 00 ; ASCI_RDR1 db 10 ; CSIO_CNTR : transmit enabled, 307200 bauds db FF ; CSIO_TRDR : data (=> continuous flow of 1 values, used for DTR) db 00 ; TIMER_TMDR0L db 00 ; TIMER_TMDR0H db 00 ; TIMER_RLDR0L db 00 ; TIMER_RLDR0H db 00 ; TIMER_TCR db 00 ; RESERVED db 00 ; RESERVED db 00 ; RESERVED db 00 ; TIMER_TMDR1L db 00 ; TIMER_TMDR1H db 00 ; TIMER_RLDR1L db 00 ; TIMER_RLDR1H db 00 ; TIMER_FRC db 00 ; RESERVED db 00 ; RESERVED db 00 ; RESERVED db 00 ; RESERVED db 00 ; RESERVED db 00 ; RESERVED db 00 ; RESERVED db 00 ; DMA_SAR0L db 00 ; DMA_SAR0H db 00 ; DMA_SAR0B db 00 ; DMA_DAR0L db 00 ; DMA_DAR0H db 00 ; DMA_DAR0B db 00 ; DMA_BCR0L db 00 ; DMA_BCR0H db 00 ; DMA_MAR1L db 00 ; DMA_MAR1H db 00 ; DMA_MAR1B db 00 ; DMA_IAR1L db 00 ; DMA_IAR1H db 00 ; RESERVED db 00 ; DMA_BCR1L db 00 ; DMA_BCR1H db 32 ; DMA_DSTAT db C1 ; DMA_DMODE db 70 ; DMA_DCNTL : Wait states : 1 for memory access (and DMA), 4 for I/O (except some internal) db 00 ; INT_IL db 38 ; INT_ITC : reserved bits db 00 ; RESERVED db BF ; REFRESH_RCR : enable refresh cycle (2 clocks) insertion every 80 states db 00 ; RESERVED db 00 ; MMU_CBR db 00 ; MMU_BBR db F0 ; MMU_CBAR : no Common Area 0, Common Area 1 = #F000-#FFFF db 00 ; RESERVED db 00 ; RESERVED db 00 ; RESERVED db 00 ; IO_OMCR : LIRE=0, IOC=0 db 1f ; IO_ICR : internal IOs in #00-#3f 03b9 dd7e1e ld a,(ix+#1e) 03bc cb7f bit 7,a ; skip boot screen ? 03be 2806 jr z,#03c6 03c0 e607 and #07 03c2 4f ld c,a 03c3 0600 ld b,#00 03c5 c9 ret 03c6 21d903 ld hl,#03d9 03c9 cd7106 call #0671 ; display NOVA800 frame 03cc 212b04 ld hl,#042b 03cf cd7106 call #0671 ; display "INSERT SYSTEM DISK..." 03d2 cdc607 call #07c6 ; wait for a key 03d5 010000 ld bc,#0000 03d8 c9 ret 03d9 1A 14 FF 0D 0A 0D 0A 03e0 1B 43 33 1B 43 31 1B 43-30 20 20 20 20 20 20 20 .C3.C1.C0 03f0 20 20 20 20 20 20 20 20-0D 0A 20 4E 20 4F 20 56 .. N O V 0400 20 41 20 20 20 38 30 30-20 0D 0A 1B 42 31 20 20 A 800 ...B1 0410 20 20 20 20 20 20 20 20-20 20 20 20 20 1B 42 30 .B0 0420 1B 42 33 0D 0A FF 0D 0A-0D 0A 00 1B 3D 29 20 49 .B3.........=) I 0430 4E 53 45 52 54 20 53 59-53 54 45 4D 20 44 49 53 NSERT SYSTEM DIS 0440 4B 45 54 54 45 20 49 4E-20 44 52 49 56 45 20 41 KETTE IN DRIVE A 0450 3A 20 41 4E 44 20 50 52-45 53 53 20 3C 1B 43 30 : AND PRESS <.C0 0460 1B 43 32 52 45 54 55 52-4E 1B 42 30 1B 42 32 3E .C2RETURN.B0.B2> 0470 1B 3D 23 5A 56 45 52 53-49 4F 4E 20 32 2E 30 31 .=#ZVERSION 2.01 0480 32 1B 3D 24 58 28 43 29-20 31 39 38 36 2C 31 39 2.=$X(C) 1986,19 0490 38 37 20 4D 43 42 1B 3D-36 20 FF 00 87 MCB.=6 . ;****************************************************************************** ; BIOS Entry point in ROM ; call BIOS function, function number * 2 in L ; and I/O byte in A 049c dde5 push ix 049e fde5 push iy 04a0 dd2178f4 ld ix,#f478 04a4 ddbe00 cp (ix+#00) 04a7 c45005 call nz,#0550 04aa d5 push de 04ab 2600 ld h,#00 04ad 11c004 ld de,#04c0 04b0 19 add hl,de 04b1 7e ld a,(hl) 04b2 23 inc hl 04b3 66 ld h,(hl) 04b4 6f ld l,a 04b5 d1 pop de 04b6 cdbf04 call #04bf ; indirect call to address HL 04b9 fde1 pop iy 04bb dde1 pop ix 04bd fb ei 04be c9 ret 04bf e9 jp (hl) ; table of BIOS functions 04c0 dw 0944 ; 00 : BOOT : cold start dw 09b9 ; 02 : WBOOT : warm boot - reload command processor dw ff1b ; 04 : console status dw ff18 ; 06 : console input dw ff12 ; console output dw ff2a ; printer output dw ff24 ; paper tape punch output (-> TTY) dw ff1e ; paper tape reader input (<- TTY) dw 0a84 ; move disc head to track 0 dw 0a9e ; select disk drive dw 0a90 ; set track number dw 0a80 ; set sector number dw 0a94 ; set dma address dw 0ae5 ; read a sector dw 0aef ; write a sector dw ff2d ; status of list device dw 0a9b ; sector translation for skewing dw ff15 ; status of console output dw ff21 ; status of auxiliary input (TTY) dw ff27 ; status of auxiliary output (TTY) dw 0014 ; not implemented dw 0015 ; not implemented dw 0016 ; not implemented dw 0017 ; not implemented dw 0018 ; not implemented dw 0019 ; not implemented dw 001a ; not implemented dw 001b ; not implemented dw 001c ; not implemented dw 001d ; not implemented dw 001e ; not implemented dw 001f ; not implemented dw 0020 ; not implemented dw 1c6a ; get/set date/time dw 0bed ; read track routine dw 0bf1 ; write track (format) routine dw 1b6d ; copy default BIOS configuration data from rom dw 1b4b ; read the BIOS configuration data from RTC's RAM dw 1b84 ; write the BIOS configuration data to the RTC's RAM dw 0027 ; not implemented dw 0658 ; set DTR state (or read DSR state if C=00) dw 0be9 ; read sector routine ;****************************************************************************** ; common interrupt handler in rom ; reg A contains the low byte of the interrupt vector 0514 c5 push bc ; 11 cycles 0515 d5 push de ; 11 0516 e5 push hl ; 11 0517 dde5 push ix ; 15 0519 dd2178f4 ld ix,#f478 ; 14 051d fde5 push iy ; 15 051f 213b05 ld hl,#053b ; 10 0522 5f ld e,a ; 4 0523 1600 ld d,#00 ; 7 0525 19 add hl,de ; 11 0526 7e ld a,(hl) ; 7 0527 23 inc hl ; 6 0528 66 ld h,(hl) ; 7 0529 6f ld l,a ; 4 052a cdbf04 call #04bf ; indirect call to HL ; 17 052d fde1 pop iy ; 14 052f dde1 pop ix ; 14 0531 e1 pop hl ; 10 0532 d1 pop de ; 10 0533 c1 pop bc ; 10 0534 3afbff ld a,(#fffb) ; 13 0537 b7 or a ; 4 0538 3ec3 ld a,#c3 ; 7 053a c9 ret ; 10 ; => 242 cycles 053b dw #08d1 ; INT1 interrupt handler 053d dw #1872 ; INT2 interrupt handler 053f dw #0000 ; no interrupt handler for PRT channel 0 0541 dw #0000 ; no interrupt handler for PRT channel 1 0543 dw #0000 ; no interrupt handler for DMA channel 0 0545 dw #0000 ; no interrupt handler for DMA channel 1 0547 dw #0000 ; no interrupt handler for SCIO 0549 dw #0725 ; ASCI channel 0 interrupt handler 054b dw #0800 ; ASCI channel 1 interrupt handler ;****************************************************************************** ; init BIOS redirectors, following I/O byte 054d dd7e35 ld a,(ix+#35) ; init some BIOS redirectors in ram 0550 e5 push hl 0551 d5 push de 0552 c5 push bc 0553 dd7700 ld (ix+#00),a 0556 1112ff ld de,#ff12 ; console output 0559 01a505 ld bc,#05a5 055c cd9705 call #0597 055f 1118ff ld de,#ff18 ; console input 0562 01bd05 ld bc,#05bd 0565 cd9705 call #0597 0568 111eff ld de,#ff1e ; paper tape reader input 056b 01d505 ld bc,#05d5 056e 2e01 ld l,#01 0570 cd8d05 call #058d 0573 1124ff ld de,#ff24 ; paper tape punch output 0576 01ed05 ld bc,#05ed 0579 2e02 ld l,#02 057b cd8d05 call #058d 057e 112aff ld de,#ff2a ; printer output 0581 010506 ld bc,#0605 0584 2e03 ld l,#03 0586 cd8d05 call #058d 0589 c1 pop bc 058a d1 pop de 058b e1 pop hl 058c c9 ret 058d dd7e00 ld a,(ix+#00) 0590 cb2f sra a 0592 cb2f sra a 0594 2d dec l 0595 20f9 jr nz,#0590 ; transfer 6 bytes from A*6+BC to DE 0597 e603 and #03 0599 6f ld l,a 059a 2606 ld h,#06 059c ed6c mlt hl 059e 09 add hl,bc 059f 010600 ld bc,#0006 05a2 edb0 ldir 05a4 c9 ret ; two CONSOLE redirectors copied from this table to ff12 and ff15 05a5 c31b07 jp #071b ; TTY: output 05a8 c30607 jp #0706 ; TTY: output status 05ab c33f10 jp #103f ; CRT: output 05ae c38610 jp #1086 ; CRT: output status 05b1 c39808 jp #0898 ; BAT: -> LPT: output 05b4 c38008 jp #0880 ; BAT: -> LPT: output status 05b7 c3ed07 jp #07ed ; UC1: output 05ba c3f707 jp #07f7 ; UC1: output status ; two CONSOLE redirectors copied from this table to ff18 and ff1b 05bd c3b806 jp #06b8 ; TTY: input 05c0 c3ac06 jp #06ac , TTY: status 05c3 c3c607 jp #07c6 ; CRT: input 05c6 c3bc07 jp #07bc ; CRT: status 05c9 c30000 jp #0000 ; BAT: input 05cc c30000 jp #0000 ; BAT: status 05cf c3c607 jp #07c6 ; UC1: input 05d2 c3bc07 jp #07bc ; UC1: status ; two READER redirectors copied from this table to ff1e and ff21 05d5 c3b806 jp #06b8 ; TTY: input 05d8 c3ac06 jp #06ac ; TTY: status 05db c30000 jp #0000 05de c30000 jp #0000 05e1 c30000 jp #0000 05e4 c30000 jp #0000 05e7 c30000 jp #0000 05ea c30000 jp #0000 ; two PUNCH redirectors copied from this table to ff24 and ff27 05ed c31b07 jp #071b ; TTY: output 05f0 c30607 jp #0706 ; TTY: output status 05f3 c30000 jp #0000 05f6 c30000 jp #0000 05f9 c30000 jp #0000 05fc c30000 jp #0000 05ff c30000 jp #0000 0602 c30000 jp #0000 ; two LIST redirectors copied from this table to ff2a and ff2d 0605 c31b07 jp #071b ; TTY: output 0608 c30607 jp #0706 ; TTY: output status 060b c33f10 jp #103f ; CRT: output 060e c38610 jp #1086 ; CRT: output status 0611 c39808 jp #0898 ; LPT: output 0614 c38008 jp #0880 ; LPT: status 0617 c30000 jp #0000 061a c30000 jp #0000 ;****************************************************************************** ; configure ASCI Channel #0 following value in f494 061d dd5e1c ld e,(ix+#1c) 0620 7b ld a,e 0621 e60f and #0f 0623 4f ld c,a 0624 0600 ld b,#00 0626 219c06 ld hl,#069c 0629 09 add hl,bc 062a 7e ld a,(hl) 062b cb7b bit 7,e 062d 2802 jr z,#0631 062f cbe7 set 4,a ; set odd parity 0631 ed3902 out0 (ASCI_CNTLB0),a ; set baud rate 0634 7b ld a,e 0635 cb3f srl a 0637 cb3f srl a 0639 cb3f srl a 063b cb3f srl a 063d e607 and #07 063f f670 or #70 ; enable receiver & transmitter ; but hold -RTS high 0641 ed3900 out0 (ASCI_CNTLA0),a ; set data format 0644 5f ld e,a 0645 af xor a 0646 cd5f06 call #065f ; -DTR = 0 0649 0600 ld b,#00 064b 10fe djnz #064b 064d 3e08 ld a,#08 ; enable receive interrupts 064f ed3904 out0 (ASCI_STAT0),a 0652 cba3 res 4,e ; -RTS = 0 0654 ed1900 out0 (ASCI_CNTLA0),e 0657 c9 ret ; if C=00, read DSR state ; otherwise use the CSIO channel to emit DTR state 0658 79 ld a,c 0659 a7 and a 065a 280c jr z,#0668 065c 3eff ld a,#ff 065e a8 xor b 065f ed390b out0 (CSIO_TRDR),a 0662 3e18 ld a,#18 0664 ed390a out0 (CSIO_CNTR),a 0667 c9 ret 0668 ed3840 in0 a,(DSR_STATE) 066b e680 and #80 066d c8 ret z 066e 3eff ld a,#ff 0670 c9 ret ;****************************************************************************** ; Two CRT output routines have been inserted here... ; 1. Display a nul-terminated string starting from HL ; (a $FF byte is displayed as a line of 80 underscore characters) 0671 113f10 ld de,#103f 0674 1803 jr #0679 0676 1112ff ld de,#ff12 0679 7e ld a,(hl) 067a 4f ld c,a 067b 3c inc a 067c 280d jr z,#068b 067e 3d dec a 067f c8 ret z 0680 d5 push de 0681 e5 push hl 0682 eb ex de,hl 0683 cdbf04 call #04bf 0686 e1 pop hl 0687 d1 pop de 0688 23 inc hl 0689 18ee jr #0679 ; display a line of 80 underscore (#5f) characters 068b 015f50 ld bc,#505f 068e c5 push bc 068f d5 push de 0690 e5 push hl 0691 eb ex de,hl 0692 cdbf04 call #04bf 0695 e1 pop hl 0696 d1 pop de 0697 c1 pop bc 0698 10f4 djnz #068e 069a 18ec jr #0688 ; parameter table for ASCI_CNTLB0 069c db 2e ; 6.144 MHz / 30 / 64 / 64 = 50 baud db ff db ff db ff db 0e ; 6.144 MHz / 10 / 64 / 64 = 150 baud db 0d ; 6.144 MHz / 10 / 64 / 32 = 300 baud db 0c ; 6.144 MHz / 10 / 64 / 16 = 600 baud db 0b ; 6.144 MHz / 10 / 64 / 8 = 1200 baud db ff db 0a ; 6.144 MHz / 10 / 64 / 4 = 2400 baud db ff db 09 ; 6.144 MHz / 10 / 64 / 2 = 4800 baud db ff db 08 ; 6.144 MHz / 10 / 64 / 1 = 9600 baud db 01 ; 6.144 MHz / 10 / 16 / 2 = 19200 baud db 00 ; 6.144 MHz / 10 / 16 / 1 = 38400 baud ; get TTY (input) status : return A=0 if no character in buffer 06ac f3 di 06ad ed5bccf4 ld de,(#f4cc) 06b1 7b ld a,e 06b2 b2 or d 06b3 fb ei 06b4 c8 ret z 06b5 3eff ld a,#ff 06b7 c9 ret ; get TTY input 06b8 cdac06 call #06ac 06bb b7 or a 06bc 28fa jr z,#06b8 06be f3 di 06bf ed5bccf4 ld de,(#f4cc) ; nb of chars in buffer 06c3 cddd06 call #06dd ; check for flow re-enable 06c6 1b dec de 06c7 ed53ccf4 ld (#f4cc),de 06cb 21d2f4 ld hl,#f4d2 06ce ed5bd0f4 ld de,(#f4d0) 06d2 19 add hl,de 06d3 cdb507 call #07b5 ; increment pointer (modulo 64) 06d6 ed53d0f4 ld (#f4d0),de 06da 7e ld a,(hl) 06db fb ei 06dc c9 ret ; check if receiver flow must be re-enabled 06dd 212000 ld hl,#0020 ; is buffer half-empty ? 06e0 b7 or a 06e1 ed52 sbc hl,de 06e3 c0 ret nz 06e4 ddcb1d7e bit 7,(ix+#1d) ; is XON/XOFF protocol active ? 06e8 2813 jr z,#06fd ; skip if hardware flow control ; XON/XOFF protocol active => try to send XON ; everytime the buffer has 32 characters in it, even if flow ; has not been stopped... ; Bug!!! This loop in uninterruptible mode may last as long as ; one character transmission and is thus responsible for the ; loss of receive interrupts !! ; A flag should be used in the same way one tells if the transmitting ; flow is suspended... (for example bit 6 of ix+#4d could be used) ; test CTS state to see if XON can be sent 06ea ed3802 in0 a,(ASCI_CNTLB0) 06ed cb6f bit 5,a ; -CTS state 06ef c0 ret nz ; return if -CTS=1 06f0 ed3804 in0 a,(ASCI_STAT0) 06f3 cb4f bit 1,a 06f5 28f3 jr z,#06ea ; wait until TDRE (or exit if -CTS=1) 06f7 3e11 ld a,#11 ; send the XON character 06f9 ed3906 out0 (ASCI_TDR0),a 06fc c9 ret ; hardware flow control => low-enable RTS (RTR) ; (ie. assumes RTS is crossed to CTS on the connected device) 06fd ed3800 in0 a,(ASCI_CNTLA0) 0700 cba7 res 4,a 0702 ed3900 out0 (ASCI_CNTLA0),a ; Warning: bit 3 rewritten to zero clears all errors (including overrun) 0705 c9 ret ; TTY output status: ; Return A=0 if Transmit Data Register is not empty (transmission in progress), ; or if flow control is enabled and flow is stopped on TTY. ; Otherwise return A=-1 if status is ok. ; 0706 ddcb1d7e bit 7,(ix+#1d) ; flow control enabled ? 070a 2806 jr z,#0712 ; skip if not 070c af xor a ; prepare A=0 070d ddcb4d7e bit 7,(ix+#4d) ; bit 7 means XOFF (flow control suspended) 0711 c0 ret nz ; return A=0 if transmitter flow is not currently suspended ; -CTS is not checked, but the HD64180/Z80180 automatically ; clears TDRE when -CTS=1, so checking TDRE is enough... 0712 ed3804 in0 a,(ASCI_STAT0) 0715 e602 and #02 ; Transmit Data Register Empty ? 0717 c8 ret z ; return A=0 if Transmit Data Register not empty 0718 3eff ld a,#ff 071a c9 ret ; TTY output 071b cd0607 call #0706 071e b7 or a 071f 28fa jr z,#071b 0721 ed0906 out0 (ASCI_TDR0),c 0724 c9 ret ; ASCI channel 0 interrupt handler 0725 ed3804 in0 a,(ASCI_STAT0) 0728 cb57 bit 2,a ; lost carrier ? 072a c27a07 jp nz,#077a ; if -DCD0=1, receiver operation is disabled 072d cb7f bit 7,a ; character received ? 072f ca8007 jp z,#0780 0732 ed0808 in0 c,(ASCI_RDR0) ; get the character received 0735 e630 and #30 ; Parity or Framing error ? Caution, Overrun errors are not checked!! 0737 2802 jr z,#073b ; could be 073e instead... 0739 0e7f ld c,#7f ; if parity or framing error, replace char by #7f 073b c48007 call nz,#0780 ; reset error flags 073e 79 ld a,c 073f ddcb1d7e bit 7,(ix+#1d) ; is XON/XOFF protocol active ? 0743 2812 jr z,#0757 ; then handle flow control... 0745 fe11 cp #11 ; received a resume flow control char (XON = Ctrl-Q) ? 0747 2005 jr nz,#074e 0749 ddcb4dbe res 7,(ix+#4d) 074d c9 ret 074e fe13 cp #13 ; received a stop flow control char (XOFF = Ctrl-S) ? 0750 2005 jr nz,#0757 0752 ddcb4dfe set 7,(ix+#4d) 0756 c9 ret ; normal characters : put in TTY buffer 0757 ed5bccf4 ld de,(#f4cc) ; nb of chars in buffer 075b cdb507 call #07b5 ; test increment nb of chars in buffer 075e c8 ret z ; return if buffer full (ie. don't store) 075f 79 ld a,c 0760 f5 push af ; save received character 0761 ed53ccf4 ld (#f4cc),de 0765 cd8c07 call #078c ; try to use flow control if buffer nearly full 0768 21d2f4 ld hl,#f4d2 ; TTY buffer start address 076b ed5bcef4 ld de,(#f4ce) ; pointer for next char to put in TTY buffer 076f 19 add hl,de 0770 f1 pop af 0771 77 ld (hl),a ; put char in buffer 0772 cdb507 call #07b5 ; increment circular buffer pointer 0775 ed53cef4 ld (#f4ce),de 0779 c9 ret 077a ed3804 in0 a,(ASCI_STAT0) ; a first read of ASCI_STAT0 resets the -DCD0 bit 077d ed3804 in0 a,(ASCI_STAT0) 0780 ed3800 in0 a,(ASCI_CNTLA0) 0783 cb9f res 3,a ; reset error flags 0785 ed3900 out0 (ASCI_CNTLA0),a 0788 ed3804 in0 a,(ASCI_STAT0) 078b c9 ret ; test if a char can be put in the TTY buffer 078c 213c00 ld hl,#003c 078f b7 or a 0790 ed52 sbc hl,de 0792 c0 ret nz ; no problem except if 60 chars in buffer... ; then try to use flow control 0793 ddcb1d7e bit 7,(ix+#1d) ; test if XON/XOFF flow control is configured... 0797 2813 jr z,#07ac ; skip if we use hardware flow control 0799 ed3802 in0 a,(ASCI_CNTLB0) 079c cb6f bit 5,a ; test -CTS state 079e c0 ret nz ; -CTS=1, we cannot send an XOFF ; -CTS=0 : send an XOFF 079f ed3804 in0 a,(ASCI_STAT0) 07a2 cb4f bit 1,a ; Transmit Data Register Empty ? 07a4 28f3 jr z,#0799 ; loop until TDRE (or exit if -CTS=1) 07a6 3e13 ld a,#13 ; TDRE => Send XOFF (Ctrl-S) 07a8 ed3906 out0 (ASCI_TDR0),a 07ab c9 ret ; hardware flow control ; => set -RTS=1 (more appropriately Ready To Receive (RTR)) ; ie. expect this -RTS(=-RTR) signal to be connected ; to the other terminal's -CTS signal 07ac ed3800 in0 a,(ASCI_CNTLA0) 07af cbe7 set 4,a 07b1 ed3900 out0 (ASCI_CNTLA0),a ; bit 3 rewritten to zero clears all error flags, ; so an undetected overrun error could be cleared... 07b4 c9 ret ; increment circular buffer pointer 07b5 1c inc e 07b6 7b ld a,e 07b7 ee40 xor #40 07b9 c0 ret nz 07ba 5f ld e,a 07bb c9 ret ;****************************************************************************** ; get CRT/UC1 (keyboard) input status 07bc f3 di 07bd 3a32f5 ld a,(#f532) ; number of chars waiting in keyboard buffer 07c0 b7 or a 07c1 fb ei 07c2 c8 ret z 07c3 3eff ld a,#ff 07c5 c9 ret ; get CRT/UC1 (keyboard) input 07c6 cdbc07 call #07bc 07c9 b7 or a 07ca 28fa jr z,#07c6 ; wait until a char is available 07cc f3 di 07cd 3a32f5 ld a,(#f532) ; decrement number of chars 07d0 3d dec a 07d1 3232f5 ld (#f532),a 07d4 2112f5 ld hl,#f512 07d7 3a33f5 ld a,(#f533) ; pointer of the char to get 07da 5f ld e,a 07db 1600 ld d,#00 07dd 19 add hl,de 07de cde707 call #07e7 ; increment pointer of circular buffer 07e1 3233f5 ld (#f533),a ; and save new pointer 07e4 7e ld a,(hl) ; get the char 07e5 fb ei 07e6 c9 ret 07e7 3c inc a ; 32-bytes long circular buffer 07e8 fe20 cp #20 07ea c0 ret nz 07eb af xor a 07ec c9 ret ; UC1 output 07ed cdf707 call #07f7 07f0 b7 or a 07f1 28fa jr z,#07ed 07f3 ed0907 out0 (ASCI_TDR1),c 07f6 c9 ret ; get UC1 status 07f7 ed3805 in0 a,(ASCI_STAT1) 07fa e602 and #02 07fc c8 ret z 07fd 3eff ld a,#ff 07ff c9 ret ; ASCI channel 1 interrupt handler 0800 ed3805 in0 a,(ASCI_STAT1) 0803 e630 and #30 ; framing or parity error ? 0805 2044 jr nz,#084b 0807 ed0809 in0 c,(ASCI_RDR1) ; no, read character received 080a 79 ld a,c 080b b7 or a 080c 2837 jr z,#0845 ; NUL character => fct sequence 080e 3a35f5 ld a,(#f535) 0811 cb7f bit 7,a ; function sequence ? 0813 2814 jr z,#0829 0815 79 ld a,c ; yeap, don't distinguish lower and upper case 0816 fe60 cp #60 0818 3802 jr c,#081c 081a e65f and #5f 081c fe52 cp #52 ; fct-R ? 081e ca0000 jp z,#0000 ; -> RESET ! 0821 fe54 cp #54 ; fct-T ? 0823 ca5408 jp z,#0854 0826 af xor a 0827 181e jr #0847 ; otherwise reset function-character flag ; normal character 0829 3a32f5 ld a,(#f532) ; nb of characters in keyboard buffer 082c cde707 call #07e7 082f c8 ret z ; return if buffer full ; store in keyboard buffer (#f512-f531) 0830 3232f5 ld (#f532),a 0833 3a34f5 ld a,(#f534) 0836 5f ld e,a 0837 1600 ld d,#00 0839 2112f5 ld hl,#f512 083c 19 add hl,de 083d 71 ld (hl),c 083e cde707 call #07e7 0841 3234f5 ld (#f534),a 0844 c9 ret 0845 3e80 ld a,#80 ; set function-character flag 0847 3235f5 ld (#f535),a 084a c9 ret 084b ed3801 in0 a,(ASCI_CNTLA1) 084e cbdf set 3,a ; reset error flags 0850 ed3901 out0 (ASCI_CNTLA1),a 0853 c9 ret ; fct-T => enter Terminal mode (no exit). ; every keyboard char is sent to TTY output, ; and every received TTY character is displayed on screen. ; Fatal Bug!! ; The stack (needed by the calls) is overwritten when a new interrupt arrives ; (either an ASCI chanel 0 or 1 interrupt for example) ; The BIOS is not re-entrant! this fct-T feature seems to ; be a last-minute addition... 0854 217c08 ld hl,#087c ; point to control sequence 1b 38 1a 0857 cd7106 call #0671 ; ie. switch to 80 columns, then clear screen 085a cdbc07 call #07bc ; get CRT (keyboard) status => enable interrupts! 085d b7 or a 085e 280d jr z,#086d ; skip if no available chars 0860 cd0607 call #0706 ; get TTY output status 0863 b7 or a 0864 2807 jr z,#086d ; skip if TTY not ready 0866 cdc607 call #07c6 ; get the next keyboard character 0869 4f ld c,a 086a cd1b07 call #071b ; and send it to TTY 086d cdac06 call #06ac ; get TTY status 0870 b7 or a 0871 28e7 jr z,#085a ; loop if no char in buffer 0873 cdb806 call #06b8 ; get the next waiting char in TTY buffer 0876 4f ld c,a 0877 cd3f10 call #103f ; and display char to CRT 087a 18de jr #085a 087c byte 1b,38,1a,00 ;****************************************************************************** ; get BAT(ch) output status 0880 f3 di 0881 af xor a 0882 110100 ld de,#0001 0885 ddcb187e bit 7,(ix+#18) 0889 2003 jr nz,#088e 088b 11ff2f ld de,#2fff 088e 2ac6f4 ld hl,(#f4c6) 0891 ed52 sbc hl,de 0893 fb ei 0894 c8 ret z 0895 3eff ld a,#ff 0897 c9 ret ; send byte to BAT(ch) output 0898 cd8008 call #0880 089b b7 or a 089c 28fa jr z,#0898 089e f3 di 089f ddcb187e bit 7,(ix+#18) 08a3 201e jr nz,#08c3 08a5 79 ld a,c 08a6 f5 push af 08a7 cd1009 call #0910 08aa ed5bc8f4 ld de,(#f4c8) 08ae 210040 ld hl,#4000 08b1 19 add hl,de 08b2 f1 pop af 08b3 77 ld (hl),a 08b4 ed093a out0 (MMU_CBAR),c 08b7 48 ld c,b 08b8 ed0939 out0 (MMU_BBR),c 08bb 4f ld c,a 08bc cd2e09 call #092e 08bf ed53c8f4 ld (#f4c8),de 08c3 2ac6f4 ld hl,(#f4c6) 08c6 7d ld a,l 08c7 b4 or h 08c8 ccf508 call z,#08f5 08cb 23 inc hl 08cc 22c6f4 ld (#f4c6),hl 08cf fb ei 08d0 c9 ret ;****************************************************************************** ; INT1 interrupt handler (parallel port acknowledge interrupt) 08d1 ed3864 in0 a,(PARPORT) 08d4 2ac6f4 ld hl,(#f4c6) 08d7 7d ld a,l 08d8 b4 or h 08d9 c8 ret z 08da 2b dec hl 08db 22c6f4 ld (#f4c6),hl 08de 7d ld a,l 08df b4 or h 08e0 c8 ret z 08e1 cd1009 call #0910 ; access an extended ram bank for the printer buffer 08e4 ed5bcaf4 ld de,(#f4ca) 08e8 210040 ld hl,#4000 08eb 19 add hl,de 08ec 7e ld a,(hl) ; and read a byte in it 08ed ed093a out0 (MMU_CBAR),c ; then restore the old MMU setup 08f0 48 ld c,b 08f1 ed0939 out0 (MMU_BBR),c 08f4 4f ld c,a 08f5 ed5bcaf4 ld de,(#f4ca) 08f9 cd2e09 call #092e 08fc ed53caf4 ld (#f4ca),de 0900 79 ld a,c 0901 ed3964 out0 (PARPORT),a ; put the byte read on the parallel port 0904 00 nop 0905 00 nop 0906 00 nop 0907 00 nop 0908 ed3965 out0 (STROBE_CLEAR),a ; clear the strobe after a few microseconds 090b 00 nop 090c ed3964 out0 (PARPORT),a ; put the byte on the parallel port again (?) 090f c9 ret 0910 ed383a in0 a,(MMU_CBAR) 0913 4f ld c,a 0914 ed3839 in0 a,(MMU_BBR) 0917 47 ld b,a ; save old values of CBAR and BBR in register BC 0918 3e84 ld a,#84 091a ed393a out0 (MMU_CBAR),a ; set up a Bank Area in #4000-#7fff 091d dd7e19 ld a,(ix+#19) 0920 cb27 sla a 0922 cb27 sla a 0924 cb27 sla a 0926 cb27 sla a 0928 d604 sub #04 092a ed3939 out0 (MMU_BBR),a ; access the Bank pointed by (#f491) 092d c9 ret 092e 1c inc e 092f c0 ret nz 0930 14 inc d 0931 7a ld a,d 0932 ee30 xor #30 0934 c0 ret nz 0935 57 ld d,a 0936 c9 ret ;****************************************************************************** ; Second stage of initialization ; this routine is not referenced anywhere ! 0937 3e0f ld a,#0f ; map drive A to drive P ? 0939 3268f4 ld (#f468),a 093c ddcb1e76 bit 6,(ix+#1e) ; drive 1 present ? 0940 281e jr z,#0960 0942 1817 jr #095b ; we arrive here after INSERT SYSTEM DISK message... 0944 ddcb1e76 bit 6,(ix+#1e) ; drive 1 present ? 0948 2816 jr z,#0960 ; patch some variables 094a 3e1f ld a,#1f ; redirect drive P to drive 1 094c 3277f4 ld (#f477),a 094f 21e6f7 ld hl,#f7e6 ; fix address of directory checksum vector for type 3 DPH 0952 2228f4 ld (#f428),hl 0955 2156f7 ld hl,#f756 ; and address of the allocation vector 0958 222af4 ld (#f42a),hl 095b 3e11 ld a,#11 ; declare drive B is drive 1 095d 3269f4 ld (#f469),a 0960 21d903 ld hl,#03d9 ; display NOVA 800 frame 0963 cd7106 call #0671 0966 0e11 ld c,#11 ; cursor on control char 0968 cd3f10 call #103f ; display char 096b cd26f3 call #f326 ; init page-0 jumps 096e ddcb187e bit 7,(ix+#18) ; how much memory do we have ? 0972 fad209 jp m,#09d2 ; if not enough, load and run CCP 0975 cdd709 call #09d7 ; otherwise load CCP.COM from disk in #dc00-#e405 0978 31fdfe ld sp,#fefd 097b 2100dc ld hl,#dc00 097e 110070 ld de,#7000 0981 cd1009 call #0910 ; then switch bank for #4000-#7fff 0984 010608 ld bc,#0806 0987 edb0 ldir ; and copy CCP to #7000 in new bank 0989 af xor a 098a ed3939 out0 (MMU_BBR),a ; restore normal bank 098d 21c309 ld hl,#09c3 0990 1107dc ld de,#dc07 0993 010f00 ld bc,#000f 0996 edb0 ldir ; patch CCP at #dc07 with "SUBMIT CONFIG" 0998 c343ff jp #ff43 ; go run CCP 099b 21c009 ld hl,#09c0 099e cd7606 call #0676 09a1 cd33f3 call #f333 ; reset page-0 jumps 09a4 ddcb187e bit 7,(ix+#18) ; do we have memory banks ? 09a8 fad209 jp m,#09d2 09ab 210070 ld hl,#7000 ; yes : copy CCP from saved bank 09ae 1100dc ld de,#dc00 09b1 cd1009 call #0910 09b4 010608 ld bc,#0806 09b7 edb0 ldir 09b9 af xor a 09ba ed3939 out0 (MMU_BBR),a ; restore normal bank 09bd c343ff jp #ff43 ; go run CCP 09c0 0d 0a 00 09c3 0d 53 55 42 4d 49 54 20 43 4f 4e 46 49 47 00 " SUBMIT CONFIG " 09d2 2143ff ld hl,#ff43 09d5 1801 jr #09d8 ; load CCP from disk then run it 09d7 e1 pop hl ; pop return addr if called to here ; HL : return addr 09d8 226df5 ld (#f56d),hl ; save return addr 09db cd52f3 call #f352 ; load CCP.COM from disk 09de b7 or a ; test return code 09df ca0b0a jp z,#0a0b ; 0 : no error 09e2 31fdfe ld sp,#fefd 09e5 f5 push af 09e6 210f0a ld hl,#0a0f 09e9 cd7606 call #0676 ; display "CCPLDR error " message 09ec f1 pop af 09ed 21200a ld hl,#0a20 09f0 3d dec a 09f1 2803 jr z,#09f6 ; 1 : display "unable to open CCP.COM" 09f3 21390a ld hl,#0a39 ; 2 : display "Incorrect version of CCP.COM" 09f6 cd7606 call #0676 09f9 21580a ld hl,#0a58 ; display "Insert a new disk ..." 09fc cd7606 call #0676 09ff cd18ff call #ff18 0a02 21c009 ld hl,#09c0 0a05 cd7606 call #0676 0a08 c3db09 jp #09db 0a0b 2a6df5 ld hl,(#f56d) ; return to addr saved 0a0e e9 jp (hl) 0a0f 0d 0a 0a11 43 43 50 4c 44 52 20 65 72 72 6f 72 2c 20 00 "CCPLDR error, " 0a20 75 6e 61 62 6c 65 20 74 6f 20 6f 70 65 6e 20 27 43 43 50 2e 43 4f 4d 27 00 "unable to open 'CCP.COM'" 0a39 49 6e 63 6f 72 72 65 63 74 20 76 65 72 73 69 6f 6e 20 6f 66 20 27 43 43 50 2e 43 4f 4d 27 00 "Incorrect version of 'CCP.COM'" 0a58 0d 0a 0a5a 49 6e 73 65 72 74 20 61 20 6e 65 77 20 64 69 73 6b 20 61 6e 64 20 70 72 65 73 73 20 3c 52 45 54 55 52 4e 3e 20 00 "Insert a new disk and press " ;****************************************************************************** ; BIOS fct, set sector number 0a80 dd7102 ld (ix+#02),c 0a83 c9 ret ; move disk head to track 0 0a84 ddcb015e bit 3,(ix+#01) 0a88 2004 jr nz,#0a8e 0a8a ddcb01c6 set 0,(ix+#01) 0a8e 0e00 ld c,#00 0a90 dd7103 ld (ix+#03),c 0a93 c9 ret ; set DMA address 0a94 dd7106 ld (ix+#06),c 0a97 dd7007 ld (ix+#07),b 0a9a c9 ret ; sector translation for skewing ; => no sector translation 0a9b 60 ld h,b 0a9c 69 ld l,c 0a9d c9 ret ; select disk drive. ; Entry: C = drive 0a9e 69 ld l,c 0a9f 2600 ld h,#00 0aa1 1168f4 ld de,#f468 ; drive table in f468 0aa4 19 add hl,de 0aa5 7e ld a,(hl) ; read drive redirection 0aa6 e60f and #0f ; low nibble redirect to another drive 0aa8 47 ld b,a ; save target drive number 0aa9 6f ld l,a 0aaa 2600 ld h,#00 0aac 19 add hl,de 0aad 7e ld a,(hl) ; read redirected physical drive 0aae fef0 cp #f0 ; type >= #f0 means device not present 0ab0 d26b0c jp nc,#0c6b ; jump to error if device not present 0ab3 dd7004 ld (ix+#04),b ; save target drive number 0ab6 cb3f srl a ; shift physical drive to low position 0ab8 cb3f srl a 0aba cb3f srl a 0abc cb3f srl a 0abe 327df4 ld (#f47d),a ; and save it 0ac1 4f ld c,a ; physical drive in register C 0ac2 78 ld a,b 0ac3 fe0f cp #0f ; logical drive P ? 0ac5 2002 jr nz,#0ac9 0ac7 0e03 ld c,#03 ; force physical drive #3 for P 0ac9 cb21 sla c 0acb cb21 sla c 0acd cb21 sla c 0acf cb21 sla c 0ad1 0600 ld b,#00 0ad3 21ecf3 ld hl,#f3ec 0ad6 09 add hl,bc 0ad7 e5 push hl ; return address of Disk Parameter Header (DPH) 0ad8 010a00 ld bc,#000a 0adb 09 add hl,bc 0adc 7e ld a,(hl) ; get DPB address 0add 23 inc hl 0ade 66 ld h,(hl) 0adf 6f ld l,a 0ae0 226ff5 ld (#f56f),hl ; and store it to f56f 0ae3 e1 pop hl 0ae4 c9 ret ; fct read sector 0ae5 ddcb018e res 1,(ix+#01) 0ae9 ddcb01a6 res 4,(ix+#01) 0aed 1825 jr #0b14 ; fct write sector ; param : C = 0, 1 or 2 0aef ddcb01ce set 1,(ix+#01) 0af3 ddcb01e6 set 4,(ix+#01) 0af7 79 ld a,c 0af8 fe01 cp #01 0afa 2818 jr z,#0b14 ; skip if write must be immediate ; no, write can be deferred 0afc ddcb018e res 1,(ix+#01) 0b00 ddcb0196 res 2,(ix+#01) 0b04 cd8d0b call #0b8d ; check if same drive/track/sector 0b07 280f jr z,#0b18 ; should go to 0b59 directly... 0b09 79 ld a,c 0b0a fe02 cp #02 0b0c 280a jr z,#0b18 0b0e ddcb0146 bit 0,(ix+#01) ; useless test... 0b12 2000 jr nz,#0b14 ; useless test... 0b14 ddcb01d6 set 2,(ix+#01) ; set pre-read flag 0b18 cd8d0b call #0b8d ; check if same drive/track/sector 0b1b 283c jr z,#0b59 ; different sector : ; check if we have one to write-back 0b1d ddcb0146 bit 0,(ix+#01) 0b21 2007 jr nz,#0b2a 0b23 ddcb015e bit 3,(ix+#01) 0b27 c4be0b call nz,#0bbe ; write-back previous sector 0b2a ddcb01c6 set 0,(ix+#01) 0b2e ddcb019e res 3,(ix+#01) 0b32 3a7df4 ld a,(#f47d) ; copy physical drive number 0b35 3283f4 ld (#f483),a 0b38 3a7cf4 ld a,(#f47c) ; and logical drive number 0b3b 3282f4 ld (#f482),a 0b3e 3a7bf4 ld a,(#f47b) ; copy track number 0b41 3281f4 ld (#f481),a 0b44 cda40b call #0ba4 ; calculate physical sector 0b47 3280f4 ld (#f480),a ; physical sector [0..9] 0b4a fd2271f5 ld (#f571),iy ; store DPB address 0b4e ddcb0156 bit 2,(ix+#01) 0b52 c4ba0b call nz,#0bba ; read sector if pre-read flag is set 0b55 ddcb0186 res 0,(ix+#01) 0b59 3a7af4 ld a,(#f47a) ; 128-bytes sector number 0b5c fda610 and (iy+#10) ; record mask (8 records per sector) 0b5f 67 ld h,a ; shift right to multiply by 128 bytes 0b60 2e00 ld l,#00 0b62 cb3c srl h 0b64 cb1d rr l 0b66 1147f8 ld de,#f847 ; 1024-bytes buffer in f847-fc46 0b69 19 add hl,de ; add offset of record inside sector 0b6a ed5b7ef4 ld de,(#f47e) ; DMA address is destination address 0b6e 018000 ld bc,#0080 0b71 ddcb0166 bit 4,(ix+#01) ; do we have to write sector ? 0b75 2805 jr z,#0b7c 0b77 ddcb01de set 3,(ix+#01) 0b7b eb ex de,hl 0b7c cd30ff call #ff30 ; copy record to loram buffer 0b7f af xor a 0b80 ddcb014e bit 1,(ix+#01) ; write sector operation ? 0b84 c8 ret z ; no, finished. 0b85 cdbe0b call #0bbe ; write sector 0b88 ddcb019e res 3,(ix+#01) 0b8c c9 ret ;******************************************************************** ; return Z if same drive/track/sector, and flag bit 0 is 0 0b8d fd2a6ff5 ld iy,(#f56f) ; DPB address of selected drive 0b91 ddcb0146 bit 0,(ix+#01) 0b95 c0 ret nz 0b96 3a7cf4 ld a,(#f47c) 0b99 ddbe0a cp (ix+#0a) 0b9c c0 ret nz ; return NZ if different drive 0b9d 3a7bf4 ld a,(#f47b) 0ba0 ddbe09 cp (ix+#09) 0ba3 c0 ret nz ; return NZ if different track ; calculate the desired sector number 0ba4 fd2a6ff5 ld iy,(#f56f) 0ba8 fd7e0f ld a,(iy+#0f) ; sector size 0bab b7 or a 0bac 47 ld b,a 0bad 3a7af4 ld a,(#f47a) ; 128-bytes sector number 0bb0 2804 jr z,#0bb6 0bb2 cb3f srl a 0bb4 10fc djnz #0bb2 0bb6 ddbe08 cp (ix+#08) ; most recently used 1024-bytes sector ? 0bb9 c9 ret ; return NZ if different sector ; or Z if same drive/track/sector ;********************************************************************** 0bba 0e01 ld c,#01 ; read sector routine 0bbc 1802 jr #0bc0 0bbe 0e02 ld c,#02 ; write sector routine 0bc0 2147f8 ld hl,#f847 ; address of buffer 0bc3 2288f4 ld (#f488),hl 0bc6 3a83f4 ld a,(#f483) ; copy physical drive number 0bc9 3286f4 ld (#f486),a 0bcc 3a80f4 ld a,(#f480) ; and sector number 0bcf 3284f4 ld (#f484),a 0bd2 3a81f4 ld a,(#f481) ; and track number 0bd5 3285f4 ld (#f485),a 0bd8 2a71f5 ld hl,(#f571) ; copy DPB address 0bdb 2273f5 ld (#f573),hl 0bde 79 ld a,c 0bdf cda30d call #0da3 ; call floppy transfer routine 0be2 b7 or a 0be3 c8 ret z ; return if no error 0be4 cd160c call #0c16 0be7 18d7 jr #0bc0 ; retry 0be9 0e01 ld c,#01 ; read sector routine 0beb 1806 jr #0bf3 0bed 0e03 ld c,#03 ; read track routine 0bef 1802 jr #0bf3 0bf1 0e04 ld c,#04 ; write track (format) routine 0bf3 2a6ff5 ld hl,(#f56f) ; copy DPB address 0bf6 2273f5 ld (#f573),hl 0bf9 3a7bf4 ld a,(#f47b) ; and track number 0bfc 3285f4 ld (#f485),a 0bff 3a7af4 ld a,(#f47a) ; and 128-bytes sector number 0c02 3284f4 ld (#f484),a 0c05 2a7ef4 ld hl,(#f47e) ; and DMA address 0c08 2288f4 ld (#f488),hl 0c0b 3a7df4 ld a,(#f47d) ; and physical drive number 0c0e 3286f4 ld (#f486),a 0c11 79 ld a,c 0c12 cda30d call #0da3 0c15 c9 ret 0c16 3d dec a 0c17 21940c ld hl,#0c94 0c1a cd890c call #0c89 0c1d cd7606 call #0676 0c20 dd7e0f ld a,(ix+#0f) 0c23 e601 and #01 0c25 21c50c ld hl,#0cc5 0c28 cd890c call #0c89 0c2b cd7606 call #0676 0c2e dd7e0e ld a,(ix+#0e) 0c31 e601 and #01 0c33 c641 add a,#41 0c35 4f ld c,a 0c36 cd12ff call #ff12 0c39 21070d ld hl,#0d07 0c3c cd7606 call #0676 0c3f cd18ff call #ff18 0c42 fe60 cp #60 0c44 3802 jr c,#0c48 0c46 e65f and #5f 0c48 fe41 cp #41 0c4a 280e jr z,#0c5a 0c4c fe52 cp #52 0c4e 20ef jr nz,#0c3f 0c50 215a0d ld hl,#0d5a 0c53 cd7606 call #0676 0c56 dd4e0f ld c,(ix+#0f) 0c59 c9 ret 0c5a dd7e0f ld a,(ix+#0f) 0c5d e601 and #01 0c5f 211b0d ld hl,#0d1b 0c62 cd890c call #0c89 0c65 cd7606 call #0676 0c68 c39b09 jp #099b 0c6b c5 push bc 0c6c af xor a 0c6d cd39ff call #ff39 0c70 215e0d ld hl,#0d5e 0c73 cd7606 call #0676 0c76 c1 pop bc 0c77 79 ld a,c 0c78 e60f and #0f 0c7a c641 add a,#41 0c7c 4f ld c,a 0c7d cd12ff call #ff12 0c80 21840d ld hl,#0d84 0c83 cd7606 call #0676 0c86 c39b09 jp #099b 0c89 cb27 sla a 0c8b 5f ld e,a 0c8c 1600 ld d,#00 0c8e 19 add hl,de 0c8f 7e ld a,(hl) 0c90 23 inc hl 0c91 66 ld h,(hl) 0c92 6f ld l,a 0c93 c9 ret 0c94 0c9a 0ca5 0cb6 0c9a 0d 0a 42 61 64 20 64 61 74 61 00 "Bad data" 0ca5 0d 0a 50 72 6f 74 65 63 74 65 64 20 64 61 74 61 00 "Protected data" 0cb6 0d 0a 55 6e 72 65 61 64 79 20 75 6e 69 74 00 "Unready unit" 0cc5 0cc9 0ce7 0cc9 20 65 72 72 6f 72 20 77 68 65 6e 20 77 72 69 74 69 6e 67 20 74 6f 20 64 72 69 76 65 20 00 " error when writing to drive " 0ce7 20 65 72 72 6f 72 20 77 68 65 6e 20 72 65 61 64 69 6e 67 20 66 72 6f 6d 20 64 72 69 76 65 20 00 " error when reading from drive " 0d07 3a 0d08 0d 0a 41 62 6f 72 74 20 6f 72 20 52 65 74 72 79 20 3f 00 " Abort or retry ?" 0d1b 0d1f 0d3d 0d1f 41 0d 0a 0d 0a 57 72 69 74 65 20 61 74 74 65 6d 70 74 20 61 62 6f 72 74 65 64 20 2e 2e 00 " Write attempt aborted .." 0d3d 41 0d 0a 0d 0a 52 65 61 64 20 61 74 74 65 6d 70 74 20 61 62 6f 72 74 65 64 20 2e 2e 00 " Read attempt aborted .." 0d5a 52 0d 0a 00 0d5e 0d 0a 4e 6f 20 75 6e 69 74 20 65 72 72 6f 72 20 77 68 65 6e 20 73 65 6c 65 63 74 69 6e 67 20 64 72 69 76 65 20 00 "No unit error when selecting drive " 0d84 3a 0d 0a 0d 0a 53 65 6c 65 63 74 20 61 74 74 65 6d 70 74 20 61 62 6f 72 74 65 64 20 2e 2e 00 "Select attempt aborted .." ; Low-level sector read/write routine ; floppy routine number in A 0da3 3287f4 ld (#f487),a 0da6 fd2a73f5 ld iy,(#f573) ; load DPB address 0daa b7 or a 0dab ca980e jp z,#0e98 ; routine number 0 -> reset 0dae 3a86f4 ld a,(#f486) ; physical drive number 0db1 fe02 cp #02 0db3 ca0810 jp z,#1008 ; if drive 2 go to RAMDISK routines 0db6 1e00 ld e,#00 0db8 cb3f srl a 0dba cb1b rr e ; bit 7 set in E for drive 1 0dbc dd361308 ld (ix+#13),#08 ; init status, not used... 0dc0 3a8cf4 ld a,(#f48c) ; get previous drive selection 0dc3 dd7314 ld (ix+#14),e ; set new drive selection 0dc6 bb cp e 0dc7 281e jr z,#0de7 ; are they the same ? ; no, drive selection needed 0dc9 f5 push af 0dca cd2e0f call #0f2e ; wait 50 us 0dcd ed195a out0 (DRV_SEL),e ; select drive 0dd0 f1 pop af 0dd1 cd3e0e call #0e3e ; get pointer for track number 0dd4 3c inc a 0dd5 2804 jr z,#0ddb 0dd7 ed3861 in0 a,(FDC_TRACK) ; save track number of old drive 0dda 77 ld (hl),a 0ddb 7b ld a,e 0ddc cd3e0e call #0e3e 0ddf 7e ld a,(hl) 0de0 ed3961 out0 (FDC_TRACK),a ; set track number of new drive 0de3 3c inc a 0de4 cce90e call z,#0ee9 0de7 fd7e12 ld a,(iy+#12) ; sector translation scheme 0dea 11460e ld de,#0e46 0ded cd340e call #0e34 ; call sector translation routine 0df0 dd7012 ld (ix+#12),b ; track number 0df3 0e28 ld c,#28 0df5 fe80 cp #80 ; set carry if A has bit 7 not set (side 0) 0df7 cb11 rl c ; I/O address will be either #50 or #51 0df9 e67f and #7f ; and remove bit 7 in A 0dfb ed3962 out0 (FDC_SECT),a ; set physical sector number in FDC 0dfe 3a8df4 ld a,(#f48d) ; previous I/O address used for side access 0e01 dd7115 ld (ix+#15),c ; save new I/O address used for side access 0e04 b9 cp c ; same side to access ? 0e05 c42e0f call nz,#0f2e ; wait 50 us 0e08 ed78 in a,(c) ; read I/O address #50 or #51 (side) 0e0a 1803 jr #0e0f 0e0c cde90e call #0ee9 0e0f 3a8af4 ld a,(#f48a) ; track number 0e12 cda70e call #0ea7 ; move head to track number 0e15 3a87f4 ld a,(#f487) ; floppy routine to call (1: read sector, 2: write sector...) 0e18 118e0e ld de,#0e90-2 ; 1-based-index routine table 0e1b cd340e call #0e34 0e1e b7 or a 0e1f c8 ret z ; return if no error 0e20 ddcb1326 sla (ix+#13) ; useless: test bit 6 of status 0e24 f8 ret m 0e25 fe01 cp #01 0e27 c0 ret nz 0e28 3a8bf4 ld a,(#f48b) ; useless: status is not set 0e2b e650 and #50 0e2d 28dd jr z,#0e0c 0e2f cde10e call #0ee1 0e32 18e1 jr #0e15 ; jump to routine number A in table pointed by DE 0e34 87 add a,a 0e35 6f ld l,a 0e36 2600 ld h,#00 0e38 19 add hl,de 0e39 7e ld a,(hl) 0e3a 23 inc hl 0e3b 66 ld h,(hl) 0e3c 6f ld l,a 0e3d e9 jp (hl) ; return f575 or f576 depending on A bit 7 0e3e 2175f5 ld hl,#f575 0e41 cb7f bit 7,a 0e43 c8 ret z 0e44 23 inc hl 0e45 c9 ret ; only two routines in table 0e46, the first without skew translation, ; the second with skew translation 0e46 dw 0e66, 0e73, 0e45, 0e45, 0e45, 0e45, 0e45, 0e45 dw 0e45, 0e45, 0e45, 0e45, 0e45, 0e45, 0e45, 0e45 ; first skew translation routine : no skew 0e66 dd460d ld b,(ix+#0d) ; track number 0e69 3a84f4 ld a,(#f484) ; (ix+#0c) 0-based sector number 0e6c 3c inc a 0e6d fe06 cp #06 0e6f d8 ret c 0e70 cbff set 7,a ; set bit 7 for sectors 6,7,8,9,10 0e72 c9 ret ; second skew translation routine : skew 1 0e73 21860e ld hl,#0e86 0e76 0600 ld b,#00 0e78 dd4e0c ld c,(ix+#0c) ; 0-based sector number 0e7b 09 add hl,bc 0e7c dd460d ld b,(ix+#0d) ; track number 0e7f 7e ld a,(hl) ; 1-based sector number 0e80 fe06 cp #06 0e82 d8 ret c 0e83 cbff set 7,a ; set bit 7 for sectors 6,7,8,9,10 0e85 c9 ret 0e86 db 01 03 05 07 09 02 04 06 08 0a ; 10 sectors skew table 0e90 dw 0f7e, 0f96, 0f6f, 0f8b ; read sector, write sector, read track, write track 0e98 3eff ld a,#ff 0e9a 328cf4 ld (#f48c),a 0e9d 328df4 ld (#f48d),a 0ea0 3275f5 ld (#f575),a 0ea3 3276f5 ld (#f576),a 0ea6 c9 ret 0ea7 3277f5 ld (#f577),a 0eaa 47 ld b,a 0eab ed3861 in0 a,(FDC_TRACK) 0eae b8 cp b 0eaf c8 ret z 0eb0 47 ld b,a 0eb1 21530f ld hl,#0f53 0eb4 fdcb1176 bit 6,(iy+#11) ; depending on bit 6, 0eb8 cc2e0f call z,#0f2e ; wait 50 us 0ebb c4310f call nz,#0f31 ; or wait 200 us 0ebe 3a77f5 ld a,(#f577) 0ec1 b7 or a 0ec2 2825 jr z,#0ee9 0ec4 b8 cp b ; compare with current track 0ec5 2005 jr nz,#0ecc 0ec7 ed3961 out0 (FDC_TRACK),a 0eca 182f jr #0efb 0ecc 3802 jr c,#0ed0 0ece 04 inc b 0ecf 04 inc b 0ed0 05 dec b 0ed1 fdcb117e bit 7,(iy+#11) 0ed5 2805 jr z,#0edc 0ed7 f5 push af 0ed8 cd0d0f call #0f0d ; step-in or out command 0edb f1 pop af 0edc cd0d0f call #0f0d 0edf 18dd jr #0ebe 0ee1 cd0f0f call #0f0f 0ee4 cd130f call #0f13 ; step-out command 0ee7 1812 jr #0efb 0ee9 ed3961 out0 (FDC_TRACK),a 0eec 0600 ld b,#00 0eee 05 dec b 0eef 2819 jr z,#0f0a 0ef1 cd130f call #0f13 ; step-out command 0ef4 ed3860 in0 a,(FDC_STATUS) 0ef7 cb57 bit 2,a 0ef9 28f3 jr z,#0eee 0efb fd7e11 ld a,(iy+#11) 0efe cb3f srl a 0f00 cb3f srl a 0f02 cb3f srl a 0f04 e607 and #07 0f06 cbdf set 3,a 0f08 181a jr #0f24 0f0a 3e03 ld a,#03 0f0c c9 ret 0f0d 3804 jr c,#0f13 0f0f 3e48 ld a,#48 ; step-in command 0f11 1802 jr #0f15 0f13 3e68 ld a,#68 ; step-out command 0f15 ed3960 out0 (FDC_COMMAND),a 0f18 ed3852 in0 a,(#52) 0f1b cb77 bit 6,a 0f1d 28f9 jr z,#0f18 ; wait FDC's INTRQ 0f1f fd7e11 ld a,(iy+#11) 0f22 e607 and #07 ; wait a delay 0f24 87 add a,a 0f25 6f ld l,a 0f26 2600 ld h,#00 0f28 114f0f ld de,#0f4f 0f2b 19 add hl,de 0f2c 1803 jr #0f31 0f2e 21510f ld hl,#0f51 ; wait using a timer, timer value pointed by HL 0f31 af xor a 0f32 ed3910 out0 (TIMER_TCR),a 0f35 ed380c in0 a,(TIMER_TMDR0L) 0f38 7e ld a,(hl) 0f39 ed390c out0 (TIMER_TMDR0L),a 0f3c 23 inc hl 0f3d 7e ld a,(hl) 0f3e ed390d out0 (TIMER_TMDR0H),a 0f41 3e01 ld a,#01 0f43 ed3910 out0 (TIMER_TCR),a 0f46 ed3810 in0 a,(TIMER_TCR) 0f49 cb77 bit 6,a 0f4b 28f9 jr z,#0f46 0f4d af xor a 0f4e c9 ret ; timer values for step commands 0f4f dw 1 0f51 dw 307+1 ; 50 us dw 1228+1 ; 200 us dw 1843+1 ; 300 us dw 2457+1 ; 400 us dw 3993+1 ; 650 us dw 5529+1 ; 900 us dw 7066+1 ;1150 us ; extended timer values for step commands 0f5f dw 1536+1 ; 250 us dw 3072+1 ; 500 us dw 3993+1 ; 650 us dw 4608+1 ; 750 us dw 6144+1 ;1000 us dw 7680+1 ;1250 us dw 9216+1 ;1500 us dw 12288+1 ;2000 us 0f6f 0672 ld b,#72 0f71 0ee0 ld c,#e0 ; read track command 0f73 1e04 ld e,#04 0f75 cdab0f call #0fab 0f78 e610 and #10 0f7a c8 ret z 0f7b 3e01 ld a,#01 0f7d c9 ret ; low level read sector routine 0f7e 0672 ld b,#72 ; dma control value 0f80 0e80 ld c,#80 ; read sector command 0f82 cda80f call #0fa8 0f85 e61c and #1c ; check RNF, CRC and Lost Data errors 0f87 c8 ret z 0f88 3e01 ld a,#01 ; returns a=1 if read error 0f8a c9 ret 0f8b 0670 ld b,#70 ; dma control value 0f8d 0ef0 ld c,#f0 ; write track command 0f8f 1e04 ld e,#04 0f91 cdab0f call #0fab 0f94 1807 jr #0f9d 0f96 0670 ld b,#70 ; wait states control value 0f98 0ea0 ld c,#a0 ; write sector command 0f9a cda80f call #0fa8 0f9d e65c and #5c ; check WriteProtect, RNF, CRC, LostData 0f9f c8 ret z 0fa0 e640 and #40 0fa2 3e01 ld a,#01 0fa4 c8 ret z ; returns a=1 if WriteProtect 0fa5 3e02 ld a,#02 ; or a=2 if RNF, CRC or LostData 0fa7 c9 ret ; floppy DMA transfer 0fa8 fd5e0f ld e,(iy+#0f) ; sector size (3) 0fab cdf50f call #0ff5 0fae 3e82 ld a,#82 0fb0 ed3936 out0 (REFRESH_RCR),a 0fb3 78 ld a,b 0fb4 ed3932 out0 (DMA_DCNTL),a 0fb7 3a88f4 ld a,(#f488) ; DMA memory address is fetched from f488 0fba ed3928 out0 (DMA_MAR1L),a 0fbd 3a89f4 ld a,(#f489) 0fc0 ed3929 out0 (DMA_MAR1H),a 0fc3 3e63 ld a,#63 ; DMA IO address is #0063 0fc5 ed392b out0 (DMA_IAR1L),a 0fc8 af xor a 0fc9 ed392a out0 (DMA_MAR1B),a 0fcc ed392c out0 (DMA_IAR1H),a 0fcf cb23 sla e ; get sector size from table 0fd1 1600 ld d,#00 0fd3 21fe0f ld hl,#0ffe 0fd6 19 add hl,de 0fd7 7e ld a,(hl) ; fetch sector size in bytes (LSB) 0fd8 ed392e out0 (DMA_BCR1L),a ; and set byte count register low ... 0fdb 23 inc hl 0fdc 7e ld a,(hl) 0fdd ed392f out0 (DMA_BCR1H),a ; ... and high (MSB) 0fe0 3e92 ld a,#92 0fe2 ed3930 out0 (DMA_DSTAT),a 0fe5 79 ld a,c 0fe6 ed3960 out0 (FDC_COMMAND),a 0fe9 ed3852 in0 a,(#52) 0fec e640 and #40 0fee 28f9 jr z,#0fe9 ; wait for FDC's INTRQ 0ff0 3e83 ld a,#83 0ff2 ed3936 out0 (REFRESH_RCR),a 0ff5 3e32 ld a,#32 0ff7 ed3930 out0 (DMA_DSTAT),a 0ffa ed3860 in0 a,(FDC_STATUS) 0ffd c9 ret ; sector sizes 0ffe dw 128,256,512,1024 ; track size 1006 dw 10240 ; ramdisk sector read/write 1008 3e ld a,#54 100a ed393a out0 (MMU_CBAR),a 100d dd7e19 ld a,(ix+#19) 1010 cb27 sla a 1012 cb27 sla a 1014 cb27 sla a 1016 cb27 sla a 1018 d604 sub #04 101a dd860d add a,(ix+#0d) ; track number 101d ed3939 out0 (MMU_BBR),a 1020 dd7e0c ld a,(ix+#0c) ; sector number 1023 87 add a,a 1024 87 add a,a ; 1024-bytes sectors 1025 f640 or #40 ; Access ramdisk in bank memory 4000-7fff 1027 67 ld h,a 1028 2e00 ld l,#00 102a 1147f8 ld de,#f847 ; ramdisk buffer address 102d dd7e0f ld a,(ix+#0f) ; routine number (1: read sector, 2: write sector) 1030 fe01 cp #01 1032 2801 jr z,#1035 1034 eb ex de,hl 1035 010004 ld bc,#0400 ; 1024-bytes to copy 1038 edb0 ldir ; copy the sector 103a af xor a 103b ed3939 out0 (MMU_BBR),a 103e c9 ret ;****************************************************************************** ; send byte to CRT output (display a character) ; IY is set to f578 or f583 depending on page number 103f fd2178f5 ld iy,#f578 ; structure pointer for page 0 1043 ddcb176e bit 5,(ix+#17) ; 1047 2804 jr z,#104d 1049 fd2183f5 ld iy,#f583 ; structure pointer for page 1 104d 41 ld b,c ; save character to display in B 104e fd4e09 ld c,(iy+#09) ; load MAT register value to write 1051 3e82 ld a,#82 ; VDP: IND cmd to write MAT reg 1053 cd5413 call #1354 ; => and force cursor off 1056 cd8910 call #1089 ; write the character ; restore cursor display 1059 fd7e00 ld a,(iy+#00) 105c e640 and #40 ; keep only bit 6 (cursor off) 105e ee60 xor #60 ; force bit 5 (cursor flashing) and inverse bit 6 1060 fdb609 or (iy+#09) 1063 4f ld c,a ; write MAT register (=> restore cursor display) 1064 181b jr #1081 ; ESC-3 sequence: screen-saver ??? ; (the display is hidden until next char is written, ; only a double-height cursor blinks at origin) 1066 e1 pop hl ; pop return address => don't restore cursor 1067 0e70 ld c,#70 1069 cd5213 call #1352 ; write PAT register: flash enable, active area mark ; don't enable {conceal,lower&upper bulk,service row) 106c 0ed0 ld c,#d0 106e 3e81 ld a,#81 ; VDP: IND cmd to write TGS reg 1070 cd5413 call #1354 ; => 80 char long, service row=0,... 1073 af xor a 1074 cdc812 call #12c8 ; line 0 1077 af xor a 1078 cdd912 call #12d9 ; column 0 107b ddcb17fe set 7,(ix+#17) ; => screen origin = + 8 KB for double height screen 107f 0ee0 ld c,#e0 ; => double height, cursor display, flash complemented, ; margin color = black 1081 3e82 ld a,#82 ; VDP: write MAT register 1083 c35413 jp #1354 ; get CRT output status 1086 3eff ld a,#ff 1088 c9 ret ; write the character to display (in register b) 1089 c5 push bc 108a ddcb177e bit 7,(ix+#17) ; in screensaver mode ? 108e c4f811 call nz,#11f8 ; leave screensaver mode 1091 fdcb0066 bit 4,(iy+#00) 1095 cc9211 call z,#1192 ; if bit4=0, switch to 80 col ? 1098 c1 pop bc 1099 fd7e00 ld a,(iy+#00) 109c e60f and #0f 109e c28313 jp nz,#1383 ; handle special sequences ; here we are not in an ESC sequence 10a1 78 ld a,b 10a2 58 ld e,b ; save bit 7 of character in E 10a3 e67f and #7f ; clear bit 7 of character 10a5 47 ld b,a 10a6 fe20 cp #20 10a8 fdcb007e bit 7,(iy+#00) 10ac c24b15 jp nz,#154b ; jump if 40 column mode ; here we are in 80 column mode 10af da2811 jp c,#1128 ; jump for control characters 10b2 cb7b bit 7,e 10b4 2802 jr z,#10b8 10b6 e61f and #1f ; map characters [a0-ff] to [00-1f] 10b8 4f ld c,a 10b9 3e50 ld a,#50 ; VDP: KRL command 10bb cd5413 call #1354 ; test if cursor on last column 10be fd3404 inc (iy+#04) 10c1 fd7e04 ld a,(iy+#04) 10c4 fe50 cp #50 10c6 dad612 jp c,#12d6 ; not last column => update cursor position 10c9 fd3504 dec (iy+#04) ; stay on last column... 10cc c9 ret ; REPLACE WITH A NOP to enable cursor to go to next line!!! 10cd fd360400 ld (iy+#04),#00 ; return to column 0 10d1 fd3405 inc (iy+#05) ; and go to next line 10d4 fd7e05 ld a,(iy+#05) 10d7 fe18 cp #18 10d9 dac512 jp c,#12c5 10dc fd3505 dec (iy+#05) 10df fdcb007e bit 7,(iy+#00) 10e3 c2c512 jp nz,#12c5 10e6 fd3406 inc (iy+#06) 10e9 fd7e06 ld a,(iy+#06) 10ec fe18 cp #18 10ee 3804 jr c,#10f4 10f0 fd360600 ld (iy+#06),#00 10f4 cdb712 call #12b7 10f7 0600 ld b,#00 10f9 1803 jr #10fe ; clear end of line 10fb fd4604 ld b,(iy+#04) ; clear line from column in B 10fe cdcf16 call #16cf 1101 2650 ld h,#50 ; 80 columns 1103 2e50 ld l,#50 ; => KRL command 1105 fdcb007e bit 7,(iy+#00) 1109 2804 jr z,#110f 110b 2628 ld h,#28 ; or 40 columns 110d 2e00 ld l,#00 ; => KRF command 110f 78 ld a,b 1110 cdd912 call #12d9 1113 7d ld a,l ; issue KRL or KRF command 1114 0e20 ld c,#20 ; => store SPACE character in screen 1116 cd5413 call #1354 1119 04 inc b 111a 78 ld a,b 111b bc cp h 111c 38f1 jr c,#110f ; loop until the end of line 111e fdcb007e bit 7,(iy+#00) 1122 cc0015 call z,#1500 1125 c3d612 jp #12d6 ; CRT output: handling control characters in 80 columns mode 1128 fe08 cp #08 ; Ctrl-H: cursor left 112a 2835 jr z,#1161 112c fe0a cp #0a ; Ctrl-J: line feed 112e 28a1 jr z,#10d1 1130 fe0b cp #0b ; Ctrl-K: up 1132 2840 jr z,#1174 1134 fe0c cp #0c ; Ctrl-L: cursor right 1136 cabe10 jp z,#10be 1139 fe0d cp #0d ; Ctrl-M: carriage return 113b 2848 jr z,#1185 113d fe11 cp #11 ; Ctrl-Q: cursor on 113f caad12 jp z,#12ad 1142 fe14 cp #14 ; Ctrl-T: cursor off 1144 cab212 jp z,#12b2 1147 fe17 cp #17 ; Ctrl-W: clear end of screen 1149 ca6912 jp z,#1269 114c fe18 cp #18 ; Ctrl-X: clear end of line 114e 28ab jr z,#10fb 1150 fe1a cp #1a ; Ctrl-Z: clear screen 1152 ca6012 jp z,#1260 1155 fe1e cp #1e ; Ctrl-^: cursor home 1157 2828 jr z,#1181 1159 fe1b cp #1b ; ESC: escape sequence 115b c0 ret nz 115c 0e01 ld c,#01 115e c37814 jp #1478 ; move cursor left 1161 fd3504 dec (iy+#04) 1164 f2d612 jp p,#12d6 1167 3e4f ld a,#4f 1169 fdcb007e bit 7,(iy+#00) 116d 2802 jr z,#1171 116f 3e27 ld a,#27 1171 fd7704 ld (iy+#04),a ; move cursor up 1174 fd7e05 ld a,(iy+#05) ; current line number 1177 b7 or a 1178 cad612 jp z,#12d6 117b fd3505 dec (iy+#05) 117e c3c512 jp #12c5 ; cursor home 1181 fd360500 ld (iy+#05),#00 ; carriage return (go to beginning of line) 1185 fd360400 ld (iy+#04),#00 1189 c3c512 jp #12c5 ; set 40 column mode 118c fdcb00fe set 7,(iy+#00) 1190 1812 jr #11a4 1192 fdcb00e6 set 4,(iy+#00) ; set 80 column mode 1196 fdcb00be res 7,(iy+#00) 119a cd4412 call #1244 ; init some registers and clear screen memory 119d fd360176 ld (iy+#01),#76 ; init DOR register value ; => C0=Cyan C1=White 11a1 cd4315 call #1543 ; init DOR register ; initialize 40 and 80 column modes 11a4 cd3c13 call #133c ; conceal enable, no service row, no lower|upper bulk 11a7 0ed0 ld c,#d0 ; value for TGS register in 80 column mode ; => 80 char long, composite sync 11a9 fdcb007e bit 7,(iy+#00) 11ad 2807 jr z,#11b6 11af 0e03 ld c,#03 ; in 40-col, select address of UserDef Set ; => Quadrichrome address = 0 ; => G'1 address (semi-graphics) = 0 ; => G'0 address (alpha UDS) = 3 => origin = 3 KB 11b1 cd4615 call #1546 , write DOR register in 40-column mode 11b4 0e10 ld c,#10 ; value for TGS register ; => 40 char long, composite sync 11b6 f3 di 11b7 3e20 ld a,#20 11b9 ed3944 out0 (VDP_REGSEL),a 11bc ed3845 in0 a,(VDP_READ) 11bf cb57 bit 2,a 11c1 200c jr nz,#11cf 11c3 3e20 ld a,#20 11c5 ed3944 out0 (VDP_REGSEL),a 11c8 ed3845 in0 a,(VDP_READ) 11cb cb57 bit 2,a 11cd 28f4 jr z,#11c3 11cf 3e20 ld a,#20 11d1 ed3944 out0 (VDP_REGSEL),a 11d4 ed3845 in0 a,(VDP_READ) 11d7 cb57 bit 2,a 11d9 20f4 jr nz,#11cf 11db 3e81 ld a,#81 11dd cd5413 call #1354 ; VDP: IND cmd to write TGS reg 11e0 cdb712 call #12b7 11e3 fdcb007e bit 7,(iy+#00) 11e7 c44412 call nz,#1244 ; in 80 col, 11ea fdcb006e bit 5,(iy+#00) 11ee fdcb00ae res 5,(iy+#00) 11f2 cc6012 call z,#1260 11f5 c34013 jp #1340 ; enable {conceal, lower&upper bulk} 11f8 ddcb17be res 7,(ix+#17) ; reset screensaver mode 11fc ddcb176e bit 5,(ix+#17) ; what is the current page ? 1200 280b jr z,#120d 1202 182f jr #1233 ; select page 0 1204 ddcb176e bit 5,(ix+#17) 1208 ddcb17ae res 5,(ix+#17) ; switch to page 0 120c c8 ret z ; page 0: 120d fd2178f5 ld iy,#f578 1211 fdcb0066 bit 4,(iy+#00) 1215 2826 jr z,#123d 1217 fdcb00ee set 5,(iy+#00) 121b fdcb007e bit 7,(iy+#00) 121f 2083 jr nz,#11a4 1221 cd4315 call #1543 1224 cd0015 call #1500 1227 c3a411 jp #11a4 ; select page 1 122a ddcb176e bit 5,(ix+#17) 122e ddcb17ee set 5,(ix+#17) 1232 c0 ret nz ; page 1 1233 fd2183f5 ld iy,#f583 1237 fdcb0066 bit 4,(iy+#00) 123b 20da jr nz,#1217 123d fdcb00ae res 5,(iy+#00) 1241 c39211 jp #1192 1244 ddcb17c6 set 0,(ix+#17) ; force access to odd row address 1248 af xor a 1249 cdd012 call #12d0 ; init R6 with 0 124c 0e99 ld c,#99 124e 3e23 ld a,#23 1250 cd7013 call #1370 ; write #99 to R3 register: Negative=1, ColorSet=1 1253 215050 ld hl,#5050 ; 80 columns, and KRL command 1256 0600 ld b,#00 1258 cd0f11 call #110f ; clear screen memory 125b ddcb1786 res 0,(ix+#17) ; force access to even row address 125f c9 ret 1260 cd8111 call #1181 ; cursor home 1263 cdad12 call #12ad ; cursor on 1266 cddc15 call #15dc ; clear end of screen 1269 fd4604 ld b,(iy+#04) 126c fd7e05 ld a,(iy+#05) 126f fe17 cp #17 ; is cursor outside screen ? 1271 2835 jr z,#12a8 1273 fd7703 ld (iy+#03),a ; no, save current line 1276 cdc812 call #12c8 1279 78 ld a,b 127a f5 push af 127b cdfe10 call #10fe ; clear end of line 127e f1 pop af 127f b7 or a 1280 2808 jr z,#128a 1282 0600 ld b,#00 ; clear next lines from column #0 1284 fd7e03 ld a,(iy+#03) ; restore saved line number 1287 3c inc a 1288 18e5 jr #126f ; and loop => clear screen 128a fd7e03 ld a,(iy+#03) 128d cdeb12 call #12eb 1290 fd7e03 ld a,(iy+#03) 1293 3c inc a 1294 fe18 cp #18 1296 3013 jr nc,#12ab 1298 f5 push af 1299 cdc812 call #12c8 129c af xor a 129d cdd912 call #12d9 12a0 0ef9 ld c,#f9 ; Move Triple Buffer (MVT) command 12a2 cd5c13 call #135c 12a5 f1 pop af 12a6 18eb jr #1293 12a8 cdfe10 call #10fe 12ab 1818 jr #12c5 12ad fdcb00b6 res 6,(iy+#00) 12b1 c9 ret 12b2 fdcb00f6 set 6,(iy+#00) 12b6 c9 ret 12b7 fd7e06 ld a,(iy+#06) 12ba c608 add a,#08 ; Y is [8-31] on VDP 12bc ddb617 or (ix+#17) 12bf 4f ld c,a 12c0 3e87 ld a,#87 12c2 cd5413 call #1354 ; VDP: IND cmd to write ROR reg 12c5 fd7e05 ld a,(iy+#05) ; cursor line number 12c8 cdff12 call #12ff ; convert line number 12cb c648 add a,#48 12cd ddb617 or (ix+#17) 12d0 4f ld c,a 12d1 3e26 ld a,#26 ; write to R6 register 12d3 cd7013 call #1370 ; update the main pointer (cursor) 12d6 fd7e04 ld a,(iy+#04) ; write column to R7 register (main pointer) 12d9 fdcb007e bit 7,(iy+#00) 12dd 2006 jr nz,#12e5 12df cb3f srl a 12e1 3002 jr nc,#12e5 12e3 f680 or #80 12e5 4f ld c,a 12e6 3e27 ld a,#27 12e8 c37013 jp #1370 ; write to R7 register 12eb cdff12 call #12ff 12ee c608 add a,#08 12f0 ddb617 or (ix+#17) 12f3 4f ld c,a 12f4 3e24 ld a,#24 12f6 cd7013 call #1370 ; write to R4 register (auxiliary pointer low) 12f9 0e00 ld c,#00 12fb 3e25 ld a,#25 12fd 1871 jr #1370 ; write 0 to R5 register (auxiliary pointer high) 12ff fd8606 add a,(iy+#06) ; add line number 1302 c60c add a,#0c ; + low($130c) 1304 6f ld l,a 1305 2613 ld h,#13 1307 3001 jr nc,#130a 1309 24 inc h 130a 7e ld a,(hl) 130b c9 ret 130c byte 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25 1324 byte 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25 133c 0e78 ld c,#78 133e 1812 jr #1352 ; write PAT register ; => conceal enable, no service row, no lower|upper bulk 1340 fdcb007e bit 7,(iy+#00) 1344 200a jr nz,#1350 1346 ddcb176e bit 5,(ix+#17) ; what is the current page ? 134a 2004 jr nz,#1350 ; page 0: 134c 0e7f ld c,#7f 134e 1802 jr #1352 ; write PAT register ; => enable {conceal,lower&upper bulk, service row} ; page 1: 1350 0e7e ld c,#7e ; write PAT register ; => enable {conceal,lower&upper bulk}, no service row 1352 3e83 ld a,#83 ; VDP: write PAT register ; send a command with a parameter to the EF9345 and wait for completion ; A contains the command, C the parameter 1354 f5 push af 1355 3e21 ld a,#21 1357 cd7013 call #1370 ; write the parameter to R1 register 135a f1 pop af 135b 4f ld c,a ; write a command to R0 register 135c 3e28 ld a,#28 135e cd7013 call #1370 ; write the command to R0 register (command register) 1361 f3 di 1362 3e20 ld a,#20 1364 ed3944 out0 (VDP_REGSEL),a 1367 ed3845 in0 a,(VDP_READ) 136a e680 and #80 136c 20f9 jr nz,#1367 136e fb ei 136f c9 ret ; write a byte to the EF9345 ; A contains the register to write, C the data 1370 f3 di 1371 ed3944 out0 (VDP_REGSEL),a 1374 79 ld a,c 1375 ed3946 out0 (VDP_WRITE),a 1378 fb ei 1379 c9 ret ; read a byte from the EF9345 ; on entry, A contains the register to read, then the value read 137a f3 di 137b ed3944 out0 (VDP_REGSEL),a 137e ed3845 in0 a,(VDP_READ) 1381 fb ei 1382 c9 ret ; CRT output: handle special sequences in 80 column mode, ; A contains the ESC sequence number (low nibble of (iy+#00)) 1383 5f ld e,a ; save ESC sequence number in E 1384 cb27 sla a 1386 219b13 ld hl,#139b 1389 85 add a,l 138a 6f ld l,a 138b 3001 jr nc,#138e 138d 24 inc h 138e 7e ld a,(hl) 138f 23 inc hl 1390 66 ld h,(hl) 1391 6f ld l,a 1392 cd7614 call #1476 ; reset all 4 LSB flag bits 1395 78 ld a,b ; normalize function to uppercase 1396 fe60 cp #60 1398 3802 jr c,#139c 139a e65f and #5f 139c e9 jp (hl) ; go handle the function ; special CRT functions handling routines, in 139b(+2) 139d dw #1421 ; ESC sequence dw #14bb ; ESC2 sequence (ESC =) : position cursor dw #14ca ; ESC3 sequence (ESC = ) dw #14de ; ESC4 sequence (ESC-C) : set attribute dw #14de ; ESC5 sequence (ESC-B) : clear attribute dw #152c ; ESC6 sequence (ESC-H) : set status-line color dw #151e ; ESC7 sequence (ESC-L) : set characters color dw #1515 ; ESC8 sequence (ESC-M) : set background color dw #1482 ; ESC9 sequence (ESC-0) : write char in status line dw #1491 ; ESC10 sequence (ESC 0 ) ; ESC-E 13b1 fd7e04 ld a,(iy+#04) 13b4 f5 push af ; save column 13b5 fd360400 ld (iy+#04),#00 ; goto column 0 13b9 3e17 ld a,#17 ; start from outside screen 13bb fdbe05 cp (iy+#05) 13be 2811 jr z,#13d1 ; did we arrive to the current line ? 13c0 47 ld b,a 13c1 cdc812 call #12c8 13c4 05 dec b 13c5 78 ld a,b 13c6 cdeb12 call #12eb 13c9 0ef9 ld c,#f9 ; Move Triple Buffer (MVT) command 13cb cd5c13 call #135c 13ce 78 ld a,b 13cf 18ea jr #13bb 13d1 f1 pop af 13d2 fd7704 ld (iy+#04),a 13d5 cdc512 call #12c5 13d8 c3f710 jp #10f7 ; 13db fd7e04 ld a,(iy+#04) 13de f5 push af 13df fd360400 ld (iy+#04),#00 13e3 fd4605 ld b,(iy+#05) 13e6 78 ld a,b 13e7 cdc812 call #12c8 13ea 78 ld a,b 13eb fe17 cp #17 13ed 280c jr z,#13fb 13ef 04 inc b 13f0 78 ld a,b 13f1 cdeb12 call #12eb 13f4 0ef9 ld c,#f9 13f6 cd5c13 call #135c 13f9 18eb jr #13e6 13fb cdf710 call #10f7 13fe f1 pop af 13ff fd7704 ld (iy+#04),a 1402 c3c512 jp #12c5 ; restore cursor position 1405 fd7e07 ld a,(iy+#07) 1408 fd7704 ld (iy+#04),a 140b fd7e08 ld a,(iy+#08) 140e fd7705 ld (iy+#05),a 1411 c3c512 jp #12c5 ; save cursor position 1414 fd7e04 ld a,(iy+#04) 1417 fd7707 ld (iy+#07),a 141a fd7e05 ld a,(iy+#05) 141d fd7708 ld (iy+#08),a 1420 c9 ret ; Handle escape sequences 1421 fdcb007e bit 7,(iy+#00) 1425 c2e316 jp nz,#16e3 ; Escape sequences in 80 columns mode 1428 fe34 cp #34 ; ESC-4 : set 40-column mode 142a ca8c11 jp z,#118c 142d fe45 cp #45 ; ESC-E : insert a line 142f 2880 jr z,#13b1 1431 fe47 cp #47 ; ESC-G : restore cursor position 1433 28d0 jr z,#1405 1435 fe52 cp #52 ; ESC-R : remove a line 1437 28a2 jr z,#13db 1439 fe53 cp #53 ; ESC-S : save cursor position 143b 28d7 jr z,#1414 143d fe31 cp #31 ; ESC-1 : page 1 143f ca0412 jp z,#1204 1442 fe32 cp #32 ; ESC-2 : page 2 1444 ca2a12 jp z,#122a 1447 fe33 cp #33 ; ESC-3 : screensave 1449 ca6610 jp z,#1066 144c 0e02 ld c,#02 144e fe3d cp #3d ; ESC-= : set ESC2 sequence 1450 2826 jr z,#1478 1452 0e05 ld c,#05 1454 fe42 cp #42 ; ESC-B : set ESC5 sequence 1456 2820 jr z,#1478 1458 0e04 ld c,#04 145a fe43 cp #43 ; ESC-C : set ESC4 sequence 145c 281a jr z,#1478 145e 0e06 ld c,#06 1460 fe48 cp #48 ; ESC-H : set ESC6 sequence 1462 2814 jr z,#1478 1464 0e07 ld c,#07 1466 fe4c cp #4c ; ESC-L : set ESC7 sequence 1468 280e jr z,#1478 146a 0e08 ld c,#08 146c fe4d cp #4d ; ESC-M : set ESC8 sequence 146e 2808 jr z,#1478 1470 0e09 ld c,#09 1472 fe30 cp #30 ; ESC-0 : set ESC9 sequence 1474 2802 jr z,#1478 1476 0e00 ld c,#00 ; clear ESC sequence ; set an ESCn sequence 1478 fd7e00 ld a,(iy+#00) 147b e6f0 and #f0 147d b1 or c 147e fd7700 ld (iy+#00),a 1481 c9 ret ; handle next character of ESC-0 sequence : column number ; column number is given by ASCII character minus 20h 1482 78 ld a,b 1483 d620 sub #20 1485 fe50 cp #50 1487 3801 jr c,#148a 1489 af xor a 148a fd7703 ld (iy+#03),a 148d 0e0a ld c,#0a ; set ESC10 sequence 148f 18e7 jr #1478 ; handle next character of ESC-0 sequence ; Next character is a character to display in status line 1491 af xor a 1492 cdd012 call #12d0 ; reset main pointer R6-R7 ? 1495 fd7e03 ld a,(iy+#03) 1498 cddf12 call #12df ; write main pointer high (R7) 149b 0e99 ld c,#99 ; normal attribute: color set, negative 149d cb78 bit 7,b ; if character > 127, 149f 2802 jr z,#14a3 14a1 0edd ld c,#dd ; then add underline attribute 14a3 3e23 ld a,#23 14a5 cd7013 call #1370 ; write #dd to R3 14a8 78 ld a,b 14a9 e67f and #7f 14ab 4f ld c,a 14ac 3e50 ld a,#50 14ae cd5413 call #1354 ; send KRL command 14b1 fdcb007e bit 7,(iy+#00) 14b5 cc0015 call z,#1500 14b8 c3c512 jp #12c5 ; restore cursor position ; handle line number in ESC= sequence ; line number is given by ASCII character minus 20h 14bb 78 ld a,b 14bc d620 sub #20 14be fe18 cp #18 ; line number must be <24 14c0 3801 jr c,#14c3 14c2 af xor a 14c3 fd7703 ld (iy+#03),a ; store line number in temp variable 14c6 0e03 ld c,#03 14c8 18ae jr #1478 ; set ESC3 sequence ; handle column number in ESC= sequence ; column number is given by ASCII character minus 20h 14ca 78 ld a,b 14cb d620 sub #20 14cd fe50 cp #50 ; column number must be <80 14cf 3801 jr c,#14d2 14d1 af xor a 14d2 fd7704 ld (iy+#04),a ; set column 14d5 fd7e03 ld a,(iy+#03) 14d8 fd7705 ld (iy+#05),a ; set line with previously stored value 14db c3c512 jp #12c5 ; handle next character of ESC-C and ESC-B sequences ; Next character must be 0, 1, 2 or 3 ; ; ESC C 0 : color set ; ESC C 1 : underline ; ESC C 2 : flashing ; ESC C 3 : negative ; current attributes are stored in high nibble of iy+#02 14de ee30 xor #30 14e0 fe04 cp #04 14e2 d0 ret nc ; only accepts 0,1,2,3 ; to map into flags $10,$20,$40,$80 14e3 0610 ld b,#10 14e5 b7 or a 14e6 2805 jr z,#14ed 14e8 cb20 sla b 14ea 3d dec a 14eb 18f8 jr #14e5 14ed 7b ld a,e 14ee fe05 cp #05 ; ESC-B sequence ? 14f0 78 ld a,b 14f1 2805 jr z,#14f8 14f3 fdb602 or (iy+#02) ; ESC-C set bit in iy+#02 14f6 1805 jr #14fd 14f8 eeff xor #ff ; ESC-B clear bit in iy+#02 14fa fda602 and (iy+#02) ; duplicate high nibble of iy+#02 to write to R3 register 14fd fd7702 ld (iy+#02),a 1500 fd7e02 ld a,(iy+#02) 1503 e6f0 and #f0 1505 47 ld b,a 1506 cb3f srl a 1508 cb3f srl a 150a cb3f srl a 150c cb3f srl a 150e b0 or b 150f 4f ld c,a 1510 3e23 ld a,#23 1512 c37013 jp #1370 ; write to R3 ; handle next character of ESC-M sequence (select background color) ; Character must be in @ABCDEFG to give a 0 to 7 value ; the value is stored in iy+#09 1515 d640 sub #40 1517 fe08 cp #08 1519 d0 ret nc 151a fd7709 ld (iy+#09),a 151d c9 ret ; handle next character of ESC-L sequence (select characters color) ; Character must be in @ABCDEFG to give a 0 to 7 value ; This will update bits 210 of DOR register and thus select color ! 151e d640 sub #40 1520 fe08 cp #08 1522 d0 ret nc 1523 47 ld b,a 1524 fd7e01 ld a,(iy+#01) 1527 e6f8 and #f8 1529 b0 or b 152a 1814 jr #1540 ; handle next character of ESC-H sequence (select status-line color) ; Character must be in @ABCDEFG to give a 0 to 7 value ; This will update bits 654 of DOR register and thus select color ! 152c d640 sub #40 152e fe08 cp #08 1530 d0 ret nc 1531 cb27 sla a 1533 cb27 sla a 1535 cb27 sla a 1537 cb27 sla a 1539 47 ld b,a 153a fd7e01 ld a,(iy+#01) 153d e68f and #8f 153f b0 or b 1540 fd7701 ld (iy+#01),a 1543 fd4e01 ld c,(iy+#01) 1546 3e84 ld a,#84 ; VDP: IND cmd to write DOR reg 1548 c35413 jp #1354 ;*********************************************************************** ;* 40 column mode * ;*********************************************************************** 154b daed15 jp c,#15ed ; jump for control characters 154e 0e08 ld c,#08 1550 cd5c13 call #135c ; send a KRF read command 1553 3e21 ld a,#21 1555 cd7a13 call #137a ; read VDP's register R1 (byte C) 1558 b7 or a 1559 f26915 jp p,#1569 ; jump if bit 7 not set ; here we have bit 7 set: 155c 3e22 ld a,#22 155e cd7a13 call #137a ; read VDP's register R2 (byte B) 1561 cb4f bit 1,a 1563 2069 jr nz,#15ce ; jump if double height attribute ? 1565 fdcb02ee set 5,(iy+#02) ; ?? force execution of routine 1686 at the end 1569 fd7e02 ld a,(iy+#02) 156c e60f and #0f ; force the alpha user defined set (G'0) 156e f680 or #80 1570 4f ld c,a 1571 78 ld a,b ; character to write 1572 fe40 cp #40 1574 3804 jr c,#157a 1576 fe60 cp #60 1578 381e jr c,#1598 ; for characters out of [40h-5f] range ; get this special handling : 157a fdcb0246 bit 0,(iy+#02) 157e 2818 jr z,#1598 ; skip if mosaic mode is off ; Remap codes in order to access mosaic characters : ; codes [60-7f] are remapped to [20-3f] or [60-7f] ; codes [20-3f] are remapped to [00-1f] or [40-5f] 1580 e65f and #5f 1582 fe40 cp #40 1584 3802 jr c,#1588 1586 ee60 xor #60 1588 fdcb017e bit 7,(iy+#01) ; separated mosaic ? 158c 2002 jr nz,#1590 158e f640 or #40 ; select continuous mosaic set 1590 47 ld b,a 1591 fd770a ld (iy+#0a),a 1594 79 ld a,c 1595 eea0 xor #a0 ; select the mosaic set 1597 4f ld c,a 1598 3e22 ld a,#22 159a cd7013 call #1370 ; write to R2 (B byte) 159d fd4e01 ld c,(iy+#01) ; current value of A byte 15a0 3e23 ld a,#23 15a2 cd7013 call #1370 ; write to R3 (A byte) 15a5 48 ld c,b 15a6 af xor a 15a7 cd5413 call #1354 ; VDP: send KRF write command 15aa fdcb024e bit 1,(iy+#02) ; double height ? 15ae 2813 jr z,#15c3 ; skip if single height... ; writing in double height mode : 15b0 fd7e05 ld a,(iy+#05) 15b3 fe17 cp #17 15b5 280c jr z,#15c3 ; skip if on 25th line 15b7 3c inc a 15b8 cdc812 call #12c8 ; write on next line too 15bb 78 ld a,b 15bc f680 or #80 ; set bit 7 to recognize these characters 15be 4f ld c,a 15bf af xor a 15c0 cd5413 call #1354 ; VDP: send KRF write command 15c3 fdcb026e bit 5,(iy+#02) 15c7 fdcb02ae res 5,(iy+#02) 15cb c48616 call nz,#1686 ; do this if bit 5 = 1, then reset bit 5 15ce fd3404 inc (iy+#04) 15d1 fd7e04 ld a,(iy+#04) 15d4 fe28 cp #28 ; did we write to the last column ? 15d6 dac512 jp c,#12c5 ; no => restore cursor position 15d9 cdcd10 call #10cd ; yes => go to start of next line 15dc fd360200 ld (iy+#02),#00; reset attributes for new line 15e0 fdcb007e bit 7,(iy+#00) 15e4 c8 ret z ; return if mode 80 columns 15e5 fd770a ld (iy+#0a),a ; store what ?? 15e8 fd360170 ld (iy+#01),#70; reset to white foreground, black background 15ec c9 ret ; Control characters in 40 columns mode 15ed fe0c cp #0c ; Ctrl-L : clear screen 15ef ca6012 jp z,#1260 15f2 fe08 cp #08 ; Ctrl-H : cursor left 15f4 ca1d16 jp z,#161d 15f7 fe09 cp #09 ; Ctrl-I : cursor right 15f9 ca2216 jp z,#1622 15fc fe0a cp #0a ; Ctrl-J : cursor down 15fe ca2716 jp z,#1627 1601 fe0b cp #0b ; Ctrl-K : cursor up 1603 ca3216 jp z,#1632 1606 fe0d cp #0d ; Ctrl-M : carriage return 1608 ca8016 jp z,#1680 160b fe11 cp #11 ; Ctrl-Q : cursor on 160d caad12 jp z,#12ad 1610 fe14 cp #14 ; Ctrl-T : cursor off 1612 cab212 jp z,#12b2 1615 fe1e cp #1e ; Ctrl-^ : cursor home 1617 ca7d16 jp z,#167d 161a c35911 jp #1159 ; cursor left 161d cd6111 call #1161 1620 1813 jr #1635 ; cursor right 1622 cdce15 call #15ce 1625 180e jr #1635 ; cursor down 1627 cdd110 call #10d1 162a fd7e04 ld a,(iy+#04) 162d b7 or a 162e 28ac jr z,#15dc 1630 1803 jr #1635 ; cursor up 1632 cd7411 call #1174 1635 fd4604 ld b,(iy+#04) 1638 04 inc b ; loop searching for an attribute character 1639 05 dec b 163a 78 ld a,b 163b e67f and #7f 163d cdd912 call #12d9 ; write column 1640 0e08 ld c,#08 1642 cd5c13 call #135c ; send KRF read command 1645 3e21 ld a,#21 1647 cd7a13 call #137a ; read VDP's register R1 (byte C) 164a b7 or a 164b f26a16 jp p,#166a ; positive character ? ok, read normal attributes ; negative characters act as flags marking special attributes 164e 3e22 ld a,#22 1650 cd7a13 call #137a ; read VDP's register R2 (byte B) 1653 cb4f bit 1,a 1655 2006 jr nz,#165d ; skip if single height character 1657 cb78 bit 7,b 1659 cbf8 set 7,b 165b 200d jr nz,#166a 165d 78 ld a,b 165e e67f and #7f 1660 3d dec a 1661 f23916 jp p,#1639 ; continue loop, searching for normal attributes 1664 cddc15 call #15dc 1667 c3d612 jp #12d6 ; read VDP's register R2 and R3 166a 3e22 ld a,#22 166c cd7a13 call #137a ; read VDP's register R2 166f fd7702 ld (iy+#02),a 1672 3e23 ld a,#23 1674 cd7a13 call #137a ; read VDP's register R3 1677 fd7701 ld (iy+#01),a 167a c3d612 jp #12d6 ; Ctrl-^ (HOME) in 40 columns mode 167d cd8111 call #1181 ; cursor home 1680 cd8511 call #1185 ; go to beginning of line 1683 c3dc15 jp #15dc 1686 cdc512 call #12c5 1689 fd4604 ld b,(iy+#04) ; increment cursor column 168c 04 inc b 168d 78 ld a,b 168e fe28 cp #28 1690 d0 ret nc 1691 cdd912 call #12d9 ; write column to main pointer 1694 0e08 ld c,#08 1696 cd5c13 call #135c ; send KRF read command 1699 3e21 ld a,#21 169b cd7a13 call #137a ; read VDP's register R1 (byte C) 169e b7 or a 169f f2ac16 jp p,#16ac ; jump if positive byte 16a2 3e22 ld a,#22 16a4 cd7a13 call #137a ; read VDP's register R2 (byte B) 16a7 cb4f bit 1,a 16a9 20e1 jr nz,#168c ; loop increment column if double height ? 16ab c9 ret ; apply attributes of iy+2 in low nibble of B byte for KRF command 16ac fd7e02 ld a,(iy+#02) ; take low nibble of iy+2 16af e60f and #0f 16b1 4f ld c,a 16b2 3e22 ld a,#22 16b4 cd7a13 call #137a ; read VDP's register R2 16b7 e6f0 and #f0 ; keep high nibble 16b9 b1 or c ; OR with low nibble of iy+2 16ba 4f ld c,a 16bb 3e22 ld a,#22 16bd cd7013 call #1370 ; write to R2 16c0 fd4e01 ld c,(iy+#01) ; get value of A byte 16c3 3e23 ld a,#23 16c5 cd7013 call #1370 ; write to R3 16c8 0e00 ld c,#00 16ca cd5c13 call #135c ; send KRF write command 16cd 18bd jr #168c 16cf 0e00 ld c,#00 16d1 fdcb007e bit 7,(iy+#00) 16d5 2807 jr z,#16de ; if 80 columns, no need to write R2 16d7 3e22 ld a,#22 16d9 cd7013 call #1370 ; write to R2 16dc 0e70 ld c,#70 16de 3e23 ld a,#23 16e0 c37013 jp #1370 ; write to R3 ; Escape sequences in 40 columns mode 16e3 fd4601 ld b,(iy+#01) ; load current value of A byte 16e6 fe38 cp #38 ; ESC-8 : set 80 column mode 16e8 ca9611 jp z,#1196 16eb fe48 cp #48 ; ESC-H : flashing on 16ed cace17 jp z,#17ce 16f0 fe49 cp #49 ; ESC-I : flashing off 16f2 cad417 jp z,#17d4 16f5 fe4c cp #4c ; ESC-L : reset double height 16f7 cac217 jp z,#17c2 16fa fe4d cp #4d ; ESC-M : set double height 16fc cac817 jp z,#17c8 16ff fe58 cp #58 ; ESC-X : set bit 2 of iy+#02 (conceal on) 1701 cabc17 jp z,#17bc 1704 fe5e cp #5e ; ESC-^ : set bit 6 of iy+#02 (accept attributes?) 1706 cab017 jp z,#17b0 1709 fe5f cp #5f ; ESC-_ : reset bit 6 of iy+#02 170b cab617 jp z,#17b6 170e fe5d cp #5d ; ESC-] : change colormode ? 1710 ca9917 jp z,#1799 1713 fe5c cp #5c ; ESC-\ : change colormode ? 1715 2877 jr z,#178e 1717 fe59 cp #59 ; ESC-Y : non-separated mosaic set 1719 2853 jr z,#176e 171b fe5a cp #5a ; ESC-Z : separated mosaic set 171d 285f jr z,#177e 171f 0e09 ld c,#09 1721 fe30 cp #30 ; ESC-0 : write char to status line 1723 ca7814 jp z,#1478 1726 fe31 cp #31 ; ESC-1 : page 1 ? 1728 ca0412 jp z,#1204 172b fe32 cp #32 ; ESC-2 : page 2 ? 172d ca2a12 jp z,#122a 1730 fe33 cp #33 ; ESC-3 : ? 1732 ca6610 jp z,#1066 1735 fe40 cp #40 1737 d8 ret c 1738 fe58 cp #58 173a d0 ret nc 173b fe50 cp #50 173d 3806 jr c,#1745 173f fdcb02c6 set 0,(iy+#02) ; set mosaic mode 1743 1812 jr #1757 ; ESC-P to ESC-W : mosaic mode color 1745 fe48 cp #48 1747 d0 ret nc ; ESC-@ to ESC-G : set character color 1748 cb78 bit 7,b 174a 2807 jr z,#1753 ; skip if normal video 174c f5 push af 174d cbb8 res 7,b ; reset to normal video 174f cd0018 call #1800 ; and swap foreground/background colors 1752 f1 pop af 1753 fdcb0286 res 0,(iy+#02) ; reset mosaic mode 1757 e607 and #07 1759 cb27 sla a 175b cb27 sla a 175d cb27 sla a 175f cb27 sla a 1761 5f ld e,a 1762 cdfb17 call #17fb ; swap colors if reverse video 1765 e68f and #8f 1767 b3 or e ; set foreground color 1768 47 ld b,a 1769 cdfb17 call #17fb ; swap colors if reverse video 176c 186a jr #17d8 ; ESC-Y: 176e fdcb0246 bit 0,(iy+#02) 1772 c8 ret z ; return if not in mosaic mode 1773 cb78 bit 7,b 1775 2861 jr z,#17d8 ; skip if continuous mosaic already 1777 cbb8 res 7,b ; reset to continuous mosaic 1779 cd0018 call #1800 177c 185a jr #17d8 ; ESC-Z: 177e fdcb0246 bit 0,(iy+#02) 1782 c8 ret z ; return if not in mosaic mode 1783 cb78 bit 7,b 1785 2051 jr nz,#17d8 ; skip if separated mosaic already 1787 cbf8 set 7,b ; set to separated mosaic 1789 cd0018 call #1800 178c 184a jr #17d8 ; ESC-\ 178e cdfb17 call #17fb ; swap colors if reverse video 1791 e6f8 and #f8 ; force background to black 1793 47 ld b,a 1794 cdfb17 call #17fb ; swap colors if reverse video 1797 183f jr #17d8 ; ; ESC-] 1799 cdfb17 call #17fb ; swap colors if reverse video 179c e6f8 and #f8 179e 4f ld c,a 179f e670 and #70 17a1 cb3f srl a ; copy foreground color to background 17a3 cb3f srl a 17a5 cb3f srl a 17a7 cb3f srl a 17a9 b1 or c 17aa 47 ld b,a 17ab cdfb17 call #17fb ; swap colors if reverse video 17ae 1828 jr #17d8 17b0 fdcb02f6 set 6,(iy+#02) 17b4 1822 jr #17d8 17b6 fdcb02b6 res 6,(iy+#02) 17ba 181c jr #17d8 17bc fdcb02d6 set 2,(iy+#02) ; set conceal attribute 17c0 1816 jr #17d8 17c2 fdcb028e res 1,(iy+#02) ; reset double height 17c6 1810 jr #17d8 17c8 fdcb02ce set 1,(iy+#02) ; set double height 17cc 180a jr #17d8 17ce fdcb01de set 3,(iy+#01) ; set flashing attribute 17d2 1804 jr #17d8 17d4 fdcb019e res 3,(iy+#01) ; reset flashing attribute ; write a sequential attribute in 40-column mode: 17d8 fdcb02ee set 5,(iy+#02) 17dc 06a0 ld b,#a0 ; space character with bit 7 set 17de fd7e02 ld a,(iy+#02) ; get current attributes 17e1 e60f and #0f ; (double width, conceal, double height, mosaic) 17e3 4f ld c,a ; (and standard G0 set by default) 17e4 fdcb0276 bit 6,(iy+#02) 17e8 ca9815 jp z,#1598 ; skip the following if bit 6 not set 17eb cb47 bit 0,a ; mosaic mode ? 17ed ca9815 jp z,#1598 ; skip if not mosaic mode 17f0 f620 or #20 ; set type mosaic set 17f2 4f ld c,a 17f3 fd460a ld b,(iy+#0a) 17f6 cbf8 set 7,b ; set bit 7 as a marker 17f8 c39815 jp #1598 ; write R2,R3 register, then KRF 17fb 78 ld a,b 17fc cb7f bit 7,a ; don't do anything if normal video 17fe 281e jr z,#181e ; but swap colors if reverse video ; swap bits 210 and bits 654 (background/foreground colors ?) 1800 78 ld a,b 1801 e688 and #88 1803 4f ld c,a 1804 78 ld a,b 1805 e607 and #07 1807 cb27 sla a 1809 cb27 sla a 180b cb27 sla a 180d cb27 sla a 180f b1 or c 1810 4f ld c,a 1811 78 ld a,b 1812 e670 and #70 1814 cb3f srl a 1816 cb3f srl a 1818 cb3f srl a 181a cb3f srl a 181c b1 or c 181d 47 ld b,a 181e fd7701 ld (iy+#01),a 1821 c9 ret ;****************************************************************************** ; start RTC ; reset to 1/1/86 00:00:00 if Carry=1 1822 302f jr nc,#1853 1824 116a18 ld de,#186a ; init time/date in RTC chip from buffer pointed by DE ; if first byte is -1, then only init date (4 bytes) from buffer ; otherwise 7 bytes are transfered 1827 0e70 ld c,#70 ; stop operation of RTC 1829 3e0a ld a,#0a 182b cd5718 call #1857 182e 0e82 ld c,#82 ; select 24-hour mode 1830 3e0b ld a,#0b 1832 cd5718 call #1857 1835 eb ex de,hl 1836 116318 ld de,#1863 1839 0607 ld b,#07 183b 34 inc (hl) 183c 2005 jr nz,#1843 183e 116618 ld de,#1866 1841 0604 ld b,#04 1843 23 inc hl 1844 1a ld a,(de) 1845 4e ld c,(hl) 1846 cd5718 call #1857 1849 13 inc de 184a 10f7 djnz #1843 184c 0e20 ld c,#20 ; start operation of RTC, 32768 kHz 184e 3e0a ld a,#0a 1850 cd5718 call #1857 1853 0e12 ld c,#12 ; allow RTC update-ended interrupts 1855 3e0b ld a,#0b ; write C to the RTC register in A 1857 ed3943 out0 (RTC_REGSEL),a 185a fe06 cp #06 ; is it address #6 ? (Day of the Week) 185c 2001 jr nz,#185f 185e 0c inc c ; Day of the Week is in 1..7 185f ed0942 out0 (RTC_WRITE),c 1862 c9 ret 1863 db 00 02 04 06 07 08 09 ; registers of RTC to initialize 186a db 00 186b db 00 00 00 03 01 01 86 ; date/time for the RTC: 01/01/86 00:00:00 ; INT2 interrupt handler : Real Time Clock 1872 3e0c ld a,#0c 1874 cd9519 call #1995 ; read RTC's register C => reset flag bits 1877 213df5 ld hl,#f53d ; address of buffer to prepare time representation 187a 3632 ld (hl),#32 ; to write from column 50... 187c 23 inc hl 187d 3650 ld (hl),#50 ; ... to column 80 187f 23 inc hl 1880 3e04 ld a,#04 1882 cd9519 call #1995 ; read Hours from RTC 1885 3238f5 ld (#f538),a ; update Hours in ram 1888 cd5919 call #1959 ; convert to one or two ascii characters 188b 363a ld (hl),#3a ; colon separator 188d 23 inc hl 188e 3e02 ld a,#02 ; read Minutes from RTC 1890 cd9519 call #1995 1893 3237f5 ld (#f537),a 1896 cd5d19 call #195d ; convert to two ascii characters 1899 362e ld (hl),#2e ; dot separator 189b 23 inc hl 189c af xor a 189d cd9519 call #1995 ; read Seconds from RTC 18a0 3236f5 ld (#f536),a 18a3 cd5d19 call #195d ; convert to two ascii characters 18a6 3620 ld (hl),#20 ; add two spaces 18a8 23 inc hl 18a9 3620 ld (hl),#20 18ab 23 inc hl 18ac 3e06 ld a,#06 ; read day of week from RTC 18ae cd9519 call #1995 18b1 3d dec a 18b2 3239f5 ld (#f539),a 18b5 3c inc a 18b6 ddcb1b7e bit 7,(ix+#1b) 18ba c2f618 jp nz,#18f6 ; Day DD Month 19YY representation 18bd 119c19 ld de,#199c ; pointer to day language table 18c0 cd7119 call #1971 ; get name of day 18c3 3620 ld (hl),#20 ; add a space 18c5 23 inc hl 18c6 3e07 ld a,#07 ; read day of month from RTC 18c8 cd9519 call #1995 18cb 323af5 ld (#f53a),a 18ce cd5919 call #1959 ; convert to one or two ascii characters 18d1 3620 ld (hl),#20 ; space separator 18d3 23 inc hl 18d4 3e08 ld a,#08 ; read month from RTC 18d6 cd9519 call #1995 18d9 323bf5 ld (#f53b),a 18dc 4f ld c,a ; convert BCD to binary 18dd e60f and #0f 18df cb61 bit 4,c 18e1 2802 jr z,#18e5 18e3 c60a add a,#0a 18e5 113f1a ld de,#1a3f ; pointer to month language table 18e8 cd7119 call #1971 ; get month name in current language 18eb 3620 ld (hl),#20 ; space separator 18ed 23 inc hl 18ee 3631 ld (hl),#31 ; 19xx year : haha, doesn't pass year 2000 18f0 23 inc hl 18f1 3639 ld (hl),#39 18f3 23 inc hl 18f4 183d jr #1933 18f6 ddcb1b76 bit 6,(ix+#1b) 18fa 201b jr nz,#1917 ; DD-MM-YY representation 18fc 3e07 ld a,#07 ; read day of month from RTC 18fe cd9519 call #1995 1901 323af5 ld (#f53a),a 1904 cd5d19 call #195d 1907 362d ld (hl),#2d ; - separator 1909 23 inc hl 190a 3e08 ld a,#08 ; read month from RTC 190c cd9519 call #1995 190f 323bf5 ld (#f53b),a 1912 cd5d19 call #195d 1915 1819 jr #1930 ; MM-DD-YY representation 1917 3e08 ld a,#08 ; read month from RTC 1919 cd9519 call #1995 191c 323bf5 ld (#f53b),a 191f cd5d19 call #195d 1922 362d ld (hl),#2d ; - separator 1924 23 inc hl 1925 3e07 ld a,#07 ; read day of month from RTC 1927 cd9519 call #1995 192a 323af5 ld (#f53a),a 192d cd5d19 call #195d 1930 362d ld (hl),#2d ; - separator 1932 23 inc hl 1933 3e09 ld a,#09 ; read year from RTC 1935 cd9519 call #1995 1938 323cf5 ld (#f53c),a 193b cd5d19 call #195d 193e 3600 ld (hl),#00 ; end of string 1940 213df5 ld hl,#f53d ; reload start of string in HL 1943 ddcb1746 bit 0,(ix+#17) 1947 c0 ret nz ; don't interrupt a double height write 1948 ddcb176e bit 5,(ix+#17) 194c c0 ret nz ; display time/date only on page 0 194d fd2178f5 ld iy,#f578 1951 fdcb007e bit 7,(iy+#00) 1955 c0 ret nz ; don't display in 40 column mode 1956 c3a21b jp #1ba2 ; display the string on the status line ; convert BCD byte to one or two ascii characters 1959 fe10 cp #10 195b 380d jr c,#196a ; convert BCD byte to two ascii characters 195d f5 push af 195e cb3f srl a 1960 cb3f srl a 1962 cb3f srl a 1964 cb3f srl a 1966 cd6a19 call #196a 1969 f1 pop af 196a e60f and #0f 196c f630 or #30 196e 77 ld (hl),a 196f 23 inc hl 1970 c9 ret 1971 4f ld c,a 1972 e5 push hl 1973 eb ex de,hl 1974 dd7e1b ld a,(ix+#1b) ; system language 1977 e607 and #07 1979 cb27 sla a 197b 5f ld e,a 197c 1600 ld d,#00 197e 19 add hl,de 197f 7e ld a,(hl) 1980 23 inc hl 1981 66 ld h,(hl) 1982 6f ld l,a 1983 0d dec c 1984 79 ld a,c 1985 cb27 sla a 1987 81 add a,c 1988 5f ld e,a 1989 19 add hl,de 198a eb ex de,hl 198b e1 pop hl 198c 0603 ld b,#03 198e 1a ld a,(de) 198f 77 ld (hl),a 1990 13 inc de 1991 23 inc hl 1992 10fa djnz #198e 1994 c9 ret 1995 ed3943 out0 (RTC_REGSEL),a 1998 ed3841 in0 a,(RTC_READ) 199b c9 ret 199c dw $19ac, $19c1, $19d6, $19ac, $1a2a, $19eb, $1a00, $1a15 19ac "SunMonTueWedThuFriSat" ; 0 and 3: English 19c1 "DimLunMarMerJeuVenSam" ; 1: French 19d6 "SonMonDieMitDonFreSam" ; 2: German 19eb "DomLunMarMerGioVenSab" ; 5: Italian 1a00 "DomLunMarMieJueVieSab" ; 6: Spanish 1a15 "NedPonTorSreCetPetSob" ; 7: Slovenian 1a2a "NedPonUtoSreCetPetSub" ; 4: Croatian 1a3f dw $1a4f, $1a73, $1a97, $1a4f, $1b27, $1abb, $1adf, $1b03 1a4f "JanFebMarAprMayJunJulAugSepOctNovDec" 1a73 "JanFevMarAvrMaiJuiJulAouSepOctNovDec" 1a97 "JanFebMarAprMaiJunJulAugSepOktNovDez" 1abb "GenFebMarAprMagGiuLugAgoSetOttNovDic" 1adf "EneFebMarAbrMayJunJulAgoSepOctNovDic" 1b03 "JanFebMarAprMajJunJulAvgSepOktNovDec" 1b27 "SijVelOzuTraSviLipSrpKolRujLisStuPro" ; read the BIOS configuration data from the ; non-volatile 50-bytes RAM of the RTC chip 1b4b f3 di 1b4c 2193f4 ld hl,#f493 1b4f 0632 ld b,#32 ; 50 bytes to read 1b51 0e0e ld c,#0e ; first RAM address in the RTC chip is 0e 1b53 af xor a ; init checksum 1b54 5f ld e,a 1b55 83 add a,e 1b56 5f ld e,a 1b57 ed0943 out0 (RTC_REGSEL),c 1b5a ed3841 in0 a,(RTC_READ) 1b5d 77 ld (hl),a 1b5e 0c inc c 1b5f 23 inc hl 1b60 10f3 djnz #1b55 1b62 ab xor e ; last byte is checksum 1b63 fb ei 1b64 c8 ret z ; return (with Carry=0) if checksum is correct 1b65 cd6d1b call #1b6d ; otherwise takes default BIOS config from rom 1b68 cd841b call #1b84 ; and write it to the RTC's backup-ed RAM 1b6b 37 scf ; return Carry flag 1b6c c9 ret ; copy 49 bytes of BIOS configuration data from rom to ram, 1b6d 212b1c ld hl,#1c2b 1b70 1193f4 ld de,#f493 1b73 013100 ld bc,#0031 1b76 edb0 ldir ; and add a 50th byte of checksum 1b78 2193f4 ld hl,#f493 1b7b 0631 ld b,#31 1b7d af xor a 1b7e 86 add a,(hl) 1b7f 23 inc hl 1b80 10fc djnz #1b7e 1b82 77 ld (hl),a 1b83 c9 ret ; send the BIOS configuration data ; to the RTC's backup RAM 1b84 f3 di 1b85 2193f4 ld hl,#f493 1b88 0631 ld b,#31 1b8a 0e0e ld c,#0e 1b8c ed0943 out0 (RTC_REGSEL),c 1b8f 7e ld a,(hl) 1b90 ed3942 out0 (RTC_WRITE),a 1b93 0c inc c 1b94 23 inc hl 1b95 10f5 djnz #1b8c 1b97 cd781b call #1b78 ; calculate the checksum and send it too 1b9a ed0943 out0 (RTC_REGSEL),c 1b9d ed3942 out0 (RTC_WRITE),a 1ba0 fb ei 1ba1 c9 ret ; display string on status line 1ba2 3e21 ld a,#21 1ba4 ed3944 out0 (VDP_REGSEL),a 1ba7 ed3845 in0 a,(VDP_READ) 1baa f5 push af 1bab 3e24 ld a,#24 1bad ed3944 out0 (VDP_REGSEL),a 1bb0 ed3845 in0 a,(VDP_READ) 1bb3 f5 push af 1bb4 3e25 ld a,#25 1bb6 ed3944 out0 (VDP_REGSEL),a 1bb9 ed3845 in0 a,(VDP_READ) 1bbc f5 push af 1bbd 3e24 ld a,#24 1bbf ed3944 out0 (VDP_REGSEL),a 1bc2 af xor a 1bc3 ed3946 out0 (VDP_WRITE),a 1bc6 46 ld b,(hl) ; column to write to 1bc7 23 inc hl 1bc8 5e ld e,(hl) ; last column to write 1bc9 23 inc hl 1bca 7e ld a,(hl) ; string starts with 3rd byte 1bcb b7 or a 1bcc 2807 jr z,#1bd5 1bce 4f ld c,a 1bcf cdfd1b call #1bfd 1bd2 04 inc b 1bd3 18f4 jr #1bc9 1bd5 7b ld a,e 1bd6 b8 cp b 1bd7 2808 jr z,#1be1 1bd9 0e20 ld c,#20 ; fills the end with spaces 1bdb cdfd1b call #1bfd 1bde 04 inc b 1bdf 18f4 jr #1bd5 1be1 3e25 ld a,#25 1be3 ed3944 out0 (VDP_REGSEL),a 1be6 f1 pop af 1be7 ed3946 out0 (VDP_WRITE),a 1bea 3e24 ld a,#24 1bec ed3944 out0 (VDP_REGSEL),a 1bef f1 pop af 1bf0 ed3946 out0 (VDP_WRITE),a 1bf3 3e21 ld a,#21 1bf5 ed3944 out0 (VDP_REGSEL),a 1bf8 f1 pop af 1bf9 ed3946 out0 (VDP_WRITE),a 1bfc c9 ret 1bfd 3e25 ld a,#25 1bff ed3944 out0 (VDP_REGSEL),a 1c02 78 ld a,b 1c03 cb3f srl a 1c05 3002 jr nc,#1c09 1c07 c680 add a,#80 1c09 ed3946 out0 (VDP_WRITE),a 1c0c 3e21 ld a,#21 1c0e ed3944 out0 (VDP_REGSEL),a 1c11 ed0946 out0 (VDP_WRITE),c 1c14 3e28 ld a,#28 1c16 ed3944 out0 (VDP_REGSEL),a 1c19 3e34 ld a,#34 1c1b ed3946 out0 (VDP_WRITE),a 1c1e 3e20 ld a,#20 1c20 ed3944 out0 (VDP_REGSEL),a 1c23 ed3845 in0 a,(VDP_READ) 1c26 e680 and #80 1c28 20f9 jr nz,#1c23 1c2a c9 ret ; default BIOS configuration data, copied to f493 1c2b db 00 5d 80 00 50 00 04 0f 00 8f 01 7f 00 c0 00 20 1c3b db 00 00 00 03 07 09 01 50 68 73 81 ff ff ff ff ff 1c4b db ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff 1c5b db ff ff ff ; initialize Disk Parameter Block of drive 3 from the BIOS configuration data 1c5e 2197f4 ld hl,#f497 1c61 113ff4 ld de,#f43f 1c64 011600 ld bc,#0016 1c67 edb0 ldir 1c69 c9 ret ; init or get date/time ; Init if C=-1, get date/time otherwise ; DE=address to transfer the date/time 1c6a f3 di 1c6b 0c inc c 1c6c ca7c1c jp z,#1c7c ; transfer the time/date from ram to buffer pointed by DE 1c6f 010700 ld bc,#0007 1c72 2136f5 ld hl,#f536 ; time/date in ram 1c75 af xor a 1c76 12 ld (de),a ; first store a 0 byte, 1c77 13 inc de 1c78 edb0 ldir ; then 7 bytes (seconds, minutes, hours, day of week, day of month, month, year) 1c7a fb ei 1c7b c9 ret ; set the time/date in the RTC chip 1c7c cd2718 call #1827 1c7f fb ei 1c80 c9 ret ;****************************************************************************** ; initialize the user defined set of characters 1c81 211f1d ld hl,#1d1f 1c84 1600 ld d,#00 1c86 1e00 ld e,#00 1c88 cdef1c call #1cef 1c8b 20fb jr nz,#1c88 1c8d 0600 ld b,#00 1c8f dd7e1b ld a,(ix+#1b) ; system language 1c92 e607 and #07 1c94 cb27 sla a 1c96 4f ld c,a 1c97 21bf1c ld hl,#1cbf 1c9a 09 add hl,bc 1c9b 7e ld a,(hl) 1c9c 23 inc hl 1c9d 66 ld h,(hl) 1c9e 6f ld l,a 1c9f 46 ld b,(hl) 1ca0 78 ld a,b 1ca1 b7 or a 1ca2 c8 ret z 1ca3 23 inc hl 1ca4 4e ld c,(hl) 1ca5 23 inc hl 1ca6 5e ld e,(hl) 1ca7 23 inc hl 1ca8 56 ld d,(hl) 1ca9 e5 push hl 1caa c5 push bc 1cab eb ex de,hl 1cac 79 ld a,c 1cad d620 sub #20 1caf 57 ld d,a 1cb0 e603 and #03 1cb2 5f ld e,a 1cb3 cb3a srl d 1cb5 cb3a srl d 1cb7 cdef1c call #1cef 1cba c1 pop bc 1cbb e1 pop hl 1cbc 10e5 djnz #1ca3 1cbe c9 ret 1cbf dw #1ccf, #1ccf, #1ccf, #1ccf, #1cd0, #1ccf, #1ccf, #1cd0 1ccf db 00 ; no additional definitions 1cd0 db 0a ; 10 additional definitions for croatian and slovenian db 40 ; character @ dw $20df db 5b ; character [ dw $20e9 db 5c ; character \ dw $20f3 db 5d ; character ] dw $20fd db 5e ; character ^ dw $2107 db 60 ; character ` dw $2111 db 7b ; character { dw $211b db 7c ; character | dw $2125 db 7d ; character } dw $212f db 7e ; character ~ dw $2139 ; transfer a user graphics definition for one character 1cef 7a ld a,d 1cf0 c648 add a,#48 1cf2 4f ld c,a 1cf3 3e26 ld a,#26 1cf5 cd7013 call #1370 ; write to R6 (main pointer low) 1cf8 af xor a 1cf9 47 ld b,a 1cfa cb27 sla a 1cfc cb27 sla a 1cfe 83 add a,e 1cff f6c0 or #c0 1d01 4f ld c,a 1d02 3e27 ld a,#27 1d04 cd7013 call #1370 ; write to R7 (main pointer high) 1d07 4e ld c,(hl) 1d08 3e30 ld a,#30 ; VDP: OCT command 1d0a cd5413 call #1354 1d0d 23 inc hl 1d0e 78 ld a,b 1d0f 3c inc a 1d10 fe0a cp #0a ; 10 bytes per char 1d12 38e5 jr c,#1cf9 1d14 1c inc e 1d15 7b ld a,e 1d16 ee04 xor #04 ; 4 definitions per row 1d18 c0 ret nz 1d19 5f ld e,a 1d1a 14 inc d 1d1b 7a ld a,d 1d1c ee18 xor #18 ; check if we arrived to 24x4=96 definitions 1d1e c9 ret 1d1f ; 96 character generator patterns 00 00 00 00 00 00 00 00 00 00 00 08 08 08 08 08 00 08 00 00 00 14 14 14 00 00 00 00 00 00 00 14 14 3E 14 3E 14 14 00 00 00 08 1C 0A 1C 28 2A 1C 08 00 00 06 26 10 08 04 32-30 00 00 00 04 0A 0A 04 2A 12 2C 00 00 00 08 08-04 00 00 00 00 00 00 00 10 08 04 04 04 08 10 00-00 00 04 08 10 10 10 08 04 00 00 00 08 2A 1C 08-1C 2A 08 00 00 00 00 08 08 3E 08 08 00 00 00 00-00 00 00 00 00 04 04 02 00 00 00 00 00 00 3C 00-00 00 00 00 00 00 00 00 00 00 04 00 00 00 00 20-10 08 04 02 00 00 00 00 08 14 22 22 22 14 08 00-00 00 08 0C 08 08 08 08 08 00 00 00 1C 22 20 18-04 02 3E 00 00 00 3E 20 10 18 20 22 1C 00 00 00-10 18 14 12 3E 10 10 00 00 00 3E 02 1E 20 20 22-1C 00 00 00 38 04 02 1E 22 22 1C 00 00 00 3E 20-10 08 04 04 04 00 00 00 1C 22 22 1C 22 22 1C 00-00 00 1C 22 22 3C 20 10 0E 00 00 00 00 00 08 00-08 00 00 00 00 00 00 00 08 00 08 08 04 00 00 00-10 08 04 02 04 08 10 00 00 00 00 00 3E 00 3E 00-00 00 00 00 04 08 10 20 10 08 04 00 00 00 1C 22-10 08 08 00 08 00 00 00 1C 22 2A 3A 1A 02 3C 00-00 ; @ 00 08 14 22 22 3E 22 22 00 00 00 1E 22 22 1E-22 22 1E 00 00 00 1C 22 02 02 02 22 1C 00 00 00-1E 22 22 22 22 22 1E 00 00 00 3E 02 02 1E 02 02-3E 00 00 00 3E 02 02 1E 02 02 02 00 00 00 3C 02-02 02 32 22 3C 00 00 00 22 22 22 3E 22 22 22 00-00 00 1C 08 08 08 08 08 1C 00 00 00 20 20 20 20-20 22 1C 00 00 00 22 12 0A 06 0A 12 22 00 00 00-02 02 02 02 02 02 3E 00 00 00 22 36 2A 2A 22 22-22 00 00 00 22 22 26 2A 32 22 22 00 00 00 1C 22-22 22 22 22 1C 00 00 00 1E 22 22 1E 02 02 02 00-00 00 1C 22 22 22 2A 12 2C 00 00 00 1E 22 22 1E-0A 12 22 00 00 00 1C 22 02 1C 20 22 1C 00 00 00-3E 08 08 08 08 08 08 00 00 00 22 22 22 22 22 22-1C 00 00 00 22 22 22 22 22 14 08 00 00 00 22 22-22 2A 2A 36 22 00 00 00 22 22 14 08 14 22 22 00-00 00 22 22 14 08 08 08 08 00 00 00 3E 20 10 08-04 02 3E 00 00 00 3E 02 02 02 02 02 3E 00 00 ; [ 00-00 02 04 08 10 20 00 00 00 ; \ 00 3E 20 20 20 20 20-3E 00 00 ; ] 00 08 14 22 00 00 00 00 00 00 ; ^ 00 00 00-00 00 00 00 00 00 FF 00 04 08 10 00 00 00 00 00-00 ; ` 00 00 00 1C 20 3C 22 3C 00 00 00 02 02 1E 22-22 22 1E 00 00 00 00 00 3C 02 02 02 3C 00 00 00-20 20 3C 22 22 22 3C 00 00 00 00 00 1C 22 3E 02-3C 00 00 00 18 24 04 1E 04 04 04 00 00 00 00 20-3C 22 22 22 3C 20 1C 00 02 02 1E 22 22 22 22 00-00 00 08 00 0C 08 08 08 1C 00 00 00 10 00 18 10-10 10 12 12 0C 00 02 02 22 12 0E 12 22 00 00 00-0C 08 08 08 08 08 1C 00 00 00 00 00 36 2A 2A 2A-22 00 00 00 00 00 1E 22 22 22 22 00 00 00 00 00-1C 22 22 22 1C 00 00 00 00 00 1E 22 22 22 1E 02-02 00 00 00 3C 22 22 22 3C 20 20 00 00 00 3A 46-02 02 02 00 00 00 00 00 3C 02 1C 20 1E 00 00 00-04 04 1E 04 04 24 18 00 00 00 00 00 22 22 22 32-2C 00 00 00 00 00 22 22 22 14 08 00 00 00 00 00-22 22 2A 2A 36 00 00 00 00 00 22 14 08 14 22 00-00 00 00 00 22 22 22 22 3C 20 1C 00 00 00 3E 10-08 04 3E 00 00 00 38 04 04 06 04 04 38 00 00 ; { 00-08 08 08 00 08 08 08 00 00 ; | 00 0E 10 10 30 10 10-0E 00 00 ; } 00 2C 1A 00 00 00 00 00 00 00 ; ~ FF FF FF-FF FF FF FF FF FF FF ; 20df : 10 accentuated character patterns 14 08 7E 20 10 08 04 7E 00-00 ; Ž 14 08 3C 42 0C 30 42 3C 00 00 ; Ĕ 00 1E 22 27 22-22 22 1E 00 00 ; Đ 10 08 1C 22 02 02 22 1C 00 00 ; Ć 14-08 1C 22 02 02 22 1C 00 00 ; Č 00 14 08 3E 10 08 04-3E 00 00 ; ž 00 14 08 3C 02 1C 20 1E 00 00 ; š 00 20 70-20 3C 22 22 3C 00 00 ; đ 00 10 08 3C 02 02 02 3C 00-00 ; ć 00 14 08 3C 02 02 02 3C 00 00 ; č ; section #2143-#31b4 (BDOS + BIOS interface) transfered to #e406-#f477 ; section #31b5-#32b4 (interrupt handlers) transfered to #ff00-#ffff ; section #32b5-#3fff empty ; BDOS system call entry : ; - fct# in C, parameter in DE ; - 8-bit result in A (and L) ; - 16-bit result in BA (and HL) e406 c311e4 jp #e411 ; Error vector table : e409 dw #e499 ; Bad sector e40b dw #e4a5 ; Select e40d dw #e4ab ; R/O e40f dw #e4b1 ; File R/O e411 eb ex de,hl ; saves parameter in e473 e412 2243e7 ld (#e743),hl e415 eb ex de,hl e416 7b ld a,e e417 32d6f1 ld (#f1d6),a ; saves LSB of parameter e41a 210000 ld hl,#0000 e41d 2245e7 ld (#e745),hl ; init result with 0 e420 39 add hl,sp e421 220fe7 ld (#e70f),hl ; save sp e424 3141e7 ld sp,#e741 ; change stack e427 af xor a e428 32e0f1 ld (#f1e0),a e42b 32def1 ld (#f1de),a e42e 2174f1 ld hl,#f174 ; push return address e431 e5 push hl e432 79 ld a,c e433 fe29 cp #29 e435 d0 ret nc ; only functions 0 to 40 e436 4b ld c,e e437 2147e4 ld hl,#e447 e43a 5f ld e,a e43b 1600 ld d,#00 e43d 19 add hl,de e43e 19 add hl,de e43f 5e ld e,(hl) e440 23 inc hl e441 56 ld d,(hl) e442 2a43e7 ld hl,(#e743) e445 eb ex de,hl e446 e9 jp (hl) e447 dw #f203 ; fct 0 (P_TERMCPM) : System Reset dw #e6c8 ; fct 1 (C_READ) : Console Input dw #e590 ; fct 2 (C_WRITE) : Console Output dw #e6ce ; fct 3 (A_READ) : Auxiliary (Reader) input dw #f212 ; fct 4 (A_WRITE) : Auxiliary (Punch) output dw #f20f ; fct 5 (L_WRITE) : Printer output dw #e6d4 ; fct 6 (C_RAWIO) : Direct console I/O dw #e6ed ; fct 7 : Get I/O byte dw #e6f3 ; fct 8 : Set I/O byte dw #e6f8 ; fct 9 (C_WRITESTR): Output string dw #e5e1 ; fct 10 (C_READSTR) : Buffered console input dw #e6fe ; fct 11 (C_STAT) : Console status dw #f07e ; fct 12 (S_BDOSVER) : Return version number dw #f083 ; fct 13 (DRV_ALLRESET): Reset discs dw #f045 ; fct 14 (DRV_SET) : Select disc dw #f09c ; fct 15 (F_OPEN) : Open file dw #f0a5 ; fct 16 (F_CLOSE) : Close file dw #f0ab ; fct 17 (F_SFIRST) : search for first dw #f0c8 ; fct 18 (F_SNEXT) : search for next dw #f0d7 ; fct 19 (F_DELETE) : delete file dw #f0e0 ; fct 20 (F_READ) : read next record dw #f0e6 ; fct 21 (F_WRITE) : write next record dw #f0ec ; fct 22 (F_MAKE) : create file dw #f0f5 ; fct 23 (F_RENAME) : Rename file dw #f0fe ; fct 24 (DRV_LOGINVEC): Return bitmap of logged-in drives dw #f104 ; fct 25 (DRV_GET) : Return current drive dw #f10a ; fct 26 (F_DMAOFF) : Set DMA address dw #f111 ; fct 27 (DRV_ALLOCVEC): Return address of allocation map dw #e92c ; fct 28 (DRV_SETRO) : Software write-protect current disc dw #f117 ; fct 29 (DRV_ROVEC) : Return bitmap of read-only drives dw #f11d ; fct 30 (F_ATTRIB) : set file attributes dw #f126 ; fct 31 (DRV_DPB) : get DPB address dw #f12d ; fct 32 (F_USERNUM) : get/set user number dw #f141 ; fct 33 (F_READRAND): Random access read record dw #f147 ; fct 34 (F_WRITERAND): Random access write record dw #f14d ; fct 35 (F_SIZE) : compute file size dw #f0e0 ; fct 36 (F_RANDREC) ; update random access pointer dw #f153 ; fct 37 (DRV_RESET) : selectively reset disc drives dw #e704 ; fct 38 undefined dw #e704 ; fct 39 undefined dw #f19b ; fct 40 : test and write record e499 21cae4 ld hl,#e4ca e49c cde5e4 call #e4e5 e49f fe03 cp #03 e4a1 ca0000 jp z,#0000 e4a4 c9 ret e4a5 21d5e4 ld hl,#e4d5 e4a8 c3b4e4 jp #e4b4 e4ab 21e1e4 ld hl,#e4e1 e4ae c3b4e4 jp #e4b4 e4b1 21dce4 ld hl,#e4dc e4b4 cde5e4 call #e4e5 e4b7 c30000 jp #0000 e4ba "Bdos Err On : $" e4ca "Bad Sector$" e4d5 "Select$" e4dc "File " e4e1 "R/O$" e4e5 e5 push hl e4e6 cdc9e5 call #e5c9 e4e9 3a42e7 ld a,(#e742) e4ec c641 add a,#41 e4ee 32c6e4 ld (#e4c6),a e4f1 01bae4 ld bc,#e4ba e4f4 cdd3e5 call #e5d3 e4f7 c1 pop bc e4f8 cdd3e5 call #e5d3 e4fb 210ee7 ld hl,#e70e e4fe 7e ld a,(hl) e4ff 3600 ld (hl),#00 e501 b7 or a e502 c0 ret nz e503 c309f2 jp #f209 e506 cdfbe4 call #e4fb e509 cd14e5 call #e514 e50c d8 ret c e50d f5 push af e50e 4f ld c,a e50f cd90e5 call #e590 e512 f1 pop af e513 c9 ret e514 fe0d cp #0d e516 c8 ret z e517 fe0a cp #0a e519 c8 ret z e51a fe09 cp #09 e51c c8 ret z e51d fe08 cp #08 e51f c8 ret z e520 fe20 cp #20 e522 c9 ret e523 3a0ee7 ld a,(#e70e) e526 b7 or a e527 c245e5 jp nz,#e545 e52a cd06f2 call #f206 e52d e601 and #01 e52f c8 ret z e530 cd09f2 call #f209 e533 fe13 cp #13 e535 c242e5 jp nz,#e542 e538 cd09f2 call #f209 e53b fe03 cp #03 e53d ca0000 jp z,#0000 e540 af xor a e541 c9 ret e542 320ee7 ld (#e70e),a e545 3e01 ld a,#01 e547 c9 ret e548 3a0ae7 ld a,(#e70a) e54b b7 or a e54c c262e5 jp nz,#e562 e54f c5 push bc e550 cd23e5 call #e523 e553 c1 pop bc e554 c5 push bc e555 cd0cf2 call #f20c e558 c1 pop bc e559 c5 push bc e55a 3a0de7 ld a,(#e70d) e55d b7 or a e55e c40ff2 call nz,#f20f e561 c1 pop bc e562 79 ld a,c e563 210ce7 ld hl,#e70c e566 fe7f cp #7f ; DEL doesn't increase column number e568 c8 ret z e569 34 inc (hl) ; normal characters increase column number... e56a fe20 cp #20 e56c d0 ret nc e56d 35 dec (hl) ; ... but Ctrl characters don't e56e 7e ld a,(hl) e56f b7 or a e570 c8 ret z e571 79 ld a,c e572 fe08 cp #08 ; backspace is Ctrl-H e574 c279e5 jp nz,#e579 e577 35 dec (hl) e578 c9 ret e579 fe0a cp #0a ; Enter is Ctrl-J (LF) ? e57b c0 ret nz e57c 3600 ld (hl),#00 e57e c9 ret e57f 79 ld a,c e580 cd14e5 call #e514 e583 d290e5 jp nc,#e590 e586 f5 push af e587 0e5e ld c,#5e e589 cd48e5 call #e548 e58c f1 pop af e58d f640 or #40 e58f 4f ld c,a e590 79 ld a,c e591 fe09 cp #09 ; tabulation ? e593 c248e5 jp nz,#e548 ; translate tabulation into spaces e596 0e20 ld c,#20 e598 cd48e5 call #e548 e59b 3a0ce7 ld a,(#e70c) ; column number e59e e607 and #07 e5a0 c296e5 jp nz,#e596 e5a3 c9 ret e5a4 cdace5 call #e5ac ; write a Backspace e5a7 0e20 ld c,#20 e5a9 cd0cf2 call #f20c ; then a space ; write a Backspace e5ac 0e08 ld c,#08 e5ae c30cf2 jp #f20c e5b1 0e23 ld c,#23 e5b3 cd48e5 call #e548 e5b6 cdc9e5 call #e5c9 e5b9 3a0ce7 ld a,(#e70c) ; column number e5bc 210be7 ld hl,#e70b e5bf be cp (hl) e5c0 d0 ret nc e5c1 0e20 ld c,#20 e5c3 cd48e5 call #e548 e5c6 c3b9e5 jp #e5b9 e5c9 0e0d ld c,#0d e5cb cd48e5 call #e548 e5ce 0e0a ld c,#0a e5d0 c348e5 jp #e548 e5d3 0a ld a,(bc) e5d4 fe24 cp #24 e5d6 c8 ret z e5d7 03 inc bc e5d8 c5 push bc e5d9 4f ld c,a e5da cd90e5 call #e590 e5dd c1 pop bc e5de c3d3e5 jp #e5d3 e5e1 3a0ce7 ld a,(#e70c) ; column number e5e4 320be7 ld (#e70b),a e5e7 2a43e7 ld hl,(#e743) e5ea 4e ld c,(hl) e5eb 23 inc hl e5ec e5 push hl e5ed 0600 ld b,#00 e5ef c5 push bc e5f0 e5 push hl e5f1 cdfbe4 call #e4fb e5f4 e67f and #7f e5f6 e1 pop hl e5f7 c1 pop bc e5f8 fe0d cp #0d e5fa cac1e6 jp z,#e6c1 e5fd fe0a cp #0a e5ff cac1e6 jp z,#e6c1 e602 fe08 cp #08 e604 c216e6 jp nz,#e616 e607 78 ld a,b e608 b7 or a e609 caefe5 jp z,#e5ef e60c 05 dec b e60d 3a0ce7 ld a,(#e70c) e610 320ae7 ld (#e70a),a e613 c370e6 jp #e670 e616 fe7f cp #7f e618 c226e6 jp nz,#e626 e61b 78 ld a,b e61c b7 or a e61d caefe5 jp z,#e5ef e620 7e ld a,(hl) e621 05 dec b e622 2b dec hl e623 c3a9e6 jp #e6a9 e626 fe05 cp #05 e628 c237e6 jp nz,#e637 e62b c5 push bc e62c e5 push hl e62d cdc9e5 call #e5c9 e630 af xor a e631 320be7 ld (#e70b),a e634 c3f1e5 jp #e5f1 e637 fe10 cp #10 e639 c248e6 jp nz,#e648 e63c e5 push hl e63d 210de7 ld hl,#e70d e640 3e01 ld a,#01 e642 96 sub (hl) e643 77 ld (hl),a e644 e1 pop hl e645 c3efe5 jp #e5ef e648 fe18 cp #18 e64a c25fe6 jp nz,#e65f e64d e1 pop hl e64e 3a0be7 ld a,(#e70b) e651 210ce7 ld hl,#e70c e654 be cp (hl) e655 d2e1e5 jp nc,#e5e1 e658 35 dec (hl) e659 cda4e5 call #e5a4 e65c c34ee6 jp #e64e e65f fe15 cp #15 e661 c26be6 jp nz,#e66b e664 cdb1e5 call #e5b1 e667 e1 pop hl e668 c3e1e5 jp #e5e1 e66b fe12 cp #12 e66d c2a6e6 jp nz,#e6a6 e670 c5 push bc e671 cdb1e5 call #e5b1 e674 c1 pop bc e675 e1 pop hl e676 e5 push hl e677 c5 push bc e678 78 ld a,b e679 b7 or a e67a ca8ae6 jp z,#e68a e67d 23 inc hl e67e 4e ld c,(hl) e67f 05 dec b e680 c5 push bc e681 e5 push hl e682 cd7fe5 call #e57f e685 e1 pop hl e686 c1 pop bc e687 c378e6 jp #e678 e68a e5 push hl e68b 3a0ae7 ld a,(#e70a) e68e b7 or a e68f caf1e5 jp z,#e5f1 e692 210ce7 ld hl,#e70c e695 96 sub (hl) e696 320ae7 ld (#e70a),a e699 cda4e5 call #e5a4 e69c 210ae7 ld hl,#e70a e69f 35 dec (hl) e6a0 c299e6 jp nz,#e699 e6a3 c3f1e5 jp #e5f1 e6a6 23 inc hl e6a7 77 ld (hl),a e6a8 04 inc b e6a9 c5 push bc e6aa e5 push hl e6ab 4f ld c,a e6ac cd7fe5 call #e57f e6af e1 pop hl e6b0 c1 pop bc e6b1 7e ld a,(hl) e6b2 fe03 cp #03 e6b4 78 ld a,b e6b5 c2bde6 jp nz,#e6bd e6b8 fe01 cp #01 e6ba ca0000 jp z,#0000 e6bd b9 cp c e6be daefe5 jp c,#e5ef e6c1 e1 pop hl e6c2 70 ld (hl),b e6c3 0e0d ld c,#0d e6c5 c348e5 jp #e548 e6c8 cd06e5 call #e506 e6cb c301e7 jp #e701 e6ce cd15f2 call #f215 e6d1 c301e7 jp #e701 e6d4 79 ld a,c e6d5 3c inc a e6d6 cae0e6 jp z,#e6e0 e6d9 3c inc a e6da ca06f2 jp z,#f206 e6dd c30cf2 jp #f20c e6e0 cd06f2 call #f206 e6e3 b7 or a e6e4 ca91f1 jp z,#f191 e6e7 cd09f2 call #f209 e6ea c301e7 jp #e701 e6ed 3a0300 ld a,(#0003) e6f0 c301e7 jp #e701 e6f3 210300 ld hl,#0003 e6f6 71 ld (hl),c e6f7 c9 ret e6f8 eb ex de,hl e6f9 4d ld c,l e6fa 44 ld b,h e6fb c3d3e5 jp #e5d3 e6fe cd23e5 call #e523 e701 3245e7 ld (#e745),a e704 c9 ret e705 3e01 ld a,#01 e707 c301e7 jp #e701 e70a 00,02,00,00,00,a7 e710 e3,00,00,00,00,00,00,00 e718 00,00,00,00,00,00,00,00 e720 00,00,00,00,00,00,00,00 e728 00,00,00,00,00 e72d dw f622,f622,f592,e7b5,e81d,f3e9,f3c7,e558 e73d dw 000a,f174,0000 e743 dw #f1ff e745 db 0,0 e747 210be4 ld hl,#e40b e74a 5e ld e,(hl) e74b 23 inc hl e74c 56 ld d,(hl) e74d eb ex de,hl e74e e9 jp (hl) ; copy C bytes from (DE) to (HL) e74f 0c inc c e750 0d dec c e751 c8 ret z e752 1a ld a,(de) e753 77 ld (hl),a e754 13 inc de e755 23 inc hl e756 c350e7 jp #e750 e759 3a42e7 ld a,(#e742) e75c 4f ld c,a e75d cd1bf2 call #f21b ; select disk drive e760 7c ld a,h e761 b5 or l e762 c8 ret z e763 5e ld e,(hl) e764 23 inc hl e765 56 ld d,(hl) e766 23 inc hl e767 22b3f1 ld (#f1b3),hl e76a 23 inc hl e76b 23 inc hl e76c 22b5f1 ld (#f1b5),hl e76f 23 inc hl e770 23 inc hl e771 22b7f1 ld (#f1b7),hl e774 23 inc hl e775 23 inc hl e776 eb ex de,hl e777 22d0f1 ld (#f1d0),hl e77a 21b9f1 ld hl,#f1b9 e77d 0e08 ld c,#08 e77f cd4fe7 call #e74f ; move 8 bytes from (DE) to f1b9 e782 2abbf1 ld hl,(#f1bb) e785 eb ex de,hl e786 21c1f1 ld hl,#f1c1 e789 0e0f ld c,#0f e78b cd4fe7 call #e74f ; copy DPB from (f1bb) to f1c1 e78e 2ac6f1 ld hl,(#f1c6) e791 7c ld a,h e792 21ddf1 ld hl,#f1dd e795 36ff ld (hl),#ff e797 b7 or a e798 ca9de7 jp z,#e79d e79b 3600 ld (hl),#00 e79d 3eff ld a,#ff e79f b7 or a e7a0 c9 ret e7a1 cd18f2 call #f218 e7a4 af xor a e7a5 2ab5f1 ld hl,(#f1b5) e7a8 77 ld (hl),a e7a9 23 inc hl e7aa 77 ld (hl),a e7ab 2ab7f1 ld hl,(#f1b7) e7ae 77 ld (hl),a e7af 23 inc hl e7b0 77 ld (hl),a e7b1 c9 ret e7b2 cd27f2 call #f227 e7b5 c3bbe7 jp #e7bb e7b8 cd2af2 call #f22a e7bb b7 or a e7bc c8 ret z e7bd 2109e4 ld hl,#e409 e7c0 c34ae7 jp #e74a e7c3 2aeaf1 ld hl,(#f1ea) e7c6 0e02 ld c,#02 e7c8 cdeae8 call #e8ea e7cb 22e5f1 ld (#f1e5),hl e7ce 22ecf1 ld (#f1ec),hl e7d1 21e5f1 ld hl,#f1e5 e7d4 4e ld c,(hl) e7d5 23 inc hl e7d6 46 ld b,(hl) e7d7 2ab7f1 ld hl,(#f1b7) e7da 5e ld e,(hl) e7db 23 inc hl e7dc 56 ld d,(hl) e7dd 2ab5f1 ld hl,(#f1b5) e7e0 7e ld a,(hl) e7e1 23 inc hl e7e2 66 ld h,(hl) e7e3 6f ld l,a e7e4 79 ld a,c e7e5 93 sub e e7e6 78 ld a,b e7e7 9a sbc a,d e7e8 d2fae7 jp nc,#e7fa e7eb e5 push hl e7ec 2ac1f1 ld hl,(#f1c1) e7ef 7b ld a,e e7f0 95 sub l e7f1 5f ld e,a e7f2 7a ld a,d e7f3 9c sbc a,h e7f4 57 ld d,a e7f5 e1 pop hl e7f6 2b dec hl e7f7 c3e4e7 jp #e7e4 e7fa e5 push hl e7fb 2ac1f1 ld hl,(#f1c1) e7fe 19 add hl,de e7ff da0fe8 jp c,#e80f e802 79 ld a,c e803 95 sub l e804 78 ld a,b e805 9c sbc a,h e806 da0fe8 jp c,#e80f e809 eb ex de,hl e80a e1 pop hl e80b 23 inc hl e80c c3fae7 jp #e7fa e80f e1 pop hl e810 c5 push bc e811 d5 push de e812 e5 push hl e813 eb ex de,hl e814 2acef1 ld hl,(#f1ce) e817 19 add hl,de e818 44 ld b,h e819 4d ld c,l e81a cd1ef2 call #f21e e81d d1 pop de e81e 2ab5f1 ld hl,(#f1b5) e821 73 ld (hl),e e822 23 inc hl e823 72 ld (hl),d e824 d1 pop de e825 2ab7f1 ld hl,(#f1b7) e828 73 ld (hl),e e829 23 inc hl e82a 72 ld (hl),d e82b c1 pop bc e82c 79 ld a,c e82d 93 sub e e82e 4f ld c,a e82f 78 ld a,b e830 9a sbc a,d e831 47 ld b,a e832 2ad0f1 ld hl,(#f1d0) e835 eb ex de,hl e836 cd30f2 call #f230 e839 4d ld c,l e83a 44 ld b,h e83b c321f2 jp #f221 ; BIOS : read sector e83e 21c3f1 ld hl,#f1c3 e841 4e ld c,(hl) e842 3ae3f1 ld a,(#f1e3) e845 b7 or a e846 1f rra e847 0d dec c e848 c245e8 jp nz,#e845 e84b 47 ld b,a e84c 3e08 ld a,#08 e84e 96 sub (hl) e84f 4f ld c,a e850 3ae2f1 ld a,(#f1e2) e853 0d dec c e854 ca5ce8 jp z,#e85c e857 b7 or a e858 17 rla e859 c353e8 jp #e853 e85c 80 add a,b e85d c9 ret e85e 2a43e7 ld hl,(#e743) e861 111000 ld de,#0010 e864 19 add hl,de e865 09 add hl,bc e866 3addf1 ld a,(#f1dd) e869 b7 or a e86a ca71e8 jp z,#e871 e86d 6e ld l,(hl) e86e 2600 ld h,#00 e870 c9 ret e871 09 add hl,bc e872 5e ld e,(hl) e873 23 inc hl e874 56 ld d,(hl) e875 eb ex de,hl e876 c9 ret e877 cd3ee8 call #e83e e87a 4f ld c,a e87b 0600 ld b,#00 e87d cd5ee8 call #e85e e880 22e5f1 ld (#f1e5),hl e883 c9 ret e884 2ae5f1 ld hl,(#f1e5) e887 7d ld a,l e888 b4 or h e889 c9 ret e88a 3ac3f1 ld a,(#f1c3) e88d 2ae5f1 ld hl,(#f1e5) e890 29 add hl,hl e891 3d dec a e892 c290e8 jp nz,#e890 e895 22e7f1 ld (#f1e7),hl e898 3ac4f1 ld a,(#f1c4) e89b 4f ld c,a e89c 3ae3f1 ld a,(#f1e3) e89f a1 and c e8a0 b5 or l e8a1 6f ld l,a e8a2 22e5f1 ld (#f1e5),hl e8a5 c9 ret e8a6 2a43e7 ld hl,(#e743) e8a9 110c00 ld de,#000c e8ac 19 add hl,de e8ad c9 ret e8ae 2a43e7 ld hl,(#e743) e8b1 110f00 ld de,#000f e8b4 19 add hl,de e8b5 eb ex de,hl e8b6 211100 ld hl,#0011 e8b9 19 add hl,de e8ba c9 ret e8bb cdaee8 call #e8ae e8be 7e ld a,(hl) e8bf 32e3f1 ld (#f1e3),a e8c2 eb ex de,hl e8c3 7e ld a,(hl) e8c4 32e1f1 ld (#f1e1),a e8c7 cda6e8 call #e8a6 e8ca 3ac5f1 ld a,(#f1c5) e8cd a6 and (hl) e8ce 32e2f1 ld (#f1e2),a e8d1 c9 ret e8d2 cdaee8 call #e8ae e8d5 3ad5f1 ld a,(#f1d5) e8d8 fe02 cp #02 e8da c2dee8 jp nz,#e8de e8dd af xor a e8de 4f ld c,a e8df 3ae3f1 ld a,(#f1e3) e8e2 81 add a,c e8e3 77 ld (hl),a e8e4 eb ex de,hl e8e5 3ae1f1 ld a,(#f1e1) e8e8 77 ld (hl),a e8e9 c9 ret e8ea 0c inc c e8eb 0d dec c e8ec c8 ret z e8ed 7c ld a,h e8ee b7 or a e8ef 1f rra e8f0 67 ld h,a e8f1 7d ld a,l e8f2 1f rra e8f3 6f ld l,a e8f4 c3ebe8 jp #e8eb ; calculate a buffer's checksum e8f7 0e80 ld c,#80 e8f9 2ab9f1 ld hl,(#f1b9) e8fc af xor a e8fd 86 add a,(hl) e8fe 23 inc hl e8ff 0d dec c e900 c2fde8 jp nz,#e8fd e903 c9 ret e904 0c inc c e905 0d dec c e906 c8 ret z e907 29 add hl,hl e908 c305e9 jp #e905 e90b c5 push bc e90c 3a42e7 ld a,(#e742) e90f 4f ld c,a e910 210100 ld hl,#0001 e913 cd04e9 call #e904 e916 c1 pop bc e917 79 ld a,c e918 b5 or l e919 6f ld l,a e91a 78 ld a,b e91b b4 or h e91c 67 ld h,a e91d c9 ret e91e 2aadf1 ld hl,(#f1ad) e921 3a42e7 ld a,(#e742) e924 4f ld c,a e925 cdeae8 call #e8ea e928 7d ld a,l e929 e601 and #01 e92b c9 ret e92c 21adf1 ld hl,#f1ad e92f 4e ld c,(hl) e930 23 inc hl e931 46 ld b,(hl) e932 cd0be9 call #e90b e935 22adf1 ld (#f1ad),hl e938 2ac8f1 ld hl,(#f1c8) e93b 23 inc hl e93c eb ex de,hl e93d 2ab3f1 ld hl,(#f1b3) e940 73 ld (hl),e e941 23 inc hl e942 72 ld (hl),d e943 c9 ret e944 cd5ee9 call #e95e e947 110900 ld de,#0009 e94a 19 add hl,de e94b 7e ld a,(hl) e94c 17 rla e94d d0 ret nc e94e 210fe4 ld hl,#e40f e951 c34ae7 jp #e74a e954 cd1ee9 call #e91e e957 c8 ret z e958 210de4 ld hl,#e40d e95b c34ae7 jp #e74a e95e 2ab9f1 ld hl,(#f1b9) e961 3ae9f1 ld a,(#f1e9) e964 85 add a,l e965 6f ld l,a e966 d0 ret nc e967 24 inc h e968 c9 ret e969 2a43e7 ld hl,(#e743) e96c 110e00 ld de,#000e e96f 19 add hl,de e970 7e ld a,(hl) e971 c9 ret e972 cd69e9 call #e969 e975 3600 ld (hl),#00 e977 c9 ret e978 cd69e9 call #e969 e97b f680 or #80 e97d 77 ld (hl),a e97e c9 ret e97f 2aeaf1 ld hl,(#f1ea) e982 eb ex de,hl e983 2ab3f1 ld hl,(#f1b3) e986 7b ld a,e e987 96 sub (hl) e988 23 inc hl e989 7a ld a,d e98a 9e sbc a,(hl) e98b c9 ret e98c cd7fe9 call #e97f e98f d8 ret c e990 13 inc de e991 72 ld (hl),d e992 2b dec hl e993 73 ld (hl),e e994 c9 ret e995 7b ld a,e e996 95 sub l e997 6f ld l,a e998 7a ld a,d e999 9c sbc a,h e99a 67 ld h,a e99b c9 ret e99c 0eff ld c,#ff e99e 2aecf1 ld hl,(#f1ec) e9a1 eb ex de,hl e9a2 2accf1 ld hl,(#f1cc) e9a5 cd95e9 call #e995 e9a8 d0 ret nc e9a9 c5 push bc e9aa cdf7e8 call #e8f7 e9ad 2abdf1 ld hl,(#f1bd) e9b0 eb ex de,hl e9b1 2aecf1 ld hl,(#f1ec) e9b4 19 add hl,de e9b5 c1 pop bc e9b6 0c inc c e9b7 cac4e9 jp z,#e9c4 e9ba be cp (hl) e9bb c8 ret z e9bc cd7fe9 call #e97f e9bf d0 ret nc e9c0 cd2ce9 call #e92c e9c3 c9 ret e9c4 77 ld (hl),a e9c5 c9 ret e9c6 cd9ce9 call #e99c e9c9 cde0e9 call #e9e0 e9cc 0e01 ld c,#01 e9ce cdb8e7 call #e7b8 e9d1 c3dae9 jp #e9da e9d4 cde0e9 call #e9e0 e9d7 cdb2e7 call #e7b2 e9da 21b1f1 ld hl,#f1b1 e9dd c3e3e9 jp #e9e3 e9e0 21b9f1 ld hl,#f1b9 e9e3 4e ld c,(hl) e9e4 23 inc hl e9e5 46 ld b,(hl) e9e6 c324f2 jp #f224 e9e9 2ab9f1 ld hl,(#f1b9) e9ec eb ex de,hl e9ed 2ab1f1 ld hl,(#f1b1) e9f0 0e80 ld c,#80 e9f2 c34fe7 jp #e74f e9f5 21eaf1 ld hl,#f1ea e9f8 7e ld a,(hl) e9f9 23 inc hl e9fa be cp (hl) e9fb c0 ret nz e9fc 3c inc a e9fd c9 ret e9fe 21ffff ld hl,#ffff ea01 22eaf1 ld (#f1ea),hl ea04 c9 ret ea05 2ac8f1 ld hl,(#f1c8) ea08 eb ex de,hl ea09 2aeaf1 ld hl,(#f1ea) ea0c 23 inc hl ea0d 22eaf1 ld (#f1ea),hl ea10 cd95e9 call #e995 ea13 d219ea jp nc,#ea19 ea16 c3fee9 jp #e9fe ea19 3aeaf1 ld a,(#f1ea) ea1c e603 and #03 ea1e 0605 ld b,#05 ea20 87 add a,a ea21 05 dec b ea22 c220ea jp nz,#ea20 ea25 32e9f1 ld (#f1e9),a ea28 b7 or a ea29 c0 ret nz ea2a c5 push bc ea2b cdc3e7 call #e7c3 ea2e cdd4e9 call #e9d4 ea31 c1 pop bc ea32 c39ee9 jp #e99e ea35 79 ld a,c ea36 e607 and #07 ea38 3c inc a ea39 5f ld e,a ea3a 57 ld d,a ea3b 79 ld a,c ea3c 0f rrca ea3d 0f rrca ea3e 0f rrca ea3f e61f and #1f ea41 4f ld c,a ea42 78 ld a,b ea43 87 add a,a ea44 87 add a,a ea45 87 add a,a ea46 87 add a,a ea47 87 add a,a ea48 b1 or c ea49 4f ld c,a ea4a 78 ld a,b ea4b 0f rrca ea4c 0f rrca ea4d 0f rrca ea4e e61f and #1f ea50 47 ld b,a ea51 2abff1 ld hl,(#f1bf) ea54 09 add hl,bc ea55 7e ld a,(hl) ea56 07 rlca ea57 1d dec e ea58 c256ea jp nz,#ea56 ea5b c9 ret ea5c d5 push de ea5d cd35ea call #ea35 ea60 e6fe and #fe ea62 c1 pop bc ea63 b1 or c ea64 0f rrca ea65 15 dec d ea66 c264ea jp nz,#ea64 ea69 77 ld (hl),a ea6a c9 ret ea6b cd5ee9 call #e95e ea6e 111000 ld de,#0010 ea71 19 add hl,de ea72 c5 push bc ea73 0e11 ld c,#11 ea75 d1 pop de ea76 0d dec c ea77 c8 ret z ea78 d5 push de ea79 3addf1 ld a,(#f1dd) ea7c b7 or a ea7d ca88ea jp z,#ea88 ea80 c5 push bc ea81 e5 push hl ea82 4e ld c,(hl) ea83 0600 ld b,#00 ea85 c38eea jp #ea8e ea88 0d dec c ea89 c5 push bc ea8a 4e ld c,(hl) ea8b 23 inc hl ea8c 46 ld b,(hl) ea8d e5 push hl ea8e 79 ld a,c ea8f b0 or b ea90 ca9dea jp z,#ea9d ea93 2ac6f1 ld hl,(#f1c6) ea96 7d ld a,l ea97 91 sub c ea98 7c ld a,h ea99 98 sbc a,b ea9a d45cea call nc,#ea5c ea9d e1 pop hl ea9e 23 inc hl ea9f c1 pop bc eaa0 c375ea jp #ea75 eaa3 2ac6f1 ld hl,(#f1c6) eaa6 0e03 ld c,#03 eaa8 cdeae8 call #e8ea eaab 23 inc hl eaac 44 ld b,h eaad 4d ld c,l eaae 2abff1 ld hl,(#f1bf) eab1 3600 ld (hl),#00 eab3 23 inc hl eab4 0b dec bc eab5 78 ld a,b eab6 b1 or c eab7 c2b1ea jp nz,#eab1 eaba 2acaf1 ld hl,(#f1ca) eabd eb ex de,hl eabe 2abff1 ld hl,(#f1bf) eac1 73 ld (hl),e eac2 23 inc hl eac3 72 ld (hl),d eac4 cda1e7 call #e7a1 eac7 2ab3f1 ld hl,(#f1b3) eaca 3603 ld (hl),#03 eacc 23 inc hl eacd 3600 ld (hl),#00 eacf cdfee9 call #e9fe ead2 0eff ld c,#ff ead4 cd05ea call #ea05 ead7 cdf5e9 call #e9f5 eada c8 ret z eadb cd5ee9 call #e95e eade 3ee5 ld a,#e5 eae0 be cp (hl) eae1 cad2ea jp z,#ead2 eae4 3a41e7 ld a,(#e741) eae7 be cp (hl) eae8 c2f6ea jp nz,#eaf6 eaeb 23 inc hl eaec 7e ld a,(hl) eaed d624 sub #24 eaef c2f6ea jp nz,#eaf6 eaf2 3d dec a eaf3 3245e7 ld (#e745),a eaf6 0e01 ld c,#01 eaf8 cd6bea call #ea6b eafb cd8ce9 call #e98c eafe c3d2ea jp #ead2 eb01 3ad4f1 ld a,(#f1d4) eb04 c301e7 jp #e701 eb07 c5 push bc eb08 f5 push af eb09 3ac5f1 ld a,(#f1c5) eb0c 2f cpl eb0d 47 ld b,a eb0e 79 ld a,c eb0f a0 and b eb10 4f ld c,a eb11 f1 pop af eb12 a0 and b eb13 91 sub c eb14 e61f and #1f eb16 c1 pop bc eb17 c9 ret eb18 3eff ld a,#ff eb1a 32d4f1 ld (#f1d4),a eb1d 21d8f1 ld hl,#f1d8 eb20 71 ld (hl),c eb21 2a43e7 ld hl,(#e743) eb24 22d9f1 ld (#f1d9),hl eb27 cdfee9 call #e9fe eb2a cda1e7 call #e7a1 eb2d 0e00 ld c,#00 eb2f cd05ea call #ea05 eb32 cdf5e9 call #e9f5 eb35 ca94eb jp z,#eb94 eb38 2ad9f1 ld hl,(#f1d9) eb3b eb ex de,hl eb3c 1a ld a,(de) eb3d fee5 cp #e5 eb3f ca4aeb jp z,#eb4a eb42 d5 push de eb43 cd7fe9 call #e97f eb46 d1 pop de eb47 d294eb jp nc,#eb94 eb4a cd5ee9 call #e95e eb4d 3ad8f1 ld a,(#f1d8) eb50 4f ld c,a eb51 0600 ld b,#00 eb53 79 ld a,c eb54 b7 or a eb55 ca83eb jp z,#eb83 eb58 1a ld a,(de) eb59 fe3f cp #3f eb5b ca7ceb jp z,#eb7c eb5e 78 ld a,b eb5f fe0d cp #0d eb61 ca7ceb jp z,#eb7c eb64 fe0c cp #0c eb66 1a ld a,(de) eb67 ca73eb jp z,#eb73 eb6a 96 sub (hl) eb6b e67f and #7f eb6d c22deb jp nz,#eb2d eb70 c37ceb jp #eb7c eb73 c5 push bc eb74 4e ld c,(hl) eb75 cd07eb call #eb07 eb78 c1 pop bc eb79 c22deb jp nz,#eb2d eb7c 13 inc de eb7d 23 inc hl eb7e 04 inc b eb7f 0d dec c eb80 c353eb jp #eb53 eb83 3aeaf1 ld a,(#f1ea) eb86 e603 and #03 eb88 3245e7 ld (#e745),a eb8b 21d4f1 ld hl,#f1d4 eb8e 7e ld a,(hl) eb8f 17 rla eb90 d0 ret nc eb91 af xor a eb92 77 ld (hl),a eb93 c9 ret eb94 cdfee9 call #e9fe eb97 3eff ld a,#ff eb99 c301e7 jp #e701 eb9c cd54e9 call #e954 eb9f 0e0c ld c,#0c eba1 cd18eb call #eb18 eba4 cdf5e9 call #e9f5 eba7 c8 ret z eba8 cd44e9 call #e944 ebab cd5ee9 call #e95e ebae 36e5 ld (hl),#e5 ebb0 0e00 ld c,#00 ebb2 cd6bea call #ea6b ebb5 cdc6e9 call #e9c6 ebb8 cd2deb call #eb2d ebbb c3a4eb jp #eba4 ebbe 50 ld d,b ebbf 59 ld e,c ebc0 79 ld a,c ebc1 b0 or b ebc2 cad1eb jp z,#ebd1 ebc5 0b dec bc ebc6 d5 push de ebc7 c5 push bc ebc8 cd35ea call #ea35 ebcb 1f rra ebcc d2eceb jp nc,#ebec ebcf c1 pop bc ebd0 d1 pop de ebd1 2ac6f1 ld hl,(#f1c6) ebd4 7b ld a,e ebd5 95 sub l ebd6 7a ld a,d ebd7 9c sbc a,h ebd8 d2f4eb jp nc,#ebf4 ebdb 13 inc de ebdc c5 push bc ebdd d5 push de ebde 42 ld b,d ebdf 4b ld c,e ebe0 cd35ea call #ea35 ebe3 1f rra ebe4 d2eceb jp nc,#ebec ebe7 d1 pop de ebe8 c1 pop bc ebe9 c3c0eb jp #ebc0 ebec 17 rla ebed 3c inc a ebee cd64ea call #ea64 ebf1 e1 pop hl ebf2 d1 pop de ebf3 c9 ret ebf4 79 ld a,c ebf5 b0 or b ebf6 c2c0eb jp nz,#ebc0 ebf9 210000 ld hl,#0000 ebfc c9 ret ebfd 0e00 ld c,#00 ebff 1e20 ld e,#20 ec01 d5 push de ec02 0600 ld b,#00 ec04 2a43e7 ld hl,(#e743) ec07 09 add hl,bc ec08 eb ex de,hl ec09 cd5ee9 call #e95e ec0c c1 pop bc ec0d cd4fe7 call #e74f ec10 cdc3e7 call #e7c3 ec13 c3c6e9 jp #e9c6 ec16 cd54e9 call #e954 ec19 0e0c ld c,#0c ec1b cd18eb call #eb18 ec1e 2a43e7 ld hl,(#e743) ec21 7e ld a,(hl) ec22 111000 ld de,#0010 ec25 19 add hl,de ec26 77 ld (hl),a ec27 cdf5e9 call #e9f5 ec2a c8 ret z ec2b cd44e9 call #e944 ec2e 0e10 ld c,#10 ec30 1e0c ld e,#0c ec32 cd01ec call #ec01 ec35 cd2deb call #eb2d ec38 c327ec jp #ec27 ec3b 0e0c ld c,#0c ec3d cd18eb call #eb18 ec40 cdf5e9 call #e9f5 ec43 c8 ret z ec44 0e00 ld c,#00 ec46 1e0c ld e,#0c ec48 cd01ec call #ec01 ec4b cd2deb call #eb2d ec4e c340ec jp #ec40 ec51 0e0f ld c,#0f ec53 cd18eb call #eb18 ec56 cdf5e9 call #e9f5 ec59 c8 ret z ec5a cda6e8 call #e8a6 ec5d 7e ld a,(hl) ec5e f5 push af ec5f e5 push hl ec60 cd5ee9 call #e95e ec63 eb ex de,hl ec64 2a43e7 ld hl,(#e743) ec67 0e20 ld c,#20 ec69 d5 push de ec6a cd4fe7 call #e74f ec6d cd78e9 call #e978 ec70 d1 pop de ec71 210c00 ld hl,#000c ec74 19 add hl,de ec75 4e ld c,(hl) ec76 210f00 ld hl,#000f ec79 19 add hl,de ec7a 46 ld b,(hl) ec7b e1 pop hl ec7c f1 pop af ec7d 77 ld (hl),a ec7e 79 ld a,c ec7f be cp (hl) ec80 78 ld a,b ec81 ca8bec jp z,#ec8b ec84 3e00 ld a,#00 ec86 da8bec jp c,#ec8b ec89 3e80 ld a,#80 ec8b 2a43e7 ld hl,(#e743) ec8e 110f00 ld de,#000f ec91 19 add hl,de ec92 77 ld (hl),a ec93 c9 ret ec94 7e ld a,(hl) ec95 23 inc hl ec96 b6 or (hl) ec97 2b dec hl ec98 c0 ret nz ec99 1a ld a,(de) ec9a 77 ld (hl),a ec9b 13 inc de ec9c 23 inc hl ec9d 1a ld a,(de) ec9e 77 ld (hl),a ec9f 1b dec de eca0 2b dec hl eca1 c9 ret eca2 af xor a eca3 3245e7 ld (#e745),a eca6 32eaf1 ld (#f1ea),a eca9 32ebf1 ld (#f1eb),a ecac cd1ee9 call #e91e ecaf c0 ret nz ecb0 cd69e9 call #e969 ecb3 e680 and #80 ecb5 c0 ret nz ecb6 0e0f ld c,#0f ecb8 cd18eb call #eb18 ecbb cdf5e9 call #e9f5 ecbe c8 ret z ecbf 011000 ld bc,#0010 ecc2 cd5ee9 call #e95e ecc5 09 add hl,bc ecc6 eb ex de,hl ecc7 2a43e7 ld hl,(#e743) ecca 09 add hl,bc eccb 0e10 ld c,#10 eccd 3addf1 ld a,(#f1dd) ecd0 b7 or a ecd1 cae8ec jp z,#ece8 ecd4 7e ld a,(hl) ecd5 b7 or a ecd6 1a ld a,(de) ecd7 c2dbec jp nz,#ecdb ecda 77 ld (hl),a ecdb b7 or a ecdc c2e1ec jp nz,#ece1 ecdf 7e ld a,(hl) ece0 12 ld (de),a ece1 be cp (hl) ece2 c21fed jp nz,#ed1f ece5 c3fdec jp #ecfd ece8 cd94ec call #ec94 eceb eb ex de,hl ecec cd94ec call #ec94 ecef eb ex de,hl ecf0 1a ld a,(de) ecf1 be cp (hl) ecf2 c21fed jp nz,#ed1f ecf5 13 inc de ecf6 23 inc hl ecf7 1a ld a,(de) ecf8 be cp (hl) ecf9 c21fed jp nz,#ed1f ecfc 0d dec c ecfd 13 inc de ecfe 23 inc hl ecff 0d dec c ed00 c2cdec jp nz,#eccd ed03 01ecff ld bc,#ffec ed06 09 add hl,bc ed07 eb ex de,hl ed08 09 add hl,bc ed09 1a ld a,(de) ed0a be cp (hl) ed0b da17ed jp c,#ed17 ed0e 77 ld (hl),a ed0f 010300 ld bc,#0003 ed12 09 add hl,bc ed13 eb ex de,hl ed14 09 add hl,bc ed15 7e ld a,(hl) ed16 12 ld (de),a ed17 3eff ld a,#ff ed19 32d2f1 ld (#f1d2),a ed1c c310ec jp #ec10 ed1f 2145e7 ld hl,#e745 ed22 35 dec (hl) ed23 c9 ret ed24 cd54e9 call #e954 ed27 2a43e7 ld hl,(#e743) ; save content of e743 ed2a e5 push hl ed2b 21acf1 ld hl,#f1ac ; init e743 to f1ac ed2e 2243e7 ld (#e743),hl ed31 0e01 ld c,#01 ed33 cd18eb call #eb18 ed36 cdf5e9 call #e9f5 ed39 e1 pop hl ; restore content of e743 ed3a 2243e7 ld (#e743),hl ed3d c8 ret z ed3e eb ex de,hl ed3f 210f00 ld hl,#000f ed42 19 add hl,de ed43 0e11 ld c,#11 ed45 af xor a ed46 77 ld (hl),a ed47 23 inc hl ed48 0d dec c ed49 c246ed jp nz,#ed46 ed4c 210d00 ld hl,#000d ed4f 19 add hl,de ed50 77 ld (hl),a ed51 cd8ce9 call #e98c ed54 cdfdeb call #ebfd ed57 c378e9 jp #e978 ed5a af xor a ed5b 32d2f1 ld (#f1d2),a ed5e cda2ec call #eca2 ed61 cdf5e9 call #e9f5 ed64 c8 ret z ed65 2a43e7 ld hl,(#e743) ed68 010c00 ld bc,#000c ed6b 09 add hl,bc ed6c 7e ld a,(hl) ed6d 3c inc a ed6e e61f and #1f ed70 77 ld (hl),a ed71 ca83ed jp z,#ed83 ed74 47 ld b,a ed75 3ac5f1 ld a,(#f1c5) ed78 a0 and b ed79 21d2f1 ld hl,#f1d2 ed7c a6 and (hl) ed7d ca8eed jp z,#ed8e ed80 c3aced jp #edac ed83 010200 ld bc,#0002 ed86 09 add hl,bc ed87 34 inc (hl) ed88 7e ld a,(hl) ed89 e60f and #0f ed8b cab6ed jp z,#edb6 ed8e 0e0f ld c,#0f ed90 cd18eb call #eb18 ed93 cdf5e9 call #e9f5 ed96 c2aced jp nz,#edac ed99 3ad3f1 ld a,(#f1d3) ed9c 3c inc a ed9d cab6ed jp z,#edb6 eda0 cd24ed call #ed24 eda3 cdf5e9 call #e9f5 eda6 cab6ed jp z,#edb6 eda9 c3afed jp #edaf edac cd5aec call #ec5a edaf cdbbe8 call #e8bb edb2 af xor a edb3 c301e7 jp #e701 edb6 cd05e7 call #e705 edb9 c378e9 jp #e978 edbc 3e01 ld a,#01 edbe 32d5f1 ld (#f1d5),a edc1 3eff ld a,#ff edc3 32d3f1 ld (#f1d3),a edc6 cdbbe8 call #e8bb edc9 3ae3f1 ld a,(#f1e3) edcc 21e1f1 ld hl,#f1e1 edcf be cp (hl) edd0 dae6ed jp c,#ede6 edd3 fe80 cp #80 edd5 c2fbed jp nz,#edfb edd8 cd5aed call #ed5a eddb af xor a eddc 32e3f1 ld (#f1e3),a eddf 3a45e7 ld a,(#e745) ede2 b7 or a ede3 c2fbed jp nz,#edfb ede6 cd77e8 call #e877 ede9 cd84e8 call #e884 edec cafbed jp z,#edfb edef cd8ae8 call #e88a edf2 cdd1e7 call #e7d1 edf5 cdb2e7 call #e7b2 edf8 c3d2e8 jp #e8d2 edfb c305e7 jp #e705 edfe 3e01 ld a,#01 ee00 32d5f1 ld (#f1d5),a ee03 3e00 ld a,#00 ee05 32d3f1 ld (#f1d3),a ee08 cd54e9 call #e954 ee0b 2a43e7 ld hl,(#e743) ee0e cd47e9 call #e947 ee11 cdbbe8 call #e8bb ee14 3ae3f1 ld a,(#f1e3) ee17 fe80 cp #80 ee19 d205e7 jp nc,#e705 ee1c cd77e8 call #e877 ee1f cd84e8 call #e884 ee22 0e00 ld c,#00 ee24 c26eee jp nz,#ee6e ee27 cd3ee8 call #e83e ee2a 32d7f1 ld (#f1d7),a ee2d 010000 ld bc,#0000 ee30 b7 or a ee31 ca3bee jp z,#ee3b ee34 4f ld c,a ee35 0b dec bc ee36 cd5ee8 call #e85e ee39 44 ld b,h ee3a 4d ld c,l ee3b cdbeeb call #ebbe ee3e 7d ld a,l ee3f b4 or h ee40 c248ee jp nz,#ee48 ee43 3e02 ld a,#02 ee45 c301e7 jp #e701 ee48 22e5f1 ld (#f1e5),hl ee4b eb ex de,hl ee4c 2a43e7 ld hl,(#e743) ee4f 011000 ld bc,#0010 ee52 09 add hl,bc ee53 3addf1 ld a,(#f1dd) ee56 b7 or a ee57 3ad7f1 ld a,(#f1d7) ee5a ca64ee jp z,#ee64 ee5d cd64e9 call #e964 ee60 73 ld (hl),e ee61 c36cee jp #ee6c ee64 4f ld c,a ee65 0600 ld b,#00 ee67 09 add hl,bc ee68 09 add hl,bc ee69 73 ld (hl),e ee6a 23 inc hl ee6b 72 ld (hl),d ee6c 0e02 ld c,#02 ee6e 3a45e7 ld a,(#e745) ee71 b7 or a ee72 c0 ret nz ee73 c5 push bc ee74 cd8ae8 call #e88a ee77 3ad5f1 ld a,(#f1d5) ee7a 3d dec a ee7b 3d dec a ee7c c2bbee jp nz,#eebb ee7f c1 pop bc ee80 c5 push bc ee81 79 ld a,c ee82 3d dec a ee83 3d dec a ee84 c2bbee jp nz,#eebb ee87 e5 push hl ee88 2ab9f1 ld hl,(#f1b9) ee8b 57 ld d,a ee8c 77 ld (hl),a ee8d 23 inc hl ee8e 14 inc d ee8f f28cee jp p,#ee8c ee92 cde0e9 call #e9e0 ee95 2ae7f1 ld hl,(#f1e7) ee98 0e02 ld c,#02 ee9a 22e5f1 ld (#f1e5),hl ee9d c5 push bc ee9e cdd1e7 call #e7d1 eea1 c1 pop bc eea2 cdb8e7 call #e7b8 eea5 2ae5f1 ld hl,(#f1e5) eea8 0e00 ld c,#00 eeaa 3ac4f1 ld a,(#f1c4) eead 47 ld b,a eeae a5 and l eeaf b8 cp b eeb0 23 inc hl eeb1 c29aee jp nz,#ee9a eeb4 e1 pop hl eeb5 22e5f1 ld (#f1e5),hl eeb8 cddae9 call #e9da eebb cdd1e7 call #e7d1 eebe c1 pop bc eebf c5 push bc eec0 cdb8e7 call #e7b8 eec3 c1 pop bc eec4 3ae3f1 ld a,(#f1e3) eec7 21e1f1 ld hl,#f1e1 eeca be cp (hl) eecb dad2ee jp c,#eed2 eece 77 ld (hl),a eecf 34 inc (hl) eed0 0e02 ld c,#02 eed2 0d dec c eed3 0d dec c eed4 c2dfee jp nz,#eedf eed7 f5 push af eed8 cd69e9 call #e969 eedb e67f and #7f eedd 77 ld (hl),a eede f1 pop af eedf fe7f cp #7f eee1 c200ef jp nz,#ef00 eee4 3ad5f1 ld a,(#f1d5) eee7 fe01 cp #01 eee9 c200ef jp nz,#ef00 eeec cdd2e8 call #e8d2 eeef cd5aed call #ed5a eef2 2145e7 ld hl,#e745 eef5 7e ld a,(hl) eef6 b7 or a eef7 c2feee jp nz,#eefe eefa 3d dec a eefb 32e3f1 ld (#f1e3),a eefe 3600 ld (hl),#00 ef00 c3d2e8 jp #e8d2 ef03 af xor a ef04 32d5f1 ld (#f1d5),a ef07 c5 push bc ef08 2a43e7 ld hl,(#e743) ef0b eb ex de,hl ef0c 212100 ld hl,#0021 ef0f 19 add hl,de ef10 7e ld a,(hl) ef11 e67f and #7f ef13 f5 push af ef14 7e ld a,(hl) ef15 17 rla ef16 23 inc hl ef17 7e ld a,(hl) ef18 17 rla ef19 e61f and #1f ef1b 4f ld c,a ef1c 7e ld a,(hl) ef1d 1f rra ef1e 1f rra ef1f 1f rra ef20 1f rra ef21 e60f and #0f ef23 47 ld b,a ef24 f1 pop af ef25 23 inc hl ef26 6e ld l,(hl) ef27 2c inc l ef28 2d dec l ef29 2e06 ld l,#06 ef2b c28bef jp nz,#ef8b ef2e 212000 ld hl,#0020 ef31 19 add hl,de ef32 77 ld (hl),a ef33 210c00 ld hl,#000c ef36 19 add hl,de ef37 79 ld a,c ef38 96 sub (hl) ef39 c247ef jp nz,#ef47 ef3c 210e00 ld hl,#000e ef3f 19 add hl,de ef40 78 ld a,b ef41 96 sub (hl) ef42 e67f and #7f ef44 ca7fef jp z,#ef7f ef47 c5 push bc ef48 d5 push de ef49 cda2ec call #eca2 ef4c d1 pop de ef4d c1 pop bc ef4e 2e03 ld l,#03 ef50 3a45e7 ld a,(#e745) ef53 3c inc a ef54 ca84ef jp z,#ef84 ef57 210c00 ld hl,#000c ef5a 19 add hl,de ef5b 71 ld (hl),c ef5c 210e00 ld hl,#000e ef5f 19 add hl,de ef60 70 ld (hl),b ef61 cd51ec call #ec51 ef64 3a45e7 ld a,(#e745) ef67 3c inc a ef68 c27fef jp nz,#ef7f ef6b c1 pop bc ef6c c5 push bc ef6d 2e04 ld l,#04 ef6f 0c inc c ef70 ca84ef jp z,#ef84 ef73 cd24ed call #ed24 ef76 2e05 ld l,#05 ef78 3a45e7 ld a,(#e745) ef7b 3c inc a ef7c ca84ef jp z,#ef84 ef7f c1 pop bc ef80 af xor a ef81 c301e7 jp #e701 ef84 e5 push hl ef85 cd69e9 call #e969 ef88 36c0 ld (hl),#c0 ef8a e1 pop hl ef8b c1 pop bc ef8c 7d ld a,l ef8d 3245e7 ld (#e745),a ef90 c378e9 jp #e978 ef93 0eff ld c,#ff ef95 cd03ef call #ef03 ef98 ccc1ed call z,#edc1 ef9b c9 ret ef9c 0e00 ld c,#00 ef9e cd03ef call #ef03 efa1 cc03ee call z,#ee03 efa4 c9 ret efa5 eb ex de,hl efa6 19 add hl,de efa7 4e ld c,(hl) efa8 0600 ld b,#00 efaa 210c00 ld hl,#000c efad 19 add hl,de efae 7e ld a,(hl) efaf 0f rrca efb0 e680 and #80 efb2 81 add a,c efb3 4f ld c,a efb4 3e00 ld a,#00 efb6 88 adc a,b efb7 47 ld b,a efb8 7e ld a,(hl) efb9 0f rrca efba e60f and #0f efbc 80 add a,b efbd 47 ld b,a efbe 210e00 ld hl,#000e efc1 19 add hl,de efc2 7e ld a,(hl) efc3 87 add a,a efc4 87 add a,a efc5 87 add a,a efc6 87 add a,a efc7 f5 push af efc8 80 add a,b efc9 47 ld b,a efca f5 push af efcb e1 pop hl efcc 7d ld a,l efcd e1 pop hl efce b5 or l efcf e601 and #01 efd1 c9 ret efd2 0e0c ld c,#0c efd4 cd18eb call #eb18 efd7 2a43e7 ld hl,(#e743) efda 112100 ld de,#0021 efdd 19 add hl,de efde e5 push hl efdf 72 ld (hl),d efe0 23 inc hl efe1 72 ld (hl),d efe2 23 inc hl efe3 72 ld (hl),d efe4 cdf5e9 call #e9f5 efe7 ca0cf0 jp z,#f00c efea cd5ee9 call #e95e efed 110f00 ld de,#000f eff0 cda5ef call #efa5 eff3 e1 pop hl eff4 e5 push hl eff5 5f ld e,a eff6 79 ld a,c eff7 96 sub (hl) eff8 23 inc hl eff9 78 ld a,b effa 9e sbc a,(hl) effb 23 inc hl effc 7b ld a,e effd 9e sbc a,(hl) effe da06f0 jp c,#f006 f001 73 ld (hl),e f002 2b dec hl f003 70 ld (hl),b f004 2b dec hl f005 71 ld (hl),c f006 cd2deb call #eb2d f009 c3e4ef jp #efe4 f00c e1 pop hl f00d c9 ret f00e 2a43e7 ld hl,(#e743) f011 112000 ld de,#0020 f014 cda5ef call #efa5 f017 212100 ld hl,#0021 f01a 19 add hl,de f01b 71 ld (hl),c f01c 23 inc hl f01d 70 ld (hl),b f01e 23 inc hl f01f 77 ld (hl),a f020 c9 ret f021 2aaff1 ld hl,(#f1af) f024 3a42e7 ld a,(#e742) f027 4f ld c,a f028 cdeae8 call #e8ea f02b e5 push hl f02c eb ex de,hl f02d cd59e7 call #e759 f030 e1 pop hl f031 cc47e7 call z,#e747 f034 7d ld a,l f035 1f rra f036 d8 ret c f037 2aaff1 ld hl,(#f1af) f03a 4d ld c,l f03b 44 ld b,h f03c cd0be9 call #e90b f03f 22aff1 ld (#f1af),hl f042 c3a3ea jp #eaa3 f045 3ad6f1 ld a,(#f1d6) f048 2142e7 ld hl,#e742 f04b be cp (hl) f04c c8 ret z f04d 77 ld (hl),a f04e c321f0 jp #f021 f051 3eff ld a,#ff f053 32def1 ld (#f1de),a f056 2a43e7 ld hl,(#e743) f059 7e ld a,(hl) f05a e61f and #1f f05c 3d dec a f05d 32d6f1 ld (#f1d6),a f060 fe1e cp #1e f062 d275f0 jp nc,#f075 f065 3a42e7 ld a,(#e742) f068 32dff1 ld (#f1df),a f06b 7e ld a,(hl) f06c 32e0f1 ld (#f1e0),a f06f e6e0 and #e0 f071 77 ld (hl),a f072 cd45f0 call #f045 f075 3a41e7 ld a,(#e741) f078 2a43e7 ld hl,(#e743) f07b b6 or (hl) f07c 77 ld (hl),a f07d c9 ret f07e 3e22 ld a,#22 f080 c301e7 jp #e701 f083 210000 ld hl,#0000 f086 22adf1 ld (#f1ad),hl f089 22aff1 ld (#f1af),hl f08c af xor a f08d 3242e7 ld (#e742),a f090 218000 ld hl,#0080 f093 22b1f1 ld (#f1b1),hl f096 cddae9 call #e9da f099 c321f0 jp #f021 f09c cd72e9 call #e972 f09f cd51f0 call #f051 f0a2 c351ec jp #ec51 f0a5 cd51f0 call #f051 f0a8 c3a2ec jp #eca2 f0ab 0e00 ld c,#00 f0ad eb ex de,hl f0ae 7e ld a,(hl) f0af fe3f cp #3f f0b1 cac2f0 jp z,#f0c2 f0b4 cda6e8 call #e8a6 f0b7 7e ld a,(hl) f0b8 fe3f cp #3f f0ba c472e9 call nz,#e972 f0bd cd51f0 call #f051 f0c0 0e0f ld c,#0f f0c2 cd18eb call #eb18 f0c5 c3e9e9 jp #e9e9 f0c8 2ad9f1 ld hl,(#f1d9) f0cb 2243e7 ld (#e743),hl f0ce cd51f0 call #f051 f0d1 cd2deb call #eb2d f0d4 c3e9e9 jp #e9e9 f0d7 cd51f0 call #f051 f0da cd9ceb call #eb9c f0dd c301eb jp #eb01 f0e0 cd51f0 call #f051 f0e3 c3bced jp #edbc f0e6 cd51f0 call #f051 f0e9 c3feed jp #edfe f0ec cd72e9 call #e972 f0ef cd51f0 call #f051 f0f2 c324ed jp #ed24 f0f5 cd51f0 call #f051 f0f8 cd16ec call #ec16 f0fb c301eb jp #eb01 ; return bitmap of logged drives f0fe 2aaff1 ld hl,(#f1af) f101 c329f1 jp #f129 f104 3a42e7 ld a,(#e742) f107 c301e7 jp #e701 f10a eb ex de,hl f10b 22b1f1 ld (#f1b1),hl f10e c3dae9 jp #e9da f111 2abff1 ld hl,(#f1bf) f114 c329f1 jp #f129 ; return bitmap of R/O drives f117 2aadf1 ld hl,(#f1ad) f11a c329f1 jp #f129 f11d cd51f0 call #f051 f120 cd3bec call #ec3b f123 c301eb jp #eb01 f126 2abbf1 ld hl,(#f1bb) f129 2245e7 ld (#e745),hl f12c c9 ret f12d 3ad6f1 ld a,(#f1d6) f130 feff cp #ff f132 c23bf1 jp nz,#f13b f135 3a41e7 ld a,(#e741) f138 c301e7 jp #e701 f13b e61f and #1f f13d 3241e7 ld (#e741),a f140 c9 ret f141 cd51f0 call #f051 f144 c393ef jp #ef93 f147 cd51f0 call #f051 f14a c39cef jp #ef9c f14d cd51f0 call #f051 f150 c3d2ef jp #efd2 f153 2a43e7 ld hl,(#e743) f156 7d ld a,l f157 2f cpl f158 5f ld e,a f159 7c ld a,h f15a 2f cpl f15b 2aaff1 ld hl,(#f1af) f15e a4 and h f15f 57 ld d,a f160 7d ld a,l f161 a3 and e f162 5f ld e,a f163 2aadf1 ld hl,(#f1ad) f166 eb ex de,hl f167 22aff1 ld (#f1af),hl f16a 7d ld a,l f16b a3 and e f16c 6f ld l,a f16d 7c ld a,h f16e a2 and d f16f 67 ld h,a f170 22adf1 ld (#f1ad),hl f173 c9 ret ; end of BDOS system call f174 3adef1 ld a,(#f1de) f177 b7 or a f178 ca91f1 jp z,#f191 f17b 2a43e7 ld hl,(#e743) f17e 3600 ld (hl),#00 f180 3ae0f1 ld a,(#f1e0) f183 b7 or a f184 ca91f1 jp z,#f191 f187 77 ld (hl),a f188 3adff1 ld a,(#f1df) f18b 32d6f1 ld (#f1d6),a f18e cd45f0 call #f045 f191 2a0fe7 ld hl,(#e70f) ; restore stack pointer f194 f9 ld sp,hl f195 2a45e7 ld hl,(#e745) ; fetch result f198 7d ld a,l ; in both BA and HL f199 44 ld b,h f19a c9 ret f19b cd51f0 call #f051 f19e 3e02 ld a,#02 f1a0 32d5f1 ld (#f1d5),a f1a3 0e00 ld c,#00 f1a5 cd07ef call #ef07 f1a8 cc03ee call z,#ee03 f1ab c9 ret ; data areas ; ; initialized data ; f1ac db #e5 ; e5 = available dir entry f1ad dw 0 ; read only disk vector f1af dw 1 ; logged-in disks f1b1 dw #0080 ; initial dma address ; these 7 addresses are always initialized by copying the DPH parameters ; as soon as a drive is selected f1b3 dw #f447 ; overriden by pointer to current dir max value f1b5 dw #f449 ; overriden by pointer to current track f1b7 dw #f44b ; overriden by pointer to current record f1b9 dw #fc00 ; overriden by address of directory buffer to use (always f6a3) f1bb dw #f465 ; overriden by current Disk Parameter Block (DPB) address f1bd dw #fce6 ; overriden by current checksum vector address f1bf dw #fc80 ; overriden by current allocation vector address ; this Disk Parameter Block (DPB) is always initialized by copying the DPB of ; the current drive as soon as it is selected f1c1 dw 80 ; number 128-byte records per track f1c3 db 4 ; block shift factor 4 => 2K f1c4 db #0f ; block mask f1c5 db 0 ; extent mask f1c6 dw 399 ; maximum allocation block number f1c8 dw 127 ; largest directory number f1ca db #c0 ; directory allocation bitmap, first byte f1cb db 0 ; directory allocation bitmap, second byte f1cc dw 32 ; size of checksum vector f1ce dw 0 ; offset tracks at beginning f1d0 dw 00 ; contains the address of the sector translation table f1d2 db #ff f1d3 db #ff f1d4 db 0 f1d5 db 1 f1d6 db #ff f1d7 db 0 f1d8 0f f1d9 dw #e3cd f1db dw 0 f1dd 00 f1de 00 f1df 0 f1e0 0 f1e1 02 f1e2 00 f1e3 02 f1e4 00 f1e5 51 f1e6 0f f1e7 50 f1e8 0f f1e9 60 f1ea 43 f1eb 00 f1ec 10 f1ed 00 f1ee 00 f1ef 00 f1f0 00 f1f1 00 f1f2 00 f1f3 00 f1f4 00 f1f5 00 f1f6 00 f1f7 00 f1f8 00 f1f9 00 f1fa 00 f1fb 00 f1fc 00 f1fd 00 f1fe 00 f1ff 00 ; BIOS functions jump table in RAM, all jumps will reactivate ROM to execute the functions ; Address 0000 is a jp $f203 f200 c393f2 jp #f293 ; BOOT f203 c395f2 jp #f295 ; (0) WBOOT: warm boot, reload command proc f206 c30af3 jp #f30a ; (1)console status f209 c398f2 jp #f298 ; (2)console input f20c c30df3 jp #f30d ; (3)console output f20f c39ef2 jp #f29e ; (4)printer output f212 c3a1f2 jp #f2a1 ; (5)paper/tape punch output (-> auxiliary ouput : TTY) f215 c3a4f2 jp #f2a4 ; (6)paper/tape reader input (-> auxiliary input : TTY) f218 c3a7f2 jp #f2a7 ; (7)move disk head to track 0 f21b c3aaf2 jp #f2aa ; (8)select disk drive f21e c3adf2 jp #f2ad ; (9)select track # f221 c3b0f2 jp #f2b0 ; (10)select sector # f224 c3b3f2 jp #f2b3 ; (11)select dma address f227 c3b6f2 jp #f2b6 ; (12)read sector f22a c3b9f2 jp #f2b9 ; (13)write sector f22d c307f3 jp #f307 ; (14)status of list device f230 c3bcf2 jp #f2bc ; (15)sector translation for skewing ; additional jumps for CP/M 3 (not fully implemented) f233 c3bff2 jp #f2bf ; (16)status of console output (CP/M 3) f236 c3c2f2 jp #f2c2 ; (17)status of auxiliary input (CP/M 3) f239 c3c5f2 jp #f2c5 ; (18)status of auxiliary output (CP/M 3) f23c c3c8f2 jp #f2c8 ; (19)not implemented f23f c3cbf2 jp #f2cb ; (20)not implemented f242 c3cef2 jp #f2ce ; (21)not implemented f245 c3d1f2 jp #f2d1 ; (22)not implemented f248 c3d4f2 jp #f2d4 ; (23)not implemented f24b c381f2 jp #f281 ; (24)=> move block routine (CP/M 3) f24e c3daf2 jp #f2da ; (25)not implemented (should be Real Time Clock) f251 c385f2 jp #f285 ; (26)not implemented f254 c388f2 jp #f288 ; (27)not implemented f257 c3e3f2 jp #f2e3 ; (28)not implemented f25a c3e6f2 jp #f2e6 ; (29)not implemented f25d c3e9f2 jp #f2e9 ; (30)not implemented (RESERVED1) f260 c3ecf2 jp #f2ec ; (31)not implemented (RESERVED2) ; additional jumps not defined in CP/M 3 f263 c3eff2 jp #f2ef ; (32) get/set date/time (in RTC if C=-1) f266 c3f2f2 jp #f2f2 ; (33) read track routine f269 c3f5f2 jp #f2f5 ; (34) write track routine (format) f26c c3f8f2 jp #f2f8 ; (35) read sector routine f26f c38bf2 jp #f28b ; (36) drive redirection map address (=> HL=f468) f272 c3fbf2 jp #f2fb ; (37) copy default BIOS configuration data from rom f275 c3fef2 jp #f2fe ; (38) read the BIOS configuration data from RTC's RAM f278 c301f3 jp #f301 ; (39) write the BIOS configuration data to the RTC's RAM f27b c38ff2 jp #f28f ; (40) BIOS configuration data address (=> HL=f493) f27e c39bf2 jp #f29b ; (41) set DTR state (or read DSR state if C=00) f281 eb ex de,hl f282 edb0 ldir f284 c9 ret f285 4f ld c,a f286 1855 jr #f2dd f288 4f ld c,a f289 1855 jr #f2e0 f28b 2168f4 ld hl,#f468 f28e c9 ret f28f 2193f4 ld hl,#f493 f292 c9 ret ; Hidden ld a,nn instructions in ld hl,nnnn operand ! f293 af xor a f294 213e02 ld hl,#023e ; f295 ld a,#02 f297 213e06 ld hl,#063e ; f298 ld a,#06 f29a 213e50 ld hl,#503e ; f29b ld a,#50 f29d 213e0a ld hl,#0a3e ; f29e ld a,#0a f2a0 213e0c ld hl,#0c3e ; f2a1 ld a,#0c f2a3 213e0e ld hl,#0e3e ; f2a4 ld a,#0e f2a6 213e10 ld hl,#103e ; f2a7 ld a,#10 f2a9 213e12 ld hl,#123e ; f2aa ld a,#12 f2ac 213e14 ld hl,#143e ; f2ad ld a,#14 f2af 213e16 ld hl,#163e ; f2b0 ld a,#16 f2b2 213e18 ld hl,#183e ; f2b3 ld a,#18 f2b5 213e1a ld hl,#1a3e ; f2b6 ld a,#1a f2b8 213e1c ld hl,#1c3e ; f2b9 ld a,#1c f2bb 213e20 ld hl,#203e ; f2bc ld a,#20 f2be 213e22 ld hl,#223e ; f2bf ld a,#22 f2c1 213e24 ld hl,#243e ; f2c2 ld a,#24 f2c4 213e26 ld hl,#263e ; f2c5 ld a,#26 f2c7 213e28 ld hl,#283e ; f2c8 ld a,#28 f2ca 213e2a ld hl,#2a3e ; f2cb ld a,#2a f2cd 213e2c ld hl,#2c3e ; f2ce ld a,#2c f2d0 213e2e ld hl,#2e3e ; f2d1 ld a,#2e f2d3 213e30 ld hl,#303e ; f2d4 ld a,#30 f2d6 213e32 ld hl,#323e ; f2d7 ld a,#32 f2d9 213e34 ld hl,#343e ; f2da ld a,#34 f2dc 213e36 ld hl,#363e ; f2dd ld a,#36 f2df 213e38 ld hl,#383e ; f2e0 ld a,#38 f2e2 213e3a ld hl,#3a3e ; f2e3 ld a,#3a f2e5 213e3c ld hl,#3c3e ; f2e6 ld a,#3c f2e8 213e3e ld hl,#3e3e ; f2e9 ld a,#3e f2eb 213e40 ld hl,#403e ; f2ec ld a,#40 f2ee 213e42 ld hl,#423e ; f2ef ld a,#42 f2f1 213e44 ld hl,#443e ; f2f2 ld a,#44 f2f4 213e46 ld hl,#463e ; f2f5 ld a,#46 f2f7 213e52 ld hl,#523e ; f2f8 ld a,#52 f2fa 213e48 ld hl,#483e ; f2fb ld a,#48 f2fd 213e4a ld hl,#4a3e ; f2fe ld a,#4a f300 213e4c ld hl,#4c3e ; f301 ld a,#4c f303 213e4e ld hl,#4e3e ; f304 ld a,#4e ; no jump to f304 ??? f306 213e1e ld hl,#1e3e ; f307 ld a,#1e ; status of list device f309 213e04 ld hl,#043e ; f30a ld a,#04 ; console status : it is faster here than in order f30c 213e08 ld hl,#083e ; f30c ld a,#08 ; console output : it is faster here than in order f30f ed73fefe ld (#fefe),sp f313 31fdfe ld sp,#fefd f316 6f ld l,a f317 3a0300 ld a,(#0003) ; get the I/O byte while we can (ram still enabled) f31a d354 out (ROM_ENABLE),a f31c cd9c04 call #049c f31f d353 out (LORAM_ENABLE),a f321 ed7bfefe ld sp,(#fefe) f325 c9 ret ; init 0-page jumps f326 ed3953 out0 (LORAM_ENABLE),a f329 af xor a f32a 320400 ld (#0004),a f32d dd7e35 ld a,(ix+#35) ; I/O byte f330 320300 ld (#0003),a f333 ed3953 out0 (LORAM_ENABLE),a f336 ddcb01c6 set 0,(ix+#01) f33a 3ec3 ld a,#c3 ; JMP opcode f33c 320000 ld (#0000),a f33f 320500 ld (#0005),a f342 2103f2 ld hl,#f203 ; 0000 : jp f203 f345 220100 ld (#0001),hl f348 2106e4 ld hl,#e406 ; 0005 : jp BDOS f34b 220600 ld (#0006),hl f34e ed3954 out0 (ROM_ENABLE),a f351 c9 ret ; activate Low Ram to load CCP ; (because of BDOS' record buffer in 0080 ?) ; and change stack address f352 d353 out (LORAM_ENABLE),a f354 e1 pop hl f355 316af5 ld sp,#f56a f358 e5 push hl f359 cd5ff3 call #f35f f35c d354 out (ROM_ENABLE),a f35e c9 ret ; load CCP in $DC00 f35f 0e0d ld c,#0d ; BDOS: Reset discs f361 cd06e4 call #e406 f364 0e0f ld c,#0f ; BDOS: Open file f366 11c8f3 ld de,#f3c8 ; "CCP.COM" entry f369 cd06e4 call #e406 f36c 3c inc a ; error if A=#ff f36d 2831 jr z,#f3a0 f36f af xor a f370 32e8f3 ld (#f3e8),a f373 67 ld h,a f374 6f ld l,a f375 226bf5 ld (#f56b),hl ; initialize checksum to zero f378 2100dc ld hl,#dc00 f37b 110608 ld de,#0806 ; #0806 bytes to load f37e 0e7f ld c,#7f ; end of buffer => next load implies disk read f380 cda3f3 call #f3a3 ; load a byte f383 b7 or a f384 2017 jr nz,#f39d f386 70 ld (hl),b ; store the loaded byte f387 23 inc hl f388 1b dec de f389 7a ld a,d f38a b3 or e f38b 20f3 jr nz,#f380 f38d 2a6bf5 ld hl,(#f56b) ; get the checksum in HL f390 cda3f3 call #f3a3 ; and compare with the next two bytes f393 b0 or b f394 ad xor l f395 2006 jr nz,#f39d f397 cda3f3 call #f3a3 f39a b0 or b f39b ac xor h f39c c8 ret z f39d 3e02 ld a,#02 f39f c9 ret f3a0 3e01 ld a,#01 f3a2 c9 ret f3a3 e5 push hl f3a4 d5 push de f3a5 0c inc c f3a6 f2b6f3 jp p,#f3b6 f3a9 0e14 ld c,#14 ; BDOS: read next record f3ab 11c8f3 ld de,#f3c8 f3ae cd06e4 call #e406 f3b1 b7 or a f3b2 2011 jr nz,#f3c5 f3b4 0e00 ld c,#00 f3b6 218000 ld hl,#0080 f3b9 0600 ld b,#00 f3bb 09 add hl,bc f3bc 46 ld b,(hl) f3bd 2a6bf5 ld hl,(#f56b) f3c0 09 add hl,bc f3c1 226bf5 ld (#f56b),hl f3c4 af xor a f3c5 d1 pop de f3c6 e1 pop hl f3c7 c9 ret f3c8 00 f3c9 "CCP COM" db 0,0,0,0,0,0,0,0 db 0,0,0,0,0,0,0,0 db 0,0,0,0,0,0,0,0 ; 4 Disc Parameter Header (DPH) : drive 0 f3ec dw 0 ; address of sector translation table dw 0,0,0 ; used as workspace (VAR1, VAR2, VAR3) dw #f6a3 ; address of a 128-byte sector buffer dw #f42c ; address of the Disk Parameter Block (DPB) dw #f7a6 ; address of the directory checksum vector dw #f723 ; address of the allocation vector ; Disc Parameter Header (DPH): drive 1 dw 0 ; address of sector translation table dw 0,0,0 ; used as workspace (VAR1, VAR2, VAR3) dw #f6a3 ; address of a 128-byte sector buffer dw #f42c ; address of the Disk Parameter Block (DPB) dw #f7a6 ; address of the directory checksum vector (replaced later by f7e6) dw #f756 ; address of the allocation vector ; Disc Parameter Header (DPH): drive 2 (ramdisk) dw 0 ; address of sector translation table dw 0,0,0 ; used as workspace (VAR1, VAR2, VAR3) dw #f6a3 ; address of a 128-byte sector buffer dw #f455 ; address of the Disk Parameter Block (DPB) dw #f826 ; address of the directory checksum vector dw #f789 ; address of the allocation vector ; Disc Parameter Header (DPH): drive 3 (drive P) dw 0 ; address of sector translation table dw 0,0,0 ; used as workspace (VAR1, VAR2, VAR3) dw #f6a3 ; address of a 128-byte sector buffer dw #f43f ; address of the Disk Parameter Block (DPB) f428 dw #f7a6 ; address of the directory checksum vector f42a dw #f723 ; address of the allocation vector ; Disk Parameter Block (DPB) for drives 0 and 1 f42c dw 80 ; number of 128-byte records per track db 4 ; block shift factor 4 => 2K block size db #0f ; block mask db 0 ; extent mask dw 399 ; maximum allocation block number dw 127 ; largest directory number db #c0 ; directory allocation bitmap, first byte db 0 ; directory allocation bitmap, second byte dw 32 ; size of checksum vector dw 0 ; offset tracks at beginning ; additionnal workspace variables db 03 ; (iy+#0f) => sector size 3 => 1024 bytes db 07 ; (iy+#10) => record mask (8 records per sector) db 09 ; (iy+#11) => timer values ; bit 7: double times ; bit 6: ; bits 543: ; bits 210: db 00 ; (iy+#12) => no sector skewing ; Disk Parameter Block (DPB) for drive 3 (logical drive P) f43f dw 70 ; number of 128-byte records per track (then 80) db 0 ; block shift factor (then 4) db 0 ; block mask (then #0f) db 0 ; extent mask (then 0) dw 0 ; maximum allocation block number (then 399) dw 0 ; largest directory number (then 127) db 0 ; directory allocation bitmap, first byte (then #c0) db 0 ; directory allocation bitmap, second byte (then 0) dw 0 ; size of checksum vector (then 32) dw 0 ; offset tracks at beginning (then 0) f44e db 00 00 00 00 ; (then 3 7 9 1 => skew scheme is 1) db 00 00 00 ; (then $50 $68 $73) ; Disk Parameter Block (DPB) for drive 2 (ramdisk ?) f455 dw 32 ; number of 128-byte records per track => 4K db 4 ; block shift factor 4 => 2K block size db #0f ; block mask db 1 ; extent mask dw 0 ; maximum allocation block number (then 87) dw 127 ; largest directory number db #c0 ; directory allocation bitmap, first byte db 0 ; directory allocation bitmap, second byte dw 32 ; size of checksum vector dw 4 ; offset tracks at beginning ; additionnal workspace variables for drive 2 db 03 ; (iy+#0f) => sector size 3 => 1024 bytes db 07 ; (iy+#10) => record mask (8 records per sector) db 00 ; (iy+#11) db 00 ; (iy+#12) ; sixteen drives redirection map: only A and P present ; but then drive M is set as drive 2 (RAMDISK) f468 00 f1 f2 f3 f4 f5 f6 f7 f8 f9 fa fb fc fd fe 0f ; f478-f5e3 : variables for the BIOS (initialized to 0 at startup, and indexed by ix) ; ix+#00 (f478) : I/O byte ; ix+#01 (f479) : flags ; bit 1 & 4 set for write sector operation ; bit 2 means pre-read sector ; bit 3 means current sector contents has to be written back to floppy ; ix+#02 (f47a) : 128-bytes sector number selected by BIOS fct ; ix+#03 (f47b) : track number selected by BIOS fct ; ix+#04 (f47c) : redirected logical drive number selected by BIOS fct ; ix+#05 (f47d) : physical drive number (0,1,2) selected by BIOS fct ; ix+#06 (f47e) : "DMA" address set by BIOS fct ; ix+#08 (f480) : MRU sector number (physical size sector, 0-based) ; ix+#09 (f481) : MRU track number (selected by BIOS fct) ; ix+#0a (f482) : MRU redirected logical drive number ; ix+#0b (f483) : MRU physical drive number ; Variables in low level sector routine : ; ix+#0c (f484) : 0-based sector number ; ix+#0d (f485) : track number (selected by BIOS fct) ; ix+#0e (f486) : physical drive number ; ix+#0f (f487) : floppy routine number ; ix+#10 (f488) : address of sector buffer (always f847) ; ix+#12 (f48a) : track number after translation scheme ; ix+#13 (f48b) : status flags ; ix+#14 (f48c) : MRU drive selection (00 for drive 0, 80 for drive 1) ; ix+#15 (f48d) : MRU I/O address for side selection ;... ; ix+#17 (f48f) : CRT flags ; bit 765: block origin for ROR register ; bit 5 is changed for page 1: ; page 1 => bit 5=1 (warning there's a swap between Z1 and Z2 !!) ; => 4 KB origin ; bit 0 is used to force selection of odd row address in dbl height ; ix+#18 (f490) : ; ix+#19 (f491) : memory bank number ; ix+#1a (f492) : ;********************************************************************* ; f493-f4c4 : 50 bytes of BIOS configuration data, copied to RTC's backup-ed RAM ; ix+#1b (f493) : default : 00 ; bit 7: short time/date representation ; bit 6: if bit7=1, 1 selects english day/month order (MM-DD-YY) ; bits 210 select language ; ix+#1c (f494) : default : 5d ; bit 7: if parity enabled, 1 => odd parity, 0 => even ; bits 654 select serial data format, ; default 8 databits, no parity, 2 stop bits ; bits 3210 select baud rate, see table in 069c ; default 9600 baud ; ix+#1d (f495) : default : 80 ; bit 7 tells if flow control is used on TTY (RTS/CTS and XON/XOFF) ; ix+#1e (f496) : default : 00 ; bit 7 tells if boot screen must be skipped ; bit 6 tells if drive B is present ? ; bit 210 must be 0 is boot screen is skipped, otherwise crash ; ix+#1f (f497) : default : 50 00 04 0f 00 8f 01 7f 00 c0 00 20 00 00 00 03 07 09 01 ; Disk Parameter Block for drive 3 (drive P) ; ix+#32 (f4aa) : default 50 -> ?? ; ix+#33 (f4ab) : default 68 -> ?? ; ix+#34 (f4ac) : default 73 -> ?? ; ix+#35 (f4ad) : default 81 : I/O byte => LIST=LPT:,PUNCH=TTY:,READER=TTY:,CONSOLE=CRT: ; f4ae-f4c3 : unused ? ; ix+#4c (f4c4) : end of BIOS configuration data : checksum ;********************************************************************* ; ix+#4d (f4c5) : bit 7 says transmitting flow to TTY is stopped (Ctrl-S) ; ix+#54 (f4cc-f4cd) : nb of chars in TTY buffer ; ix+#56 (f4ce-f4cf) : pointer for next char to put in TTY buffer ; ix+#58 (f4d0-f4d1) : pointer for next char to get in TTY buffer ; f4d2-f511 : TTY buffer (64 bytes) ; f512-f531 : keyboard buffer (32 bytes) ; f536 : copy of RTC Seconds ; f537 : copy of RTC Minutes ; f538 : copy of RTC Hours ; f539 : copy of RTC Day of week - 1 ; f53a : copy of RTC Day of month ; f53b : copy of RTC Month ; f53c : copy of RTC Year ; f53d-... : buffer for date/time string ; ....-f56a : stack pointer SP is initialized to f56a when loading CCP ; f56b-f56c : checksum when loading CCP ; ; f56f-f570 : DPB address of selected drive ; f571-f572 : DPB address of last used drive ; f573-f574 : DPB address of current drive in low-level sector routine ; f575-f577 : floppy variables ; f578-f582 and f583-f58d: two CRT variables structures pointed by IY ; iy+0 : flags bit 7: 40 column mode bit 6: cursor off bit 5: bit 4: bit 3210: ESCn sequence number ; iy+1 : current value of VDP DOR register in 80-column mode or R3 register in 40-column mode (A byte) In both cases, each nibble contains a color and there are two additionnal bits (bit 3 and bit 7) If in 40-column mode and mosaic mode (bit 0 of iy+2), bit 7 means separated mosaic set instead of inverse video ; iy+2 : copy of VDP R2 register (B byte) ? bit 6 : if 0 don't apply sequential attributes bit 5 : ? bits 3210: low nibble for B Byte (KRF command) bit 3 : double width ? bit 2 : conceal bit 1 : double height bit 0 : mosaic mode (insert attribute not used) ; iy+3 : temporary variable, first argument of ESC sequence ; iy+4 : cursor column ; iy+5 : cursor line number ; iy+6 : line number ; iy+7 : saved cursor column ; iy+8 : saved cursor line ; iy+9 : margin color for VDP MAT register (background color) ; iy+10: work variable, character to write ; f58e-f6a2 : unused ?? (277 bytes) ; f6a3-f722 : 128-bytes sector buffer ; f723-f755 : allocation vector for drive 0 DPH : 408 bits (should be 400) ; f756-f788 : allocation vector for drive 1 DPH : 408 bits (should be 400) ; f789-f7a5 : allocation vector for drive 2 DPH : 408 bits (should be 400) ; f7a6-f7e5 : directory checksum vector for drive 0 DPH : 32 words ; f7e6-f825 : directory checksum vector for drive 1 DPH : 32 words ; f826-f845 : directory checksum vector for drive 2 DPH : 32 words ; f847-fc46 : 1024 bytes sector buffer ; fc47-fedf : unused ?? (665 bytes) ; stack pointer SP is saved in fefe and then initialized to fefd when entering BIOS ; so fee0-feff is typically overwritten by stack ; register I is set to #ff and ff00 dw #ff4d ; INT1 vector ff02 dw #ff51 ; INT2 vector ff04 dw #ff56 ; TIMER channel 0 interrupt vector ff06 dw #ff5b ; TIMER channel 1 interrupt vector ff08 dw #ff60 ; DMA channel 0 interrupt vector ff0a dw #ff65 ; DMA channel 1 interrupt vector ff0c dw #ff6a ; CSIO interrupt vector ff0e dw #ff6f ; ASCI channel 0 interrupt vector ff10 dw #ff74 ; ASCI channel 1 interrupt vector ff12 c30000 jp #0000 ; console output ff15 c30000 jp #0000 ; status of console output ff18 c30000 jp #0000 ; console input ff1b c30000 jp #0000 ; console status ff1e c30000 jp #0000 ; paper tape reader input ff21 c30000 jp #0000 ; status of auxiliary input ff24 c30000 jp #0000 ; paper tape punch output ff27 c30000 jp #0000 ; status of auxiliary output ff2a c30000 jp #0000 ; printer output ff2d c30000 jp #0000 ; status of list device ff30 ed3953 out0 (LORAM_ENABLE),a ff33 edb0 ldir ff35 ed3954 out0 (ROM_ENABLE),a ff38 c9 ret ff39 ed3953 out0 (LORAM_ENABLE),a ff3c 320400 ld (#0004),a ff3f ed3954 out0 (ROM_ENABLE),a ff42 c9 ret ff43 ed3953 out0 (LORAM_ENABLE),a ff46 3a0400 ld a,(#0004) ff49 4f ld c,a ff4a c300dc jp #dc00 ; start CCP.COM ; INT1 interrupt handler ff4d f5 push af ff4e af xor a ff4f 1826 jr #ff77 ; INT2 interrupt handler ff51 f5 push af ff52 3e02 ld a,#02 ff54 1821 jr #ff77 ; Programmable Reload Timer (PRT) channel 0 interrupt handler ff56 f5 push af ff57 3e04 ld a,#04 ff59 181c jr #ff77 ; PRT channel 1 interrupt handler ff5b f5 push af ff5c 3e06 ld a,#06 ff5e 1817 jr #ff77 ; DMA channel 0 interrupt handler ff60 f5 push af ff61 3e08 ld a,#08 ff63 1812 jr #ff77 ; DMA channel 1 interrupt handler ff65 f5 push af ff66 3e0a ld a,#0a ff68 180d jr #ff77 ; SCIO interrupt handler ff6a f5 push af ff6b 3e0c ld a,#0c ff6d 1808 jr #ff77 ; ASCI channel 0 interrupt handler ff6f f5 push af ; 11 cycles ff70 3e0e ld a,#0e ; 7 ff72 1803 jr #ff77 ; 12 ; => 30 cycles ; ASCI channel 1 interrupt handler ff74 f5 push af ff75 3e10 ld a,#10 ; common interrupt handler, ; register A contains the low byte of the interrupt vector ; Cycles: 20+10+11+4+13+13+13+10+16?+17+12/7+16?+13+20+10+4+14 = 211 cycles ff77 ed73fcff ld (#fffc),sp ff7b 31faff ld sp,#fffa ff7e f5 push af ff7f af xor a ; => A=00 ff80 320000 ld (#0000),a ; no effect if rom is active ff83 3a0000 ld a,(#0000) ; 00 if ram is active, C3 if rom is active ff86 32fbff ld (#fffb),a ff89 f1 pop af ff8a ed3954 out0 (ROM_ENABLE),a ; restore the rom in lower memory ff8d cd1405 call #0514 ; will return with flag Z if (0000) is 00 ff90 2006 jr nz,#ff98 ff92 ed3953 out0 (LORAM_ENABLE),a ; remove the rom from lower memory ff95 320000 ld (#0000),a ; restore a C3 in 0000 ff98 ed7bfcff ld sp,(#fffc) ff9c f1 pop af ff9d fb ei ; reti doesn't enable interrupts, so ei is needed. ; but ei will not retrigger the pending interrupts, ff9e ed4d reti ; reti will retrigger the interrupt priority mechanism ffa0 4f ld c,a ;....-fffa : stack pointer SP is initialized to fffa for interrupt handling ;fffb : content of memory 0000 is copied here by interrupt vector ;fffc-fffd : stack pointer SP is saved here for interrupt handling