4418 lines
186 KiB
Plaintext
4418 lines
186 KiB
Plaintext
1: ;----------------------------------------------------------------
|
||
2: ;Z8C Homebrew Computer Monitor
|
||
3: ;by Dennis Gunia (01/2023)
|
||
4: ;----------------------------------------------------------------
|
||
5:
|
||
6: ;================================================================
|
||
7: ; Memory areas
|
||
8: ;================================================================
|
||
9: - 4000 SYS_RAM_START equ 0x4000
|
||
10: - 4010 SYS_BUF_START equ 0x4010
|
||
11: - 4110 PRG_RAM_START equ 0x4110
|
||
12: - FF00 PRG_RAM_TOP equ 0xFF00
|
||
13: - FFFF STACK_RAM_TOP equ 0xFFFF
|
||
14:
|
||
15: ;================================================================
|
||
16: ; Terminal configuration
|
||
17: ;================================================================
|
||
18: - 000F VAR_CONSOLE_CONF equ 0x0F ;CPU/16 Clock @ 230402.5625/s
|
||
19: - 0018 VAR_CONSOLE_BAUD equ 24 ;BAUD timer constant
|
||
20: ;CLK/TRG Clock @ 1843220.5/s
|
||
21: ; -> 0x16 : 14400
|
||
22: ;CPU/16 Clock @ 230402.5625/s
|
||
23: ; -> 12 : 19200
|
||
24: ; -> 24 : 9600
|
||
25:
|
||
26: ;================================================================
|
||
27: ; Includes (1/2)
|
||
28: ;================================================================
|
||
29: ; include IO device addresses
|
||
30: .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
|
||
48:
|
||
49: - 00F8 CS_APU_DATA .EQU 0xF8
|
||
**** main.asm ****
|
||
31: - 00F9 CS_APU_CTRL .EQU 0xF9
|
||
32:
|
||
33: ;================================================================
|
||
34: ; RST Vectors for BASIC
|
||
35: ;================================================================
|
||
36: - 0000 org 0x0000
|
||
37: - 0000 RST_00: ;Hardware Restart
|
||
38: 0+10 0000 C35000 jp BOOT_PHASE0
|
||
39:
|
||
40: - 0008 org 0x0008
|
||
41: - 0008 RST_08 ;Print Char
|
||
42: 10+10 0008 C3040D jp EXEC_RST_08
|
||
43:
|
||
44: - 0010 org 0x0010
|
||
45: - 0010 RST_10 ;receive char
|
||
46: 20+10 0010 C3080D jp EXEC_RST_10
|
||
47:
|
||
48: - 0018 org 0x0018
|
||
49: - 0018 RST_18 ;Buffer length
|
||
50: 30+10 0018 C3140D jp EXEC_RST_18
|
||
51:
|
||
52: ;================================================================
|
||
53: ; Default interrupt vectors
|
||
54: ;================================================================
|
||
55: - 001B INT_VEC:
|
||
56: - 0044 org 0x0044
|
||
57: ;DEFW EXEC_INT_VDP
|
||
58:
|
||
59: ;================================================================
|
||
60: ; Memory layout
|
||
61: ;================================================================
|
||
62: - 0044 mon_var_template:
|
||
63: - 4000 phase SYS_RAM_START
|
||
64:
|
||
65: - 4000 var_buffer_len:
|
||
66: - 4000 00 defb 0
|
||
67: - 4001 var_last_char:
|
||
68: - 4001 00 defb 0
|
||
69: - 4002 var_curserx:
|
||
70: - 4002 00 defb 0
|
||
71: - 4003 var_cursery:
|
||
72: - 4003 00 defb 0
|
||
73: - 4004 var_curserstate:
|
||
74: - 4004 00 defb 0
|
||
75: - 4005 var_curseron:
|
||
76: - 4005 00 defb 0
|
||
77: - 4006 var_curserchar:
|
||
78: - 4006 00 defb 0
|
||
79: - 4007 var_curserlastaddr:
|
||
80: - 4007 0000 defw 0
|
||
81: - 4009 var_pio_present:
|
||
82: - 4009 00 defb 0
|
||
83: - 400A var_apu_present:
|
||
84: - 400A 00 defb 0
|
||
85: - 400B var_scratch:
|
||
86: - 400B ..401A 00 defs 16 ;16 bytes space for scratch vars
|
||
87: - 401B var_ps2mem:
|
||
88: - 401B ..402A 00 defs 16 ;16 bytes space for scratch vars
|
||
89: - 402B var_buffer:
|
||
90: - 402B 00 defb 0 ;var lentgh
|
||
91: - 402C var_idebuffer:
|
||
92: - 402C ..432B 00 defs 768
|
||
93:
|
||
94: - 0370 dephase
|
||
95: - 0370 mon_var_template_end:
|
||
96: 40+4 0370 00 nop
|
||
97:
|
||
98: ;================================================================
|
||
99: ; Start of monitor
|
||
100: ;================================================================
|
||
101: - 0050 org 0x0050
|
||
102: - 0050 BOOT_PHASE0: ;Setup Hardware
|
||
103: ;Setup Stack-Pointer
|
||
104: 44+10 0050 31FFFF ld sp, STACK_RAM_TOP
|
||
105: ;Disable Interrupts
|
||
106: 54+4 0053 F3 di
|
||
107: ;Setup PIO on MIO Board
|
||
108: 58+7 0054 3ECF LD A,0xCF
|
||
109: 65+11 0056 D3F6 OUT (CS_PIO_AC), A
|
||
110: 76+7 0058 3EF7 LD A,11110111b ;All pins inputs except speaker
|
||
111: 83+11 005A D3F6 OUT (CS_PIO_AC), A
|
||
112: 94+7 005C 3E03 LD A,00000011B ;Preset I2C pins to high
|
||
113: 101+11 005E D3F6 OUT (CS_PIO_AC), A
|
||
114:
|
||
115: ;Set variables
|
||
116: 112+13 0060 320440 ld (var_curserstate),a
|
||
117: 125+13 0063 320540 ld (var_curseron),a
|
||
118: 138+7 0066 3E20 ld a, " "
|
||
119: 145+13 0068 320640 ld (var_curserchar),a
|
||
120:
|
||
121: ;Initialize Console (Serial-Port)
|
||
122: 158+17 006B CD9E00 call CONSOLE_INIT
|
||
123:
|
||
124: - 006E BOOT_PHASE1: ;Copy default values to RAM
|
||
125: 175+10 006E 214400 ld hl,mon_var_template
|
||
126: 185+10 0071 117003 ld de,mon_var_template_end
|
||
127: 195+10 0074 010040 ld bc,SYS_RAM_START
|
||
128: - 0077 BOOT_PHASE1_LOOP:
|
||
129: 205+7 0077 7E ld a,(hl) ;copy values
|
||
130: 212+7 0078 02 ld (bc),a
|
||
131: 219+6 0079 23 inc hl
|
||
132: 225+6 007A 03 inc bc
|
||
133: 231+11 007B E5 push hl ;check if end is reached
|
||
134: 242+15 007C ED52 sbc hl,de
|
||
135: 257+10 007E E1 pop hl
|
||
136: 267+10 007F C27700 jp nz, BOOT_PHASE1_LOOP
|
||
137: ;template copy done
|
||
138:
|
||
139: - 0082 BOOT_PHASE2: ;Hardware initialized.
|
||
140: ; Print banner
|
||
141: 277+17 0082 CDEA00 call print_clear
|
||
142: 294+10 0085 216F1E ld hl, [STR_Banner_Start]
|
||
143: 304+17 0088 CDDF00 call print_str
|
||
144:
|
||
145: ; Power-On Self Tests
|
||
146: 321+17 008B CDDD1C call POST_START
|
||
147:
|
||
148: ; Detect IDE drives
|
||
149: 338+17 008E CDAB14 call ideif_init_all
|
||
150:
|
||
151: ; Beep after start
|
||
152: 355+10 0091 114000 LD DE,0x40
|
||
153: 365+10 0094 014800 LD BC,0x48
|
||
154: 375+17 0097 CD170D CALL beep
|
||
155:
|
||
156: ; Start commandline
|
||
157: 392+10 009A C3EB17 jp COMMAND
|
||
158:
|
||
159: ; This instruction should never be reached
|
||
160: 402+4 009D 76 halt
|
||
161:
|
||
162: ;================================================================
|
||
163: ; Includes (2/2)
|
||
164: ;================================================================
|
||
165: .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/<BAUD>
|
||
5: ;
|
||
6: ;9600 -> 12 / 00110000
|
||
7: ;
|
||
8:
|
||
9: - 009E CONSOLE_INIT:
|
||
10: - 009E CONSOLE_INIT_CTC:
|
||
11: ;LD A,00001111b ; Set /16 Divider, CPU Trigger, Time COnstant Follows
|
||
12: 406+7 009E 3E4F LD A,01001111b ; External Trigger, Time COnstant Follows
|
||
13: 413+11 00A0 D304 OUT (CS_CTC_0),A
|
||
14: 424+11 00A2 DB01 IN A,(CS_DIP) ; Read BAUD from DIP-Switches
|
||
15: ;LD A,39
|
||
16: 435+11 00A4 D304 OUT (CS_CTC_0),A
|
||
17: - 00A6 CONSOLE_INIT_SIO:
|
||
18: 446+7 00A6 3E30 LD A,00110000b ;write into WR0: error reset, select WR0
|
||
19: 453+11 00A8 D309 OUT (CS_SIO_A_C),A
|
||
20: 464+7 00AA 3E18 LD a,018h ;write into WR0: channel reset
|
||
21: 471+11 00AC D309 OUT (CS_SIO_A_C),A
|
||
22: 482+7 00AE 3E04 LD a,004h ;write into WR0: select WR4
|
||
23: 489+11 00B0 D309 OUT (CS_SIO_A_C),A
|
||
24: 500+7 00B2 3E44 LD a,01000100b ;write into WR4: clkx16,1 stop bit, no parity
|
||
25: 507+11 00B4 D309 OUT (CS_SIO_A_C),A
|
||
26: 518+7 00B6 3E05 LD a,005h ;write into WR0: select WR5
|
||
27: 525+11 00B8 D309 OUT (CS_SIO_A_C),A
|
||
28: 536+7 00BA 3EE8 LD a,11101000b ;DTR inactive, TX 8bit, BREAK off, TX on, RTS inactive
|
||
29: 543+11 00BC D309 OUT (CS_SIO_A_C),A
|
||
30: 554+7 00BE 3E01 LD a,01h ;write into WR0: select WR1
|
||
31: 561+11 00C0 D309 OUT (CS_SIO_A_C),A
|
||
32: 572+7 00C2 3E04 LD a,00000100b ;no interrupt in CH B, special RX condition affects vect
|
||
33: 579+11 00C4 D309 OUT (CS_SIO_A_C),A
|
||
34: 590+7 00C6 3E02 LD a,02h ;write into WR0: select WR2
|
||
35: 597+11 00C8 D309 OUT (CS_SIO_A_C),A
|
||
36: 608+7 00CA 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: 615+11 00CC D309 OUT (CS_SIO_A_C),A
|
||
39: 626+7 00CE 3E03 LD a,003h ;write into WR0: select WR3
|
||
40: 633+11 00D0 D309 OUT (CS_SIO_A_C),A
|
||
41: 644+7 00D2 3EC1 LD a,0C1h ;RX 8bit, auto enable off, RX on
|
||
42: 651+11 00D4 D309 OUT (CS_SIO_A_C),A
|
||
43: ;Channel A RX active
|
||
44: 662+10 00D6 C9 RET
|
||
45:
|
||
46: ; A contains char
|
||
47: ; Destroys A
|
||
48: - 00D7 print_char:
|
||
49: 672+11 00D7 F5 push af
|
||
50: 683+11 00D8 D308 out (CS_SIO_A_D),a
|
||
51: 694+17 00DA CDFC00 call print_wait_out
|
||
52: 711+10 00DD F1 pop af
|
||
53: ;call print_char
|
||
54: 721+10 00DE C9 ret
|
||
55: ; HL contains pointer to string
|
||
56: ; Destroy A, HL
|
||
57:
|
||
58: - 00DF print_str:
|
||
59: 731+7 00DF 7E ld a, (hl)
|
||
60: 738+4 00E0 B7 or a
|
||
61: 742+7+5 00E1 2806 jr z,print_str_end
|
||
62: 749+17 00E3 CDD700 call print_char
|
||
63: 766+6 00E6 23 inc hl
|
||
64: 772+12 00E7 18F6 jr print_str
|
||
65: - 00E9 print_str_end:
|
||
66: 784+10 00E9 C9 ret
|
||
67:
|
||
68: - 00EA print_clear:
|
||
69: 794+10 00EA 214A01 ld hl, [MSG_CLEAR]
|
||
70: 804+17 00ED CDDF00 call print_str
|
||
71: 821+10 00F0 C9 ret
|
||
72:
|
||
73: - 00F1 print_newLine:
|
||
74: 831+7 00F1 3E0A ld a,10
|
||
75: 838+17 00F3 CDD700 call print_char
|
||
76: 855+7 00F6 3E0D ld a,13
|
||
77: 862+17 00F8 CDD700 call print_char
|
||
78: 879+10 00FB C9 ret
|
||
79: ; destroys a
|
||
80: - 00FC print_wait_out:
|
||
81: ; check for TX buffer empty
|
||
82: 889+4 00FC 97 sub a ;clear a, write into WR0: select RR0
|
||
83: 893+4 00FD 3C inc a ;select RR1
|
||
84: 897+11 00FE D309 out (CS_SIO_A_C),A
|
||
85: 908+11 0100 DB09 in A,(CS_SIO_A_C) ;read RRx
|
||
86: 919+8 0102 CB47 bit 0,A
|
||
87: 927+7+5 0104 28F6 jr z,print_wait_out
|
||
88: 934+10 0106 C9 ret
|
||
89:
|
||
90: - 0107 print_a_hex:
|
||
91: 944+11 0107 F5 push af
|
||
92: 955+11 0108 C5 push bc
|
||
93: 966+11 0109 D5 push de
|
||
94: 977+17 010A CD9B01 call STRCONV_BYTES_TO_HEX
|
||
95: 994+4 010D 78 ld a,b
|
||
96: 998+17 010E CDD700 call print_char
|
||
97: 1015+4 0111 79 ld a,c
|
||
98: 1019+17 0112 CDD700 call print_char
|
||
99: 1036+10 0115 D1 pop de
|
||
100: 1046+10 0116 C1 pop bc
|
||
101: 1056+10 0117 F1 pop af
|
||
102: 1066+10 0118 C9 ret
|
||
103:
|
||
104: - 0119 print_bcd:
|
||
105: 1076+7 0119 C630 ADD 48 ;offset for ascii number
|
||
106: 1083+17 011B CDD700 call print_char
|
||
107: 1100+10 011E C9 ret
|
||
108:
|
||
109: - 011F read_char:
|
||
110: 1110+17 011F CD5B01 call A_RTS_ON
|
||
111: 1127+4 0122 00 nop
|
||
112: 1131+4 0123 AF xor a ; a = 0
|
||
113: 1135+11 0124 D309 out (CS_SIO_A_C), a ; select reg 0
|
||
114: 1146+11 0126 DB09 in a, (CS_SIO_A_C) ; read reg 0
|
||
115: 1157+7 0128 E601 and 1 ; mask D0 (recieve char available)
|
||
116: 1164+17 012A CD5201 call A_RTS_OFF
|
||
117: 1181+5+6 012D C8 ret Z ; return 0 if no char
|
||
118: 1186+11 012E DB08 in a, (CS_SIO_A_D) ; read char if avail
|
||
119: 1197+10 0130 C9 ret ; return
|
||
120:
|
||
121: - 0131 read_bcd;
|
||
122: 1207+17 0131 CD1F01 call read_char
|
||
123: 1224+10 0134 CA3101 jp z, read_bcd
|
||
124: 1234+17 0137 CDD700 call print_char
|
||
125: 1251+7 013A DE30 sbc 48 ;remove ascii offset
|
||
126: 1258+10 013C DA4701 jp c, _read_bcd_invalid ;if carry, wrong input
|
||
127: 1268+7 013F FE0A cp 10
|
||
128: 1275+10 0141 CA4701 jp z, _read_bcd_invalid ;if equal or greater than 10, also error
|
||
129: 1285+7 0144 E60F and 0x0F ;mask unused bits
|
||
130: 1292+10 0146 C9 ret
|
||
131: - 0147 _read_bcd_invalid
|
||
132: 1302+7 0147 3EFF ld a, 0xFF
|
||
133: 1309+10 0149 C9 ret
|
||
134:
|
||
135:
|
||
136: ;MSG_CRSR_0:
|
||
137: ; db 0x1B, "[?25h",0
|
||
138: ;MSG_CRSR_1:
|
||
139: ; db 0x1B, "[?25l",0
|
||
140: - 014A MSG_CLEAR:
|
||
141: - 014A 1B5B324A db 27, '[2J', 27, '[H',0
|
||
1B5B4800
|
||
142:
|
||
143:
|
||
144:
|
||
145: ; Serial Util Functions
|
||
146: - 0152 A_RTS_OFF:
|
||
147: 1319+7 0152 3E05 ld a,005h ;write into WR0: select WR5
|
||
148: 1326+11 0154 D309 out (CS_SIO_A_C),A
|
||
149: 1337+7 0156 3E68 ld a,068h ;DTR inactive, TX 8bit, BREAK off, TX on, RTS inactive
|
||
150: 1344+11 0158 D309 out (CS_SIO_A_C),A
|
||
151: 1355+10 015A C9 ret
|
||
152: - 015B A_RTS_ON:
|
||
153: 1365+7 015B 3E05 ld a,005h ;write into WR0: select WR5
|
||
154: 1372+11 015D D309 out (CS_SIO_A_C),A
|
||
155: 1383+7 015F 3EEA ld a,0EAh ;DTR active, TX 8bit, BREAK off, TX on, RTS active
|
||
156: 1390+11 0161 D309 out (CS_SIO_A_C),A
|
||
**** main.asm ****
|
||
166: 1401+10 0163 C9 ret
|
||
167: .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: - 0164 DHEX_TO_BYTE:
|
||
7: 1411+11 0164 E5 PUSH HL ;Backup pointer
|
||
8: ; Load First Byte
|
||
9: 1422+7 0165 7E LD A,(HL) ;Load first char (high)
|
||
10: 1429+17 0166 CD8401 CALL HEX_TO_BIN ;Conv chart to 4bit
|
||
11: 1446+7+5 0169 3815 jr C, DHEX_TO_BYTE_FAILED ;If error jmp to DHEX_TO_BYTE_FAILED
|
||
12: 1453+8 016B CB27 SLA A ;shift result to upper 4 bits
|
||
13: 1461+8 016D CB27 SLA A
|
||
14: 1469+8 016F CB27 SLA A
|
||
15: 1477+8 0171 CB27 SLA A
|
||
16: 1485+4 0173 57 LD D,A ;store result in D
|
||
17:
|
||
18: 1489+6 0174 23 INC HL ;next byte
|
||
19: 1495+7 0175 7E LD A,(HL) ;load 2nd char (lower)
|
||
20: 1502+17 0176 CD8401 CALL HEX_TO_BIN ;Conv chart to 4bit
|
||
21: 1519+7+5 0179 3805 jr C, DHEX_TO_BYTE_FAILED ;If error jmp to DHEX_TO_BYTE_FAILED
|
||
22: 1526+4 017B B2 OR D ;merge D with accumulator
|
||
23:
|
||
24: 1530+10 017C E1 POP HL ;restor original pointer
|
||
25: 1540+7 017D 1E00 LD E,0x00 ;set error to 0x00 = no error
|
||
26: 1547+10 017F C9 RET
|
||
27: - 0180 DHEX_TO_BYTE_FAILED:
|
||
28: 1557+7 0180 1EFF LD E,0xFF ;set error to oxFF
|
||
29: ;LD A,0x00
|
||
30: 1564+10 0182 E1 POP HL
|
||
31: 1574+10 0183 C9 RET
|
||
32:
|
||
33: ; REG A Contains CHAR-Low
|
||
34: ; If failed, Carry is set
|
||
35: - 0184 HEX_TO_BIN:
|
||
36: 1584+7 0184 D630 SUB 48 ; 0 is 0
|
||
37: 1591+10 0186 EA9901 jp PE, HEX_TO_INVALID_2; to low (SUB overflow)
|
||
38: 1601+7 0189 FE0A CP 10 ; Value is between 0 and 9
|
||
39: 1608+7+5 018B 3805 JR C, HEX_TO_BIN_2
|
||
40: 1615+7 018D D607 SUB 7
|
||
41: 1622+10 018F EA9901 jp PE, HEX_TO_INVALID_2; to low (SUB overflow)
|
||
42: - 0192 HEX_TO_BIN_2:
|
||
43: 1632+7 0192 FE10 CP 16
|
||
44: 1639+7+5 0194 3003 JR NC, HEX_TO_INVALID_2; if bigger than 15-> fail
|
||
45: 1646+7 0196 E60F AND 0x0F
|
||
46: 1653+10 0198 C9 RET
|
||
47: - 0199 HEX_TO_INVALID_2:
|
||
48: 1663+4 0199 37 SCF ;set carry flag
|
||
49: 1667+10 019A 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: - 019B STRCONV_BYTES_TO_HEX:
|
||
63: 1677+11 019B F5 PUSH AF;Backup A Register
|
||
64: 1688+4 019C 1F RRA
|
||
65: 1692+4 019D 1F RRA
|
||
66: 1696+4 019E 1F RRA
|
||
67: 1700+4 019F 1F RRA
|
||
68: 1704+17 01A0 CDAA01 CALL STRCONV_BYTES_TO_HEX_1
|
||
69: ;LD A,D
|
||
70: 1721+4 01A3 47 LD B,A
|
||
71: 1725+10 01A4 F1 POP AF ; Reload first Byte
|
||
72: 1735+17 01A5 CDAA01 CALL STRCONV_BYTES_TO_HEX_1
|
||
73: ;LD A,D
|
||
74: 1752+4 01A8 4F LD C,A
|
||
75: 1756+10 01A9 C9 RET
|
||
76:
|
||
77: - 01AA STRCONV_BYTES_TO_HEX_1:
|
||
78: 1766+7 01AA E60F AND 0x0F
|
||
79: 1773+7 01AC C630 ADD 48
|
||
80: 1780+7 01AE FE3A CP 58 ; Check if less than 58 (less than ASCII 9)
|
||
81: ;JR C, STRCONV_BYTES_TO_HEX_2
|
||
82: 1787+5+6 01B0 D8 RET C
|
||
83: 1792+7 01B1 C607 ADD 7 ; A-F
|
||
84: 1799+10 01B3 C9 RET
|
||
85: - 01B4 STRCONV_BYTES_TO_HEX_2:
|
||
86: ;LD D,A
|
||
87: 1809+10 01B4 C9 RET
|
||
88:
|
||
89:
|
||
**** main.asm ****
|
||
168: .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: - 01B5 disassemble:
|
||
12: 1819+4 01B5 78 ld a,b
|
||
13: 1823+13 01B6 321A41 ld (var_bytes_count),a
|
||
14: - 01B9 disassemble_next:
|
||
15:
|
||
16:
|
||
17: 1836+16 01B9 221041 ld (var_opcode_start), hl ;16 bit pointer to opcode in mem
|
||
18: 1852+7 01BC 7E ld a,(hl) ;load opcode to find in A
|
||
19: 1859+13 01BD 321441 ld (var_opcode), a ;8 bit opcode value
|
||
20: 1872+6 01C0 23 inc hl
|
||
21: 1878+7 01C1 7E ld a,(hl) ;load opcode to find in A
|
||
22: 1885+13 01C2 321541 ld (var_opcode_x), a ;8 bit opcode extended value
|
||
23: 1898+6 01C5 2B dec hl
|
||
24: 1904+17 01C6 CDA902 call disassemble_table_seek
|
||
25: 1921+4 01C9 78 ld a,b
|
||
26: 1925+4 01CA B1 or c
|
||
27: 1929+10 01CB CA8B02 jp z, disassemble_err ;if bc==0000h
|
||
28:
|
||
29: 1939+20 01CE ED431241 ld (var_opcode_table), bc ;16 bit pointer to opcode in table
|
||
30:
|
||
31: ;load params
|
||
32: 1959+6 01D2 03 inc bc
|
||
33: 1965+6 01D3 03 inc bc
|
||
34: 1971+6 01D4 03 inc bc
|
||
35: 1977+6 01D5 03 inc bc
|
||
36: 1983+7 01D6 0A ld a,(bc)
|
||
37: 1990+13 01D7 321641 ld (var_opcode_length),A ;8 bit opcode length (in bytes)
|
||
38: 2003+6 01DA 03 inc bc
|
||
39: 2009+7 01DB 0A ld a, (bc)
|
||
40: 2016+4 01DC 5F ld e,a
|
||
41: 2020+6 01DD 03 inc bc
|
||
42: 2026+7 01DE 0A ld a, (bc)
|
||
43: 2033+4 01DF 57 ld d,a
|
||
44: 2037+20 01E0 ED531741 ld (var_opcode_string),de ;16 bit pointer to opcode string
|
||
45: 2057+6 01E4 03 inc bc
|
||
46: 2063+7 01E5 0A ld a,(bc)
|
||
47: 2070+13 01E6 321941 ld (var_opcode_pcount),A ;8 bit opcode param count
|
||
48:
|
||
49: ;values are prepared. Continue with print
|
||
50:
|
||
51: 2083+16 01E9 2A1041 ld hl,(var_opcode_start) ;print address
|
||
52: 2099+17 01EC CDF102 call dasm_print16hex_addr
|
||
53:
|
||
54: 2116+13 01EF 3A1641 ld a,(var_opcode_length)
|
||
55: 2129+4 01F2 47 ld b, a
|
||
56:
|
||
57: ;print up to 4 opcode bytes
|
||
58: 2133+16 01F3 2A1041 ld hl,(var_opcode_start)
|
||
59:
|
||
60: - 01F6 disassemble_print_opcode_raw
|
||
61: 2149+7 01F6 7E ld a,(hl) ;load first byte
|
||
62: 2156+17 01F7 CD0701 call print_a_hex
|
||
63: 2173+6 01FA 23 inc hl
|
||
64: 2179+8+5 01FB 10F9 djnz disassemble_print_opcode_raw
|
||
65:
|
||
66: 2187+7 01FD 3E68 ld a,"h"
|
||
67: 2194+17 01FF CDD700 call print_char
|
||
68: ;fill empty spots
|
||
69: 2211+13 0202 3A1641 ld a,(var_opcode_length)
|
||
70: 2224+4 0205 47 ld b,a
|
||
71: 2228+7 0206 3E06 ld a,6
|
||
72: 2235+4 0208 90 sub b
|
||
73: 2239+4 0209 47 ld b,a
|
||
74:
|
||
75: - 020A disassemble_print_opcode_raw_fill:
|
||
76: 2243+7 020A 3E20 ld a," "
|
||
77: 2250+17 020C CDD700 call print_char
|
||
78: 2267+7 020F 3E20 ld a," "
|
||
79: 2274+17 0211 CDD700 call print_char
|
||
80: 2291+8+5 0214 10F4 djnz disassemble_print_opcode_raw_fill
|
||
81: 2299+7 0216 3E20 ld a," "
|
||
82: 2306+17 0218 CDD700 call print_char
|
||
83:
|
||
84: 2323+11 021B E5 push hl
|
||
85: ;print opcode
|
||
86: 2334+16 021C 2A1741 ld hl,(var_opcode_string)
|
||
87: 2350+17 021F CDDF00 call print_str
|
||
88:
|
||
89:
|
||
90: ;print params
|
||
91: 2367+13 0222 3A1941 ld a,(var_opcode_pcount)
|
||
92: 2380+4 0225 B7 or a
|
||
93: 2384+10 0226 CA8802 jp z, disassemble_print_opcode_params_end ;skip if no params
|
||
94:
|
||
95: 2394+16 0229 2A1241 ld hl,(var_opcode_table)
|
||
96: 2410+10 022C 010800 ld bc, 8
|
||
97: 2420+11 022F 09 add hl,bc ;hl now has address of first param
|
||
98: 2431+13 0230 3A1941 ld a,(var_opcode_pcount)
|
||
99: 2444+4 0233 47 ld b,a
|
||
100: - 0234 disassemble_print_opcode_params_loop:
|
||
101: ;ld a,(hl) ;load param
|
||
102: ;call print_a_hex
|
||
103: 2448+7 0234 7E ld a,(hl) ;load param
|
||
104:
|
||
105: 2455+7 0235 FE01 cp 0x01
|
||
106: 2462+10+7 0237 CC1703 call z, param_01
|
||
107: 2472+7 023A FE02 cp 0x02
|
||
108: 2479+10+7 023C CC3E03 call z, param_02
|
||
109: 2489+7 023F FE03 cp 0x03
|
||
110: 2496+10+7 0241 CC5B03 call z, param_03
|
||
111: 2506+7 0244 FE04 cp 0x04
|
||
112: 2513+10+7 0246 CC9703 call z, param_04
|
||
113: 2523+7 0249 FE05 cp 0x05
|
||
114: 2530+10+7 024B CCAD03 call z, param_05
|
||
115: 2540+7 024E FE06 cp 0x06
|
||
116: 2547+10+7 0250 CCBA03 call z, param_06
|
||
117: 2557+7 0253 FE07 cp 0x07
|
||
118: 2564+10+7 0255 CCD403 call z, param_07
|
||
119: 2574+7 0258 FE08 cp 0x08
|
||
120: 2581+10+7 025A CCE103 call z, param_08
|
||
121: 2591+7 025D FE09 cp 0x09
|
||
122: 2598+10+7 025F CCF603 call z, param_09
|
||
123: 2608+7 0262 FE10 cp 0x10
|
||
124: 2615+10+7 0264 CC0B04 call z, param_10
|
||
125: 2625+7 0267 FE11 cp 0x11
|
||
126: 2632+10+7 0269 CC1B04 call z, param_11
|
||
127: 2642+7 026C FE12 cp 0x12
|
||
128: 2649+10+7 026E CC2304 call z, param_12
|
||
129: 2659+7 0271 FE13 cp 0x13
|
||
130: 2666+10+7 0273 CC5B04 call z, param_13
|
||
131: 2676+7 0276 FE0A cp 0x0A
|
||
132: 2683+10+7 0278 CCED03 call z, param_0A
|
||
133: ;strings
|
||
134: 2693+7 027B FE80 cp 0x80
|
||
135: 2700+10+7 027D CC7A04 call z, param_80
|
||
136: 2710+7 0280 FE81 cp 0x81
|
||
137: 2717+10+7 0282 CC7104 call z, param_81
|
||
138: 2727+6 0285 23 inc hl
|
||
139: 2733+8+5 0286 10AC djnz disassemble_print_opcode_params_loop
|
||
140: - 0288 disassemble_print_opcode_params_end:
|
||
141: 2741+10 0288 E1 pop hl
|
||
142: 2751+12 0289 1810 jr disassemble_continue
|
||
143:
|
||
144:
|
||
145: - 028B disassemble_err:
|
||
146: 2763+17 028B CDF102 call dasm_print16hex_addr
|
||
147: 2780+7 028E 7E ld a,(hl)
|
||
148: 2787+17 028F CD0903 call dasm_print8hex ;print value
|
||
149: 2804+6 0292 23 inc hl
|
||
150: 2810+11 0293 E5 push hl
|
||
151: 2821+10 0294 21C60C ld hl, [dasm_UU]
|
||
152: 2831+17 0297 CDDF00 call print_str
|
||
153: 2848+10 029A E1 pop hl
|
||
154:
|
||
155: - 029B disassemble_continue:
|
||
156:
|
||
157: 2858+17 029B CDF100 call print_newLine
|
||
158: ;inc hl
|
||
159: 2875+13 029E 3A1A41 ld a,(var_bytes_count)
|
||
160: 2888+4 02A1 3D dec a
|
||
161: 2892+13 02A2 321A41 ld (var_bytes_count),a
|
||
162: 2905+10 02A5 C2B901 jp nz, disassemble_next
|
||
163: 2915+10 02A8 C9 ret
|
||
164:
|
||
165:
|
||
166:
|
||
167: ;A contains opcode
|
||
168: ;BC contains returned position
|
||
169: - 02A9 disassemble_table_seek:
|
||
170: 2925+11 02A9 E5 push hl
|
||
171: 2936+10 02AA 21C404 ld hl, [dasm_opcode_table]
|
||
172: - 02AD disassemble_table_seek_loop:
|
||
173: 2946+13 02AD 3A1441 ld a,(var_opcode)
|
||
174: 2959+4 02B0 4F ld c,a
|
||
175: 2963+7 02B1 7E ld a,(hl)
|
||
176: 2970+7 02B2 FEFF cp 0xFF ; if null
|
||
177: 2977+10 02B4 CAEB02 jp z, disassemble_table_notfound
|
||
178:
|
||
179: ;apply mask
|
||
180: 2987+11 02B7 F5 push af
|
||
181: 2998+6 02B8 23 inc hl
|
||
182: 3004+7 02B9 46 ld b,(hl) ;load mask
|
||
183: 3011+6 02BA 2B dec hl
|
||
184: 3017+4 02BB 79 ld a,c
|
||
185: 3021+4 02BC A0 and b ;apply mask
|
||
186: 3025+4 02BD 4F ld c,a
|
||
187: 3029+10 02BE F1 pop af
|
||
188:
|
||
189: 3039+4 02BF B9 cp c ; if match
|
||
190: 3043+7+5 02C0 280B jr z, disassemble_table_first_match
|
||
191: 3050+7 02C2 0600 ld b,0
|
||
192: 3057+7 02C4 0E07 ld c,7
|
||
193: 3064+11 02C6 09 add hl,bc
|
||
194: 3075+7 02C7 7E ld a,(hl)
|
||
195: 3082+4 02C8 4F ld c,a
|
||
196: 3086+11 02C9 09 add hl,bc
|
||
197: 3097+6 02CA 23 inc hl
|
||
198: 3103+12 02CB 18E0 jr disassemble_table_seek_loop
|
||
199:
|
||
200: - 02CD disassemble_table_first_match
|
||
201: 3115+6 02CD 23 inc hl
|
||
202: 3121+6 02CE 23 inc hl
|
||
203: 3127+7 02CF 4E ld c,(hl) ;load opcode x from table
|
||
204: 3134+6 02D0 23 inc hl
|
||
205: 3140+13 02D1 3A1541 ld a,(var_opcode_x) ;load current opcode x
|
||
206: 3153+7 02D4 46 ld b,(hl) ;load mask
|
||
207: 3160+4 02D5 A0 and b ;apply mask
|
||
208: 3164+4 02D6 B9 cp c ;compare to table
|
||
209: 3168+6 02D7 2B dec hl
|
||
210: 3174+6 02D8 2B dec hl
|
||
211: 3180+6 02D9 2B dec hl
|
||
212: 3186+7+5 02DA 280B jr z, disassemble_table_found ;IF FOUND
|
||
213: 3193+7 02DC 0600 ld b,0 ;else continue with next
|
||
214:
|
||
215: 3200+7 02DE 0E07 ld c,7
|
||
216: 3207+11 02E0 09 add hl,bc
|
||
217: 3218+7 02E1 7E ld a,(hl)
|
||
218: 3225+4 02E2 4F ld c,a
|
||
219: 3229+11 02E3 09 add hl,bc
|
||
220: 3240+6 02E4 23 inc hl
|
||
221: 3246+12 02E5 18C6 jr disassemble_table_seek_loop
|
||
222:
|
||
223: - 02E7 disassemble_table_found
|
||
224: 3258+4 02E7 44 ld b,H
|
||
225: 3262+4 02E8 4D ld c,l
|
||
226: 3266+10 02E9 E1 pop hl
|
||
227: 3276+10 02EA C9 ret
|
||
228:
|
||
229: - 02EB disassemble_table_notfound
|
||
230: 3286+7 02EB 0600 ld b,0
|
||
231: 3293+7 02ED 0E00 ld c,0
|
||
232: 3300+10 02EF E1 pop hl
|
||
233: 3310+10 02F0 C9 ret
|
||
234:
|
||
235:
|
||
236:
|
||
237:
|
||
238: - 02F1 dasm_print16hex_addr:
|
||
239: 3320+7 02F1 3E24 ld a,"$"
|
||
240: 3327+17 02F3 CDD700 call print_char
|
||
241: 3344+4 02F6 7C ld a,h
|
||
242: 3348+17 02F7 CD0701 call print_a_hex
|
||
243: 3365+4 02FA 7D ld a,l
|
||
244: 3369+17 02FB CD0701 call print_a_hex
|
||
245: 3386+7 02FE 3E68 ld a,"h"
|
||
246: 3393+17 0300 CDD700 call print_char
|
||
247: 3410+7 0303 3E20 ld a," "
|
||
248: 3417+17 0305 CDD700 call print_char
|
||
249: 3434+10 0308 C9 ret
|
||
250:
|
||
251: - 0309 dasm_print8hex:
|
||
252: 3444+17 0309 CD0701 call print_a_hex
|
||
253: 3461+7 030C 3E68 ld a,"h"
|
||
254: 3468+17 030E CDD700 call print_char
|
||
255: 3485+7 0311 3E20 ld a," "
|
||
256: 3492+17 0313 CDD700 call print_char
|
||
257: 3509+10 0316 C9 ret
|
||
258:
|
||
259:
|
||
260:
|
||
261:
|
||
262:
|
||
263:
|
||
264:
|
||
265: - 0317 param_01: ; 0x01 16bit address pointer
|
||
266: 3519+11 0317 E5 push hl
|
||
267: 3530+20 0318 ED5B1041 ld de,(var_opcode_start)
|
||
268: 3550+6 031C 13 inc de
|
||
269: 3556+7 031D 1A ld a,(de)
|
||
270: 3563+4 031E 6F ld l,a
|
||
271: 3567+6 031F 13 inc de
|
||
272: 3573+7 0320 1A ld a,(de)
|
||
273: 3580+4 0321 67 ld h,a
|
||
274:
|
||
275: 3584+7 0322 3E24 ld a,"$"
|
||
276: 3591+17 0324 CDD700 call print_char
|
||
277: 3608+4 0327 7C ld a,h
|
||
278: 3612+17 0328 CD0701 call print_a_hex
|
||
279: 3629+4 032B 7D ld a,l
|
||
280: 3633+17 032C CD0701 call print_a_hex
|
||
281: 3650+7 032F 3E68 ld a,"h"
|
||
282: 3657+17 0331 CDD700 call print_char
|
||
283: 3674+7 0334 3E20 ld a," "
|
||
284: 3681+17 0336 CDD700 call print_char
|
||
285: 3698+17 0339 CDB504 call param_comma
|
||
286: 3715+10 033C E1 pop hl
|
||
287: 3725+10 033D C9 ret
|
||
288:
|
||
289: - 033E param_02:
|
||
290: 3735+11 033E C5 push bc
|
||
291: 3746+20 033F ED5B1041 ld de,(var_opcode_start)
|
||
292: 3766+7 0343 1A ld a,(de)
|
||
293: 3773+4 0344 1F rra
|
||
294: 3777+4 0345 1F rra
|
||
295: 3781+7 0346 E60E and 0x0E
|
||
296:
|
||
297: 3788+11 0348 E5 push hl
|
||
298: 3799+10 0349 21CF0C ld hl, [dasm_printFlags_table]
|
||
299: 3809+7 034C 0600 ld b,0
|
||
300: 3816+4 034E 4F ld c,a
|
||
301: 3820+11 034F 09 add hl,bc
|
||
302: 3831+17 0350 CDDF00 call print_str
|
||
303: 3848+7 0353 3E20 ld a, " "
|
||
304: 3855+17 0355 CDD700 call print_char
|
||
305: 3872+10 0358 E1 pop hl
|
||
306: 3882+10 0359 C1 pop bc
|
||
307: 3892+10 035A C9 ret
|
||
308:
|
||
309:
|
||
310: - 035B param_03:
|
||
311: 3902+20 035B ED5B1041 ld de,(var_opcode_start)
|
||
312: 3922+6 035F 13 inc de
|
||
313: 3928+7 0360 1A ld a,(de)
|
||
314:
|
||
315: 3935+11 0361 F5 push af
|
||
316: 3946+7 0362 E680 and 0x80
|
||
317: 3953+10 0364 C27C03 jp nz, param_03_neg
|
||
318: 3963+7 0367 3E24 ld a,"$"
|
||
319: 3970+17 0369 CDD700 call print_char
|
||
320: 3987+7 036C 3E2B ld a,"+"
|
||
321: 3994+17 036E CDD700 call print_char
|
||
322: 4011+10 0371 F1 pop af
|
||
323: 4021+17 0372 CD0701 call print_a_hex
|
||
324: 4038+7 0375 3E68 ld a,"h"
|
||
325: 4045+17 0377 CDD700 call print_char
|
||
326: 4062+12 037A 1817 jr param_03_done
|
||
327:
|
||
328: - 037C param_03_neg:
|
||
329: 4074+7 037C 3E24 ld a,"$"
|
||
330: 4081+17 037E CDD700 call print_char
|
||
331: 4098+7 0381 3E2D ld a,"-"
|
||
332: 4105+17 0383 CDD700 call print_char
|
||
333: 4122+10 0386 F1 pop af
|
||
334: 4132+8 0387 ED44 neg
|
||
335: 4140+17 0389 CD0701 call print_a_hex
|
||
336: 4157+7 038C 3E68 ld a,"h"
|
||
337: 4164+17 038E CDD700 call print_char
|
||
338: 4181+12 0391 1800 jr param_03_done
|
||
339:
|
||
340: - 0393 param_03_done:
|
||
341: 4193+17 0393 CDB504 call param_comma
|
||
342: 4210+10 0396 C9 ret
|
||
343:
|
||
344:
|
||
345: - 0397 param_04:
|
||
346: 4220+20 0397 ED5B1041 ld de,(var_opcode_start)
|
||
347: 4240+6 039B 13 inc de
|
||
348: 4246+7 039C 1A ld a,(de)
|
||
349: 4253+7 039D FE4D cp 0x4D
|
||
350: 4260+7+5 039F 2806 jr z,param_04_i
|
||
351: 4267+7 03A1 3E4E ld a,"N"
|
||
352: 4274+17 03A3 CDD700 call print_char
|
||
353: 4291+10 03A6 C9 ret
|
||
354: - 03A7 param_04_i:
|
||
355: 4301+7 03A7 3E49 ld a,"I"
|
||
356: 4308+17 03A9 CDD700 call print_char
|
||
357: 4325+10 03AC C9 ret
|
||
358:
|
||
359: - 03AD param_05:
|
||
360: 4335+11 03AD C5 push bc
|
||
361: 4346+20 03AE ED5B1041 ld de,(var_opcode_start)
|
||
362: 4366+7 03B2 1A ld a,(de)
|
||
363: 4373+7 03B3 E638 and 0x38
|
||
364: ; print hex char
|
||
365: 4380+17 03B5 CD0903 call dasm_print8hex
|
||
366: 4397+10 03B8 C1 pop bc
|
||
367: 4407+10 03B9 C9 ret
|
||
368:
|
||
369:
|
||
370: - 03BA param_06:
|
||
371: 4417+11 03BA C5 push bc
|
||
372: 4428+20 03BB ED5B1041 ld de,(var_opcode_start)
|
||
373: 4448+7 03BF 1A ld a,(de)
|
||
374: 4455+4 03C0 1F rra
|
||
375: 4459+4 03C1 1F rra
|
||
376: 4463+4 03C2 1F rra
|
||
377: 4467+7 03C3 E607 and 0x07
|
||
378: 4474+17 03C5 CD9004 call param_printRegister
|
||
379: 4491+7 03C8 3E20 ld a," "
|
||
380: 4498+17 03CA CDD700 call print_char
|
||
381: 4515+7 03CD 3E2C ld a,","
|
||
382: 4522+17 03CF CDD700 call print_char
|
||
383: 4539+10 03D2 C1 pop bc
|
||
384: 4549+10 03D3 C9 ret
|
||
385:
|
||
386: - 03D4 param_07:
|
||
387: 4559+11 03D4 C5 push bc
|
||
388: 4570+20 03D5 ED5B1041 ld de,(var_opcode_start)
|
||
389: 4590+7 03D9 1A ld a,(de)
|
||
390: 4597+7 03DA E607 and 0x07
|
||
391:
|
||
392: 4604+17 03DC CD9004 call param_printRegister
|
||
393: 4621+10 03DF C1 pop bc
|
||
394: 4631+10 03E0 C9 ret
|
||
395:
|
||
396: - 03E1 param_08:
|
||
397: 4641+11 03E1 C5 push bc
|
||
398: 4652+20 03E2 ED5B1041 ld de,(var_opcode_start)
|
||
399: 4672+6 03E6 13 inc de
|
||
400: 4678+7 03E7 1A ld a,(de)
|
||
401: 4685+17 03E8 CD0903 call dasm_print8hex
|
||
402: 4702+10 03EB C1 pop bc
|
||
403: 4712+10 03EC C9 ret
|
||
404:
|
||
405:
|
||
406: - 03ED param_0A:
|
||
407: 4722+11 03ED E5 push hl
|
||
408: 4733+20 03EE ED5B1041 ld de,(var_opcode_start)
|
||
409: 4753+6 03F2 13 inc de
|
||
410: 4759+6 03F3 13 inc de
|
||
411: 4765+12 03F4 1806 jr param_09_0A
|
||
412: - 03F6 param_09:
|
||
413: 4777+11 03F6 E5 push hl
|
||
414: 4788+20 03F7 ED5B1041 ld de,(var_opcode_start)
|
||
415: 4808+6 03FB 13 inc de
|
||
416: - 03FC param_09_0A:
|
||
417: 4814+7 03FC 1A ld a,(de)
|
||
418: 4821+4 03FD 6F ld l,a
|
||
419: 4825+6 03FE 13 inc de
|
||
420: 4831+7 03FF 1A ld a,(de)
|
||
421: 4838+4 0400 67 ld h,a
|
||
422: 4842+4 0401 7C ld a,h
|
||
423: 4846+17 0402 CD0701 call print_a_hex
|
||
424: 4863+4 0405 7D ld a,l
|
||
425: 4867+17 0406 CD0701 call print_a_hex
|
||
426: 4884+10 0409 E1 pop hl
|
||
427: 4894+10 040A C9 ret
|
||
428:
|
||
429: - 040B param_10:
|
||
430: 4904+11 040B C5 push bc
|
||
431: 4915+20 040C ED5B1041 ld de,(var_opcode_start)
|
||
432: 4935+7 0410 1A ld a,(de)
|
||
433: 4942+4 0411 1F rra
|
||
434: 4946+4 0412 1F rra
|
||
435: 4950+4 0413 1F rra
|
||
436: 4954+7 0414 E607 and 0x07
|
||
437: 4961+17 0416 CD9004 call param_printRegister
|
||
438: 4978+10 0419 C1 pop bc
|
||
439: 4988+10 041A C9 ret
|
||
440:
|
||
441:
|
||
442: - 041B param_11:
|
||
443: 4998+11 041B E5 push hl
|
||
444: 5009+11 041C C5 push bc
|
||
445: 5020+20 041D ED5B1041 ld de,(var_opcode_start)
|
||
446: 5040+12 0421 1807 jr param_11_12
|
||
447: - 0423 param_12:
|
||
448: 5052+11 0423 E5 push hl
|
||
449: 5063+11 0424 C5 push bc
|
||
450: 5074+20 0425 ED5B1041 ld de,(var_opcode_start)
|
||
451: 5094+6 0429 13 inc de
|
||
452:
|
||
453: - 042A param_11_12:
|
||
454: 5100+7 042A 1A ld a,(de)
|
||
455: 5107+4 042B 1F rra
|
||
456: 5111+4 042C 1F rra
|
||
457: 5115+4 042D 1F rra
|
||
458: 5119+7 042E E606 and 0x06
|
||
459: 5126+11 0430 F5 push af
|
||
460: ;check which table to use
|
||
461: 5137+16 0431 2A1041 ld hl, (var_opcode_start)
|
||
462: 5153+7 0434 7E ld a,(hl)
|
||
463: 5160+7 0435 FEDD cp 0xDD
|
||
464: 5167+7+5 0437 2809 jr z,param_11_12_ix
|
||
465: 5174+7 0439 FEFD cp 0xFD
|
||
466: 5181+7+5 043B 280A jr z,param_11_12_iy
|
||
467: - 043D param_11_12_def:
|
||
468: 5188+10 043D 21DF0C ld hl, [dasm_printRegister8_table]
|
||
469: 5198+12 0440 1808 jr param_11_12_all
|
||
470: - 0442 param_11_12_ix:
|
||
471: 5210+10 0442 21E70C ld hl, [dasm_printRegisterIX_table]
|
||
472: 5220+12 0445 1803 jr param_11_12_all
|
||
473: - 0447 param_11_12_iy:
|
||
474: 5232+10 0447 21EF0C ld hl, [dasm_printRegisterIY_table]
|
||
475: - 044A param_11_12_all:
|
||
476: 5242+10 044A F1 pop af
|
||
477: 5252+7 044B 0600 ld b,0
|
||
478: 5259+4 044D 4F ld c,a
|
||
479: 5263+11 044E 09 add hl, bc
|
||
480: 5274+7 044F 7E ld a,(hl)
|
||
481: 5281+17 0450 CDD700 call print_char
|
||
482: 5298+6 0453 23 inc hl
|
||
483: 5304+7 0454 7E ld a,(hl)
|
||
484: 5311+17 0455 CDD700 call print_char
|
||
485: 5328+10 0458 C1 pop bc
|
||
486: 5338+10 0459 E1 pop hl
|
||
487: 5348+10 045A C9 ret
|
||
488:
|
||
489: - 045B param_13:
|
||
490: 5358+11 045B E5 push hl
|
||
491: 5369+11 045C C5 push bc
|
||
492: 5380+20 045D ED5B1041 ld de,(var_opcode_start)
|
||
493: 5400+7 0461 1A ld a,(de)
|
||
494: 5407+4 0462 1F rra
|
||
495: 5411+4 0463 1F rra
|
||
496: 5415+4 0464 1F rra
|
||
497: 5419+7 0465 E606 and 0x06
|
||
498: 5426+11 0467 F5 push af
|
||
499: ;check which table to use
|
||
500: 5437+16 0468 2A1041 ld hl, (var_opcode_start)
|
||
501: 5453+7 046B 7E ld a,(hl)
|
||
502: 5460+10 046C 21F70C ld hl, [dasm_printRegisterSP_table]
|
||
503: 5470+12 046F 18D9 jr param_11_12_all ;reuse code from 11_12
|
||
504:
|
||
505:
|
||
506: - 0471 param_81:
|
||
507: 5482+11 0471 E5 push hl
|
||
508: 5493+11 0472 C5 push bc
|
||
509: 5504+16 0473 2A1741 ld hl, (var_opcode_string)
|
||
510: 5520+7 0476 0602 ld b,2
|
||
511: 5527+12 0478 1807 jr param_80_seek
|
||
512: - 047A param_80:
|
||
513: 5539+11 047A E5 push hl
|
||
514: 5550+11 047B C5 push bc
|
||
515: 5561+16 047C 2A1741 ld hl, (var_opcode_string)
|
||
516: 5577+7 047F 0601 ld b,1
|
||
517: - 0481 param_80_seek:
|
||
518: 5584+7 0481 7E ld a,(hl)
|
||
519: 5591+6 0482 23 inc hl
|
||
520: 5597+4 0483 A7 and a
|
||
521: 5601+7+5 0484 20FB jr nz, param_80_seek
|
||
522: ;found
|
||
523: 5608+4 0486 05 dec b ;found but counter too high
|
||
524: 5612+10 0487 C28104 jp nz, param_80_seek
|
||
525:
|
||
526: 5622+17 048A CDDF00 call print_str
|
||
527: 5639+10 048D C1 pop bc
|
||
528: 5649+10 048E E1 pop hl
|
||
529: 5659+10 048F C9 ret
|
||
530:
|
||
531:
|
||
532:
|
||
533: - 0490 param_printRegister:
|
||
534: 5669+11 0490 E5 push hl
|
||
535: 5680+7 0491 FE06 cp 0x06
|
||
536: 5687+7+5 0493 2811 jr z, param_printRegisterHL
|
||
537: 5694+7 0495 FE07 cp 0x07
|
||
538: 5701+7+5 0497 2815 jr z, param_printRegisterA
|
||
539: 5708+10 0499 21DF0C ld hl, [dasm_printRegister8_table]
|
||
540: 5718+7 049C 0600 ld b,0
|
||
541: 5725+4 049E 4F ld c,a
|
||
542: 5729+11 049F 09 add hl,bc
|
||
543: 5740+7 04A0 7E ld a, (hl)
|
||
544: 5747+17 04A1 CDD700 call print_char
|
||
545: 5764+10 04A4 E1 pop hl
|
||
546: 5774+10 04A5 C9 ret
|
||
547:
|
||
548: - 04A6 param_printRegisterHL:
|
||
549: 5784+10 04A6 21FF0C ld hl, [dasm_printRegister8_table_HL]
|
||
550: 5794+17 04A9 CDDF00 call print_str
|
||
551: 5811+10 04AC E1 pop hl
|
||
552: 5821+10 04AD C9 ret
|
||
553:
|
||
554: - 04AE param_printRegisterA:
|
||
555: 5831+7 04AE 3E41 ld a,"A"
|
||
556: 5838+17 04B0 CDD700 call print_char
|
||
557: 5855+10 04B3 E1 pop hl
|
||
558: 5865+10 04B4 C9 ret
|
||
559:
|
||
560:
|
||
561: - 04B5 param_comma:
|
||
562: 5875+4 04B5 78 ld a,b
|
||
563: 5879+7 04B6 FE01 cp 1
|
||
564: 5886+5+6 04B8 C8 ret z
|
||
565: 5891+7 04B9 3E20 ld a," "
|
||
566: 5898+17 04BB CDD700 call print_char
|
||
567: 5915+7 04BE 3E2C ld a,","
|
||
568: 5922+17 04C0 CDD700 call print_char
|
||
**** main.asm ****
|
||
169: 5939+10 04C3 C9 ret
|
||
170: .include "disassembler_table.s"
|
||
**** include/disassembler_table.s ****
|
||
1: ;disassembler tables
|
||
2:
|
||
3: - 04C4 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: - 04C4 00FF0000 defb 0x00, 0xFF, 0x00, 0x00, 1, [dasm_00], [dasm_00]>>8,0 ;NOP
|
||
011C0900
|
||
29: ;General-Purpose Arithmetic and CPU Control Groups
|
||
30: - 04CC 27FF0000 defb 0x27, 0xFF, 0x00, 0x00, 1, [dasm_27], [dasm_27]>>8, 0 ;DAA
|
||
01E70900
|
||
31: - 04D4 2FFF0000 defb 0x2F, 0xFF, 0x00, 0x00, 1, [dasm_2F], [dasm_2F]>>8, 0 ;CPL
|
||
01EB0900
|
||
32: - 04DC EDFF44FF defb 0xED, 0xFF, 0x44, 0xFF, 2, [dasm_ED_44], [dasm_ED_44]>>8, 0 ;NEG
|
||
02EF0900
|
||
33: - 04E4 3FFF0000 defb 0x3f, 0xFF, 0x00, 0x00, 1, [dasm_3F], [dasm_3F]>>8, 0 ;CCF
|
||
01F30900
|
||
34: - 04EC 37FF0000 defb 0x37, 0xFF, 0x00, 0x00, 1, [dasm_37], [dasm_37]>>8, 0 ;SCF
|
||
01F70900
|
||
35: ;defb 0x00, 0xFF, 0x00, 0x00, 1, [dasm_00], [dasm_00]>>8,0 ;NOP -> already at top for performance reasons
|
||
36: - 04F4 76FF0000 defb 0x76, 0xFF, 0x00, 0x00, 1, [dasm_76], [dasm_76]>>8, 0 ;HALT
|
||
01FB0900
|
||
37: - 04FC F3FF0000 defb 0xF3, 0xFF, 0x00, 0x00, 1, [dasm_F3], [dasm_F3]>>8, 0 ;DI
|
||
01000A00
|
||
38: - 0504 FBFF0000 defb 0xFB, 0xFF, 0x00, 0x00, 1, [dasm_FB], [dasm_FB]>>8, 0 ;EI
|
||
01030A00
|
||
39: - 050C EDFF46FF defb 0xED, 0xFF, 0x46, 0xFF, 2, [dasm_ED_46], [dasm_ED_46]>>8, 0 ;IM 0
|
||
02060A00
|
||
40: - 0514 EDFF56FF defb 0xED, 0xFF, 0x56, 0xFF, 2, [dasm_ED_56], [dasm_ED_56]>>8, 0 ;IM 1
|
||
020B0A00
|
||
41: - 051C EDFF5EFF defb 0xED, 0xFF, 0x5E, 0xFF, 2, [dasm_ED_5E], [dasm_ED_5E]>>8, 0 ;IM 2
|
||
02100A00
|
||
42:
|
||
43: ;Exchange, Block Transfer, and Search Group
|
||
44: - 0524 EBFF0000 defb 0xEB, 0xFF, 0x00, 0x00, 1, [dasm_BE], [dasm_BE]>>8, 0 ;EX DE, HL
|
||
01150A00
|
||
45: - 052C 08FF0000 defb 0x08, 0xFF, 0x00, 0x00, 1, [dasm_08], [dasm_08]>>8, 0 ;EX AF, AF′
|
||
011F0A00
|
||
46: - 0534 D9FF0000 defb 0xD9, 0xFF, 0x00, 0x00, 1, [dasm_D9], [dasm_D9]>>8, 0 ;EXX
|
||
012C0A00
|
||
47: - 053C E3FF0000 defb 0xE3, 0xFF, 0x00, 0x00, 1, [dasm_E3], [dasm_E3]>>8, 0 ;EX (SP), HL
|
||
01300A00
|
||
48: - 0544 DDFFE3FF defb 0xDD, 0xFF, 0xE3, 0xFF, 2, [dasm_DD_E3], [dasm_DD_E3]>>8, 0 ;EX (SP), IX
|
||
023C0A00
|
||
49: - 054C FDFFE3FF defb 0xFD, 0xFF, 0xE3, 0xFF, 2, [dasm_FD_E3], [dasm_FD_E3]>>8, 0 ;EX (SP), IY
|
||
02480A00
|
||
50: - 0554 EDFFA0FF defb 0xED, 0xFF, 0xA0, 0xFF, 2, [dasm_ED_A0], [dasm_ED_A0]>>8, 0 ;LDI
|
||
02540A00
|
||
51: - 055C EDFFB0FF defb 0xED, 0xFF, 0xB0, 0xFF, 2, [dasm_ED_B0], [dasm_ED_B0]>>8, 0 ;LDIR
|
||
02580A00
|
||
52: - 0564 EDFFA8FF defb 0xED, 0xFF, 0xA8, 0xFF, 2, [dasm_ED_A8], [dasm_ED_A8]>>8, 0 ;LDD
|
||
025D0A00
|
||
53: - 056C EDFFB8FF defb 0xED, 0xFF, 0xB8, 0xFF, 2, [dasm_ED_B8], [dasm_ED_B8]>>8, 0 ;LDDR
|
||
02610A00
|
||
54: - 0574 EDFFA1FF defb 0xED, 0xFF, 0xA1, 0xFF, 2, [dasm_ED_A1], [dasm_ED_A1]>>8, 0 ;CPI
|
||
02660A00
|
||
55: - 057C EDFFB1FF defb 0xED, 0xFF, 0xB1, 0xFF, 2, [dasm_ED_B1], [dasm_ED_B1]>>8, 0 ;CPIR
|
||
026A0A00
|
||
56: - 0584 EDFFA9FF defb 0xED, 0xFF, 0xA9, 0xFF, 2, [dasm_ED_A9], [dasm_ED_A9]>>8, 0 ;CPD
|
||
026F0A00
|
||
57: - 058C EDFFB9FF defb 0xED, 0xFF, 0xB9, 0xFF, 2, [dasm_ED_B9], [dasm_ED_B9]>>8, 0 ;CPDR
|
||
02730A00
|
||
58:
|
||
59: ;JUMP Group
|
||
60: - 0594 C3FF0000 defb 0xC3, 0xFF, 0x00, 0x00, 3, [dasm_C3], [dasm_C3]>>8,1, 0x01 ;JP nn
|
||
03200901
|
||
01
|
||
61: - 059D C2C70000 defb 0xC2, 0xC7, 0x00, 0x00, 3, [dasm_C3], [dasm_C3]>>8,3, 0x02, 0x80, 0x01 ;JP cc,nn
|
||
03200903
|
||
028001
|
||
62: - 05A8 18FF0000 defb 0x18, 0xFF, 0x00, 0x00, 2, [dasm_18], [dasm_18]>>8,1, 0x03 ;JR e
|
||
02270901
|
||
03
|
||
63: - 05B1 38FF0000 defb 0x38, 0xFF, 0x00, 0x00, 2, [dasm_38], [dasm_38]>>8,1, 0x03 ;JR C,e
|
||
022B0901
|
||
03
|
||
64: - 05BA 30FF0000 defb 0x30, 0xFF, 0x00, 0x00, 2, [dasm_30], [dasm_30]>>8,1, 0x03 ;JR NC,e
|
||
02320901
|
||
03
|
||
65: - 05C3 28FF0000 defb 0x28, 0xFF, 0x00, 0x00, 2, [dasm_28], [dasm_28]>>8,1, 0x03 ;JR Z,e
|
||
023A0901
|
||
03
|
||
66: - 05CC 20FF0000 defb 0x20, 0xFF, 0x00, 0x00, 2, [dasm_20], [dasm_20]>>8,1, 0x03 ;JR NZ,e
|
||
02410901
|
||
03
|
||
67: - 05D5 E9FF0000 defb 0xE9, 0xFF, 0x00, 0x00, 2, [dasm_E9], [dasm_E9]>>8,0 ;JP (HL)
|
||
02490900
|
||
68: - 05DD DDFFE9FF defb 0xDD, 0xFF, 0xE9, 0xFF, 2, [dasm_DD], [dasm_DD]>>8,0 ;JP (IX)
|
||
02520900
|
||
69: - 05E5 FDFFE9FF defb 0xFD, 0xFF, 0xE9, 0xFF, 2, [dasm_FD], [dasm_FD]>>8,0 ;JP (IY)
|
||
025B0900
|
||
70: - 05ED 10FF0000 defb 0x10, 0xFF, 0x00, 0x00, 2, [dasm_10], [dasm_10]>>8,1, 0x03 ;DJNZ, e
|
||
02640901
|
||
03
|
||
71: ;Call and Return Group
|
||
72: - 05F6 CDFF0000 defb 0xCD, 0xFF, 0x00, 0x00, 3, [dasm_CD], [dasm_CD]>>8,1, 0x01 ;CALL nn
|
||
036A0901
|
||
01
|
||
73: - 05FF C4C70000 defb 0xC4, 0xC7, 0x00, 0x00, 3, [dasm_CD], [dasm_CD]>>8,2, 0x02, 0x01 ;CALL cc,nn
|
||
036A0902
|
||
0201
|
||
74: - 0609 C9FF0000 defb 0xC9, 0xFF, 0x00, 0x00, 1, [dasm_C9], [dasm_C9]>>8,0 ;RET
|
||
01700900
|
||
75: - 0611 C0C70000 defb 0xC0, 0xC7, 0x00, 0x00, 1, [dasm_C9], [dasm_C9]>>8,1, 0x02 ;RET cc
|
||
01700901
|
||
02
|
||
76: - 061A EDFF4DFF defb 0xED, 0xFF, 0x4D, 0xFF, 2, [dasm_ED_4D], [dasm_ED_4D]>>8,0 ;RETI
|
||
02750900
|
||
77: - 0622 EDFF45FF defb 0xED, 0xFF, 0x45, 0xFF, 2, [dasm_ED_45], [dasm_ED_45]>>8,0 ;RETN
|
||
027A0900
|
||
78:
|
||
79: - 062A C7C70000 defb 0xC7, 0xC7, 0x00, 0x00, 1, [dasm_FF], [dasm_FF]>>8,1, 0x05 ;RST
|
||
017F0901
|
||
05
|
||
80: ;8-Bit load group
|
||
81: - 0633 0AFF0000 defb 0x0A, 0xFF, 0x00, 0x00, 1, [dasm_0A], [dasm_0A]>>8, 0 ;LD A, (BC)
|
||
01840900
|
||
82: - 063B 1AFF0000 defb 0x1A, 0xFF, 0x00, 0x00, 1, [dasm_1A], [dasm_1A]>>8, 0 ;LD A, (DE)
|
||
018E0900
|
||
83: - 0643 3AFF0000 defb 0x3A, 0xFF, 0x00, 0x00, 3, [dasm_3A], [dasm_3A]>>8, 2, 0x09, 0x80 ;LD A, (nn)
|
||
03980902
|
||
0980
|
||
84: - 064D 02FF0000 defb 0x02, 0xFF, 0x00, 0x00, 1, [dasm_02], [dasm_02]>>8, 0 ;LD (BC), A
|
||
01A20900
|
||
85: - 0655 12FF0000 defb 0x12, 0xFF, 0x00, 0x00, 1, [dasm_12], [dasm_12]>>8, 0 ;LD (DE), A
|
||
01AD0900
|
||
86: - 065D 32FF0000 defb 0x32, 0xFF, 0x00, 0x00, 3, [dasm_32], [dasm_32]>>8, 2, 0x09, 0x80 ;LD (nn), A
|
||
03B80902
|
||
0980
|
||
87: - 0667 EDFF57FF defb 0xED, 0xFF, 0x57, 0xFF, 2, [dasm__ED_57], [dasm__ED_57]>>8, 0 ;LD A, I
|
||
02C70900
|
||
88: - 066F EDFF5FFF defb 0xED, 0xFF, 0x5F, 0xFF, 2, [dasm__ED_5F], [dasm__ED_5F]>>8, 0 ;LD A, R
|
||
02CF0900
|
||
89: - 0677 EDFF47FF defb 0xED, 0xFF, 0x47, 0xFF, 2, [dasm__ED_47], [dasm__ED_47]>>8, 0 ;LD I, A
|
||
02D70900
|
||
90: - 067F EDFF4FFF defb 0xED, 0xFF, 0x4F, 0xFF, 2, [dasm__ED_4F], [dasm__ED_4F]>>8, 0 ;LD R, A
|
||
02DF0900
|
||
91:
|
||
92: - 0687 06C70000 defb 0x06, 0xC7, 0x00, 0x00, 2, [dasm__LD], [dasm__LD]>>8, 2, 0x06, 0x08 ;LD r, n
|
||
02C30902
|
||
0608
|
||
93: - 0691 40C00000 defb 0x40, 0xC0, 0x00, 0x00, 1, [dasm__LD], [dasm__LD]>>8, 2, 0x06, 0x07 ;LD r, r' / LD r, (HL) / LD (HL), r
|
||
01C30902
|
||
0607
|
||
94:
|
||
95: ;8-Bit Arithmetic Group
|
||
96: - 069B 80F80000 defb 0x80, 0xF8, 0x00, 0x00, 1, [dasm_80C6], [dasm_80C6]>>8, 1, 0x07 ;ADD A, r / ADD A, (HL)
|
||
01780A01
|
||
07
|
||
97: - 06A4 C6FF0000 defb 0xC6, 0xFF, 0x00, 0x00, 2, [dasm_80C6], [dasm_80C6]>>8, 1, 0x08 ;ADD A, n
|
||
02780A01
|
||
08
|
||
98: - 06AD DDFF86FF defb 0xDD, 0xFF, 0x86, 0xFF, 3, [dasm_DD_86], [dasm_DD_86]>>8, 2, 0x08, 0x80 ;ADD A, (IX + d)
|
||
03800A02
|
||
0880
|
||
99: - 06B7 FDFF86FF defb 0xFD, 0xFF, 0x86, 0xFF, 3, [dasm_FD_86], [dasm_FD_86]>>8, 2, 0x08, 0x80 ;ADD A, (IY + d)
|
||
038F0A02
|
||
0880
|
||
100: - 06C1 C8F80000 defb 0xC8, 0xF8, 0x00, 0x00, 1, [dasm_C88E], [dasm_C88E]>>8, 1, 0x07 ;ADC A, r / ADC A, (HL)
|
||
019E0A01
|
||
07
|
||
101: - 06CA 8EF80000 defb 0x8E, 0xF8, 0x00, 0x00, 2, [dasm_C88E], [dasm_C88E]>>8, 1, 0x08 ;ADC A, n
|
||
029E0A01
|
||
08
|
||
102: - 06D3 DDFF8EFF defb 0xDD, 0xFF, 0x8E, 0xFF, 3, [dasm_DD_8E], [dasm_DD_8E]>>8, 2, 0x08, 0x80 ;ADC A, (IX + d)
|
||
03A60A02
|
||
0880
|
||
103: - 06DD FDFF8EFF defb 0xFD, 0xFF, 0x8E, 0xFF, 3, [dasm_FD_8E], [dasm_FD_8E]>>8, 2, 0x08, 0x80 ;ADC A, (IY + d)
|
||
03B50A02
|
||
0880
|
||
104: - 06E7 90F80000 defb 0x90, 0xF8, 0x00, 0x00, 1, [dasm__SUB], [dasm__SUB]>>8, 1, 0x07 ;SUB r / SUB A, (HL)
|
||
01C40A01
|
||
07
|
||
105: - 06F0 D6FF0000 defb 0xD6, 0xFF, 0x00, 0x00, 2, [dasm__SUB], [dasm__SUB]>>8, 1, 0x08 ;SUB n
|
||
02C40A01
|
||
08
|
||
106: - 06F9 DDFF96FF defb 0xDD, 0xFF, 0x96, 0xFF, 3, [dasm_DD_96], [dasm_DD_96]>>8, 2, 0x08, 0x80 ;SUB (IX + d)
|
||
03C90A02
|
||
0880
|
||
107: - 0703 FDFF96FF defb 0xFD, 0xFF, 0x96, 0xFF, 3, [dasm_FD_96], [dasm_FD_96]>>8, 2, 0x08, 0x80 ;SUB (IY + d)
|
||
03D50A02
|
||
0880
|
||
108: - 070D 94F80000 defb 0x94, 0xF8, 0x00, 0x00, 1, [dasm__SBC], [dasm__SBC]>>8, 1, 0x07 ;SBC A,r / SBC A, (HL)
|
||
01E10A01
|
||
07
|
||
109: - 0716 DEFF0000 defb 0xDE, 0xFF, 0x00, 0x00, 2, [dasm__SBC], [dasm__SBC]>>8, 1, 0x08 ;SBC A,n
|
||
02E10A01
|
||
08
|
||
110: - 071F DDFF9EFF defb 0xDD, 0xFF, 0x9E, 0xFF, 3, [dasm_DD_9E], [dasm_DD_9E]>>8, 2, 0x08, 0x80 ;SBC A,(IX + d)
|
||
03E90A02
|
||
0880
|
||
111: - 0729 FDFF9EFF defb 0xFD, 0xFF, 0x9E, 0xFF, 3, [dasm_FD_9E], [dasm_FD_9E]>>8, 2, 0x08, 0x80 ;SBC A,(IY + d)
|
||
03F70A02
|
||
0880
|
||
112: - 0733 A0F80000 defb 0xA0, 0xF8, 0x00, 0x00, 1, [dasm__AND], [dasm__AND]>>8, 1, 0x07 ;AND A,r / AND A, (HL)
|
||
01050B01
|
||
07
|
||
113: - 073C E6FF0000 defb 0xE6, 0xFF, 0x00, 0x00, 2, [dasm__AND], [dasm__AND]>>8, 1, 0x08 ;AND A,n
|
||
02050B01
|
||
08
|
||
114: - 0745 DDFFA6FF defb 0xDD, 0xFF, 0xA6, 0xFF, 3, [dasm_DD_A6], [dasm_DD_A6]>>8, 2, 0x08, 0x80 ;AND A,(IX + d)
|
||
030A0B02
|
||
0880
|
||
115: - 074F FDFFA6FF defb 0xFD, 0xFF, 0xA6, 0xFF, 3, [dasm_FD_A6], [dasm_FD_A6]>>8, 2, 0x08, 0x80 ;AND A,(IY + d)
|
||
03160B02
|
||
0880
|
||
116: - 0759 B0F80000 defb 0xB0, 0xF8, 0x00, 0x00, 1, [dasm__OR], [dasm__OR]>>8, 1, 0x07 ;OR A,r / OR A, (HL)
|
||
01220B01
|
||
07
|
||
117: - 0762 F6FF0000 defb 0xF6, 0xFF, 0x00, 0x00, 2, [dasm__OR], [dasm__OR]>>8, 1, 0x08 ;OR A,n
|
||
02220B01
|
||
08
|
||
118: - 076B DDFFB6FF defb 0xDD, 0xFF, 0xB6, 0xFF, 3, [dasm_DD_B6], [dasm_DD_B6]>>8, 2, 0x08, 0x80 ;OR A,(IX + d)
|
||
03260B02
|
||
0880
|
||
119: - 0775 FDFFB6FF defb 0xFD, 0xFF, 0xB6, 0xFF, 3, [dasm_FD_B6], [dasm_FD_B6]>>8, 2, 0x08, 0x80 ;OR A,(IY + d)
|
||
03310B02
|
||
0880
|
||
120: - 077F A8F80000 defb 0xA8, 0xF8, 0x00, 0x00, 1, [dasm__XOR], [dasm__XOR]>>8, 1, 0x07 ;XOR A,r / XOR A, (HL)
|
||
013C0B01
|
||
07
|
||
121: - 0788 EEFF0000 defb 0xEE, 0xFF, 0x00, 0x00, 2, [dasm__XOR], [dasm__XOR]>>8, 1, 0x08 ;XOR A,n
|
||
023C0B01
|
||
08
|
||
122: - 0791 DDFFAEFF defb 0xDD, 0xFF, 0xAE, 0xFF, 3, [dasm_DD_AE], [dasm_DD_AE]>>8, 2, 0x08, 0x80 ;XOR A,(IX + d)
|
||
03410B02
|
||
0880
|
||
123: - 079B FDFFAEFF defb 0xFD, 0xFF, 0xAE, 0xFF, 3, [dasm_FD_AE], [dasm_FD_AE]>>8, 2, 0x08, 0x80 ;XOR A,(IY + d)
|
||
034D0B02
|
||
0880
|
||
124: - 07A5 B8F80000 defb 0xB8, 0xF8, 0x00, 0x00, 1, [dasm__CP], [dasm__CP]>>8, 1, 0x07 ;CP A,r / CP A, (HL)
|
||
01590B01
|
||
07
|
||
125: - 07AE FEFF0000 defb 0xFE, 0xFF, 0x00, 0x00, 2, [dasm__CP], [dasm__CP]>>8, 1, 0x08 ;CP A,n
|
||
02590B01
|
||
08
|
||
126: - 07B7 DDFFBEFF defb 0xDD, 0xFF, 0xBE, 0xFF, 3, [dasm_DD_BE], [dasm_DD_BE]>>8, 2, 0x08, 0x80 ;CP A,(IX + d)
|
||
035D0B02
|
||
0880
|
||
127: - 07C1 FDFFBEFF defb 0xFD, 0xFF, 0xBE, 0xFF, 3, [dasm_FD_BE], [dasm_FD_BE]>>8, 2, 0x08, 0x80 ;CP A,(IY + d)
|
||
03680B02
|
||
0880
|
||
128: - 07CB 04C70000 defb 0x04, 0xC7, 0x00, 0x00, 1, [dasm__INC], [dasm__INC]>>8, 1, 0x10 ;INC r / INC (HL)
|
||
01730B01
|
||
10
|
||
129: - 07D4 DDFF34FF defb 0xDD, 0xFF, 0x34, 0xFF, 3, [dasm_DD_34], [dasm_DD_34]>>8, 2, 0x08, 0x80 ;INC (IX + d)
|
||
03780B02
|
||
0880
|
||
130: - 07DE FDFF34FF defb 0xFD, 0xFF, 0x34, 0xFF, 3, [dasm_FD_34], [dasm_FD_34]>>8, 2, 0x08, 0x80 ;INC (IY + d)
|
||
03840B02
|
||
0880
|
||
131: - 07E8 05C70000 defb 0x05, 0xC7, 0x00, 0x00, 1, [dasm__DEC], [dasm__DEC]>>8, 1, 0x10 ;DEC r / DEC (HL)
|
||
01900B01
|
||
10
|
||
132: - 07F1 DDFF35FF defb 0xDD, 0xFF, 0x35, 0xFF, 3, [dasm_DD_35], [dasm_DD_35]>>8, 2, 0x08, 0x80 ;DEC (IX + d)
|
||
03950B02
|
||
0880
|
||
133: - 07FB FDFF35FF defb 0xFD, 0xFF, 0x35, 0xFF, 3, [dasm_FD_35], [dasm_FD_35]>>8, 2, 0x08, 0x80 ;DEC (IY + d)
|
||
03A10B02
|
||
0880
|
||
134: ;16-Bit Arithmetic Group
|
||
135: - 0805 09CF0000 defb 0x09, 0xCF, 0x00, 0x00, 1, [dasm_09], [dasm_09]>>8, 1, 0x11 ;ADD HL, ss
|
||
01AD0B01
|
||
11
|
||
136: - 080E EDFF4ACF defb 0xED, 0xFF, 0x4A, 0xCF, 2, [dasm_ED_4A], [dasm_ED_4A]>>8, 1, 0x12 ;ADC HL, ss
|
||
02B60B01
|
||
12
|
||
137: - 0817 EDFF42CF defb 0xED, 0xFF, 0x42, 0xCF, 2, [dasm_ED_42], [dasm_ED_42]>>8, 1, 0x12 ;SBC HL, ss
|
||
02BF0B01
|
||
12
|
||
138: - 0820 DDFF09CF defb 0xDD, 0xFF, 0x09, 0xCF, 2, [dasm_DD_09], [dasm_DD_09]>>8, 1, 0x12 ;ADD IX, ss
|
||
02C80B01
|
||
12
|
||
139: - 0829 FDFF09CF defb 0xFD, 0xFF, 0x09, 0xCF, 2, [dasm_FD_09], [dasm_FD_09]>>8, 1, 0x12 ;ADD IY, ss
|
||
02D10B01
|
||
12
|
||
140: - 0832 03CF0000 defb 0x03, 0xCF, 0x00, 0x00, 1, [dasm_03], [dasm_03]>>8, 1, 0x11 ;INC ss
|
||
01DA0B01
|
||
11
|
||
141: - 083B DDFF23FF defb 0xDD, 0xFF, 0x23, 0xFF, 2, [dasm_DD_23], [dasm_DD_23]>>8, 0 ;INC IX
|
||
02DF0B00
|
||
142: - 0843 FDFF23FF defb 0xFD, 0xFF, 0x23, 0xFF, 2, [dasm_FD_23], [dasm_FD_23]>>8, 0 ;INC IY
|
||
02E80B00
|
||
143: - 084B 0BCF0000 defb 0x0B, 0xCF, 0x00, 0x00, 1, [dasm_0B], [dasm_0B]>>8, 1, 0x11 ;DEC ss
|
||
01F10B01
|
||
11
|
||
144: - 0854 DDFF2BFF defb 0xDD, 0xFF, 0x2B, 0xFF, 2, [dasm_DD_2B], [dasm_DD_2B]>>8, 0 ;DEC IX
|
||
02F60B00
|
||
145: - 085C FDFF2BFF defb 0xFD, 0xFF, 0x2B, 0xFF, 2, [dasm_FD_2B], [dasm_FD_2B]>>8, 0 ;DEC IY
|
||
02FF0B00
|
||
146: ;16-Bit Load Group
|
||
147: - 0864 01CF0000 defb 0x01, 0xCF, 0x00, 0x00, 3, [dasm_01], [dasm_01]>>8, 3, 0x11, 0x80, 0x09 ;LD dd, nn
|
||
03080C03
|
||
118009
|
||
148: - 086F DDFF21FF defb 0xDD, 0xFF, 0x21, 0xFF, 4, [dasm_DD_01], [dasm_DD_01]>>8, 1, 0x0A ;LD IX, nn
|
||
040F0C01
|
||
0A
|
||
149: - 0878 FDFF21FF defb 0xFD, 0xFF, 0x21, 0xFF, 4, [dasm_FD_01], [dasm_FD_01]>>8, 1, 0x0A ;LD IY, nn
|
||
04170C01
|
||
0A
|
||
150: - 0881 2AFF0000 defb 0x2A, 0xFF, 0x00, 0x00, 3, [dasm_2A], [dasm_2A]>>8, 2, 0x09, 0x80 ;LD HL, (nn)
|
||
031F0C02
|
||
0980
|
||
151: - 088B EDFF4BCF defb 0xED, 0xFF, 0x4B, 0xCF, 4, [dasm_ED_4B], [dasm_ED_4B]>>8, 4, 0x12, 0x80, 0x0A, 0x81 ;LD dd, (nn)
|
||
042B0C04
|
||
12800A81
|
||
152: - 0897 DDFF2AFF defb 0xDD, 0xFF, 0x2A, 0xFF, 4, [dasm_DD_2A], [dasm_DD_2A]>>8, 1, 0x0A ;LD IX, (nn)
|
||
04360C01
|
||
0A
|
||
153: - 08A0 FDFF2AFF defb 0xFD, 0xFF, 0x2A, 0xFF, 4, [dasm_FD_2A], [dasm_FD_2A]>>8, 1, 0x0A ;LD IY, (nn)
|
||
04420C01
|
||
0A
|
||
154: - 08A9 22FF0000 defb 0x22, 0xFF, 0x00, 0x00, 3, [dasm_22], [dasm_22]>>8, 2, 0x0A, 0x80 ;LD (nn), HL
|
||
034E0C02
|
||
0A80
|
||
155: - 08B3 EDFF43CF defb 0xED, 0xFF, 0x43, 0xCF, 4, [dasm_ED_43], [dasm_ED_43]>>8, 3, 0x0A, 0x80, 0x12 ;LD (nn), dd
|
||
045A0C03
|
||
0A8012
|
||
156: - 08BE DDFF22CF defb 0xDD, 0xFF, 0x22, 0xCF, 4, [dasm_DD_22], [dasm_DD_22]>>8, 2, 0x0A, 0x80 ;LD (nn), IX
|
||
04640C02
|
||
0A80
|
||
157: - 08C8 FDFF22CF defb 0xFD, 0xFF, 0x22, 0xCF, 4, [dasm_FD_22], [dasm_FD_22]>>8, 2, 0x0A, 0x80 ;LD (nn), IY
|
||
04700C02
|
||
0A80
|
||
158: - 08D2 F9FF0000 defb 0xF9, 0xFF, 0x00, 0x00, 1, [dasm_F9], [dasm_F9]>>8, 0 ;LD SP, HL
|
||
017C0C00
|
||
159: - 08DA DDFFF9FF defb 0xDD, 0xFF, 0xF9, 0xFF, 2, [dasm_DD_F9], [dasm_DD_F9]>>8, 0 ;LD SP, IX
|
||
02860C00
|
||
160: - 08E2 FDFFF9FF defb 0xFD, 0xFF, 0xF9, 0xFF, 2, [dasm_FD_F9], [dasm_FD_F9]>>8, 0 ;LD SP, IY
|
||
02900C00
|
||
161: - 08EA C5CF0000 defb 0xC5, 0xCF, 0x00, 0x00, 1, [dasm_E5], [dasm_E5]>>8, 1, 0x13 ;PUSH qq
|
||
019A0C01
|
||
13
|
||
162: - 08F3 DDFFE5FF defb 0xDD, 0xFF, 0xE5, 0xFF, 2, [dasm_DD_E5], [dasm_DD_E5]>>8, 0 ;PUSH IX
|
||
02A00C00
|
||
163: - 08FB FDFFE5FF defb 0xFD, 0xFF, 0xE5, 0xFF, 2, [dasm_FD_E5], [dasm_FD_E5]>>8, 0 ;PUSH IY
|
||
02A80C00
|
||
164: - 0903 C1CF0000 defb 0xC1, 0xCF, 0x00, 0x00, 1, [dasm_E1], [dasm_E1]>>8, 1, 0x13 ;POP qq
|
||
01B00C01
|
||
13
|
||
165: - 090C DDFFE1FF defb 0xDD, 0xFF, 0xE1, 0xFF, 2, [dasm_DD_E1], [dasm_DD_E1]>>8, 0 ;POP IX
|
||
02B60C00
|
||
166: - 0914 FDFFE1FF defb 0xFD, 0xFF, 0xE1, 0xFF, 2, [dasm_FD_E1], [dasm_FD_E1]>>8, 0 ;POP IY
|
||
02BE0C00
|
||
167:
|
||
168:
|
||
169: - 091C 4E4F5000 dasm_00: db "NOP",0x00
|
||
170: ;JUMP Group
|
||
171: - 0920 4A502000 dasm_C3: db "JP ",0x00,", ",0x00
|
||
2C2000
|
||
172: - 0927 4A522000 dasm_18: db "JR ",0x00
|
||
173: - 092B 4A522043 dasm_38: db "JR C, ",0x00
|
||
2C2000
|
||
174: - 0932 4A52204E dasm_30: db "JR NC, ",0x00
|
||
432C2000
|
||
175: - 093A 4A52205A dasm_28: db "JR Z, ",0x00
|
||
2C2000
|
||
176: - 0941 4A52204E dasm_20: db "JR NZ, ",0x00
|
||
5A2C2000
|
||
177: - 0949 4A502028 dasm_E9: db "JP (HL) ",0x00
|
||
484C2920
|
||
00
|
||
178: - 0952 4A502028 dasm_DD: db "JP (IX) ",0x00
|
||
49582920
|
||
00
|
||
179: - 095B 4A502028 dasm_FD: db "JP (IY) ",0x00
|
||
49592920
|
||
00
|
||
180: - 0964 444A4E5A dasm_10: db "DJNZ ",0x00
|
||
2000
|
||
181: ;Call and Return Group
|
||
182: - 096A 43414C4C dasm_CD: db "CALL ",0x00
|
||
2000
|
||
183: - 0970 52455420 dasm_C9: db "RET ",0x00
|
||
00
|
||
184: - 0975 52455449 dasm_ED_4D: db "RETI",0x00
|
||
00
|
||
185: - 097A 5245544E dasm_ED_45: db "RETN",0x00
|
||
00
|
||
186: - 097F 52535420 dasm_FF: db "RST ",0x00
|
||
00
|
||
187: ;8-Bit load group
|
||
188: - 0984 4C442041 dasm_0A: db "LD A,(BC)",0x00
|
||
2C284243
|
||
2900
|
||
189: - 098E 4C442041 dasm_1A: db "LD A,(DE)",0x00
|
||
2C284445
|
||
2900
|
||
190: - 0998 4C442041 dasm_3A: db "LD A,(",0x00, "h)",0x00
|
||
2C280068
|
||
2900
|
||
191: - 09A2 4C442028 dasm_02: db "LD (BC), A",0x00
|
||
4243292C
|
||
204100
|
||
192: - 09AD 4C442028 dasm_12: db "LD (DE), A",0x00
|
||
4445292C
|
||
204100
|
||
193: - 09B8 4C442028 dasm_32: db "LD (",0x00, "h), A",0x00
|
||
0068292C
|
||
204100
|
||
194: - 09C3 4C442000 dasm__LD: db "LD ",0x00
|
||
195: - 09C7 4C442041 dasm__ED_57: db "LD A, I",0x00
|
||
2C204900
|
||
196: - 09CF 4C442041 dasm__ED_5F: db "LD A, R",0x00
|
||
2C205200
|
||
197: - 09D7 4C442049 dasm__ED_47: db "LD I, A",0x00
|
||
2C204100
|
||
198: - 09DF 4C442052 dasm__ED_4F: db "LD R, A",0x00
|
||
2C204100
|
||
199: ;General-Purpose Arithmetic and CPU Control Groups
|
||
200: - 09E7 44414100 dasm_27: db "DAA",0x00
|
||
201: - 09EB 43504C00 dasm_2F: db "CPL",0x00
|
||
202: - 09EF 4E454700 dasm_ED_44: db "NEG",0x00
|
||
203: - 09F3 43434600 dasm_3F: db "CCF",0x00
|
||
204: - 09F7 53434600 dasm_37: db "SCF",0x00
|
||
205: - 09FB 48414C54 dasm_76: db "HALT",0x00
|
||
00
|
||
206: - 0A00 444900 dasm_F3: db "DI",0x00
|
||
207: - 0A03 454900 dasm_FB: db "EI",0x00
|
||
208: - 0A06 494D2030 dasm_ED_46: db "IM 0",0x00
|
||
00
|
||
209: - 0A0B 494D2031 dasm_ED_56: db "IM 1",0x00
|
||
00
|
||
210: - 0A10 494D2032 dasm_ED_5E: db "IM 2",0x00
|
||
00
|
||
211: ;Exchange, Block Transfer, and Search Group
|
||
212: - 0A15 45582044 dasm_BE: db "EX DE, HL",0x00
|
||
452C2048
|
||
4C00
|
||
213: - 0A1F 45582041 dasm_08: db "EX AF, AF′",0x00
|
||
462C2041
|
||
46E280B2
|
||
00
|
||
214: - 0A2C 45585800 dasm_D9: db "EXX",0x00
|
||
215: - 0A30 45582028 dasm_E3: db "EX (SP), HL",0x00
|
||
5350292C
|
||
20484C00
|
||
216: - 0A3C 45582028 dasm_DD_E3: db "EX (SP), IX",0x00
|
||
5350292C
|
||
20495800
|
||
217: - 0A48 45582028 dasm_FD_E3: db "EX (SP), IY",0x00
|
||
5350292C
|
||
20495900
|
||
218: - 0A54 4C444900 dasm_ED_A0: db "LDI",0x00
|
||
219: - 0A58 4C444952 dasm_ED_B0: db "LDIR",0x00
|
||
00
|
||
220: - 0A5D 4C444400 dasm_ED_A8: db "LDD",0x00
|
||
221: - 0A61 4C444452 dasm_ED_B8: db "LDDR",0x00
|
||
00
|
||
222: - 0A66 43504900 dasm_ED_A1: db "CPI",0x00
|
||
223: - 0A6A 43504952 dasm_ED_B1: db "CPIR",0x00
|
||
00
|
||
224: - 0A6F 43504400 dasm_ED_A9: db "CPD",0x00
|
||
225: - 0A73 43504452 dasm_ED_B9: db "CPDR",0x00
|
||
00
|
||
226: ;8-Bit Arithmetic Group
|
||
227: - 0A78 41444420 dasm_80C6: db "ADD A, ", 0x00
|
||
412C2000
|
||
228: - 0A80 41444420 dasm_DD_86: db "ADD A, (IX+", 0x00, "h)",0x00
|
||
412C2028
|
||
49582B00
|
||
682900
|
||
229: - 0A8F 41444420 dasm_FD_86: db "ADD A, (IY+", 0x00, "h)",0x00
|
||
412C2028
|
||
49592B00
|
||
682900
|
||
230: - 0A9E 41444320 dasm_C88E: db "ADC A, ", 0x00
|
||
412C2000
|
||
231: - 0AA6 41444320 dasm_DD_8E: db "ADC A, (IX+", 0x00, "h)",0x00
|
||
412C2028
|
||
49582B00
|
||
682900
|
||
232: - 0AB5 41444320 dasm_FD_8E: db "ADC A, (IY+", 0x00, "h)",0x00
|
||
412C2028
|
||
49592B00
|
||
682900
|
||
233: - 0AC4 53554220 dasm__SUB: db "SUB ", 0x00
|
||
00
|
||
234: - 0AC9 53554220 dasm_DD_96: db "SUB (IX+", 0x00, "h)",0x00
|
||
2849582B
|
||
00682900
|
||
235: - 0AD5 53554220 dasm_FD_96: db "SUB (IY+", 0x00, "h)",0x00
|
||
2849592B
|
||
00682900
|
||
236: - 0AE1 53424320 dasm__SBC: db "SBC A, ", 0x00
|
||
412C2000
|
||
237: - 0AE9 53424320 dasm_DD_9E: db "SBC A,(IX+", 0x00, "h)",0x00
|
||
412C2849
|
||
582B0068
|
||
2900
|
||
238: - 0AF7 53424320 dasm_FD_9E: db "SBC A,(IY+", 0x00, "h)",0x00
|
||
412C2849
|
||
592B0068
|
||
2900
|
||
239: - 0B05 414E4420 dasm__AND: db "AND ", 0x00
|
||
00
|
||
240: - 0B0A 414E4420 dasm_DD_A6: db "AND (IX+", 0x00, "h)",0x00
|
||
2849582B
|
||
00682900
|
||
241: - 0B16 414E4420 dasm_FD_A6: db "AND (IY+", 0x00, "h)",0x00
|
||
2849592B
|
||
00682900
|
||
242: - 0B22 4F522000 dasm__OR: db "OR ", 0x00
|
||
243: - 0B26 4F522028 dasm_DD_B6: db "OR (IX+", 0x00, "h)",0x00
|
||
49582B00
|
||
682900
|
||
244: - 0B31 4F522028 dasm_FD_B6: db "OR (IY+", 0x00, "h)",0x00
|
||
49592B00
|
||
682900
|
||
245: - 0B3C 584F5220 dasm__XOR: db "XOR ", 0x00
|
||
00
|
||
246: - 0B41 584F5220 dasm_DD_AE: db "XOR (IX+", 0x00, "h)",0x00
|
||
2849582B
|
||
00682900
|
||
247: - 0B4D 584F5220 dasm_FD_AE: db "XOR (IY+", 0x00, "h)",0x00
|
||
2849592B
|
||
00682900
|
||
248: - 0B59 43502000 dasm__CP: db "CP ", 0x00
|
||
249: - 0B5D 43502028 dasm_DD_BE: db "CP (IX+", 0x00, "h)",0x00
|
||
49582B00
|
||
682900
|
||
250: - 0B68 43502028 dasm_FD_BE: db "CP (IY+", 0x00, "h)",0x00
|
||
49592B00
|
||
682900
|
||
251: - 0B73 494E4320 dasm__INC: db "INC ", 0x00
|
||
00
|
||
252: - 0B78 494E4320 dasm_DD_34: db "INC (IX+", 0x00, "h)",0x00
|
||
2849582B
|
||
00682900
|
||
253: - 0B84 494E4320 dasm_FD_34: db "INC (IY+", 0x00, "h)",0x00
|
||
2849592B
|
||
00682900
|
||
254: - 0B90 44454320 dasm__DEC: db "DEC ", 0x00
|
||
00
|
||
255: - 0B95 44454320 dasm_DD_35: db "DEC (IX+", 0x00, "h)",0x00
|
||
2849582B
|
||
00682900
|
||
256: - 0BA1 44454320 dasm_FD_35: db "DEC (IY+", 0x00, "h)",0x00
|
||
2849592B
|
||
00682900
|
||
257: ;16-Bit Arithmetic Group
|
||
258: - 0BAD 41444420 dasm_09: db "ADD HL, ",0x00
|
||
484C2C20
|
||
00
|
||
259: - 0BB6 41444320 dasm_ED_4A: db "ADC HL, ",0x00
|
||
484C2C20
|
||
00
|
||
260: - 0BBF 53424320 dasm_ED_42: db "SBC HL, ",0x00
|
||
484C2C20
|
||
00
|
||
261: - 0BC8 41444420 dasm_DD_09: db "ADD IX, ",0x00
|
||
49582C20
|
||
00
|
||
262: - 0BD1 41444420 dasm_FD_09: db "ADD IY, ",0x00
|
||
49592C20
|
||
00
|
||
263: - 0BDA 494E4320 dasm_03: db "INC ",0x00
|
||
00
|
||
264: - 0BDF 494E4320 dasm_DD_23: db "INC IX, ",0x00
|
||
49582C20
|
||
00
|
||
265: - 0BE8 494E4320 dasm_FD_23: db "INC IY, ",0x00
|
||
49592C20
|
||
00
|
||
266: - 0BF1 44454320 dasm_0B: db "DEC ",0x00
|
||
00
|
||
267: - 0BF6 44454320 dasm_DD_2B: db "DEC IX, ",0x00
|
||
49582C20
|
||
00
|
||
268: - 0BFF 44454320 dasm_FD_2B: db "DEC IY, ",0x00
|
||
49592C20
|
||
00
|
||
269: ;16-Bit Load Group
|
||
270: - 0C08 4C442000 dasm_01: db "LD ",0x00, ", ",0x00
|
||
2C2000
|
||
271: - 0C0F 4C442049 dasm_DD_01: db "LD IX, ",0x00
|
||
582C2000
|
||
272: - 0C17 4C442049 dasm_FD_01: db "LD IY, ",0x00
|
||
592C2000
|
||
273: - 0C1F 4C442048 dasm_2A: db "LD HL, (",0x00,"h)",0x00
|
||
4C2C2028
|
||
00682900
|
||
274: - 0C2B 4C442000 dasm_ED_4B: db "LD ",0x00,", (",0x00,"h)",0x00
|
||
2C202800
|
||
682900
|
||
275: - 0C36 4C442049 dasm_DD_2A: db "LD IX, (",0x00,"h)",0x00
|
||
582C2028
|
||
00682900
|
||
276: - 0C42 4C442049 dasm_FD_2A: db "LD IY, (",0x00,"h)",0x00
|
||
592C2028
|
||
00682900
|
||
277: - 0C4E 4C442028 dasm_22: db "LD (",0x00,"h), HL",0x00
|
||
0068292C
|
||
20484C00
|
||
278: - 0C5A 4C442028 dasm_ED_43: db "LD (",0x00,"h), ",0x00
|
||
0068292C
|
||
2000
|
||
279: - 0C64 4C442028 dasm_DD_22: db "LD (",0x00,"h), IX",0x00
|
||
0068292C
|
||
20495800
|
||
280: - 0C70 4C442028 dasm_FD_22: db "LD (",0x00,"h), IY",0x00
|
||
0068292C
|
||
20495900
|
||
281: - 0C7C 4C442053 dasm_F9: db "LD SP, HL",0x00
|
||
502C2048
|
||
4C00
|
||
282: - 0C86 4C442053 dasm_DD_F9: db "LD SP, IX",0x00
|
||
502C2049
|
||
5800
|
||
283: - 0C90 4C442053 dasm_FD_F9: db "LD SP, IY",0x00
|
||
502C2049
|
||
5900
|
||
284: - 0C9A 50555348 dasm_E5: db "PUSH ",0x00
|
||
2000
|
||
285: - 0CA0 50555348 dasm_DD_E5: db "PUSH IX",0x00
|
||
20495800
|
||
286: - 0CA8 50555348 dasm_FD_E5: db "PUSH IY",0x00
|
||
20495900
|
||
287: - 0CB0 50555348 dasm_E1: db "PUSH ",0x00
|
||
2000
|
||
288: - 0CB6 50555348 dasm_DD_E1: db "PUSH IX",0x00
|
||
20495800
|
||
289: - 0CBE 50555348 dasm_FD_E1: db "PUSH IY",0x00
|
||
20495900
|
||
290:
|
||
291: ;Misc
|
||
292: - 0CC6 2E3F2E00 dasm_UU: db ".?.",0x00
|
||
293: - 0CCA 20202020 dasm_UW: db " ",0x00
|
||
00
|
||
294:
|
||
295: - 0CCF dasm_printFlags_table:
|
||
296: - 0CCF 4E5A db "NZ"
|
||
297: - 0CD1 5A00 db "Z",0
|
||
298: - 0CD3 4E43 db "NC"
|
||
299: - 0CD5 4300 db "C",0
|
||
300: - 0CD7 504F db "PO"
|
||
301: - 0CD9 5045 db "PE"
|
||
302: - 0CDB 5000 db "P",0
|
||
303: - 0CDD 4D00 db "M",0
|
||
304:
|
||
305: - 0CDF dasm_printRegister8_table:
|
||
306: - 0CDF 42 db "B"
|
||
307: - 0CE0 43 db "C"
|
||
308: - 0CE1 44 db "D"
|
||
309: - 0CE2 45 db "E"
|
||
310: - 0CE3 48 db "H"
|
||
311: - 0CE4 4C db "L"
|
||
312: - 0CE5 53 db "S" ;only 18 bit (SP)
|
||
313: - 0CE6 50 db "P" ;only 18 bit (SP)
|
||
314:
|
||
315: - 0CE7 dasm_printRegisterIX_table:
|
||
316: - 0CE7 4243 db "BC"
|
||
317: - 0CE9 4445 db "DE"
|
||
318: - 0CEB 4958 db "IX"
|
||
319: - 0CED 5350 db "SP"
|
||
320: - 0CEF dasm_printRegisterIY_table:
|
||
321: - 0CEF 4243 db "BC"
|
||
322: - 0CF1 4445 db "DE"
|
||
323: - 0CF3 4959 db "IY"
|
||
324: - 0CF5 5350 db "SP"
|
||
325:
|
||
326: - 0CF7 dasm_printRegisterSP_table:
|
||
327: - 0CF7 4243 db "BC"
|
||
328: - 0CF9 4445 db "DE"
|
||
329: - 0CFB 484C db "HL"
|
||
330: - 0CFD 4146 db "AF"
|
||
331:
|
||
332: - 0CFF dasm_printRegister8_table_HL:
|
||
**** main.asm ****
|
||
171: - 0CFF 28484C29 db "(HL)", 0
|
||
00
|
||
172: .include "rst.s"
|
||
**** include/rst.s ****
|
||
1: - 0D04 EXEC_RST_08:
|
||
2: 5949+17 0D04 CDD700 call print_char
|
||
3: 5966+10 0D07 C9 ret
|
||
4:
|
||
5:
|
||
6: - 0D08 EXEC_RST_10:
|
||
7: 5976+11 0D08 C5 push bc
|
||
8: 5987+11 0D09 D5 push de
|
||
9: 5998+11 0D0A E5 push hl
|
||
10: ;call vdp_cursor_on
|
||
11: 6009+17 0D0B CD1F01 call read_char
|
||
12: 6026+11 0D0E F5 push af
|
||
13: ;call vdp_cursor_off
|
||
14: 6037+10 0D0F F1 pop af
|
||
15: 6047+10 0D10 E1 pop hl
|
||
16: 6057+10 0D11 D1 pop de
|
||
17: 6067+10 0D12 C1 pop bc
|
||
18: 6077+10 0D13 C9 ret
|
||
19:
|
||
20: - 0D14 EXEC_RST_18:
|
||
21: 6087+7 0D14 3E00 ld a,0
|
||
22: 6094+10 0D16 C9 ret
|
||
**** main.asm ****
|
||
173: .include "beep.s"
|
||
**** include/beep.s ****
|
||
1: ;------------------------------------------------------------------------------
|
||
2: ; beep
|
||
3: ;
|
||
4: ; Beeps the speaker
|
||
5: ; DE sets duration
|
||
6: ;------------------------------------------------------------------------------
|
||
7: - 0D17 beep:
|
||
8: 6104+11 0D17 F5 push AF
|
||
9: 6115+11 0D18 D5 push DE
|
||
10: - 0D19 beep_loop:
|
||
11: 6126+7 0D19 3E08 LD A,0x08
|
||
12: 6133+11 0D1B D3F4 OUT (CS_PIO_AD), A
|
||
13: 6144+17 0D1D CD2F0D CALL beep_pause
|
||
14: 6161+7 0D20 3E00 LD A,0x00
|
||
15: 6168+11 0D22 D3F4 OUT (CS_PIO_AD), A
|
||
16: 6179+17 0D24 CD2F0D CALL beep_pause
|
||
17: 6196+6 0D27 1B DEC DE
|
||
18: 6202+4 0D28 7A ld A,D
|
||
19: 6206+4 0D29 B3 or E
|
||
20: 6210+7+5 0D2A 20ED jr NZ, beep_loop
|
||
21: 6217+10 0D2C D1 pop de
|
||
22: 6227+10 0D2D F1 pop af
|
||
23: 6237+10 0D2E C9 ret
|
||
24:
|
||
25: - 0D2F beep_pause:
|
||
26: 6247+11 0D2F C5 PUSH BC
|
||
27: - 0D30 _beep_pause_l1:
|
||
28: ;NEG ; 8 T-states
|
||
29: ;NEG ; 8 T-states
|
||
30: 6258+8 0D30 ED44 NEG ; 8 T-states
|
||
31: 6266+8 0D32 ED44 NEG ; 8 T-states
|
||
32: 6274+6 0D34 0B DEC BC ; 6 T-states
|
||
33: 6280+4 0D35 79 LD A,C ; 9 T-states
|
||
34: 6284+4 0D36 B0 OR B ; 4 T-states
|
||
35: 6288+10 0D37 C2300D JP NZ,_beep_pause_l1 ; 10 T-states
|
||
36: 6298+10 0D3A C1 POP BC
|
||
**** main.asm ****
|
||
174: 6308+10 0D3B C9 RET ; Pause complete, RETurn
|
||
175: .include "kdrv_ide8255.s" ;include ide interface driver.
|
||
**** include/kdrv_ide8255.s ****
|
||
1: ;----------------------------------------------------------------
|
||
2: ;BIOS Driver for IDE Interface 82C55
|
||
3: ;by Dennis Gunia (01/2023)
|
||
4: ;----------------------------------------------------------------
|
||
5:
|
||
6: ;================================================================
|
||
7: ; I/O registers
|
||
8: ;================================================================
|
||
9: - 0030 CS_PIA_PA .EQU 0x30 ; D0-7
|
||
10: - 0031 CS_PIA_PB .EQU 0x31 ; D8-15
|
||
11: - 0032 CS_PIA_PC .EQU 0x32 ; Controll Lines
|
||
12: - 0033 CS_PIA_CR .EQU 0x33
|
||
13:
|
||
14: ;================================================================
|
||
15: ; I/O pins
|
||
16: ;================================================================
|
||
17: - 0020 IDE_WR .EQU 00100000b
|
||
18: - 0040 IDE_RD .EQU 01000000b
|
||
19: - 0080 IDE_RST .EQU 10000000b
|
||
20:
|
||
21: ;================================================================
|
||
22: ; IDE registers
|
||
23: ;================================================================
|
||
24: - 0008 IDE_REG_DATA .EQU 01000b ;data I/O register (16-bits)
|
||
25: - 0009 IDE_REG_ERROR .EQU 01001b ;error information register when read; write precompensation register when written.
|
||
26: - 000A IDE_REG_SECTOR .EQU 01010b ;Sector counter register
|
||
27: - 000B IDE_REG_SSECTOR .EQU 01011b ;Start sector register
|
||
28: - 000C IDE_REG_LCYL .EQU 01100b ;Low byte of the cylinder number
|
||
29: - 000D IDE_REG_HCYL .EQU 01101b ;High two bits of the cylinder number
|
||
30: - 000E IDE_REG_HEAD .EQU 01110b ;Head and device select register
|
||
31: - 000F IDE_REG_CMDSTS .EQU 01111b ;command/status register
|
||
32: - 0016 IDE_REG_ALTSTS .EQU 10110b ;Alternate Status/Digital Output
|
||
33: - 0017 IDE_REG_DRVADDR .EQU 10111b ;Drive Address
|
||
34:
|
||
35: - 000B IDE_REG_LBA0 .EQU 01011b ;Start sector register
|
||
36: - 000C IDE_REG_LBA1 .EQU 01100b ;Low byte of the cylinder number
|
||
37: - 000D IDE_REG_LBA2 .EQU 01101b ;High two bits of the cylinder number
|
||
38: - 000E IDE_REG_LBA3 .EQU 01110b ;Head and device select register
|
||
39:
|
||
40:
|
||
41: ;================================================================
|
||
42: ; I/O access functions
|
||
43: ;================================================================
|
||
44:
|
||
45: ;------------------------------------------------------------------------------
|
||
46: ; ide_reset
|
||
47: ;
|
||
48: ; resets drives on bus
|
||
49: ;------------------------------------------------------------------------------
|
||
50: - 0D3C ide_reset:
|
||
51:
|
||
52: 6318+7 0D3C 3E80 LD A, 10000000b ;CommandByte-A, Mode 0, PA Out, PC Out, PB Out
|
||
53: 6325+11 0D3E D333 OUT (CS_PIA_CR), A ;Set Data direction to out
|
||
54: 6336+7 0D40 3E80 LD A, IDE_RST
|
||
55: 6343+11 0D42 D332 OUT (CS_PIA_PC), A ;Reset IDE Device
|
||
56: 6354+4 0D44 00 NOP
|
||
57: 6358+4 0D45 AF XOR A
|
||
58: 6362+11 0D46 D332 OUT (CS_PIA_PC), A ;end device reset
|
||
59: 6373+10 0D48 C9 RET
|
||
60:
|
||
61:
|
||
62: ;------------------------------------------------------------------------------
|
||
63: ; ide_regwrite_8
|
||
64: ;
|
||
65: ; Sends data to the IDE device
|
||
66: ; A contains DATA
|
||
67: ; B contains register number
|
||
68: ;------------------------------------------------------------------------------
|
||
69: - 0D49 ide_regwrite_8:
|
||
70: 6383+11 0D49 F5 PUSH AF ;store date to stack
|
||
71: ; Prepare PIA Data Direction
|
||
72: 6394+7 0D4A 3E80 LD A, 10000000b ;CommandByte-A, Mode 0, PA Out, PC Out, PB Out
|
||
73: 6401+11 0D4C D333 OUT (CS_PIA_CR), A ;Set Data direction to out
|
||
74: ; Write Data out
|
||
75: 6412+10 0D4E F1 POP AF
|
||
76: 6422+11 0D4F D330 OUT (CS_PIA_PA), A ;Write Data to bit 0-7
|
||
77: ;Prepare Address
|
||
78: 6433+4 0D51 78 LD A, B ;Load register address
|
||
79: 6437+7 0D52 E61F AND 00011111b ;Mask unused bits
|
||
80: 6444+11 0D54 D332 OUT (CS_PIA_PC), A ;Write Data to bit controll lines
|
||
81: 6455+7 0D56 F620 OR IDE_WR ;Set Write bit
|
||
82: 6462+11 0D58 D332 OUT (CS_PIA_PC), A ;Set write signal
|
||
83: 6473+4 0D5A 00 NOP ;delay to wait for processing
|
||
84: 6477+4 0D5B 78 LD A, B ;Load register address
|
||
85: 6481+7 0D5C E61F AND 00011111b ;Mask unused bits
|
||
86: 6488+11 0D5E D332 OUT (CS_PIA_PC), A ;disable write signal
|
||
87: 6499+4 0D60 00 NOP
|
||
88: 6503+4 0D61 AF XOR A ;clear register A
|
||
89: 6507+11 0D62 D332 OUT (CS_PIA_PC), A ;clear controll lines
|
||
90: 6518+10 0D64 C9 RET
|
||
91:
|
||
92:
|
||
93: ;------------------------------------------------------------------------------
|
||
94: ; ide_regread_8
|
||
95: ;
|
||
96: ; Sends data to the IDE device
|
||
97: ; B contains register number
|
||
98: ; A returns data
|
||
99: ;------------------------------------------------------------------------------
|
||
100: - 0D65 ide_regread_8:
|
||
101: 6528+7 0D65 3E92 LD A, 10010010b ;CommandByte-A, Mode 0, PA IN, PC Out, PB IN
|
||
102: 6535+11 0D67 D333 OUT (CS_PIA_CR), A ;Set Data direction to in
|
||
103: ;Prepare Address
|
||
104: 6546+4 0D69 78 LD A, B ;Load register address
|
||
105: 6550+7 0D6A E61F AND 00011111b ;Mask unused bits
|
||
106: 6557+11 0D6C D332 OUT (CS_PIA_PC), A ;Write Data to bit controll lines
|
||
107: 6568+7 0D6E F640 OR IDE_RD ;Set Write bit
|
||
108: 6575+11 0D70 D332 OUT (CS_PIA_PC), A ;Write Data to bit controll lines
|
||
109: 6586+4 0D72 00 NOP ;delay to wait for processing
|
||
110: 6590+11 0D73 F5 PUSH AF
|
||
111: 6601+10 0D74 F1 POP AF
|
||
112: 6611+11 0D75 F5 PUSH AF
|
||
113: 6622+10 0D76 F1 POP AF
|
||
114: 6632+11 0D77 F5 PUSH AF
|
||
115: 6643+10 0D78 F1 POP AF
|
||
116: 6653+11 0D79 F5 PUSH AF
|
||
117: 6664+10 0D7A F1 POP AF
|
||
118: 6674+11 0D7B DB30 IN A,(CS_PIA_PA) ;read data from ide device to b (because a is used later)
|
||
119: 6685+11 0D7D F5 PUSH AF
|
||
120: 6696+4 0D7E AF XOR A ;clear register A
|
||
121: 6700+11 0D7F D332 OUT (CS_PIA_PC), A ;clear controll lines
|
||
122: 6711+10 0D81 F1 POP AF ;put data in accumulator
|
||
123: 6721+10 0D82 C9 RET
|
||
124:
|
||
125:
|
||
126: ;------------------------------------------------------------------------------
|
||
127: ; ide_readsector_256
|
||
128: ;
|
||
129: ; Reads IDE Data
|
||
130: ; HL contains destination address
|
||
131: ;------------------------------------------------------------------------------
|
||
132: - 0D83 ide_readsector_256:
|
||
133: 6731+7 0D83 0EFF LD C,255 ;Setup counter for 256 words
|
||
134:
|
||
135: - 0D85 ide_readsector_256_waitloop:
|
||
136: 6738+7 0D85 060F LD B, IDE_REG_CMDSTS
|
||
137: 6745+17 0D87 CD650D CALL ide_regread_8
|
||
138: 6762+8 0D8A CB47 BIT 0,a ;Error Bit set.
|
||
139: 6770+10 0D8C C2040E JP NZ, ide_printerror
|
||
140: 6780+8 0D8F CB5F BIT 3,a ;DRQ Bit set. If set, disk has data
|
||
141: 6788+7+5 0D91 28F2 JR Z, ide_readsector_256_waitloop ;If not set, wait
|
||
142:
|
||
143: 6795+7 0D93 3E92 LD A, 10010010b ;CommandByte-A, Mode 0, PA IN, PC Out, PB IN
|
||
144: 6802+11 0D95 D333 OUT (CS_PIA_CR), A ;Set Data direction to IN
|
||
145: 6813+7 0D97 3E08 LD A, IDE_REG_DATA ;CS0 and A=0 -> I/O register
|
||
146: 6820+11 0D99 D332 OUT (CS_PIA_PC), A ;set register
|
||
147: 6831+7 0D9B F640 OR IDE_RD ;Set Read bit
|
||
148: 6838+11 0D9D D332 OUT (CS_PIA_PC), A ;Write Read to bit controll lines
|
||
149: 6849+4 0D9F 00 NOP
|
||
150: 6853+4 0DA0 00 NOP
|
||
151: 6857+4 0DA1 00 NOP
|
||
152: 6861+11 0DA2 DB31 IN A,(CS_PIA_PB) ;Load 16-Bit data to buffer
|
||
153: 6872+7 0DA4 77 LD (HL), A
|
||
154: 6879+6 0DA5 23 INC HL
|
||
155: 6885+11 0DA6 DB30 IN A,(CS_PIA_PA)
|
||
156: 6896+7 0DA8 77 LD (HL), A
|
||
157: 6903+6 0DA9 23 INC HL
|
||
158:
|
||
159: 6909+4 0DAA 79 LD A,C
|
||
160: 6913+4 0DAB B7 OR A
|
||
161: 6917+10 0DAC CAB20D JP Z,ide_readsector_256_done
|
||
162: 6927+4 0DAF 0D DEC C
|
||
163: 6931+12 0DB0 18D3 JR ide_readsector_256_waitloop
|
||
164:
|
||
165: - 0DB2 ide_readsector_256_done:
|
||
166: 6943+10 0DB2 C9 RET
|
||
167:
|
||
168: - 0DB3 ide_readsector_512_inv:
|
||
169: 6953+7 0DB3 0EFF LD C,255 ;Setup counter for 256 words
|
||
170: 6960+10 0DB5 110010 LD DE, 4096 ;Timeout counter
|
||
171: - 0DB8 ide_readsector_512_inv_waitloop:
|
||
172: 6970+6 0DB8 1B DEC DE
|
||
173: 6976+4 0DB9 7A LD A,D
|
||
174: 6980+4 0DBA B3 OR E
|
||
175: 6984+10 0DBB CAEE0D JP Z, ide_readsector_timeout
|
||
176: 6994+7 0DBE 060F LD B, IDE_REG_CMDSTS
|
||
177: 7001+17 0DC0 CD650D CALL ide_regread_8
|
||
178: 7018+8 0DC3 CB47 BIT 0,a ;Error Bit set.
|
||
179: 7026+10 0DC5 C2040E JP NZ, ide_printerror
|
||
180: 7036+8 0DC8 CB5F BIT 3,a ;DRQ Bit set. If set, disk has data
|
||
181: 7044+7+5 0DCA 28EC JR Z, ide_readsector_512_inv_waitloop ;If not set, wait
|
||
182: 7051+10 0DCC 110008 LD DE, 2048 ;Timeout counter
|
||
183: 7061+7 0DCF 3E92 LD A, 10010010b ;CommandByte-A, Mode 0, PA IN, PC Out, PB IN
|
||
184: 7068+11 0DD1 D333 OUT (CS_PIA_CR), A ;Set Data direction to IN
|
||
185: 7079+7 0DD3 3E08 LD A, IDE_REG_DATA ;CS0 and A=0 -> I/O register
|
||
186: 7086+11 0DD5 D332 OUT (CS_PIA_PC), A ;set register
|
||
187: 7097+7 0DD7 F640 OR IDE_RD ;Set Read bit
|
||
188: 7104+11 0DD9 D332 OUT (CS_PIA_PC), A ;Write Read to bit controll lines
|
||
189: 7115+4 0DDB 00 NOP
|
||
190: 7119+4 0DDC 00 NOP
|
||
191: 7123+4 0DDD 00 NOP
|
||
192: 7127+11 0DDE DB30 IN A,(CS_PIA_PA) ;Load 16-Bit data to buffer
|
||
193: 7138+7 0DE0 77 LD (HL), A
|
||
194: 7145+6 0DE1 23 INC HL
|
||
195: 7151+11 0DE2 DB31 IN A,(CS_PIA_PB)
|
||
196: 7162+7 0DE4 77 LD (HL), A
|
||
197: 7169+6 0DE5 23 INC HL
|
||
198:
|
||
199: 7175+4 0DE6 79 LD A,C
|
||
200: 7179+4 0DE7 B7 OR A
|
||
201: 7183+10 0DE8 CAB20D JP Z,ide_readsector_256_done
|
||
202: 7193+4 0DEB 0D DEC C
|
||
203: 7197+12 0DEC 18CA JR ide_readsector_512_inv_waitloop
|
||
204:
|
||
205: - 0DEE ide_readsector_timeout:
|
||
206: 7209+10 0DEE 21660E LD HL, [str_error_time]
|
||
207: 7219+17 0DF1 CDDF00 CALL print_str
|
||
208: 7236+4 0DF4 79 LD A, C
|
||
209: 7240+17 0DF5 CD0701 CALL print_a_hex
|
||
210: 7257+7 0DF8 3E0A LD A,10
|
||
211: 7264+17 0DFA CDD700 CALL print_char
|
||
212: 7281+7 0DFD 3E0D LD A,13
|
||
213: 7288+17 0DFF CDD700 CALL print_char
|
||
214: 7305+10 0E02 C9 RET
|
||
215:
|
||
216:
|
||
217:
|
||
218:
|
||
219: ;------------------------------------------------------------------------------
|
||
220: ; ide_writesector_256
|
||
221: ;
|
||
222: ; Writes 512 bytes (256 words) of IDE Data
|
||
223: ; HL contains data start address
|
||
224: ;------------------------------------------------------------------------------
|
||
225: - 0E03 ide_writesector_256:
|
||
226: 7315+10 0E03 C9 RET ;NOT IMPLEMENTED
|
||
227:
|
||
228:
|
||
229: ;================================================================
|
||
230: ; utility functions
|
||
231: ;================================================================
|
||
232:
|
||
233: ;------------------------------------------------------------------------------
|
||
234: ; ide_printerror
|
||
235: ;
|
||
236: ; prints IDE error to console
|
||
237: ;------------------------------------------------------------------------------
|
||
238: - 0E04 ide_printerror:
|
||
239: 7325+10 0E04 21370E LD HL, [str_error_start]
|
||
240: 7335+17 0E07 CDDF00 CALL print_str
|
||
241: 7352+7 0E0A 060F LD B, IDE_REG_CMDSTS
|
||
242: 7359+17 0E0C CD650D CALL ide_regread_8
|
||
243: 7376+17 0E0F CD0701 CALL print_a_hex
|
||
244: 7393+10 0E12 21540E LD HL, [str_error_start1]
|
||
245: 7403+17 0E15 CDDF00 CALL print_str
|
||
246: 7420+13 0E18 3A2C40 LD A,(MEM_IDE_DEVICE)
|
||
247: 7433+17 0E1B CD0701 CALL print_a_hex
|
||
248: 7450+10 0E1E 215D0E LD HL, [str_error_start2]
|
||
249: 7460+17 0E21 CDDF00 CALL print_str
|
||
250: 7477+7 0E24 0609 LD B, IDE_REG_ERROR
|
||
251: 7484+17 0E26 CD650D CALL ide_regread_8
|
||
252: 7501+17 0E29 CD0701 CALL print_a_hex
|
||
253: 7518+7 0E2C 3E0A LD A,10
|
||
254: 7525+17 0E2E CDD700 CALL print_char
|
||
255: 7542+7 0E31 3E0D LD A,13
|
||
256: 7549+17 0E33 CDD700 CALL print_char
|
||
257:
|
||
258: 7566+10 0E36 C9 RET
|
||
259:
|
||
260: - 0E37 str_error_start:
|
||
261: - 0E37 0D0A4469 db 13,10,"Disk I/O error. Status: 0x",0
|
||
736B2049
|
||
2F4F2065
|
||
72726F72
|
||
2E205374
|
||
61747573
|
||
3A203078
|
||
00
|
||
262: - 0E54 str_error_start1:
|
||
263: - 0E54 20446576 db " Dev: 0x",0
|
||
3A203078
|
||
00
|
||
264: - 0E5D str_error_start2:
|
||
265: - 0E5D 20457272 db " Err: 0x",0
|
||
3A203078
|
||
00
|
||
266:
|
||
267: - 0E66 str_error_time:
|
||
268: - 0E66 0D0A4469 db 13,10,"Disk I/O error. Data timeout @ 0x",0
|
||
736B2049
|
||
2F4F2065
|
||
72726F72
|
||
2E204461
|
||
74612074
|
||
696D656F
|
||
75742040
|
||
20307800
|
||
**** main.asm ****
|
||
176: .include "kdrv_ideif.s" ;include ide driver.
|
||
**** include/kdrv_ideif.s ****
|
||
1: ;----------------------------------------------------------------
|
||
2: ;BIOS Driver for IDE Access
|
||
3: ;by Dennis Gunia (01/2023)
|
||
4: ;----------------------------------------------------------------
|
||
5:
|
||
6: ;================================================================
|
||
7: ; IDE commands
|
||
8: ;================================================================
|
||
9: - 00EC IDE_CMD_IDENT .EQU 0xEC ;Identify drive.
|
||
10: - 0020 IDE_CMD_READSEC .EQU 0x20 ;Read sectors.
|
||
11:
|
||
12: ;================================================================
|
||
13: ; IDE Variables
|
||
14: ;================================================================
|
||
15: - 402C phase var_idebuffer
|
||
16: - 402C MEM_IDE_DEVICE:
|
||
17: - 402C ..402C 00 defs 1
|
||
18: - 402D MEM_IDE_STATUS:
|
||
19: - 402D ..402D 00 defs 1 ;1Byte: 0x00 if status is okay
|
||
20: - 402E MEM_IDE_PARTITION:
|
||
21: - 402E ..4031 00 defs 4 ;4*16Bytes: LBA first sector
|
||
22: - 4032 MEM_IDE_POINTER:
|
||
23: - 4032 ..4035 00 defs 4 ;4*16Bytes: LBA first sector
|
||
24: - 4036 MEM_IDE_DEV_TABLE:
|
||
25: - 4036 ..4075 00 defs 16*4
|
||
26: - 4076 MEM_IDE_SELECTED:
|
||
27: - 4076 ..4076 00 defs 1
|
||
28: - 4077 MEM_IDE_STRING_0:
|
||
29: - 4077 ..409E 00 defs 40
|
||
30: - 409F MEM_IDE_STRING_1:
|
||
31: - 409F ..40C6 00 defs 40
|
||
32: - 40C7 MEM_IDE_STRING_2:
|
||
33: - 40C7 ..40EE 00 defs 40
|
||
34: - 40EF MEM_IDE_STRING_3:
|
||
35: - 40EF ..4116 00 defs 40
|
||
36: - 4117 MEM_IDE_BUFFER:
|
||
37: - 4117 ..4316 00 defs 512
|
||
38: - 4317 MEM_IDE_FSBUFFER:
|
||
39: - 4317 ..4416 00 defs 256
|
||
40: - 1275 dephase
|
||
41: ;DEV-Table layout
|
||
42: ;<STATUS> <TYPE> <FIRST-SECTOR (4-byte)> <Length (4-byte)> <I/O Addr> <Master/Slave> 0x00 0x00
|
||
43: ;Status: 0x00 -> Ready
|
||
44: ; 0x01 -> Not found
|
||
45: ; 0x02 -> No supported filesystem
|
||
46: ;I/O Addr: Base addr of 82C55
|
||
47: ;Type: File system type
|
||
48:
|
||
49:
|
||
50: - 1275 IDE_DEV_TABLE:
|
||
51: - 1275 FF000000 db 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x00, [MEM_IDE_STRING_0], [MEM_IDE_STRING_0]>>8, 0x00, 0x00
|
||
00000000
|
||
00003000
|
||
77400000
|
||
52: - 1285 FF000000 db 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x01, [MEM_IDE_STRING_1], [MEM_IDE_STRING_1]>>8, 0x00, 0x00
|
||
00000000
|
||
00003001
|
||
9F400000
|
||
53: - 1295 FF000000 db 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, [MEM_IDE_STRING_2], [MEM_IDE_STRING_2]>>8, 0x00, 0x00
|
||
00000000
|
||
00004000
|
||
C7400000
|
||
54: - 12A5 FF000000 db 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x01, [MEM_IDE_STRING_3], [MEM_IDE_STRING_3]>>8, 0x00, 0x00
|
||
00000000
|
||
00004001
|
||
EF400000
|
||
55:
|
||
56: ;================================================================
|
||
57: ; IDE funtions
|
||
58: ;================================================================
|
||
59:
|
||
60: ;------------------------------------------------------------------------------
|
||
61: ; ideif_init_table
|
||
62: ;
|
||
63: ; initializes drive table
|
||
64: ;------------------------------------------------------------------------------
|
||
65: - 12B5 ideif_init_devtable:
|
||
66: ;copy default values to ram
|
||
67: 7576+10 12B5 217512 ld hl,[IDE_DEV_TABLE]
|
||
68: 7586+10 12B8 113640 ld de,[MEM_IDE_DEV_TABLE]
|
||
69: 7596+10 12BB 014000 ld bc,16*4
|
||
70: 7606+16+5 12BE EDB0 ldir
|
||
71: ;set selected device
|
||
72: 7622+7 12C0 3E00 ld a,0
|
||
73: 7629+13 12C2 327640 ld (MEM_IDE_SELECTED),a
|
||
74: ;set empty names
|
||
75: 7642+4 12C5 AF xor a
|
||
76: 7646+13 12C6 327740 ld (MEM_IDE_STRING_0),a
|
||
77: 7659+13 12C9 329F40 ld (MEM_IDE_STRING_1),a
|
||
78: 7672+13 12CC 32C740 ld (MEM_IDE_STRING_2),a
|
||
79: 7685+13 12CF 32EF40 ld (MEM_IDE_STRING_3),a
|
||
80: 7698+10 12D2 C9 ret
|
||
81:
|
||
82: ;------------------------------------------------------------------------------
|
||
83: ; ideif_prnt_devtable
|
||
84: ;
|
||
85: ; prints drive table
|
||
86: ;------------------------------------------------------------------------------
|
||
87: - 12D3 ideif_prnt_devtable:
|
||
88: 7708+17 12D3 CDF100 call print_newLine
|
||
89: 7725+10 12D6 211015 ld hl,[_ideif_prnt_devtable_hdr]
|
||
90: 7735+17 12D9 CDDF00 call print_str
|
||
91: 7752+10 12DC 213640 ld hl,[MEM_IDE_DEV_TABLE]
|
||
92: 7762+7 12DF 0600 ld b,0 ;device number
|
||
93: - 12E1 _ideif_prnt_devtable_l1: ;loop 1 -> for each device
|
||
94: ;print if selected
|
||
95: 7769+13 12E1 3A7640 ld a,(MEM_IDE_SELECTED)
|
||
96: 7782+4 12E4 B8 cp b
|
||
97: 7786+10 12E5 CAEC12 jp z,_ideif_prnt_devtable_l1_sel
|
||
98: 7796+7 12E8 3E20 ld a, ' '
|
||
99: 7803+12 12EA 1802 jr _ideif_prnt_devtable_l1_nxt
|
||
100: - 12EC _ideif_prnt_devtable_l1_sel:
|
||
101: 7815+7 12EC 3E2A ld a, '*'
|
||
102: - 12EE _ideif_prnt_devtable_l1_nxt:
|
||
103: 7822+17 12EE CDD700 call print_char
|
||
104: ;print drive letter
|
||
105: 7839+4 12F1 78 ld a,b
|
||
106: 7843+7 12F2 C645 add 69 ;offset letter to D
|
||
107: 7850+17 12F4 CDD700 call print_char
|
||
108: 7867+7 12F7 3E3A ld a, ':'
|
||
109: 7874+17 12F9 CDD700 call print_char
|
||
110: 7891+7 12FC 3E20 ld a, ' '
|
||
111: 7898+17 12FE CDD700 call print_char
|
||
112: ;print status
|
||
113: 7915+11 1301 E5 push hl
|
||
114: 7926+7 1302 7E ld a,(HL)
|
||
115: 7933+4 1303 B7 or a
|
||
116: 7937+7+5 1304 280E jr z, _ideif_prnt_devtable_l1_s00
|
||
117: 7944+7 1306 FE01 cp 0x01
|
||
118: 7951+7+5 1308 280F jr z, _ideif_prnt_devtable_l1_s01
|
||
119: 7958+7 130A FE02 cp 0x02
|
||
120: 7965+7+5 130C 2810 jr z, _ideif_prnt_devtable_l1_s02
|
||
121: 7972+7 130E FEFF cp 0xFF
|
||
122: 7979+7+5 1310 2811 jr z, _ideif_prnt_devtable_l1_sFF
|
||
123: 7986+12 1312 180F jr _ideif_prnt_devtable_l1_sFF
|
||
124: - 1314 _ideif_prnt_devtable_l1_s00
|
||
125: 7998+10 1314 214815 ld hl,[_ideif_prnt_devtable_s00]
|
||
126: 8008+12 1317 180D jr _ideif_prnt_devtable_l1_es
|
||
127: - 1319 _ideif_prnt_devtable_l1_s01
|
||
128: 8020+10 1319 215315 ld hl,[_ideif_prnt_devtable_s01]
|
||
129: 8030+12 131C 1808 jr _ideif_prnt_devtable_l1_es
|
||
130: - 131E _ideif_prnt_devtable_l1_s02
|
||
131: 8042+10 131E 215E15 ld hl,[_ideif_prnt_devtable_s02]
|
||
132: 8052+12 1321 1803 jr _ideif_prnt_devtable_l1_es
|
||
133: - 1323 _ideif_prnt_devtable_l1_sFF
|
||
134: 8064+10 1323 216915 ld hl,[_ideif_prnt_devtable_sFF]
|
||
135: - 1326 _ideif_prnt_devtable_l1_es
|
||
136: 8074+17 1326 CDDF00 call print_str
|
||
137: 8091+10 1329 E1 pop hl
|
||
138: 8101+6 132A 23 inc hl
|
||
139: ;print FS-Type
|
||
140: 8107+7 132B 3E30 ld a,'0'
|
||
141: 8114+17 132D CDD700 call print_char
|
||
142: 8131+7 1330 3E78 ld a,'x'
|
||
143: 8138+17 1332 CDD700 call print_char
|
||
144: 8155+7 1335 7E ld a,(HL)
|
||
145: 8162+17 1336 CD0701 call print_a_hex
|
||
146: 8179+7 1339 3E20 ld a,' '
|
||
147: 8186+17 133B CDD700 call print_char
|
||
148: 8203+6 133E 23 inc hl
|
||
149: ;print first sector
|
||
150: 8209+11 133F E5 push hl
|
||
151: 8220+14 1340 DDE1 pop ix
|
||
152:
|
||
153: 8234+6 1342 23 inc hl
|
||
154: 8240+6 1343 23 inc hl
|
||
155: 8246+6 1344 23 inc hl
|
||
156: 8252+6 1345 23 inc hl
|
||
157: 8258+6 1346 23 inc hl
|
||
158: 8264+6 1347 23 inc hl
|
||
159: 8270+6 1348 23 inc hl
|
||
160: 8276+6 1349 23 inc hl
|
||
161:
|
||
162: 8282+19 134A DD7E03 ld a,(ix+3)
|
||
163: 8301+17 134D CD0701 call print_a_hex
|
||
164: 8318+19 1350 DD7E02 ld a,(ix+2)
|
||
165: 8337+17 1353 CD0701 call print_a_hex
|
||
166: 8354+19 1356 DD7E01 ld a,(ix+1)
|
||
167: 8373+17 1359 CD0701 call print_a_hex
|
||
168: 8390+19 135C DD7E00 ld a,(ix+0)
|
||
169: 8409+17 135F CD0701 call print_a_hex
|
||
170: 8426+7 1362 3E20 ld a,' '
|
||
171: 8433+17 1364 CDD700 call print_char
|
||
172: ;print length
|
||
173: 8450+19 1367 DD7E07 ld a,(ix+7)
|
||
174: 8469+17 136A CD0701 call print_a_hex
|
||
175: 8486+19 136D DD7E06 ld a,(ix+6)
|
||
176: 8505+17 1370 CD0701 call print_a_hex
|
||
177: 8522+19 1373 DD7E05 ld a,(ix+5)
|
||
178: 8541+17 1376 CD0701 call print_a_hex
|
||
179: 8558+19 1379 DD7E04 ld a,(ix+4)
|
||
180: 8577+17 137C CD0701 call print_a_hex
|
||
181: 8594+7 137F 3E20 ld a,' '
|
||
182: 8601+17 1381 CDD700 call print_char
|
||
183: ;print Port
|
||
184: 8618+7 1384 3E30 ld a,'0'
|
||
185: 8625+17 1386 CDD700 call print_char
|
||
186: 8642+7 1389 3E78 ld a,'x'
|
||
187: 8649+17 138B CDD700 call print_char
|
||
188: 8666+7 138E 7E ld a,(HL)
|
||
189: 8673+17 138F CD0701 call print_a_hex
|
||
190: 8690+7 1392 3E20 ld a,' '
|
||
191: 8697+17 1394 CDD700 call print_char
|
||
192: 8714+6 1397 23 inc hl
|
||
193: ;print M/S
|
||
194: 8720+7 1398 7E ld a,(HL)
|
||
195: 8727+11 1399 E5 push hl
|
||
196: 8738+4 139A B7 or a
|
||
197: 8742+10 139B CAA413 jp z,_ideif_prnt_devtable_l1_ms
|
||
198: 8752+10 139E 217C15 ld hl,[_ideif_prnt_devtable_slave]
|
||
199: 8762+10 13A1 C3A713 jp _ideif_prnt_devtable_l1_e2
|
||
200: - 13A4 _ideif_prnt_devtable_l1_ms
|
||
201: 8772+10 13A4 217415 ld hl,[_ideif_prnt_devtable_master]
|
||
202: - 13A7 _ideif_prnt_devtable_l1_e2
|
||
203: 8782+17 13A7 CDDF00 call print_str
|
||
204: 8799+10 13AA E1 pop hl
|
||
205: 8809+6 13AB 23 inc hl
|
||
206: ;print str
|
||
207: 8815+11 13AC C5 push bc
|
||
208: 8826+7 13AD 7E ld a,(hl)
|
||
209: 8833+4 13AE 4F ld c,a
|
||
210: 8837+6 13AF 23 inc hl
|
||
211: 8843+7 13B0 7E ld a,(hl)
|
||
212: 8850+4 13B1 47 ld b,a
|
||
213: 8854+6 13B2 23 inc hl
|
||
214: 8860+11 13B3 E5 push hl
|
||
215: 8871+4 13B4 60 ld h,b
|
||
216: 8875+4 13B5 69 ld l,c
|
||
217: 8879+17 13B6 CDDF00 call print_str
|
||
218: 8896+17 13B9 CDF100 call print_newLine
|
||
219: 8913+10 13BC E1 pop hl
|
||
220: 8923+10 13BD C1 pop bc
|
||
221: ;next
|
||
222: 8933+6 13BE 23 inc hl
|
||
223: 8939+6 13BF 23 inc hl
|
||
224: 8945+4 13C0 04 inc b
|
||
225: 8949+4 13C1 78 ld a,b
|
||
226: 8953+7 13C2 FE04 cp 4
|
||
227: 8960+5+6 13C4 C8 ret z
|
||
228: 8965+10 13C5 C3E112 jp _ideif_prnt_devtable_l1
|
||
229: ;------------------------------------------------------------------------------
|
||
230: ; ideif_init_drive
|
||
231: ;
|
||
232: ; initializes selected drive in table
|
||
233: ;------------------------------------------------------------------------------
|
||
234: - 13C8 ideif_init_drive:
|
||
235: 8975+17 13C8 CD9714 call ideif_get_drv_pointer
|
||
236: ; load addresses. not used atm
|
||
237: ;ld a,(IX+6) ;load IO Addr
|
||
238: ;ld d,a
|
||
239: ;ld a,(IX+7) ;load Master/Slave bit
|
||
240: ;ld e,a
|
||
241: 8992+17 13CB CD3C0D call ide_reset
|
||
242:
|
||
243: 9009+10 13CE 01FF5F ld bc, 0x5FFF ;preload timeout counter
|
||
244: - 13D1 _ideif_init_drive_loop:
|
||
245: 9019+7 13D1 060F ld b, IDE_REG_CMDSTS
|
||
246: 9026+17 13D3 CD650D call ide_regread_8 ;read drive status register
|
||
247: 9043+4 13D6 B7 or a
|
||
248: 9047+7+5 13D7 280B jr z,_ideif_init_drive_nodrv ;no drive found
|
||
249: 9054+8 13D9 CB77 bit 6,a
|
||
250: 9062+7+5 13DB 200C jr nz, _ideif_init_drive_found
|
||
251: 9069+6 13DD 1B dec de
|
||
252: 9075+4 13DE 7A ld a,d
|
||
253: 9079+4 13DF B3 or e
|
||
254: 9083+7+5 13E0 2802 jr z, _ideif_init_drive_nodrv
|
||
255: 9090+12 13E2 18ED jr _ideif_init_drive_loop
|
||
256:
|
||
257: - 13E4 _ideif_init_drive_nodrv:
|
||
258: 9102+19 13E4 DD360001 ld(ix+0),0x01
|
||
259: 9121+10 13E8 C9 ret
|
||
260:
|
||
261: - 13E9 _ideif_init_drive_found:
|
||
262: 9131+19 13E9 DD360002 ld (ix+0),0x02
|
||
263: ;get drive name
|
||
264: 9150+7 13ED 060F ld b, IDE_REG_CMDSTS ;Get drive identification
|
||
265: 9157+7 13EF 3EEC ld a, IDE_CMD_IDENT
|
||
266: 9164+17 13F1 CD490D call ide_regwrite_8 ;Write command to drive
|
||
267: 9181+10 13F4 211741 ld hl, MEM_IDE_BUFFER ;set read/write buffer start address
|
||
268: 9191+17 13F7 CD830D call ide_readsector_256 ;read 256 words from device
|
||
269: 9208+10 13FA 214D41 ld hl,MEM_IDE_BUFFER + 54 ;print device serial
|
||
270: 9218+19 13FD DD7E0C ld a,(ix+12) ;load str pointer into de
|
||
271: 9237+4 1400 5F ld e,a
|
||
272: 9241+19 1401 DD7E0D ld a,(ix+13)
|
||
273: 9260+4 1404 57 ld d,a
|
||
274: 9264+10 1405 012800 ld bc,40 ;copy 40 char
|
||
275: 9274+16+5 1408 EDB0 ldir
|
||
276: ;get partition table
|
||
277: ;read bootsector
|
||
278: 9290+7 140A 3E01 ld a,1 ;read 1 sector
|
||
279: 9297+7 140C 060A ld B,IDE_REG_SECTOR
|
||
280: 9304+17 140E CD490D call ide_regwrite_8
|
||
281: 9321+7 1411 3E01 ld a,1 ;read sector 0
|
||
282: 9328+7 1413 060B ld b,IDE_REG_SSECTOR
|
||
283: 9335+17 1415 CD490D call ide_regwrite_8
|
||
284: 9352+7 1418 3E00 ld a,0 ;read cylinder 0
|
||
285: 9359+7 141A 060C ld b,IDE_REG_LCYL
|
||
286: 9366+17 141C CD490D call ide_regwrite_8
|
||
287: 9383+7 141F 3E00 ld a,0
|
||
288: 9390+7 1421 060D ld b,IDE_REG_HCYL
|
||
289: 9397+17 1423 CD490D call ide_regwrite_8
|
||
290: 9414+7 1426 3EA0 ld a,10100000b ;read head 0
|
||
291: 9421+7 1428 060E ld b,IDE_REG_HEAD
|
||
292: 9428+17 142A CD490D call ide_regwrite_8
|
||
293: 9445+7 142D 3E20 ld a,IDE_CMD_READSEC ;send read command
|
||
294: 9452+7 142F 060F ld b,IDE_REG_CMDSTS
|
||
295: 9459+17 1431 CD490D call ide_regwrite_8
|
||
296: 9476+10 1434 211741 ld hl, MEM_IDE_BUFFER ;set read/write buffer start address
|
||
297: 9486+17 1437 CDB30D call ide_readsector_512_inv ;read 256 words from device
|
||
298: ;prepare partitions
|
||
299: 9503+7 143A 0604 ld b,4 ;Partition table length
|
||
300: 9510+7 143C 0E00 ld c,0 ;Partition ID counter
|
||
301: 9517+14 143E FD21D542 ld iy,MEM_IDE_BUFFER+446 ;Load offest of first partition table entry
|
||
302: - 1442 _ideif_init_drive_prt_l1:
|
||
303: 9531+19 1442 FD7E04 ld a,(iy+4) ;load status byte
|
||
304: 9550+4 1445 B7 or a
|
||
305: 9554+10 1446 C25414 jp NZ, _ideif_init_drive_prt_fnd ;If not zero, jump to print function
|
||
306: 9564+10 1449 C34C14 jp _ideif_init_drive_prt_ln
|
||
307: - 144C _ideif_init_drive_prt_ln:
|
||
308: 9574+10 144C 111000 ld de,16
|
||
309: 9584+15 144F FD19 add iy,de
|
||
310: 9599+8+5 1451 10EF djnz _ideif_init_drive_prt_l1
|
||
311: 9607+10 1453 C9 ret
|
||
312: - 1454 _ideif_init_drive_prt_fnd;
|
||
313: 9617+19 1454 FD7E04 ld a,(iy+4)
|
||
314: 9636+19 1457 DD7701 ld (ix+1),a ;store partition type
|
||
315: 9655+7 145A FE0E cp 0x0E ;if not 0xE0, continue with next entry
|
||
316: 9662+7+5 145C 20EE jr nz, _ideif_init_drive_prt_ln
|
||
317: ;get start LBA
|
||
318: 9669+19 145E FD7E08 ld a,(iy+0x08)
|
||
319: 9688+19 1461 DD7702 ld (ix+0x02),a
|
||
320: 9707+19 1464 FD7E09 ld a,(iy+0x09)
|
||
321: 9726+19 1467 DD7703 ld (ix+0x03),a
|
||
322: 9745+19 146A FD7E0A ld a,(iy+0x0A)
|
||
323: 9764+19 146D DD7704 ld (ix+0x04),a
|
||
324: 9783+19 1470 FD7E0B ld a,(iy+0x0B)
|
||
325: 9802+19 1473 DD7705 ld (ix+0x05),a
|
||
326: 9821+19 1476 DD360000 ld (ix+0),0x00
|
||
327: ;get count LBA
|
||
328: 9840+19 147A FD7E0C ld a,(iy+0x0C)
|
||
329: 9859+19 147D DD7706 ld (ix+0x06),a
|
||
330: 9878+19 1480 FD7E0D ld a,(iy+0x0D)
|
||
331: 9897+19 1483 DD7707 ld (ix+0x07),a
|
||
332: 9916+19 1486 FD7E0E ld a,(iy+0x0E)
|
||
333: 9935+19 1489 DD7708 ld (ix+0x08),a
|
||
334: 9954+19 148C FD7E0F ld a,(iy+0x0F)
|
||
335: 9973+19 148F DD7709 ld (ix+0x09),a
|
||
336: 9992+19 1492 DD360000 ld (ix+0),0x00
|
||
337:10011+10 1496 C9 ret
|
||
338:
|
||
339: ;------------------------------------------------------------------------------
|
||
340: ; ideif_get_drv_pointer
|
||
341: ;
|
||
342: ; gets pointer to selected drive in table
|
||
343: ;------------------------------------------------------------------------------
|
||
344: - 1497 ideif_get_drv_pointer:
|
||
345:10021+11 1497 F5 push af
|
||
346:10032+11 1498 C5 push bc
|
||
347: ;get selected drive
|
||
348:10043+13 1499 3A7640 ld a,(MEM_IDE_SELECTED)
|
||
349: ;multiply a *8
|
||
350:10056+4 149C 07 rlca ;*2
|
||
351:10060+4 149D 07 rlca ;*4
|
||
352:10064+4 149E 07 rlca ;*8
|
||
353:10068+7 149F 0600 ld b,0
|
||
354:10075+4 14A1 4F ld c,a
|
||
355:10079+14 14A2 DD213640 ld ix,[MEM_IDE_DEV_TABLE]
|
||
356:10093+15 14A6 DD09 add ix,bc
|
||
357:10108+10 14A8 C1 pop bc
|
||
358:10118+10 14A9 F1 pop af
|
||
359:10128+10 14AA C9 ret
|
||
360:
|
||
361: ;------------------------------------------------------------------------------
|
||
362: ; ideif_init_all
|
||
363: ;
|
||
364: ; initializes interface
|
||
365: ;------------------------------------------------------------------------------
|
||
366: - 14AB ideif_init_all:
|
||
367:10138+10 14AB 21F014 ld hl, [str_dev_waitready]
|
||
368:10148+17 14AE CDDF00 call print_str ;print waiting message
|
||
369:
|
||
370:10165+17 14B1 CDB512 call ideif_init_devtable
|
||
371:10182+17 14B4 CDC813 call ideif_init_drive
|
||
372:
|
||
373:10199+10 14B7 210815 ld hl, [str_dev_done]
|
||
374:10209+17 14BA CDDF00 call print_str
|
||
375:10226+10 14BD C9 RET
|
||
376:
|
||
377:
|
||
378: ;------------------------------------------------------------------------------
|
||
379: ; ideif_drv_sel
|
||
380: ;
|
||
381: ; Selects drive from table and initializes the fat16 file system
|
||
382: ; A contains drive id
|
||
383: ;------------------------------------------------------------------------------
|
||
384:
|
||
385:
|
||
386:
|
||
387: ;------------------------------------------------------------------------------
|
||
388: ; read_lba_sector
|
||
389: ;
|
||
390: ; Reads A*512 byte sector into memory
|
||
391: ; HL contains pointer to LBA address
|
||
392: ; A contains sector count
|
||
393: ;------------------------------------------------------------------------------
|
||
394: - 14BE read_lba_sector:
|
||
395:10236+7 14BE 060A LD B,IDE_REG_SECTOR ;amount of sectores
|
||
396:10243+17 14C0 CD490D CALL ide_regwrite_8
|
||
397:
|
||
398:10260+7 14C3 7E LD A,(HL)
|
||
399:10267+7 14C4 060B LD B,IDE_REG_LBA0
|
||
400:10274+17 14C6 CD490D CALL ide_regwrite_8
|
||
401:10291+6 14C9 23 INC HL
|
||
402:10297+7 14CA 7E LD A,(HL)
|
||
403:10304+7 14CB 060C LD B,IDE_REG_LBA1
|
||
404:10311+17 14CD CD490D CALL ide_regwrite_8
|
||
405:10328+6 14D0 23 INC HL
|
||
406:10334+7 14D1 7E LD A,(HL)
|
||
407:10341+7 14D2 060D LD B,IDE_REG_LBA2
|
||
408:10348+17 14D4 CD490D CALL ide_regwrite_8
|
||
409:10365+6 14D7 23 INC HL
|
||
410:10371+7 14D8 7E LD A,(HL)
|
||
411:10378+7 14D9 E60F AND 00001111b
|
||
412:10385+7 14DB F6E0 OR 11100000b
|
||
413:10392+7 14DD 060E LD B,IDE_REG_LBA3
|
||
414:10399+17 14DF CD490D CALL ide_regwrite_8
|
||
415:
|
||
416:10416+7 14E2 3E20 LD A,IDE_CMD_READSEC ;send read command
|
||
417:10423+7 14E4 060F LD B,IDE_REG_CMDSTS
|
||
418:10430+17 14E6 CD490D CALL ide_regwrite_8
|
||
419:10447+10 14E9 211741 LD HL,MEM_IDE_BUFFER ;set read/write buffer start address
|
||
420:10457+17 14EC CDB30D call ide_readsector_512_inv ;read 256 words from device
|
||
421:10474+10 14EF C9 ret
|
||
422:
|
||
423:
|
||
424:
|
||
425:
|
||
426:
|
||
427: ;================================================================
|
||
428: ; IDE strings
|
||
429: ;===============================================================
|
||
430:
|
||
431: - 14F0 str_dev_waitready:
|
||
432: - 14F0 0D0A4465 db 13,10,"Detecting drives ... ",0
|
||
74656374
|
||
696E6720
|
||
64726976
|
||
6573202E
|
||
2E2E2000
|
||
433: - 1508 str_dev_done:
|
||
434: - 1508 646F6E65 db "done!",13,10,0
|
||
210D0A00
|
||
435:
|
||
436: - 1510 _ideif_prnt_devtable_hdr:
|
||
437: - 1510 44525620 db "DRV Status Type LBA Length Port M/S Name",10,13,0
|
||
53746174
|
||
75732020
|
||
20205479
|
||
7065204C
|
||
42412020
|
||
20202020
|
||
4C656E67
|
||
74682020
|
||
20506F72
|
||
74204D2F
|
||
53202020
|
||
204E616D
|
||
650A0D00
|
||
438: - 1548 _ideif_prnt_devtable_s00:
|
||
439: - 1548 41766169 db "Avail ",0
|
||
6C202020
|
||
202000
|
||
440: - 1553 _ideif_prnt_devtable_s01:
|
||
441: - 1553 4E6F7420 db "Not Found ",0
|
||
466F756E
|
||
642000
|
||
442: - 155E _ideif_prnt_devtable_s02:
|
||
443: - 155E 556E6B6F db "Unkown FS ",0
|
||
776E2046
|
||
532000
|
||
444: - 1569 _ideif_prnt_devtable_sFF:
|
||
445: - 1569 4374726C db "Ctrl. Err ",0
|
||
2E204572
|
||
722000
|
||
446: - 1574 _ideif_prnt_devtable_master:
|
||
447: - 1574 4D617374 db "Master ",0
|
||
65722000
|
||
448: - 157C _ideif_prnt_devtable_slave:
|
||
**** main.asm ****
|
||
177: - 157C 536C6176 db "Slave ",0
|
||
65202000
|
||
178: .include "kdrv_siic.s"
|
||
**** include/kdrv_siic.s ****
|
||
1: ;----------------------------------------------------------------
|
||
2: ;BIOS Driver for I2C Protocol (Software)
|
||
3: ;by Dennis Gunia (01/2024)
|
||
4: ;
|
||
5: ; SCL is connected to PA1 of PIO (U6) with pull-up
|
||
6: ; SDA is connected to PA0 of PIO (U6) with pull-up
|
||
7: ;----------------------------------------------------------------
|
||
8:
|
||
9:
|
||
10: ;================================================================
|
||
11: ; I/O registers
|
||
12: ;================================================================
|
||
13:
|
||
14:
|
||
15: ;================================================================
|
||
16: ; I/O pins
|
||
17: ;================================================================
|
||
18: - 0001 IIC_CLK .EQU 00000001b
|
||
19: - 0002 IIC_DATA .EQU 00000010b
|
||
20:
|
||
21: ;================================================================
|
||
22: ; basic access functions
|
||
23: ;================================================================
|
||
24: ;HL contains buffer location
|
||
25: ;B defines amount of bytes to send
|
||
26: ;C contains device address
|
||
27: - 1584 iic_send_buffer:
|
||
28:10484+17 1584 CDE615 CALL iic_send_sbit ;Send startbit
|
||
29:10501+4 1587 79 LD A,C
|
||
30:10505+7 1588 E6FE AND 0xFE ;Mask R/W bit (must be 0 for write)
|
||
31:10512+17 158A CD7C16 CALL iic_send_byte ;Send Address
|
||
32:10529+17 158D CD1C16 CALL iic_read_ack
|
||
33:10546+4 1590 B7 OR A ; if no ack, error
|
||
34:10550+10 1591 C2A815 JP NZ, iic_send_buffer_err
|
||
35: - 1594 iic_send_buffer_loop;
|
||
36:10560+7 1594 7E LD A,(HL)
|
||
37:10567+6 1595 23 INC HL
|
||
38:10573+17 1596 CD7C16 CALL iic_send_byte
|
||
39:10590+17 1599 CD1C16 CALL iic_read_ack
|
||
40:10607+4 159C B7 OR A ; if no ack, error
|
||
41:10611+10 159D C2A815 JP NZ, iic_send_buffer_err
|
||
42:10621+8+5 15A0 10F2 DJNZ iic_send_buffer_loop ;loop for remaining bytes
|
||
43: - 15A2 iic_send_buffer_done:
|
||
44:10629+17 15A2 CDFB15 CALL iic_send_ebit
|
||
45:10646+7 15A5 3E00 LD A,0
|
||
46:10653+10 15A7 C9 RET
|
||
47: - 15A8 iic_send_buffer_err:
|
||
48:10663+17 15A8 CDFB15 CALL iic_send_ebit
|
||
49:10680+7 15AB 3E01 LD A,1
|
||
50:10687+10 15AD C9 RET
|
||
51:
|
||
52: ;HL contains buffer location
|
||
53: ;B defines amount of bytes to send
|
||
54: ;C contains device address
|
||
55: - 15AE iic_receive_buffer:
|
||
56:10697+4 15AE 05 DEC B
|
||
57:10701+17 15AF CDE615 CALL iic_send_sbit ;Send startbit
|
||
58:10718+4 15B2 79 LD A,C
|
||
59:10722+7 15B3 F601 OR 0x01 ;set R/W bit (must be 1 for read)
|
||
60:10729+17 15B5 CD7C16 CALL iic_send_byte ;Send Address
|
||
61:10746+17 15B8 CD1C16 CALL iic_read_ack
|
||
62:10763+4 15BB B7 OR A ; if no ack, error
|
||
63:10767+10 15BC C2D715 JP NZ, iic_receive_buffer_err
|
||
64: - 15BF iic_receive_buffer_loop:
|
||
65:10777+17 15BF CDA216 CALL iic_receive_byte
|
||
66:10794+7 15C2 77 LD (HL),A
|
||
67:10801+6 15C3 23 INC HL
|
||
68:10807+17 15C4 CD4216 CALL iic_send_ack
|
||
69:10824+8+5 15C7 10F6 DJNZ iic_receive_buffer_loop
|
||
70: ; last time:
|
||
71:10832+17 15C9 CDA216 CALL iic_receive_byte
|
||
72:10849+7 15CC 77 LD (HL),A
|
||
73:10856+6 15CD 23 INC HL
|
||
74:10862+17 15CE CD5F16 CALL iic_send_nack
|
||
75:
|
||
76: - 15D1 iic_receive_buffer_done:
|
||
77:10879+17 15D1 CDFB15 CALL iic_send_ebit
|
||
78:10896+7 15D4 3E00 LD A,0
|
||
79:10903+10 15D6 C9 RET
|
||
80: - 15D7 iic_receive_buffer_err:
|
||
81:10913+17 15D7 CDFB15 CALL iic_send_ebit
|
||
82:10930+7 15DA 3E01 LD A,1
|
||
83:10937+10 15DC C9 RET
|
||
84:
|
||
85:
|
||
86:
|
||
87: ;================================================================
|
||
88: ; I/O access functions
|
||
89: ;================================================================
|
||
90:
|
||
91: ;Reset PIO configuration
|
||
92: - 15DD iic_init:
|
||
93: ;Set port to controll mode (MODE3)
|
||
94:10947+7 15DD 3ECF LD A,0xCF
|
||
95:10954+11 15DF D3F6 OUT (CS_PIO_AC), A
|
||
96: ;Set inputs/outputs
|
||
97:10965+7 15E1 3EF0 LD A,0xF0
|
||
98:10972+11 15E3 D3F6 OUT (CS_PIO_AC), A
|
||
99:10983+10 15E5 C9 RET
|
||
100:
|
||
101: ; send start bit
|
||
102: - 15E6 iic_send_sbit:
|
||
103: ;Set port to controll mode (MODE3)
|
||
104:10993+7 15E6 3ECF LD A,0xCF
|
||
105:11000+11 15E8 D3F6 OUT (CS_PIO_AC), A
|
||
106: ;Set inputs/outputs (SDA and SCL is now output)
|
||
107:11011+7 15EA 3EFC LD A,0xFC
|
||
108:11018+11 15EC D3F6 OUT (CS_PIO_AC), A
|
||
109: ;SCL HIGH, SDA LOW
|
||
110:11029+7 15EE 3E02 LD A,0x02
|
||
111:11036+11 15F0 D3F4 OUT (CS_PIO_AD), A
|
||
112:11047+4 15F2 00 NOP
|
||
113:11051+4 15F3 00 NOP
|
||
114:11055+7 15F4 3E00 LD A,0x00
|
||
115:11062+11 15F6 D3F4 OUT (CS_PIO_AD), A
|
||
116:11073+4 15F8 00 NOP
|
||
117:11077+4 15F9 00 NOP
|
||
118:11081+10 15FA C9 RET
|
||
119:
|
||
120: ; send end/stop bit
|
||
121: - 15FB iic_send_ebit:
|
||
122: ;Set port to controll mode (MODE3)
|
||
123:11091+7 15FB 3ECF LD A,0xCF
|
||
124:11098+11 15FD D3F6 OUT (CS_PIO_AC), A
|
||
125:
|
||
126: ;Set inputs/outputs (SDA and SCL is now output)
|
||
127:11109+7 15FF 3EFC LD A,0xFC
|
||
128:11116+11 1601 D3F6 OUT (CS_PIO_AC), A
|
||
129: ;SCL HIGH, SDA LOW
|
||
130:11127+7 1603 3E02 LD A,0x02
|
||
131:11134+11 1605 D3F4 OUT (CS_PIO_AD), A
|
||
132:11145+4 1607 00 NOP
|
||
133:11149+4 1608 00 NOP
|
||
134:11153+7 1609 3E03 LD A,0x03 ; both high
|
||
135:11160+11 160B D3F4 OUT (CS_PIO_AD), A
|
||
136:11171+4 160D 00 NOP
|
||
137:11175+4 160E 00 NOP
|
||
138: ;release bus
|
||
139: ;Set port to controll mode (MODE3)
|
||
140:11179+7 160F 3ECF LD A,0xCF
|
||
141:11186+11 1611 D3F6 OUT (CS_PIO_AC), A
|
||
142:11197+4 1613 00 NOP
|
||
143:11201+4 1614 00 NOP
|
||
144: ;Set inputs/outputs (SDA and SCL is now input, sound enabled)
|
||
145:11205+7 1615 3EF7 LD A,11110111b
|
||
146:11212+11 1617 D3F6 OUT (CS_PIO_AC), A
|
||
147:11223+4 1619 00 NOP
|
||
148:11227+4 161A 00 NOP
|
||
149:11231+10 161B C9 RET
|
||
150:
|
||
151:
|
||
152: - 161C iic_read_ack:
|
||
153:11241+7 161C 3ECF LD A,0xCF
|
||
154:11248+11 161E D3F6 OUT (CS_PIO_AC), A
|
||
155: ;Set inputs/outputs (SCL is now output, SDA input)
|
||
156:11259+7 1620 3EFD LD A,0xFD
|
||
157:11266+11 1622 D3F6 OUT (CS_PIO_AC), A
|
||
158:11277+4 1624 00 NOP
|
||
159:11281+4 1625 00 NOP
|
||
160:11285+7 1626 3E00 LD A,0x00 ;set SCL LOW
|
||
161:11292+11 1628 D3F4 OUT (CS_PIO_AD), A
|
||
162:11303+4 162A 00 NOP
|
||
163:11307+4 162B 00 NOP
|
||
164:11311+7 162C EE02 XOR 0x02 ;set SCL HIGH
|
||
165:11318+11 162E D3F4 OUT (CS_PIO_AD), A
|
||
166:11329+4 1630 00 NOP
|
||
167:11333+11 1631 DBF4 IN A,(CS_PIO_AD) ; Read SDA
|
||
168:11344+4 1633 00 NOP
|
||
169:11348+4 1634 00 NOP
|
||
170:11352+11 1635 F5 PUSH AF
|
||
171:11363+7 1636 E6FE AND 0xFE ; Filter input
|
||
172:11370+7 1638 EE02 XOR 0x02 ;set SCL LOW
|
||
173:11377+11 163A D3F4 OUT (CS_PIO_AD), A
|
||
174:11388+4 163C 00 NOP
|
||
175:11392+4 163D 00 NOP
|
||
176:11396+10 163E F1 POP AF
|
||
177:11406+7 163F E601 AND 1
|
||
178:11413+10 1641 C9 RET
|
||
179:
|
||
180: - 1642 iic_send_ack:
|
||
181: ;Set port to controll mode (MODE3)
|
||
182:11423+7 1642 3ECF LD A,0xCF
|
||
183:11430+11 1644 D3F6 OUT (CS_PIO_AC), A
|
||
184: ;Set inputs/outputs (SDA and SCL is now output)
|
||
185:11441+7 1646 3EFC LD A,0xFC
|
||
186:11448+11 1648 D3F6 OUT (CS_PIO_AC), A
|
||
187:11459+4 164A 00 NOP
|
||
188:11463+4 164B 00 NOP
|
||
189:11467+7 164C 3E00 LD A,0x00 ; SCL LOW, SDA LOW
|
||
190:11474+11 164E D3F4 OUT (CS_PIO_AD), A
|
||
191:11485+4 1650 00 NOP
|
||
192:11489+4 1651 00 NOP
|
||
193:11493+7 1652 3E02 LD A,0x02 ; SCL HIGH, SDA LOW
|
||
194:11500+11 1654 D3F4 OUT (CS_PIO_AD), A
|
||
195:11511+4 1656 00 NOP
|
||
196:11515+4 1657 00 NOP
|
||
197:11519+7 1658 3E00 LD A,0x00 ; SCL LOW, SDA LOW
|
||
198:11526+11 165A D3F4 OUT (CS_PIO_AD), A
|
||
199:11537+4 165C 00 NOP
|
||
200:11541+4 165D 00 NOP
|
||
201:11545+10 165E C9 RET
|
||
202:
|
||
203: - 165F iic_send_nack:
|
||
204: ;Set port to controll mode (MODE3)
|
||
205:11555+7 165F 3ECF LD A,0xCF
|
||
206:11562+11 1661 D3F6 OUT (CS_PIO_AC), A
|
||
207: ;Set inputs/outputs (SDA and SCL is now output)
|
||
208:11573+7 1663 3EFC LD A,0xFC
|
||
209:11580+11 1665 D3F6 OUT (CS_PIO_AC), A
|
||
210:11591+4 1667 00 NOP
|
||
211:11595+4 1668 00 NOP
|
||
212:11599+7 1669 3E02 LD A,0x02 ; SCL LOW, SDA HIGH
|
||
213:11606+11 166B D3F4 OUT (CS_PIO_AD), A
|
||
214:11617+4 166D 00 NOP
|
||
215:11621+4 166E 00 NOP
|
||
216:11625+7 166F 3E03 LD A,0x03 ; both high
|
||
217:11632+11 1671 D3F4 OUT (CS_PIO_AD), A
|
||
218:11643+4 1673 00 NOP
|
||
219:11647+4 1674 00 NOP
|
||
220:11651+7 1675 3E02 LD A,0x02 ; SCL LOW, SDA HIGH
|
||
221:11658+11 1677 D3F4 OUT (CS_PIO_AD), A
|
||
222:11669+4 1679 00 NOP
|
||
223:11673+4 167A 00 NOP
|
||
224:11677+10 167B C9 RET
|
||
225:
|
||
226: ;A contains byte
|
||
227: - 167C iic_send_byte:
|
||
228:11687+11 167C C5 PUSH BC
|
||
229:11698+4 167D 4F LD C,A ;buffer
|
||
230: ;Set port to controll mode (MODE3)
|
||
231:11702+7 167E 3ECF LD A,0xCF
|
||
232:11709+11 1680 D3F6 OUT (CS_PIO_AC), A
|
||
233: ;Set inputs/outputs (SDA and SCL is now output)
|
||
234:11720+7 1682 3EFC LD A,0xFC
|
||
235:11727+11 1684 D3F6 OUT (CS_PIO_AC), A
|
||
236:11738+7 1686 0608 LD B,8 ;bit counter
|
||
237:
|
||
238: - 1688 iic_send_byte_loop:
|
||
239: ;prepare data
|
||
240:11745+8 1688 CB11 RL C
|
||
241:11753+7 168A 3E00 LD A,0
|
||
242:11760+4 168C 17 RLA ; set SCA bit from carry, SCL LOW
|
||
243:11764+11 168D D3F4 OUT (CS_PIO_AD), A
|
||
244:11775+4 168F 00 NOP
|
||
245:11779+4 1690 00 NOP
|
||
246:11783+7 1691 EE02 XOR 0x02 ;set SCL HIGH
|
||
247:11790+11 1693 D3F4 OUT (CS_PIO_AD), A
|
||
248:11801+4 1695 00 NOP
|
||
249:11805+4 1696 00 NOP
|
||
250:11809+7 1697 EE02 XOR 0x02 ;set SCL LOW
|
||
251:11816+11 1699 D3F4 OUT (CS_PIO_AD), A
|
||
252:11827+4 169B 00 NOP
|
||
253:11831+4 169C 00 NOP
|
||
254:11835+8+5 169D 10E9 DJNZ iic_send_byte_loop ;loop until counter is 0
|
||
255: ;transmittion end / end loop
|
||
256:11843+4 169F 79 LD A,C
|
||
257:11847+10 16A0 C1 POP BC
|
||
258:11857+10 16A1 C9 RET
|
||
259:
|
||
260: - 16A2 iic_receive_byte:
|
||
261:11867+11 16A2 C5 PUSH BC
|
||
262: ;Set port to controll mode (MODE3)
|
||
263:11878+7 16A3 3ECF LD A,0xCF
|
||
264:11885+11 16A5 D3F6 OUT (CS_PIO_AC), A
|
||
265: ;Set inputs/outputs (SCL is now output, SDA input)
|
||
266:11896+7 16A7 3EFD LD A,0xFD
|
||
267:11903+11 16A9 D3F6 OUT (CS_PIO_AC), A
|
||
268:11914+7 16AB 0608 LD B,8 ;bit counter
|
||
269:11921+7 16AD 0E00 LD C,0
|
||
270: - 16AF iic_receive_byte_loop:
|
||
271:11928+4 16AF AF XOR A ;set SCL LOW
|
||
272:11932+11 16B0 D3F4 OUT (CS_PIO_AD), A
|
||
273:11943+4 16B2 00 NOP
|
||
274:11947+4 16B3 00 NOP
|
||
275:11951+7 16B4 3E02 LD A,2 ;set SCL HIGH
|
||
276:11958+11 16B6 D3F4 OUT (CS_PIO_AD), A
|
||
277:11969+4 16B8 00 NOP
|
||
278:11973+11 16B9 DBF4 IN A, (CS_PIO_AD)
|
||
279:11984+4 16BB 00 NOP
|
||
280:11988+4 16BC 1F RRA ;read SDA bit
|
||
281:11992+8 16BD CB11 RL C ;store bit
|
||
282:12000+4 16BF AF XOR A ;set SCL LOW again
|
||
283:12004+11 16C0 D3F4 OUT (CS_PIO_AD), A
|
||
284:12015+4 16C2 00 NOP
|
||
285:12019+4 16C3 00 NOP
|
||
286:12023+8+5 16C4 10E9 DJNZ iic_receive_byte_loop
|
||
287:12031+4 16C6 79 LD A,C
|
||
288:12035+10 16C7 C1 POP BC
|
||
**** main.asm ****
|
||
179:12045+10 16C8 C9 RET
|
||
180: .include "prettydump.s"
|
||
**** include/prettydump.s ****
|
||
1: ;----------------------------------------------------------------
|
||
2: ;HEX and ASCII dump function
|
||
3: ;by Dennis Gunia (01/2023)
|
||
4: ;----------------------------------------------------------------
|
||
5:
|
||
6: ;------------------------------------------------------------------------------
|
||
7: ; dump_pretty
|
||
8: ;
|
||
9: ; Dumps memory content
|
||
10: ; B contains amount of rows
|
||
11: ; HL contains start address
|
||
12: ; Destroys BC, HL
|
||
13: ;------------------------------------------------------------------------------
|
||
14: - 16C9 dump_pretty:
|
||
15:12055+11 16C9 E5 PUSH HL
|
||
16:12066+10 16CA 212417 LD HL,[STR_PD_HEADER] ;Print header
|
||
17:12076+17 16CD CDDF00 CALL print_str
|
||
18:12093+10 16D0 E1 POP HL
|
||
19: - 16D1 dump_pretty_row:
|
||
20:12103+4 16D1 78 LD A,B ;Check row counter
|
||
21:12107+4 16D2 B7 OR A
|
||
22:12111+10 16D3 CA2317 JP Z, dump_pretty_end ;If counter is 0, exit
|
||
23:12121+4 16D6 05 DEC B ;Decrement row counter by 1
|
||
24:12125+7 16D7 0E10 LD C, 16 ;Load column counter
|
||
25:12132+4 16D9 7C LD A, H ;Print base address
|
||
26:12136+17 16DA CD0701 CALL print_a_hex
|
||
27:12153+4 16DD 7D LD A, L
|
||
28:12157+17 16DE CD0701 CALL print_a_hex
|
||
29:12174+7 16E1 3E20 LD A, ' '
|
||
30:12181+17 16E3 CDD700 CALL print_char
|
||
31: - 16E6 dump_pretty_col: ;Loop for column
|
||
32:12198+7 16E6 7E LD A,(HL) ;Load byte to disply
|
||
33:12205+17 16E7 CD0701 CALL print_a_hex
|
||
34:12222+7 16EA 3E20 LD A, ' '
|
||
35:12229+17 16EC CDD700 CALL print_char
|
||
36:12246+6 16EF 23 INC HL
|
||
37:12252+4 16F0 0D DEC C ;Decrement column counter
|
||
38:12256+7+5 16F1 20F3 JR NZ, dump_pretty_col ;Loop if not 0
|
||
39: - 16F3 dump_pretty_ascii:
|
||
40:12263+11 16F3 C5 PUSH BC
|
||
41:12274+11 16F4 E5 PUSH HL
|
||
42:12285+7 16F5 0600 LD B,0
|
||
43:12292+7 16F7 0E10 LD C,16
|
||
44:12299+15 16F9 ED42 SBC HL,BC ;Reset HL by column count
|
||
45: - 16FB dump_pretty_ascii_loop:
|
||
46:12314+7 16FB 7E LD A,(HL)
|
||
47:12321+6 16FC 23 INC HL
|
||
48:12327+7 16FD FE20 CP 32
|
||
49:12334+10 16FF DA0C17 JP C, dump_pretty_ascii_none ;if less than 32, it is not a char
|
||
50:12344+7 1702 FE7F CP 127
|
||
51:12351+10 1704 D20C17 JP NC, dump_pretty_ascii_none ;if greater or equal than 128, it is not a char
|
||
52:12361+17 1707 CDD700 call print_char
|
||
53:12378+12 170A 1805 jr dump_pretty_ascii_cont
|
||
54: - 170C dump_pretty_ascii_none:
|
||
55:12390+7 170C 3E2E LD A,'.'
|
||
56:12397+17 170E CDD700 call print_char
|
||
57: - 1711 dump_pretty_ascii_cont:
|
||
58:12414+4 1711 0D DEC C
|
||
59:12418+10 1712 C2FB16 JP NZ, dump_pretty_ascii_loop
|
||
60:
|
||
61:
|
||
62:12428+10 1715 E1 POP HL
|
||
63:12438+10 1716 C1 POP BC
|
||
64: - 1717 dump_pretty_nextrow:
|
||
65:12448+7 1717 3E0A LD A,10 ;New line
|
||
66:12455+17 1719 CDD700 CALL print_char
|
||
67:12472+7 171C 3E0D LD A,13
|
||
68:12479+17 171E CDD700 CALL print_char
|
||
69:12496+12 1721 18AE JR dump_pretty_row ;Else next line
|
||
70: - 1723 dump_pretty_end:
|
||
71:12508+10 1723 C9 RET
|
||
72:
|
||
73: - 1724 STR_PD_HEADER:
|
||
74: - 1724 0D0A4241 db 13,10,'BASE 0 1 2 3 4 5 6 7 8 9 A B C D E F ASCII',13,10,0
|
||
53452030
|
||
20203120
|
||
20322020
|
||
33202034
|
||
20203520
|
||
20362020
|
||
37202038
|
||
20203920
|
||
20412020
|
||
42202043
|
||
20204420
|
||
20452020
|
||
46202041
|
||
53434949
|
||
0D0A00
|
||
75:
|
||
76:
|
||
77: ;------------------------------------------------------------------------------
|
||
78: ; print_str_fixed
|
||
79: ;
|
||
80: ; Prints string with fixed length
|
||
81: ; B contains length
|
||
82: ; HL contains start address
|
||
83: ;------------------------------------------------------------------------------
|
||
84: - 1763 print_str_fixed:
|
||
85:12518+7 1763 7E LD A,(HL)
|
||
86:12525+6 1764 23 INC HL
|
||
87:12531+17 1765 CDD700 CALL print_char
|
||
88:12548+8+5 1768 10F9 DJNZ print_str_fixed
|
||
89:12556+10 176A C9 RET
|
||
90:
|
||
**** main.asm ****
|
||
181: .include "command.s"
|
||
**** include/command.s ****
|
||
1: - 176B COMMAND_LUT:
|
||
2: - 176B 64617465 db "date", 0 , [OP_RTIME], [OP_RTIME]>>8 ;Read time
|
||
00901A
|
||
3: - 1772 73657464 db "setdate", 0 , [OP_STIME], [OP_STIME]>>8 ;Read time
|
||
61746500
|
||
281C
|
||
4: - 177C 70696E20 db "pin ", 0 , [OP_IO_IN], [OP_IO_IN]>>8 ;Read port
|
||
00A919
|
||
5: - 1783 64756D70 db "dump ",0, [OP_DUMP], [OP_DUMP]>>8 ;print pretty hexdump
|
||
20001819
|
||
6: - 178B 706F7574 db "pout ", 0 , [OP_IO_OUT], [OP_IO_OUT]>>8 ;Write port
|
||
2000BF19
|
||
7: - 1793 69696E20 db "iin ", 0, [OP_IIC_IN], [OP_IIC_IN]>>8 ;Read IIC
|
||
00401A
|
||
8: - 179A 696F7574 db "iout ", 0, [OP_IIC_OUT], [OP_IIC_OUT]>>8 ;Write IIC
|
||
2000E019
|
||
9: - 17A2 63616C6C db "call ", 0, [OP_CALL], [OP_CALL]>>8 ;Call to addr
|
||
2000F818
|
||
10: - 17AA 636C7200 db "clr", 0, [OP_CLR], [OP_CLR]>>8 ;Call to addr
|
||
8C1A
|
||
11: - 17B0 6461736D db "dasm ", 0, [OP_DASM], [OP_DASM]>>8 ;Call to addr
|
||
20007919
|
||
12: - 17B8 6A702000 db "jp ", 0,[OP_EXEC], [OP_EXEC]>>8 ;jump to addr
|
||
DF18
|
||
13: - 17BE 72737400 db "rst", 0,0x00,0x00 ;soft reset
|
||
0000
|
||
14: - 17C4 6C736473 db "lsdsk", 0,[OP_LSDSK], [OP_LSDSK]>>8 ;list disks
|
||
6B00A11C
|
||
15: - 17CC 73656C64 db "seldsk ", 0,[OP_SELDSK], [OP_SELDSK]>>8 ;select disk
|
||
736B2000
|
||
A51C
|
||
16: - 17D6 2400DF18 db "$", 0, [OP_EXEC], [OP_EXEC]>>8 ;jump to addr
|
||
17: - 17DA 6900A919 db "i", 0, [OP_IO_IN], [OP_IO_IN]>>8 ;Read port
|
||
18: - 17DE 6F00BF19 db "o", 0, [OP_IO_OUT], [OP_IO_OUT]>>8 ;Write port
|
||
19: - 17E2 21004819 db "!", 0, [OP_SET], [OP_SET]>>8 ;Write memory
|
||
20: - 17E6 3F001819 db "?", 0, [OP_DUMP], [OP_DUMP]>>8 ;Print memory
|
||
21: - 17EA FF db 0xFF ;End of Table
|
||
22:
|
||
23: - 402B IN_BUFFER .equ var_buffer
|
||
24:
|
||
25: - 17EB COMMAND:
|
||
26:12566+17 17EB CDF100 call print_newLine
|
||
27:12583+7 17EE 3E3E ld a,'>'
|
||
28:12590+17 17F0 CDD700 call print_char
|
||
29:12607+4 17F3 AF xor a ;reset buffer len
|
||
30:12611+13 17F4 320040 ld (var_buffer_len),a
|
||
31: - 17F7 COMMAND_READ:
|
||
32:12624+17 17F7 CD1F01 call read_char
|
||
33:12641+10 17FA CAF717 jp z, COMMAND_READ ;wait for input
|
||
34:12651+7 17FD FE0D cp 13 ; enter
|
||
35:12658+10 17FF CA4C18 jp z,COMMAND_PROCESS
|
||
36:12668+7 1802 FE0A cp 10
|
||
37:12675+10 1804 CAF717 jp z, COMMAND_READ; skip LF for file load
|
||
38:12685+7 1807 FE08 cp 0x08 ; backspace 0x08 VT102 0x7f Putty
|
||
39:12692+10 1809 CA2618 jp z,COMMAND_BACKSPACE
|
||
40:
|
||
41:12702+11 180C F5 push af
|
||
42: ; a contains latest char
|
||
43:12713+10 180D 212B40 ld hl,[var_buffer]
|
||
44:12723+7 1810 1600 ld d,0
|
||
45:12730+13 1812 3A0040 ld a,(var_buffer_len)
|
||
46:12743+4 1815 5F ld e,a
|
||
47:12747+11 1816 19 add hl,de ;hl now contains pointer to last position in buffer
|
||
48:12758+4 1817 3C inc a
|
||
49:12762+13 1818 320040 ld (var_buffer_len),a ;store incremented buffer length
|
||
50:
|
||
51:12775+10 181B F1 pop af
|
||
52:12785+7 181C 77 ld (hl),a
|
||
53:12792+17 181D CDD700 call print_char
|
||
54:12809+6 1820 23 inc hl
|
||
55:12815+4 1821 AF xor a ;a = 0
|
||
56:12819+7 1822 77 ld (hl),a ;always add null termination after last char
|
||
57:12826+10 1823 C3F717 jp COMMAND_READ
|
||
58:
|
||
59:
|
||
60: - 1826 COMMAND_BACKSPACE:
|
||
61:12836+13 1826 3A0040 ld a,(var_buffer_len)
|
||
62:12849+4 1829 A7 and a
|
||
63:12853+10 182A CAF717 jp z, COMMAND_READ ; do not continue if already at char 0
|
||
64:12863+4 182D 3D dec a ;decrement length
|
||
65:12867+13 182E 320040 ld (var_buffer_len),a ;and store it
|
||
66:12880+4 1831 5F ld e,a ;load de with decremented value
|
||
67:12884+7 1832 1600 ld d,0
|
||
68:12891+10 1834 212B40 ld hl,[var_buffer]
|
||
69:12901+11 1837 19 add hl,de ;hl now contains pointer to last position in buffer
|
||
70:12912+4 1838 AF xor a ; store null byte to current location
|
||
71:12916+7 1839 77 ld (hl),a
|
||
72: ;call print_delete
|
||
73:12923+7 183A 3E08 ld a, 0x08
|
||
74:12930+17 183C CDD700 call print_char
|
||
75:12947+7 183F 3E20 ld a, 0x20
|
||
76:12954+17 1841 CDD700 call print_char
|
||
77:12971+7 1844 3E08 ld a, 0x08
|
||
78:12978+17 1846 CDD700 call print_char
|
||
79:12995+10 1849 C3F717 jp COMMAND_READ
|
||
80: - 184C COMMAND_PROCESS:
|
||
81: ;compare
|
||
82:13005+10 184C 216B17 LD HL,[COMMAND_LUT] ;Lookup table
|
||
83: - 184F COMMAND_PROCESS_LOOP:
|
||
84:13015+10 184F 112B40 LD DE,[var_buffer] ;Buffer
|
||
85:13025+7 1852 7E LD A,(HL) ;Load first byte of entry
|
||
86:13032+7 1853 FEFF CP 0xFF
|
||
87:13039+10 1855 CA7E18 JP Z,COMMAND_PROCESS_NOT_FOUND ;if first byte is 0xFF, End is reached
|
||
88: ; compare string loop
|
||
89: - 1858 COMMAND_PROCESS_LOOP_STR1:
|
||
90:13049+7 1858 1A LD A,(DE)
|
||
91:13056+4 1859 47 LD B,A
|
||
92:13060+7 185A 7E LD A,(HL)
|
||
93:13067+4 185B B0 OR B ;not 0 -> match
|
||
94:13071+10 185C CA8718 JP Z, COMMAND_PROCESS_FOUND ;match
|
||
95:
|
||
96:13081+7 185F 1A LD A,(DE)
|
||
97:13088+4 1860 47 LD B,A
|
||
98: ;LD A,(HL) ;Load first byte of entry
|
||
99: ;call print_a_hex
|
||
100:13092+7 1861 7E LD A,(HL)
|
||
101: ;compare byte
|
||
102:13099+4 1862 A8 XOR B
|
||
103:13103+4 1863 B7 OR A ;if identical = resoult shopuld be zero
|
||
104:13107+10 1864 CA6E18 JP Z, COMMAND_PROCESS_LOOP_STR2 ;then continue
|
||
105: ; if not identical
|
||
106:13117+7 1867 7E LD A,(HL)
|
||
107:13124+4 1868 B7 OR A ;if reached end of compare string
|
||
108:13128+10 1869 CA8718 JP Z, COMMAND_PROCESS_FOUND ;match
|
||
109:13138+12 186C 1805 JR COMMAND_PROCESS_NEXT_ENTRY ;next entry on no match
|
||
110:
|
||
111: - 186E COMMAND_PROCESS_LOOP_STR2: ;continue with next char
|
||
112:13150+6 186E 23 INC HL
|
||
113:13156+6 186F 13 INC DE
|
||
114:13162+12 1870 18E6 JR COMMAND_PROCESS_LOOP_STR1
|
||
115:
|
||
116: - 1872 COMMAND_PROCESS_NEXT_ENTRYI: ;do not jump here
|
||
117:13174+6 1872 23 INC HL
|
||
118: - 1873 COMMAND_PROCESS_NEXT_ENTRY: ;jump here
|
||
119:13180+7 1873 7E LD A,(HL)
|
||
120:13187+4 1874 B7 OR A
|
||
121:13191+10 1875 C27218 JP NZ,COMMAND_PROCESS_NEXT_ENTRYI ;loop until end of string
|
||
122:13201+6 1878 23 INC HL ;skip pointer
|
||
123:13207+6 1879 23 INC HL
|
||
124:13213+6 187A 23 INC HL
|
||
125:13219+10 187B C34F18 JP COMMAND_PROCESS_LOOP
|
||
126: - 187E COMMAND_PROCESS_NOT_FOUND:
|
||
127:13229+10 187E 21B818 LD HL,[_STR_NOT_FOUND]
|
||
128:13239+17 1881 CDDF00 CALL print_str
|
||
129:13256+10 1884 C3EB17 JP COMMAND
|
||
130:
|
||
131: - 1887 COMMAND_PROCESS_FOUND:
|
||
132:13266+11 1887 E5 PUSH HL
|
||
133:13277+10 1888 C1 POP BC
|
||
134:13287+6 1889 03 INC BC
|
||
135:13293+7 188A 0A LD A,(BC)
|
||
136:13300+4 188B 6F LD L,A
|
||
137:13304+6 188C 03 INC BC
|
||
138:13310+7 188D 0A LD A,(BC)
|
||
139:13317+4 188E 67 LD H,A
|
||
140:
|
||
141: ;HL: pointer to start of routine
|
||
142: ;DE: buffer start of arguments
|
||
143:13321+17 188F CD9518 CALL _COMMAND_PROCESS_FOUND
|
||
144:13338+10 1892 C3EB17 JP COMMAND
|
||
145: - 1895 _COMMAND_PROCESS_FOUND
|
||
146:13348+4 1895 E9 JP (HL)
|
||
147:
|
||
148: - 1896 NOT_IMPLEMENTED:
|
||
149:13352+10 1896 21A418 LD HL,[_STR_NOT_IMPLEMENTED]
|
||
150:13362+17 1899 CDDF00 CALL print_str
|
||
151:13379+10 189C C9 RET
|
||
152:
|
||
153: - 189D ERR_SYNTAX:
|
||
154:13389+10 189D 21CC18 LD HL,[_STR_SYNTAX]
|
||
155:13399+17 18A0 CDDF00 CALL print_str
|
||
156:13416+10 18A3 C9 RET
|
||
157:
|
||
158: - 18A4 _STR_NOT_IMPLEMENTED:
|
||
159: - 18A4 0A0D6E6F db 10,13,"not implemented",10,13,0
|
||
7420696D
|
||
706C656D
|
||
656E7465
|
||
640A0D00
|
||
160:
|
||
161: - 18B8 _STR_NOT_FOUND:
|
||
162: - 18B8 0A0D696E db 10,13,"invalid command",10,13,0
|
||
76616C69
|
||
6420636F
|
||
6D6D616E
|
||
640A0D00
|
||
163:
|
||
164: - 18CC _STR_SYNTAX:
|
||
**** main.asm ****
|
||
182: - 18CC 0A0D696E db 10,13,"invalid syntax",10,13,0
|
||
76616C69
|
||
64207379
|
||
6E746178
|
||
0A0D00
|
||
183: .include "cmd_mem.s"
|
||
**** include/cmd_mem.s ****
|
||
1: - 18DF OP_EXEC:
|
||
2: ;DE contains pointer
|
||
3:13426+11 18DF D5 push DE
|
||
4:13437+10 18E0 E1 pop HL
|
||
5:13447+17 18E1 CD6401 call DHEX_TO_BYTE
|
||
6:13464+4 18E4 47 ld b,a ;store result in b
|
||
7:13468+4 18E5 7B ld a,e ;check for error
|
||
8:13472+4 18E6 A7 and a
|
||
9:13476+10 18E7 C29D18 jp nz, ERR_SYNTAX
|
||
10:13486+6 18EA 23 inc HL
|
||
11:13492+6 18EB 23 inc HL
|
||
12:13498+17 18EC CD6401 call DHEX_TO_BYTE
|
||
13:13515+4 18EF 4F ld c,a
|
||
14:13519+4 18F0 7B ld a,e ;check for error
|
||
15:13523+4 18F1 A7 and a
|
||
16:13527+10 18F2 C29D18 jp nz, ERR_SYNTAX
|
||
17:13537+4 18F5 60 ld h,b
|
||
18:13541+4 18F6 69 ld l,c
|
||
19:13545+4 18F7 E9 jp (hl)
|
||
20: - 18F8 OP_CALL:
|
||
21: ;DE contains pointer
|
||
22:13549+11 18F8 D5 push DE
|
||
23:13560+10 18F9 E1 pop HL
|
||
24:13570+17 18FA CD6401 call DHEX_TO_BYTE
|
||
25:13587+4 18FD 47 ld b,a ;store result in b
|
||
26:13591+4 18FE 7B ld a,e ;check for error
|
||
27:13595+4 18FF A7 and a
|
||
28:13599+10 1900 C29D18 jp nz, ERR_SYNTAX
|
||
29:13609+6 1903 23 inc HL
|
||
30:13615+6 1904 23 inc HL
|
||
31:13621+17 1905 CD6401 call DHEX_TO_BYTE
|
||
32:13638+4 1908 4F ld c,a
|
||
33:13642+4 1909 7B ld a,e ;check for error
|
||
34:13646+4 190A A7 and a
|
||
35:13650+10 190B C29D18 jp nz, ERR_SYNTAX
|
||
36:13660+4 190E 60 ld h,b
|
||
37:13664+4 190F 69 ld l,c
|
||
38:13668+17 1910 CD1719 call _OP_CALL
|
||
39:13685+17 1913 CDF100 call print_newLine
|
||
40:13702+10 1916 C9 ret
|
||
41: - 1917 _OP_CALL
|
||
42:13712+4 1917 E9 jp (hl)
|
||
43:
|
||
44: - 1918 OP_DUMP:
|
||
45: ;DE contains pointer
|
||
46:13716+11 1918 D5 push DE
|
||
47:13727+10 1919 E1 pop HL
|
||
48:13737+17 191A CD6401 call DHEX_TO_BYTE ;parse start address
|
||
49:13754+4 191D 47 ld b,a ;store result in b
|
||
50:13758+4 191E 7B ld a,e ;check for error
|
||
51:13762+4 191F A7 and a
|
||
52:13766+10 1920 C29D18 jp nz, ERR_SYNTAX
|
||
53:13776+6 1923 23 inc HL
|
||
54:13782+6 1924 23 inc HL
|
||
55:13788+17 1925 CD6401 call DHEX_TO_BYTE
|
||
56:13805+4 1928 4F ld c,a
|
||
57:13809+4 1929 7B ld a,e ;check for error
|
||
58:13813+4 192A A7 and a
|
||
59:13817+10 192B C29D18 jp nz, ERR_SYNTAX
|
||
60:13827+6 192E 23 inc HL
|
||
61:13833+6 192F 23 inc HL
|
||
62:13839+7 1930 7E ld a,(HL)
|
||
63:13846+7 1931 FE20 cp ' '
|
||
64:13853+10 1933 C29D18 jp nz, ERR_SYNTAX
|
||
65:13863+6 1936 23 inc HL
|
||
66:13869+17 1937 CD6401 call DHEX_TO_BYTE
|
||
67:13886+11 193A F5 push af
|
||
68:13897+4 193B 7B ld a,e ;check for error
|
||
69:13901+4 193C A7 and a
|
||
70:13905+10 193D C29D18 jp nz, ERR_SYNTAX
|
||
71:13915+10 1940 F1 pop af
|
||
72:
|
||
73:13925+4 1941 60 ld h,b
|
||
74:13929+4 1942 69 ld l,c
|
||
75:13933+4 1943 47 ld b,a
|
||
76:
|
||
77:13937+17 1944 CDC916 call dump_pretty
|
||
78:13954+10 1947 C9 ret
|
||
79:
|
||
80: - 1948 OP_SET:
|
||
81: ;DE contains pointer
|
||
82:13964+11 1948 D5 push DE
|
||
83:13975+10 1949 E1 pop HL
|
||
84:13985+17 194A CD6401 call DHEX_TO_BYTE ;parse start address
|
||
85:14002+4 194D 47 ld b,a ;store result in b
|
||
86:14006+4 194E 7B ld a,e ;check for error
|
||
87:14010+4 194F A7 and a
|
||
88:14014+10 1950 C29D18 jp nz, ERR_SYNTAX
|
||
89:14024+6 1953 23 inc HL
|
||
90:14030+6 1954 23 inc HL
|
||
91:14036+17 1955 CD6401 call DHEX_TO_BYTE
|
||
92:14053+4 1958 4F ld c,a
|
||
93:14057+4 1959 7B ld a,e ;check for error
|
||
94:14061+4 195A A7 and a
|
||
95:14065+10 195B C29D18 jp nz, ERR_SYNTAX
|
||
96: ;bc now contains the start address
|
||
97:14075+6 195E 23 INC HL
|
||
98:14081+6 195F 23 INC HL
|
||
99: ;hl now cointains start addr of data bytes
|
||
100: - 1960 _OP_SET_LOOP:
|
||
101:14087+7 1960 7E ld a,(hl)
|
||
102:14094+7 1961 FE00 cp 0 ;if 0 then end
|
||
103:14101+5+6 1963 C8 RET Z
|
||
104:14106+7 1964 FE20 cp ' '
|
||
105:14113+10 1966 C29D18 jp nz, ERR_SYNTAX
|
||
106:14123+6 1969 23 inc hl ;next byte
|
||
107:14129+17 196A CD6401 call DHEX_TO_BYTE
|
||
108:14146+7 196D 02 ld (bc),a ;load byte to
|
||
109:14153+4 196E 7B ld a,e
|
||
110:14157+4 196F A7 and a
|
||
111:14161+10 1970 C29D18 jp nz, ERR_SYNTAX
|
||
112:14171+6 1973 03 inc bc
|
||
113:14177+6 1974 23 inc hl
|
||
114:14183+6 1975 23 inc hl
|
||
115:14189+10 1976 C36019 jp _OP_SET_LOOP
|
||
116:
|
||
117: - 1979 OP_DASM:
|
||
118:14199+11 1979 D5 push DE
|
||
119:14210+10 197A E1 pop HL
|
||
120:14220+17 197B CD6401 call DHEX_TO_BYTE
|
||
121:14237+4 197E 47 ld b,a ;store result in b
|
||
122:14241+4 197F 7B ld a,e ;check for error
|
||
123:14245+4 1980 A7 and a
|
||
124:14249+10 1981 C29D18 jp nz, ERR_SYNTAX
|
||
125:14259+6 1984 23 inc hl
|
||
126:14265+6 1985 23 inc hl
|
||
127:14271+17 1986 CD6401 call DHEX_TO_BYTE
|
||
128:14288+4 1989 4F ld c,a
|
||
129:14292+4 198A 7B ld a,e ;check for error
|
||
130:14296+4 198B A7 and a
|
||
131:14300+10 198C C29D18 jp nz, ERR_SYNTAX
|
||
132:14310+6 198F 23 inc hl
|
||
133:14316+6 1990 23 inc hl
|
||
134:14322+7 1991 7E ld a,(HL)
|
||
135:14329+7 1992 FE20 cp ' '
|
||
136:14336+10 1994 C29D18 jp nz, ERR_SYNTAX
|
||
137:14346+6 1997 23 inc hl
|
||
138:14352+17 1998 CD6401 call DHEX_TO_BYTE
|
||
139:14369+11 199B F5 push af
|
||
140:14380+4 199C 7B ld a,e ;check for error
|
||
141:14384+4 199D A7 and a
|
||
142:14388+10 199E C29D18 jp nz, ERR_SYNTAX
|
||
143:14398+4 19A1 60 ld h,b
|
||
144:14402+4 19A2 69 ld l,c
|
||
145:14406+10 19A3 F1 pop af ;restore af
|
||
146:14416+4 19A4 47 ld b,a
|
||
147:14420+17 19A5 CDB501 call disassemble
|
||
**** main.asm ****
|
||
184:14437+10 19A8 C9 ret
|
||
185: .include "cmd_io.s"
|
||
**** include/cmd_io.s ****
|
||
1: - 19A9 OP_IO_IN:
|
||
2:14447+11 19A9 D5 push DE
|
||
3:14458+10 19AA E1 pop HL
|
||
4:14468+17 19AB CD6401 call DHEX_TO_BYTE
|
||
5:14485+4 19AE 4F ld c,a ;store result in b
|
||
6:14489+4 19AF 7B ld a,e ;check for error
|
||
7:14493+4 19B0 A7 and a
|
||
8:14497+10 19B1 C29D18 jp nz, ERR_SYNTAX
|
||
9:14507+12 19B4 ED78 in a,(c)
|
||
10:14519+11 19B6 F5 push af
|
||
11:14530+17 19B7 CDF100 call print_newLine
|
||
12:14547+10 19BA F1 pop af
|
||
13:14557+17 19BB CD0701 call print_a_hex
|
||
14:14574+10 19BE C9 ret
|
||
15:
|
||
16: - 19BF OP_IO_OUT:
|
||
17:14584+11 19BF D5 push DE
|
||
18:14595+10 19C0 E1 pop HL
|
||
19:14605+17 19C1 CD6401 call DHEX_TO_BYTE
|
||
20:14622+4 19C4 4F ld c,a ;store result in b
|
||
21:14626+4 19C5 7B ld a,e ;check for error
|
||
22:14630+4 19C6 A7 and a
|
||
23:14634+10 19C7 C29D18 jp nz, ERR_SYNTAX
|
||
24:14644+6 19CA 23 inc hl
|
||
25:14650+6 19CB 23 inc hl
|
||
26:14656+7 19CC 7E ld a,(hl)
|
||
27:14663+7 19CD FE20 cp ' '
|
||
28:14670+10 19CF C29D18 jp nz, ERR_SYNTAX
|
||
29:14680+6 19D2 23 inc hl
|
||
30:14686+17 19D3 CD6401 call DHEX_TO_BYTE
|
||
31:14703+11 19D6 F5 push af
|
||
32:14714+4 19D7 7B ld a,e ;check for error
|
||
33:14718+4 19D8 A7 and a
|
||
34:14722+10 19D9 C29D18 jp nz, ERR_SYNTAX
|
||
35:14732+10 19DC F1 pop af
|
||
36:14742+12 19DD ED79 out (c),a
|
||
37:14754+10 19DF C9 ret
|
||
38:
|
||
39: - 19E0 OP_IIC_OUT:
|
||
40:14764+11 19E0 D5 push DE
|
||
41:14775+10 19E1 E1 pop HL
|
||
42:14785+17 19E2 CD6401 call DHEX_TO_BYTE ;load start addr
|
||
43:14802+13 19E5 320C40 ld (var_scratch+1),A ;store result in ram
|
||
44:14815+4 19E8 7B ld a,e ;check for error
|
||
45:14819+4 19E9 A7 and a
|
||
46:14823+10 19EA C29D18 jp nz, ERR_SYNTAX
|
||
47:14833+6 19ED 23 inc hl
|
||
48:14839+6 19EE 23 inc hl
|
||
49:14845+10 19EF 010D40 LD BC,[var_scratch + 2]
|
||
50:14855+4 19F2 AF XOR A
|
||
51:14859+13 19F3 320B40 LD (var_scratch),A
|
||
52: - 19F6 _OP_IIC_OUT_LOOP:
|
||
53:14872+7 19F6 7E ld a,(hl)
|
||
54:14879+7 19F7 FE00 cp 0 ;if 0 then end
|
||
55:14886+10 19F9 CA121A jp z,_OP_IIC_OUT_SEND
|
||
56:14896+7 19FC FE20 cp ' '
|
||
57:14903+10 19FE C29D18 jp nz, ERR_SYNTAX
|
||
58:14913+6 1A01 23 inc hl ;next byte
|
||
59:
|
||
60:14919+17 1A02 CD6401 call DHEX_TO_BYTE
|
||
61:14936+7 1A05 02 ld (bc),a
|
||
62:14943+6 1A06 03 inc bc ;incerement pointer
|
||
63:14949+13 1A07 3A0B40 ld a,(var_scratch)
|
||
64:14962+4 1A0A 3C inc a ;increment counter
|
||
65:14966+13 1A0B 320B40 ld (var_scratch),a
|
||
66:14979+6 1A0E 23 inc HL
|
||
67:14985+6 1A0F 23 inc HL
|
||
68:14991+12 1A10 18E4 jr _OP_IIC_OUT_LOOP
|
||
69: - 1A12 _OP_IIC_OUT_SEND:
|
||
70:15003+10 1A12 210D40 ld hl,[var_scratch + 2]
|
||
71:15013+13 1A15 3A0B40 ld a,(var_scratch) ;load amount of bytes
|
||
72:15026+4 1A18 47 ld b,a
|
||
73:15030+13 1A19 3A0C40 ld a,(var_scratch+1) ;load start addr
|
||
74:15043+4 1A1C 4F ld c,a
|
||
75:15047+17 1A1D CD8415 call iic_send_buffer
|
||
76:15064+4 1A20 B7 or a
|
||
77:15068+10 1A21 C2251A jp nz, _OP_IIC_ACK_ERR
|
||
78:15078+10 1A24 C9 ret
|
||
79:
|
||
80: - 1A25 _OP_IIC_ACK_ERR:
|
||
81:15088+10 1A25 212C1A LD HL,[_OP_IIC_ACK_ERR_str]
|
||
82:15098+17 1A28 CDDF00 call print_str
|
||
83:15115+10 1A2B C9 ret
|
||
84: - 1A2C _OP_IIC_ACK_ERR_str:
|
||
85: - 1A2C 0A0D6275 db 10,13,"bus-error: no ACK",0
|
||
732D6572
|
||
726F723A
|
||
206E6F20
|
||
41434B00
|
||
86:
|
||
87: - 1A40 OP_IIC_IN:
|
||
88:15125+11 1A40 D5 push DE
|
||
89:15136+10 1A41 E1 pop HL
|
||
90:15146+17 1A42 CD6401 call DHEX_TO_BYTE ;load start addr
|
||
91:15163+4 1A45 4F ld C,a ;store start addr to B
|
||
92:15167+4 1A46 7B ld a,e ;check for error
|
||
93:15171+4 1A47 A7 and a
|
||
94:15175+10 1A48 C29D18 jp nz, ERR_SYNTAX
|
||
95:15185+6 1A4B 23 inc hl
|
||
96:15191+6 1A4C 23 inc hl
|
||
97:15197+7 1A4D 7E ld a,(hl)
|
||
98:15204+7 1A4E FE20 cp ' '
|
||
99:15211+10 1A50 C29D18 jp nz, ERR_SYNTAX
|
||
100:15221+6 1A53 23 inc hl
|
||
101:15227+17 1A54 CD6401 call DHEX_TO_BYTE ;read length
|
||
102:15244+4 1A57 47 ld b,a ;store length in B
|
||
103:15248+11 1A58 C5 push bc
|
||
104:15259+4 1A59 7B ld a,e ;check for error
|
||
105:15263+4 1A5A A7 and a
|
||
106:15267+10 1A5B C29D18 jp nz, ERR_SYNTAX
|
||
107:15277+10 1A5E 210B40 ld hl,[var_scratch]
|
||
108:15287+17 1A61 CDAE15 call iic_receive_buffer
|
||
109:15304+10 1A64 C1 pop bc
|
||
110:15314+4 1A65 B7 or a
|
||
111:15318+10 1A66 C2251A jp nz, _OP_IIC_ACK_ERR
|
||
112:15328+10 1A69 217F1A ld hl,[_OP_IIC_IN_LOOP_TEXT]
|
||
113:15338+17 1A6C CDDF00 call print_str
|
||
114:15355+10 1A6F 210B40 ld hl,[var_scratch]
|
||
115: ;print data
|
||
116: - 1A72 _OP_IIC_IN_LOOP:
|
||
117:15365+7 1A72 7E ld a,(hl)
|
||
118:15372+17 1A73 CD0701 call print_a_hex
|
||
119:15389+7 1A76 3E20 ld a, ' '
|
||
120:15396+17 1A78 CDD700 call print_char
|
||
121:15413+6 1A7B 23 inc hl
|
||
122:15419+8+5 1A7C 10F4 djnz _OP_IIC_IN_LOOP
|
||
123:15427+10 1A7E C9 ret
|
||
124:
|
||
125: - 1A7F _OP_IIC_IN_LOOP_TEXT:
|
||
126: - 1A7F 0A0D7265 db 10,13,"rec-buff: ",0
|
||
632D6275
|
||
66663A20
|
||
00
|
||
127:
|
||
128: - 1A8C OP_CLR:
|
||
129:15437+17 1A8C CDEA00 call print_clear
|
||
**** main.asm ****
|
||
186:15454+10 1A8F C9 ret
|
||
187: .include "cmd_date.s"
|
||
**** include/cmd_date.s ****
|
||
1: - 00D0 ADDR_RTC .equ 0xD0
|
||
2:
|
||
3: - 1A90 OP_RTIME:
|
||
4:15464+17 1A90 CDF100 call print_newLine
|
||
5: - 1A93 _OP_RTIME_NN:
|
||
6: ;set pointer
|
||
7:15481+10 1A93 214B1B ld hl,[_OP_RTIME_RD_CMD]
|
||
8:15491+7 1A96 0601 ld b, 1
|
||
9:15498+7 1A98 0ED0 ld c, ADDR_RTC
|
||
10:15505+17 1A9A CD8415 call iic_send_buffer
|
||
11:15522+4 1A9D B7 or a
|
||
12:15526+10 1A9E C2251A jp nz, _OP_IIC_ACK_ERR
|
||
13: ;read RTC data
|
||
14:15536+10 1AA1 210B40 ld hl,[var_scratch]
|
||
15:15546+7 1AA4 0608 ld b,8
|
||
16:15553+7 1AA6 0ED0 ld c, ADDR_RTC
|
||
17:15560+17 1AA8 CDAE15 call iic_receive_buffer
|
||
18:15577+4 1AAB B7 or a
|
||
19:15581+10 1AAC C2251A jp nz, _OP_IIC_ACK_ERR
|
||
20: ;process display hours
|
||
21:15591+13 1AAF 3A0D40 ld a,(var_scratch+2)
|
||
22:15604+7 1AB2 E630 and 00110000b
|
||
23:15611+4 1AB4 1F RRA
|
||
24:15615+4 1AB5 1F RRA
|
||
25:15619+4 1AB6 1F RRA
|
||
26:15623+4 1AB7 1F RRA
|
||
27:15627+17 1AB8 CD1901 call print_bcd
|
||
28:15644+13 1ABB 3A0D40 ld a,(var_scratch+2)
|
||
29:15657+7 1ABE E60F and 00001111b
|
||
30:15664+17 1AC0 CD1901 call print_bcd
|
||
31:15681+7 1AC3 3E3A ld a,':'
|
||
32:15688+17 1AC5 CDD700 call print_char
|
||
33: ;display minutes
|
||
34:15705+13 1AC8 3A0C40 ld a,(var_scratch+1)
|
||
35:15718+7 1ACB E670 and 01110000b
|
||
36:15725+4 1ACD 1F RRA
|
||
37:15729+4 1ACE 1F RRA
|
||
38:15733+4 1ACF 1F RRA
|
||
39:15737+4 1AD0 1F RRA
|
||
40:15741+17 1AD1 CD1901 call print_bcd
|
||
41:15758+13 1AD4 3A0C40 ld a,(var_scratch+1)
|
||
42:15771+7 1AD7 E60F and 00001111b
|
||
43:15778+17 1AD9 CD1901 call print_bcd
|
||
44:15795+7 1ADC 3E3A ld a,':'
|
||
45:15802+17 1ADE CDD700 call print_char
|
||
46: ;display seconds
|
||
47:15819+13 1AE1 3A0B40 ld a,(var_scratch+0)
|
||
48:15832+7 1AE4 E670 and 01110000b
|
||
49:15839+4 1AE6 1F RRA
|
||
50:15843+4 1AE7 1F RRA
|
||
51:15847+4 1AE8 1F RRA
|
||
52:15851+4 1AE9 1F RRA
|
||
53:15855+17 1AEA CD1901 call print_bcd
|
||
54:15872+13 1AED 3A0B40 ld a,(var_scratch+0)
|
||
55:15885+7 1AF0 E60F and 00001111b
|
||
56:15892+17 1AF2 CD1901 call print_bcd
|
||
57:15909+7 1AF5 3E20 ld a,' '
|
||
58:15916+17 1AF7 CDD700 call print_char
|
||
59: ;display date
|
||
60:15933+13 1AFA 3A0F40 ld a,(var_scratch+4)
|
||
61:15946+7 1AFD E630 and 00110000b
|
||
62:15953+4 1AFF 1F RRA
|
||
63:15957+4 1B00 1F RRA
|
||
64:15961+4 1B01 1F RRA
|
||
65:15965+4 1B02 1F RRA
|
||
66:15969+17 1B03 CD1901 call print_bcd
|
||
67:15986+13 1B06 3A0F40 ld a,(var_scratch+4)
|
||
68:15999+7 1B09 E60F and 00001111b
|
||
69:16006+17 1B0B CD1901 call print_bcd
|
||
70:16023+7 1B0E 3E2E ld a,'.'
|
||
71:16030+17 1B10 CDD700 call print_char
|
||
72:16047+13 1B13 3A1040 ld a,(var_scratch+5)
|
||
73:16060+7 1B16 E610 and 00010000b
|
||
74:16067+4 1B18 1F RRA
|
||
75:16071+4 1B19 1F RRA
|
||
76:16075+4 1B1A 1F RRA
|
||
77:16079+4 1B1B 1F RRA
|
||
78:16083+17 1B1C CD1901 call print_bcd
|
||
79:16100+13 1B1F 3A1040 ld a,(var_scratch+5)
|
||
80:16113+7 1B22 E60F and 00001111b
|
||
81:16120+17 1B24 CD1901 call print_bcd
|
||
82:16137+7 1B27 3E2E ld a,'.'
|
||
83:16144+17 1B29 CDD700 call print_char
|
||
84:16161+7 1B2C 3E32 ld a,'2'
|
||
85:16168+17 1B2E CDD700 call print_char
|
||
86:16185+7 1B31 3E30 ld a,'0'
|
||
87:16192+17 1B33 CDD700 call print_char
|
||
88:16209+13 1B36 3A1140 ld a,(var_scratch+6)
|
||
89:16222+7 1B39 E6F0 and 11110000b
|
||
90:16229+4 1B3B 1F RRA
|
||
91:16233+4 1B3C 1F RRA
|
||
92:16237+4 1B3D 1F RRA
|
||
93:16241+4 1B3E 1F RRA
|
||
94:16245+17 1B3F CD1901 call print_bcd
|
||
95:16262+13 1B42 3A1140 ld a,(var_scratch+6)
|
||
96:16275+7 1B45 E60F and 00001111b
|
||
97:16282+17 1B47 CD1901 call print_bcd
|
||
98:
|
||
99:16299+10 1B4A C9 RET
|
||
100: - 1B4B _OP_RTIME_RD_CMD:
|
||
101: - 1B4B 00 db 0x00
|
||
102:
|
||
103: - 1B4C 0A0D456E _OP_STIME_STR_DAY: db 10,13,"Enter Date (00-31) : ",0
|
||
74657220
|
||
44617465
|
||
20202020
|
||
2830302D
|
||
33312920
|
||
3A2000
|
||
104: - 1B67 0A0D456E _OP_STIME_STR_MON: db 10,13,"Enter Month (00-12) : ",0
|
||
74657220
|
||
4D6F6E74
|
||
68202020
|
||
2830302D
|
||
31322920
|
||
3A2000
|
||
105: - 1B82 0A0D456E _OP_STIME_STR_YEAR: db 10,13,"Enter Year (00-99) : ",0
|
||
74657220
|
||
59656172
|
||
20202020
|
||
2830302D
|
||
39392920
|
||
3A2000
|
||
106: - 1B9D 0A0D456E _OP_STIME_STR_HOUR: db 10,13,"Enter Hours (00-23) : ",0
|
||
74657220
|
||
486F7572
|
||
73202020
|
||
2830302D
|
||
32332920
|
||
3A2000
|
||
107: - 1BB8 0A0D456E _OP_STIME_STR_MIN: db 10,13,"Enter Minutes (00-59) : ",0
|
||
74657220
|
||
4D696E75
|
||
74657320
|
||
2830302D
|
||
35392920
|
||
3A2000
|
||
108: - 1BD3 0A0D456E _OP_STIME_STR_SEC: db 10,13,"Enter Seconds (00-59) : ",0
|
||
74657220
|
||
5365636F
|
||
6E647320
|
||
2830302D
|
||
35392920
|
||
3A2000
|
||
109: - 1BEE 20696E76 _OP_STIME_INVALID: db " invaild input. Retry!",0
|
||
61696C64
|
||
20696E70
|
||
75742E20
|
||
52657472
|
||
792100
|
||
110: ;HL contains pointer to stack
|
||
111: ;BC returns value (BCD)
|
||
112: - 1C05 _OP_STIME_PROMPT:
|
||
113:16309+11 1C05 E5 push hl
|
||
114:16320+17 1C06 CDDF00 call print_str
|
||
115:16337+10 1C09 E1 pop hl
|
||
116:16347+17 1C0A CD3101 call read_bcd
|
||
117:16364+7 1C0D FEFF cp 0xFF ;if failed
|
||
118:16371+10 1C0F CA1D1C jp Z, _OP_STIME_PROMPT_ERR
|
||
119:16381+4 1C12 47 ld b,a
|
||
120:16385+17 1C13 CD3101 call read_bcd
|
||
121:16402+7 1C16 FEFF cp 0xFF ;if failed
|
||
122:16409+10 1C18 CA1D1C jp Z, _OP_STIME_PROMPT_ERR
|
||
123:16419+4 1C1B 4F ld c,a
|
||
124:16423+10 1C1C C9 ret
|
||
125: - 1C1D _OP_STIME_PROMPT_ERR:
|
||
126:16433+11 1C1D E5 push HL
|
||
127:16444+10 1C1E 21EE1B ld hl, [_OP_STIME_INVALID]
|
||
128:16454+17 1C21 CDDF00 call print_str
|
||
129:16471+10 1C24 E1 pop hl
|
||
130:16481+10 1C25 C3051C jp _OP_STIME_PROMPT
|
||
131:
|
||
132:
|
||
133:
|
||
134: - 1C28 OP_STIME:
|
||
135:16491+4 1C28 AF xor a
|
||
136:16495+13 1C29 320B40 ld (var_scratch),a ;set pointer
|
||
137: ;date
|
||
138:16508+10 1C2C 214C1B ld hl, [_OP_STIME_STR_DAY]
|
||
139:16518+17 1C2F CD051C call _OP_STIME_PROMPT
|
||
140:16535+4 1C32 78 ld a,b
|
||
141:16539+17 1C33 CD9C1C call _shift4
|
||
142:16556+7 1C36 E630 and 00110000b ;mask bits; bit6 low -> 24h mode
|
||
143:16563+4 1C38 B1 or c ;add second digit
|
||
144:16567+13 1C39 321040 ld (var_scratch+5),a
|
||
145: ;month
|
||
146:16580+10 1C3C 21671B ld hl, [_OP_STIME_STR_MON]
|
||
147:16590+17 1C3F CD051C call _OP_STIME_PROMPT
|
||
148:16607+4 1C42 78 ld a,b
|
||
149:16611+17 1C43 CD9C1C call _shift4
|
||
150:16628+7 1C46 E610 and 00010000b ;mask bits; bit6 low -> 24h mode
|
||
151:16635+4 1C48 B1 or c ;add second digit
|
||
152:16639+13 1C49 321140 ld (var_scratch+6),a
|
||
153: ;year
|
||
154:16652+10 1C4C 21821B ld hl, [_OP_STIME_STR_YEAR]
|
||
155:16662+17 1C4F CD051C call _OP_STIME_PROMPT
|
||
156:16679+4 1C52 78 ld a,b
|
||
157:16683+17 1C53 CD9C1C call _shift4
|
||
158:16700+7 1C56 E6F0 and 11110000b ;mask bits; bit6 low -> 24h mode
|
||
159:16707+4 1C58 B1 or c ;add second digit
|
||
160:16711+13 1C59 321240 ld (var_scratch+7),a
|
||
161: ;hours
|
||
162:16724+10 1C5C 219D1B ld hl, [_OP_STIME_STR_HOUR]
|
||
163:16734+17 1C5F CD051C call _OP_STIME_PROMPT
|
||
164:16751+4 1C62 78 ld a,b
|
||
165:16755+17 1C63 CD9C1C call _shift4
|
||
166:16772+7 1C66 E630 and 00110000b ;mask bits; bit6 low -> 24h mode
|
||
167:16779+4 1C68 B1 or c ;add second digit
|
||
168:16783+13 1C69 320E40 ld (var_scratch+3),a
|
||
169: ; minutes
|
||
170:16796+10 1C6C 21B81B ld hl, [_OP_STIME_STR_MIN]
|
||
171:16806+17 1C6F CD051C call _OP_STIME_PROMPT
|
||
172:16823+4 1C72 78 ld a,b
|
||
173:16827+17 1C73 CD9C1C call _shift4
|
||
174:16844+7 1C76 E670 and 01110000b ;mask bits
|
||
175:16851+4 1C78 B1 or c ;add second digit
|
||
176:16855+13 1C79 320D40 ld (var_scratch+2),a
|
||
177: ; seconds
|
||
178:16868+10 1C7C 21D31B ld hl, [_OP_STIME_STR_SEC]
|
||
179:16878+17 1C7F CD051C call _OP_STIME_PROMPT
|
||
180:16895+4 1C82 78 ld a,b
|
||
181:16899+17 1C83 CD9C1C call _shift4
|
||
182:16916+7 1C86 E670 and 01110000b ;mask bits / bit6 low -> 24h mode (enable clock)
|
||
183:16923+4 1C88 B1 or c ;add second digit
|
||
184:16927+13 1C89 320C40 ld (var_scratch+1),a
|
||
185:16940+6 1C8C 13 inc de ;next
|
||
186:
|
||
187:16946+7 1C8D 0ED0 ld c, ADDR_RTC
|
||
188:16953+7 1C8F 0608 ld b, 8
|
||
189:16960+10 1C91 210B40 ld hl,[var_scratch]
|
||
190:16970+17 1C94 CD8415 call iic_send_buffer
|
||
191:16987+4 1C97 B7 or a
|
||
192:16991+10 1C98 C2251A jp nz, _OP_IIC_ACK_ERR
|
||
193:
|
||
194:17001+10 1C9B C9 ret
|
||
195:
|
||
196: - 1C9C _shift4:
|
||
197:17011+4 1C9C 07 RLCA
|
||
198:17015+4 1C9D 07 RLCA
|
||
199:17019+4 1C9E 07 RLCA
|
||
200:17023+4 1C9F 07 RLCA
|
||
**** main.asm ****
|
||
188:17027+10 1CA0 C9 ret
|
||
189: .include "cmd_disk.s"
|
||
**** include/cmd_disk.s ****
|
||
1: - 1CA1 OP_LSDSK:
|
||
2:17037+17 1CA1 CDD312 call ideif_prnt_devtable
|
||
3:17054+10 1CA4 C9 ret
|
||
4:
|
||
5: - 1CA5 OP_SELDSK:
|
||
6: ;DE contains pointer
|
||
7:17064+11 1CA5 D5 push de
|
||
8:17075+10 1CA6 E1 pop hl
|
||
9:17085+7 1CA7 7E ld a,(hl)
|
||
10:17092+7 1CA8 DE45 sbc 69
|
||
11:17099+7+5 1CAA 3808 jr c,_OP_SELDSK_INVALID
|
||
12:17106+7 1CAC FE04 cp 4
|
||
13:17113+7+5 1CAE 3004 jr nc, _OP_SELDSK_INVALID
|
||
14:17120+17 1CB0 CD0080 call 0x8000
|
||
15:17137+10 1CB3 C9 ret
|
||
16:
|
||
17: - 1CB4 _OP_SELDSK_INVALID:
|
||
18:17147+10 1CB4 21C41C ld hl,[_OP_SELDSK_INVALID_STR]
|
||
19:17157+17 1CB7 CDDF00 call print_str
|
||
20:17174+10 1CBA 112000 LD DE,0x20
|
||
21:17184+10 1CBD 017000 LD BC,0x70
|
||
22:17194+17 1CC0 CD170D CALL beep
|
||
23:17211+10 1CC3 C9 ret
|
||
24:
|
||
25: - 1CC4 _OP_SELDSK_INVALID_STR:
|
||
**** main.asm ****
|
||
190: - 1CC4 0A0D496E db 10,13,"Invalid drive letter",10,13,0
|
||
76616C69
|
||
64206472
|
||
69766520
|
||
6C657474
|
||
65720A0D
|
||
00
|
||
191: .include "post.s"
|
||
**** include/post.s ****
|
||
1: ;Power-On self test
|
||
2: - 1CDD POST_START:
|
||
3:17221+17 1CDD CDED1C call POST_CHECK_PIO
|
||
4:17238+17 1CE0 CD121D call POST_CHECK_APU
|
||
5:17255+17 1CE3 CD6A1D call POST_TEST_RTC
|
||
6:17272+17 1CE6 CD3D1D call POST_CHECK_IDE_30
|
||
7:17289+17 1CE9 CD501D call POST_CHECK_IDE_40
|
||
8:17306+10 1CEC C9 ret
|
||
9:
|
||
10: - 1CED POST_CHECK_PIO:
|
||
11:17316+10 1CED 21E11D ld hl,[str_post_pio]
|
||
12:17326+17 1CF0 CDDF00 call print_str
|
||
13:17343+11 1CF3 DBF6 in a,(CS_PIO_AC) ;test read from pio
|
||
14:17354+7 1CF5 FE00 cp 0x00 ;0x78 when not installed
|
||
15:17361+10 1CF7 C2061D jp nz, _POST_CHECK_PIO_FAILED
|
||
16:17371+7 1CFA 3E00 ld a, 0x00 ;set present flag
|
||
17:17378+13 1CFC 320940 ld (var_pio_present),a
|
||
18:17391+10 1CFF 216A1E ld hl,[str_post_ok]
|
||
19:17401+17 1D02 CDDF00 call print_str
|
||
20:17418+10 1D05 C9 ret
|
||
21: - 1D06 _POST_CHECK_PIO_FAILED:
|
||
22:17428+7 1D06 3EFF ld a, 0xFF
|
||
23:17435+13 1D08 320940 ld (var_pio_present),a
|
||
24:17448+10 1D0B 21321E ld hl,[str_post_nd]
|
||
25:17458+17 1D0E CDDF00 call print_str
|
||
26:17475+10 1D11 C9 ret
|
||
27:
|
||
28: - 1D12 POST_CHECK_APU:
|
||
29:17485+10 1D12 21FC1D ld hl,[str_post_apu]
|
||
30:17495+17 1D15 CDDF00 call print_str
|
||
31:
|
||
32:17512+7 1D18 3EFF ld a, 0xFF
|
||
33:17519+11 1D1A D3F8 out (CS_APU_DATA),a
|
||
34:17530+4 1D1C 00 nop
|
||
35:17534+4 1D1D 00 nop
|
||
36:17538+11 1D1E DBF8 in a,(CS_APU_DATA)
|
||
37:17549+7 1D20 FEFF cp 0xFF
|
||
38:17556+10 1D22 C2311D jp nz, _POST_CHECK_APU_FAILED
|
||
39:17566+7 1D25 3E00 ld a, 0x00 ;set present flag
|
||
40:17573+13 1D27 320A40 ld (var_apu_present),a
|
||
41:17586+10 1D2A 216A1E ld hl,[str_post_ok]
|
||
42:17596+17 1D2D CDDF00 call print_str
|
||
43:17613+10 1D30 C9 ret
|
||
44: - 1D31 _POST_CHECK_APU_FAILED:
|
||
45:17623+7 1D31 3EFF ld a, 0xFF
|
||
46:17630+13 1D33 320A40 ld (var_apu_present),a
|
||
47:17643+10 1D36 21321E ld hl,[str_post_nd]
|
||
48:17653+17 1D39 CDDF00 call print_str
|
||
49:17670+10 1D3C C9 ret
|
||
50:
|
||
51: - 1D3D POST_CHECK_IDE_30:
|
||
52:17680+10 1D3D 21AB1D ld hl,[str_post_ide_30]
|
||
53:17690+17 1D40 CDDF00 call print_str
|
||
54:17707+11 1D43 DB30 in a,(0x30)
|
||
55:17718+4 1D45 B7 or a
|
||
56:17722+10 1D46 C2631D jp nz, _POST_CHECK_IDE_FAILED
|
||
57:17732+10 1D49 216A1E ld hl,[str_post_ok]
|
||
58:17742+17 1D4C CDDF00 call print_str
|
||
59:17759+10 1D4F C9 ret
|
||
60: - 1D50 POST_CHECK_IDE_40:
|
||
61:17769+10 1D50 21C61D ld hl,[str_post_ide_40]
|
||
62:17779+17 1D53 CDDF00 call print_str
|
||
63:17796+11 1D56 DB40 in a,(0x40)
|
||
64:17807+4 1D58 B7 or a
|
||
65:17811+10 1D59 C2631D jp nz, _POST_CHECK_IDE_FAILED
|
||
66:17821+10 1D5C 216A1E ld hl,[str_post_ok]
|
||
67:17831+17 1D5F CDDF00 call print_str
|
||
68:17848+10 1D62 C9 ret
|
||
69:
|
||
70: - 1D63 _POST_CHECK_IDE_FAILED
|
||
71:17858+10 1D63 21321E ld hl,[str_post_nd]
|
||
72:17868+17 1D66 CDDF00 call print_str
|
||
73:17885+10 1D69 C9 ret
|
||
74:
|
||
75: - 1D6A POST_TEST_RTC:
|
||
76:17895+7 1D6A 3E06 ld a, 0x06
|
||
77:17902+13 1D6C 320B40 ld (var_scratch),a
|
||
78:17915+10 1D6F 21171E ld hl,[str_post_rtc]
|
||
79:17925+17 1D72 CDDF00 call print_str
|
||
80:17942+10 1D75 210B40 ld hl,[var_scratch]
|
||
81:17952+7 1D78 0601 ld b, 1
|
||
82:17959+7 1D7A 0ED0 ld c, ADDR_RTC
|
||
83:17966+17 1D7C CD8415 call iic_send_buffer
|
||
84:17983+4 1D7F B7 or a
|
||
85:17987+10 1D80 C29D1D jp nz, _POST_TEST_RTC_NOTFOUND
|
||
86:17997+10 1D83 210B40 ld hl,[var_scratch]
|
||
87:18007+7 1D86 0601 ld b, 1
|
||
88:18014+7 1D88 0ED0 ld c, ADDR_RTC
|
||
89:18021+17 1D8A CDAE15 call iic_receive_buffer
|
||
90:18038+13 1D8D 3A0B40 ld a, (var_scratch)
|
||
91:18051+4 1D90 B7 or a
|
||
92:18055+10 1D91 CAA41D jp z, _POST_TEST_RTC_INVALID
|
||
93:18065+10 1D94 216A1E ld hl,[str_post_ok]
|
||
94:18075+17 1D97 CDDF00 call print_str
|
||
95:18092+10 1D9A C3931A jp _OP_RTIME_NN
|
||
96: - 1D9D _POST_TEST_RTC_NOTFOUND:
|
||
97:18102+10 1D9D 21321E ld hl,[str_post_nd]
|
||
98:18112+17 1DA0 CDDF00 call print_str
|
||
99:18129+10 1DA3 C9 ret
|
||
100: - 1DA4 _POST_TEST_RTC_INVALID:
|
||
101:18139+10 1DA4 21401E ld hl,[str_post_rtc_iv]
|
||
102:18149+17 1DA7 CDDF00 call print_str
|
||
103:18166+10 1DAA C9 ret
|
||
104:
|
||
105: - 1DAB str_post_ide_30:
|
||
106: - 1DAB 0D0A4368 db 13,10,"Check Diskctrl.@030h... ",0
|
||
65636B20
|
||
4469736B
|
||
6374726C
|
||
2E403033
|
||
30682E2E
|
||
2E2000
|
||
107: - 1DC6 str_post_ide_40:
|
||
108: - 1DC6 0D0A4368 db 13,10,"Check Diskctrl.@040h... ",0
|
||
65636B20
|
||
4469736B
|
||
6374726C
|
||
2E403034
|
||
30682E2E
|
||
2E2000
|
||
109: - 1DE1 str_post_pio:
|
||
110: - 1DE1 0D0A4368 db 13,10,"Check IO-Controller ... ",0
|
||
65636B20
|
||
494F2D43
|
||
6F6E7472
|
||
6F6C6C65
|
||
72202E2E
|
||
2E2000
|
||
111: - 1DFC str_post_apu:
|
||
112: - 1DFC 0D0A4368 db 13,10,"Check AMD8911 APU ... ",0
|
||
65636B20
|
||
414D4438
|
||
39313120
|
||
41505520
|
||
20202E2E
|
||
2E2000
|
||
113: - 1E17 str_post_rtc:
|
||
114: - 1E17 0D0A4368 db 13,10,"Check DS1307 RTC ... ",0
|
||
65636B20
|
||
44533133
|
||
30372052
|
||
54432020
|
||
20202E2E
|
||
2E2000
|
||
115: - 1E32 str_post_nd:
|
||
116: - 1E32 6E6F7420 db "not detected!",0
|
||
64657465
|
||
63746564
|
||
2100
|
||
117: - 1E40 str_post_rtc_iv:
|
||
118: - 1E40 6E6F7420 db "not set. Check battery and run 'setdate'!",0
|
||
7365742E
|
||
20436865
|
||
636B2062
|
||
61747465
|
||
72792061
|
||
6E642072
|
||
756E2027
|
||
73657464
|
||
61746527
|
||
2100
|
||
119: - 1E6A str_post_ok:
|
||
**** main.asm ****
|
||
192: - 1E6A 6F6B2120 db "ok! ",0
|
||
00
|
||
193:
|
||
194: ;================================================================
|
||
195: ; Strings
|
||
196: ;================================================================
|
||
197: - 1E6F STR_Banner_Start:
|
||
198: - 1E6F 5A384320 db "Z8C Monitor V2.1 by Dennis Gunia (2022-2024)",0
|
||
4D6F6E69
|
||
746F7220
|
||
56322E31
|
||
20627920
|
||
44656E6E
|
||
69732047
|
||
756E6961
|
||
20283230
|
||
32322D32
|
||
30323429
|
||
00
|
||
|
||
|
||
|
||
Statistics:
|
||
|
||
4 passes
|
||
0 jr promotions
|
||
470 symbols
|
||
8581 bytes
|
||
|
||
|
||
|
||
Symbol Table:
|
||
|
||
ADDR_RTC =D0 208
|
||
A_RTS_OFF 152 338
|
||
A_RTS_ON 15B 347
|
||
BOOT_PHASE0 50 80
|
||
BOOT_PHASE1 6E 110
|
||
BOOT_PHASE1_LOOP 77 119
|
||
BOOT_PHASE2 82 130
|
||
COMMAND 17EB 6123
|
||
COMMAND_BACKSPACE 1826 6182
|
||
COMMAND_LUT 176B 5995
|
||
COMMAND_PROCESS 184C 6220
|
||
COMMAND_PROCESS_FOUND 1887 6279
|
||
COMMAND_PROCESS_LOOP 184F 6223
|
||
COMMAND_PROCESS_LOOP_STR1 1858 6232
|
||
COMMAND_PROCESS_LOOP_STR2 186E 6254
|
||
COMMAND_PROCESS_NEXT_ENTRY 1873 6259
|
||
COMMAND_PROCESS_NEXT_ENTRYI 1872 6258
|
||
COMMAND_PROCESS_NOT_FOUND 187E 6270
|
||
COMMAND_READ 17F7 6135
|
||
CONSOLE_INIT 9E 158
|
||
CONSOLE_INIT_CTC 9E 158
|
||
CONSOLE_INIT_SIO A6 166
|
||
CS_APU_CTRL =F9 249
|
||
CS_APU_DATA =F8 248
|
||
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_PIA_CR =33 51
|
||
CS_PIA_PA =30 48
|
||
CS_PIA_PB =31 49
|
||
CS_PIA_PC =32 50
|
||
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 164 356
|
||
DHEX_TO_BYTE_FAILED 180 384
|
||
ERR_SYNTAX 189D 6301
|
||
EXEC_RST_08 D04 3332
|
||
EXEC_RST_10 D08 3336
|
||
EXEC_RST_18 D14 3348
|
||
HEX_TO_BIN 184 388
|
||
HEX_TO_BIN_2 192 402
|
||
HEX_TO_INVALID_2 199 409
|
||
IDE_CMD_IDENT =EC 236
|
||
IDE_CMD_READSEC=20 32
|
||
IDE_DEV_TABLE 1275 4725
|
||
IDE_RD =40 64
|
||
IDE_REG_ALTSTS =16 22
|
||
IDE_REG_CMDSTS =0F 15
|
||
IDE_REG_DATA =08 8
|
||
IDE_REG_DRVADDR=17 23
|
||
IDE_REG_ERROR =09 9
|
||
IDE_REG_HCYL =0D 13
|
||
IDE_REG_HEAD =0E 14
|
||
IDE_REG_LBA0 =0B 11
|
||
IDE_REG_LBA1 =0C 12
|
||
IDE_REG_LBA2 =0D 13
|
||
IDE_REG_LBA3 =0E 14
|
||
IDE_REG_LCYL =0C 12
|
||
IDE_REG_SECTOR =0A 10
|
||
IDE_REG_SSECTOR=0B 11
|
||
IDE_RST =80 128
|
||
IDE_WR =20 32
|
||
IIC_CLK =01 1
|
||
IIC_DATA =02 2
|
||
INT_VEC 1B 27
|
||
IN_BUFFER =402B 16427
|
||
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
|
||
MEM_IDE_BUFFER 4117 16663
|
||
MEM_IDE_DEVICE 402C 16428
|
||
MEM_IDE_DEV_TABLE 4036 16438
|
||
MEM_IDE_FSBUFFER 4317 17175
|
||
MEM_IDE_PARTITION 402E 16430
|
||
MEM_IDE_POINTER 4032 16434
|
||
MEM_IDE_SELECTED 4076 16502
|
||
MEM_IDE_STATUS 402D 16429
|
||
MEM_IDE_STRING_0 4077 16503
|
||
MEM_IDE_STRING_1 409F 16543
|
||
MEM_IDE_STRING_2 40C7 16583
|
||
MEM_IDE_STRING_3 40EF 16623
|
||
MSG_CLEAR 14A 330
|
||
NOT_IMPLEMENTED 1896 6294
|
||
OP_CALL 18F8 6392
|
||
OP_CLR 1A8C 6796
|
||
OP_DASM 1979 6521
|
||
OP_DUMP 1918 6424
|
||
OP_EXEC 18DF 6367
|
||
OP_IIC_IN 1A40 6720
|
||
OP_IIC_OUT 19E0 6624
|
||
OP_IO_IN 19A9 6569
|
||
OP_IO_OUT 19BF 6591
|
||
OP_LSDSK 1CA1 7329
|
||
OP_RTIME 1A90 6800
|
||
OP_SELDSK 1CA5 7333
|
||
OP_SET 1948 6472
|
||
OP_STIME 1C28 7208
|
||
POST_CHECK_APU 1D12 7442
|
||
POST_CHECK_IDE_30 1D3D 7485
|
||
POST_CHECK_IDE_40 1D50 7504
|
||
POST_CHECK_PIO 1CED 7405
|
||
POST_START 1CDD 7389
|
||
POST_TEST_RTC 1D6A 7530
|
||
PRG_RAM_START =4110 16656
|
||
PRG_RAM_TOP =FF00 65280
|
||
PROG_MEM_START =4000 16384
|
||
PROG_ROM_START = 100 256
|
||
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 19B 411
|
||
STRCONV_BYTES_TO_HEX_1 1AA 426
|
||
STRCONV_BYTES_TO_HEX_2 1B4 436
|
||
STR_Banner_Start 1E6F 7791
|
||
STR_PD_HEADER 1724 5924
|
||
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
|
||
_COMMAND_PROCESS_FOUND 1895 6293
|
||
_OP_CALL 1917 6423
|
||
_OP_IIC_ACK_ERR 1A25 6693
|
||
_OP_IIC_ACK_ERR_str 1A2C 6700
|
||
_OP_IIC_IN_LOOP 1A72 6770
|
||
_OP_IIC_IN_LOOP_TEXT 1A7F 6783
|
||
_OP_IIC_OUT_LOOP 19F6 6646
|
||
_OP_IIC_OUT_SEND 1A12 6674
|
||
_OP_RTIME_NN 1A93 6803
|
||
_OP_RTIME_RD_CMD 1B4B 6987
|
||
_OP_SELDSK_INVALID 1CB4 7348
|
||
_OP_SELDSK_INVALID_STR 1CC4 7364
|
||
_OP_SET_LOOP 1960 6496
|
||
_OP_STIME_INVALID 1BEE 7150
|
||
_OP_STIME_PROMPT 1C05 7173
|
||
_OP_STIME_PROMPT_ERR 1C1D 7197
|
||
_OP_STIME_STR_DAY 1B4C 6988
|
||
_OP_STIME_STR_HOUR 1B9D 7069
|
||
_OP_STIME_STR_MIN 1BB8 7096
|
||
_OP_STIME_STR_MON 1B67 7015
|
||
_OP_STIME_STR_SEC 1BD3 7123
|
||
_OP_STIME_STR_YEAR 1B82 7042
|
||
_POST_CHECK_APU_FAILED 1D31 7473
|
||
_POST_CHECK_IDE_FAILED 1D63 7523
|
||
_POST_CHECK_PIO_FAILED 1D06 7430
|
||
_POST_TEST_RTC_INVALID 1DA4 7588
|
||
_POST_TEST_RTC_NOTFOUND 1D9D 7581
|
||
_STR_NOT_FOUND 18B8 6328
|
||
_STR_NOT_IMPLEMENTED 18A4 6308
|
||
_STR_SYNTAX 18CC 6348
|
||
_beep_pause_l1 D30 3376
|
||
_ideif_init_drive_found 13E9 5097
|
||
_ideif_init_drive_loop 13D1 5073
|
||
_ideif_init_drive_nodrv 13E4 5092
|
||
_ideif_init_drive_prt_fnd 1454 5204
|
||
_ideif_init_drive_prt_l1 1442 5186
|
||
_ideif_init_drive_prt_ln 144C 5196
|
||
_ideif_prnt_devtable_hdr 1510 5392
|
||
_ideif_prnt_devtable_l1 12E1 4833
|
||
_ideif_prnt_devtable_l1_e2 13A7 5031
|
||
_ideif_prnt_devtable_l1_es 1326 4902
|
||
_ideif_prnt_devtable_l1_ms 13A4 5028
|
||
_ideif_prnt_devtable_l1_nxt 12EE 4846
|
||
_ideif_prnt_devtable_l1_s00 1314 4884
|
||
_ideif_prnt_devtable_l1_s01 1319 4889
|
||
_ideif_prnt_devtable_l1_s02 131E 4894
|
||
_ideif_prnt_devtable_l1_sFF 1323 4899
|
||
_ideif_prnt_devtable_l1_sel 12EC 4844
|
||
_ideif_prnt_devtable_master 1574 5492
|
||
_ideif_prnt_devtable_s00 1548 5448
|
||
_ideif_prnt_devtable_s01 1553 5459
|
||
_ideif_prnt_devtable_s02 155E 5470
|
||
_ideif_prnt_devtable_sFF 1569 5481
|
||
_ideif_prnt_devtable_slave 157C 5500
|
||
_read_bcd_invalid 147 327
|
||
_shift4 1C9C 7324
|
||
beep D17 3351
|
||
beep_loop D19 3353
|
||
beep_pause D2F 3375
|
||
dasm_00 91C 2332
|
||
dasm_01 C08 3080
|
||
dasm_02 9A2 2466
|
||
dasm_03 BDA 3034
|
||
dasm_08 A1F 2591
|
||
dasm_09 BAD 2989
|
||
dasm_0A 984 2436
|
||
dasm_0B BF1 3057
|
||
dasm_10 964 2404
|
||
dasm_12 9AD 2477
|
||
dasm_18 927 2343
|
||
dasm_1A 98E 2446
|
||
dasm_20 941 2369
|
||
dasm_22 C4E 3150
|
||
dasm_27 9E7 2535
|
||
dasm_28 93A 2362
|
||
dasm_2A C1F 3103
|
||
dasm_2F 9EB 2539
|
||
dasm_30 932 2354
|
||
dasm_32 9B8 2488
|
||
dasm_37 9F7 2551
|
||
dasm_38 92B 2347
|
||
dasm_3A 998 2456
|
||
dasm_3F 9F3 2547
|
||
dasm_76 9FB 2555
|
||
dasm_80C6 A78 2680
|
||
dasm_BE A15 2581
|
||
dasm_C3 920 2336
|
||
dasm_C88E A9E 2718
|
||
dasm_C9 970 2416
|
||
dasm_CD 96A 2410
|
||
dasm_D9 A2C 2604
|
||
dasm_DD 952 2386
|
||
dasm_DD_01 C0F 3087
|
||
dasm_DD_09 BC8 3016
|
||
dasm_DD_22 C64 3172
|
||
dasm_DD_23 BDF 3039
|
||
dasm_DD_2A C36 3126
|
||
dasm_DD_2B BF6 3062
|
||
dasm_DD_34 B78 2936
|
||
dasm_DD_35 B95 2965
|
||
dasm_DD_86 A80 2688
|
||
dasm_DD_8E AA6 2726
|
||
dasm_DD_96 AC9 2761
|
||
dasm_DD_9E AE9 2793
|
||
dasm_DD_A6 B0A 2826
|
||
dasm_DD_AE B41 2881
|
||
dasm_DD_B6 B26 2854
|
||
dasm_DD_BE B5D 2909
|
||
dasm_DD_E1 CB6 3254
|
||
dasm_DD_E3 A3C 2620
|
||
dasm_DD_E5 CA0 3232
|
||
dasm_DD_F9 C86 3206
|
||
dasm_E1 CB0 3248
|
||
dasm_E3 A30 2608
|
||
dasm_E5 C9A 3226
|
||
dasm_E9 949 2377
|
||
dasm_ED_42 BBF 3007
|
||
dasm_ED_43 C5A 3162
|
||
dasm_ED_44 9EF 2543
|
||
dasm_ED_45 97A 2426
|
||
dasm_ED_46 A06 2566
|
||
dasm_ED_4A BB6 2998
|
||
dasm_ED_4B C2B 3115
|
||
dasm_ED_4D 975 2421
|
||
dasm_ED_56 A0B 2571
|
||
dasm_ED_5E A10 2576
|
||
dasm_ED_A0 A54 2644
|
||
dasm_ED_A1 A66 2662
|
||
dasm_ED_A8 A5D 2653
|
||
dasm_ED_A9 A6F 2671
|
||
dasm_ED_B0 A58 2648
|
||
dasm_ED_B1 A6A 2666
|
||
dasm_ED_B8 A61 2657
|
||
dasm_ED_B9 A73 2675
|
||
dasm_F3 A00 2560
|
||
dasm_F9 C7C 3196
|
||
dasm_FB A03 2563
|
||
dasm_FD 95B 2395
|
||
dasm_FD_01 C17 3095
|
||
dasm_FD_09 BD1 3025
|
||
dasm_FD_22 C70 3184
|
||
dasm_FD_23 BE8 3048
|
||
dasm_FD_2A C42 3138
|
||
dasm_FD_2B BFF 3071
|
||
dasm_FD_34 B84 2948
|
||
dasm_FD_35 BA1 2977
|
||
dasm_FD_86 A8F 2703
|
||
dasm_FD_8E AB5 2741
|
||
dasm_FD_96 AD5 2773
|
||
dasm_FD_9E AF7 2807
|
||
dasm_FD_A6 B16 2838
|
||
dasm_FD_AE B4D 2893
|
||
dasm_FD_B6 B31 2865
|
||
dasm_FD_BE B68 2920
|
||
dasm_FD_E1 CBE 3262
|
||
dasm_FD_E3 A48 2632
|
||
dasm_FD_E5 CA8 3240
|
||
dasm_FD_F9 C90 3216
|
||
dasm_FF 97F 2431
|
||
dasm_UU CC6 3270
|
||
dasm_UW CCA 3274
|
||
dasm__AND B05 2821
|
||
dasm__CP B59 2905
|
||
dasm__DEC B90 2960
|
||
dasm__ED_47 9D7 2519
|
||
dasm__ED_4F 9DF 2527
|
||
dasm__ED_57 9C7 2503
|
||
dasm__ED_5F 9CF 2511
|
||
dasm__INC B73 2931
|
||
dasm__LD 9C3 2499
|
||
dasm__OR B22 2850
|
||
dasm__SBC AE1 2785
|
||
dasm__SUB AC4 2756
|
||
dasm__XOR B3C 2876
|
||
dasm_opcode_table 4C4 1220
|
||
dasm_print16hex_addr 2F1 753
|
||
dasm_print8hex 309 777
|
||
dasm_printFlags_table CCF 3279
|
||
dasm_printRegister8_table CDF 3295
|
||
dasm_printRegister8_table_HL CFF 3327
|
||
dasm_printRegisterIX_table CE7 3303
|
||
dasm_printRegisterIY_table CEF 3311
|
||
dasm_printRegisterSP_table CF7 3319
|
||
disassemble 1B5 437
|
||
disassemble_continue 29B 667
|
||
disassemble_err 28B 651
|
||
disassemble_next 1B9 441
|
||
disassemble_print_opcode_params_end 288 648
|
||
disassemble_print_opcode_params_loop 234 564
|
||
disassemble_print_opcode_raw 1F6 502
|
||
disassemble_print_opcode_raw_fill 20A 522
|
||
disassemble_table_first_match 2CD 717
|
||
disassemble_table_found 2E7 743
|
||
disassemble_table_notfound 2EB 747
|
||
disassemble_table_seek 2A9 681
|
||
disassemble_table_seek_loop 2AD 685
|
||
dump_pretty 16C9 5833
|
||
dump_pretty_ascii 16F3 5875
|
||
dump_pretty_ascii_cont 1711 5905
|
||
dump_pretty_ascii_loop 16FB 5883
|
||
dump_pretty_ascii_none 170C 5900
|
||
dump_pretty_col 16E6 5862
|
||
dump_pretty_end 1723 5923
|
||
dump_pretty_nextrow 1717 5911
|
||
dump_pretty_row 16D1 5841
|
||
ide_printerror E04 3588
|
||
ide_readsector_256 D83 3459
|
||
ide_readsector_256_done DB2 3506
|
||
ide_readsector_256_waitloop D85 3461
|
||
ide_readsector_512_inv DB3 3507
|
||
ide_readsector_512_inv_waitloop DB8 3512
|
||
ide_readsector_timeout DEE 3566
|
||
ide_regread_8 D65 3429
|
||
ide_regwrite_8 D49 3401
|
||
ide_reset D3C 3388
|
||
ide_writesector_256 E03 3587
|
||
ideif_get_drv_pointer 1497 5271
|
||
ideif_init_all 14AB 5291
|
||
ideif_init_devtable 12B5 4789
|
||
ideif_init_drive 13C8 5064
|
||
ideif_prnt_devtable 12D3 4819
|
||
iic_init 15DD 5597
|
||
iic_read_ack 161C 5660
|
||
iic_receive_buffer 15AE 5550
|
||
iic_receive_buffer_done 15D1 5585
|
||
iic_receive_buffer_err 15D7 5591
|
||
iic_receive_buffer_loop 15BF 5567
|
||
iic_receive_byte 16A2 5794
|
||
iic_receive_byte_loop 16AF 5807
|
||
iic_send_ack 1642 5698
|
||
iic_send_buffer 1584 5508
|
||
iic_send_buffer_done 15A2 5538
|
||
iic_send_buffer_err 15A8 5544
|
||
iic_send_buffer_loop 1594 5524
|
||
iic_send_byte 167C 5756
|
||
iic_send_byte_loop 1688 5768
|
||
iic_send_ebit 15FB 5627
|
||
iic_send_nack 165F 5727
|
||
iic_send_sbit 15E6 5606
|
||
mon_var_template 44 68
|
||
mon_var_template_end 370 880
|
||
param_01 317 791
|
||
param_02 33E 830
|
||
param_03 35B 859
|
||
param_03_done 393 915
|
||
param_03_neg 37C 892
|
||
param_04 397 919
|
||
param_04_i 3A7 935
|
||
param_05 3AD 941
|
||
param_06 3BA 954
|
||
param_07 3D4 980
|
||
param_08 3E1 993
|
||
param_09 3F6 1014
|
||
param_09_0A 3FC 1020
|
||
param_0A 3ED 1005
|
||
param_10 40B 1035
|
||
param_11 41B 1051
|
||
param_11_12 42A 1066
|
||
param_11_12_all 44A 1098
|
||
param_11_12_def 43D 1085
|
||
param_11_12_ix 442 1090
|
||
param_11_12_iy 447 1095
|
||
param_12 423 1059
|
||
param_13 45B 1115
|
||
param_80 47A 1146
|
||
param_80_seek 481 1153
|
||
param_81 471 1137
|
||
param_comma 4B5 1205
|
||
param_printRegister 490 1168
|
||
param_printRegisterA 4AE 1198
|
||
param_printRegisterHL 4A6 1190
|
||
print_a_hex 107 263
|
||
print_bcd 119 281
|
||
print_char D7 215
|
||
print_clear EA 234
|
||
print_newLine F1 241
|
||
print_str DF 223
|
||
print_str_end E9 233
|
||
print_str_fixed 1763 5987
|
||
print_wait_out FC 252
|
||
read_bcd 131 305
|
||
read_char 11F 287
|
||
read_lba_sector 14BE 5310
|
||
str_dev_done 1508 5384
|
||
str_dev_waitready 14F0 5360
|
||
str_error_start E37 3639
|
||
str_error_start1 E54 3668
|
||
str_error_start2 E5D 3677
|
||
str_error_time E66 3686
|
||
str_post_apu 1DFC 7676
|
||
str_post_ide_30 1DAB 7595
|
||
str_post_ide_40 1DC6 7622
|
||
str_post_nd 1E32 7730
|
||
str_post_ok 1E6A 7786
|
||
str_post_pio 1DE1 7649
|
||
str_post_rtc 1E17 7703
|
||
str_post_rtc_iv 1E40 7744
|
||
var_apu_present 400A 16394
|
||
var_buffer 402B 16427
|
||
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_idebuffer 402C 16428
|
||
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_pio_present 4009 16393
|
||
var_ps2mem 401B 16411
|
||
var_scratch 400B 16395
|