; z80dasm 1.1.6 ; command line: z80dasm -g 0000h -l -a -b block_monroe_oc8820_r3.00 -o monroe_test.asm ../prom/monroe_oc8820_boot_prom_r3_00C_tms2516_ea751e22.bin displaymem equ 0x3000 nomemchecks equ 9 org 00000h l0000h: di ;0000 no interrupt ld sp,0ffa6h ;0001 init stack xor a ;0004 A=0 jp l_init ;0005 go init 00046h ld de,0303eh ;0008 point to screen ram call cleartopline ;000b go clear top line 0052dh nop ;000e nop ;000f pop hl ;0010 get return addr displaymsg: ld c,(hl) ;0011 load count inc hl ;0012 bump ld b,000h ;0013 jp printroutine ;0015 rst 38h ;0018 rst 38h ;0019 rst 38h ;001a rst 38h ;001b rst 38h ;001c rst 38h ;001d rst 38h ;001e rst 38h ;001f rst 38h ;0020 rst 38h ;0021 rst 38h ;0022 rst 38h ;0023 rst 38h ;0024 rst 38h ;0025 rst 38h ;0026 rst 38h ;0027 rst 38h ;0028 rst 38h ;0029 rst 38h ;002a rst 38h ;002b rst 38h ;002c rst 38h ;002d rst 38h ;002e rst 38h ;002f rst 38h ;0030 rst 38h ;0031 rst 38h ;0032 rst 38h ;0033 rst 38h ;0034 rst 38h ;0035 rst 38h ;0036 rst 38h ;0037 rst 38h ;0038 rst 38h ;0039 rst 38h ;003a rst 38h ;003b rst 38h ;003c rst 38h ;003d rst 38h ;003e rst 38h ;003f jp l0000h ;0040 jp l0000h ;0043 l_init: out (0c0h),a ;0046 clear io, floppy control out (0c4h),a ;0048 clear io,Program map A base out (0c5h),a ;004a clear io,Program map B base out (0c6h),a ;004c clear io,DMA map A base out (0c7h),a ;004e clear io,DMA map B base out (0d4h),a ;0050 clear io,Hi-res color out (0d8h),a ;0052 clear io,Hi-res start ld hl,PIOA_start ;0054 jp l0562h ;0057 do OTIR loop on following data 00562h ; BLOCK 'PIOA' (start 0x005a end 0x008b) PIOA_start: defb 0b5h ;005a io port CRT register select defb 004h ;005b count 4 defb 0cfh ;005c defb 0b8h ;005d defb 037h ;005e defb 0efh ;005f ; defb 0b4h ;0060 io port PIO A data defb 001h ;0061 count 1 defb 001h ;0062 ; defb 0a1h ;0063 io port DART A command defb 006h ;0064 count 6 defb 048h ;0065 defb 048h ;0066 defb 004h ;0067 defb 044h ;0068 defb 005h ;0069 defb 0eah ;006a ; defb 0a3h ;006b io port DART B command defb 008h ;006c count 8 defb 048h ;006d defb 048h ;006e defb 004h ;006f defb 044h ;0070 defb 001h ;0071 defb 000h ;0072 defb 003h ;0073 defb 0c1h ;0074 ; defb 0a5h ;0075 io port SIO A command defb 002h ;0076 count 2 defb 048h ;0077 defb 048h ;0078 ; defb 0a7h ;0079 io port SIO B command defb 002h ;007a count 2 defb 048h ;007b defb 048h ;007c ; defb 0a8h ;007d io port CTC CHANNEL 0 - Communications baud rate defb 002h ;007e count 2 defb 003h ;007f defb 003h ;0080 ; defb 0a9h ;0081 io port CTC CHANNEL 1 - AUX RS-232C baud rate defb 002h ;0082 count 2 defb 003h ;0083 defb 003h ;0084 ; defb 0aah ;0085 io port CTC CHANNEL 2 - Printer baud rate defb 002h ;0086 count 2 defb 057h ;0087 defb 04eh ;0088 ; defb 000h ;0089 io port reset defb 000h ;008a count 0 terminator PIOA_end: ld ix,initcontinue ;008b continuation addr 00092h jp setupclearscreen ;008f setup display and clear screen 00505h initcontinue: ld a,080h ;0092 out (0d4h),a ;0094 out 0d4h,80h Hi-res color enable copy, buzzer off ld de,displaymem ;0096 point to display upper left corner 03000h ld hl,TESTING_start ;0099 point to message 0009fh jp displaymsg ;009c go display message at HL 00011h ; BLOCK 'TESTING' (start 0x009f end 0x00a8) TESTING_start: defb 008h ;009f 8 bytes "Testing." defb 054h ;00a0 defb 065h ;00a1 defb 073h ;00a2 defb 074h ;00a3 defb 069h ;00a4 defb 06eh ;00a5 defb 067h ;00a6 defb 02eh ;00a7 TESTING_end: ld a,005h ;00a8 out (0a3h),a ;00aa DART B command ld a,068h ;00ac out (0a3h),a ;00ae DART B command ld a,0f0h ;00b0 ????? out (0c8h),a ;00b2 Map and system control ld ix,0c001h ;00b4 ld bc,00c5h ;00b8 ld d,nomemchecks ;00bb Start test memory bank (1-9), go to zero afterwards 009h ld a,0a0h ;00bd out (0c5h),a ;00bf Program map B base ld (ix-001h),b ;00c1 dec b ;00c4 inc a ;00c5 out (0c5h),a ;00c6 Program map B base ld (ix-001h),b ;00c8 dec a ;00cb out (0c5h),a ;00cc Program map B base ld b,(ix-001h) ;00ce inc b ;00d1 jr z,skipd011 ;00d2 $+4 skip for start of memtest ld d,011h ;00d4 skipd011: ld b,d ;00d6 ld hl,memtesteval ;00d7 00122h ld de,0000h ;00da beginmemtest: outi ;00dd jr z,memcmp ;00df exx ;00e1 ld b,055h ;00e2 memory check value ld e,000h ;00e4 memtestloop: ld hl,0c000h ;00e6 Start for membank that has been switch into ld c,b ;00e9 memtestwriteloop: ld (hl),c ;00ea rlc c ;00eb inc l ;00ed jr nz,memtestwriteloop ;00ee -4 rlc c ;00f0 inc h ;00f2 jr nz,memtestwriteloop ;00f3 -9 ld h,0c0h ;00f5 ld c,b ;00f7 memtestreadloop: ld a,(hl) ;00f8 xor c ;00f9 or e ;00fa ld e,a ;00fb rlc c ;00fc inc l ;00fe jr nz,memtestreadloop ;00ff rlc c ;0101 inc h ;0103 jr nz,memtestreadloop ;0104 rlc b ;0106 jr nc,memtestloop ;0108 ld a,e ;010a exx ;010b and a ;010c jr z,memgood ;010d inc a ;010f jr z,memerror ;0110 or d ;0112 ld d,a ;0113 jr memgood ;0114 memerror: inc e ;0116 memgood: ld a,b ;0117 cp 004h ;0118 jr nz,beginmemtest ;011a ld a,020h ;011c out (0c0h),a ;011e Floppy external control Motor on! jr beginmemtest ;0120 memtesteval: and c ;0122 pop bc ;0123 pop hl ;0124 nop ;0125 jr nz,floppystart2 ;0126 ld h,b ;0128 add a,b ;0129 and b ;012a ret nz ;012b ret po ;012c ld bc,04121h ;012d ld h,c ;0130 add a,c ;0131 nop ;0132 memcmp: xor a ;0133 or d ;0134 or e ;0135 Any errors? jr z,floppystart ;0136 ld ix,memcheckdisplay ;0138 jp setupcrt ;013c memcheckdisplay: ld de,displaymem ;013f ld hl,ERROR2_start ;0142 jp displaymsg ;0145 ; BLOCK 'ERROR2' (start 0x0148 end 0x0160) ERROR2_start: defb 017h ;0148 count 23 defb 045h ;0149 Error #2 :Call service. defb 072h ;014a defb 072h ;014b defb 06fh ;014c defb 072h ;014d defb 020h ;014e defb 023h ;014f defb 032h ;0150 defb 020h ;0151 defb 03ah ;0152 defb 043h ;0153 defb 061h ;0154 defb 06ch ;0155 defb 06ch ;0156 defb 020h ;0157 defb 073h ;0158 defb 065h ;0159 defb 072h ;015a defb 076h ;015b defb 069h ;015c defb 063h ;015d defb 065h ;015e defb 02eh ;015f ERROR2_end: halt ;0160 floppystart: out (0c5h),a ;0161 Program map B base out (0c8h),a ;0163 Map and system control dec hl ;0165 dec hl ;0166 ld a,(hl) ;0167 floppystart2: rrca ;0168 and 080h ;0169 ld (0ff80h),a ;016b ld de,0ffa6h ;016e ld hl,005beh ;0171 ld bc,0005ah ;0174 ldir ;0177 call setupclearscreen2 ;0179 readydiskloop: call readydisk ;017c call sub_061ch ;017f ld a,0ffh ;0182 jr c,skipinvert ;0184 cpl ;0186 skipinvert: ld (0ff93h),a ;0187 ld hl,00404h ;018a ld (0ff91h),hl ;018d or a ;0190 jr nz,l01c3h ;0191 ld c,010h ;0193 call sub_065ah ;0195 jr c,l01abh ;0198 ld bc,00000h ;019a call sub_040eh ;019d jr c,l01abh ;01a0 call sub_03a2h ;01a2 ld a,(0ff8bh) ;01a5 ld (0ff91h),a ;01a8 l01abh: ld c,011h ;01ab call sub_065ah ;01ad jr c,l01c3h ;01b0 ld bc,0000h ;01b2 call sub_040eh ;01b5 jr c,l01c3h ;01b8 call sub_03a2h ;01ba ld a,(0ff8bh) ;01bd ld (0ff92h),a ;01c0 l01c3h: ld a,001h ;01c3 ld c,008h ;01c5 l01c7h: or 0a0h ;01c7 out (0c0h),a ;01c9 Floppy external control ld b,a ;01cb l01cch: in a,(0b0h) ;01cc Floppy status rr a ;01ce jr c,l01cch ;01d0 in a,(0b0h) ;01d2 Floppy status add a,a ;01d4 jr c,l01ddh ;01d5 call delayloop ;01d7 call loadingdisk ;01da l01ddh: inc c ;01dd ld a,b ;01de add a,a ;01df and 00fh ;01e0 jr nz,l01c7h ;01e2 ld a,(0ff93h) ;01e4 or a ;01e7 jr nz,l0204h ;01e8 in a,(0ffh) ;01ea ???? and 020h ;01ec jr nz,l0204h ;01ee ld c,010h ;01f0 call sub_065ah ;01f2 ld b,000h ;01f5 call nc,loadingdisk ;01f7 ld c,011h ;01fa call sub_065ah ;01fc ld b,000h ;01ff call nc,loadingdisk ;0201 l0204h: call setupclearscreen2 ;0204 ld bc,002a3h ;0207 ld hl,0061ah ;020a otir ;020d ld de,03000h ;020f ld hl,NOSYSTEM_start ;0212 jp displaymsg ;0215 ; BLOCK 'NOSYSTEM' (start 0x0218 end 0x0232) NOSYSTEM_start: defb 019h ;0218 count 25 defb 04eh ;0219 No System Device On Line. defb 06fh ;021a defb 020h ;021b defb 053h ;021c defb 079h ;021d defb 073h ;021e defb 074h ;021f defb 065h ;0220 defb 06dh ;0221 defb 020h ;0222 defb 044h ;0223 defb 065h ;0224 defb 076h ;0225 defb 069h ;0226 defb 063h ;0227 defb 065h ;0228 defb 020h ;0229 defb 04fh ;022a defb 06eh ;022b defb 020h ;022c defb 04ch ;022d defb 069h ;022e defb 06eh ;022f defb 065h ;0230 defb 02eh ;0231 NOSYSTEM_end: call delayloop ;0232 call delayloop ;0235 call delayloop ;0238 jp readydiskloop ;023b l023eh: ld ix,returnsetupcrt1 ;023e jp setupcrt ;0242 returnsetupcrt1: call screenclearnetry2 ;0245 rst 10h ;0248 ; BLOCK 'ERROR0' (start 0x0249 end 0x0261) ERROR0_start: defb 017h ;0249 count 23 defb 045h ;024a Error #0: Call service. defb 072h ;024b defb 072h ;024c defb 06fh ;024d defb 072h ;024e defb 020h ;024f defb 023h ;0250 defb 030h ;0251 defb 03ah ;0252 defb 020h ;0253 defb 043h ;0254 defb 061h ;0255 defb 06ch ;0256 defb 06ch ;0257 defb 020h ;0258 defb 073h ;0259 defb 065h ;025a defb 072h ;025b defb 076h ;025c defb 069h ;025d defb 063h ;025e defb 065h ;025f defb 02eh ;0260 ERROR0_end: halt ;0261 loadingdisk: push bc ;0262 xor a ;0263 ld (0ff81h),a ;0264 ld (0ff82h),a ;0267 rst 8 ;026a ; BLOCK 'LOADING' (start 0x026b end 0x0274) LOADING_start: defb 008h ;026b count 8 defb 04ch ;026c Loading defb 06fh ;026d defb 061h ;026e defb 064h ;026f defb 069h ;0270 defb 06eh ;0271 defb 067h ;0272 defb 020h ;0273 LOADING_end: pop ix ;0274 call sub_04a1h ;0276 jr c,l023eh ;0279 ld bc,0000h ;027b call sub_040eh ;027e jr c,l02ddh ;0281 ld hl,(0ff81h) ;0283 ld a,l ;0286 and a ;0287 jr z,l029ch ;0288 ld a,h ;028a and 003h ;028b in a,(0ffh) ;028d jr z,l0298h ;028f bit 0,a ;0291 jr nz,l029ch ;0293 l0295h: jp l034bh ;0295 l0298h: bit 1,a ;0298 jr z,l0295h ;029a l029ch: call sub_03a2h ;029c jp c,l0343h ;029f jr z,l02b6h ;02a2 call sub_040eh ;02a4 jr c,l02ddh ;02a7 ld hl,0401fh ;02a9 bit 0,(hl) ;02ac jp nz,l034fh ;02ae call sub_040eh ;02b1 jr c,l02ddh ;02b4 l02b6h: exx ;02b6 ld hl,0400eh ;02b7 ld d,(hl) ;02ba inc hl ;02bb ld e,(hl) ;02bc push de ;02bd pop iy ;02be ld hl,04080h ;02c0 ld c,(hl) ;02c3 inc hl ;02c4 inc hl ;02c5 ld d,(hl) ;02c6 inc hl ;02c7 ld e,(hl) ;02c8 inc hl ;02c9 ld a,(hl) ;02ca inc hl ;02cb ld l,(hl) ;02cc ld h,a ;02cd ex de,hl ;02ce push hl ;02cf ld a,e ;02d0 add a,0ffh ;02d1 ld a,d ;02d3 exx ;02d4 ld e,000h ;02d5 adc a,e ;02d7 ld d,a ;02d8 pop hl ;02d9 call sub_0414h ;02da l02ddh: jr c,l0347h ;02dd ld a,(0ff8bh) ;02df cp 002h ;02e2 jr z,l02eeh ;02e4 xor a ;02e6 ex af,af' ;02e7 exx ;02e8 jp 0ffa6h ;02e9 l02ech: ex af,af' ;02ec adc a,c ;02ed l02eeh: push ix ;02ee pop bc ;02f0 ld a,(0ff8bh) ;02f1 ld de,00013h ;02f4 ld hl,0ff8dh ;02f7 jr nz,l033fh ;02fa cp 002h ;02fc jp nz,0ffb8h ;02fe push bc ;0301 bit 3,c ;0302 jr nz,l030bh ;0304 ld a,0ffh ;0306 ld (0ff81h),a ;0308 l030bh: in a,(0ffh) ;030b ld c,a ;030d xor a ;030e bit 0,c ;030f jr z,l0315h ;0311 ld a,00fh ;0313 l0315h: bit 1,c ;0315 jr z,l031bh ;0317 or 0f0h ;0319 l031bh: ld b,a ;031b ld a,(0ff81h) ;031c cpl ;031f and a ;0320 jr z,l0334h ;0321 push bc ;0323 push ix ;0324 pop bc ;0326 ld a,c ;0327 sub 007h ;0328 ld b,a ;032a ld a,080h ;032b l032dh: rlca ;032d rlca ;032e djnz l032dh ;032f pop bc ;0331 and b ;0332 rrca ;0333 l0334h: xor b ;0334 pop bc ;0335 ld (0ff81h),a ;0336 ld a,(0ff8bh) ;0339 jp 0ffb8h ;033c l033fh: ld a,033h ;033f jr l0351h ;0341 l0343h: ld a,030h ;0343 jr l0351h ;0345 l0347h: ld a,032h ;0347 jr l0351h ;0349 l034bh: ld a,039h ;034b jr l0351h ;034d l034fh: ld a,031h ;034f l0351h: push ix ;0351 push af ;0353 call screenclearnetry2 ;0354 push de ;0357 rst 10h ;0358 ; BLOCK 'INVALID' (start 0x0359 end 0x0382) INVALID_start: defb 028h ;0359 count 40 defb 045h ;035a Error #10: Invalid System Disk in Drive defb 072h ;035b defb 072h ;035c defb 06fh ;035d defb 072h ;035e defb 020h ;035f defb 023h ;0360 defb 031h ;0361 defb 030h ;0362 defb 03ah ;0363 defb 020h ;0364 defb 049h ;0365 defb 06eh ;0366 defb 076h ;0367 defb 061h ;0368 defb 06ch ;0369 defb 069h ;036a defb 064h ;036b defb 020h ;036c defb 053h ;036d defb 079h ;036e defb 073h ;036f defb 074h ;0370 defb 065h ;0371 defb 06dh ;0372 defb 020h ;0373 defb 044h ;0374 defb 069h ;0375 defb 073h ;0376 defb 06bh ;0377 defb 020h ;0378 defb 069h ;0379 defb 06eh ;037a defb 020h ;037b defb 044h ;037c defb 072h ;037d defb 069h ;037e defb 076h ;037f defb 065h ;0380 defb 020h ;0381 INVALID_end: pop hl ;0382 pop bc ;0383 ld de,0008h ;0384 add hl,de ;0387 add hl,de ;0388 inc hl ;0389 ld a,004h ;038a Select display memory out (0c8h),a ;038c Map and system control ld (hl),b ;038e xor a ;038f out (0c8h),a ;0390 Map and system control call delayloop ;0392 call delayloop ;0395 call setupclearscreen2 ;0398 call readydisk ;039b exx ;039e pop bc ;039f scf ;03a0 ret ;03a1 sub_03a2h: ld a,003h ;03a2 ld (0ff8bh),a ;03a4 ld hl,0401dh ;03a7 ld a,(hl) ;03aa cp 0e5h ;03ab scf ;03ad ret z ;03ae cp 06ch ;03af scf ;03b1 ret z ;03b2 add a,001h ;03b3 jr nc,l03bdh ;03b5 ld hl,0ff8bh ;03b7 ld (hl),002h ;03ba ret ;03bc l03bdh: inc hl ;03bd ld b,(hl) ;03be ld a,b ;03bf inc hl ;03c0 ld c,(hl) ;03c1 add a,001h ;03c2 adc a,c ;03c4 ld hl,0ff8bh ;03c5 ld (hl),002h ;03c8 jr z,l03d4h ;03ca ld (hl),001h ;03cc ld a,b ;03ce or c ;03cf scf ;03d0 ret z ;03d1 or a ;03d2 ret ;03d3 l03d4h: ld bc,0001h ;03d4 or a ;03d7 ret ;03d8 readydisk: ld de,displaymem ;03d9 rst 10h ;03dc ; BLOCK 'READY' (start 0x03dd end 0x03fb) READY_start: defb 01dh ;03dd count 29 defb 052h ;03de R3-00C Ready For System Disk defb 033h ;03df defb 02dh ;03e0 defb 030h ;03e1 defb 030h ;03e2 defb 043h ;03e3 defb 020h ;03e4 defb 052h ;03e5 defb 065h ;03e6 defb 061h ;03e7 defb 064h ;03e8 defb 079h ;03e9 defb 020h ;03ea defb 046h ;03eb defb 06fh ;03ec defb 072h ;03ed defb 020h ;03ee defb 053h ;03ef defb 079h ;03f0 defb 073h ;03f1 defb 074h ;03f2 defb 065h ;03f3 defb 06dh ;03f4 defb 020h ;03f5 defb 044h ;03f6 defb 069h ;03f7 defb 073h ;03f8 defb 06bh ;03f9 defb 020h ;03fa READY_end: call delayloop ;03fb ret ;03fe ld b,00ah ;03ff ld hl,0000h ;0401 l0404h: inc hl ;0404 ld a,l ;0405 or h ;0406 jr nz,l0404h ;0407 djnz l0404h ;0409 jp memcmp ;040b sub_040eh: ld de,00100h ;040e ld hl,04000h ;0411 sub_0414h: push bc ;0414 push ix ;0415 pop bc ;0417 ld a,c ;0418 pop bc ;0419 cp 010h ;041a jp nc,l06c1h ;041c l041fh: ld a,005h ;041f l0421h: ex af,af' ;0421 push bc ;0422 ex (sp),hl ;0423 ld a,l ;0424 and 00fh ;0425 push bc ;0427 push af ;0428 ld a,(0ff81h) ;0429 and a ;042c ld b,000h ;042d jr z,l0433h ;042f ld b,010h ;0431 l0433h: pop af ;0433 add a,b ;0434 inc a ;0435 out (0b2h),a ;0436 Floppy sector register add hl,hl ;0438 add hl,hl ;0439 add hl,hl ;043a add hl,hl ;043b cp 011h ;043c ld a,h ;043e out (0b3h),a ;043f Floppy data register jr c,l0453h ;0441 rra ;0443 out (0b3h),a ;0444 Floppy data register push ix ;0446 pop bc ;0448 ld a,b ;0449 jr nc,l044eh ;044a or 010h ;044c l044eh: ld (0ff82h),a ;044e out (0c0h),a ;0451 Floppy external control l0453h: pop bc ;0453 pop hl ;0454 ld a,01dh ;0455 call setfloppystatus ;0457 and 098h ;045a jr nz,l0486h ;045c call sub_04c1h ;045e l0461h: ld a,(0ff82h) ;0461 bit 4,a ;0464 ld a,082h ;0466 jr z,l046ch ;0468 ld a,08ah ;046a l046ch: call setfloppystatus ;046c and 09ch ;046f jr nz,l0486h ;0471 inc h ;0473 inc bc ;0474 dec d ;0475 ret z ;0476 ld a,c ;0477 and 00fh ;0478 jr z,l041fh ;047a in a,(0b2h) ;047c Floppy sector register inc a ;047e out (0b2h),a ;047f Floppy sector register ld a,005h ;0481 l0483h: ex af,af' ;0483 jr l0461h ;0484 l0486h: scf ;0486 bit 7,a ;0487 ret nz ;0489 ex af,af' ;048a dec a ;048b jr nz,l0421h ;048c ex af,af' ;048e bit 4,a ;048f jr z,l049fh ;0491 ld a,(0ff81h) ;0493 and a ;0496 jr nz,l049fh ;0497 cpl ;0499 ld (0ff81h),a ;049a jr l041fh ;049d l049fh: scf ;049f ret ;04a0 sub_04a1h: push bc ;04a1 push ix ;04a2 pop bc ;04a4 ld a,c ;04a5 pop bc ;04a6 cp 010h ;04a7 jp nc,l0788h ;04a9 ld a,001h ;04ac call setfloppystatus ;04ae and 004h ;04b1 ret nz ;04b3 scf ;04b4 ret ;04b5 setfloppystatus: out (0b0h),a ;04b6 Floppy status l04b8h: in a,(0b4h) ;04b8 PIO A data bit 4,a ;04ba jr z,l04b8h ;04bc in a,(0b0h) ;04be floppy status and command ret ;04c0 sub_04c1h: push bc ;04c1 ld bc,0b301h ;04c2 jr l04cbh ;04c5 sub_04c7h: push bc ;04c7 ld bc,07803h ;04c8 l04cbh: ld a,b ;04cb ld (0ff8ch),a ;04cc ld a,c ;04cf out (0b4h),a ;04d0 PIO A data ld bc,006ach ;04d2 ld a,0c3h ;04d5 l04d7h: out (c),a ;04d7 djnz l04d7h ;04d9 ld a,07dh ;04db out (c),a ;04dd out (c),l ;04df out (c),h ;04e1 out (c),e ;04e3 out (c),d ;04e5 push hl ;04e7 ld hl,004fbh ;04e8 ld b,003h ;04eb otir ;04ed ld a,(0ff8ch) ;04ef out (c),a ;04f2 ld b,005h ;04f4 otir ;04f6 pop hl ;04f8 pop bc ;04f9 ret ;04fa inc d ;04fb jr z,l0483h ;04fc adc a,d ;04fe rst 8 ;04ff ld bc,087cfh ;0500 setupclearscreen2: pop ix ;0503 setupclearscreen: ;entry during initiation with IX=0092 xor a ;0505 start A=0 ld bc,00eb9h ;0506 C=B9 B=14 ld hl,0054fh ;0509 setupclearloop : out (0b8h),a ;050cCRT register select inc a ;050e A++ outi ;050f C)=(HL++) and B-- jr nz,setupclearloop ;0511 loop until B==0 (14 bytes to write) $-5 ld de,03002h ;0513 ld hl,displaymem ;0516 ld bc,00ffeh ;0519 ;RST 08 jump in here HL=300C DE=300E BC=4E IX=032F l051ch: ld a,004h ;051c Select display memory out (0c8h),a ;051e Output to screen out C8,04 Map and system control xor a ;0520 ld (hl),a ;0521 put 00h at 3000h or 300Ch inc hl ;0522 bump ld (hl),020h ;0523 put 20h at 3001h or 300Dh dec hl ;0525 go back point to original ldir ;0526 copy 00 20 through 4K or 80 words xor a ;0528 Reset map A=0 out (0c8h),a ;0529 out C8,00 Map and system control jp (ix) ;052b continue cleartopline: push de ;052d save old DE ld l,e ;052e HL=DE ld h,d ;052f inc de ;0530 DE+=2 inc de ;0531 ld bc,0004eh ;0532 80-2 push ix ;0535 save old IX ld ix,clearlineend ;0537 exit addr 0053dh jr l051ch ;053b clear line 300C 80char $-3 ;clear line returns here clearlineend: pop ix ;053d restore old IX pop de ;053f restore old DE ret ;0540 ; BLOCK 'DB' (start 0x0541 end 0x055d) printroutine: ;print routine ;BC count ;HL message source ;DE screen target ld a,004h ;0541 Select display memory out (0c8h),a ;0543 Output to screen Map and system control printcharloop: inc de ;0545 do every other addr ldi ;0546 (DE++)=(HL++) and BC-- jp pe,printcharloop ;0548 repeat while BC not 0 00545h xor a ;054b Reset map out (0c8h),a ;054c Reset to memory Map and system control jp (hl) ;054e ;data to be output to io port B9 14 byte CRT data register defb 069h ;054f defb 050h ;0550 defb 056h ;0551 defb 00bh ;0552 defb 019h ;0553 defb 003h ;0554 defb 018h ;0555 defb 018h ;0556 defb 000h ;0557 defb 00bh ;0558 defb 020h ;0559 defb 000h ;055a defb 000h ;055b defb 000h ;055c DB_end: pop hl ;055d jr l0562h ;055e screenclearloop: otir ;0560 out B bytes from (HL) to (C) l0562h: ld c,(hl) ;0562 get register inc hl ;0563 bump ld b,(hl) ;0564 get count inc hl ;0565 bump ld a,b ;0566 and a ;0567 jr nz,screenclearloop ;0568 if count not 0 loop $-8 jp (hl) ;056a screenclearnetry2: ld de,03100h ;056b ld a,00fh ;056e out (0b8h),a ;0570 CRT register select xor a ;0572 out (0b9h),a ;0573 CRT data register in a,(0bbh) ;0575 ????? or a ;0577 ret nz ;0578 ld de,030a0h ;0579 ret ;057c delayloop: ld hl,04600h ;057d l0580h: dec hl ;0580 ex (sp),hl ;0581 ex (sp),hl ;0582 ex (sp),hl ;0583 ex (sp),hl ;0584 ld a,l ;0585 or h ;0586 jr nz,l0580h ;0587 ret ;0589 pop ix ;058a setupcrt: ld a,00fh ;058c out (0b8h),a ;058e CRT register select xor a ;0590 out (0b9h),a ;0591 CRT data register in a,(0bbh) ;0593 and a ;0595 jr nz,l059ch ;0596 ld a,081h ;0598 out (0d4h),a ;059a Buzzer on l059ch: ld bc,006cch ;059c ld hl,005b8h ;059f otir ;05a2 ld bc,0000h ;05a4 l05a7h: ex (sp),hl ;05a7 ex (sp),hl ;05a8 dec bc ;05a9 ld a,b ;05aa or c ;05ab jr nz,l05a7h ;05ac ld a,080h ;05ae out (0d4h),a ;05b0 Buzzer off ld a,09fh ;05b2 out (0cch),a ;05b4 ????? jp (ix) ;05b6 l05b8h: adc a,(hl) ;05b8 inc b ;05b9 sub d ;05ba cp a ;05bb rst 18h ;05bc rst 38h ;05bd l05beh: ld a,001h ;05be out (0c8h),a ;05c0 Map and system control l05c2h: ex af,af' ;05c2 adc a,(hl) ;05c3 ex af,af' ;05c4 inc hl ;05c5 dec de ;05c6 ld a,e ;05c7 or d ;05c8 jr nz,l05c2h ;05c9 out (0c8h),a ;05cb Map and system control jp l02ech ;05cd cp 002h ;05d0 ld a,001h ;05d2 out (0c8h),a ;05d4 Map and system control jr nz,l05f5h ;05d6 ld a,(0ff81h) ;05d8 ld (0022h),a ;05db ld a,c ;05de sub 010h ;05df jr c,l05f5h ;05e1 ld c,a ;05e3 jr z,l05eeh ;05e4 ld a,(0ff8fh) ;05e6 cp 095h ;05e9 jr nz,l05eeh ;05eb inc c ;05ed l05eeh: ld a,004h ;05ee add a,c ;05f0 ld c,a ;05f1 push bc ;05f2 pop ix ;05f3 l05f5h: ld a,(0ff80h) ;05f5 or c ;05f8 ld c,a ;05f9 ld a,(0ff91h) ;05fa ld (de),a ;05fd inc de ;05fe push bc ;05ff ld bc,00004h ;0600 ldir ;0603 ld de,00023h ;0605 ld hl,0ff8dh ;0608 ld a,(0ff92h) ;060b ld (de),a ;060e inc de ;060f ld bc,00004h ;0610 ldir ;0613 pop bc ;0615 jp (iy) ;0616 dec b ;0618 add a,b ;0619 dec b ;061a nop ;061b sub_061ch: ld bc,002a3h ;061c ld hl,00618h ;061f otir ;0622 ld b,0ffh ;0624 l0626h: in a,(079h) ;0626 cp 0c7h ;0628 jr z,l0630h ;062a djnz l0626h ;062c scf ;062e ret ;062f l0630h: call reading ;0630 ret c ;0633 in a,(0ffh) ;0634 rra ;0636 rra ;0637 and 007h ;0638 ld hl,007e2h ;063a jr z,l064fh ;063d ld hl,007d6h ;063f dec a ;0642 jr z,l0648h ;0643 ld hl,007cah ;0645 l0648h: call sub_076bh ;0648 call reading ;064b ret c ;064e l064fh: ld de,0ff8dh ;064f ld bc,00004h ;0652 ldir ;0655 jp l077fh ;0657 sub_065ah: push bc ;065a pop ix ;065b ld a,010h ;065d sub c ;065f jr z,l0664h ;0660 ld a,020h ;0662 l0664h: ld hl,0ff83h ;0664 ld b,004h ;0667 ld (hl),008h ;0669 inc hl ;066b ld (hl),a ;066c l066dh: inc hl ;066d ld (hl),000h ;066e djnz l066dh ;0670 call reading ;0672 ret c ;0675 call moveoutreseta ;0676 call reading2 ;0679 and 002h ;067c ret z ;067e scf ;067f ret ;0680 l0681h: push bc ;0681 call screenclearnetry2 ;0682 rst 10h ;0685 ; BLOCK 'ERROR1' (start 0x0686 end 0x06af) ERROR1_start: defb 028h ;0686 defb 045h ;0687 count 40 defb 072h ;0688 Error 1: Disk system error, Call Service defb 072h ;0689 defb 06fh ;068a defb 072h ;068b defb 020h ;068c defb 031h ;068d defb 03ah ;068e defb 020h ;068f defb 044h ;0690 defb 069h ;0691 defb 073h ;0692 defb 06bh ;0693 defb 020h ;0694 defb 073h ;0695 defb 079h ;0696 defb 073h ;0697 defb 074h ;0698 defb 065h ;0699 defb 06dh ;069a defb 020h ;069b defb 065h ;069c defb 072h ;069d defb 072h ;069e defb 06fh ;069f defb 072h ;06a0 defb 02ch ;06a1 defb 020h ;06a2 defb 043h ;06a3 defb 061h ;06a4 defb 06ch ;06a5 defb 06ch ;06a6 defb 020h ;06a7 defb 053h ;06a8 defb 065h ;06a9 defb 072h ;06aa defb 076h ;06ab l06ach: defb 069h ;06ac defb 063h ;06ad defb 065h ;06ae ERROR1_end: call delayloop ;06af call delayloop ;06b2 call delayloop ;06b5 call setupclearscreen2 ;06b8 call readydisk ;06bb pop bc ;06be scf ;06bf ret ;06c0 l06c1h: call sub_04c7h ;06c1 ld a,b ;06c4 ld (0ff85h),a ;06c5 ld a,c ;06c8 ld (0ff86h),a ;06c9 l06cch: ld a,d ;06cc ld (0ff87h),a ;06cd push bc ;06d0 push hl ;06d1 call reading ;06d2 jp c,l06fbh ;06d5 ld hl,0ff83h ;06d8 ld bc,00678h ;06db l06deh: in a,(079h) ;06de and 041h ;06e0 jr nz,l06deh ;06e2 outi ;06e4 jr nz,l06deh ;06e6 out (07ah),a ;06e8 nop ;06ea l06ebh: in a,(079h) ;06eb and 044h ;06ed jr nz,l06ebh ;06ef out (07bh),a ;06f1 call reading2 ;06f3 and 002h ;06f6 call nz,sub_06ffh ;06f8 l06fbh: pop hl ;06fb pop bc ;06fc inc bc ;06fd ret ;06fe sub_06ffh: call reading ;06ff ret c ;0702 ld a,003h ;0703 call moveout ;0705 ld bc,00478h ;0708 ld hl,0ff89h ;070b l070eh: in a,(079h) ;070e cp 00fh ;0710 jr nz,l070eh ;0712 ini ;0714 jr nz,l070eh ;0716 call reading2 ;0718 ld a,(0ff89h) ;071b sub 098h ;071e ret z ;0720 scf ;0721 ret ;0722 reading: in a,(079h) ;0723 and 080h ;0725 scf ;0727 ret z ;0728 ld a,001h ;0729 out (079h),a ;072b ld b,0ffh ;072d l072fh: in a,(079h) ;072f and 080h ;0731 ret z ;0733 djnz l072fh ;0734 scf ;0736 ret ;0737 reading2: in a,(079h) ;0738 and 044h ;073a jr nz,reading2 ;073c in a,(078h) ;073e ld b,a ;0740 l0741h: in a,(079h) ;0741 and 042h ;0743 jr nz,l0741h ;0745 in a,(078h) ;0747 ld a,b ;0749 ret ;074a moveoutreseta: ld a,000h ;074b moveout: call sub_0760h ;074d ld a,(0ff84h) ;0750 call sub_0760h ;0753 ld a,000h ;0756 ld b,004h ;0758 l075ah: call sub_0760h ;075a djnz l075ah ;075d ret ;075f sub_0760h: push af ;0760 l0761h: in a,(079h) ;0761 and 041h ;0763 jr nz,l0761h ;0765 pop af ;0767 out (078h),a ;0768 ret ;076a sub_076bh: ld a,00ch ;076b call moveout ;076d ld bc,00878h ;0770 l0773h: in a,(079h) ;0773 cp 007h ;0775 jr nz,l0773h ;0777 outi ;0779 jr nz,l0773h ;077b jr reading2 ;077d l077fh: ld a,0e4h ;077f call steproutine ;0781 ret z ;0784 jp l0681h ;0785 l0788h: call reading ;0788 ret c ;078b ld a,001h ;078c call steproutine ;078e ret z ;0791 jr l079dh ;0792 steproutine: call moveout ;0794 call reading2 ;0797 and 002h ;079a ret ;079c l079dh: call screenclearnetry2 ;079d rst 10h ;07a0 ; BLOCK 'ERROR3' (start 0x07a1 end 0x07c9) ERROR3_start: defb 027h ;07a1 count 39 defb 045h ;07a2 Error 3: Disk Malfunction, Call Service defb 072h ;07a3 defb 072h ;07a4 defb 06fh ;07a5 defb 072h ;07a6 defb 020h ;07a7 defb 033h ;07a8 defb 03ah ;07a9 defb 020h ;07aa defb 044h ;07ab defb 069h ;07ac defb 073h ;07ad defb 06bh ;07ae defb 020h ;07af defb 04dh ;07b0 defb 061h ;07b1 defb 06ch ;07b2 defb 066h ;07b3 defb 075h ;07b4 defb 06eh ;07b5 defb 063h ;07b6 defb 074h ;07b7 defb 069h ;07b8 defb 06fh ;07b9 defb 06eh ;07ba defb 02ch ;07bb defb 020h ;07bc defb 043h ;07bd defb 061h ;07be defb 06ch ;07bf defb 06ch ;07c0 defb 020h ;07c1 defb 053h ;07c2 defb 065h ;07c3 defb 072h ;07c4 defb 076h ;07c5 defb 069h ;07c6 defb 063h ;07c7 defb 065h ;07c8 ERROR3_end: halt ;07c9 l07cah: ld bc,00432h ;07ca ld bc,00031h ;07cd ld b,b ;07d0 dec bc ;07d1 ld b,000h ;07d2 sub l ;07d4 rst 38h ;07d5 l07d6h: ld bc,00232h ;07d6 ld bc,00031h ;07d9 ld b,b ;07dc dec bc ;07dd ld b,000h ;07de ld c,d ;07e0 rst 38h ;07e1 l07e2h: nop ;07e2 nop ;07e3 ld c,d ;07e4 rst 38h ;07e5 rst 38h ;07e6 rst 38h ;07e7 rst 38h ;07e8 rst 38h ;07e9 rst 38h ;07ea rst 38h ;07eb rst 38h ;07ec rst 38h ;07ed rst 38h ;07ee rst 38h ;07ef rst 38h ;07f0 rst 38h ;07f1 rst 38h ;07f2 rst 38h ;07f3 rst 38h ;07f4 rst 38h ;07f5 rst 38h ;07f6 rst 38h ;07f7 rst 38h ;07f8 rst 38h ;07f9 rst 38h ;07fa rst 38h ;07fb rst 38h ;07fc rst 38h ;07fd rst 38h ;07fe rst 38h ;07ff