1: - 4000 SYS_RAM_START equ 0x4000 2: - 4010 SYS_BUF_START equ 0x4010 3: - 4110 PRG_RAM_START equ 0x4110 4: - FF00 PRG_RAM_TOP equ 0xFF00 5: - FFFF STACK_RAM_TOP equ 0xFFFF 6: 7: ;VAR_CONSOLE_CONF equ 0x07 ;CLK/TRG Clock @ 1843220.5/s 8: - 000F VAR_CONSOLE_CONF equ 0x0F ;CPU/16 Clock @ 230402.5625/s 9: 10: - 0018 VAR_CONSOLE_BAUD equ 24 ;BAUD timer constant 11: ;CLK/TRG Clock @ 1843220.5/s 12: ; -> 0x16 : 14400 13: ;CPU/16 Clock @ 230402.5625/s 14: ; -> 12 : 19200 15: ; -> 24 : 9600 16: 17: ; include IO device addresses 18: .include "addresses.s" **** include/addresses.s **** 1: - 0000 CS_BANK equ 0000000b 2: - 0001 CS_DIP equ 0000001b 3: - 0004 CS_CTC_0 equ 0000100b 4: - 0005 CS_CTC_1 equ 0000101b 5: - 0006 CS_CTC_2 equ 0000110b 6: - 0007 CS_CTC_3 equ 0000111b 7: - 0008 CS_SIO_A_D equ 0001000b 8: - 0009 CS_SIO_A_C equ 0001001b 9: - 000A CS_SIO_B_D equ 0001010b 10: - 000B CS_SIO_B_C equ 0001011b 11: 12: - 0020 IO_RTC_SEC0 equ 00100000b 13: - 0021 IO_RTC_SEC1 equ 00100001b 14: - 0022 IO_RTC_MIN0 equ 00100010b 15: - 0023 IO_RTC_MIN1 equ 00100011b 16: - 0024 IO_RTC_HOUR equ 00100100b 17: - 0025 IO_RTC_AMPM equ 00100101b 18: - 0026 IO_RTC_DAY0 equ 00100110b 19: - 0027 IO_RTC_DAY1 equ 00100111b 20: - 0028 IO_RTC_MON0 equ 00101000b 21: - 0029 IO_RTC_MON1 equ 00101001b 22: - 002A IO_RTC_YERR0 equ 00101010b 23: - 002B IO_RTC_YEAR1 equ 00101011b 24: - 002C IO_RTC_WEEK equ 00101100b 25: - 002D IO_RTC_CTR_D equ 00101101b 26: - 002E IO_RTC_CTR_E equ 00101110b 27: - 002F IO_RTC_CTR_F equ 00101111b 28: 29: - 0040 IO_AY0_ADDR equ 01000000b ;64 30: - 0041 IO_AY0_DATA equ 01000001b ;65 31: - 0042 IO_AY1_ADDR equ 01000010b ;66 32: - 0043 IO_AY1_DATA equ 01000011b ;67 33: 34: - 0000 START_ROM equ 0x0000 35: - 0020 IO_REG0 equ 0x20 36: 37: - 0081 VDP_REG equ 0x81 38: - 0080 VDP_MEM equ 0x80 39: 40: - 0100 PROG_ROM_START equ 0x0100 41: - 4000 PROG_MEM_START equ 04000h 42: 43: 44: - 00F5 CS_PIO_BD .EQU 0xF5 45: - 00F7 CS_PIO_BC .EQU 0xF7 46: - 00F4 CS_PIO_AD .EQU 0xF4 47: - 00F6 CS_PIO_AC .EQU 0xF6 **** main.asm **** 19: 20: - 0000 org 0x0000 21: - 0000 RST_00: ;Hardware Restart 22: 0+10 0000 C35000 jp mon_start_init_sound 23: 24: - 0008 org 0x0008 25: - 0008 RST_08 ;Print Char 26: 10+10 0008 C3C40E jp EXEC_RST_08 27: 28: - 0010 org 0x0010 29: - 0010 RST_10 ;receive char 30: 20+10 0010 C3C80E jp EXEC_RST_10 31: 32: - 0018 org 0x0018 33: - 0018 RST_18 ;Buffer length 34: 30+10 0018 C3D40E jp EXEC_RST_18 35: 36: 37: - 001B INT_VEC: 38: - 0044 org 0x0044 39: ;DEFW EXEC_INT_VDP 40: 41: ;memory var template 42: - 0044 mon_var_template: 43: - 4000 phase SYS_RAM_START 44: 45: - 4000 var_buffer_len: 46: - 4000 00 defb 0 47: - 4001 var_last_char: 48: - 4001 00 defb 0 49: - 4002 var_curserx: 50: - 4002 00 defb 0 51: - 4003 var_cursery: 52: - 4003 00 defb 0 53: - 4004 var_curserstate: 54: - 4004 00 defb 0 55: - 4005 var_curseron: 56: - 4005 00 defb 0 57: - 4006 var_curserchar: 58: - 4006 00 defb 0 59: - 4007 var_curserlastaddr: 60: - 4007 0000 defw 0 61: - 4009 var_scratch: 62: - 4009 ..4018 00 defs 16 ;16 bytes space for scratch vars 63: - 4019 var_ps2mem: 64: - 4019 ..4028 00 defs 16 ;16 bytes space for scratch vars 65: - 4029 var_buffer: 66: - 4029 00 defb 0 ;var lentgh 67: 68: - 402A mon_var_template_end: 69: - 006E dephase 70: ;end memory var template 71: - 0050 org 0x0050 72: - 0050 mon_start_init_sound: 73: ;CALL BTLDR_ENTRY ;call bootloader first 74: ;ld D,0x08 ; Select register #8 75: ;ld A,0x00 ; Volume channel A 0 76: ;call AY0_WRITE_REG 77: ;ld D,0x09 ; Select register #9 78: ;ld A,0x00 ; Volume channel B 0 79: ;call AY0_WRITE_REG 80: ;ld D,0x0A ; Select register #10 81: ;ld A,0x00 ; Volume channel C 0 82: ;call AY0_WRITE_REG 83: 84: - 0050 mon_start_init_ctc: 85: 40+10 0050 31FFFF ld sp, 0xffff 86: ; Set CTC Ch2 Interrupt Vector 87: ;LD A,40h ; it vector defined in bit 7­3,bit 2­1 don't care, bit 0 = 0 88: ;OUT (IO_CTC0_C0),A 89: ; Init CTC Channel 2 90: ;LD A,10100111b 91: ;OUT (IO_CTC0_C2),A 92: ;LD A,0x34 ; 55Hz ISR 93: ;LD A,0xFF ; 55Hz ISR 94: ;OUT (IO_CTC0_C2),A 95: 96: ;INIT PIO 97: 50+7 0053 3ECF LD A,0xCF 98: 57+11 0055 D3F6 OUT (CS_PIO_AC), A 99: 68+7 0057 3EF5 LD A,11110101b 100: 75+11 0059 D3F6 OUT (CS_PIO_AC), A 101: 102: 103: 86+4 005B AF xor a 104: ;ld i, a 105: ;im 2 ;set int mode 2 106: 107: 90+13 005C 320440 ld (var_curserstate),a 108: 103+13 005F 320540 ld (var_curseron),a 109: 116+7 0062 3E20 ld a, " " 110: 123+13 0064 320640 ld (var_curserchar),a 111: 112: 113: ;ei ; Enable Interrupts 114: 115: ;jr mon_start_ram ;skip serial, cause not used atm 116: - 0067 mon_start_init_serial: 117: 136+17 0067 CD7E02 call CONSOLE_INIT 118: - 006A mon_start_ram: 119: 153+10 006A 214400 ld hl,mon_var_template 120: 163+10 006D 112A40 ld de,mon_var_template_end 121: 173+10 0070 010040 ld bc,SYS_RAM_START 122: - 0073 mon_start_ram_loop: 123: 183+7 0073 7E ld a,(hl) ;copy values 124: 190+7 0074 02 ld (bc),a 125: 197+6 0075 23 inc hl 126: 203+6 0076 03 inc bc 127: 209+11 0077 E5 push hl ;check if end is reached 128: 220+15 0078 ED52 sbc hl,de 129: 235+10 007A E1 pop hl 130: 245+10 007B C27300 jp nz, mon_start_ram_loop 131: ;template copy done 132: 133: - 007E mon_start_complete: 134: 135: ;call keyboard_init_io 136: ;call vdpconsole_init 137: 138: ;call print_str 139: 140: 141: ;jp splash_run 142: 143: ;jp ps2demo_run 144: ;call debug_init 145: ;call vdp_cursor_on 146: ;jp COLD 147: 148: 255+17 007E CDCA02 call print_clear 149: 272+10 0081 21000F ld hl, [STR_Banner_Start] 150: 282+17 0084 CDBF02 call print_str 151: 152: ;halt 153: 154: 299+10 0087 114000 LD DE,0x40 155: 309+17 008A CDD70E CALL beep 156: 157: ;call vdp_cursor_on 158: 326+17 008D CD9900 call PROMPT_BEGIN 159: 160: ;halt CPU if prompt exits 161: 343+4 0090 76 halt 162: 163: ; Misc Functions 164: - 0091 AY0_WRITE_REG: 165: 347+4 0091 47 LD B,A 166: 351+4 0092 7A LD A,D 167: 355+11 0093 D340 OUT (IO_AY0_ADDR),A 168: 366+4 0095 78 LD A,B 169: 370+11 0096 D341 OUT (IO_AY0_DATA),A 170: 381+10 0098 C9 RET 171: 172: - 0099 PROMPT_BEGIN: 173: 391+17 0099 CDD102 call print_newLine 174: ;call A_RTS_ON 175: 408+7 009C 3E3E ld a,'>' 176: 415+17 009E CDB702 call print_char 177: 432+4 00A1 AF xor a ;reset buffer len 178: 436+13 00A2 320040 ld (var_buffer_len),a 179: 180: - 00A5 PROMPT_BEGIN_READ_LOOP: 181: 449+17 00A5 CDF802 call read_char 182: ;call keybd_read_ascii 183: 466+10 00A8 CAA500 jp z, PROMPT_BEGIN_READ_LOOP ; wait until char avail 184: 476+11 00AB F5 push af 185: 487+10 00AC F1 pop af 186: ; process special ops 187: 497+7 00AD FE0D cp 13 ; enter 188: 504+10 00AF CAFC00 jp z,PROMPT_BEGIN_READ_PROCESS 189: 514+7 00B2 FE0A cp 10 190: 521+10 00B4 CAA500 jp z, PROMPT_BEGIN_READ_LOOP; skip LF for file load 191: 531+7 00B7 FE08 cp 0x08 ; backspace 0x08 VT102 0x7f Putty 192: 538+10 00B9 CAD600 jp z,PROMPT_BEGIN_READ_BACKSPACE 193: 194: 548+11 00BC F5 push af 195: ; a contains latest char 196: 559+10 00BD 212940 ld hl,[var_buffer] 197: 569+7 00C0 1600 ld d,0 198: 576+13 00C2 3A0040 ld a,(var_buffer_len) 199: 589+4 00C5 5F ld e,a 200: 593+11 00C6 19 add hl,de ;hl now contains pointer to last position in buffer 201: 604+4 00C7 3C inc a 202: 608+13 00C8 320040 ld (var_buffer_len),a ;store incremented buffer length 203: 204: 621+10 00CB F1 pop af 205: 631+7 00CC 77 ld (hl),a 206: 638+17 00CD CDB702 call print_char 207: 655+6 00D0 23 inc hl 208: 661+4 00D1 AF xor a ;a = 0 209: 665+7 00D2 77 ld (hl),a ;always add null termination after last char 210: 672+10 00D3 C3A500 jp PROMPT_BEGIN_READ_LOOP 211: 212: - 00D6 PROMPT_BEGIN_READ_BACKSPACE: 213: 682+13 00D6 3A0040 ld a,(var_buffer_len) 214: 695+4 00D9 A7 and a 215: 699+10 00DA CAA500 jp z, PROMPT_BEGIN_READ_LOOP ; do not continue if already at char 0 216: 709+4 00DD 3D dec a ;decrement length 217: 713+13 00DE 320040 ld (var_buffer_len),a ;and store it 218: 726+4 00E1 5F ld e,a ;load de with decremented value 219: 730+7 00E2 1600 ld d,0 220: 737+10 00E4 212940 ld hl,[var_buffer] 221: 747+11 00E7 19 add hl,de ;hl now contains pointer to last position in buffer 222: 758+4 00E8 AF xor a ; store null byte to current location 223: 762+7 00E9 77 ld (hl),a 224: ;call print_delete 225: 769+7 00EA 3E08 ld a, 0x08 226: 776+17 00EC CDB702 call print_char 227: 793+7 00EF 3E20 ld a, 0x20 228: 800+17 00F1 CDB702 call print_char 229: 817+7 00F4 3E08 ld a, 0x08 230: 824+17 00F6 CDB702 call print_char 231: 841+10 00F9 C3A500 jp PROMPT_BEGIN_READ_LOOP 232: 233: - 00FC PROMPT_BEGIN_READ_PROCESS: 234: ;call print_newLine 235: ;ld hl,var_buffer 236: ;call print_str 237: 238: 851+13 00FC 3A2940 ld a,([var_buffer]) 239: 864+7 00FF FE24 cp '$' ;jump to addr 240: 871+10 0101 CA2F01 jp z, CMD_EXEC 241: 881+7 0104 FE3F cp '?' ;print hexdump 242: 888+10 0106 CA4E01 jp z, CMD_VIEW 243: 898+7 0109 FE21 cp '!' ;set memory 244: 905+10 010B CAB801 jp z, CMD_SET 245: 915+7 010E FE69 cp 'i' ;in IO 246: 922+10 0110 CA1D02 jp z, CMD_IO_READ 247: 932+7 0113 FE6F cp 'o' ;out IO 248: 939+10 0115 CAF401 jp z, CMD_IO_WRITE 249: 949+7 0118 FE64 cp 'd' ;disassemble 250: 956+10 011A CA3902 jp z, CMD_DASM 251: 966+7 011D FE78 cp 'x' ;start xmodem 252: 973+10 011F CA4C0F jp z, xmodem_init 253: 254: 255: 983+17 0122 CDD102 call print_newLine 256: 1000+10 0125 212B0F ld hl, [STR_Unknown] 257: 1010+17 0128 CDBF02 call print_str 258: 1027+10 012B C39900 jp PROMPT_BEGIN 259: 260: 1037+10 012E C9 ret 261: 262: - 012F CMD_EXEC: 263: 1047+4 012F AF xor a ;write null byte to buffer pos 0 to prevent reexecute the last command 264: 1051+13 0130 322940 ld (var_buffer),a 265: 266: 1064+10 0133 212A40 ld hl,var_buffer+1 ;load 1st byte 267: 1074+17 0136 CD2403 call DHEX_TO_BYTE 268: 1091+4 0139 47 ld b,a ;store result in b 269: 1095+4 013A 7B ld a,e ;check for error 270: 1099+4 013B A7 and a 271: 1103+10 013C C27202 jp nz, CMD_SYNTAX_ERROR 272: 273: 1113+10 013F 212C40 ld hl,var_buffer+3 ;load 2nd byte 274: 1123+17 0142 CD2403 call DHEX_TO_BYTE 275: 1140+4 0145 4F ld c,a 276: 1144+4 0146 7B ld a,e ;check for error 277: 1148+4 0147 A7 and a 278: 1152+10 0148 C27202 jp nz, CMD_SYNTAX_ERROR 279: 280: 1162+4 014B 60 ld h,b 281: 1166+4 014C 69 ld l,c 282: 1170+4 014D E9 jp (hl) 283: 284: - 014E CMD_VIEW: 285: 1174+17 014E CDD102 call print_newLine 286: 1191+10 0151 212A40 ld hl,var_buffer+1 ;load 1st byte 287: 1201+17 0154 CD2403 call DHEX_TO_BYTE 288: 1218+4 0157 47 ld b,a ;store result in b 289: 1222+4 0158 7B ld a,e ;check for error 290: 1226+4 0159 A7 and a 291: 1230+10 015A C27202 jp nz, CMD_SYNTAX_ERROR 292: 293: 1240+10 015D 212C40 ld hl,var_buffer+3 ;load 2nd byte 294: 1250+17 0160 CD2403 call DHEX_TO_BYTE 295: 1267+4 0163 4F ld c,a 296: 1271+4 0164 7B ld a,e ;check for error 297: 1275+4 0165 A7 and a 298: 1279+10 0166 C27202 jp nz, CMD_SYNTAX_ERROR 299: 300: 301: 1289+13 0169 3A2E40 ld a,(var_buffer+5) 302: 1302+7 016C FE20 cp ' ' 303: 1309+10 016E C27202 jp nz, CMD_SYNTAX_ERROR 304: 305: 1319+10 0171 212F40 ld hl,var_buffer+6 ;load length 306: 1329+17 0174 CD2403 call DHEX_TO_BYTE 307: 1346+11 0177 F5 push af 308: 1357+4 0178 7B ld a,e ;check for error 309: 1361+4 0179 A7 and a 310: 1365+10 017A C27202 jp nz, CMD_SYNTAX_ERROR 311: 312: ;draw header 313: 1375+10 017D 21300F ld hl,[STR_HEXDUMP_HEADER] 314: 1385+17 0180 CDBF02 call print_str 315: 316: 1402+10 0183 F1 pop af 317: ;loading vars done. display results 318: 1412+4 0184 60 ld h, b ;pointer to current byte 319: 1416+4 0185 69 ld l, c ;pointer to current byte 320: 1420+4 0186 47 ld b, a ;bytes counter 321: 322: ;draw row 323: - 0187 CMD_VIEW_ROW: 324: 1424+17 0187 CDD102 call print_newLine 325: 1441+4 018A 7C ld a,h ;print start 326: 1445+17 018B CDE702 call print_a_hex 327: 1462+4 018E 7D ld a,l 328: 1466+17 018F CDE702 call print_a_hex 329: 1483+7 0192 3E20 ld a, ' ' 330: 1490+17 0194 CDB702 call print_char 331: 1507+7 0197 0E08 ld c, 8 ;column counter 332: - 0199 CMD_VIEW_ROW_LOOP: 333: 1514+7 0199 7E ld a,(hl) 334: 1521+17 019A CDE702 call print_a_hex 335: 336: 1538+6 019D 23 inc hl ;increment pointer 337: 1544+4 019E 05 dec b ;decrement byte counter 338: 1548+4 019F 0D dec c ;decrement column counter 339: 340: 1552+4 01A0 78 ld a,b 341: 1556+4 01A1 A7 and a 342: 1560+10 01A2 CAB201 jp z,CMD_VIEW_END ;if byte counter = 0 -> end reached 343: 344: 1570+4 01A5 79 ld a,c 345: 1574+4 01A6 A7 and a 346: 1578+10 01A7 CA8701 jp z,CMD_VIEW_ROW ;else if column counter = 0 -> 16 chars printed. next row 347: 348: 1588+7 01AA 3E20 ld a, ' ' 349: 1595+17 01AC CDB702 call print_char 350: 1612+10 01AF C39901 jp CMD_VIEW_ROW_LOOP ;else 351: - 01B2 CMD_VIEW_END: 352: 1622+17 01B2 CDD102 call print_newLine 353: 1639+10 01B5 C39900 jp PROMPT_BEGIN 354: 355: - 01B8 CMD_SET: 356: 1649+10 01B8 212A40 ld hl,var_buffer+1 ;load 1st byte 357: 1659+17 01BB CD2403 call DHEX_TO_BYTE 358: 1676+4 01BE 47 ld b,a ;store result in b 359: 1680+4 01BF 7B ld a,e ;check for error 360: 1684+4 01C0 A7 and a 361: 1688+10 01C1 C27202 jp nz, CMD_SYNTAX_ERROR 362: 363: 1698+10 01C4 212C40 ld hl,var_buffer+3 ;load 2nd byte 364: 1708+17 01C7 CD2403 call DHEX_TO_BYTE 365: 1725+4 01CA 4F ld c,a 366: 1729+4 01CB 7B ld a,e ;check for error 367: 1733+4 01CC A7 and a 368: 1737+10 01CD C27202 jp nz, CMD_SYNTAX_ERROR 369: ;bc now contains the start address 370: 371: 1747+10 01D0 212E40 ld hl,var_buffer+5 372: - 01D3 CMD_SET_LOOP: 373: 1757+7 01D3 7E ld a,(hl) 374: 1764+7 01D4 FE00 cp 0 ;if 0 then end 375: 1771+10 01D6 CAEE01 jp z, CMD_SET_END 376: 1781+7 01D9 FE20 cp ' ' 377: 1788+10 01DB C27202 jp nz, CMD_SYNTAX_ERROR 378: 1798+6 01DE 23 inc hl ;next byte 379: 1804+17 01DF CD2403 call DHEX_TO_BYTE 380: 1821+7 01E2 02 ld (bc),a ;load byte to 381: 1828+4 01E3 7B ld a,e 382: 1832+4 01E4 A7 and a 383: 1836+10 01E5 C27202 jp nz, CMD_SYNTAX_ERROR 384: 1846+6 01E8 03 inc bc 385: 1852+6 01E9 23 inc hl 386: 1858+6 01EA 23 inc hl 387: 1864+10 01EB C3D301 jp CMD_SET_LOOP 388: - 01EE CMD_SET_END: 389: 1874+17 01EE CDD102 call print_newLine 390: 1891+10 01F1 C39900 jp PROMPT_BEGIN 391: 392: 393: - 01F4 CMD_IO_WRITE: 394: 1901+10 01F4 212A40 ld hl,var_buffer+1 ;load 1st byte 395: 1911+17 01F7 CD2403 call DHEX_TO_BYTE 396: 1928+4 01FA 4F ld c,a ;store result in b 397: 1932+4 01FB 7B ld a,e ;check for error 398: 1936+4 01FC A7 and a 399: 1940+10 01FD C27202 jp nz, CMD_SYNTAX_ERROR 400: 401: 1950+13 0200 3A2C40 ld a,(var_buffer+3) 402: 1963+7 0203 FE20 cp ' ' 403: 1970+10 0205 C27202 jp nz, CMD_SYNTAX_ERROR 404: 405: 1980+10 0208 212D40 ld hl,var_buffer+4 ;load 1st byte 406: 1990+17 020B CD2403 call DHEX_TO_BYTE 407: 2007+11 020E F5 push af 408: 2018+4 020F 7B ld a,e ;check for error 409: 2022+4 0210 A7 and a 410: 2026+10 0211 C27202 jp nz, CMD_SYNTAX_ERROR 411: 412: 2036+10 0214 F1 pop af 413: 2046+12 0215 ED79 out (c),a 414: 2058+17 0217 CDD102 call print_newLine 415: 2075+10 021A C39900 jp PROMPT_BEGIN 416: 417: - 021D CMD_IO_READ: 418: 2085+10 021D 212A40 ld hl,var_buffer+1 ;load 1st byte 419: 2095+17 0220 CD2403 call DHEX_TO_BYTE 420: 2112+4 0223 4F ld c,a ;store result in b 421: 2116+4 0224 7B ld a,e ;check for error 422: 2120+4 0225 A7 and a 423: 2124+10 0226 C27202 jp nz, CMD_SYNTAX_ERROR 424: 425: 2134+12 0229 ED78 in a,(c) 426: 2146+11 022B F5 push af 427: 2157+17 022C CDD102 call print_newLine 428: 2174+10 022F F1 pop af 429: 2184+17 0230 CDE702 call print_a_hex 430: 2201+17 0233 CDD102 call print_newLine 431: 2218+10 0236 C39900 jp PROMPT_BEGIN 432: 433: - 0239 CMD_DASM: 434: 2228+17 0239 CDD102 call print_newLine 435: 2245+10 023C 212A40 ld hl,var_buffer+1 ;load 1st byte 436: 2255+17 023F CD2403 call DHEX_TO_BYTE 437: 2272+4 0242 47 ld b,a ;store result in b 438: 2276+4 0243 7B ld a,e ;check for error 439: 2280+4 0244 A7 and a 440: 2284+10 0245 C27202 jp nz, CMD_SYNTAX_ERROR 441: 442: 2294+10 0248 212C40 ld hl,var_buffer+3 ;load 2nd byte 443: 2304+17 024B CD2403 call DHEX_TO_BYTE 444: 2321+4 024E 4F ld c,a 445: 2325+4 024F 7B ld a,e ;check for error 446: 2329+4 0250 A7 and a 447: 2333+10 0251 C27202 jp nz, CMD_SYNTAX_ERROR 448: 449: 450: 2343+13 0254 3A2E40 ld a,(var_buffer+5) 451: 2356+7 0257 FE20 cp ' ' 452: 2363+10 0259 C27202 jp nz, CMD_SYNTAX_ERROR 453: 454: 2373+10 025C 212F40 ld hl,var_buffer+6 ;load length 455: 2383+17 025F CD2403 call DHEX_TO_BYTE 456: 2400+11 0262 F5 push af 457: 2411+4 0263 7B ld a,e ;check for error 458: 2415+4 0264 A7 and a 459: 2419+10 0265 C27202 jp nz, CMD_SYNTAX_ERROR 460: 461: 2429+4 0268 60 ld h,b 462: 2433+4 0269 69 ld l,c 463: 464: 2437+10 026A F1 pop af ;restore af 465: 2447+4 026B 47 ld b,a 466: 467: 2451+17 026C CD7503 call disassemble 468: 469: 470: 2468+10 026F C39900 jp PROMPT_BEGIN 471: 472: - 0272 CMD_SYNTAX_ERROR: 473: 2478+17 0272 CDD102 call print_newLine 474: 2495+10 0275 21260F ld hl, [STR_SyntaxError] 475: 2505+17 0278 CDBF02 call print_str 476: 2522+10 027B C39900 jp PROMPT_BEGIN 477: 478: 479: 480: - 027E Includes: 481: ;.include "bootldr.s" 482: .include "console.s" **** include/console.s **** 1: ;DIP SWICTHES 2: ;1843200 CLK / x16 SIO CLOCK MODE = 115200 3: ;MAX BAUD RATE = 115200 4: ;DIP VALUE = 115200/ 5: ; 6: ;9600 -> 12 / 00110000 7: ; 8: 9: - 027E CONSOLE_INIT: 10: - 027E CONSOLE_INIT_CTC: 11: ;LD A,00001111b ; Set /16 Divider, CPU Trigger, Time COnstant Follows 12: 2532+7 027E 3E4F LD A,01001111b ; External Trigger, Time COnstant Follows 13: 2539+11 0280 D304 OUT (CS_CTC_0),A 14: 2550+11 0282 DB01 IN A,(CS_DIP) ; Read BAUD from DIP-Switches 15: ;LD A,39 16: 2561+11 0284 D304 OUT (CS_CTC_0),A 17: - 0286 CONSOLE_INIT_SIO: 18: 2572+7 0286 3E30 LD A,00110000b ;write into WR0: error reset, select WR0 19: 2579+11 0288 D309 OUT (CS_SIO_A_C),A 20: 2590+7 028A 3E18 LD a,018h ;write into WR0: channel reset 21: 2597+11 028C D309 OUT (CS_SIO_A_C),A 22: 2608+7 028E 3E04 LD a,004h ;write into WR0: select WR4 23: 2615+11 0290 D309 OUT (CS_SIO_A_C),A 24: 2626+7 0292 3E44 LD a,01000100b ;write into WR4: clkx16,1 stop bit, no parity 25: 2633+11 0294 D309 OUT (CS_SIO_A_C),A 26: 2644+7 0296 3E05 LD a,005h ;write into WR0: select WR5 27: 2651+11 0298 D309 OUT (CS_SIO_A_C),A 28: 2662+7 029A 3EE8 LD a,11101000b ;DTR inactive, TX 8bit, BREAK off, TX on, RTS inactive 29: 2669+11 029C D309 OUT (CS_SIO_A_C),A 30: 2680+7 029E 3E01 LD a,01h ;write into WR0: select WR1 31: 2687+11 02A0 D309 OUT (CS_SIO_A_C),A 32: 2698+7 02A2 3E04 LD a,00000100b ;no interrupt in CH B, special RX condition affects vect 33: 2705+11 02A4 D309 OUT (CS_SIO_A_C),A 34: 2716+7 02A6 3E02 LD a,02h ;write into WR0: select WR2 35: 2723+11 02A8 D309 OUT (CS_SIO_A_C),A 36: 2734+7 02AA 3E00 LD a,0h ;write into WR2: cmd line int vect (see int vec table) 37: ;bits D3,D2,D1 are changed according to RX condition 38: 2741+11 02AC D309 OUT (CS_SIO_A_C),A 39: 2752+7 02AE 3E03 LD a,003h ;write into WR0: select WR3 40: 2759+11 02B0 D309 OUT (CS_SIO_A_C),A 41: 2770+7 02B2 3EC1 LD a,0C1h ;RX 8bit, auto enable off, RX on 42: 2777+11 02B4 D309 OUT (CS_SIO_A_C),A 43: ;Channel A RX active 44: 2788+10 02B6 C9 RET 45: 46: ; A contains char 47: ; Destroys A 48: - 02B7 print_char: 49: 2798+11 02B7 F5 push af 50: 2809+11 02B8 D308 out (CS_SIO_A_D),a 51: 2820+17 02BA CDDC02 call print_wait_out 52: 2837+10 02BD F1 pop af 53: ;call print_char 54: 2847+10 02BE C9 ret 55: ; HL contains pointer to string 56: ; Destroy A, HL 57: 58: - 02BF print_str: 59: 2857+7 02BF 7E ld a, (hl) 60: 2864+4 02C0 B7 or a 61: 2868+7+5 02C1 2806 jr z,print_str_end 62: 2875+17 02C3 CDB702 call print_char 63: 2892+6 02C6 23 inc hl 64: 2898+12 02C7 18F6 jr print_str 65: - 02C9 print_str_end: 66: 2910+10 02C9 C9 ret 67: 68: - 02CA print_clear: 69: 2920+10 02CA 210A03 ld hl, [MSG_CLEAR] 70: 2930+17 02CD CDBF02 call print_str 71: 2947+10 02D0 C9 ret 72: 73: - 02D1 print_newLine: 74: 2957+7 02D1 3E0A ld a,10 75: 2964+17 02D3 CDB702 call print_char 76: 2981+7 02D6 3E0D ld a,13 77: 2988+17 02D8 CDB702 call print_char 78: 3005+10 02DB C9 ret 79: ; destroys a 80: - 02DC print_wait_out: 81: ; check for TX buffer empty 82: 3015+4 02DC 97 sub a ;clear a, write into WR0: select RR0 83: 3019+4 02DD 3C inc a ;select RR1 84: 3023+11 02DE D309 out (CS_SIO_A_C),A 85: 3034+11 02E0 DB09 in A,(CS_SIO_A_C) ;read RRx 86: 3045+8 02E2 CB47 bit 0,A 87: 3053+7+5 02E4 28F6 jr z,print_wait_out 88: 3060+10 02E6 C9 ret 89: 90: - 02E7 print_a_hex: 91: 3070+11 02E7 F5 push af 92: 3081+11 02E8 C5 push bc 93: 3092+11 02E9 D5 push de 94: 3103+17 02EA CD5B03 call STRCONV_BYTES_TO_HEX 95: 3120+4 02ED 78 ld a,b 96: 3124+17 02EE CDB702 call print_char 97: 3141+4 02F1 79 ld a,c 98: 3145+17 02F2 CDB702 call print_char 99: 3162+10 02F5 D1 pop de 100: 3172+10 02F6 C1 pop bc 101: 3182+10 02F7 F1 pop af 102: 103: - 02F8 read_char: 104: 3192+17 02F8 CD1B03 call A_RTS_ON 105: 3209+4 02FB 00 nop 106: 3213+4 02FC AF xor a ; a = 0 107: 3217+11 02FD D309 out (CS_SIO_A_C), a ; select reg 0 108: 3228+11 02FF DB09 in a, (CS_SIO_A_C) ; read reg 0 109: 3239+7 0301 E601 and 1 ; mask D0 (recieve char available) 110: 3246+17 0303 CD1203 call A_RTS_OFF 111: 3263+5+6 0306 C8 ret Z ; return 0 if no char 112: 3268+11 0307 DB08 in a, (CS_SIO_A_D) ; read char if avail 113: 3279+10 0309 C9 ret ; return 114: 115: ;MSG_CRSR_0: 116: ; db 0x1B, "[?25h",0 117: ;MSG_CRSR_1: 118: ; db 0x1B, "[?25l",0 119: - 030A MSG_CLEAR: 120: - 030A 1B5B324A db 27, '[2J', 27, '[H',0 1B5B4800 121: 122: 123: 124: ; Serial Util Functions 125: - 0312 A_RTS_OFF: 126: 3289+7 0312 3E05 ld a,005h ;write into WR0: select WR5 127: 3296+11 0314 D309 out (CS_SIO_A_C),A 128: 3307+7 0316 3E68 ld a,068h ;DTR inactiveh, TX 8bit, BREAK off, TX on, RTS inactive 129: 3314+11 0318 D309 out (CS_SIO_A_C),A 130: 3325+10 031A C9 ret 131: - 031B A_RTS_ON: 132: 3335+7 031B 3E05 ld a,005h ;write into WR0: select WR5 133: 3342+11 031D D309 out (CS_SIO_A_C),A 134: 3353+7 031F 3EEA ld a,0EAh ;DTR active, TX 8bit, BREAK off, TX on, RTS active 135: 3360+11 0321 D309 out (CS_SIO_A_C),A **** main.asm **** 483: 3371+10 0323 C9 ret 484: .include "conversions.s" **** include/conversions.s **** 1: ; HL Contains Address to string 2: ; E is 0xFF if error 3: ; E is 0x00 if okay 4: ; A returns byte 5: ; A,DE are destroyed 6: - 0324 DHEX_TO_BYTE: 7: 3381+11 0324 E5 PUSH HL ;Backup pointer 8: ; Load First Byte 9: 3392+7 0325 7E LD A,(HL) ;Load first char (high) 10: 3399+17 0326 CD4403 CALL HEX_TO_BIN ;Conv chart to 4bit 11: 3416+7+5 0329 3815 jr C, DHEX_TO_BYTE_FAILED ;If error jmp to DHEX_TO_BYTE_FAILED 12: 3423+8 032B CB27 SLA A ;shift result to upper 4 bits 13: 3431+8 032D CB27 SLA A 14: 3439+8 032F CB27 SLA A 15: 3447+8 0331 CB27 SLA A 16: 3455+4 0333 57 LD D,A ;store result in D 17: 18: 3459+6 0334 23 INC HL ;next byte 19: 3465+7 0335 7E LD A,(HL) ;load 2nd char (lower) 20: 3472+17 0336 CD4403 CALL HEX_TO_BIN ;Conv chart to 4bit 21: 3489+7+5 0339 3805 jr C, DHEX_TO_BYTE_FAILED ;If error jmp to DHEX_TO_BYTE_FAILED 22: 3496+4 033B B2 OR D ;merge D with accumulator 23: 24: 3500+10 033C E1 POP HL ;restor original pointer 25: 3510+7 033D 1E00 LD E,0x00 ;set error to 0x00 = no error 26: 3517+10 033F C9 RET 27: - 0340 DHEX_TO_BYTE_FAILED: 28: 3527+7 0340 1EFF LD E,0xFF ;set error to oxFF 29: ;LD A,0x00 30: 3534+10 0342 E1 POP HL 31: 3544+10 0343 C9 RET 32: 33: ; REG A Contains CHAR-Low 34: ; If failed, Carry is set 35: - 0344 HEX_TO_BIN: 36: 3554+7 0344 D630 SUB 48 ; 0 is 0 37: 3561+10 0346 EA5903 jp PE, HEX_TO_INVALID_2; to low (SUB overflow) 38: 3571+7 0349 FE0A CP 10 ; Value is between 0 and 9 39: 3578+7+5 034B 3805 JR C, HEX_TO_BIN_2 40: 3585+7 034D D607 SUB 7 41: 3592+10 034F EA5903 jp PE, HEX_TO_INVALID_2; to low (SUB overflow) 42: - 0352 HEX_TO_BIN_2: 43: 3602+7 0352 FE10 CP 16 44: 3609+7+5 0354 3003 JR NC, HEX_TO_INVALID_2; if bigger than 15-> fail 45: 3616+7 0356 E60F AND 0x0F 46: 3623+10 0358 C9 RET 47: - 0359 HEX_TO_INVALID_2: 48: 3633+4 0359 37 SCF ;set carry flag 49: 3637+10 035A C9 RET 50: 51: 52: ;***************** 53: ; Convert Byte to Hex Char (ASCII) 54: ;***************** 55: ;Description: the StrLength function inline 56: ; 57: ;Inputs: A contains input byte 58: ; 59: ;Outputs: BC contains 2 Bytes of ASCII (HEX) 60: ; 61: ;Destroys: A, BC, 62: - 035B STRCONV_BYTES_TO_HEX: 63: 3647+11 035B F5 PUSH AF;Backup A Register 64: 3658+4 035C 1F RRA 65: 3662+4 035D 1F RRA 66: 3666+4 035E 1F RRA 67: 3670+4 035F 1F RRA 68: 3674+17 0360 CD6A03 CALL STRCONV_BYTES_TO_HEX_1 69: ;LD A,D 70: 3691+4 0363 47 LD B,A 71: 3695+10 0364 F1 POP AF ; Reload first Byte 72: 3705+17 0365 CD6A03 CALL STRCONV_BYTES_TO_HEX_1 73: ;LD A,D 74: 3722+4 0368 4F LD C,A 75: 3726+10 0369 C9 RET 76: 77: - 036A STRCONV_BYTES_TO_HEX_1: 78: 3736+7 036A E60F AND 0x0F 79: 3743+7 036C C630 ADD 48 80: 3750+7 036E FE3A CP 58 ; Check if less than 58 (less than ASCII 9) 81: ;JR C, STRCONV_BYTES_TO_HEX_2 82: 3757+5+6 0370 D8 RET C 83: 3762+7 0371 C607 ADD 7 ; A-F 84: 3769+10 0373 C9 RET 85: - 0374 STRCONV_BYTES_TO_HEX_2: 86: ;LD D,A 87: 3779+10 0374 C9 RET 88: 89: **** main.asm **** 485: ;.include "basic.s" 486: .include "disassembler.s" **** include/disassembler.s **** 1: - 4110 var_opcode_start equ PRG_RAM_START ;16 bit pointer to opcode in mem 2: - 4112 var_opcode_table equ PRG_RAM_START+2 ;16 bit pointer to opcode in table 3: - 4114 var_opcode equ PRG_RAM_START+4 ;8 bit opcode value 4: - 4115 var_opcode_x equ PRG_RAM_START+5 ;8 bit opcode extension value 5: - 4116 var_opcode_length equ PRG_RAM_START+6 ;8 bit opcode length (in bytes) 6: - 4117 var_opcode_string equ PRG_RAM_START+7 ;16 bit pointer to opcode string 7: - 4119 var_opcode_pcount equ PRG_RAM_START+9 ;8 bit opcode param count 8: - 411A var_bytes_count equ PRG_RAM_START+10 ;bytes to examine 9: ; HL contains start address 10: ; B contains length 11: - 0375 disassemble: 12: 3789+4 0375 78 ld a,b 13: 3793+13 0376 321A41 ld (var_bytes_count),a 14: - 0379 disassemble_next: 15: 16: 17: 3806+16 0379 221041 ld (var_opcode_start), hl ;16 bit pointer to opcode in mem 18: 3822+7 037C 7E ld a,(hl) ;load opcode to find in A 19: 3829+13 037D 321441 ld (var_opcode), a ;8 bit opcode value 20: 3842+6 0380 23 inc hl 21: 3848+7 0381 7E ld a,(hl) ;load opcode to find in A 22: 3855+13 0382 321541 ld (var_opcode_x), a ;8 bit opcode extended value 23: 3868+6 0385 2B dec hl 24: 3874+17 0386 CD6904 call disassemble_table_seek 25: 3891+4 0389 78 ld a,b 26: 3895+4 038A B1 or c 27: 3899+10 038B CA4B04 jp z, disassemble_err ;if bc==0000h 28: 29: 3909+20 038E ED431241 ld (var_opcode_table), bc ;16 bit pointer to opcode in table 30: 31: ;load params 32: 3929+6 0392 03 inc bc 33: 3935+6 0393 03 inc bc 34: 3941+6 0394 03 inc bc 35: 3947+6 0395 03 inc bc 36: 3953+7 0396 0A ld a,(bc) 37: 3960+13 0397 321641 ld (var_opcode_length),A ;8 bit opcode length (in bytes) 38: 3973+6 039A 03 inc bc 39: 3979+7 039B 0A ld a, (bc) 40: 3986+4 039C 5F ld e,a 41: 3990+6 039D 03 inc bc 42: 3996+7 039E 0A ld a, (bc) 43: 4003+4 039F 57 ld d,a 44: 4007+20 03A0 ED531741 ld (var_opcode_string),de ;16 bit pointer to opcode string 45: 4027+6 03A4 03 inc bc 46: 4033+7 03A5 0A ld a,(bc) 47: 4040+13 03A6 321941 ld (var_opcode_pcount),A ;8 bit opcode param count 48: 49: ;values are prepared. Continue with print 50: 51: 4053+16 03A9 2A1041 ld hl,(var_opcode_start) ;print address 52: 4069+17 03AC CDB104 call dasm_print16hex_addr 53: 54: 4086+13 03AF 3A1641 ld a,(var_opcode_length) 55: 4099+4 03B2 47 ld b, a 56: 57: ;print up to 4 opcode bytes 58: 4103+16 03B3 2A1041 ld hl,(var_opcode_start) 59: 60: - 03B6 disassemble_print_opcode_raw 61: 4119+7 03B6 7E ld a,(hl) ;load first byte 62: 4126+17 03B7 CDE702 call print_a_hex 63: 4143+6 03BA 23 inc hl 64: 4149+8+5 03BB 10F9 djnz disassemble_print_opcode_raw 65: 66: 4157+7 03BD 3E68 ld a,"h" 67: 4164+17 03BF CDB702 call print_char 68: ;fill empty spots 69: 4181+13 03C2 3A1641 ld a,(var_opcode_length) 70: 4194+4 03C5 47 ld b,a 71: 4198+7 03C6 3E06 ld a,6 72: 4205+4 03C8 90 sub b 73: 4209+4 03C9 47 ld b,a 74: 75: - 03CA disassemble_print_opcode_raw_fill: 76: 4213+7 03CA 3E20 ld a," " 77: 4220+17 03CC CDB702 call print_char 78: 4237+7 03CF 3E20 ld a," " 79: 4244+17 03D1 CDB702 call print_char 80: 4261+8+5 03D4 10F4 djnz disassemble_print_opcode_raw_fill 81: 4269+7 03D6 3E20 ld a," " 82: 4276+17 03D8 CDB702 call print_char 83: 84: 4293+11 03DB E5 push hl 85: ;print opcode 86: 4304+16 03DC 2A1741 ld hl,(var_opcode_string) 87: 4320+17 03DF CDBF02 call print_str 88: 89: 90: ;print params 91: 4337+13 03E2 3A1941 ld a,(var_opcode_pcount) 92: 4350+4 03E5 B7 or a 93: 4354+10 03E6 CA4804 jp z, disassemble_print_opcode_params_end ;skip if no params 94: 95: 4364+16 03E9 2A1241 ld hl,(var_opcode_table) 96: 4380+10 03EC 010800 ld bc, 8 97: 4390+11 03EF 09 add hl,bc ;hl now has address of first param 98: 4401+13 03F0 3A1941 ld a,(var_opcode_pcount) 99: 4414+4 03F3 47 ld b,a 100: - 03F4 disassemble_print_opcode_params_loop: 101: ;ld a,(hl) ;load param 102: ;call print_a_hex 103: 4418+7 03F4 7E ld a,(hl) ;load param 104: 105: 4425+7 03F5 FE01 cp 0x01 106: 4432+10+7 03F7 CCD704 call z, param_01 107: 4442+7 03FA FE02 cp 0x02 108: 4449+10+7 03FC CCFE04 call z, param_02 109: 4459+7 03FF FE03 cp 0x03 110: 4466+10+7 0401 CC1B05 call z, param_03 111: 4476+7 0404 FE04 cp 0x04 112: 4483+10+7 0406 CC5705 call z, param_04 113: 4493+7 0409 FE05 cp 0x05 114: 4500+10+7 040B CC6D05 call z, param_05 115: 4510+7 040E FE06 cp 0x06 116: 4517+10+7 0410 CC7A05 call z, param_06 117: 4527+7 0413 FE07 cp 0x07 118: 4534+10+7 0415 CC9405 call z, param_07 119: 4544+7 0418 FE08 cp 0x08 120: 4551+10+7 041A CCA105 call z, param_08 121: 4561+7 041D FE09 cp 0x09 122: 4568+10+7 041F CCB605 call z, param_09 123: 4578+7 0422 FE10 cp 0x10 124: 4585+10+7 0424 CCCB05 call z, param_10 125: 4595+7 0427 FE11 cp 0x11 126: 4602+10+7 0429 CCDB05 call z, param_11 127: 4612+7 042C FE12 cp 0x12 128: 4619+10+7 042E CCE305 call z, param_12 129: 4629+7 0431 FE13 cp 0x13 130: 4636+10+7 0433 CC1B06 call z, param_13 131: 4646+7 0436 FE0A cp 0x0A 132: 4653+10+7 0438 CCAD05 call z, param_0A 133: ;strings 134: 4663+7 043B FE80 cp 0x80 135: 4670+10+7 043D CC3A06 call z, param_80 136: 4680+7 0440 FE81 cp 0x81 137: 4687+10+7 0442 CC3106 call z, param_81 138: 4697+6 0445 23 inc hl 139: 4703+8+5 0446 10AC djnz disassemble_print_opcode_params_loop 140: - 0448 disassemble_print_opcode_params_end: 141: 4711+10 0448 E1 pop hl 142: 4721+12 0449 1810 jr disassemble_continue 143: 144: 145: - 044B disassemble_err: 146: 4733+17 044B CDB104 call dasm_print16hex_addr 147: 4750+7 044E 7E ld a,(hl) 148: 4757+17 044F CDC904 call dasm_print8hex ;print value 149: 4774+6 0452 23 inc hl 150: 4780+11 0453 E5 push hl 151: 4791+10 0454 21860E ld hl, [dasm_UU] 152: 4801+17 0457 CDBF02 call print_str 153: 4818+10 045A E1 pop hl 154: 155: - 045B disassemble_continue: 156: 157: 4828+17 045B CDD102 call print_newLine 158: ;inc hl 159: 4845+13 045E 3A1A41 ld a,(var_bytes_count) 160: 4858+4 0461 3D dec a 161: 4862+13 0462 321A41 ld (var_bytes_count),a 162: 4875+10 0465 C27903 jp nz, disassemble_next 163: 4885+10 0468 C9 ret 164: 165: 166: 167: ;A contains opcode 168: ;BC contains returned position 169: - 0469 disassemble_table_seek: 170: 4895+11 0469 E5 push hl 171: 4906+10 046A 218406 ld hl, [dasm_opcode_table] 172: - 046D disassemble_table_seek_loop: 173: 4916+13 046D 3A1441 ld a,(var_opcode) 174: 4929+4 0470 4F ld c,a 175: 4933+7 0471 7E ld a,(hl) 176: 4940+7 0472 FEFF cp 0xFF ; if null 177: 4947+10 0474 CAAB04 jp z, disassemble_table_notfound 178: 179: ;apply mask 180: 4957+11 0477 F5 push af 181: 4968+6 0478 23 inc hl 182: 4974+7 0479 46 ld b,(hl) ;load mask 183: 4981+6 047A 2B dec hl 184: 4987+4 047B 79 ld a,c 185: 4991+4 047C A0 and b ;apply mask 186: 4995+4 047D 4F ld c,a 187: 4999+10 047E F1 pop af 188: 189: 5009+4 047F B9 cp c ; if match 190: 5013+7+5 0480 280B jr z, disassemble_table_first_match 191: 5020+7 0482 0600 ld b,0 192: 5027+7 0484 0E07 ld c,7 193: 5034+11 0486 09 add hl,bc 194: 5045+7 0487 7E ld a,(hl) 195: 5052+4 0488 4F ld c,a 196: 5056+11 0489 09 add hl,bc 197: 5067+6 048A 23 inc hl 198: 5073+12 048B 18E0 jr disassemble_table_seek_loop 199: 200: - 048D disassemble_table_first_match 201: 5085+6 048D 23 inc hl 202: 5091+6 048E 23 inc hl 203: 5097+7 048F 4E ld c,(hl) ;load opcode x from table 204: 5104+6 0490 23 inc hl 205: 5110+13 0491 3A1541 ld a,(var_opcode_x) ;load current opcode x 206: 5123+7 0494 46 ld b,(hl) ;load mask 207: 5130+4 0495 A0 and b ;apply mask 208: 5134+4 0496 B9 cp c ;compare to table 209: 5138+6 0497 2B dec hl 210: 5144+6 0498 2B dec hl 211: 5150+6 0499 2B dec hl 212: 5156+7+5 049A 280B jr z, disassemble_table_found ;IF FOUND 213: 5163+7 049C 0600 ld b,0 ;else continue with next 214: 215: 5170+7 049E 0E07 ld c,7 216: 5177+11 04A0 09 add hl,bc 217: 5188+7 04A1 7E ld a,(hl) 218: 5195+4 04A2 4F ld c,a 219: 5199+11 04A3 09 add hl,bc 220: 5210+6 04A4 23 inc hl 221: 5216+12 04A5 18C6 jr disassemble_table_seek_loop 222: 223: - 04A7 disassemble_table_found 224: 5228+4 04A7 44 ld b,H 225: 5232+4 04A8 4D ld c,l 226: 5236+10 04A9 E1 pop hl 227: 5246+10 04AA C9 ret 228: 229: - 04AB disassemble_table_notfound 230: 5256+7 04AB 0600 ld b,0 231: 5263+7 04AD 0E00 ld c,0 232: 5270+10 04AF E1 pop hl 233: 5280+10 04B0 C9 ret 234: 235: 236: 237: 238: - 04B1 dasm_print16hex_addr: 239: 5290+7 04B1 3E24 ld a,"$" 240: 5297+17 04B3 CDB702 call print_char 241: 5314+4 04B6 7C ld a,h 242: 5318+17 04B7 CDE702 call print_a_hex 243: 5335+4 04BA 7D ld a,l 244: 5339+17 04BB CDE702 call print_a_hex 245: 5356+7 04BE 3E68 ld a,"h" 246: 5363+17 04C0 CDB702 call print_char 247: 5380+7 04C3 3E20 ld a," " 248: 5387+17 04C5 CDB702 call print_char 249: 5404+10 04C8 C9 ret 250: 251: - 04C9 dasm_print8hex: 252: 5414+17 04C9 CDE702 call print_a_hex 253: 5431+7 04CC 3E68 ld a,"h" 254: 5438+17 04CE CDB702 call print_char 255: 5455+7 04D1 3E20 ld a," " 256: 5462+17 04D3 CDB702 call print_char 257: 5479+10 04D6 C9 ret 258: 259: 260: 261: 262: 263: 264: 265: - 04D7 param_01: ; 0x01 16bit address pointer 266: 5489+11 04D7 E5 push hl 267: 5500+20 04D8 ED5B1041 ld de,(var_opcode_start) 268: 5520+6 04DC 13 inc de 269: 5526+7 04DD 1A ld a,(de) 270: 5533+4 04DE 6F ld l,a 271: 5537+6 04DF 13 inc de 272: 5543+7 04E0 1A ld a,(de) 273: 5550+4 04E1 67 ld h,a 274: 275: 5554+7 04E2 3E24 ld a,"$" 276: 5561+17 04E4 CDB702 call print_char 277: 5578+4 04E7 7C ld a,h 278: 5582+17 04E8 CDE702 call print_a_hex 279: 5599+4 04EB 7D ld a,l 280: 5603+17 04EC CDE702 call print_a_hex 281: 5620+7 04EF 3E68 ld a,"h" 282: 5627+17 04F1 CDB702 call print_char 283: 5644+7 04F4 3E20 ld a," " 284: 5651+17 04F6 CDB702 call print_char 285: 5668+17 04F9 CD7506 call param_comma 286: 5685+10 04FC E1 pop hl 287: 5695+10 04FD C9 ret 288: 289: - 04FE param_02: 290: 5705+11 04FE C5 push bc 291: 5716+20 04FF ED5B1041 ld de,(var_opcode_start) 292: 5736+7 0503 1A ld a,(de) 293: 5743+4 0504 1F rra 294: 5747+4 0505 1F rra 295: 5751+7 0506 E60E and 0x0E 296: 297: 5758+11 0508 E5 push hl 298: 5769+10 0509 218F0E ld hl, [dasm_printFlags_table] 299: 5779+7 050C 0600 ld b,0 300: 5786+4 050E 4F ld c,a 301: 5790+11 050F 09 add hl,bc 302: 5801+17 0510 CDBF02 call print_str 303: 5818+7 0513 3E20 ld a, " " 304: 5825+17 0515 CDB702 call print_char 305: 5842+10 0518 E1 pop hl 306: 5852+10 0519 C1 pop bc 307: 5862+10 051A C9 ret 308: 309: 310: - 051B param_03: 311: 5872+20 051B ED5B1041 ld de,(var_opcode_start) 312: 5892+6 051F 13 inc de 313: 5898+7 0520 1A ld a,(de) 314: 315: 5905+11 0521 F5 push af 316: 5916+7 0522 E680 and 0x80 317: 5923+10 0524 C23C05 jp nz, param_03_neg 318: 5933+7 0527 3E24 ld a,"$" 319: 5940+17 0529 CDB702 call print_char 320: 5957+7 052C 3E2B ld a,"+" 321: 5964+17 052E CDB702 call print_char 322: 5981+10 0531 F1 pop af 323: 5991+17 0532 CDE702 call print_a_hex 324: 6008+7 0535 3E68 ld a,"h" 325: 6015+17 0537 CDB702 call print_char 326: 6032+12 053A 1817 jr param_03_done 327: 328: - 053C param_03_neg: 329: 6044+7 053C 3E24 ld a,"$" 330: 6051+17 053E CDB702 call print_char 331: 6068+7 0541 3E2D ld a,"-" 332: 6075+17 0543 CDB702 call print_char 333: 6092+10 0546 F1 pop af 334: 6102+8 0547 ED44 neg 335: 6110+17 0549 CDE702 call print_a_hex 336: 6127+7 054C 3E68 ld a,"h" 337: 6134+17 054E CDB702 call print_char 338: 6151+12 0551 1800 jr param_03_done 339: 340: - 0553 param_03_done: 341: 6163+17 0553 CD7506 call param_comma 342: 6180+10 0556 C9 ret 343: 344: 345: - 0557 param_04: 346: 6190+20 0557 ED5B1041 ld de,(var_opcode_start) 347: 6210+6 055B 13 inc de 348: 6216+7 055C 1A ld a,(de) 349: 6223+7 055D FE4D cp 0x4D 350: 6230+7+5 055F 2806 jr z,param_04_i 351: 6237+7 0561 3E4E ld a,"N" 352: 6244+17 0563 CDB702 call print_char 353: 6261+10 0566 C9 ret 354: - 0567 param_04_i: 355: 6271+7 0567 3E49 ld a,"I" 356: 6278+17 0569 CDB702 call print_char 357: 6295+10 056C C9 ret 358: 359: - 056D param_05: 360: 6305+11 056D C5 push bc 361: 6316+20 056E ED5B1041 ld de,(var_opcode_start) 362: 6336+7 0572 1A ld a,(de) 363: 6343+7 0573 E638 and 0x38 364: ; print hex char 365: 6350+17 0575 CDC904 call dasm_print8hex 366: 6367+10 0578 C1 pop bc 367: 6377+10 0579 C9 ret 368: 369: 370: - 057A param_06: 371: 6387+11 057A C5 push bc 372: 6398+20 057B ED5B1041 ld de,(var_opcode_start) 373: 6418+7 057F 1A ld a,(de) 374: 6425+4 0580 1F rra 375: 6429+4 0581 1F rra 376: 6433+4 0582 1F rra 377: 6437+7 0583 E607 and 0x07 378: 6444+17 0585 CD5006 call param_printRegister 379: 6461+7 0588 3E20 ld a," " 380: 6468+17 058A CDB702 call print_char 381: 6485+7 058D 3E2C ld a,"," 382: 6492+17 058F CDB702 call print_char 383: 6509+10 0592 C1 pop bc 384: 6519+10 0593 C9 ret 385: 386: - 0594 param_07: 387: 6529+11 0594 C5 push bc 388: 6540+20 0595 ED5B1041 ld de,(var_opcode_start) 389: 6560+7 0599 1A ld a,(de) 390: 6567+7 059A E607 and 0x07 391: 392: 6574+17 059C CD5006 call param_printRegister 393: 6591+10 059F C1 pop bc 394: 6601+10 05A0 C9 ret 395: 396: - 05A1 param_08: 397: 6611+11 05A1 C5 push bc 398: 6622+20 05A2 ED5B1041 ld de,(var_opcode_start) 399: 6642+6 05A6 13 inc de 400: 6648+7 05A7 1A ld a,(de) 401: 6655+17 05A8 CDC904 call dasm_print8hex 402: 6672+10 05AB C1 pop bc 403: 6682+10 05AC C9 ret 404: 405: 406: - 05AD param_0A: 407: 6692+11 05AD E5 push hl 408: 6703+20 05AE ED5B1041 ld de,(var_opcode_start) 409: 6723+6 05B2 13 inc de 410: 6729+6 05B3 13 inc de 411: 6735+12 05B4 1806 jr param_09_0A 412: - 05B6 param_09: 413: 6747+11 05B6 E5 push hl 414: 6758+20 05B7 ED5B1041 ld de,(var_opcode_start) 415: 6778+6 05BB 13 inc de 416: - 05BC param_09_0A: 417: 6784+7 05BC 1A ld a,(de) 418: 6791+4 05BD 6F ld l,a 419: 6795+6 05BE 13 inc de 420: 6801+7 05BF 1A ld a,(de) 421: 6808+4 05C0 67 ld h,a 422: 6812+4 05C1 7C ld a,h 423: 6816+17 05C2 CDE702 call print_a_hex 424: 6833+4 05C5 7D ld a,l 425: 6837+17 05C6 CDE702 call print_a_hex 426: 6854+10 05C9 E1 pop hl 427: 6864+10 05CA C9 ret 428: 429: - 05CB param_10: 430: 6874+11 05CB C5 push bc 431: 6885+20 05CC ED5B1041 ld de,(var_opcode_start) 432: 6905+7 05D0 1A ld a,(de) 433: 6912+4 05D1 1F rra 434: 6916+4 05D2 1F rra 435: 6920+4 05D3 1F rra 436: 6924+7 05D4 E607 and 0x07 437: 6931+17 05D6 CD5006 call param_printRegister 438: 6948+10 05D9 C1 pop bc 439: 6958+10 05DA C9 ret 440: 441: 442: - 05DB param_11: 443: 6968+11 05DB E5 push hl 444: 6979+11 05DC C5 push bc 445: 6990+20 05DD ED5B1041 ld de,(var_opcode_start) 446: 7010+12 05E1 1807 jr param_11_12 447: - 05E3 param_12: 448: 7022+11 05E3 E5 push hl 449: 7033+11 05E4 C5 push bc 450: 7044+20 05E5 ED5B1041 ld de,(var_opcode_start) 451: 7064+6 05E9 13 inc de 452: 453: - 05EA param_11_12: 454: 7070+7 05EA 1A ld a,(de) 455: 7077+4 05EB 1F rra 456: 7081+4 05EC 1F rra 457: 7085+4 05ED 1F rra 458: 7089+7 05EE E606 and 0x06 459: 7096+11 05F0 F5 push af 460: ;check which table to use 461: 7107+16 05F1 2A1041 ld hl, (var_opcode_start) 462: 7123+7 05F4 7E ld a,(hl) 463: 7130+7 05F5 FEDD cp 0xDD 464: 7137+7+5 05F7 2809 jr z,param_11_12_ix 465: 7144+7 05F9 FEFD cp 0xFD 466: 7151+7+5 05FB 280A jr z,param_11_12_iy 467: - 05FD param_11_12_def: 468: 7158+10 05FD 219F0E ld hl, [dasm_printRegister8_table] 469: 7168+12 0600 1808 jr param_11_12_all 470: - 0602 param_11_12_ix: 471: 7180+10 0602 21A70E ld hl, [dasm_printRegisterIX_table] 472: 7190+12 0605 1803 jr param_11_12_all 473: - 0607 param_11_12_iy: 474: 7202+10 0607 21AF0E ld hl, [dasm_printRegisterIY_table] 475: - 060A param_11_12_all: 476: 7212+10 060A F1 pop af 477: 7222+7 060B 0600 ld b,0 478: 7229+4 060D 4F ld c,a 479: 7233+11 060E 09 add hl, bc 480: 7244+7 060F 7E ld a,(hl) 481: 7251+17 0610 CDB702 call print_char 482: 7268+6 0613 23 inc hl 483: 7274+7 0614 7E ld a,(hl) 484: 7281+17 0615 CDB702 call print_char 485: 7298+10 0618 C1 pop bc 486: 7308+10 0619 E1 pop hl 487: 7318+10 061A C9 ret 488: 489: - 061B param_13: 490: 7328+11 061B E5 push hl 491: 7339+11 061C C5 push bc 492: 7350+20 061D ED5B1041 ld de,(var_opcode_start) 493: 7370+7 0621 1A ld a,(de) 494: 7377+4 0622 1F rra 495: 7381+4 0623 1F rra 496: 7385+4 0624 1F rra 497: 7389+7 0625 E606 and 0x06 498: 7396+11 0627 F5 push af 499: ;check which table to use 500: 7407+16 0628 2A1041 ld hl, (var_opcode_start) 501: 7423+7 062B 7E ld a,(hl) 502: 7430+10 062C 21B70E ld hl, [dasm_printRegisterSP_table] 503: 7440+12 062F 18D9 jr param_11_12_all ;reuse code from 11_12 504: 505: 506: - 0631 param_81: 507: 7452+11 0631 E5 push hl 508: 7463+11 0632 C5 push bc 509: 7474+16 0633 2A1741 ld hl, (var_opcode_string) 510: 7490+7 0636 0602 ld b,2 511: 7497+12 0638 1807 jr param_80_seek 512: - 063A param_80: 513: 7509+11 063A E5 push hl 514: 7520+11 063B C5 push bc 515: 7531+16 063C 2A1741 ld hl, (var_opcode_string) 516: 7547+7 063F 0601 ld b,1 517: - 0641 param_80_seek: 518: 7554+7 0641 7E ld a,(hl) 519: 7561+6 0642 23 inc hl 520: 7567+4 0643 A7 and a 521: 7571+7+5 0644 20FB jr nz, param_80_seek 522: ;found 523: 7578+4 0646 05 dec b ;found but counter too high 524: 7582+10 0647 C24106 jp nz, param_80_seek 525: 526: 7592+17 064A CDBF02 call print_str 527: 7609+10 064D C1 pop bc 528: 7619+10 064E E1 pop hl 529: 7629+10 064F C9 ret 530: 531: 532: 533: - 0650 param_printRegister: 534: 7639+11 0650 E5 push hl 535: 7650+7 0651 FE06 cp 0x06 536: 7657+7+5 0653 2811 jr z, param_printRegisterHL 537: 7664+7 0655 FE07 cp 0x07 538: 7671+7+5 0657 2815 jr z, param_printRegisterA 539: 7678+10 0659 219F0E ld hl, [dasm_printRegister8_table] 540: 7688+7 065C 0600 ld b,0 541: 7695+4 065E 4F ld c,a 542: 7699+11 065F 09 add hl,bc 543: 7710+7 0660 7E ld a, (hl) 544: 7717+17 0661 CDB702 call print_char 545: 7734+10 0664 E1 pop hl 546: 7744+10 0665 C9 ret 547: 548: - 0666 param_printRegisterHL: 549: 7754+10 0666 21BF0E ld hl, [dasm_printRegister8_table_HL] 550: 7764+17 0669 CDBF02 call print_str 551: 7781+10 066C E1 pop hl 552: 7791+10 066D C9 ret 553: 554: - 066E param_printRegisterA: 555: 7801+7 066E 3E41 ld a,"A" 556: 7808+17 0670 CDB702 call print_char 557: 7825+10 0673 E1 pop hl 558: 7835+10 0674 C9 ret 559: 560: 561: - 0675 param_comma: 562: 7845+4 0675 78 ld a,b 563: 7849+7 0676 FE01 cp 1 564: 7856+5+6 0678 C8 ret z 565: 7861+7 0679 3E20 ld a," " 566: 7868+17 067B CDB702 call print_char 567: 7885+7 067E 3E2C ld a,"," 568: 7892+17 0680 CDB702 call print_char **** main.asm **** 487: 7909+10 0683 C9 ret 488: .include "disassembler_table.s" **** include/disassembler_table.s **** 1: ;disassembler tables 2: 3: - 0684 dasm_opcode_table: 4: ;byte 0 = opcode 5: ;byte 1 = opcode mask 6: ;byte 2 = opcode extended 7: ;byte 3 = opcode extended mask 8: ;byte 4 = length 9: ;byte 5+6 = pointer to string 10: ;byte 7 = params = count of paramters 11: ;byte 8+ = paramters 12: ; 0x01 16bit address pointer 13: ; 0x02 flag bit 3-5 14: ; 0x03 relative jmp address 15: ; 0x04 RETI/RETN 16: ; 0x05 RST Vector 17: ; 0x06 register (r) 18: ; 0x07 register (r') 19: ; 0x08 8-Bit value 20: ; 0x09 16-Bit value 21: ; 0x0A 16-bit value with offset +1 22: ; 0x10 same as 0x06 without "," 23: ; 0x11 print 16 bit register from 1st byte 24: ; 0x12 print 16 bit register from 2nd byte 25: ; 0x13 push/pop register lookup 26: ; 0x80 print string suffix 27: ; 0x81 print string suffix 2 28: - 0684 00FF0000 defb 0x00, 0xFF, 0x00, 0x00, 1, [dasm_00], [dasm_00]>>8,0 ;NOP 01DC0A00 29: ;General-Purpose Arithmetic and CPU Control Groups 30: - 068C 27FF0000 defb 0x27, 0xFF, 0x00, 0x00, 1, [dasm_27], [dasm_27]>>8, 0 ;DAA 01A70B00 31: - 0694 2FFF0000 defb 0x2F, 0xFF, 0x00, 0x00, 1, [dasm_2F], [dasm_2F]>>8, 0 ;CPL 01AB0B00 32: - 069C EDFF44FF defb 0xED, 0xFF, 0x44, 0xFF, 2, [dasm_ED_44], [dasm_ED_44]>>8, 0 ;NEG 02AF0B00 33: - 06A4 3FFF0000 defb 0x3f, 0xFF, 0x00, 0x00, 1, [dasm_3F], [dasm_3F]>>8, 0 ;CCF 01B30B00 34: - 06AC 37FF0000 defb 0x37, 0xFF, 0x00, 0x00, 1, [dasm_37], [dasm_37]>>8, 0 ;SCF 01B70B00 35: ;defb 0x00, 0xFF, 0x00, 0x00, 1, [dasm_00], [dasm_00]>>8,0 ;NOP -> already at top for performance reasons 36: - 06B4 76FF0000 defb 0x76, 0xFF, 0x00, 0x00, 1, [dasm_76], [dasm_76]>>8, 0 ;HALT 01BB0B00 37: - 06BC F3FF0000 defb 0xF3, 0xFF, 0x00, 0x00, 1, [dasm_F3], [dasm_F3]>>8, 0 ;DI 01C00B00 38: - 06C4 FBFF0000 defb 0xFB, 0xFF, 0x00, 0x00, 1, [dasm_FB], [dasm_FB]>>8, 0 ;EI 01C30B00 39: - 06CC EDFF46FF defb 0xED, 0xFF, 0x46, 0xFF, 2, [dasm_ED_46], [dasm_ED_46]>>8, 0 ;IM 0 02C60B00 40: - 06D4 EDFF56FF defb 0xED, 0xFF, 0x56, 0xFF, 2, [dasm_ED_56], [dasm_ED_56]>>8, 0 ;IM 1 02CB0B00 41: - 06DC EDFF5EFF defb 0xED, 0xFF, 0x5E, 0xFF, 2, [dasm_ED_5E], [dasm_ED_5E]>>8, 0 ;IM 2 02D00B00 42: 43: ;Exchange, Block Transfer, and Search Group 44: - 06E4 EBFF0000 defb 0xEB, 0xFF, 0x00, 0x00, 1, [dasm_BE], [dasm_BE]>>8, 0 ;EX DE, HL 01D50B00 45: - 06EC 08FF0000 defb 0x08, 0xFF, 0x00, 0x00, 1, [dasm_08], [dasm_08]>>8, 0 ;EX AF, AF′ 01DF0B00 46: - 06F4 D9FF0000 defb 0xD9, 0xFF, 0x00, 0x00, 1, [dasm_D9], [dasm_D9]>>8, 0 ;EXX 01EC0B00 47: - 06FC E3FF0000 defb 0xE3, 0xFF, 0x00, 0x00, 1, [dasm_E3], [dasm_E3]>>8, 0 ;EX (SP), HL 01F00B00 48: - 0704 DDFFE3FF defb 0xDD, 0xFF, 0xE3, 0xFF, 2, [dasm_DD_E3], [dasm_DD_E3]>>8, 0 ;EX (SP), IX 02FC0B00 49: - 070C FDFFE3FF defb 0xFD, 0xFF, 0xE3, 0xFF, 2, [dasm_FD_E3], [dasm_FD_E3]>>8, 0 ;EX (SP), IY 02080C00 50: - 0714 EDFFA0FF defb 0xED, 0xFF, 0xA0, 0xFF, 2, [dasm_ED_A0], [dasm_ED_A0]>>8, 0 ;LDI 02140C00 51: - 071C EDFFB0FF defb 0xED, 0xFF, 0xB0, 0xFF, 2, [dasm_ED_B0], [dasm_ED_B0]>>8, 0 ;LDIR 02180C00 52: - 0724 EDFFA8FF defb 0xED, 0xFF, 0xA8, 0xFF, 2, [dasm_ED_A8], [dasm_ED_A8]>>8, 0 ;LDD 021D0C00 53: - 072C EDFFB8FF defb 0xED, 0xFF, 0xB8, 0xFF, 2, [dasm_ED_B8], [dasm_ED_B8]>>8, 0 ;LDDR 02210C00 54: - 0734 EDFFA1FF defb 0xED, 0xFF, 0xA1, 0xFF, 2, [dasm_ED_A1], [dasm_ED_A1]>>8, 0 ;CPI 02260C00 55: - 073C EDFFB1FF defb 0xED, 0xFF, 0xB1, 0xFF, 2, [dasm_ED_B1], [dasm_ED_B1]>>8, 0 ;CPIR 022A0C00 56: - 0744 EDFFA9FF defb 0xED, 0xFF, 0xA9, 0xFF, 2, [dasm_ED_A9], [dasm_ED_A9]>>8, 0 ;CPD 022F0C00 57: - 074C EDFFB9FF defb 0xED, 0xFF, 0xB9, 0xFF, 2, [dasm_ED_B9], [dasm_ED_B9]>>8, 0 ;CPDR 02330C00 58: 59: ;JUMP Group 60: - 0754 C3FF0000 defb 0xC3, 0xFF, 0x00, 0x00, 3, [dasm_C3], [dasm_C3]>>8,1, 0x01 ;JP nn 03E00A01 01 61: - 075D C2C70000 defb 0xC2, 0xC7, 0x00, 0x00, 3, [dasm_C3], [dasm_C3]>>8,3, 0x02, 0x80, 0x01 ;JP cc,nn 03E00A03 028001 62: - 0768 18FF0000 defb 0x18, 0xFF, 0x00, 0x00, 2, [dasm_18], [dasm_18]>>8,1, 0x03 ;JR e 02E70A01 03 63: - 0771 38FF0000 defb 0x38, 0xFF, 0x00, 0x00, 2, [dasm_38], [dasm_38]>>8,1, 0x03 ;JR C,e 02EB0A01 03 64: - 077A 30FF0000 defb 0x30, 0xFF, 0x00, 0x00, 2, [dasm_30], [dasm_30]>>8,1, 0x03 ;JR NC,e 02F20A01 03 65: - 0783 28FF0000 defb 0x28, 0xFF, 0x00, 0x00, 2, [dasm_28], [dasm_28]>>8,1, 0x03 ;JR Z,e 02FA0A01 03 66: - 078C 20FF0000 defb 0x20, 0xFF, 0x00, 0x00, 2, [dasm_20], [dasm_20]>>8,1, 0x03 ;JR NZ,e 02010B01 03 67: - 0795 E9FF0000 defb 0xE9, 0xFF, 0x00, 0x00, 2, [dasm_E9], [dasm_E9]>>8,0 ;JP (HL) 02090B00 68: - 079D DDFFE9FF defb 0xDD, 0xFF, 0xE9, 0xFF, 2, [dasm_DD], [dasm_DD]>>8,0 ;JP (IX) 02120B00 69: - 07A5 FDFFE9FF defb 0xFD, 0xFF, 0xE9, 0xFF, 2, [dasm_FD], [dasm_FD]>>8,0 ;JP (IY) 021B0B00 70: - 07AD 10FF0000 defb 0x10, 0xFF, 0x00, 0x00, 2, [dasm_10], [dasm_10]>>8,1, 0x03 ;DJNZ, e 02240B01 03 71: ;Call and Return Group 72: - 07B6 CDFF0000 defb 0xCD, 0xFF, 0x00, 0x00, 3, [dasm_CD], [dasm_CD]>>8,1, 0x01 ;CALL nn 032A0B01 01 73: - 07BF C4C70000 defb 0xC4, 0xC7, 0x00, 0x00, 3, [dasm_CD], [dasm_CD]>>8,2, 0x02, 0x01 ;CALL cc,nn 032A0B02 0201 74: - 07C9 C9FF0000 defb 0xC9, 0xFF, 0x00, 0x00, 1, [dasm_C9], [dasm_C9]>>8,0 ;RET 01300B00 75: - 07D1 C0C70000 defb 0xC0, 0xC7, 0x00, 0x00, 1, [dasm_C9], [dasm_C9]>>8,1, 0x02 ;RET cc 01300B01 02 76: - 07DA EDFF4DFF defb 0xED, 0xFF, 0x4D, 0xFF, 2, [dasm_ED_4D], [dasm_ED_4D]>>8,0 ;RETI 02350B00 77: - 07E2 EDFF45FF defb 0xED, 0xFF, 0x45, 0xFF, 2, [dasm_ED_45], [dasm_ED_45]>>8,0 ;RETN 023A0B00 78: 79: - 07EA C7C70000 defb 0xC7, 0xC7, 0x00, 0x00, 1, [dasm_FF], [dasm_FF]>>8,1, 0x05 ;RST 013F0B01 05 80: ;8-Bit load group 81: - 07F3 0AFF0000 defb 0x0A, 0xFF, 0x00, 0x00, 1, [dasm_0A], [dasm_0A]>>8, 0 ;LD A, (BC) 01440B00 82: - 07FB 1AFF0000 defb 0x1A, 0xFF, 0x00, 0x00, 1, [dasm_1A], [dasm_1A]>>8, 0 ;LD A, (DE) 014E0B00 83: - 0803 3AFF0000 defb 0x3A, 0xFF, 0x00, 0x00, 3, [dasm_3A], [dasm_3A]>>8, 2, 0x09, 0x80 ;LD A, (nn) 03580B02 0980 84: - 080D 02FF0000 defb 0x02, 0xFF, 0x00, 0x00, 1, [dasm_02], [dasm_02]>>8, 0 ;LD (BC), A 01620B00 85: - 0815 12FF0000 defb 0x12, 0xFF, 0x00, 0x00, 1, [dasm_12], [dasm_12]>>8, 0 ;LD (DE), A 016D0B00 86: - 081D 32FF0000 defb 0x32, 0xFF, 0x00, 0x00, 3, [dasm_32], [dasm_32]>>8, 2, 0x09, 0x80 ;LD (nn), A 03780B02 0980 87: - 0827 EDFF57FF defb 0xED, 0xFF, 0x57, 0xFF, 2, [dasm__ED_57], [dasm__ED_57]>>8, 0 ;LD A, I 02870B00 88: - 082F EDFF5FFF defb 0xED, 0xFF, 0x5F, 0xFF, 2, [dasm__ED_5F], [dasm__ED_5F]>>8, 0 ;LD A, R 028F0B00 89: - 0837 EDFF47FF defb 0xED, 0xFF, 0x47, 0xFF, 2, [dasm__ED_47], [dasm__ED_47]>>8, 0 ;LD I, A 02970B00 90: - 083F EDFF4FFF defb 0xED, 0xFF, 0x4F, 0xFF, 2, [dasm__ED_4F], [dasm__ED_4F]>>8, 0 ;LD R, A 029F0B00 91: 92: - 0847 06C70000 defb 0x06, 0xC7, 0x00, 0x00, 2, [dasm__LD], [dasm__LD]>>8, 2, 0x06, 0x08 ;LD r, n 02830B02 0608 93: - 0851 40C00000 defb 0x40, 0xC0, 0x00, 0x00, 1, [dasm__LD], [dasm__LD]>>8, 2, 0x06, 0x07 ;LD r, r' / LD r, (HL) / LD (HL), r 01830B02 0607 94: 95: ;8-Bit Arithmetic Group 96: - 085B 80F80000 defb 0x80, 0xF8, 0x00, 0x00, 1, [dasm_80C6], [dasm_80C6]>>8, 1, 0x07 ;ADD A, r / ADD A, (HL) 01380C01 07 97: - 0864 C6FF0000 defb 0xC6, 0xFF, 0x00, 0x00, 2, [dasm_80C6], [dasm_80C6]>>8, 1, 0x08 ;ADD A, n 02380C01 08 98: - 086D DDFF86FF defb 0xDD, 0xFF, 0x86, 0xFF, 3, [dasm_DD_86], [dasm_DD_86]>>8, 2, 0x08, 0x80 ;ADD A, (IX + d) 03400C02 0880 99: - 0877 FDFF86FF defb 0xFD, 0xFF, 0x86, 0xFF, 3, [dasm_FD_86], [dasm_FD_86]>>8, 2, 0x08, 0x80 ;ADD A, (IY + d) 034F0C02 0880 100: - 0881 C8F80000 defb 0xC8, 0xF8, 0x00, 0x00, 1, [dasm_C88E], [dasm_C88E]>>8, 1, 0x07 ;ADC A, r / ADC A, (HL) 015E0C01 07 101: - 088A 8EF80000 defb 0x8E, 0xF8, 0x00, 0x00, 2, [dasm_C88E], [dasm_C88E]>>8, 1, 0x08 ;ADC A, n 025E0C01 08 102: - 0893 DDFF8EFF defb 0xDD, 0xFF, 0x8E, 0xFF, 3, [dasm_DD_8E], [dasm_DD_8E]>>8, 2, 0x08, 0x80 ;ADC A, (IX + d) 03660C02 0880 103: - 089D FDFF8EFF defb 0xFD, 0xFF, 0x8E, 0xFF, 3, [dasm_FD_8E], [dasm_FD_8E]>>8, 2, 0x08, 0x80 ;ADC A, (IY + d) 03750C02 0880 104: - 08A7 90F80000 defb 0x90, 0xF8, 0x00, 0x00, 1, [dasm__SUB], [dasm__SUB]>>8, 1, 0x07 ;SUB r / SUB A, (HL) 01840C01 07 105: - 08B0 D6FF0000 defb 0xD6, 0xFF, 0x00, 0x00, 2, [dasm__SUB], [dasm__SUB]>>8, 1, 0x08 ;SUB n 02840C01 08 106: - 08B9 DDFF96FF defb 0xDD, 0xFF, 0x96, 0xFF, 3, [dasm_DD_96], [dasm_DD_96]>>8, 2, 0x08, 0x80 ;SUB (IX + d) 03890C02 0880 107: - 08C3 FDFF96FF defb 0xFD, 0xFF, 0x96, 0xFF, 3, [dasm_FD_96], [dasm_FD_96]>>8, 2, 0x08, 0x80 ;SUB (IY + d) 03950C02 0880 108: - 08CD 94F80000 defb 0x94, 0xF8, 0x00, 0x00, 1, [dasm__SBC], [dasm__SBC]>>8, 1, 0x07 ;SBC A,r / SBC A, (HL) 01A10C01 07 109: - 08D6 DEFF0000 defb 0xDE, 0xFF, 0x00, 0x00, 2, [dasm__SBC], [dasm__SBC]>>8, 1, 0x08 ;SBC A,n 02A10C01 08 110: - 08DF DDFF9EFF defb 0xDD, 0xFF, 0x9E, 0xFF, 3, [dasm_DD_9E], [dasm_DD_9E]>>8, 2, 0x08, 0x80 ;SBC A,(IX + d) 03A90C02 0880 111: - 08E9 FDFF9EFF defb 0xFD, 0xFF, 0x9E, 0xFF, 3, [dasm_FD_9E], [dasm_FD_9E]>>8, 2, 0x08, 0x80 ;SBC A,(IY + d) 03B70C02 0880 112: - 08F3 A0F80000 defb 0xA0, 0xF8, 0x00, 0x00, 1, [dasm__AND], [dasm__AND]>>8, 1, 0x07 ;AND A,r / AND A, (HL) 01C50C01 07 113: - 08FC E6FF0000 defb 0xE6, 0xFF, 0x00, 0x00, 2, [dasm__AND], [dasm__AND]>>8, 1, 0x08 ;AND A,n 02C50C01 08 114: - 0905 DDFFA6FF defb 0xDD, 0xFF, 0xA6, 0xFF, 3, [dasm_DD_A6], [dasm_DD_A6]>>8, 2, 0x08, 0x80 ;AND A,(IX + d) 03CA0C02 0880 115: - 090F FDFFA6FF defb 0xFD, 0xFF, 0xA6, 0xFF, 3, [dasm_FD_A6], [dasm_FD_A6]>>8, 2, 0x08, 0x80 ;AND A,(IY + d) 03D60C02 0880 116: - 0919 B0F80000 defb 0xB0, 0xF8, 0x00, 0x00, 1, [dasm__OR], [dasm__OR]>>8, 1, 0x07 ;OR A,r / OR A, (HL) 01E20C01 07 117: - 0922 F6FF0000 defb 0xF6, 0xFF, 0x00, 0x00, 2, [dasm__OR], [dasm__OR]>>8, 1, 0x08 ;OR A,n 02E20C01 08 118: - 092B DDFFB6FF defb 0xDD, 0xFF, 0xB6, 0xFF, 3, [dasm_DD_B6], [dasm_DD_B6]>>8, 2, 0x08, 0x80 ;OR A,(IX + d) 03E60C02 0880 119: - 0935 FDFFB6FF defb 0xFD, 0xFF, 0xB6, 0xFF, 3, [dasm_FD_B6], [dasm_FD_B6]>>8, 2, 0x08, 0x80 ;OR A,(IY + d) 03F10C02 0880 120: - 093F A8F80000 defb 0xA8, 0xF8, 0x00, 0x00, 1, [dasm__XOR], [dasm__XOR]>>8, 1, 0x07 ;XOR A,r / XOR A, (HL) 01FC0C01 07 121: - 0948 EEFF0000 defb 0xEE, 0xFF, 0x00, 0x00, 2, [dasm__XOR], [dasm__XOR]>>8, 1, 0x08 ;XOR A,n 02FC0C01 08 122: - 0951 DDFFAEFF defb 0xDD, 0xFF, 0xAE, 0xFF, 3, [dasm_DD_AE], [dasm_DD_AE]>>8, 2, 0x08, 0x80 ;XOR A,(IX + d) 03010D02 0880 123: - 095B FDFFAEFF defb 0xFD, 0xFF, 0xAE, 0xFF, 3, [dasm_FD_AE], [dasm_FD_AE]>>8, 2, 0x08, 0x80 ;XOR A,(IY + d) 030D0D02 0880 124: - 0965 B8F80000 defb 0xB8, 0xF8, 0x00, 0x00, 1, [dasm__CP], [dasm__CP]>>8, 1, 0x07 ;CP A,r / CP A, (HL) 01190D01 07 125: - 096E FEFF0000 defb 0xFE, 0xFF, 0x00, 0x00, 2, [dasm__CP], [dasm__CP]>>8, 1, 0x08 ;CP A,n 02190D01 08 126: - 0977 DDFFBEFF defb 0xDD, 0xFF, 0xBE, 0xFF, 3, [dasm_DD_BE], [dasm_DD_BE]>>8, 2, 0x08, 0x80 ;CP A,(IX + d) 031D0D02 0880 127: - 0981 FDFFBEFF defb 0xFD, 0xFF, 0xBE, 0xFF, 3, [dasm_FD_BE], [dasm_FD_BE]>>8, 2, 0x08, 0x80 ;CP A,(IY + d) 03280D02 0880 128: - 098B 04C70000 defb 0x04, 0xC7, 0x00, 0x00, 1, [dasm__INC], [dasm__INC]>>8, 1, 0x10 ;INC r / INC (HL) 01330D01 10 129: - 0994 DDFF34FF defb 0xDD, 0xFF, 0x34, 0xFF, 3, [dasm_DD_34], [dasm_DD_34]>>8, 2, 0x08, 0x80 ;INC (IX + d) 03380D02 0880 130: - 099E FDFF34FF defb 0xFD, 0xFF, 0x34, 0xFF, 3, [dasm_FD_34], [dasm_FD_34]>>8, 2, 0x08, 0x80 ;INC (IY + d) 03440D02 0880 131: - 09A8 05C70000 defb 0x05, 0xC7, 0x00, 0x00, 1, [dasm__DEC], [dasm__DEC]>>8, 1, 0x10 ;DEC r / DEC (HL) 01500D01 10 132: - 09B1 DDFF35FF defb 0xDD, 0xFF, 0x35, 0xFF, 3, [dasm_DD_35], [dasm_DD_35]>>8, 2, 0x08, 0x80 ;DEC (IX + d) 03550D02 0880 133: - 09BB FDFF35FF defb 0xFD, 0xFF, 0x35, 0xFF, 3, [dasm_FD_35], [dasm_FD_35]>>8, 2, 0x08, 0x80 ;DEC (IY + d) 03610D02 0880 134: ;16-Bit Arithmetic Group 135: - 09C5 09CF0000 defb 0x09, 0xCF, 0x00, 0x00, 1, [dasm_09], [dasm_09]>>8, 1, 0x11 ;ADD HL, ss 016D0D01 11 136: - 09CE EDFF4ACF defb 0xED, 0xFF, 0x4A, 0xCF, 2, [dasm_ED_4A], [dasm_ED_4A]>>8, 1, 0x12 ;ADC HL, ss 02760D01 12 137: - 09D7 EDFF42CF defb 0xED, 0xFF, 0x42, 0xCF, 2, [dasm_ED_42], [dasm_ED_42]>>8, 1, 0x12 ;SBC HL, ss 027F0D01 12 138: - 09E0 DDFF09CF defb 0xDD, 0xFF, 0x09, 0xCF, 2, [dasm_DD_09], [dasm_DD_09]>>8, 1, 0x12 ;ADD IX, ss 02880D01 12 139: - 09E9 FDFF09CF defb 0xFD, 0xFF, 0x09, 0xCF, 2, [dasm_FD_09], [dasm_FD_09]>>8, 1, 0x12 ;ADD IY, ss 02910D01 12 140: - 09F2 03CF0000 defb 0x03, 0xCF, 0x00, 0x00, 1, [dasm_03], [dasm_03]>>8, 1, 0x11 ;INC ss 019A0D01 11 141: - 09FB DDFF23FF defb 0xDD, 0xFF, 0x23, 0xFF, 2, [dasm_DD_23], [dasm_DD_23]>>8, 0 ;INC IX 029F0D00 142: - 0A03 FDFF23FF defb 0xFD, 0xFF, 0x23, 0xFF, 2, [dasm_FD_23], [dasm_FD_23]>>8, 0 ;INC IY 02A80D00 143: - 0A0B 0BCF0000 defb 0x0B, 0xCF, 0x00, 0x00, 1, [dasm_0B], [dasm_0B]>>8, 1, 0x11 ;DEC ss 01B10D01 11 144: - 0A14 DDFF2BFF defb 0xDD, 0xFF, 0x2B, 0xFF, 2, [dasm_DD_2B], [dasm_DD_2B]>>8, 0 ;DEC IX 02B60D00 145: - 0A1C FDFF2BFF defb 0xFD, 0xFF, 0x2B, 0xFF, 2, [dasm_FD_2B], [dasm_FD_2B]>>8, 0 ;DEC IY 02BF0D00 146: ;16-Bit Load Group 147: - 0A24 01CF0000 defb 0x01, 0xCF, 0x00, 0x00, 3, [dasm_01], [dasm_01]>>8, 3, 0x11, 0x80, 0x09 ;LD dd, nn 03C80D03 118009 148: - 0A2F DDFF21FF defb 0xDD, 0xFF, 0x21, 0xFF, 4, [dasm_DD_01], [dasm_DD_01]>>8, 1, 0x0A ;LD IX, nn 04CF0D01 0A 149: - 0A38 FDFF21FF defb 0xFD, 0xFF, 0x21, 0xFF, 4, [dasm_FD_01], [dasm_FD_01]>>8, 1, 0x0A ;LD IY, nn 04D70D01 0A 150: - 0A41 2AFF0000 defb 0x2A, 0xFF, 0x00, 0x00, 3, [dasm_2A], [dasm_2A]>>8, 2, 0x09, 0x80 ;LD HL, (nn) 03DF0D02 0980 151: - 0A4B EDFF4BCF defb 0xED, 0xFF, 0x4B, 0xCF, 4, [dasm_ED_4B], [dasm_ED_4B]>>8, 4, 0x12, 0x80, 0x0A, 0x81 ;LD dd, (nn) 04EB0D04 12800A81 152: - 0A57 DDFF2AFF defb 0xDD, 0xFF, 0x2A, 0xFF, 4, [dasm_DD_2A], [dasm_DD_2A]>>8, 1, 0x0A ;LD IX, (nn) 04F60D01 0A 153: - 0A60 FDFF2AFF defb 0xFD, 0xFF, 0x2A, 0xFF, 4, [dasm_FD_2A], [dasm_FD_2A]>>8, 1, 0x0A ;LD IY, (nn) 04020E01 0A 154: - 0A69 22FF0000 defb 0x22, 0xFF, 0x00, 0x00, 3, [dasm_22], [dasm_22]>>8, 2, 0x0A, 0x80 ;LD (nn), HL 030E0E02 0A80 155: - 0A73 EDFF43CF defb 0xED, 0xFF, 0x43, 0xCF, 4, [dasm_ED_43], [dasm_ED_43]>>8, 3, 0x0A, 0x80, 0x12 ;LD (nn), dd 041A0E03 0A8012 156: - 0A7E DDFF22CF defb 0xDD, 0xFF, 0x22, 0xCF, 4, [dasm_DD_22], [dasm_DD_22]>>8, 2, 0x0A, 0x80 ;LD (nn), IX 04240E02 0A80 157: - 0A88 FDFF22CF defb 0xFD, 0xFF, 0x22, 0xCF, 4, [dasm_FD_22], [dasm_FD_22]>>8, 2, 0x0A, 0x80 ;LD (nn), IY 04300E02 0A80 158: - 0A92 F9FF0000 defb 0xF9, 0xFF, 0x00, 0x00, 1, [dasm_F9], [dasm_F9]>>8, 0 ;LD SP, HL 013C0E00 159: - 0A9A DDFFF9FF defb 0xDD, 0xFF, 0xF9, 0xFF, 2, [dasm_DD_F9], [dasm_DD_F9]>>8, 0 ;LD SP, IX 02460E00 160: - 0AA2 FDFFF9FF defb 0xFD, 0xFF, 0xF9, 0xFF, 2, [dasm_FD_F9], [dasm_FD_F9]>>8, 0 ;LD SP, IY 02500E00 161: - 0AAA C5CF0000 defb 0xC5, 0xCF, 0x00, 0x00, 1, [dasm_E5], [dasm_E5]>>8, 1, 0x13 ;PUSH qq 015A0E01 13 162: - 0AB3 DDFFE5FF defb 0xDD, 0xFF, 0xE5, 0xFF, 2, [dasm_DD_E5], [dasm_DD_E5]>>8, 0 ;PUSH IX 02600E00 163: - 0ABB FDFFE5FF defb 0xFD, 0xFF, 0xE5, 0xFF, 2, [dasm_FD_E5], [dasm_FD_E5]>>8, 0 ;PUSH IY 02680E00 164: - 0AC3 C1CF0000 defb 0xC1, 0xCF, 0x00, 0x00, 1, [dasm_E1], [dasm_E1]>>8, 1, 0x13 ;POP qq 01700E01 13 165: - 0ACC DDFFE1FF defb 0xDD, 0xFF, 0xE1, 0xFF, 2, [dasm_DD_E1], [dasm_DD_E1]>>8, 0 ;POP IX 02760E00 166: - 0AD4 FDFFE1FF defb 0xFD, 0xFF, 0xE1, 0xFF, 2, [dasm_FD_E1], [dasm_FD_E1]>>8, 0 ;POP IY 027E0E00 167: 168: 169: - 0ADC 4E4F5000 dasm_00: db "NOP",0x00 170: ;JUMP Group 171: - 0AE0 4A502000 dasm_C3: db "JP ",0x00,", ",0x00 2C2000 172: - 0AE7 4A522000 dasm_18: db "JR ",0x00 173: - 0AEB 4A522043 dasm_38: db "JR C, ",0x00 2C2000 174: - 0AF2 4A52204E dasm_30: db "JR NC, ",0x00 432C2000 175: - 0AFA 4A52205A dasm_28: db "JR Z, ",0x00 2C2000 176: - 0B01 4A52204E dasm_20: db "JR NZ, ",0x00 5A2C2000 177: - 0B09 4A502028 dasm_E9: db "JP (HL) ",0x00 484C2920 00 178: - 0B12 4A502028 dasm_DD: db "JP (IX) ",0x00 49582920 00 179: - 0B1B 4A502028 dasm_FD: db "JP (IY) ",0x00 49592920 00 180: - 0B24 444A4E5A dasm_10: db "DJNZ ",0x00 2000 181: ;Call and Return Group 182: - 0B2A 43414C4C dasm_CD: db "CALL ",0x00 2000 183: - 0B30 52455420 dasm_C9: db "RET ",0x00 00 184: - 0B35 52455449 dasm_ED_4D: db "RETI",0x00 00 185: - 0B3A 5245544E dasm_ED_45: db "RETN",0x00 00 186: - 0B3F 52535420 dasm_FF: db "RST ",0x00 00 187: ;8-Bit load group 188: - 0B44 4C442041 dasm_0A: db "LD A,(BC)",0x00 2C284243 2900 189: - 0B4E 4C442041 dasm_1A: db "LD A,(DE)",0x00 2C284445 2900 190: - 0B58 4C442041 dasm_3A: db "LD A,(",0x00, "h)",0x00 2C280068 2900 191: - 0B62 4C442028 dasm_02: db "LD (BC), A",0x00 4243292C 204100 192: - 0B6D 4C442028 dasm_12: db "LD (DE), A",0x00 4445292C 204100 193: - 0B78 4C442028 dasm_32: db "LD (",0x00, "h), A",0x00 0068292C 204100 194: - 0B83 4C442000 dasm__LD: db "LD ",0x00 195: - 0B87 4C442041 dasm__ED_57: db "LD A, I",0x00 2C204900 196: - 0B8F 4C442041 dasm__ED_5F: db "LD A, R",0x00 2C205200 197: - 0B97 4C442049 dasm__ED_47: db "LD I, A",0x00 2C204100 198: - 0B9F 4C442052 dasm__ED_4F: db "LD R, A",0x00 2C204100 199: ;General-Purpose Arithmetic and CPU Control Groups 200: - 0BA7 44414100 dasm_27: db "DAA",0x00 201: - 0BAB 43504C00 dasm_2F: db "CPL",0x00 202: - 0BAF 4E454700 dasm_ED_44: db "NEG",0x00 203: - 0BB3 43434600 dasm_3F: db "CCF",0x00 204: - 0BB7 53434600 dasm_37: db "SCF",0x00 205: - 0BBB 48414C54 dasm_76: db "HALT",0x00 00 206: - 0BC0 444900 dasm_F3: db "DI",0x00 207: - 0BC3 454900 dasm_FB: db "EI",0x00 208: - 0BC6 494D2030 dasm_ED_46: db "IM 0",0x00 00 209: - 0BCB 494D2031 dasm_ED_56: db "IM 1",0x00 00 210: - 0BD0 494D2032 dasm_ED_5E: db "IM 2",0x00 00 211: ;Exchange, Block Transfer, and Search Group 212: - 0BD5 45582044 dasm_BE: db "EX DE, HL",0x00 452C2048 4C00 213: - 0BDF 45582041 dasm_08: db "EX AF, AF′",0x00 462C2041 46E280B2 00 214: - 0BEC 45585800 dasm_D9: db "EXX",0x00 215: - 0BF0 45582028 dasm_E3: db "EX (SP), HL",0x00 5350292C 20484C00 216: - 0BFC 45582028 dasm_DD_E3: db "EX (SP), IX",0x00 5350292C 20495800 217: - 0C08 45582028 dasm_FD_E3: db "EX (SP), IY",0x00 5350292C 20495900 218: - 0C14 4C444900 dasm_ED_A0: db "LDI",0x00 219: - 0C18 4C444952 dasm_ED_B0: db "LDIR",0x00 00 220: - 0C1D 4C444400 dasm_ED_A8: db "LDD",0x00 221: - 0C21 4C444452 dasm_ED_B8: db "LDDR",0x00 00 222: - 0C26 43504900 dasm_ED_A1: db "CPI",0x00 223: - 0C2A 43504952 dasm_ED_B1: db "CPIR",0x00 00 224: - 0C2F 43504400 dasm_ED_A9: db "CPD",0x00 225: - 0C33 43504452 dasm_ED_B9: db "CPDR",0x00 00 226: ;8-Bit Arithmetic Group 227: - 0C38 41444420 dasm_80C6: db "ADD A, ", 0x00 412C2000 228: - 0C40 41444420 dasm_DD_86: db "ADD A, (IX+", 0x00, "h)",0x00 412C2028 49582B00 682900 229: - 0C4F 41444420 dasm_FD_86: db "ADD A, (IY+", 0x00, "h)",0x00 412C2028 49592B00 682900 230: - 0C5E 41444320 dasm_C88E: db "ADC A, ", 0x00 412C2000 231: - 0C66 41444320 dasm_DD_8E: db "ADC A, (IX+", 0x00, "h)",0x00 412C2028 49582B00 682900 232: - 0C75 41444320 dasm_FD_8E: db "ADC A, (IY+", 0x00, "h)",0x00 412C2028 49592B00 682900 233: - 0C84 53554220 dasm__SUB: db "SUB ", 0x00 00 234: - 0C89 53554220 dasm_DD_96: db "SUB (IX+", 0x00, "h)",0x00 2849582B 00682900 235: - 0C95 53554220 dasm_FD_96: db "SUB (IY+", 0x00, "h)",0x00 2849592B 00682900 236: - 0CA1 53424320 dasm__SBC: db "SBC A, ", 0x00 412C2000 237: - 0CA9 53424320 dasm_DD_9E: db "SBC A,(IX+", 0x00, "h)",0x00 412C2849 582B0068 2900 238: - 0CB7 53424320 dasm_FD_9E: db "SBC A,(IY+", 0x00, "h)",0x00 412C2849 592B0068 2900 239: - 0CC5 414E4420 dasm__AND: db "AND ", 0x00 00 240: - 0CCA 414E4420 dasm_DD_A6: db "AND (IX+", 0x00, "h)",0x00 2849582B 00682900 241: - 0CD6 414E4420 dasm_FD_A6: db "AND (IY+", 0x00, "h)",0x00 2849592B 00682900 242: - 0CE2 4F522000 dasm__OR: db "OR ", 0x00 243: - 0CE6 4F522028 dasm_DD_B6: db "OR (IX+", 0x00, "h)",0x00 49582B00 682900 244: - 0CF1 4F522028 dasm_FD_B6: db "OR (IY+", 0x00, "h)",0x00 49592B00 682900 245: - 0CFC 584F5220 dasm__XOR: db "XOR ", 0x00 00 246: - 0D01 584F5220 dasm_DD_AE: db "XOR (IX+", 0x00, "h)",0x00 2849582B 00682900 247: - 0D0D 584F5220 dasm_FD_AE: db "XOR (IY+", 0x00, "h)",0x00 2849592B 00682900 248: - 0D19 43502000 dasm__CP: db "CP ", 0x00 249: - 0D1D 43502028 dasm_DD_BE: db "CP (IX+", 0x00, "h)",0x00 49582B00 682900 250: - 0D28 43502028 dasm_FD_BE: db "CP (IY+", 0x00, "h)",0x00 49592B00 682900 251: - 0D33 494E4320 dasm__INC: db "INC ", 0x00 00 252: - 0D38 494E4320 dasm_DD_34: db "INC (IX+", 0x00, "h)",0x00 2849582B 00682900 253: - 0D44 494E4320 dasm_FD_34: db "INC (IY+", 0x00, "h)",0x00 2849592B 00682900 254: - 0D50 44454320 dasm__DEC: db "DEC ", 0x00 00 255: - 0D55 44454320 dasm_DD_35: db "DEC (IX+", 0x00, "h)",0x00 2849582B 00682900 256: - 0D61 44454320 dasm_FD_35: db "DEC (IY+", 0x00, "h)",0x00 2849592B 00682900 257: ;16-Bit Arithmetic Group 258: - 0D6D 41444420 dasm_09: db "ADD HL, ",0x00 484C2C20 00 259: - 0D76 41444320 dasm_ED_4A: db "ADC HL, ",0x00 484C2C20 00 260: - 0D7F 53424320 dasm_ED_42: db "SBC HL, ",0x00 484C2C20 00 261: - 0D88 41444420 dasm_DD_09: db "ADD IX, ",0x00 49582C20 00 262: - 0D91 41444420 dasm_FD_09: db "ADD IY, ",0x00 49592C20 00 263: - 0D9A 494E4320 dasm_03: db "INC ",0x00 00 264: - 0D9F 494E4320 dasm_DD_23: db "INC IX, ",0x00 49582C20 00 265: - 0DA8 494E4320 dasm_FD_23: db "INC IY, ",0x00 49592C20 00 266: - 0DB1 44454320 dasm_0B: db "DEC ",0x00 00 267: - 0DB6 44454320 dasm_DD_2B: db "DEC IX, ",0x00 49582C20 00 268: - 0DBF 44454320 dasm_FD_2B: db "DEC IY, ",0x00 49592C20 00 269: ;16-Bit Load Group 270: - 0DC8 4C442000 dasm_01: db "LD ",0x00, ", ",0x00 2C2000 271: - 0DCF 4C442049 dasm_DD_01: db "LD IX, ",0x00 582C2000 272: - 0DD7 4C442049 dasm_FD_01: db "LD IY, ",0x00 592C2000 273: - 0DDF 4C442048 dasm_2A: db "LD HL, (",0x00,"h)",0x00 4C2C2028 00682900 274: - 0DEB 4C442000 dasm_ED_4B: db "LD ",0x00,", (",0x00,"h)",0x00 2C202800 682900 275: - 0DF6 4C442049 dasm_DD_2A: db "LD IX, (",0x00,"h)",0x00 582C2028 00682900 276: - 0E02 4C442049 dasm_FD_2A: db "LD IY, (",0x00,"h)",0x00 592C2028 00682900 277: - 0E0E 4C442028 dasm_22: db "LD (",0x00,"h), HL",0x00 0068292C 20484C00 278: - 0E1A 4C442028 dasm_ED_43: db "LD (",0x00,"h), ",0x00 0068292C 2000 279: - 0E24 4C442028 dasm_DD_22: db "LD (",0x00,"h), IX",0x00 0068292C 20495800 280: - 0E30 4C442028 dasm_FD_22: db "LD (",0x00,"h), IY",0x00 0068292C 20495900 281: - 0E3C 4C442053 dasm_F9: db "LD SP, HL",0x00 502C2048 4C00 282: - 0E46 4C442053 dasm_DD_F9: db "LD SP, IX",0x00 502C2049 5800 283: - 0E50 4C442053 dasm_FD_F9: db "LD SP, IY",0x00 502C2049 5900 284: - 0E5A 50555348 dasm_E5: db "PUSH ",0x00 2000 285: - 0E60 50555348 dasm_DD_E5: db "PUSH IX",0x00 20495800 286: - 0E68 50555348 dasm_FD_E5: db "PUSH IY",0x00 20495900 287: - 0E70 50555348 dasm_E1: db "PUSH ",0x00 2000 288: - 0E76 50555348 dasm_DD_E1: db "PUSH IX",0x00 20495800 289: - 0E7E 50555348 dasm_FD_E1: db "PUSH IY",0x00 20495900 290: 291: ;Misc 292: - 0E86 2E3F2E00 dasm_UU: db ".?.",0x00 293: - 0E8A 20202020 dasm_UW: db " ",0x00 00 294: 295: - 0E8F dasm_printFlags_table: 296: - 0E8F 4E5A db "NZ" 297: - 0E91 5A00 db "Z",0 298: - 0E93 4E43 db "NC" 299: - 0E95 4300 db "C",0 300: - 0E97 504F db "PO" 301: - 0E99 5045 db "PE" 302: - 0E9B 5000 db "P",0 303: - 0E9D 4D00 db "M",0 304: 305: - 0E9F dasm_printRegister8_table: 306: - 0E9F 42 db "B" 307: - 0EA0 43 db "C" 308: - 0EA1 44 db "D" 309: - 0EA2 45 db "E" 310: - 0EA3 48 db "H" 311: - 0EA4 4C db "L" 312: - 0EA5 53 db "S" ;only 18 bit (SP) 313: - 0EA6 50 db "P" ;only 18 bit (SP) 314: 315: - 0EA7 dasm_printRegisterIX_table: 316: - 0EA7 4243 db "BC" 317: - 0EA9 4445 db "DE" 318: - 0EAB 4958 db "IX" 319: - 0EAD 5350 db "SP" 320: - 0EAF dasm_printRegisterIY_table: 321: - 0EAF 4243 db "BC" 322: - 0EB1 4445 db "DE" 323: - 0EB3 4959 db "IY" 324: - 0EB5 5350 db "SP" 325: 326: - 0EB7 dasm_printRegisterSP_table: 327: - 0EB7 4243 db "BC" 328: - 0EB9 4445 db "DE" 329: - 0EBB 484C db "HL" 330: - 0EBD 4146 db "AF" 331: 332: - 0EBF dasm_printRegister8_table_HL: **** main.asm **** 489: - 0EBF 28484C29 db "(HL)", 0 00 490: .include "rst.s" **** include/rst.s **** 1: - 0EC4 EXEC_RST_08: 2: 7919+17 0EC4 CDB702 call print_char 3: 7936+10 0EC7 C9 ret 4: 5: 6: - 0EC8 EXEC_RST_10: 7: 7946+11 0EC8 C5 push bc 8: 7957+11 0EC9 D5 push de 9: 7968+11 0ECA E5 push hl 10: ;call vdp_cursor_on 11: 7979+17 0ECB CDF802 call read_char 12: 7996+11 0ECE F5 push af 13: ;call vdp_cursor_off 14: 8007+10 0ECF F1 pop af 15: 8017+10 0ED0 E1 pop hl 16: 8027+10 0ED1 D1 pop de 17: 8037+10 0ED2 C1 pop bc 18: 8047+10 0ED3 C9 ret 19: 20: - 0ED4 EXEC_RST_18: 21: 8057+7 0ED4 3E00 ld a,0 22: 8064+10 0ED6 C9 ret **** main.asm **** 491: .include "beep.s" **** include/beep.s **** 1: ;------------------------------------------------------------------------------ 2: ; beep 3: ; 4: ; Beeps the speaker 5: ; DE sets duration 6: ;------------------------------------------------------------------------------ 7: - 0ED7 beep: 8: 8074+7 0ED7 3E08 LD A,0x08 9: 8081+11 0ED9 D3F4 OUT (CS_PIO_AD), A 10: 8092+10 0EDB 012800 LD BC, 0x28 11: 8102+17 0EDE CDF10E CALL beep_pause 12: 8119+7 0EE1 3E00 LD A,0x00 13: 8126+11 0EE3 D3F4 OUT (CS_PIO_AD), A 14: 8137+10 0EE5 012400 LD BC, 0x24 15: 8147+17 0EE8 CDF10E CALL beep_pause 16: 8164+6 0EEB 1B DEC DE 17: 8170+4 0EEC 7A LD A,D 18: 8174+4 0EED B3 OR E 19: 8178+7+5 0EEE 20E7 JR NZ, beep 20: 8185+10 0EF0 C9 RET 21: 22: - 0EF1 beep_pause: 23: 8195+8 0EF1 ED44 NEG ; 8 T-states 24: 8203+8 0EF3 ED44 NEG ; 8 T-states 25: 8211+8 0EF5 ED44 NEG ; 8 T-states 26: 8219+8 0EF7 ED44 NEG ; 8 T-states 27: 8227+6 0EF9 0B DEC BC ; 6 T-states 28: 8233+4 0EFA 79 LD A,C ; 9 T-states 29: 8237+4 0EFB B0 OR B ; 4 T-states 30: 8241+10 0EFC C2F10E JP NZ,beep_pause ; 10 T-states **** main.asm **** 492: 8251+10 0EFF C9 RET ; Pause complete, RETurn 493: ; Strings 494: - 0F00 STR_Banner_Start: 495: - 0F00 5A384320 db "Z8C Monitor V2 by Dennis Gunia (2022)",0 4D6F6E69 746F7220 56322062 79204465 6E6E6973 2047756E 69612028 32303232 2900 496: - 0F26 STR_SyntaxError: 497: - 0F26 73796E3F db "syn?",0 00 498: - 0F2B STR_Unknown: 499: - 0F2B 636D643F db "cmd?",0 00 500: - 0F30 STR_HEXDUMP_HEADER: 501: - 0F30 42415345 db 'BASE 0 1 2 3 4 5 6 7',0 20302020 31202032 20203320 20342020 35202036 20203700 502: 503: .include "xmodem.s" **** include/xmodem.s **** 1: ;------------------------------------------------------------------------- 2: ; Z80 XMODEM implementation by Dennis Gunia 3: ; 2022 - www,dennisgunia.de 4: ; 5: ; important doc: https://web.mit.edu/6.115/www/amulet/xmodem.htm 6: ; http://www.blunk-electronic.de/train-z/pdf/xymodem.pdf 7: ;------------------------------------------------------------------------- 8: 9: ;Symbols 10: - 0001 SYM_SOH equ 0x01 11: - 0004 SYM_EOT equ 0x04 12: - 0006 SYM_ACK equ 0x06 13: - 0015 SYM_NAK equ 0x15 14: - 0017 SYM_ETB equ 0x17 15: - 0018 SYM_CAN equ 0x18 16: - 0043 SYM_C equ 0x43 17: 18: ;Memory locations 19: - 40FB MEM_VAR_BLOCK equ 0x40FB ;last block 20: - 40FC MEM_VAR_TIMEA equ 0x40FC ;timer var (mills) 21: - 40FE MEM_VAR_TIMER equ 0x40FE ;timer var (seconds) 22: - 40FE MEM_INT_VEC_T equ 0x40FE ;interrupt vector table 23: 24: - 4400 MEM_LOC_LOAD equ 0x4400 ;load location for program 25: 26: ;XMODEM routine 27: - 0F4C xmodem_init: 28: 8261+17 0F4C CD1203 call A_RTS_OFF 29: 30: 8278+7 0F4F 3EA7 LD A,10100111b ; Init CTC Channel 3 31: 8285+11 0F51 D306 OUT (CS_CTC_2),A 32: 8296+7 0F53 3E0E LD A,14 ; 1028.57Hz ISR 33: 8303+11 0F55 D306 OUT (CS_CTC_2),A 34: 8314+7 0F57 3E00 LD A,00h ; Set CTC Ch3 Interrupt Vector 35: 8321+11 0F59 D304 OUT (CS_CTC_0),A 36: ;load int vector to ram 37: 8332+10 0F5B 212C10 ld hl,xmodem_int ;CTC Ch3 INT routine 38: 8342+16 0F5E 220442 ld (0x4200 + 0x04),hl 39: ;reset timer vars 40: 8358+10 0F61 210000 ld hl,0x0000 41: 8368+16 0F64 22FC40 ld (MEM_VAR_TIMEA),hl 42: 8384+16 0F67 22FE40 ld (MEM_VAR_TIMER),hl 43: 44: 8400+7 0F6A 3E42 ld a,0x42 ; Set interrupt vector register 45: 8407+9 0F6C ED47 ld i,a 46: 8416+8 0F6E ED5E im 2 ; Z80 Interrupt mode 47: 48: 8424+10 0F70 21A710 ld hl,MSG_START ; Print start banner 49: 8434+17 0F73 CDBF02 call print_str 50: 8451+4 0F76 FB ei ; Enable interrupts 51: ; init done. Continue with xmodem_await_conn 52: 8455+17 0F77 CDDD10 call xmodem_wait 53: 54: - 0F7A xmodem_await_conn: ;Wait for initial connection 55: 8472+7 0F7A 3E43 ld a, SYM_C ;Send C to notify sender, that we want CRC 56: 8479+17 0F7C CD7D10 call xmodem_out 57: 8496+17 0F7F CD5010 call xmodem_read_wait ;Read with timeout 58: 8513+10 0F82 DA7A0F jp c, xmodem_await_conn ;Carry flag set = timeout -> repeat 59: ;else continue 60: 61: - 0F85 xmodem_packet: ;XmodemCRC packet start 62: ;use 1st byte to decide further processing 63: 8523+7 0F85 FE04 cp SYM_EOT ;End of Transmission 64: 8530+10 0F87 CAE30F jp z, xmodem_packet_EOT 65: 8540+7 0F8A FE18 cp SYM_CAN ;Cancel (Force receiver to start sending C's) 66: 8547+10 0F8C CA7A0F jp z, xmodem_await_conn 67: 8557+7 0F8F FE01 cp SYM_SOH ;Start of 68: 8564+10 0F91 CA970F jp z, xmodem_packet_get 69: 70: 8574+10 0F94 C3EB0F jp xmodem_err ;anything else is an error -> abort transmission 71: 72: - 0F97 xmodem_packet_get: ;if first byte == SYM_SOH -> receive block 73: 8584+17 0F97 CD5010 call xmodem_read_wait ;get byte 2 => block ID 74: 8601+10 0F9A DACF10 jp c, xmodem_nak 75: 8611+4 0F9D 47 ld b,a 76: 8615+13 0F9E 32FB40 ld (MEM_VAR_BLOCK), a ;store block id to memory 77: 8628+17 0FA1 CD5010 call xmodem_read_wait ;get byte 3 => block ID complement 78: 8645+10 0FA4 DACF10 jp c, xmodem_nak 79: 8655+4 0FA7 80 add b 80: 8659+7 0FA8 FEFF cp 255 ;both size infos should always sum to 255 81: 8666+10 0FAA C2EB0F jp nz,xmodem_err ;if not 255 then its an error 82: 83: ;calculate block start address in RAM 84: ;multiply by 128 85: ;use more efficient bit-wise operations 86: 8676+4 0FAD 3D dec a ;a-1 to remove 1 sector offset 87: 8680+4 0FAE 78 ld a,b 88: 8684+4 0FAF 1F rra ;shift 1 bit to the right 89: 8688+7 0FB0 E67F and 0x7F 90: 8695+4 0FB2 67 ld h,a 91: 8699+4 0FB3 78 ld a,b 92: 8703+4 0FB4 3D dec a ;a-1 to remove 1 sector offset 93: 8707+4 0FB5 0F rrca ;shift bit0 to bit 7 94: 8711+7 0FB6 E680 and 0x80 ;mask out all other bits 95: 8718+4 0FB8 6F ld l,a 96: ;result: 97: ;hl = 0aaaaaaa a000000 98: 99: 8722+10 0FB9 110044 ld de,MEM_LOC_LOAD 100: 8732+11 0FBC 19 add hl,de ;add calculated offset to base address 101: ;hl now contains the true start address of this sector 102: 103: 8743+7 0FBD 0680 ld b,128 ;preload counter for data baytes 104: 8750+7 0FBF 0E00 ld c,0 ;packet length counter ( used for overflow error ) 105: 106: - 0FC1 xmodem_packet_get_data: ;get 128 data bytes (loop) 107: 8757+11 0FC1 E5 push hl ;push hl onto stack because xmodem_read_wait destroys hl 108: 8768+17 0FC2 CD5010 call xmodem_read_wait ;read byte or timeout 109: 8785+10 0FC5 DACF10 jp c, xmodem_nak ;if timeout -> nak and retry 110: 8795+10 0FC8 E1 pop hl ;restore hl 111: 8805+7 0FC9 77 ld (hl), a ;store received byte in memory 112: 8812+6 0FCA 23 inc hl ;increment pointer 113: 8818+4 0FCB 0C inc c ;increment packet length counter 114: 8822+4 0FCC 05 dec b ;decerment data bytes remmaining 115: 8826+10 0FCD C2C10F jp nz, xmodem_packet_get_data ;if bytes remaining, loop 116: ;else continue with crc bytes 117: 118: - 0FD0 xmodem_packet_get_crc: ;get 16-Bit CRC 119: 8836+17 0FD0 CD5010 call xmodem_read_wait 120: 8853+10 0FD3 DACF10 jp c, xmodem_nak 121: 8863+4 0FD6 57 ld d,a 122: 8867+4 0FD7 0C inc c 123: 8871+17 0FD8 CD5010 call xmodem_read_wait 124: 8888+10 0FDB DACF10 jp c, xmodem_nak 125: 8898+4 0FDE 5F ld e,a 126: 8902+4 0FDF 0C inc c 127: ;de now contains CRC value 128: ;check if c is not bigger than 130 byte (128 data + 2crc) 129: ;TODO if so NACK 130: 131: ;de contains 16-bit CRC 132: ;TODO if crc error NACK 133: 8906+10 0FE0 C3C110 jp xmodem_ack ;ack block -> then jump to start again 134: 135: - 0FE3 xmodem_packet_EOT: ;End of transmission SUB. 136: 8916+7 0FE3 3E06 ld a, SYM_ACK ;Acknowledge EOT 137: 8923+17 0FE5 CD7D10 call xmodem_out 138: 8940+10 0FE8 C32510 jp xmodem_end ;and end xmodem 139: 140: 141: 142: - 0FEB xmodem_err: ;non recoverable error -> abort 143: 8950+7 0FEB 3E18 ld a, SYM_CAN 144: 8957+17 0FED CD7D10 call xmodem_out 145: 8974+7 0FF0 3E18 ld a, SYM_CAN 146: 8981+17 0FF2 CD7D10 call xmodem_out 147: 8998+7 0FF5 3E18 ld a, SYM_CAN 148: 9005+17 0FF7 CD7D10 call xmodem_out 149: 9022+7 0FFA 3E18 ld a, SYM_CAN 150: 9029+17 0FFC CD7D10 call xmodem_out 151: 9046+7 0FFF 3E18 ld a, SYM_CAN 152: 9053+17 1001 CD7D10 call xmodem_out 153: 9070+7 1004 3E18 ld a, SYM_CAN 154: 9077+17 1006 CD7D10 call xmodem_out 155: 9094+7 1009 3E18 ld a, SYM_CAN 156: 9101+17 100B CD7D10 call xmodem_out 157: 9118+7 100E 3E18 ld a, SYM_CAN 158: 9125+17 1010 CD7D10 call xmodem_out 159: 9142+7 1013 3E18 ld a, SYM_CAN 160: 9149+17 1015 CD7D10 call xmodem_out 161: 9166+7 1018 3E18 ld a, SYM_CAN 162: 9173+17 101A CD7D10 call xmodem_out 163: 9190+7 101D 3E18 ld a, SYM_CAN 164: 165: 9197+10 101F 218E10 ld hl, MSG_ERROR 166: 9207+17 1022 CDBF02 call print_str 167: 168: ;overflow to end 169: - 1025 xmodem_end: 170: 9224+4 1025 F3 di ;disable interrupts 171: 9228+17 1026 CDD102 call print_newLine ;print new line 172: 9245+10 1029 C39900 jp PROMPT_BEGIN ;return ti prompt 173: 174: ;isr is used as counter for timeouts 175: - 102C xmodem_int: 176: 9255+4 102C F3 di ;setup ISR (disable further interrupts, exchange registers) 177: 9259+4 102D 08 ex AF,AF' 178: 9263+4 102E D9 exx 179: 180: 9267+16 102F 2AFC40 ld hl,(MEM_VAR_TIMEA) ;millis counter 181: 9283+6 1032 23 inc hl 182: 9289+16 1033 22FC40 ld (MEM_VAR_TIMEA),hl 183: 184: 9305+10 1036 110404 ld de,1028 ;every 1028 millis counter 185: 9315+15 1039 ED52 sbc hl,de 186: 9330+10 103B C24B10 jp nz, xmodem_int_cont ;if less than 1028 millis, loop 187: 188: 9340+10 103E 210000 ld hl,0 ;reset millis 189: 9350+16 1041 22FC40 ld (MEM_VAR_TIMEA),hl 190: 9366+16 1044 2AFE40 ld hl,(MEM_VAR_TIMER) ;incement seconds 191: 9382+6 1047 23 inc hl 192: 9388+16 1048 22FE40 ld (MEM_VAR_TIMER),hl 193: - 104B xmodem_int_cont: ;end isr 194: 9404+4 104B 08 ex AF,AF' ;restore registers 195: 9408+4 104C D9 exx 196: 9412+4 104D FB EI ;enable interrupts 197: 9416+14 104E ED4D reti ;exit ISR 198: 199: 200: 201: 202: 203: ; A returns char 204: ; Carry is set if timeout 205: - 0003 xmodem_read_timeount equ 3 ;3 seconds timeout 206: - 1050 xmodem_read_wait: 207: 9430+4 1050 F3 di 208: 9434+10 1051 210000 ld hl,0 209: 9444+16 1054 22FC40 ld (MEM_VAR_TIMEA),hl 210: 9460+16 1057 22FE40 ld (MEM_VAR_TIMER),hl 211: 9476+4 105A FB ei 212: 9480+17 105B CD1B03 call A_RTS_ON 213: - 105E xmodem_read_wait_loop: 214: ;check timeout 215: 9497+16 105E 2AFE40 ld hl,(MEM_VAR_TIMER) 216: 9513+4 1061 7D ld a, l 217: 9517+7 1062 FE03 cp xmodem_read_timeount 218: 9524+10 1064 CA7B10 jp z, xmodem_read_wait_timeout ;if timeout retry 219: 220: ; if no timeout 221: 9534+4 1067 AF xor a ; a = 0 222: 9538+11 1068 D309 out (CS_SIO_A_C), a ; select reg 0 223: 9549+11 106A DB09 in a, (CS_SIO_A_C) ; read reg 0 224: 9560+7 106C E601 and 1 ; mask D0 (recieve char available) 225: 9567+10 106E CA5E10 jp Z,xmodem_read_wait_loop ; wait if no char 226: 227: ; if char avail 228: 9577+11 1071 DB08 in a, (CS_SIO_A_D) ; read char 229: ;call debug_a_hex 230: 9588+11 1073 F5 push af 231: 9599+17 1074 CD1203 call A_RTS_OFF 232: 9616+10 1077 F1 pop af 233: 9626+4 1078 37 scf 234: 9630+4 1079 3F ccf 235: 9634+10 107A C9 ret ; return 236: - 107B xmodem_read_wait_timeout: 237: 9644+4 107B 37 scf 238: 9648+10 107C C9 ret 239: 240: 241: - 107D xmodem_out: 242: 9658+11 107D D308 out (CS_SIO_A_D), a 243: 9669+17 107F CD8310 call xmodem_wait_out 244: 9686+10 1082 C9 ret 245: 246: - 1083 xmodem_wait_out: 247: 9696+4 1083 97 sub a ;clear a, write into WR0: select RR0 248: 9700+4 1084 3C inc a ;select RR1 249: 9704+11 1085 D309 out (CS_SIO_A_C),A 250: 9715+11 1087 DB09 in A,(CS_SIO_A_C) ;read RRx 251: 9726+8 1089 CB47 bit 0,A 252: 9734+7+5 108B 28F6 jr z,xmodem_wait_out 253: 9741+10 108D C9 ret 254: 255: - 108E MSG_ERROR: 256: - 108E 4572726F db "Error: unexpected byte",13,10,0 723A2075 6E657870 65637465 64206279 74650D0A 00 257: 258: - 10A7 MSG_START: 259: - 10A7 41776169 db "Await xmodem connection",13,10,0 7420786D 6F64656D 20636F6E 6E656374 696F6E0D 0A00 260: 261: 262: - 10C1 xmodem_ack: ;ack routine. Only use when expecting transmission afterwards. 263: 9751+7 10C1 3E06 ld a, SYM_ACK ;send ACK 264: 9758+17 10C3 CD7D10 call xmodem_out 265: 9775+17 10C6 CD5010 call xmodem_read_wait ;wait for response 266: 9792+10 10C9 DAC110 jp c, xmodem_ack ;if timeout repeat 267: 9802+10 10CC C3850F jp xmodem_packet ;if received, continue with new packet 268: 269: - 10CF xmodem_nak: ;nak routine. Only use when expecting transmission afterwards. 270: 9812+7 10CF 3E15 ld a, SYM_NAK ;send NAK 271: 9819+17 10D1 CD7D10 call xmodem_out 272: 9836+17 10D4 CD5010 call xmodem_read_wait ;wait for response 273: 9853+10 10D7 DACF10 jp c, xmodem_nak ;if timeout repeat 274: 9863+10 10DA C3850F jp xmodem_packet ;if received, continue with new packet 275: 276: - 10DD xmodem_wait: 277: 9873+10 10DD 21FF00 ld hl, 0xFF 278: 9883+10 10E0 010100 ld bc, 0x01 279: - 10E3 xmodem_wait_1: 280: 9893+4 10E3 00 nop 281: 9897+4 10E4 00 nop 282: 9901+4 10E5 00 nop 283: 9905+4 10E6 00 nop 284: 9909+15 10E7 ED42 sbc hl,bc 285: 9924+5+6 10E9 C8 ret Z **** main.asm **** 504: 9929+12 10EA 18F7 jr xmodem_wait_1 **** main.asm **** 505: ;.include "debug.s" Statistics: 4 passes 0 jr promotions 330 symbols 4306 bytes Symbol Table: AY0_WRITE_REG 91 145 A_RTS_OFF 312 786 A_RTS_ON 31B 795 CMD_DASM 239 569 CMD_EXEC 12F 303 CMD_IO_READ 21D 541 CMD_IO_WRITE 1F4 500 CMD_SET 1B8 440 CMD_SET_END 1EE 494 CMD_SET_LOOP 1D3 467 CMD_SYNTAX_ERROR 272 626 CMD_VIEW 14E 334 CMD_VIEW_END 1B2 434 CMD_VIEW_ROW 187 391 CMD_VIEW_ROW_LOOP 199 409 CONSOLE_INIT 27E 638 CONSOLE_INIT_CTC 27E 638 CONSOLE_INIT_SIO 286 646 CS_BANK =00 0 CS_CTC_0 =04 4 CS_CTC_1 =05 5 CS_CTC_2 =06 6 CS_CTC_3 =07 7 CS_DIP =01 1 CS_PIO_AC =F6 246 CS_PIO_AD =F4 244 CS_PIO_BC =F7 247 CS_PIO_BD =F5 245 CS_SIO_A_C =09 9 CS_SIO_A_D =08 8 CS_SIO_B_C =0B 11 CS_SIO_B_D =0A 10 DHEX_TO_BYTE 324 804 DHEX_TO_BYTE_FAILED 340 832 EXEC_RST_08 EC4 3780 EXEC_RST_10 EC8 3784 EXEC_RST_18 ED4 3796 HEX_TO_BIN 344 836 HEX_TO_BIN_2 352 850 HEX_TO_INVALID_2 359 857 INT_VEC 1B 27 IO_AY0_ADDR =40 64 IO_AY0_DATA =41 65 IO_AY1_ADDR =42 66 IO_AY1_DATA =43 67 IO_REG0 =20 32 IO_RTC_AMPM =25 37 IO_RTC_CTR_D =2D 45 IO_RTC_CTR_E =2E 46 IO_RTC_CTR_F =2F 47 IO_RTC_DAY0 =26 38 IO_RTC_DAY1 =27 39 IO_RTC_HOUR =24 36 IO_RTC_MIN0 =22 34 IO_RTC_MIN1 =23 35 IO_RTC_MON0 =28 40 IO_RTC_MON1 =29 41 IO_RTC_SEC0 =20 32 IO_RTC_SEC1 =21 33 IO_RTC_WEEK =2C 44 IO_RTC_YEAR1 =2B 43 IO_RTC_YERR0 =2A 42 Includes 27E 638 MEM_INT_VEC_T =40FE 16638 MEM_LOC_LOAD =4400 17408 MEM_VAR_BLOCK =40FB 16635 MEM_VAR_TIMEA =40FC 16636 MEM_VAR_TIMER =40FE 16638 MSG_CLEAR 30A 778 MSG_ERROR 108E 4238 MSG_START 10A7 4263 PRG_RAM_START =4110 16656 PRG_RAM_TOP =FF00 65280 PROG_MEM_START =4000 16384 PROG_ROM_START = 100 256 PROMPT_BEGIN 99 153 PROMPT_BEGIN_READ_BACKSPACE D6 214 PROMPT_BEGIN_READ_LOOP A5 165 PROMPT_BEGIN_READ_PROCESS FC 252 RST_00 00 0 RST_08 08 8 RST_10 10 16 RST_18 18 24 STACK_RAM_TOP =FFFF 65535 START_ROM =00 0 STRCONV_BYTES_TO_HEX 35B 859 STRCONV_BYTES_TO_HEX_1 36A 874 STRCONV_BYTES_TO_HEX_2 374 884 STR_Banner_Start F00 3840 STR_HEXDUMP_HEADER F30 3888 STR_SyntaxError F26 3878 STR_Unknown F2B 3883 SYM_ACK =06 6 SYM_C =43 67 SYM_CAN =18 24 SYM_EOT =04 4 SYM_ETB =17 23 SYM_NAK =15 21 SYM_SOH =01 1 SYS_BUF_START =4010 16400 SYS_RAM_START =4000 16384 VAR_CONSOLE_BAUD=18 24 VAR_CONSOLE_CONF=0F 15 VDP_MEM =80 128 VDP_REG =81 129 beep ED7 3799 beep_pause EF1 3825 dasm_00 ADC 2780 dasm_01 DC8 3528 dasm_02 B62 2914 dasm_03 D9A 3482 dasm_08 BDF 3039 dasm_09 D6D 3437 dasm_0A B44 2884 dasm_0B DB1 3505 dasm_10 B24 2852 dasm_12 B6D 2925 dasm_18 AE7 2791 dasm_1A B4E 2894 dasm_20 B01 2817 dasm_22 E0E 3598 dasm_27 BA7 2983 dasm_28 AFA 2810 dasm_2A DDF 3551 dasm_2F BAB 2987 dasm_30 AF2 2802 dasm_32 B78 2936 dasm_37 BB7 2999 dasm_38 AEB 2795 dasm_3A B58 2904 dasm_3F BB3 2995 dasm_76 BBB 3003 dasm_80C6 C38 3128 dasm_BE BD5 3029 dasm_C3 AE0 2784 dasm_C88E C5E 3166 dasm_C9 B30 2864 dasm_CD B2A 2858 dasm_D9 BEC 3052 dasm_DD B12 2834 dasm_DD_01 DCF 3535 dasm_DD_09 D88 3464 dasm_DD_22 E24 3620 dasm_DD_23 D9F 3487 dasm_DD_2A DF6 3574 dasm_DD_2B DB6 3510 dasm_DD_34 D38 3384 dasm_DD_35 D55 3413 dasm_DD_86 C40 3136 dasm_DD_8E C66 3174 dasm_DD_96 C89 3209 dasm_DD_9E CA9 3241 dasm_DD_A6 CCA 3274 dasm_DD_AE D01 3329 dasm_DD_B6 CE6 3302 dasm_DD_BE D1D 3357 dasm_DD_E1 E76 3702 dasm_DD_E3 BFC 3068 dasm_DD_E5 E60 3680 dasm_DD_F9 E46 3654 dasm_E1 E70 3696 dasm_E3 BF0 3056 dasm_E5 E5A 3674 dasm_E9 B09 2825 dasm_ED_42 D7F 3455 dasm_ED_43 E1A 3610 dasm_ED_44 BAF 2991 dasm_ED_45 B3A 2874 dasm_ED_46 BC6 3014 dasm_ED_4A D76 3446 dasm_ED_4B DEB 3563 dasm_ED_4D B35 2869 dasm_ED_56 BCB 3019 dasm_ED_5E BD0 3024 dasm_ED_A0 C14 3092 dasm_ED_A1 C26 3110 dasm_ED_A8 C1D 3101 dasm_ED_A9 C2F 3119 dasm_ED_B0 C18 3096 dasm_ED_B1 C2A 3114 dasm_ED_B8 C21 3105 dasm_ED_B9 C33 3123 dasm_F3 BC0 3008 dasm_F9 E3C 3644 dasm_FB BC3 3011 dasm_FD B1B 2843 dasm_FD_01 DD7 3543 dasm_FD_09 D91 3473 dasm_FD_22 E30 3632 dasm_FD_23 DA8 3496 dasm_FD_2A E02 3586 dasm_FD_2B DBF 3519 dasm_FD_34 D44 3396 dasm_FD_35 D61 3425 dasm_FD_86 C4F 3151 dasm_FD_8E C75 3189 dasm_FD_96 C95 3221 dasm_FD_9E CB7 3255 dasm_FD_A6 CD6 3286 dasm_FD_AE D0D 3341 dasm_FD_B6 CF1 3313 dasm_FD_BE D28 3368 dasm_FD_E1 E7E 3710 dasm_FD_E3 C08 3080 dasm_FD_E5 E68 3688 dasm_FD_F9 E50 3664 dasm_FF B3F 2879 dasm_UU E86 3718 dasm_UW E8A 3722 dasm__AND CC5 3269 dasm__CP D19 3353 dasm__DEC D50 3408 dasm__ED_47 B97 2967 dasm__ED_4F B9F 2975 dasm__ED_57 B87 2951 dasm__ED_5F B8F 2959 dasm__INC D33 3379 dasm__LD B83 2947 dasm__OR CE2 3298 dasm__SBC CA1 3233 dasm__SUB C84 3204 dasm__XOR CFC 3324 dasm_opcode_table 684 1668 dasm_print16hex_addr 4B1 1201 dasm_print8hex 4C9 1225 dasm_printFlags_table E8F 3727 dasm_printRegister8_table E9F 3743 dasm_printRegister8_table_HL EBF 3775 dasm_printRegisterIX_table EA7 3751 dasm_printRegisterIY_table EAF 3759 dasm_printRegisterSP_table EB7 3767 disassemble 375 885 disassemble_continue 45B 1115 disassemble_err 44B 1099 disassemble_next 379 889 disassemble_print_opcode_params_end 448 1096 disassemble_print_opcode_params_loop 3F4 1012 disassemble_print_opcode_raw 3B6 950 disassemble_print_opcode_raw_fill 3CA 970 disassemble_table_first_match 48D 1165 disassemble_table_found 4A7 1191 disassemble_table_notfound 4AB 1195 disassemble_table_seek 469 1129 disassemble_table_seek_loop 46D 1133 mon_start_complete 7E 126 mon_start_init_ctc 50 80 mon_start_init_serial 67 103 mon_start_init_sound 50 80 mon_start_ram 6A 106 mon_start_ram_loop 73 115 mon_var_template 44 68 mon_var_template_end 402A 16426 param_01 4D7 1239 param_02 4FE 1278 param_03 51B 1307 param_03_done 553 1363 param_03_neg 53C 1340 param_04 557 1367 param_04_i 567 1383 param_05 56D 1389 param_06 57A 1402 param_07 594 1428 param_08 5A1 1441 param_09 5B6 1462 param_09_0A 5BC 1468 param_0A 5AD 1453 param_10 5CB 1483 param_11 5DB 1499 param_11_12 5EA 1514 param_11_12_all 60A 1546 param_11_12_def 5FD 1533 param_11_12_ix 602 1538 param_11_12_iy 607 1543 param_12 5E3 1507 param_13 61B 1563 param_80 63A 1594 param_80_seek 641 1601 param_81 631 1585 param_comma 675 1653 param_printRegister 650 1616 param_printRegisterA 66E 1646 param_printRegisterHL 666 1638 print_a_hex 2E7 743 print_char 2B7 695 print_clear 2CA 714 print_newLine 2D1 721 print_str 2BF 703 print_str_end 2C9 713 print_wait_out 2DC 732 read_char 2F8 760 var_buffer 4029 16425 var_buffer_len 4000 16384 var_bytes_count=411A 16666 var_curserchar 4006 16390 var_curserlastaddr 4007 16391 var_curseron 4005 16389 var_curserstate 4004 16388 var_curserx 4002 16386 var_cursery 4003 16387 var_last_char 4001 16385 var_opcode =4114 16660 var_opcode_length=4116 16662 var_opcode_pcount=4119 16665 var_opcode_start=4110 16656 var_opcode_string=4117 16663 var_opcode_table=4112 16658 var_opcode_x =4115 16661 var_ps2mem 4019 16409 var_scratch 4009 16393 xmodem_ack 10C1 4289 xmodem_await_conn F7A 3962 xmodem_end 1025 4133 xmodem_err FEB 4075 xmodem_init F4C 3916 xmodem_int 102C 4140 xmodem_int_cont 104B 4171 xmodem_nak 10CF 4303 xmodem_out 107D 4221 xmodem_packet F85 3973 xmodem_packet_EOT FE3 4067 xmodem_packet_get F97 3991 xmodem_packet_get_crc FD0 4048 xmodem_packet_get_data FC1 4033 xmodem_read_timeount=03 3 xmodem_read_wait 1050 4176 xmodem_read_wait_loop 105E 4190 xmodem_read_wait_timeout 107B 4219 xmodem_wait 10DD 4317 xmodem_wait_1 10E3 4323 xmodem_wait_out 1083 4227