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: - 0060 IO_PIO_0_A_D equ 0x60 44: - 0061 IO_PIO_0_A_C equ 0x61 45: - 0062 IO_PIO_0_B_D equ 0x62 46: - 0063 IO_PIO_0_B_C equ 0x63 47: 48: - 0064 IO_PIO_1_A_D equ 0x64 ;PS2 49: - 0065 IO_PIO_1_A_C equ 0x65 50: - 0066 IO_PIO_1_B_D equ 0x66 51: - 0067 IO_PIO_1_B_C equ 0x67 **** 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 C3B60E jp EXEC_RST_08 27: 28: - 0010 org 0x0010 29: - 0010 RST_10 ;receive char 30: 20+10 0010 C3BA0E jp EXEC_RST_10 31: 32: - 0018 org 0x0018 33: - 0018 RST_18 ;Buffer length 34: 30+10 0018 C3C60E 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: 50+4 0053 AF xor a 97: ;ld i, a 98: ;im 2 ;set int mode 2 99: 100: 54+13 0054 320440 ld (var_curserstate),a 101: 67+13 0057 320540 ld (var_curseron),a 102: 80+7 005A 3E20 ld a, " " 103: 87+13 005C 320640 ld (var_curserchar),a 104: 105: 106: ;ei ; Enable Interrupts 107: 108: ;jr mon_start_ram ;skip serial, cause not used atm 109: - 005F mon_start_init_serial: 110: 100+17 005F CD7002 call CONSOLE_INIT 111: - 0062 mon_start_ram: 112: 117+10 0062 214400 ld hl,mon_var_template 113: 127+10 0065 112A40 ld de,mon_var_template_end 114: 137+10 0068 010040 ld bc,SYS_RAM_START 115: - 006B mon_start_ram_loop: 116: 147+7 006B 7E ld a,(hl) ;copy values 117: 154+7 006C 02 ld (bc),a 118: 161+6 006D 23 inc hl 119: 167+6 006E 03 inc bc 120: 173+11 006F E5 push hl ;check if end is reached 121: 184+15 0070 ED52 sbc hl,de 122: 199+10 0072 E1 pop hl 123: 209+10 0073 C26B00 jp nz, mon_start_ram_loop 124: ;template copy done 125: 126: - 0076 mon_start_complete: 127: 128: ;call keyboard_init_io 129: ;call vdpconsole_init 130: 131: ;call print_str 132: 133: 134: ;jp splash_run 135: 136: ;jp ps2demo_run 137: ;call debug_init 138: ;call vdp_cursor_on 139: ;jp COLD 140: 141: 219+17 0076 CDBC02 call print_clear 142: 236+10 0079 21C90E ld hl, [STR_Banner_Start] 143: 246+17 007C CDB102 call print_str 144: 145: ;halt 146: 147: ;call vdp_cursor_on 148: 263+17 007F CD8B00 call PROMPT_BEGIN 149: 150: ;halt CPU if prompt exits 151: 280+4 0082 76 halt 152: 153: ; Misc Functions 154: - 0083 AY0_WRITE_REG: 155: 284+4 0083 47 LD B,A 156: 288+4 0084 7A LD A,D 157: 292+11 0085 D340 OUT (IO_AY0_ADDR),A 158: 303+4 0087 78 LD A,B 159: 307+11 0088 D341 OUT (IO_AY0_DATA),A 160: 318+10 008A C9 RET 161: 162: - 008B PROMPT_BEGIN: 163: 328+17 008B CDC302 call print_newLine 164: ;call A_RTS_ON 165: 345+7 008E 3E3E ld a,'>' 166: 352+17 0090 CDA902 call print_char 167: 369+4 0093 AF xor a ;reset buffer len 168: 373+13 0094 320040 ld (var_buffer_len),a 169: 170: - 0097 PROMPT_BEGIN_READ_LOOP: 171: 386+17 0097 CDEA02 call read_char 172: ;call keybd_read_ascii 173: 403+10 009A CA9700 jp z, PROMPT_BEGIN_READ_LOOP ; wait until char avail 174: 413+11 009D F5 push af 175: 424+10 009E F1 pop af 176: ; process special ops 177: 434+7 009F FE0D cp 13 ; enter 178: 441+10 00A1 CAEE00 jp z,PROMPT_BEGIN_READ_PROCESS 179: 451+7 00A4 FE0A cp 10 180: 458+10 00A6 CA9700 jp z, PROMPT_BEGIN_READ_LOOP; skip LF for file load 181: 468+7 00A9 FE08 cp 0x08 ; backspace 0x08 VT102 0x7f Putty 182: 475+10 00AB CAC800 jp z,PROMPT_BEGIN_READ_BACKSPACE 183: 184: 485+11 00AE F5 push af 185: ; a contains latest char 186: 496+10 00AF 212940 ld hl,[var_buffer] 187: 506+7 00B2 1600 ld d,0 188: 513+13 00B4 3A0040 ld a,(var_buffer_len) 189: 526+4 00B7 5F ld e,a 190: 530+11 00B8 19 add hl,de ;hl now contains pointer to last position in buffer 191: 541+4 00B9 3C inc a 192: 545+13 00BA 320040 ld (var_buffer_len),a ;store incremented buffer length 193: 194: 558+10 00BD F1 pop af 195: 568+7 00BE 77 ld (hl),a 196: 575+17 00BF CDA902 call print_char 197: 592+6 00C2 23 inc hl 198: 598+4 00C3 AF xor a ;a = 0 199: 602+7 00C4 77 ld (hl),a ;always add null termination after last char 200: 609+10 00C5 C39700 jp PROMPT_BEGIN_READ_LOOP 201: 202: - 00C8 PROMPT_BEGIN_READ_BACKSPACE: 203: 619+13 00C8 3A0040 ld a,(var_buffer_len) 204: 632+4 00CB A7 and a 205: 636+10 00CC CA9700 jp z, PROMPT_BEGIN_READ_LOOP ; do not continue if already at char 0 206: 646+4 00CF 3D dec a ;decrement length 207: 650+13 00D0 320040 ld (var_buffer_len),a ;and store it 208: 663+4 00D3 5F ld e,a ;load de with decremented value 209: 667+7 00D4 1600 ld d,0 210: 674+10 00D6 212940 ld hl,[var_buffer] 211: 684+11 00D9 19 add hl,de ;hl now contains pointer to last position in buffer 212: 695+4 00DA AF xor a ; store null byte to current location 213: 699+7 00DB 77 ld (hl),a 214: ;call print_delete 215: 706+7 00DC 3E08 ld a, 0x08 216: 713+17 00DE CDA902 call print_char 217: 730+7 00E1 3E20 ld a, 0x20 218: 737+17 00E3 CDA902 call print_char 219: 754+7 00E6 3E08 ld a, 0x08 220: 761+17 00E8 CDA902 call print_char 221: 778+10 00EB C39700 jp PROMPT_BEGIN_READ_LOOP 222: 223: - 00EE PROMPT_BEGIN_READ_PROCESS: 224: ;call print_newLine 225: ;ld hl,var_buffer 226: ;call print_str 227: 228: 788+13 00EE 3A2940 ld a,([var_buffer]) 229: 801+7 00F1 FE24 cp '$' ;jump to addr 230: 808+10 00F3 CA2101 jp z, CMD_EXEC 231: 818+7 00F6 FE3F cp '?' ;print hexdump 232: 825+10 00F8 CA4001 jp z, CMD_VIEW 233: 835+7 00FB FE21 cp '!' ;set memory 234: 842+10 00FD CAAA01 jp z, CMD_SET 235: 852+7 0100 FE69 cp 'i' ;in IO 236: 859+10 0102 CA0F02 jp z, CMD_IO_READ 237: 869+7 0105 FE6F cp 'o' ;out IO 238: 876+10 0107 CAE601 jp z, CMD_IO_WRITE 239: 886+7 010A FE64 cp 'd' ;disassemble 240: 893+10 010C CA2B02 jp z, CMD_DASM 241: 903+7 010F FE78 cp 'x' ;start xmodem 242: 910+10 0111 CA150F jp z, xmodem_init 243: 244: 245: 920+17 0114 CDC302 call print_newLine 246: 937+10 0117 21F40E ld hl, [STR_Unknown] 247: 947+17 011A CDB102 call print_str 248: 964+10 011D C38B00 jp PROMPT_BEGIN 249: 250: 974+10 0120 C9 ret 251: 252: - 0121 CMD_EXEC: 253: 984+4 0121 AF xor a ;write null byte to buffer pos 0 to prevent reexecute the last command 254: 988+13 0122 322940 ld (var_buffer),a 255: 256: 1001+10 0125 212A40 ld hl,var_buffer+1 ;load 1st byte 257: 1011+17 0128 CD1603 call DHEX_TO_BYTE 258: 1028+4 012B 47 ld b,a ;store result in b 259: 1032+4 012C 7B ld a,e ;check for error 260: 1036+4 012D A7 and a 261: 1040+10 012E C26402 jp nz, CMD_SYNTAX_ERROR 262: 263: 1050+10 0131 212C40 ld hl,var_buffer+3 ;load 2nd byte 264: 1060+17 0134 CD1603 call DHEX_TO_BYTE 265: 1077+4 0137 4F ld c,a 266: 1081+4 0138 7B ld a,e ;check for error 267: 1085+4 0139 A7 and a 268: 1089+10 013A C26402 jp nz, CMD_SYNTAX_ERROR 269: 270: 1099+4 013D 60 ld h,b 271: 1103+4 013E 69 ld l,c 272: 1107+4 013F E9 jp (hl) 273: 274: - 0140 CMD_VIEW: 275: 1111+17 0140 CDC302 call print_newLine 276: 1128+10 0143 212A40 ld hl,var_buffer+1 ;load 1st byte 277: 1138+17 0146 CD1603 call DHEX_TO_BYTE 278: 1155+4 0149 47 ld b,a ;store result in b 279: 1159+4 014A 7B ld a,e ;check for error 280: 1163+4 014B A7 and a 281: 1167+10 014C C26402 jp nz, CMD_SYNTAX_ERROR 282: 283: 1177+10 014F 212C40 ld hl,var_buffer+3 ;load 2nd byte 284: 1187+17 0152 CD1603 call DHEX_TO_BYTE 285: 1204+4 0155 4F ld c,a 286: 1208+4 0156 7B ld a,e ;check for error 287: 1212+4 0157 A7 and a 288: 1216+10 0158 C26402 jp nz, CMD_SYNTAX_ERROR 289: 290: 291: 1226+13 015B 3A2E40 ld a,(var_buffer+5) 292: 1239+7 015E FE20 cp ' ' 293: 1246+10 0160 C26402 jp nz, CMD_SYNTAX_ERROR 294: 295: 1256+10 0163 212F40 ld hl,var_buffer+6 ;load length 296: 1266+17 0166 CD1603 call DHEX_TO_BYTE 297: 1283+11 0169 F5 push af 298: 1294+4 016A 7B ld a,e ;check for error 299: 1298+4 016B A7 and a 300: 1302+10 016C C26402 jp nz, CMD_SYNTAX_ERROR 301: 302: ;draw header 303: 1312+10 016F 21F90E ld hl,[STR_HEXDUMP_HEADER] 304: 1322+17 0172 CDB102 call print_str 305: 306: 1339+10 0175 F1 pop af 307: ;loading vars done. display results 308: 1349+4 0176 60 ld h, b ;pointer to current byte 309: 1353+4 0177 69 ld l, c ;pointer to current byte 310: 1357+4 0178 47 ld b, a ;bytes counter 311: 312: ;draw row 313: - 0179 CMD_VIEW_ROW: 314: 1361+17 0179 CDC302 call print_newLine 315: 1378+4 017C 7C ld a,h ;print start 316: 1382+17 017D CDD902 call print_a_hex 317: 1399+4 0180 7D ld a,l 318: 1403+17 0181 CDD902 call print_a_hex 319: 1420+7 0184 3E20 ld a, ' ' 320: 1427+17 0186 CDA902 call print_char 321: 1444+7 0189 0E08 ld c, 8 ;column counter 322: - 018B CMD_VIEW_ROW_LOOP: 323: 1451+7 018B 7E ld a,(hl) 324: 1458+17 018C CDD902 call print_a_hex 325: 326: 1475+6 018F 23 inc hl ;increment pointer 327: 1481+4 0190 05 dec b ;decrement byte counter 328: 1485+4 0191 0D dec c ;decrement column counter 329: 330: 1489+4 0192 78 ld a,b 331: 1493+4 0193 A7 and a 332: 1497+10 0194 CAA401 jp z,CMD_VIEW_END ;if byte counter = 0 -> end reached 333: 334: 1507+4 0197 79 ld a,c 335: 1511+4 0198 A7 and a 336: 1515+10 0199 CA7901 jp z,CMD_VIEW_ROW ;else if column counter = 0 -> 16 chars printed. next row 337: 338: 1525+7 019C 3E20 ld a, ' ' 339: 1532+17 019E CDA902 call print_char 340: 1549+10 01A1 C38B01 jp CMD_VIEW_ROW_LOOP ;else 341: - 01A4 CMD_VIEW_END: 342: 1559+17 01A4 CDC302 call print_newLine 343: 1576+10 01A7 C38B00 jp PROMPT_BEGIN 344: 345: - 01AA CMD_SET: 346: 1586+10 01AA 212A40 ld hl,var_buffer+1 ;load 1st byte 347: 1596+17 01AD CD1603 call DHEX_TO_BYTE 348: 1613+4 01B0 47 ld b,a ;store result in b 349: 1617+4 01B1 7B ld a,e ;check for error 350: 1621+4 01B2 A7 and a 351: 1625+10 01B3 C26402 jp nz, CMD_SYNTAX_ERROR 352: 353: 1635+10 01B6 212C40 ld hl,var_buffer+3 ;load 2nd byte 354: 1645+17 01B9 CD1603 call DHEX_TO_BYTE 355: 1662+4 01BC 4F ld c,a 356: 1666+4 01BD 7B ld a,e ;check for error 357: 1670+4 01BE A7 and a 358: 1674+10 01BF C26402 jp nz, CMD_SYNTAX_ERROR 359: ;bc now contains the start address 360: 361: 1684+10 01C2 212E40 ld hl,var_buffer+5 362: - 01C5 CMD_SET_LOOP: 363: 1694+7 01C5 7E ld a,(hl) 364: 1701+7 01C6 FE00 cp 0 ;if 0 then end 365: 1708+10 01C8 CAE001 jp z, CMD_SET_END 366: 1718+7 01CB FE20 cp ' ' 367: 1725+10 01CD C26402 jp nz, CMD_SYNTAX_ERROR 368: 1735+6 01D0 23 inc hl ;next byte 369: 1741+17 01D1 CD1603 call DHEX_TO_BYTE 370: 1758+7 01D4 02 ld (bc),a ;load byte to 371: 1765+4 01D5 7B ld a,e 372: 1769+4 01D6 A7 and a 373: 1773+10 01D7 C26402 jp nz, CMD_SYNTAX_ERROR 374: 1783+6 01DA 03 inc bc 375: 1789+6 01DB 23 inc hl 376: 1795+6 01DC 23 inc hl 377: 1801+10 01DD C3C501 jp CMD_SET_LOOP 378: - 01E0 CMD_SET_END: 379: 1811+17 01E0 CDC302 call print_newLine 380: 1828+10 01E3 C38B00 jp PROMPT_BEGIN 381: 382: 383: - 01E6 CMD_IO_WRITE: 384: 1838+10 01E6 212A40 ld hl,var_buffer+1 ;load 1st byte 385: 1848+17 01E9 CD1603 call DHEX_TO_BYTE 386: 1865+4 01EC 4F ld c,a ;store result in b 387: 1869+4 01ED 7B ld a,e ;check for error 388: 1873+4 01EE A7 and a 389: 1877+10 01EF C26402 jp nz, CMD_SYNTAX_ERROR 390: 391: 1887+13 01F2 3A2C40 ld a,(var_buffer+3) 392: 1900+7 01F5 FE20 cp ' ' 393: 1907+10 01F7 C26402 jp nz, CMD_SYNTAX_ERROR 394: 395: 1917+10 01FA 212D40 ld hl,var_buffer+4 ;load 1st byte 396: 1927+17 01FD CD1603 call DHEX_TO_BYTE 397: 1944+11 0200 F5 push af 398: 1955+4 0201 7B ld a,e ;check for error 399: 1959+4 0202 A7 and a 400: 1963+10 0203 C26402 jp nz, CMD_SYNTAX_ERROR 401: 402: 1973+10 0206 F1 pop af 403: 1983+12 0207 ED79 out (c),a 404: 1995+17 0209 CDC302 call print_newLine 405: 2012+10 020C C38B00 jp PROMPT_BEGIN 406: 407: - 020F CMD_IO_READ: 408: 2022+10 020F 212A40 ld hl,var_buffer+1 ;load 1st byte 409: 2032+17 0212 CD1603 call DHEX_TO_BYTE 410: 2049+4 0215 4F ld c,a ;store result in b 411: 2053+4 0216 7B ld a,e ;check for error 412: 2057+4 0217 A7 and a 413: 2061+10 0218 C26402 jp nz, CMD_SYNTAX_ERROR 414: 415: 2071+12 021B ED78 in a,(c) 416: 2083+11 021D F5 push af 417: 2094+17 021E CDC302 call print_newLine 418: 2111+10 0221 F1 pop af 419: 2121+17 0222 CDD902 call print_a_hex 420: 2138+17 0225 CDC302 call print_newLine 421: 2155+10 0228 C38B00 jp PROMPT_BEGIN 422: 423: - 022B CMD_DASM: 424: 2165+17 022B CDC302 call print_newLine 425: 2182+10 022E 212A40 ld hl,var_buffer+1 ;load 1st byte 426: 2192+17 0231 CD1603 call DHEX_TO_BYTE 427: 2209+4 0234 47 ld b,a ;store result in b 428: 2213+4 0235 7B ld a,e ;check for error 429: 2217+4 0236 A7 and a 430: 2221+10 0237 C26402 jp nz, CMD_SYNTAX_ERROR 431: 432: 2231+10 023A 212C40 ld hl,var_buffer+3 ;load 2nd byte 433: 2241+17 023D CD1603 call DHEX_TO_BYTE 434: 2258+4 0240 4F ld c,a 435: 2262+4 0241 7B ld a,e ;check for error 436: 2266+4 0242 A7 and a 437: 2270+10 0243 C26402 jp nz, CMD_SYNTAX_ERROR 438: 439: 440: 2280+13 0246 3A2E40 ld a,(var_buffer+5) 441: 2293+7 0249 FE20 cp ' ' 442: 2300+10 024B C26402 jp nz, CMD_SYNTAX_ERROR 443: 444: 2310+10 024E 212F40 ld hl,var_buffer+6 ;load length 445: 2320+17 0251 CD1603 call DHEX_TO_BYTE 446: 2337+11 0254 F5 push af 447: 2348+4 0255 7B ld a,e ;check for error 448: 2352+4 0256 A7 and a 449: 2356+10 0257 C26402 jp nz, CMD_SYNTAX_ERROR 450: 451: 2366+4 025A 60 ld h,b 452: 2370+4 025B 69 ld l,c 453: 454: 2374+10 025C F1 pop af ;restore af 455: 2384+4 025D 47 ld b,a 456: 457: 2388+17 025E CD6703 call disassemble 458: 459: 460: 2405+10 0261 C38B00 jp PROMPT_BEGIN 461: 462: - 0264 CMD_SYNTAX_ERROR: 463: 2415+17 0264 CDC302 call print_newLine 464: 2432+10 0267 21EF0E ld hl, [STR_SyntaxError] 465: 2442+17 026A CDB102 call print_str 466: 2459+10 026D C38B00 jp PROMPT_BEGIN 467: 468: 469: 470: - 0270 Includes: 471: ;.include "bootldr.s" 472: .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: - 0270 CONSOLE_INIT: 10: - 0270 CONSOLE_INIT_CTC: 11: ;LD A,00001111b ; Set /16 Divider, CPU Trigger, Time COnstant Follows 12: 2469+7 0270 3E4F LD A,01001111b ; External Trigger, Time COnstant Follows 13: 2476+11 0272 D304 OUT (CS_CTC_0),A 14: 2487+11 0274 DB01 IN A,(CS_DIP) ; Read BAUD from DIP-Switches 15: ;LD A,39 16: 2498+11 0276 D304 OUT (CS_CTC_0),A 17: - 0278 CONSOLE_INIT_SIO: 18: 2509+7 0278 3E30 LD A,00110000b ;write into WR0: error reset, select WR0 19: 2516+11 027A D309 OUT (CS_SIO_A_C),A 20: 2527+7 027C 3E18 LD a,018h ;write into WR0: channel reset 21: 2534+11 027E D309 OUT (CS_SIO_A_C),A 22: 2545+7 0280 3E04 LD a,004h ;write into WR0: select WR4 23: 2552+11 0282 D309 OUT (CS_SIO_A_C),A 24: 2563+7 0284 3E44 LD a,01000100b ;write into WR4: clkx16,1 stop bit, no parity 25: 2570+11 0286 D309 OUT (CS_SIO_A_C),A 26: 2581+7 0288 3E05 LD a,005h ;write into WR0: select WR5 27: 2588+11 028A D309 OUT (CS_SIO_A_C),A 28: 2599+7 028C 3EE8 LD a,11101000b ;DTR inactive, TX 8bit, BREAK off, TX on, RTS inactive 29: 2606+11 028E D309 OUT (CS_SIO_A_C),A 30: 2617+7 0290 3E01 LD a,01h ;write into WR0: select WR1 31: 2624+11 0292 D309 OUT (CS_SIO_A_C),A 32: 2635+7 0294 3E04 LD a,00000100b ;no interrupt in CH B, special RX condition affects vect 33: 2642+11 0296 D309 OUT (CS_SIO_A_C),A 34: 2653+7 0298 3E02 LD a,02h ;write into WR0: select WR2 35: 2660+11 029A D309 OUT (CS_SIO_A_C),A 36: 2671+7 029C 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: 2678+11 029E D309 OUT (CS_SIO_A_C),A 39: 2689+7 02A0 3E03 LD a,003h ;write into WR0: select WR3 40: 2696+11 02A2 D309 OUT (CS_SIO_A_C),A 41: 2707+7 02A4 3EC1 LD a,0C1h ;RX 8bit, auto enable off, RX on 42: 2714+11 02A6 D309 OUT (CS_SIO_A_C),A 43: ;Channel A RX active 44: 2725+10 02A8 C9 RET 45: 46: ; A contains char 47: ; Destroys A 48: - 02A9 print_char: 49: 2735+11 02A9 F5 push af 50: 2746+11 02AA D308 out (CS_SIO_A_D),a 51: 2757+17 02AC CDCE02 call print_wait_out 52: 2774+10 02AF F1 pop af 53: ;call print_char 54: 2784+10 02B0 C9 ret 55: ; HL contains pointer to string 56: ; Destroy A, HL 57: 58: - 02B1 print_str: 59: 2794+7 02B1 7E ld a, (hl) 60: 2801+4 02B2 B7 or a 61: 2805+7+5 02B3 2806 jr z,print_str_end 62: 2812+17 02B5 CDA902 call print_char 63: 2829+6 02B8 23 inc hl 64: 2835+12 02B9 18F6 jr print_str 65: - 02BB print_str_end: 66: 2847+10 02BB C9 ret 67: 68: - 02BC print_clear: 69: 2857+10 02BC 21FC02 ld hl, [MSG_CLEAR] 70: 2867+17 02BF CDB102 call print_str 71: 2884+10 02C2 C9 ret 72: 73: - 02C3 print_newLine: 74: 2894+7 02C3 3E0A ld a,10 75: 2901+17 02C5 CDA902 call print_char 76: 2918+7 02C8 3E0D ld a,13 77: 2925+17 02CA CDA902 call print_char 78: 2942+10 02CD C9 ret 79: ; destroys a 80: - 02CE print_wait_out: 81: ; check for TX buffer empty 82: 2952+4 02CE 97 sub a ;clear a, write into WR0: select RR0 83: 2956+4 02CF 3C inc a ;select RR1 84: 2960+11 02D0 D309 out (CS_SIO_A_C),A 85: 2971+11 02D2 DB09 in A,(CS_SIO_A_C) ;read RRx 86: 2982+8 02D4 CB47 bit 0,A 87: 2990+7+5 02D6 28F6 jr z,print_wait_out 88: 2997+10 02D8 C9 ret 89: 90: - 02D9 print_a_hex: 91: 3007+11 02D9 F5 push af 92: 3018+11 02DA C5 push bc 93: 3029+11 02DB D5 push de 94: 3040+17 02DC CD4D03 call STRCONV_BYTES_TO_HEX 95: 3057+4 02DF 78 ld a,b 96: 3061+17 02E0 CDA902 call print_char 97: 3078+4 02E3 79 ld a,c 98: 3082+17 02E4 CDA902 call print_char 99: 3099+10 02E7 D1 pop de 100: 3109+10 02E8 C1 pop bc 101: 3119+10 02E9 F1 pop af 102: 103: - 02EA read_char: 104: 3129+17 02EA CD0D03 call A_RTS_ON 105: 3146+4 02ED 00 nop 106: 3150+4 02EE AF xor a ; a = 0 107: 3154+11 02EF D309 out (CS_SIO_A_C), a ; select reg 0 108: 3165+11 02F1 DB09 in a, (CS_SIO_A_C) ; read reg 0 109: 3176+7 02F3 E601 and 1 ; mask D0 (recieve char available) 110: 3183+17 02F5 CD0403 call A_RTS_OFF 111: 3200+5+6 02F8 C8 ret Z ; return 0 if no char 112: 3205+11 02F9 DB08 in a, (CS_SIO_A_D) ; read char if avail 113: 3216+10 02FB C9 ret ; return 114: 115: ;MSG_CRSR_0: 116: ; db 0x1B, "[?25h",0 117: ;MSG_CRSR_1: 118: ; db 0x1B, "[?25l",0 119: - 02FC MSG_CLEAR: 120: - 02FC 1B5B324A db 27, '[2J', 27, '[H',0 1B5B4800 121: 122: 123: 124: ; Serial Util Functions 125: - 0304 A_RTS_OFF: 126: 3226+7 0304 3E05 ld a,005h ;write into WR0: select WR5 127: 3233+11 0306 D309 out (CS_SIO_A_C),A 128: 3244+7 0308 3E68 ld a,068h ;DTR inactiveh, TX 8bit, BREAK off, TX on, RTS inactive 129: 3251+11 030A D309 out (CS_SIO_A_C),A 130: 3262+10 030C C9 ret 131: - 030D A_RTS_ON: 132: 3272+7 030D 3E05 ld a,005h ;write into WR0: select WR5 133: 3279+11 030F D309 out (CS_SIO_A_C),A 134: 3290+7 0311 3EEA ld a,0EAh ;DTR active, TX 8bit, BREAK off, TX on, RTS active 135: 3297+11 0313 D309 out (CS_SIO_A_C),A **** main.asm **** 473: 3308+10 0315 C9 ret 474: .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: - 0316 DHEX_TO_BYTE: 7: 3318+11 0316 E5 PUSH HL ;Backup pointer 8: ; Load First Byte 9: 3329+7 0317 7E LD A,(HL) ;Load first char (high) 10: 3336+17 0318 CD3603 CALL HEX_TO_BIN ;Conv chart to 4bit 11: 3353+7+5 031B 3815 jr C, DHEX_TO_BYTE_FAILED ;If error jmp to DHEX_TO_BYTE_FAILED 12: 3360+8 031D CB27 SLA A ;shift result to upper 4 bits 13: 3368+8 031F CB27 SLA A 14: 3376+8 0321 CB27 SLA A 15: 3384+8 0323 CB27 SLA A 16: 3392+4 0325 57 LD D,A ;store result in D 17: 18: 3396+6 0326 23 INC HL ;next byte 19: 3402+7 0327 7E LD A,(HL) ;load 2nd char (lower) 20: 3409+17 0328 CD3603 CALL HEX_TO_BIN ;Conv chart to 4bit 21: 3426+7+5 032B 3805 jr C, DHEX_TO_BYTE_FAILED ;If error jmp to DHEX_TO_BYTE_FAILED 22: 3433+4 032D B2 OR D ;merge D with accumulator 23: 24: 3437+10 032E E1 POP HL ;restor original pointer 25: 3447+7 032F 1E00 LD E,0x00 ;set error to 0x00 = no error 26: 3454+10 0331 C9 RET 27: - 0332 DHEX_TO_BYTE_FAILED: 28: 3464+7 0332 1EFF LD E,0xFF ;set error to oxFF 29: ;LD A,0x00 30: 3471+10 0334 E1 POP HL 31: 3481+10 0335 C9 RET 32: 33: ; REG A Contains CHAR-Low 34: ; If failed, Carry is set 35: - 0336 HEX_TO_BIN: 36: 3491+7 0336 D630 SUB 48 ; 0 is 0 37: 3498+10 0338 EA4B03 jp PE, HEX_TO_INVALID_2; to low (SUB overflow) 38: 3508+7 033B FE0A CP 10 ; Value is between 0 and 9 39: 3515+7+5 033D 3805 JR C, HEX_TO_BIN_2 40: 3522+7 033F D607 SUB 7 41: 3529+10 0341 EA4B03 jp PE, HEX_TO_INVALID_2; to low (SUB overflow) 42: - 0344 HEX_TO_BIN_2: 43: 3539+7 0344 FE10 CP 16 44: 3546+7+5 0346 3003 JR NC, HEX_TO_INVALID_2; if bigger than 15-> fail 45: 3553+7 0348 E60F AND 0x0F 46: 3560+10 034A C9 RET 47: - 034B HEX_TO_INVALID_2: 48: 3570+4 034B 37 SCF ;set carry flag 49: 3574+10 034C 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: - 034D STRCONV_BYTES_TO_HEX: 63: 3584+11 034D F5 PUSH AF;Backup A Register 64: 3595+4 034E 1F RRA 65: 3599+4 034F 1F RRA 66: 3603+4 0350 1F RRA 67: 3607+4 0351 1F RRA 68: 3611+17 0352 CD5C03 CALL STRCONV_BYTES_TO_HEX_1 69: ;LD A,D 70: 3628+4 0355 47 LD B,A 71: 3632+10 0356 F1 POP AF ; Reload first Byte 72: 3642+17 0357 CD5C03 CALL STRCONV_BYTES_TO_HEX_1 73: ;LD A,D 74: 3659+4 035A 4F LD C,A 75: 3663+10 035B C9 RET 76: 77: - 035C STRCONV_BYTES_TO_HEX_1: 78: 3673+7 035C E60F AND 0x0F 79: 3680+7 035E C630 ADD 48 80: 3687+7 0360 FE3A CP 58 ; Check if less than 58 (less than ASCII 9) 81: ;JR C, STRCONV_BYTES_TO_HEX_2 82: 3694+5+6 0362 D8 RET C 83: 3699+7 0363 C607 ADD 7 ; A-F 84: 3706+10 0365 C9 RET 85: - 0366 STRCONV_BYTES_TO_HEX_2: 86: ;LD D,A 87: 3716+10 0366 C9 RET 88: 89: **** main.asm **** 475: ;.include "basic.s" 476: .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: - 0367 disassemble: 12: 3726+4 0367 78 ld a,b 13: 3730+13 0368 321A41 ld (var_bytes_count),a 14: - 036B disassemble_next: 15: 16: 17: 3743+16 036B 221041 ld (var_opcode_start), hl ;16 bit pointer to opcode in mem 18: 3759+7 036E 7E ld a,(hl) ;load opcode to find in A 19: 3766+13 036F 321441 ld (var_opcode), a ;8 bit opcode value 20: 3779+6 0372 23 inc hl 21: 3785+7 0373 7E ld a,(hl) ;load opcode to find in A 22: 3792+13 0374 321541 ld (var_opcode_x), a ;8 bit opcode extended value 23: 3805+6 0377 2B dec hl 24: 3811+17 0378 CD5B04 call disassemble_table_seek 25: 3828+4 037B 78 ld a,b 26: 3832+4 037C B1 or c 27: 3836+10 037D CA3D04 jp z, disassemble_err ;if bc==0000h 28: 29: 3846+20 0380 ED431241 ld (var_opcode_table), bc ;16 bit pointer to opcode in table 30: 31: ;load params 32: 3866+6 0384 03 inc bc 33: 3872+6 0385 03 inc bc 34: 3878+6 0386 03 inc bc 35: 3884+6 0387 03 inc bc 36: 3890+7 0388 0A ld a,(bc) 37: 3897+13 0389 321641 ld (var_opcode_length),A ;8 bit opcode length (in bytes) 38: 3910+6 038C 03 inc bc 39: 3916+7 038D 0A ld a, (bc) 40: 3923+4 038E 5F ld e,a 41: 3927+6 038F 03 inc bc 42: 3933+7 0390 0A ld a, (bc) 43: 3940+4 0391 57 ld d,a 44: 3944+20 0392 ED531741 ld (var_opcode_string),de ;16 bit pointer to opcode string 45: 3964+6 0396 03 inc bc 46: 3970+7 0397 0A ld a,(bc) 47: 3977+13 0398 321941 ld (var_opcode_pcount),A ;8 bit opcode param count 48: 49: ;values are prepared. Continue with print 50: 51: 3990+16 039B 2A1041 ld hl,(var_opcode_start) ;print address 52: 4006+17 039E CDA304 call dasm_print16hex_addr 53: 54: 4023+13 03A1 3A1641 ld a,(var_opcode_length) 55: 4036+4 03A4 47 ld b, a 56: 57: ;print up to 4 opcode bytes 58: 4040+16 03A5 2A1041 ld hl,(var_opcode_start) 59: 60: - 03A8 disassemble_print_opcode_raw 61: 4056+7 03A8 7E ld a,(hl) ;load first byte 62: 4063+17 03A9 CDD902 call print_a_hex 63: 4080+6 03AC 23 inc hl 64: 4086+8+5 03AD 10F9 djnz disassemble_print_opcode_raw 65: 66: 4094+7 03AF 3E68 ld a,"h" 67: 4101+17 03B1 CDA902 call print_char 68: ;fill empty spots 69: 4118+13 03B4 3A1641 ld a,(var_opcode_length) 70: 4131+4 03B7 47 ld b,a 71: 4135+7 03B8 3E06 ld a,6 72: 4142+4 03BA 90 sub b 73: 4146+4 03BB 47 ld b,a 74: 75: - 03BC disassemble_print_opcode_raw_fill: 76: 4150+7 03BC 3E20 ld a," " 77: 4157+17 03BE CDA902 call print_char 78: 4174+7 03C1 3E20 ld a," " 79: 4181+17 03C3 CDA902 call print_char 80: 4198+8+5 03C6 10F4 djnz disassemble_print_opcode_raw_fill 81: 4206+7 03C8 3E20 ld a," " 82: 4213+17 03CA CDA902 call print_char 83: 84: 4230+11 03CD E5 push hl 85: ;print opcode 86: 4241+16 03CE 2A1741 ld hl,(var_opcode_string) 87: 4257+17 03D1 CDB102 call print_str 88: 89: 90: ;print params 91: 4274+13 03D4 3A1941 ld a,(var_opcode_pcount) 92: 4287+4 03D7 B7 or a 93: 4291+10 03D8 CA3A04 jp z, disassemble_print_opcode_params_end ;skip if no params 94: 95: 4301+16 03DB 2A1241 ld hl,(var_opcode_table) 96: 4317+10 03DE 010800 ld bc, 8 97: 4327+11 03E1 09 add hl,bc ;hl now has address of first param 98: 4338+13 03E2 3A1941 ld a,(var_opcode_pcount) 99: 4351+4 03E5 47 ld b,a 100: - 03E6 disassemble_print_opcode_params_loop: 101: ;ld a,(hl) ;load param 102: ;call print_a_hex 103: 4355+7 03E6 7E ld a,(hl) ;load param 104: 105: 4362+7 03E7 FE01 cp 0x01 106: 4369+10+7 03E9 CCC904 call z, param_01 107: 4379+7 03EC FE02 cp 0x02 108: 4386+10+7 03EE CCF004 call z, param_02 109: 4396+7 03F1 FE03 cp 0x03 110: 4403+10+7 03F3 CC0D05 call z, param_03 111: 4413+7 03F6 FE04 cp 0x04 112: 4420+10+7 03F8 CC4905 call z, param_04 113: 4430+7 03FB FE05 cp 0x05 114: 4437+10+7 03FD CC5F05 call z, param_05 115: 4447+7 0400 FE06 cp 0x06 116: 4454+10+7 0402 CC6C05 call z, param_06 117: 4464+7 0405 FE07 cp 0x07 118: 4471+10+7 0407 CC8605 call z, param_07 119: 4481+7 040A FE08 cp 0x08 120: 4488+10+7 040C CC9305 call z, param_08 121: 4498+7 040F FE09 cp 0x09 122: 4505+10+7 0411 CCA805 call z, param_09 123: 4515+7 0414 FE10 cp 0x10 124: 4522+10+7 0416 CCBD05 call z, param_10 125: 4532+7 0419 FE11 cp 0x11 126: 4539+10+7 041B CCCD05 call z, param_11 127: 4549+7 041E FE12 cp 0x12 128: 4556+10+7 0420 CCD505 call z, param_12 129: 4566+7 0423 FE13 cp 0x13 130: 4573+10+7 0425 CC0D06 call z, param_13 131: 4583+7 0428 FE0A cp 0x0A 132: 4590+10+7 042A CC9F05 call z, param_0A 133: ;strings 134: 4600+7 042D FE80 cp 0x80 135: 4607+10+7 042F CC2C06 call z, param_80 136: 4617+7 0432 FE81 cp 0x81 137: 4624+10+7 0434 CC2306 call z, param_81 138: 4634+6 0437 23 inc hl 139: 4640+8+5 0438 10AC djnz disassemble_print_opcode_params_loop 140: - 043A disassemble_print_opcode_params_end: 141: 4648+10 043A E1 pop hl 142: 4658+12 043B 1810 jr disassemble_continue 143: 144: 145: - 043D disassemble_err: 146: 4670+17 043D CDA304 call dasm_print16hex_addr 147: 4687+7 0440 7E ld a,(hl) 148: 4694+17 0441 CDBB04 call dasm_print8hex ;print value 149: 4711+6 0444 23 inc hl 150: 4717+11 0445 E5 push hl 151: 4728+10 0446 21780E ld hl, [dasm_UU] 152: 4738+17 0449 CDB102 call print_str 153: 4755+10 044C E1 pop hl 154: 155: - 044D disassemble_continue: 156: 157: 4765+17 044D CDC302 call print_newLine 158: ;inc hl 159: 4782+13 0450 3A1A41 ld a,(var_bytes_count) 160: 4795+4 0453 3D dec a 161: 4799+13 0454 321A41 ld (var_bytes_count),a 162: 4812+10 0457 C26B03 jp nz, disassemble_next 163: 4822+10 045A C9 ret 164: 165: 166: 167: ;A contains opcode 168: ;BC contains returned position 169: - 045B disassemble_table_seek: 170: 4832+11 045B E5 push hl 171: 4843+10 045C 217606 ld hl, [dasm_opcode_table] 172: - 045F disassemble_table_seek_loop: 173: 4853+13 045F 3A1441 ld a,(var_opcode) 174: 4866+4 0462 4F ld c,a 175: 4870+7 0463 7E ld a,(hl) 176: 4877+7 0464 FEFF cp 0xFF ; if null 177: 4884+10 0466 CA9D04 jp z, disassemble_table_notfound 178: 179: ;apply mask 180: 4894+11 0469 F5 push af 181: 4905+6 046A 23 inc hl 182: 4911+7 046B 46 ld b,(hl) ;load mask 183: 4918+6 046C 2B dec hl 184: 4924+4 046D 79 ld a,c 185: 4928+4 046E A0 and b ;apply mask 186: 4932+4 046F 4F ld c,a 187: 4936+10 0470 F1 pop af 188: 189: 4946+4 0471 B9 cp c ; if match 190: 4950+7+5 0472 280B jr z, disassemble_table_first_match 191: 4957+7 0474 0600 ld b,0 192: 4964+7 0476 0E07 ld c,7 193: 4971+11 0478 09 add hl,bc 194: 4982+7 0479 7E ld a,(hl) 195: 4989+4 047A 4F ld c,a 196: 4993+11 047B 09 add hl,bc 197: 5004+6 047C 23 inc hl 198: 5010+12 047D 18E0 jr disassemble_table_seek_loop 199: 200: - 047F disassemble_table_first_match 201: 5022+6 047F 23 inc hl 202: 5028+6 0480 23 inc hl 203: 5034+7 0481 4E ld c,(hl) ;load opcode x from table 204: 5041+6 0482 23 inc hl 205: 5047+13 0483 3A1541 ld a,(var_opcode_x) ;load current opcode x 206: 5060+7 0486 46 ld b,(hl) ;load mask 207: 5067+4 0487 A0 and b ;apply mask 208: 5071+4 0488 B9 cp c ;compare to table 209: 5075+6 0489 2B dec hl 210: 5081+6 048A 2B dec hl 211: 5087+6 048B 2B dec hl 212: 5093+7+5 048C 280B jr z, disassemble_table_found ;IF FOUND 213: 5100+7 048E 0600 ld b,0 ;else continue with next 214: 215: 5107+7 0490 0E07 ld c,7 216: 5114+11 0492 09 add hl,bc 217: 5125+7 0493 7E ld a,(hl) 218: 5132+4 0494 4F ld c,a 219: 5136+11 0495 09 add hl,bc 220: 5147+6 0496 23 inc hl 221: 5153+12 0497 18C6 jr disassemble_table_seek_loop 222: 223: - 0499 disassemble_table_found 224: 5165+4 0499 44 ld b,H 225: 5169+4 049A 4D ld c,l 226: 5173+10 049B E1 pop hl 227: 5183+10 049C C9 ret 228: 229: - 049D disassemble_table_notfound 230: 5193+7 049D 0600 ld b,0 231: 5200+7 049F 0E00 ld c,0 232: 5207+10 04A1 E1 pop hl 233: 5217+10 04A2 C9 ret 234: 235: 236: 237: 238: - 04A3 dasm_print16hex_addr: 239: 5227+7 04A3 3E24 ld a,"$" 240: 5234+17 04A5 CDA902 call print_char 241: 5251+4 04A8 7C ld a,h 242: 5255+17 04A9 CDD902 call print_a_hex 243: 5272+4 04AC 7D ld a,l 244: 5276+17 04AD CDD902 call print_a_hex 245: 5293+7 04B0 3E68 ld a,"h" 246: 5300+17 04B2 CDA902 call print_char 247: 5317+7 04B5 3E20 ld a," " 248: 5324+17 04B7 CDA902 call print_char 249: 5341+10 04BA C9 ret 250: 251: - 04BB dasm_print8hex: 252: 5351+17 04BB CDD902 call print_a_hex 253: 5368+7 04BE 3E68 ld a,"h" 254: 5375+17 04C0 CDA902 call print_char 255: 5392+7 04C3 3E20 ld a," " 256: 5399+17 04C5 CDA902 call print_char 257: 5416+10 04C8 C9 ret 258: 259: 260: 261: 262: 263: 264: 265: - 04C9 param_01: ; 0x01 16bit address pointer 266: 5426+11 04C9 E5 push hl 267: 5437+20 04CA ED5B1041 ld de,(var_opcode_start) 268: 5457+6 04CE 13 inc de 269: 5463+7 04CF 1A ld a,(de) 270: 5470+4 04D0 6F ld l,a 271: 5474+6 04D1 13 inc de 272: 5480+7 04D2 1A ld a,(de) 273: 5487+4 04D3 67 ld h,a 274: 275: 5491+7 04D4 3E24 ld a,"$" 276: 5498+17 04D6 CDA902 call print_char 277: 5515+4 04D9 7C ld a,h 278: 5519+17 04DA CDD902 call print_a_hex 279: 5536+4 04DD 7D ld a,l 280: 5540+17 04DE CDD902 call print_a_hex 281: 5557+7 04E1 3E68 ld a,"h" 282: 5564+17 04E3 CDA902 call print_char 283: 5581+7 04E6 3E20 ld a," " 284: 5588+17 04E8 CDA902 call print_char 285: 5605+17 04EB CD6706 call param_comma 286: 5622+10 04EE E1 pop hl 287: 5632+10 04EF C9 ret 288: 289: - 04F0 param_02: 290: 5642+11 04F0 C5 push bc 291: 5653+20 04F1 ED5B1041 ld de,(var_opcode_start) 292: 5673+7 04F5 1A ld a,(de) 293: 5680+4 04F6 1F rra 294: 5684+4 04F7 1F rra 295: 5688+7 04F8 E60E and 0x0E 296: 297: 5695+11 04FA E5 push hl 298: 5706+10 04FB 21810E ld hl, [dasm_printFlags_table] 299: 5716+7 04FE 0600 ld b,0 300: 5723+4 0500 4F ld c,a 301: 5727+11 0501 09 add hl,bc 302: 5738+17 0502 CDB102 call print_str 303: 5755+7 0505 3E20 ld a, " " 304: 5762+17 0507 CDA902 call print_char 305: 5779+10 050A E1 pop hl 306: 5789+10 050B C1 pop bc 307: 5799+10 050C C9 ret 308: 309: 310: - 050D param_03: 311: 5809+20 050D ED5B1041 ld de,(var_opcode_start) 312: 5829+6 0511 13 inc de 313: 5835+7 0512 1A ld a,(de) 314: 315: 5842+11 0513 F5 push af 316: 5853+7 0514 E680 and 0x80 317: 5860+10 0516 C22E05 jp nz, param_03_neg 318: 5870+7 0519 3E24 ld a,"$" 319: 5877+17 051B CDA902 call print_char 320: 5894+7 051E 3E2B ld a,"+" 321: 5901+17 0520 CDA902 call print_char 322: 5918+10 0523 F1 pop af 323: 5928+17 0524 CDD902 call print_a_hex 324: 5945+7 0527 3E68 ld a,"h" 325: 5952+17 0529 CDA902 call print_char 326: 5969+12 052C 1817 jr param_03_done 327: 328: - 052E param_03_neg: 329: 5981+7 052E 3E24 ld a,"$" 330: 5988+17 0530 CDA902 call print_char 331: 6005+7 0533 3E2D ld a,"-" 332: 6012+17 0535 CDA902 call print_char 333: 6029+10 0538 F1 pop af 334: 6039+8 0539 ED44 neg 335: 6047+17 053B CDD902 call print_a_hex 336: 6064+7 053E 3E68 ld a,"h" 337: 6071+17 0540 CDA902 call print_char 338: 6088+12 0543 1800 jr param_03_done 339: 340: - 0545 param_03_done: 341: 6100+17 0545 CD6706 call param_comma 342: 6117+10 0548 C9 ret 343: 344: 345: - 0549 param_04: 346: 6127+20 0549 ED5B1041 ld de,(var_opcode_start) 347: 6147+6 054D 13 inc de 348: 6153+7 054E 1A ld a,(de) 349: 6160+7 054F FE4D cp 0x4D 350: 6167+7+5 0551 2806 jr z,param_04_i 351: 6174+7 0553 3E4E ld a,"N" 352: 6181+17 0555 CDA902 call print_char 353: 6198+10 0558 C9 ret 354: - 0559 param_04_i: 355: 6208+7 0559 3E49 ld a,"I" 356: 6215+17 055B CDA902 call print_char 357: 6232+10 055E C9 ret 358: 359: - 055F param_05: 360: 6242+11 055F C5 push bc 361: 6253+20 0560 ED5B1041 ld de,(var_opcode_start) 362: 6273+7 0564 1A ld a,(de) 363: 6280+7 0565 E638 and 0x38 364: ; print hex char 365: 6287+17 0567 CDBB04 call dasm_print8hex 366: 6304+10 056A C1 pop bc 367: 6314+10 056B C9 ret 368: 369: 370: - 056C param_06: 371: 6324+11 056C C5 push bc 372: 6335+20 056D ED5B1041 ld de,(var_opcode_start) 373: 6355+7 0571 1A ld a,(de) 374: 6362+4 0572 1F rra 375: 6366+4 0573 1F rra 376: 6370+4 0574 1F rra 377: 6374+7 0575 E607 and 0x07 378: 6381+17 0577 CD4206 call param_printRegister 379: 6398+7 057A 3E20 ld a," " 380: 6405+17 057C CDA902 call print_char 381: 6422+7 057F 3E2C ld a,"," 382: 6429+17 0581 CDA902 call print_char 383: 6446+10 0584 C1 pop bc 384: 6456+10 0585 C9 ret 385: 386: - 0586 param_07: 387: 6466+11 0586 C5 push bc 388: 6477+20 0587 ED5B1041 ld de,(var_opcode_start) 389: 6497+7 058B 1A ld a,(de) 390: 6504+7 058C E607 and 0x07 391: 392: 6511+17 058E CD4206 call param_printRegister 393: 6528+10 0591 C1 pop bc 394: 6538+10 0592 C9 ret 395: 396: - 0593 param_08: 397: 6548+11 0593 C5 push bc 398: 6559+20 0594 ED5B1041 ld de,(var_opcode_start) 399: 6579+6 0598 13 inc de 400: 6585+7 0599 1A ld a,(de) 401: 6592+17 059A CDBB04 call dasm_print8hex 402: 6609+10 059D C1 pop bc 403: 6619+10 059E C9 ret 404: 405: 406: - 059F param_0A: 407: 6629+11 059F E5 push hl 408: 6640+20 05A0 ED5B1041 ld de,(var_opcode_start) 409: 6660+6 05A4 13 inc de 410: 6666+6 05A5 13 inc de 411: 6672+12 05A6 1806 jr param_09_0A 412: - 05A8 param_09: 413: 6684+11 05A8 E5 push hl 414: 6695+20 05A9 ED5B1041 ld de,(var_opcode_start) 415: 6715+6 05AD 13 inc de 416: - 05AE param_09_0A: 417: 6721+7 05AE 1A ld a,(de) 418: 6728+4 05AF 6F ld l,a 419: 6732+6 05B0 13 inc de 420: 6738+7 05B1 1A ld a,(de) 421: 6745+4 05B2 67 ld h,a 422: 6749+4 05B3 7C ld a,h 423: 6753+17 05B4 CDD902 call print_a_hex 424: 6770+4 05B7 7D ld a,l 425: 6774+17 05B8 CDD902 call print_a_hex 426: 6791+10 05BB E1 pop hl 427: 6801+10 05BC C9 ret 428: 429: - 05BD param_10: 430: 6811+11 05BD C5 push bc 431: 6822+20 05BE ED5B1041 ld de,(var_opcode_start) 432: 6842+7 05C2 1A ld a,(de) 433: 6849+4 05C3 1F rra 434: 6853+4 05C4 1F rra 435: 6857+4 05C5 1F rra 436: 6861+7 05C6 E607 and 0x07 437: 6868+17 05C8 CD4206 call param_printRegister 438: 6885+10 05CB C1 pop bc 439: 6895+10 05CC C9 ret 440: 441: 442: - 05CD param_11: 443: 6905+11 05CD E5 push hl 444: 6916+11 05CE C5 push bc 445: 6927+20 05CF ED5B1041 ld de,(var_opcode_start) 446: 6947+12 05D3 1807 jr param_11_12 447: - 05D5 param_12: 448: 6959+11 05D5 E5 push hl 449: 6970+11 05D6 C5 push bc 450: 6981+20 05D7 ED5B1041 ld de,(var_opcode_start) 451: 7001+6 05DB 13 inc de 452: 453: - 05DC param_11_12: 454: 7007+7 05DC 1A ld a,(de) 455: 7014+4 05DD 1F rra 456: 7018+4 05DE 1F rra 457: 7022+4 05DF 1F rra 458: 7026+7 05E0 E606 and 0x06 459: 7033+11 05E2 F5 push af 460: ;check which table to use 461: 7044+16 05E3 2A1041 ld hl, (var_opcode_start) 462: 7060+7 05E6 7E ld a,(hl) 463: 7067+7 05E7 FEDD cp 0xDD 464: 7074+7+5 05E9 2809 jr z,param_11_12_ix 465: 7081+7 05EB FEFD cp 0xFD 466: 7088+7+5 05ED 280A jr z,param_11_12_iy 467: - 05EF param_11_12_def: 468: 7095+10 05EF 21910E ld hl, [dasm_printRegister8_table] 469: 7105+12 05F2 1808 jr param_11_12_all 470: - 05F4 param_11_12_ix: 471: 7117+10 05F4 21990E ld hl, [dasm_printRegisterIX_table] 472: 7127+12 05F7 1803 jr param_11_12_all 473: - 05F9 param_11_12_iy: 474: 7139+10 05F9 21A10E ld hl, [dasm_printRegisterIY_table] 475: - 05FC param_11_12_all: 476: 7149+10 05FC F1 pop af 477: 7159+7 05FD 0600 ld b,0 478: 7166+4 05FF 4F ld c,a 479: 7170+11 0600 09 add hl, bc 480: 7181+7 0601 7E ld a,(hl) 481: 7188+17 0602 CDA902 call print_char 482: 7205+6 0605 23 inc hl 483: 7211+7 0606 7E ld a,(hl) 484: 7218+17 0607 CDA902 call print_char 485: 7235+10 060A C1 pop bc 486: 7245+10 060B E1 pop hl 487: 7255+10 060C C9 ret 488: 489: - 060D param_13: 490: 7265+11 060D E5 push hl 491: 7276+11 060E C5 push bc 492: 7287+20 060F ED5B1041 ld de,(var_opcode_start) 493: 7307+7 0613 1A ld a,(de) 494: 7314+4 0614 1F rra 495: 7318+4 0615 1F rra 496: 7322+4 0616 1F rra 497: 7326+7 0617 E606 and 0x06 498: 7333+11 0619 F5 push af 499: ;check which table to use 500: 7344+16 061A 2A1041 ld hl, (var_opcode_start) 501: 7360+7 061D 7E ld a,(hl) 502: 7367+10 061E 21A90E ld hl, [dasm_printRegisterSP_table] 503: 7377+12 0621 18D9 jr param_11_12_all ;reuse code from 11_12 504: 505: 506: - 0623 param_81: 507: 7389+11 0623 E5 push hl 508: 7400+11 0624 C5 push bc 509: 7411+16 0625 2A1741 ld hl, (var_opcode_string) 510: 7427+7 0628 0602 ld b,2 511: 7434+12 062A 1807 jr param_80_seek 512: - 062C param_80: 513: 7446+11 062C E5 push hl 514: 7457+11 062D C5 push bc 515: 7468+16 062E 2A1741 ld hl, (var_opcode_string) 516: 7484+7 0631 0601 ld b,1 517: - 0633 param_80_seek: 518: 7491+7 0633 7E ld a,(hl) 519: 7498+6 0634 23 inc hl 520: 7504+4 0635 A7 and a 521: 7508+7+5 0636 20FB jr nz, param_80_seek 522: ;found 523: 7515+4 0638 05 dec b ;found but counter too high 524: 7519+10 0639 C23306 jp nz, param_80_seek 525: 526: 7529+17 063C CDB102 call print_str 527: 7546+10 063F C1 pop bc 528: 7556+10 0640 E1 pop hl 529: 7566+10 0641 C9 ret 530: 531: 532: 533: - 0642 param_printRegister: 534: 7576+11 0642 E5 push hl 535: 7587+7 0643 FE06 cp 0x06 536: 7594+7+5 0645 2811 jr z, param_printRegisterHL 537: 7601+7 0647 FE07 cp 0x07 538: 7608+7+5 0649 2815 jr z, param_printRegisterA 539: 7615+10 064B 21910E ld hl, [dasm_printRegister8_table] 540: 7625+7 064E 0600 ld b,0 541: 7632+4 0650 4F ld c,a 542: 7636+11 0651 09 add hl,bc 543: 7647+7 0652 7E ld a, (hl) 544: 7654+17 0653 CDA902 call print_char 545: 7671+10 0656 E1 pop hl 546: 7681+10 0657 C9 ret 547: 548: - 0658 param_printRegisterHL: 549: 7691+10 0658 21B10E ld hl, [dasm_printRegister8_table_HL] 550: 7701+17 065B CDB102 call print_str 551: 7718+10 065E E1 pop hl 552: 7728+10 065F C9 ret 553: 554: - 0660 param_printRegisterA: 555: 7738+7 0660 3E41 ld a,"A" 556: 7745+17 0662 CDA902 call print_char 557: 7762+10 0665 E1 pop hl 558: 7772+10 0666 C9 ret 559: 560: 561: - 0667 param_comma: 562: 7782+4 0667 78 ld a,b 563: 7786+7 0668 FE01 cp 1 564: 7793+5+6 066A C8 ret z 565: 7798+7 066B 3E20 ld a," " 566: 7805+17 066D CDA902 call print_char 567: 7822+7 0670 3E2C ld a,"," 568: 7829+17 0672 CDA902 call print_char **** main.asm **** 477: 7846+10 0675 C9 ret 478: .include "disassembler_table.s" **** include/disassembler_table.s **** 1: ;disassembler tables 2: 3: - 0676 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: - 0676 00FF0000 defb 0x00, 0xFF, 0x00, 0x00, 1, [dasm_00], [dasm_00]>>8,0 ;NOP 01CE0A00 29: ;General-Purpose Arithmetic and CPU Control Groups 30: - 067E 27FF0000 defb 0x27, 0xFF, 0x00, 0x00, 1, [dasm_27], [dasm_27]>>8, 0 ;DAA 01990B00 31: - 0686 2FFF0000 defb 0x2F, 0xFF, 0x00, 0x00, 1, [dasm_2F], [dasm_2F]>>8, 0 ;CPL 019D0B00 32: - 068E EDFF44FF defb 0xED, 0xFF, 0x44, 0xFF, 2, [dasm_ED_44], [dasm_ED_44]>>8, 0 ;NEG 02A10B00 33: - 0696 3FFF0000 defb 0x3f, 0xFF, 0x00, 0x00, 1, [dasm_3F], [dasm_3F]>>8, 0 ;CCF 01A50B00 34: - 069E 37FF0000 defb 0x37, 0xFF, 0x00, 0x00, 1, [dasm_37], [dasm_37]>>8, 0 ;SCF 01A90B00 35: ;defb 0x00, 0xFF, 0x00, 0x00, 1, [dasm_00], [dasm_00]>>8,0 ;NOP -> already at top for performance reasons 36: - 06A6 76FF0000 defb 0x76, 0xFF, 0x00, 0x00, 1, [dasm_76], [dasm_76]>>8, 0 ;HALT 01AD0B00 37: - 06AE F3FF0000 defb 0xF3, 0xFF, 0x00, 0x00, 1, [dasm_F3], [dasm_F3]>>8, 0 ;DI 01B20B00 38: - 06B6 FBFF0000 defb 0xFB, 0xFF, 0x00, 0x00, 1, [dasm_FB], [dasm_FB]>>8, 0 ;EI 01B50B00 39: - 06BE EDFF46FF defb 0xED, 0xFF, 0x46, 0xFF, 2, [dasm_ED_46], [dasm_ED_46]>>8, 0 ;IM 0 02B80B00 40: - 06C6 EDFF56FF defb 0xED, 0xFF, 0x56, 0xFF, 2, [dasm_ED_56], [dasm_ED_56]>>8, 0 ;IM 1 02BD0B00 41: - 06CE EDFF5EFF defb 0xED, 0xFF, 0x5E, 0xFF, 2, [dasm_ED_5E], [dasm_ED_5E]>>8, 0 ;IM 2 02C20B00 42: 43: ;Exchange, Block Transfer, and Search Group 44: - 06D6 EBFF0000 defb 0xEB, 0xFF, 0x00, 0x00, 1, [dasm_BE], [dasm_BE]>>8, 0 ;EX DE, HL 01C70B00 45: - 06DE 08FF0000 defb 0x08, 0xFF, 0x00, 0x00, 1, [dasm_08], [dasm_08]>>8, 0 ;EX AF, AF′ 01D10B00 46: - 06E6 D9FF0000 defb 0xD9, 0xFF, 0x00, 0x00, 1, [dasm_D9], [dasm_D9]>>8, 0 ;EXX 01DE0B00 47: - 06EE E3FF0000 defb 0xE3, 0xFF, 0x00, 0x00, 1, [dasm_E3], [dasm_E3]>>8, 0 ;EX (SP), HL 01E20B00 48: - 06F6 DDFFE3FF defb 0xDD, 0xFF, 0xE3, 0xFF, 2, [dasm_DD_E3], [dasm_DD_E3]>>8, 0 ;EX (SP), IX 02EE0B00 49: - 06FE FDFFE3FF defb 0xFD, 0xFF, 0xE3, 0xFF, 2, [dasm_FD_E3], [dasm_FD_E3]>>8, 0 ;EX (SP), IY 02FA0B00 50: - 0706 EDFFA0FF defb 0xED, 0xFF, 0xA0, 0xFF, 2, [dasm_ED_A0], [dasm_ED_A0]>>8, 0 ;LDI 02060C00 51: - 070E EDFFB0FF defb 0xED, 0xFF, 0xB0, 0xFF, 2, [dasm_ED_B0], [dasm_ED_B0]>>8, 0 ;LDIR 020A0C00 52: - 0716 EDFFA8FF defb 0xED, 0xFF, 0xA8, 0xFF, 2, [dasm_ED_A8], [dasm_ED_A8]>>8, 0 ;LDD 020F0C00 53: - 071E EDFFB8FF defb 0xED, 0xFF, 0xB8, 0xFF, 2, [dasm_ED_B8], [dasm_ED_B8]>>8, 0 ;LDDR 02130C00 54: - 0726 EDFFA1FF defb 0xED, 0xFF, 0xA1, 0xFF, 2, [dasm_ED_A1], [dasm_ED_A1]>>8, 0 ;CPI 02180C00 55: - 072E EDFFB1FF defb 0xED, 0xFF, 0xB1, 0xFF, 2, [dasm_ED_B1], [dasm_ED_B1]>>8, 0 ;CPIR 021C0C00 56: - 0736 EDFFA9FF defb 0xED, 0xFF, 0xA9, 0xFF, 2, [dasm_ED_A9], [dasm_ED_A9]>>8, 0 ;CPD 02210C00 57: - 073E EDFFB9FF defb 0xED, 0xFF, 0xB9, 0xFF, 2, [dasm_ED_B9], [dasm_ED_B9]>>8, 0 ;CPDR 02250C00 58: 59: ;JUMP Group 60: - 0746 C3FF0000 defb 0xC3, 0xFF, 0x00, 0x00, 3, [dasm_C3], [dasm_C3]>>8,1, 0x01 ;JP nn 03D20A01 01 61: - 074F C2C70000 defb 0xC2, 0xC7, 0x00, 0x00, 3, [dasm_C3], [dasm_C3]>>8,3, 0x02, 0x80, 0x01 ;JP cc,nn 03D20A03 028001 62: - 075A 18FF0000 defb 0x18, 0xFF, 0x00, 0x00, 2, [dasm_18], [dasm_18]>>8,1, 0x03 ;JR e 02D90A01 03 63: - 0763 38FF0000 defb 0x38, 0xFF, 0x00, 0x00, 2, [dasm_38], [dasm_38]>>8,1, 0x03 ;JR C,e 02DD0A01 03 64: - 076C 30FF0000 defb 0x30, 0xFF, 0x00, 0x00, 2, [dasm_30], [dasm_30]>>8,1, 0x03 ;JR NC,e 02E40A01 03 65: - 0775 28FF0000 defb 0x28, 0xFF, 0x00, 0x00, 2, [dasm_28], [dasm_28]>>8,1, 0x03 ;JR Z,e 02EC0A01 03 66: - 077E 20FF0000 defb 0x20, 0xFF, 0x00, 0x00, 2, [dasm_20], [dasm_20]>>8,1, 0x03 ;JR NZ,e 02F30A01 03 67: - 0787 E9FF0000 defb 0xE9, 0xFF, 0x00, 0x00, 2, [dasm_E9], [dasm_E9]>>8,0 ;JP (HL) 02FB0A00 68: - 078F DDFFE9FF defb 0xDD, 0xFF, 0xE9, 0xFF, 2, [dasm_DD], [dasm_DD]>>8,0 ;JP (IX) 02040B00 69: - 0797 FDFFE9FF defb 0xFD, 0xFF, 0xE9, 0xFF, 2, [dasm_FD], [dasm_FD]>>8,0 ;JP (IY) 020D0B00 70: - 079F 10FF0000 defb 0x10, 0xFF, 0x00, 0x00, 2, [dasm_10], [dasm_10]>>8,1, 0x03 ;DJNZ, e 02160B01 03 71: ;Call and Return Group 72: - 07A8 CDFF0000 defb 0xCD, 0xFF, 0x00, 0x00, 3, [dasm_CD], [dasm_CD]>>8,1, 0x01 ;CALL nn 031C0B01 01 73: - 07B1 C4C70000 defb 0xC4, 0xC7, 0x00, 0x00, 3, [dasm_CD], [dasm_CD]>>8,2, 0x02, 0x01 ;CALL cc,nn 031C0B02 0201 74: - 07BB C9FF0000 defb 0xC9, 0xFF, 0x00, 0x00, 1, [dasm_C9], [dasm_C9]>>8,0 ;RET 01220B00 75: - 07C3 C0C70000 defb 0xC0, 0xC7, 0x00, 0x00, 1, [dasm_C9], [dasm_C9]>>8,1, 0x02 ;RET cc 01220B01 02 76: - 07CC EDFF4DFF defb 0xED, 0xFF, 0x4D, 0xFF, 2, [dasm_ED_4D], [dasm_ED_4D]>>8,0 ;RETI 02270B00 77: - 07D4 EDFF45FF defb 0xED, 0xFF, 0x45, 0xFF, 2, [dasm_ED_45], [dasm_ED_45]>>8,0 ;RETN 022C0B00 78: 79: - 07DC C7C70000 defb 0xC7, 0xC7, 0x00, 0x00, 1, [dasm_FF], [dasm_FF]>>8,1, 0x05 ;RST 01310B01 05 80: ;8-Bit load group 81: - 07E5 0AFF0000 defb 0x0A, 0xFF, 0x00, 0x00, 1, [dasm_0A], [dasm_0A]>>8, 0 ;LD A, (BC) 01360B00 82: - 07ED 1AFF0000 defb 0x1A, 0xFF, 0x00, 0x00, 1, [dasm_1A], [dasm_1A]>>8, 0 ;LD A, (DE) 01400B00 83: - 07F5 3AFF0000 defb 0x3A, 0xFF, 0x00, 0x00, 3, [dasm_3A], [dasm_3A]>>8, 2, 0x09, 0x80 ;LD A, (nn) 034A0B02 0980 84: - 07FF 02FF0000 defb 0x02, 0xFF, 0x00, 0x00, 1, [dasm_02], [dasm_02]>>8, 0 ;LD (BC), A 01540B00 85: - 0807 12FF0000 defb 0x12, 0xFF, 0x00, 0x00, 1, [dasm_12], [dasm_12]>>8, 0 ;LD (DE), A 015F0B00 86: - 080F 32FF0000 defb 0x32, 0xFF, 0x00, 0x00, 3, [dasm_32], [dasm_32]>>8, 2, 0x09, 0x80 ;LD (nn), A 036A0B02 0980 87: - 0819 EDFF57FF defb 0xED, 0xFF, 0x57, 0xFF, 2, [dasm__ED_57], [dasm__ED_57]>>8, 0 ;LD A, I 02790B00 88: - 0821 EDFF5FFF defb 0xED, 0xFF, 0x5F, 0xFF, 2, [dasm__ED_5F], [dasm__ED_5F]>>8, 0 ;LD A, R 02810B00 89: - 0829 EDFF47FF defb 0xED, 0xFF, 0x47, 0xFF, 2, [dasm__ED_47], [dasm__ED_47]>>8, 0 ;LD I, A 02890B00 90: - 0831 EDFF4FFF defb 0xED, 0xFF, 0x4F, 0xFF, 2, [dasm__ED_4F], [dasm__ED_4F]>>8, 0 ;LD R, A 02910B00 91: 92: - 0839 06C70000 defb 0x06, 0xC7, 0x00, 0x00, 2, [dasm__LD], [dasm__LD]>>8, 2, 0x06, 0x08 ;LD r, n 02750B02 0608 93: - 0843 40C00000 defb 0x40, 0xC0, 0x00, 0x00, 1, [dasm__LD], [dasm__LD]>>8, 2, 0x06, 0x07 ;LD r, r' / LD r, (HL) / LD (HL), r 01750B02 0607 94: 95: ;8-Bit Arithmetic Group 96: - 084D 80F80000 defb 0x80, 0xF8, 0x00, 0x00, 1, [dasm_80C6], [dasm_80C6]>>8, 1, 0x07 ;ADD A, r / ADD A, (HL) 012A0C01 07 97: - 0856 C6FF0000 defb 0xC6, 0xFF, 0x00, 0x00, 2, [dasm_80C6], [dasm_80C6]>>8, 1, 0x08 ;ADD A, n 022A0C01 08 98: - 085F DDFF86FF defb 0xDD, 0xFF, 0x86, 0xFF, 3, [dasm_DD_86], [dasm_DD_86]>>8, 2, 0x08, 0x80 ;ADD A, (IX + d) 03320C02 0880 99: - 0869 FDFF86FF defb 0xFD, 0xFF, 0x86, 0xFF, 3, [dasm_FD_86], [dasm_FD_86]>>8, 2, 0x08, 0x80 ;ADD A, (IY + d) 03410C02 0880 100: - 0873 C8F80000 defb 0xC8, 0xF8, 0x00, 0x00, 1, [dasm_C88E], [dasm_C88E]>>8, 1, 0x07 ;ADC A, r / ADC A, (HL) 01500C01 07 101: - 087C 8EF80000 defb 0x8E, 0xF8, 0x00, 0x00, 2, [dasm_C88E], [dasm_C88E]>>8, 1, 0x08 ;ADC A, n 02500C01 08 102: - 0885 DDFF8EFF defb 0xDD, 0xFF, 0x8E, 0xFF, 3, [dasm_DD_8E], [dasm_DD_8E]>>8, 2, 0x08, 0x80 ;ADC A, (IX + d) 03580C02 0880 103: - 088F FDFF8EFF defb 0xFD, 0xFF, 0x8E, 0xFF, 3, [dasm_FD_8E], [dasm_FD_8E]>>8, 2, 0x08, 0x80 ;ADC A, (IY + d) 03670C02 0880 104: - 0899 90F80000 defb 0x90, 0xF8, 0x00, 0x00, 1, [dasm__SUB], [dasm__SUB]>>8, 1, 0x07 ;SUB r / SUB A, (HL) 01760C01 07 105: - 08A2 D6FF0000 defb 0xD6, 0xFF, 0x00, 0x00, 2, [dasm__SUB], [dasm__SUB]>>8, 1, 0x08 ;SUB n 02760C01 08 106: - 08AB DDFF96FF defb 0xDD, 0xFF, 0x96, 0xFF, 3, [dasm_DD_96], [dasm_DD_96]>>8, 2, 0x08, 0x80 ;SUB (IX + d) 037B0C02 0880 107: - 08B5 FDFF96FF defb 0xFD, 0xFF, 0x96, 0xFF, 3, [dasm_FD_96], [dasm_FD_96]>>8, 2, 0x08, 0x80 ;SUB (IY + d) 03870C02 0880 108: - 08BF 94F80000 defb 0x94, 0xF8, 0x00, 0x00, 1, [dasm__SBC], [dasm__SBC]>>8, 1, 0x07 ;SBC A,r / SBC A, (HL) 01930C01 07 109: - 08C8 DEFF0000 defb 0xDE, 0xFF, 0x00, 0x00, 2, [dasm__SBC], [dasm__SBC]>>8, 1, 0x08 ;SBC A,n 02930C01 08 110: - 08D1 DDFF9EFF defb 0xDD, 0xFF, 0x9E, 0xFF, 3, [dasm_DD_9E], [dasm_DD_9E]>>8, 2, 0x08, 0x80 ;SBC A,(IX + d) 039B0C02 0880 111: - 08DB FDFF9EFF defb 0xFD, 0xFF, 0x9E, 0xFF, 3, [dasm_FD_9E], [dasm_FD_9E]>>8, 2, 0x08, 0x80 ;SBC A,(IY + d) 03A90C02 0880 112: - 08E5 A0F80000 defb 0xA0, 0xF8, 0x00, 0x00, 1, [dasm__AND], [dasm__AND]>>8, 1, 0x07 ;AND A,r / AND A, (HL) 01B70C01 07 113: - 08EE E6FF0000 defb 0xE6, 0xFF, 0x00, 0x00, 2, [dasm__AND], [dasm__AND]>>8, 1, 0x08 ;AND A,n 02B70C01 08 114: - 08F7 DDFFA6FF defb 0xDD, 0xFF, 0xA6, 0xFF, 3, [dasm_DD_A6], [dasm_DD_A6]>>8, 2, 0x08, 0x80 ;AND A,(IX + d) 03BC0C02 0880 115: - 0901 FDFFA6FF defb 0xFD, 0xFF, 0xA6, 0xFF, 3, [dasm_FD_A6], [dasm_FD_A6]>>8, 2, 0x08, 0x80 ;AND A,(IY + d) 03C80C02 0880 116: - 090B B0F80000 defb 0xB0, 0xF8, 0x00, 0x00, 1, [dasm__OR], [dasm__OR]>>8, 1, 0x07 ;OR A,r / OR A, (HL) 01D40C01 07 117: - 0914 F6FF0000 defb 0xF6, 0xFF, 0x00, 0x00, 2, [dasm__OR], [dasm__OR]>>8, 1, 0x08 ;OR A,n 02D40C01 08 118: - 091D DDFFB6FF defb 0xDD, 0xFF, 0xB6, 0xFF, 3, [dasm_DD_B6], [dasm_DD_B6]>>8, 2, 0x08, 0x80 ;OR A,(IX + d) 03D80C02 0880 119: - 0927 FDFFB6FF defb 0xFD, 0xFF, 0xB6, 0xFF, 3, [dasm_FD_B6], [dasm_FD_B6]>>8, 2, 0x08, 0x80 ;OR A,(IY + d) 03E30C02 0880 120: - 0931 A8F80000 defb 0xA8, 0xF8, 0x00, 0x00, 1, [dasm__XOR], [dasm__XOR]>>8, 1, 0x07 ;XOR A,r / XOR A, (HL) 01EE0C01 07 121: - 093A EEFF0000 defb 0xEE, 0xFF, 0x00, 0x00, 2, [dasm__XOR], [dasm__XOR]>>8, 1, 0x08 ;XOR A,n 02EE0C01 08 122: - 0943 DDFFAEFF defb 0xDD, 0xFF, 0xAE, 0xFF, 3, [dasm_DD_AE], [dasm_DD_AE]>>8, 2, 0x08, 0x80 ;XOR A,(IX + d) 03F30C02 0880 123: - 094D FDFFAEFF defb 0xFD, 0xFF, 0xAE, 0xFF, 3, [dasm_FD_AE], [dasm_FD_AE]>>8, 2, 0x08, 0x80 ;XOR A,(IY + d) 03FF0C02 0880 124: - 0957 B8F80000 defb 0xB8, 0xF8, 0x00, 0x00, 1, [dasm__CP], [dasm__CP]>>8, 1, 0x07 ;CP A,r / CP A, (HL) 010B0D01 07 125: - 0960 FEFF0000 defb 0xFE, 0xFF, 0x00, 0x00, 2, [dasm__CP], [dasm__CP]>>8, 1, 0x08 ;CP A,n 020B0D01 08 126: - 0969 DDFFBEFF defb 0xDD, 0xFF, 0xBE, 0xFF, 3, [dasm_DD_BE], [dasm_DD_BE]>>8, 2, 0x08, 0x80 ;CP A,(IX + d) 030F0D02 0880 127: - 0973 FDFFBEFF defb 0xFD, 0xFF, 0xBE, 0xFF, 3, [dasm_FD_BE], [dasm_FD_BE]>>8, 2, 0x08, 0x80 ;CP A,(IY + d) 031A0D02 0880 128: - 097D 04C70000 defb 0x04, 0xC7, 0x00, 0x00, 1, [dasm__INC], [dasm__INC]>>8, 1, 0x10 ;INC r / INC (HL) 01250D01 10 129: - 0986 DDFF34FF defb 0xDD, 0xFF, 0x34, 0xFF, 3, [dasm_DD_34], [dasm_DD_34]>>8, 2, 0x08, 0x80 ;INC (IX + d) 032A0D02 0880 130: - 0990 FDFF34FF defb 0xFD, 0xFF, 0x34, 0xFF, 3, [dasm_FD_34], [dasm_FD_34]>>8, 2, 0x08, 0x80 ;INC (IY + d) 03360D02 0880 131: - 099A 05C70000 defb 0x05, 0xC7, 0x00, 0x00, 1, [dasm__DEC], [dasm__DEC]>>8, 1, 0x10 ;DEC r / DEC (HL) 01420D01 10 132: - 09A3 DDFF35FF defb 0xDD, 0xFF, 0x35, 0xFF, 3, [dasm_DD_35], [dasm_DD_35]>>8, 2, 0x08, 0x80 ;DEC (IX + d) 03470D02 0880 133: - 09AD FDFF35FF defb 0xFD, 0xFF, 0x35, 0xFF, 3, [dasm_FD_35], [dasm_FD_35]>>8, 2, 0x08, 0x80 ;DEC (IY + d) 03530D02 0880 134: ;16-Bit Arithmetic Group 135: - 09B7 09CF0000 defb 0x09, 0xCF, 0x00, 0x00, 1, [dasm_09], [dasm_09]>>8, 1, 0x11 ;ADD HL, ss 015F0D01 11 136: - 09C0 EDFF4ACF defb 0xED, 0xFF, 0x4A, 0xCF, 2, [dasm_ED_4A], [dasm_ED_4A]>>8, 1, 0x12 ;ADC HL, ss 02680D01 12 137: - 09C9 EDFF42CF defb 0xED, 0xFF, 0x42, 0xCF, 2, [dasm_ED_42], [dasm_ED_42]>>8, 1, 0x12 ;SBC HL, ss 02710D01 12 138: - 09D2 DDFF09CF defb 0xDD, 0xFF, 0x09, 0xCF, 2, [dasm_DD_09], [dasm_DD_09]>>8, 1, 0x12 ;ADD IX, ss 027A0D01 12 139: - 09DB FDFF09CF defb 0xFD, 0xFF, 0x09, 0xCF, 2, [dasm_FD_09], [dasm_FD_09]>>8, 1, 0x12 ;ADD IY, ss 02830D01 12 140: - 09E4 03CF0000 defb 0x03, 0xCF, 0x00, 0x00, 1, [dasm_03], [dasm_03]>>8, 1, 0x11 ;INC ss 018C0D01 11 141: - 09ED DDFF23FF defb 0xDD, 0xFF, 0x23, 0xFF, 2, [dasm_DD_23], [dasm_DD_23]>>8, 0 ;INC IX 02910D00 142: - 09F5 FDFF23FF defb 0xFD, 0xFF, 0x23, 0xFF, 2, [dasm_FD_23], [dasm_FD_23]>>8, 0 ;INC IY 029A0D00 143: - 09FD 0BCF0000 defb 0x0B, 0xCF, 0x00, 0x00, 1, [dasm_0B], [dasm_0B]>>8, 1, 0x11 ;DEC ss 01A30D01 11 144: - 0A06 DDFF2BFF defb 0xDD, 0xFF, 0x2B, 0xFF, 2, [dasm_DD_2B], [dasm_DD_2B]>>8, 0 ;DEC IX 02A80D00 145: - 0A0E FDFF2BFF defb 0xFD, 0xFF, 0x2B, 0xFF, 2, [dasm_FD_2B], [dasm_FD_2B]>>8, 0 ;DEC IY 02B10D00 146: ;16-Bit Load Group 147: - 0A16 01CF0000 defb 0x01, 0xCF, 0x00, 0x00, 3, [dasm_01], [dasm_01]>>8, 3, 0x11, 0x80, 0x09 ;LD dd, nn 03BA0D03 118009 148: - 0A21 DDFF21FF defb 0xDD, 0xFF, 0x21, 0xFF, 4, [dasm_DD_01], [dasm_DD_01]>>8, 1, 0x0A ;LD IX, nn 04C10D01 0A 149: - 0A2A FDFF21FF defb 0xFD, 0xFF, 0x21, 0xFF, 4, [dasm_FD_01], [dasm_FD_01]>>8, 1, 0x0A ;LD IY, nn 04C90D01 0A 150: - 0A33 2AFF0000 defb 0x2A, 0xFF, 0x00, 0x00, 3, [dasm_2A], [dasm_2A]>>8, 2, 0x09, 0x80 ;LD HL, (nn) 03D10D02 0980 151: - 0A3D EDFF4BCF defb 0xED, 0xFF, 0x4B, 0xCF, 4, [dasm_ED_4B], [dasm_ED_4B]>>8, 4, 0x12, 0x80, 0x0A, 0x81 ;LD dd, (nn) 04DD0D04 12800A81 152: - 0A49 DDFF2AFF defb 0xDD, 0xFF, 0x2A, 0xFF, 4, [dasm_DD_2A], [dasm_DD_2A]>>8, 1, 0x0A ;LD IX, (nn) 04E80D01 0A 153: - 0A52 FDFF2AFF defb 0xFD, 0xFF, 0x2A, 0xFF, 4, [dasm_FD_2A], [dasm_FD_2A]>>8, 1, 0x0A ;LD IY, (nn) 04F40D01 0A 154: - 0A5B 22FF0000 defb 0x22, 0xFF, 0x00, 0x00, 3, [dasm_22], [dasm_22]>>8, 2, 0x0A, 0x80 ;LD (nn), HL 03000E02 0A80 155: - 0A65 EDFF43CF defb 0xED, 0xFF, 0x43, 0xCF, 4, [dasm_ED_43], [dasm_ED_43]>>8, 3, 0x0A, 0x80, 0x12 ;LD (nn), dd 040C0E03 0A8012 156: - 0A70 DDFF22CF defb 0xDD, 0xFF, 0x22, 0xCF, 4, [dasm_DD_22], [dasm_DD_22]>>8, 2, 0x0A, 0x80 ;LD (nn), IX 04160E02 0A80 157: - 0A7A FDFF22CF defb 0xFD, 0xFF, 0x22, 0xCF, 4, [dasm_FD_22], [dasm_FD_22]>>8, 2, 0x0A, 0x80 ;LD (nn), IY 04220E02 0A80 158: - 0A84 F9FF0000 defb 0xF9, 0xFF, 0x00, 0x00, 1, [dasm_F9], [dasm_F9]>>8, 0 ;LD SP, HL 012E0E00 159: - 0A8C DDFFF9FF defb 0xDD, 0xFF, 0xF9, 0xFF, 2, [dasm_DD_F9], [dasm_DD_F9]>>8, 0 ;LD SP, IX 02380E00 160: - 0A94 FDFFF9FF defb 0xFD, 0xFF, 0xF9, 0xFF, 2, [dasm_FD_F9], [dasm_FD_F9]>>8, 0 ;LD SP, IY 02420E00 161: - 0A9C C5CF0000 defb 0xC5, 0xCF, 0x00, 0x00, 1, [dasm_E5], [dasm_E5]>>8, 1, 0x13 ;PUSH qq 014C0E01 13 162: - 0AA5 DDFFE5FF defb 0xDD, 0xFF, 0xE5, 0xFF, 2, [dasm_DD_E5], [dasm_DD_E5]>>8, 0 ;PUSH IX 02520E00 163: - 0AAD FDFFE5FF defb 0xFD, 0xFF, 0xE5, 0xFF, 2, [dasm_FD_E5], [dasm_FD_E5]>>8, 0 ;PUSH IY 025A0E00 164: - 0AB5 C1CF0000 defb 0xC1, 0xCF, 0x00, 0x00, 1, [dasm_E1], [dasm_E1]>>8, 1, 0x13 ;POP qq 01620E01 13 165: - 0ABE DDFFE1FF defb 0xDD, 0xFF, 0xE1, 0xFF, 2, [dasm_DD_E1], [dasm_DD_E1]>>8, 0 ;POP IX 02680E00 166: - 0AC6 FDFFE1FF defb 0xFD, 0xFF, 0xE1, 0xFF, 2, [dasm_FD_E1], [dasm_FD_E1]>>8, 0 ;POP IY 02700E00 167: 168: 169: - 0ACE 4E4F5000 dasm_00: db "NOP",0x00 170: ;JUMP Group 171: - 0AD2 4A502000 dasm_C3: db "JP ",0x00,", ",0x00 2C2000 172: - 0AD9 4A522000 dasm_18: db "JR ",0x00 173: - 0ADD 4A522043 dasm_38: db "JR C, ",0x00 2C2000 174: - 0AE4 4A52204E dasm_30: db "JR NC, ",0x00 432C2000 175: - 0AEC 4A52205A dasm_28: db "JR Z, ",0x00 2C2000 176: - 0AF3 4A52204E dasm_20: db "JR NZ, ",0x00 5A2C2000 177: - 0AFB 4A502028 dasm_E9: db "JP (HL) ",0x00 484C2920 00 178: - 0B04 4A502028 dasm_DD: db "JP (IX) ",0x00 49582920 00 179: - 0B0D 4A502028 dasm_FD: db "JP (IY) ",0x00 49592920 00 180: - 0B16 444A4E5A dasm_10: db "DJNZ ",0x00 2000 181: ;Call and Return Group 182: - 0B1C 43414C4C dasm_CD: db "CALL ",0x00 2000 183: - 0B22 52455420 dasm_C9: db "RET ",0x00 00 184: - 0B27 52455449 dasm_ED_4D: db "RETI",0x00 00 185: - 0B2C 5245544E dasm_ED_45: db "RETN",0x00 00 186: - 0B31 52535420 dasm_FF: db "RST ",0x00 00 187: ;8-Bit load group 188: - 0B36 4C442041 dasm_0A: db "LD A,(BC)",0x00 2C284243 2900 189: - 0B40 4C442041 dasm_1A: db "LD A,(DE)",0x00 2C284445 2900 190: - 0B4A 4C442041 dasm_3A: db "LD A,(",0x00, "h)",0x00 2C280068 2900 191: - 0B54 4C442028 dasm_02: db "LD (BC), A",0x00 4243292C 204100 192: - 0B5F 4C442028 dasm_12: db "LD (DE), A",0x00 4445292C 204100 193: - 0B6A 4C442028 dasm_32: db "LD (",0x00, "h), A",0x00 0068292C 204100 194: - 0B75 4C442000 dasm__LD: db "LD ",0x00 195: - 0B79 4C442041 dasm__ED_57: db "LD A, I",0x00 2C204900 196: - 0B81 4C442041 dasm__ED_5F: db "LD A, R",0x00 2C205200 197: - 0B89 4C442049 dasm__ED_47: db "LD I, A",0x00 2C204100 198: - 0B91 4C442052 dasm__ED_4F: db "LD R, A",0x00 2C204100 199: ;General-Purpose Arithmetic and CPU Control Groups 200: - 0B99 44414100 dasm_27: db "DAA",0x00 201: - 0B9D 43504C00 dasm_2F: db "CPL",0x00 202: - 0BA1 4E454700 dasm_ED_44: db "NEG",0x00 203: - 0BA5 43434600 dasm_3F: db "CCF",0x00 204: - 0BA9 53434600 dasm_37: db "SCF",0x00 205: - 0BAD 48414C54 dasm_76: db "HALT",0x00 00 206: - 0BB2 444900 dasm_F3: db "DI",0x00 207: - 0BB5 454900 dasm_FB: db "EI",0x00 208: - 0BB8 494D2030 dasm_ED_46: db "IM 0",0x00 00 209: - 0BBD 494D2031 dasm_ED_56: db "IM 1",0x00 00 210: - 0BC2 494D2032 dasm_ED_5E: db "IM 2",0x00 00 211: ;Exchange, Block Transfer, and Search Group 212: - 0BC7 45582044 dasm_BE: db "EX DE, HL",0x00 452C2048 4C00 213: - 0BD1 45582041 dasm_08: db "EX AF, AF′",0x00 462C2041 46E280B2 00 214: - 0BDE 45585800 dasm_D9: db "EXX",0x00 215: - 0BE2 45582028 dasm_E3: db "EX (SP), HL",0x00 5350292C 20484C00 216: - 0BEE 45582028 dasm_DD_E3: db "EX (SP), IX",0x00 5350292C 20495800 217: - 0BFA 45582028 dasm_FD_E3: db "EX (SP), IY",0x00 5350292C 20495900 218: - 0C06 4C444900 dasm_ED_A0: db "LDI",0x00 219: - 0C0A 4C444952 dasm_ED_B0: db "LDIR",0x00 00 220: - 0C0F 4C444400 dasm_ED_A8: db "LDD",0x00 221: - 0C13 4C444452 dasm_ED_B8: db "LDDR",0x00 00 222: - 0C18 43504900 dasm_ED_A1: db "CPI",0x00 223: - 0C1C 43504952 dasm_ED_B1: db "CPIR",0x00 00 224: - 0C21 43504400 dasm_ED_A9: db "CPD",0x00 225: - 0C25 43504452 dasm_ED_B9: db "CPDR",0x00 00 226: ;8-Bit Arithmetic Group 227: - 0C2A 41444420 dasm_80C6: db "ADD A, ", 0x00 412C2000 228: - 0C32 41444420 dasm_DD_86: db "ADD A, (IX+", 0x00, "h)",0x00 412C2028 49582B00 682900 229: - 0C41 41444420 dasm_FD_86: db "ADD A, (IY+", 0x00, "h)",0x00 412C2028 49592B00 682900 230: - 0C50 41444320 dasm_C88E: db "ADC A, ", 0x00 412C2000 231: - 0C58 41444320 dasm_DD_8E: db "ADC A, (IX+", 0x00, "h)",0x00 412C2028 49582B00 682900 232: - 0C67 41444320 dasm_FD_8E: db "ADC A, (IY+", 0x00, "h)",0x00 412C2028 49592B00 682900 233: - 0C76 53554220 dasm__SUB: db "SUB ", 0x00 00 234: - 0C7B 53554220 dasm_DD_96: db "SUB (IX+", 0x00, "h)",0x00 2849582B 00682900 235: - 0C87 53554220 dasm_FD_96: db "SUB (IY+", 0x00, "h)",0x00 2849592B 00682900 236: - 0C93 53424320 dasm__SBC: db "SBC A, ", 0x00 412C2000 237: - 0C9B 53424320 dasm_DD_9E: db "SBC A,(IX+", 0x00, "h)",0x00 412C2849 582B0068 2900 238: - 0CA9 53424320 dasm_FD_9E: db "SBC A,(IY+", 0x00, "h)",0x00 412C2849 592B0068 2900 239: - 0CB7 414E4420 dasm__AND: db "AND ", 0x00 00 240: - 0CBC 414E4420 dasm_DD_A6: db "AND (IX+", 0x00, "h)",0x00 2849582B 00682900 241: - 0CC8 414E4420 dasm_FD_A6: db "AND (IY+", 0x00, "h)",0x00 2849592B 00682900 242: - 0CD4 4F522000 dasm__OR: db "OR ", 0x00 243: - 0CD8 4F522028 dasm_DD_B6: db "OR (IX+", 0x00, "h)",0x00 49582B00 682900 244: - 0CE3 4F522028 dasm_FD_B6: db "OR (IY+", 0x00, "h)",0x00 49592B00 682900 245: - 0CEE 584F5220 dasm__XOR: db "XOR ", 0x00 00 246: - 0CF3 584F5220 dasm_DD_AE: db "XOR (IX+", 0x00, "h)",0x00 2849582B 00682900 247: - 0CFF 584F5220 dasm_FD_AE: db "XOR (IY+", 0x00, "h)",0x00 2849592B 00682900 248: - 0D0B 43502000 dasm__CP: db "CP ", 0x00 249: - 0D0F 43502028 dasm_DD_BE: db "CP (IX+", 0x00, "h)",0x00 49582B00 682900 250: - 0D1A 43502028 dasm_FD_BE: db "CP (IY+", 0x00, "h)",0x00 49592B00 682900 251: - 0D25 494E4320 dasm__INC: db "INC ", 0x00 00 252: - 0D2A 494E4320 dasm_DD_34: db "INC (IX+", 0x00, "h)",0x00 2849582B 00682900 253: - 0D36 494E4320 dasm_FD_34: db "INC (IY+", 0x00, "h)",0x00 2849592B 00682900 254: - 0D42 44454320 dasm__DEC: db "DEC ", 0x00 00 255: - 0D47 44454320 dasm_DD_35: db "DEC (IX+", 0x00, "h)",0x00 2849582B 00682900 256: - 0D53 44454320 dasm_FD_35: db "DEC (IY+", 0x00, "h)",0x00 2849592B 00682900 257: ;16-Bit Arithmetic Group 258: - 0D5F 41444420 dasm_09: db "ADD HL, ",0x00 484C2C20 00 259: - 0D68 41444320 dasm_ED_4A: db "ADC HL, ",0x00 484C2C20 00 260: - 0D71 53424320 dasm_ED_42: db "SBC HL, ",0x00 484C2C20 00 261: - 0D7A 41444420 dasm_DD_09: db "ADD IX, ",0x00 49582C20 00 262: - 0D83 41444420 dasm_FD_09: db "ADD IY, ",0x00 49592C20 00 263: - 0D8C 494E4320 dasm_03: db "INC ",0x00 00 264: - 0D91 494E4320 dasm_DD_23: db "INC IX, ",0x00 49582C20 00 265: - 0D9A 494E4320 dasm_FD_23: db "INC IY, ",0x00 49592C20 00 266: - 0DA3 44454320 dasm_0B: db "DEC ",0x00 00 267: - 0DA8 44454320 dasm_DD_2B: db "DEC IX, ",0x00 49582C20 00 268: - 0DB1 44454320 dasm_FD_2B: db "DEC IY, ",0x00 49592C20 00 269: ;16-Bit Load Group 270: - 0DBA 4C442000 dasm_01: db "LD ",0x00, ", ",0x00 2C2000 271: - 0DC1 4C442049 dasm_DD_01: db "LD IX, ",0x00 582C2000 272: - 0DC9 4C442049 dasm_FD_01: db "LD IY, ",0x00 592C2000 273: - 0DD1 4C442048 dasm_2A: db "LD HL, (",0x00,"h)",0x00 4C2C2028 00682900 274: - 0DDD 4C442000 dasm_ED_4B: db "LD ",0x00,", (",0x00,"h)",0x00 2C202800 682900 275: - 0DE8 4C442049 dasm_DD_2A: db "LD IX, (",0x00,"h)",0x00 582C2028 00682900 276: - 0DF4 4C442049 dasm_FD_2A: db "LD IY, (",0x00,"h)",0x00 592C2028 00682900 277: - 0E00 4C442028 dasm_22: db "LD (",0x00,"h), HL",0x00 0068292C 20484C00 278: - 0E0C 4C442028 dasm_ED_43: db "LD (",0x00,"h), ",0x00 0068292C 2000 279: - 0E16 4C442028 dasm_DD_22: db "LD (",0x00,"h), IX",0x00 0068292C 20495800 280: - 0E22 4C442028 dasm_FD_22: db "LD (",0x00,"h), IY",0x00 0068292C 20495900 281: - 0E2E 4C442053 dasm_F9: db "LD SP, HL",0x00 502C2048 4C00 282: - 0E38 4C442053 dasm_DD_F9: db "LD SP, IX",0x00 502C2049 5800 283: - 0E42 4C442053 dasm_FD_F9: db "LD SP, IY",0x00 502C2049 5900 284: - 0E4C 50555348 dasm_E5: db "PUSH ",0x00 2000 285: - 0E52 50555348 dasm_DD_E5: db "PUSH IX",0x00 20495800 286: - 0E5A 50555348 dasm_FD_E5: db "PUSH IY",0x00 20495900 287: - 0E62 50555348 dasm_E1: db "PUSH ",0x00 2000 288: - 0E68 50555348 dasm_DD_E1: db "PUSH IX",0x00 20495800 289: - 0E70 50555348 dasm_FD_E1: db "PUSH IY",0x00 20495900 290: 291: ;Misc 292: - 0E78 2E3F2E00 dasm_UU: db ".?.",0x00 293: - 0E7C 20202020 dasm_UW: db " ",0x00 00 294: 295: - 0E81 dasm_printFlags_table: 296: - 0E81 4E5A db "NZ" 297: - 0E83 5A00 db "Z",0 298: - 0E85 4E43 db "NC" 299: - 0E87 4300 db "C",0 300: - 0E89 504F db "PO" 301: - 0E8B 5045 db "PE" 302: - 0E8D 5000 db "P",0 303: - 0E8F 4D00 db "M",0 304: 305: - 0E91 dasm_printRegister8_table: 306: - 0E91 42 db "B" 307: - 0E92 43 db "C" 308: - 0E93 44 db "D" 309: - 0E94 45 db "E" 310: - 0E95 48 db "H" 311: - 0E96 4C db "L" 312: - 0E97 53 db "S" ;only 18 bit (SP) 313: - 0E98 50 db "P" ;only 18 bit (SP) 314: 315: - 0E99 dasm_printRegisterIX_table: 316: - 0E99 4243 db "BC" 317: - 0E9B 4445 db "DE" 318: - 0E9D 4958 db "IX" 319: - 0E9F 5350 db "SP" 320: - 0EA1 dasm_printRegisterIY_table: 321: - 0EA1 4243 db "BC" 322: - 0EA3 4445 db "DE" 323: - 0EA5 4959 db "IY" 324: - 0EA7 5350 db "SP" 325: 326: - 0EA9 dasm_printRegisterSP_table: 327: - 0EA9 4243 db "BC" 328: - 0EAB 4445 db "DE" 329: - 0EAD 484C db "HL" 330: - 0EAF 4146 db "AF" 331: 332: - 0EB1 dasm_printRegister8_table_HL: **** main.asm **** 479: - 0EB1 28484C29 db "(HL)", 0 00 480: .include "rst.s" **** include/rst.s **** 1: - 0EB6 EXEC_RST_08: 2: 7856+17 0EB6 CDA902 call print_char 3: 7873+10 0EB9 C9 ret 4: 5: 6: - 0EBA EXEC_RST_10: 7: 7883+11 0EBA C5 push bc 8: 7894+11 0EBB D5 push de 9: 7905+11 0EBC E5 push hl 10: ;call vdp_cursor_on 11: 7916+17 0EBD CDEA02 call read_char 12: 7933+11 0EC0 F5 push af 13: ;call vdp_cursor_off 14: 7944+10 0EC1 F1 pop af 15: 7954+10 0EC2 E1 pop hl 16: 7964+10 0EC3 D1 pop de 17: 7974+10 0EC4 C1 pop bc 18: 7984+10 0EC5 C9 ret 19: 20: - 0EC6 EXEC_RST_18: 21: 7994+7 0EC6 3E00 ld a,0 22: 8001+10 0EC8 C9 ret **** main.asm **** 481: ; Strings 482: - 0EC9 STR_Banner_Start: 483: - 0EC9 5A384320 db "Z8C Monitor V2 by Dennis Gunia (2022)",0 4D6F6E69 746F7220 56322062 79204465 6E6E6973 2047756E 69612028 32303232 2900 484: - 0EEF STR_SyntaxError: 485: - 0EEF 73796E3F db "syn?",0 00 486: - 0EF4 STR_Unknown: 487: - 0EF4 636D643F db "cmd?",0 00 488: - 0EF9 STR_HEXDUMP_HEADER: 489: - 0EF9 42415345 db 'BASE 0 1 2 3 4 5 6 7',0 20302020 31202032 20203320 20342020 35202036 20203700 490: 491: .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: - 0F15 xmodem_init: 28: 8011+17 0F15 CD0403 call A_RTS_OFF 29: 30: 8028+7 0F18 3EA7 LD A,10100111b ; Init CTC Channel 3 31: 8035+11 0F1A D306 OUT (CS_CTC_2),A 32: 8046+7 0F1C 3E0E LD A,14 ; 1028.57Hz ISR 33: 8053+11 0F1E D306 OUT (CS_CTC_2),A 34: 8064+7 0F20 3E00 LD A,00h ; Set CTC Ch3 Interrupt Vector 35: 8071+11 0F22 D304 OUT (CS_CTC_0),A 36: ;load int vector to ram 37: 8082+10 0F24 21F50F ld hl,xmodem_int ;CTC Ch3 INT routine 38: 8092+16 0F27 220442 ld (0x4200 + 0x04),hl 39: ;reset timer vars 40: 8108+10 0F2A 210000 ld hl,0x0000 41: 8118+16 0F2D 22FC40 ld (MEM_VAR_TIMEA),hl 42: 8134+16 0F30 22FE40 ld (MEM_VAR_TIMER),hl 43: 44: 8150+7 0F33 3E42 ld a,0x42 ; Set interrupt vector register 45: 8157+9 0F35 ED47 ld i,a 46: 8166+8 0F37 ED5E im 2 ; Z80 Interrupt mode 47: 48: 8174+10 0F39 217010 ld hl,MSG_START ; Print start banner 49: 8184+17 0F3C CDB102 call print_str 50: 8201+4 0F3F FB ei ; Enable interrupts 51: ; init done. Continue with xmodem_await_conn 52: 8205+17 0F40 CDA610 call xmodem_wait 53: 54: - 0F43 xmodem_await_conn: ;Wait for initial connection 55: 8222+7 0F43 3E43 ld a, SYM_C ;Send C to notify sender, that we want CRC 56: 8229+17 0F45 CD4610 call xmodem_out 57: 8246+17 0F48 CD1910 call xmodem_read_wait ;Read with timeout 58: 8263+10 0F4B DA430F jp c, xmodem_await_conn ;Carry flag set = timeout -> repeat 59: ;else continue 60: 61: - 0F4E xmodem_packet: ;XmodemCRC packet start 62: ;use 1st byte to decide further processing 63: 8273+7 0F4E FE04 cp SYM_EOT ;End of Transmission 64: 8280+10 0F50 CAAC0F jp z, xmodem_packet_EOT 65: 8290+7 0F53 FE18 cp SYM_CAN ;Cancel (Force receiver to start sending C's) 66: 8297+10 0F55 CA430F jp z, xmodem_await_conn 67: 8307+7 0F58 FE01 cp SYM_SOH ;Start of 68: 8314+10 0F5A CA600F jp z, xmodem_packet_get 69: 70: 8324+10 0F5D C3B40F jp xmodem_err ;anything else is an error -> abort transmission 71: 72: - 0F60 xmodem_packet_get: ;if first byte == SYM_SOH -> receive block 73: 8334+17 0F60 CD1910 call xmodem_read_wait ;get byte 2 => block ID 74: 8351+10 0F63 DA9810 jp c, xmodem_nak 75: 8361+4 0F66 47 ld b,a 76: 8365+13 0F67 32FB40 ld (MEM_VAR_BLOCK), a ;store block id to memory 77: 8378+17 0F6A CD1910 call xmodem_read_wait ;get byte 3 => block ID complement 78: 8395+10 0F6D DA9810 jp c, xmodem_nak 79: 8405+4 0F70 80 add b 80: 8409+7 0F71 FEFF cp 255 ;both size infos should always sum to 255 81: 8416+10 0F73 C2B40F 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: 8426+4 0F76 3D dec a ;a-1 to remove 1 sector offset 87: 8430+4 0F77 78 ld a,b 88: 8434+4 0F78 1F rra ;shift 1 bit to the right 89: 8438+7 0F79 E67F and 0x7F 90: 8445+4 0F7B 67 ld h,a 91: 8449+4 0F7C 78 ld a,b 92: 8453+4 0F7D 3D dec a ;a-1 to remove 1 sector offset 93: 8457+4 0F7E 0F rrca ;shift bit0 to bit 7 94: 8461+7 0F7F E680 and 0x80 ;mask out all other bits 95: 8468+4 0F81 6F ld l,a 96: ;result: 97: ;hl = 0aaaaaaa a000000 98: 99: 8472+10 0F82 110044 ld de,MEM_LOC_LOAD 100: 8482+11 0F85 19 add hl,de ;add calculated offset to base address 101: ;hl now contains the true start address of this sector 102: 103: 8493+7 0F86 0680 ld b,128 ;preload counter for data baytes 104: 8500+7 0F88 0E00 ld c,0 ;packet length counter ( used for overflow error ) 105: 106: - 0F8A xmodem_packet_get_data: ;get 128 data bytes (loop) 107: 8507+11 0F8A E5 push hl ;push hl onto stack because xmodem_read_wait destroys hl 108: 8518+17 0F8B CD1910 call xmodem_read_wait ;read byte or timeout 109: 8535+10 0F8E DA9810 jp c, xmodem_nak ;if timeout -> nak and retry 110: 8545+10 0F91 E1 pop hl ;restore hl 111: 8555+7 0F92 77 ld (hl), a ;store received byte in memory 112: 8562+6 0F93 23 inc hl ;increment pointer 113: 8568+4 0F94 0C inc c ;increment packet length counter 114: 8572+4 0F95 05 dec b ;decerment data bytes remmaining 115: 8576+10 0F96 C28A0F jp nz, xmodem_packet_get_data ;if bytes remaining, loop 116: ;else continue with crc bytes 117: 118: - 0F99 xmodem_packet_get_crc: ;get 16-Bit CRC 119: 8586+17 0F99 CD1910 call xmodem_read_wait 120: 8603+10 0F9C DA9810 jp c, xmodem_nak 121: 8613+4 0F9F 57 ld d,a 122: 8617+4 0FA0 0C inc c 123: 8621+17 0FA1 CD1910 call xmodem_read_wait 124: 8638+10 0FA4 DA9810 jp c, xmodem_nak 125: 8648+4 0FA7 5F ld e,a 126: 8652+4 0FA8 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: 8656+10 0FA9 C38A10 jp xmodem_ack ;ack block -> then jump to start again 134: 135: - 0FAC xmodem_packet_EOT: ;End of transmission SUB. 136: 8666+7 0FAC 3E06 ld a, SYM_ACK ;Acknowledge EOT 137: 8673+17 0FAE CD4610 call xmodem_out 138: 8690+10 0FB1 C3EE0F jp xmodem_end ;and end xmodem 139: 140: 141: 142: - 0FB4 xmodem_err: ;non recoverable error -> abort 143: 8700+7 0FB4 3E18 ld a, SYM_CAN 144: 8707+17 0FB6 CD4610 call xmodem_out 145: 8724+7 0FB9 3E18 ld a, SYM_CAN 146: 8731+17 0FBB CD4610 call xmodem_out 147: 8748+7 0FBE 3E18 ld a, SYM_CAN 148: 8755+17 0FC0 CD4610 call xmodem_out 149: 8772+7 0FC3 3E18 ld a, SYM_CAN 150: 8779+17 0FC5 CD4610 call xmodem_out 151: 8796+7 0FC8 3E18 ld a, SYM_CAN 152: 8803+17 0FCA CD4610 call xmodem_out 153: 8820+7 0FCD 3E18 ld a, SYM_CAN 154: 8827+17 0FCF CD4610 call xmodem_out 155: 8844+7 0FD2 3E18 ld a, SYM_CAN 156: 8851+17 0FD4 CD4610 call xmodem_out 157: 8868+7 0FD7 3E18 ld a, SYM_CAN 158: 8875+17 0FD9 CD4610 call xmodem_out 159: 8892+7 0FDC 3E18 ld a, SYM_CAN 160: 8899+17 0FDE CD4610 call xmodem_out 161: 8916+7 0FE1 3E18 ld a, SYM_CAN 162: 8923+17 0FE3 CD4610 call xmodem_out 163: 8940+7 0FE6 3E18 ld a, SYM_CAN 164: 165: 8947+10 0FE8 215710 ld hl, MSG_ERROR 166: 8957+17 0FEB CDB102 call print_str 167: 168: ;overflow to end 169: - 0FEE xmodem_end: 170: 8974+4 0FEE F3 di ;disable interrupts 171: 8978+17 0FEF CDC302 call print_newLine ;print new line 172: 8995+10 0FF2 C38B00 jp PROMPT_BEGIN ;return ti prompt 173: 174: ;isr is used as counter for timeouts 175: - 0FF5 xmodem_int: 176: 9005+4 0FF5 F3 di ;setup ISR (disable further interrupts, exchange registers) 177: 9009+4 0FF6 08 ex AF,AF' 178: 9013+4 0FF7 D9 exx 179: 180: 9017+16 0FF8 2AFC40 ld hl,(MEM_VAR_TIMEA) ;millis counter 181: 9033+6 0FFB 23 inc hl 182: 9039+16 0FFC 22FC40 ld (MEM_VAR_TIMEA),hl 183: 184: 9055+10 0FFF 110404 ld de,1028 ;every 1028 millis counter 185: 9065+15 1002 ED52 sbc hl,de 186: 9080+10 1004 C21410 jp nz, xmodem_int_cont ;if less than 1028 millis, loop 187: 188: 9090+10 1007 210000 ld hl,0 ;reset millis 189: 9100+16 100A 22FC40 ld (MEM_VAR_TIMEA),hl 190: 9116+16 100D 2AFE40 ld hl,(MEM_VAR_TIMER) ;incement seconds 191: 9132+6 1010 23 inc hl 192: 9138+16 1011 22FE40 ld (MEM_VAR_TIMER),hl 193: - 1014 xmodem_int_cont: ;end isr 194: 9154+4 1014 08 ex AF,AF' ;restore registers 195: 9158+4 1015 D9 exx 196: 9162+4 1016 FB EI ;enable interrupts 197: 9166+14 1017 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: - 1019 xmodem_read_wait: 207: 9180+4 1019 F3 di 208: 9184+10 101A 210000 ld hl,0 209: 9194+16 101D 22FC40 ld (MEM_VAR_TIMEA),hl 210: 9210+16 1020 22FE40 ld (MEM_VAR_TIMER),hl 211: 9226+4 1023 FB ei 212: 9230+17 1024 CD0D03 call A_RTS_ON 213: - 1027 xmodem_read_wait_loop: 214: ;check timeout 215: 9247+16 1027 2AFE40 ld hl,(MEM_VAR_TIMER) 216: 9263+4 102A 7D ld a, l 217: 9267+7 102B FE03 cp xmodem_read_timeount 218: 9274+10 102D CA4410 jp z, xmodem_read_wait_timeout ;if timeout retry 219: 220: ; if no timeout 221: 9284+4 1030 AF xor a ; a = 0 222: 9288+11 1031 D309 out (CS_SIO_A_C), a ; select reg 0 223: 9299+11 1033 DB09 in a, (CS_SIO_A_C) ; read reg 0 224: 9310+7 1035 E601 and 1 ; mask D0 (recieve char available) 225: 9317+10 1037 CA2710 jp Z,xmodem_read_wait_loop ; wait if no char 226: 227: ; if char avail 228: 9327+11 103A DB08 in a, (CS_SIO_A_D) ; read char 229: ;call debug_a_hex 230: 9338+11 103C F5 push af 231: 9349+17 103D CD0403 call A_RTS_OFF 232: 9366+10 1040 F1 pop af 233: 9376+4 1041 37 scf 234: 9380+4 1042 3F ccf 235: 9384+10 1043 C9 ret ; return 236: - 1044 xmodem_read_wait_timeout: 237: 9394+4 1044 37 scf 238: 9398+10 1045 C9 ret 239: 240: 241: - 1046 xmodem_out: 242: 9408+11 1046 D308 out (CS_SIO_A_D), a 243: 9419+17 1048 CD4C10 call xmodem_wait_out 244: 9436+10 104B C9 ret 245: 246: - 104C xmodem_wait_out: 247: 9446+4 104C 97 sub a ;clear a, write into WR0: select RR0 248: 9450+4 104D 3C inc a ;select RR1 249: 9454+11 104E D309 out (CS_SIO_A_C),A 250: 9465+11 1050 DB09 in A,(CS_SIO_A_C) ;read RRx 251: 9476+8 1052 CB47 bit 0,A 252: 9484+7+5 1054 28F6 jr z,xmodem_wait_out 253: 9491+10 1056 C9 ret 254: 255: - 1057 MSG_ERROR: 256: - 1057 4572726F db "Error: unexpected byte",13,10,0 723A2075 6E657870 65637465 64206279 74650D0A 00 257: 258: - 1070 MSG_START: 259: - 1070 41776169 db "Await xmodem connection",13,10,0 7420786D 6F64656D 20636F6E 6E656374 696F6E0D 0A00 260: 261: 262: - 108A xmodem_ack: ;ack routine. Only use when expecting transmission afterwards. 263: 9501+7 108A 3E06 ld a, SYM_ACK ;send ACK 264: 9508+17 108C CD4610 call xmodem_out 265: 9525+17 108F CD1910 call xmodem_read_wait ;wait for response 266: 9542+10 1092 DA8A10 jp c, xmodem_ack ;if timeout repeat 267: 9552+10 1095 C34E0F jp xmodem_packet ;if received, continue with new packet 268: 269: - 1098 xmodem_nak: ;nak routine. Only use when expecting transmission afterwards. 270: 9562+7 1098 3E15 ld a, SYM_NAK ;send NAK 271: 9569+17 109A CD4610 call xmodem_out 272: 9586+17 109D CD1910 call xmodem_read_wait ;wait for response 273: 9603+10 10A0 DA9810 jp c, xmodem_nak ;if timeout repeat 274: 9613+10 10A3 C34E0F jp xmodem_packet ;if received, continue with new packet 275: 276: - 10A6 xmodem_wait: 277: 9623+10 10A6 21FF00 ld hl, 0xFF 278: 9633+10 10A9 010100 ld bc, 0x01 279: - 10AC xmodem_wait_1: 280: 9643+4 10AC 00 nop 281: 9647+4 10AD 00 nop 282: 9651+4 10AE 00 nop 283: 9655+4 10AF 00 nop 284: 9659+15 10B0 ED42 sbc hl,bc 285: 9674+5+6 10B2 C8 ret Z **** main.asm **** 492: 9679+12 10B3 18F7 jr xmodem_wait_1 **** main.asm **** 493: ;.include "debug.s" Statistics: 4 passes 0 jr promotions 332 symbols 4251 bytes Symbol Table: AY0_WRITE_REG 83 131 A_RTS_OFF 304 772 A_RTS_ON 30D 781 CMD_DASM 22B 555 CMD_EXEC 121 289 CMD_IO_READ 20F 527 CMD_IO_WRITE 1E6 486 CMD_SET 1AA 426 CMD_SET_END 1E0 480 CMD_SET_LOOP 1C5 453 CMD_SYNTAX_ERROR 264 612 CMD_VIEW 140 320 CMD_VIEW_END 1A4 420 CMD_VIEW_ROW 179 377 CMD_VIEW_ROW_LOOP 18B 395 CONSOLE_INIT 270 624 CONSOLE_INIT_CTC 270 624 CONSOLE_INIT_SIO 278 632 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_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 316 790 DHEX_TO_BYTE_FAILED 332 818 EXEC_RST_08 EB6 3766 EXEC_RST_10 EBA 3770 EXEC_RST_18 EC6 3782 HEX_TO_BIN 336 822 HEX_TO_BIN_2 344 836 HEX_TO_INVALID_2 34B 843 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_PIO_0_A_C =61 97 IO_PIO_0_A_D =60 96 IO_PIO_0_B_C =63 99 IO_PIO_0_B_D =62 98 IO_PIO_1_A_C =65 101 IO_PIO_1_A_D =64 100 IO_PIO_1_B_C =67 103 IO_PIO_1_B_D =66 102 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 270 624 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 2FC 764 MSG_ERROR 1057 4183 MSG_START 1070 4208 PRG_RAM_START =4110 16656 PRG_RAM_TOP =FF00 65280 PROG_MEM_START =4000 16384 PROG_ROM_START = 100 256 PROMPT_BEGIN 8B 139 PROMPT_BEGIN_READ_BACKSPACE C8 200 PROMPT_BEGIN_READ_LOOP 97 151 PROMPT_BEGIN_READ_PROCESS EE 238 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 34D 845 STRCONV_BYTES_TO_HEX_1 35C 860 STRCONV_BYTES_TO_HEX_2 366 870 STR_Banner_Start EC9 3785 STR_HEXDUMP_HEADER EF9 3833 STR_SyntaxError EEF 3823 STR_Unknown EF4 3828 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 dasm_00 ACE 2766 dasm_01 DBA 3514 dasm_02 B54 2900 dasm_03 D8C 3468 dasm_08 BD1 3025 dasm_09 D5F 3423 dasm_0A B36 2870 dasm_0B DA3 3491 dasm_10 B16 2838 dasm_12 B5F 2911 dasm_18 AD9 2777 dasm_1A B40 2880 dasm_20 AF3 2803 dasm_22 E00 3584 dasm_27 B99 2969 dasm_28 AEC 2796 dasm_2A DD1 3537 dasm_2F B9D 2973 dasm_30 AE4 2788 dasm_32 B6A 2922 dasm_37 BA9 2985 dasm_38 ADD 2781 dasm_3A B4A 2890 dasm_3F BA5 2981 dasm_76 BAD 2989 dasm_80C6 C2A 3114 dasm_BE BC7 3015 dasm_C3 AD2 2770 dasm_C88E C50 3152 dasm_C9 B22 2850 dasm_CD B1C 2844 dasm_D9 BDE 3038 dasm_DD B04 2820 dasm_DD_01 DC1 3521 dasm_DD_09 D7A 3450 dasm_DD_22 E16 3606 dasm_DD_23 D91 3473 dasm_DD_2A DE8 3560 dasm_DD_2B DA8 3496 dasm_DD_34 D2A 3370 dasm_DD_35 D47 3399 dasm_DD_86 C32 3122 dasm_DD_8E C58 3160 dasm_DD_96 C7B 3195 dasm_DD_9E C9B 3227 dasm_DD_A6 CBC 3260 dasm_DD_AE CF3 3315 dasm_DD_B6 CD8 3288 dasm_DD_BE D0F 3343 dasm_DD_E1 E68 3688 dasm_DD_E3 BEE 3054 dasm_DD_E5 E52 3666 dasm_DD_F9 E38 3640 dasm_E1 E62 3682 dasm_E3 BE2 3042 dasm_E5 E4C 3660 dasm_E9 AFB 2811 dasm_ED_42 D71 3441 dasm_ED_43 E0C 3596 dasm_ED_44 BA1 2977 dasm_ED_45 B2C 2860 dasm_ED_46 BB8 3000 dasm_ED_4A D68 3432 dasm_ED_4B DDD 3549 dasm_ED_4D B27 2855 dasm_ED_56 BBD 3005 dasm_ED_5E BC2 3010 dasm_ED_A0 C06 3078 dasm_ED_A1 C18 3096 dasm_ED_A8 C0F 3087 dasm_ED_A9 C21 3105 dasm_ED_B0 C0A 3082 dasm_ED_B1 C1C 3100 dasm_ED_B8 C13 3091 dasm_ED_B9 C25 3109 dasm_F3 BB2 2994 dasm_F9 E2E 3630 dasm_FB BB5 2997 dasm_FD B0D 2829 dasm_FD_01 DC9 3529 dasm_FD_09 D83 3459 dasm_FD_22 E22 3618 dasm_FD_23 D9A 3482 dasm_FD_2A DF4 3572 dasm_FD_2B DB1 3505 dasm_FD_34 D36 3382 dasm_FD_35 D53 3411 dasm_FD_86 C41 3137 dasm_FD_8E C67 3175 dasm_FD_96 C87 3207 dasm_FD_9E CA9 3241 dasm_FD_A6 CC8 3272 dasm_FD_AE CFF 3327 dasm_FD_B6 CE3 3299 dasm_FD_BE D1A 3354 dasm_FD_E1 E70 3696 dasm_FD_E3 BFA 3066 dasm_FD_E5 E5A 3674 dasm_FD_F9 E42 3650 dasm_FF B31 2865 dasm_UU E78 3704 dasm_UW E7C 3708 dasm__AND CB7 3255 dasm__CP D0B 3339 dasm__DEC D42 3394 dasm__ED_47 B89 2953 dasm__ED_4F B91 2961 dasm__ED_57 B79 2937 dasm__ED_5F B81 2945 dasm__INC D25 3365 dasm__LD B75 2933 dasm__OR CD4 3284 dasm__SBC C93 3219 dasm__SUB C76 3190 dasm__XOR CEE 3310 dasm_opcode_table 676 1654 dasm_print16hex_addr 4A3 1187 dasm_print8hex 4BB 1211 dasm_printFlags_table E81 3713 dasm_printRegister8_table E91 3729 dasm_printRegister8_table_HL EB1 3761 dasm_printRegisterIX_table E99 3737 dasm_printRegisterIY_table EA1 3745 dasm_printRegisterSP_table EA9 3753 disassemble 367 871 disassemble_continue 44D 1101 disassemble_err 43D 1085 disassemble_next 36B 875 disassemble_print_opcode_params_end 43A 1082 disassemble_print_opcode_params_loop 3E6 998 disassemble_print_opcode_raw 3A8 936 disassemble_print_opcode_raw_fill 3BC 956 disassemble_table_first_match 47F 1151 disassemble_table_found 499 1177 disassemble_table_notfound 49D 1181 disassemble_table_seek 45B 1115 disassemble_table_seek_loop 45F 1119 mon_start_complete 76 118 mon_start_init_ctc 50 80 mon_start_init_serial 5F 95 mon_start_init_sound 50 80 mon_start_ram 62 98 mon_start_ram_loop 6B 107 mon_var_template 44 68 mon_var_template_end 402A 16426 param_01 4C9 1225 param_02 4F0 1264 param_03 50D 1293 param_03_done 545 1349 param_03_neg 52E 1326 param_04 549 1353 param_04_i 559 1369 param_05 55F 1375 param_06 56C 1388 param_07 586 1414 param_08 593 1427 param_09 5A8 1448 param_09_0A 5AE 1454 param_0A 59F 1439 param_10 5BD 1469 param_11 5CD 1485 param_11_12 5DC 1500 param_11_12_all 5FC 1532 param_11_12_def 5EF 1519 param_11_12_ix 5F4 1524 param_11_12_iy 5F9 1529 param_12 5D5 1493 param_13 60D 1549 param_80 62C 1580 param_80_seek 633 1587 param_81 623 1571 param_comma 667 1639 param_printRegister 642 1602 param_printRegisterA 660 1632 param_printRegisterHL 658 1624 print_a_hex 2D9 729 print_char 2A9 681 print_clear 2BC 700 print_newLine 2C3 707 print_str 2B1 689 print_str_end 2BB 699 print_wait_out 2CE 718 read_char 2EA 746 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 108A 4234 xmodem_await_conn F43 3907 xmodem_end FEE 4078 xmodem_err FB4 4020 xmodem_init F15 3861 xmodem_int FF5 4085 xmodem_int_cont 1014 4116 xmodem_nak 1098 4248 xmodem_out 1046 4166 xmodem_packet F4E 3918 xmodem_packet_EOT FAC 4012 xmodem_packet_get F60 3936 xmodem_packet_get_crc F99 3993 xmodem_packet_get_data F8A 3978 xmodem_read_timeount=03 3 xmodem_read_wait 1019 4121 xmodem_read_wait_loop 1027 4135 xmodem_read_wait_timeout 1044 4164 xmodem_wait 10A6 4262 xmodem_wait_1 10AC 4268 xmodem_wait_out 104C 4172