6148 lines
261 KiB
Plaintext
6148 lines
261 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 C38600 jp BOOT_PHASE0
|
||
39:
|
||
40: - 0008 org 0x0008
|
||
41: - 0008 RST_08 ;Print Char
|
||
42: 10+10 0008 C3F10D jp EXEC_RST_08
|
||
43:
|
||
44: - 0010 org 0x0010
|
||
45: - 0010 RST_10 ;receive char
|
||
46: 20+10 0010 C3F50D jp EXEC_RST_10
|
||
47:
|
||
48: - 0018 org 0x0018
|
||
49: - 0018 RST_18 ;Buffer length
|
||
50: 30+10 0018 C3010E 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:
|
||
63: - 0444 mon_var_template_sof .EQU mon_var_template + 1024
|
||
64:
|
||
65: - 0044 mon_var_template:
|
||
66: - 4000 phase SYS_RAM_START
|
||
67: - 4000 interrupt_vectors:
|
||
68: - 4000 ..40FF 00 defs 256
|
||
69: - 4100 var_buffer_conin_data: ;contains console input
|
||
70: - 4100 ..41FF 00 defs 256
|
||
71: - 4200 var_buffer_conin_in: ;pointer to write position of buffer
|
||
72: - 4200 00 defb 0
|
||
73: - 4201 var_buffer_conin_out: ;pointer to read position of buffer
|
||
74: - 4201 00 defb 0
|
||
75: - 4202 var_buffer_conin_sts:
|
||
76: - 4202 00 defb 0
|
||
77: - 4203 var_buffer_conout:
|
||
78: - 4203 00 defb 0
|
||
79: - 4204 var_buffer_len:
|
||
80: - 4204 00 defb 0
|
||
81: - 4205 var_last_char:
|
||
82: - 4205 00 defb 0
|
||
83: - 4206 var_curserx:
|
||
84: - 4206 00 defb 0
|
||
85: - 4207 var_cursery:
|
||
86: - 4207 00 defb 0
|
||
87: - 4208 var_curserstate:
|
||
88: - 4208 00 defb 0
|
||
89: - 4209 var_curseron:
|
||
90: - 4209 00 defb 0
|
||
91: - 420A var_curserchar:
|
||
92: - 420A 00 defb 0
|
||
93: - 420B var_curserlastaddr:
|
||
94: - 420B 0000 defw 0
|
||
95: - 420D var_pio_present:
|
||
96: - 420D 00 defb 0
|
||
97: - 420E var_apu_present:
|
||
98: - 420E 00 defb 0
|
||
99: - 420F var_scratch:
|
||
100: - 420F ..421E 00 defs 16 ;16 bytes space for scratch vars
|
||
101: - 421F var_ps2mem:
|
||
102: - 421F ..422E 00 defs 16 ;16 bytes space for scratch vars
|
||
103: - 422F var_dir:
|
||
104: - 422F ..427E 00 defs 80
|
||
105: - 427F var_input:
|
||
106: - 427F ..42CE 00 defs 80
|
||
107: - 42CF var_idebuffer:
|
||
108: - 42CF ..45CE 00 defs 768
|
||
109:
|
||
110: - 0613 dephase
|
||
111: - 0613 mon_var_template_end:
|
||
112: 40+4 0613 00 nop
|
||
113:
|
||
114: ;================================================================
|
||
115: ; Start of monitor
|
||
116: ;================================================================
|
||
117: .include "ref.s" ;static bios calls for programs
|
||
**** include/ref.s ****
|
||
1: ;-------------------------------------
|
||
2: ; BIOS Routines entry points
|
||
3: ; Do not move in memory!!!!
|
||
4: ;-------------------------------------
|
||
5: - 0050 org 0x0050
|
||
6: - 0050 B_BEEP:
|
||
7: 44+10 0050 C3040E jp beep
|
||
8:
|
||
9: - 0053 B_IICSEND:
|
||
10: 54+10 0053 C3E116 jp iic_send_buffer
|
||
11:
|
||
12: - 0056 B_IICRECV:
|
||
13: 64+10 0056 C30B17 jp iic_receive_buffer
|
||
14:
|
||
15: - 0059 B_PRINTCHAR:
|
||
16: 74+10 0059 C3F600 jp print_char
|
||
17:
|
||
18: - 005C B_PRINTSTR:
|
||
19: 84+10 005C C3FC00 jp print_str
|
||
20:
|
||
21: - 005F B_PRINTINLINE:
|
||
22: 94+10 005F C3EC01 jp PRINTINLINE
|
||
23:
|
||
24: - 0062 B_PRINTAHEX:
|
||
25: 104+10 0062 C32201 jp print_a_hex
|
||
26:
|
||
27: - 0065 B_PRINTLN:
|
||
28: 114+10 0065 C30C01 jp print_newLine
|
||
29:
|
||
30: - 0068 B_READCHAR:
|
||
31: 124+10 0068 C34C01 jp read_char
|
||
32:
|
||
33: - 006B B_KEYREAD:
|
||
34: 134+10 006B C9 ret ;placeholder -> not implemented
|
||
35: - 006C 0000 db 0x00, 0x00
|
||
36:
|
||
37: - 006E B_KEYREADASCII:
|
||
38: 144+10 006E C9 ret ;placeholder -> not implemented
|
||
39: - 006F 0000 db 0x00, 0x00
|
||
40:
|
||
41: - 0071 B_KEYSEND:
|
||
42: 154+10 0071 C9 ret ;placeholder -> not implemented
|
||
43: - 0072 0000 db 0x00, 0x00
|
||
44:
|
||
45: - 0074 B_DSKSEL:
|
||
46: 164+10 0074 C3B815 jp ideif_drv_sel
|
||
47:
|
||
48: - 0077 B_FATOPEN:
|
||
49: 174+10 0077 C37723 jp fat_openfile
|
||
50:
|
||
51: - 007A B_FATREAD:
|
||
52: 184+10 007A C34A23 jp fat_readfilesec
|
||
53:
|
||
54: - 007D B_FATCD:
|
||
55: 194+10 007D C3FB25 jp fat_cd_single
|
||
56:
|
||
57: - 0080 B_FATCREATE:
|
||
58: 204+10 0080 C9 ret ;placeholder -> not implemented
|
||
59: - 0081 0000 db 0x00, 0x00
|
||
60:
|
||
61: - 0083 B_FATWRITE:
|
||
62: 214+10 0083 C9 ret ;placeholder -> not implemented
|
||
**** main.asm ****
|
||
118: - 0084 0000 db 0x00, 0x00
|
||
119:
|
||
120: - 0086 BOOT_PHASE0: ;Setup Hardware
|
||
121: ;Setup Stack-Pointer
|
||
122: 224+10 0086 31FFFF ld sp, STACK_RAM_TOP
|
||
123: ;Disable Interrupts
|
||
124: 234+4 0089 F3 di
|
||
125: ;Setup PIO on MIO Board
|
||
126: 238+7 008A 3ECF LD A,0xCF
|
||
127: 245+11 008C D3F6 OUT (CS_PIO_AC), A
|
||
128: 256+7 008E 3EF7 LD A,11110111b ;All pins inputs except speaker
|
||
129: 263+11 0090 D3F6 OUT (CS_PIO_AC), A
|
||
130: 274+7 0092 3E03 LD A,00000011B ;Preset I2C pins to high
|
||
131: 281+11 0094 D3F6 OUT (CS_PIO_AC), A
|
||
132:
|
||
133: ;Set variables
|
||
134: 292+13 0096 320842 ld (var_curserstate),a
|
||
135: 305+13 0099 320942 ld (var_curseron),a
|
||
136: 318+7 009C 3E20 ld a, " "
|
||
137: 325+13 009E 320A42 ld (var_curserchar),a
|
||
138:
|
||
139: ;Enable interupts
|
||
140: 338+17 00A1 CD2E18 call intctrl_init
|
||
141: ;Initialize Console (Serial-Port)
|
||
142: 355+17 00A4 CDEF00 call CONSOLE_INIT
|
||
143:
|
||
144:
|
||
145: ;clear memory area
|
||
146: 372+10 00A7 214404 ld hl, [mon_var_template_sof]
|
||
147: 382+10 00AA 01CF01 ld bc, [mon_var_template_end-mon_var_template_sof]
|
||
148: 392+10 00AD 114504 ld de, [mon_var_template_sof+1]
|
||
149: 402+4 00B0 AF xor a
|
||
150: 406+7 00B1 77 ld (hl),a
|
||
151: 413+16+5 00B2 EDB0 ldir
|
||
152:
|
||
153: 429+10 00B4 C3CB00 jp BOOT_PHASE2 ;skip rest of table init
|
||
154: - 00B7 BOOT_PHASE1: ;Copy default values to RAM
|
||
155: 439+10 00B7 214404 ld hl,mon_var_template + 1024
|
||
156: 449+10 00BA 111306 ld de,mon_var_template_end
|
||
157: 459+10 00BD 010040 ld bc,SYS_RAM_START
|
||
158: - 00C0 BOOT_PHASE1_LOOP:
|
||
159: 469+7 00C0 7E ld a,(hl) ;copy values
|
||
160: 476+7 00C1 02 ld (bc),a
|
||
161: 483+6 00C2 23 inc hl
|
||
162: 489+6 00C3 03 inc bc
|
||
163: 495+11 00C4 E5 push hl ;check if end is reached
|
||
164: 506+15 00C5 ED52 sbc hl,de
|
||
165: 521+10 00C7 E1 pop hl
|
||
166: 531+10 00C8 C2C000 jp nz, BOOT_PHASE1_LOOP
|
||
167: ;template copy done
|
||
168:
|
||
169:
|
||
170: - 00CB BOOT_PHASE2: ;Hardware initialized.
|
||
171: ; Print banner
|
||
172: 541+17 00CB CD0501 call print_clear
|
||
173: 558+10 00CE 21E927 ld hl, [STR_Banner_Start]
|
||
174: 568+17 00D1 CDFC00 call print_str
|
||
175:
|
||
176: ; Power-On Self Tests
|
||
177: 585+17 00D4 CDA81F call POST_START
|
||
178:
|
||
179: ; Detect IDE drives
|
||
180: 602+17 00D7 CD6C15 call ideif_init_all
|
||
181:
|
||
182: ; Beep after start
|
||
183: 619+10 00DA 114000 LD DE,0x40
|
||
184: 629+10 00DD 014800 LD BC,0x48
|
||
185: 639+17 00E0 CD040E CALL beep
|
||
186:
|
||
187: 656+4 00E3 AF xor a ;set dir to empty
|
||
188: 660+13 00E4 322F42 ld (var_dir),a
|
||
189: 673+13 00E7 323042 ld (var_dir+1),a
|
||
190: ;enable interrupts
|
||
191: 686+4 00EA FB ei
|
||
192: ; Start commandline
|
||
193: 690+10 00EB C3A41A jp COMMAND
|
||
194:
|
||
195: ; This instruction should never be reached
|
||
196: 700+4 00EE 76 halt
|
||
197:
|
||
198: ;================================================================
|
||
199: ; Includes (2/2)
|
||
200: ;================================================================
|
||
201: .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:
|
||
10: - 00EF CONSOLE_INIT:
|
||
11: 704+17 00EF CD8E01 call con_rb_init; initialize ring buffer
|
||
12: 721+17 00F2 CDCE18 call consio_init_a
|
||
13: 738+10 00F5 C9 ret
|
||
14:
|
||
15:
|
||
16: ; A contains char
|
||
17: ; Destroys A
|
||
18: - 00F6 print_char:
|
||
19: 748+11 00F6 F5 push af
|
||
20: 759+17 00F7 CD2619 call consio_tx_a
|
||
21: 776+10 00FA F1 pop af
|
||
22: 786+10 00FB C9 ret
|
||
23: ; HL contains pointer to string
|
||
24: ; Destroy A, HL
|
||
25:
|
||
26: - 00FC print_str:
|
||
27: 796+7 00FC 7E ld a, (hl)
|
||
28: 803+4 00FD B7 or a
|
||
29: 807+5+6 00FE C8 ret z
|
||
30: 812+17 00FF CDF600 call print_char
|
||
31: 829+6 0102 23 inc hl
|
||
32: 835+12 0103 18F7 jr print_str
|
||
33:
|
||
34:
|
||
35: - 0105 print_clear:
|
||
36: 847+10 0105 21D201 ld hl, [MSG_CLEAR]
|
||
37: 857+17 0108 CDFC00 call print_str
|
||
38: 874+10 010B C9 ret
|
||
39:
|
||
40: - 010C print_newLine:
|
||
41: 884+7 010C 3E0A ld a,10
|
||
42: 891+17 010E CDF600 call print_char
|
||
43: 908+7 0111 3E0D ld a,13
|
||
44: 915+17 0113 CDF600 call print_char
|
||
45: 932+10 0116 C9 ret
|
||
46: ; destroys a
|
||
47: - 0117 print_wait_out:
|
||
48: ; check for TX buffer empty
|
||
49: 942+4 0117 97 sub a ;clear a, write into WR0: select RR0
|
||
50: 946+4 0118 3C inc a ;select RR1
|
||
51: 950+11 0119 D309 out (CS_SIO_A_C),A
|
||
52: 961+11 011B DB09 in A,(CS_SIO_A_C) ;read RRx
|
||
53: 972+8 011D CB47 bit 0,A
|
||
54: 980+7+5 011F 28F6 jr z,print_wait_out
|
||
55: 987+10 0121 C9 ret
|
||
56:
|
||
57: - 0122 print_a_hex:
|
||
58: 997+11 0122 F5 push af
|
||
59: 1008+11 0123 C5 push bc
|
||
60: 1019+11 0124 D5 push de
|
||
61: 1030+17 0125 CD8802 call STRCONV_BYTES_TO_HEX
|
||
62: 1047+4 0128 78 ld a,b
|
||
63: 1051+17 0129 CDF600 call print_char
|
||
64: 1068+4 012C 79 ld a,c
|
||
65: 1072+17 012D CDF600 call print_char
|
||
66: 1089+10 0130 D1 pop de
|
||
67: 1099+10 0131 C1 pop bc
|
||
68: 1109+10 0132 F1 pop af
|
||
69: 1119+10 0133 C9 ret
|
||
70:
|
||
71: - 0134 print_bcd:
|
||
72: 1129+7 0134 C630 ADD 48 ;offset for ascii number
|
||
73: 1136+17 0136 CDF600 call print_char
|
||
74: 1153+10 0139 C9 ret
|
||
75:
|
||
76: - 013A read_char_raw:
|
||
77: 1163+17 013A CDE301 call A_RTS_ON
|
||
78: 1180+4 013D 00 nop
|
||
79: 1184+4 013E AF xor a ; a = 0
|
||
80: 1188+11 013F D309 out (CS_SIO_A_C), a ; select reg 0
|
||
81: 1199+11 0141 DB09 in a, (CS_SIO_A_C) ; read reg 0
|
||
82: 1210+7 0143 E601 and 1 ; mask D0 (recieve char available)
|
||
83: 1217+17 0145 CDDA01 call A_RTS_OFF
|
||
84: 1234+5+6 0148 C8 ret Z ; return 0 if no char
|
||
85: 1239+11 0149 DB08 in a, (CS_SIO_A_D) ; read char if avail
|
||
86: 1250+10 014B C9 ret ; return
|
||
87:
|
||
88: - 014C read_char:
|
||
89: 1260+10 014C C33319 jp consio_rx_a
|
||
90:
|
||
91: - 014F read_bcd;
|
||
92: 1270+17 014F CD4C01 call read_char
|
||
93: 1287+10 0152 CA4F01 jp z, read_bcd
|
||
94: 1297+17 0155 CDF600 call print_char
|
||
95: 1314+7 0158 DE30 sbc 48 ;remove ascii offset
|
||
96: 1321+10 015A DA6501 jp c, _read_bcd_invalid ;if carry, wrong input
|
||
97: 1331+7 015D FE0A cp 10
|
||
98: 1338+10 015F CA6501 jp z, _read_bcd_invalid ;if equal or greater than 10, also error
|
||
99: 1348+7 0162 E60F and 0x0F ;mask unused bits
|
||
100: 1355+10 0164 C9 ret
|
||
101: - 0165 _read_bcd_invalid
|
||
102: 1365+7 0165 3EFF ld a, 0xFF
|
||
103: 1372+10 0167 C9 ret
|
||
104:
|
||
105: - 0168 print_32_hex:
|
||
106: 1382+19 0168 DD7E03 ld a,(ix+3)
|
||
107: 1401+17 016B CD2201 call print_a_hex
|
||
108: 1418+19 016E DD7E02 ld a,(ix+2)
|
||
109: 1437+17 0171 CD2201 call print_a_hex
|
||
110: 1454+19 0174 DD7E01 ld a,(ix+1)
|
||
111: 1473+17 0177 CD2201 call print_a_hex
|
||
112: 1490+19 017A DD7E00 ld a,(ix+0)
|
||
113: 1509+17 017D CD2201 call print_a_hex
|
||
114: 1526+10 0180 C9 ret
|
||
115:
|
||
116: - 0181 print_16_hex:
|
||
117: 1536+19 0181 DD7E01 ld a,(ix+1)
|
||
118: 1555+17 0184 CD2201 call print_a_hex
|
||
119: 1572+19 0187 DD7E00 ld a,(ix+0)
|
||
120: 1591+17 018A CD2201 call print_a_hex
|
||
121: 1608+10 018D C9 ret
|
||
122:
|
||
123: ;input ringbuffer
|
||
124: ;initialize ringbuffer
|
||
125: - 018E con_rb_init:
|
||
126: 1618+4 018E AF xor a
|
||
127: 1622+13 018F 320042 ld (var_buffer_conin_in),a
|
||
128: 1635+13 0192 320142 ld (var_buffer_conin_out),a
|
||
129: 1648+13 0195 320242 ld (var_buffer_conin_sts),a
|
||
130: 1661+10 0198 C9 ret
|
||
131:
|
||
132: - 0199 con_rb_read:
|
||
133: 1671+11 0199 E5 push hl
|
||
134: 1682+11 019A D5 push de
|
||
135: 1693+13 019B 3A0042 ld a,(var_buffer_conin_in)
|
||
136: 1706+4 019E 47 ld b,a
|
||
137: 1710+13 019F 3A0142 ld a,(var_buffer_conin_out)
|
||
138: 1723+4 01A2 B8 cp b ;check if equal
|
||
139: 1727+10 01A3 CAB601 jp z, con_rb_read_empty
|
||
140: ;if not equal, buffer contians data
|
||
141: 1737+7 01A6 2641 ld h, high [var_buffer_conin_data] ;load high byte for pointer
|
||
142: 1744+4 01A8 6F ld l, a
|
||
143: 1748+7 01A9 7E ld a,(hl)
|
||
144: 1755+11 01AA F5 push af
|
||
145: ;move pointer
|
||
146: 1766+13 01AB 3A0142 ld a,(var_buffer_conin_out)
|
||
147: 1779+4 01AE 3C inc a
|
||
148: 1783+13 01AF 320142 ld (var_buffer_conin_out),a
|
||
149: 1796+10 01B2 F1 pop af
|
||
150: 1806+10 01B3 D1 pop de
|
||
151: 1816+10 01B4 E1 pop hl
|
||
152: 1826+10 01B5 C9 ret
|
||
153: - 01B6 con_rb_read_empty:
|
||
154: 1836+7 01B6 3E01 ld a,1
|
||
155: 1843+13 01B8 320242 ld (var_buffer_conin_sts),a
|
||
156: 1856+4 01BB AF xor a
|
||
157: 1860+10 01BC D1 pop de
|
||
158: 1870+10 01BD E1 pop hl
|
||
159: 1880+10 01BE C9 ret
|
||
160:
|
||
161: - 01BF con_rb_write:
|
||
162: 1890+11 01BF E5 push hl
|
||
163: 1901+11 01C0 F5 push af
|
||
164: 1912+7 01C1 2641 ld h, high [var_buffer_conin_data] ;load high byte for pointer
|
||
165: 1919+13 01C3 3A0042 ld a,(var_buffer_conin_in)
|
||
166: 1932+4 01C6 6F ld l,a
|
||
167: 1936+10 01C7 F1 pop af
|
||
168: 1946+7 01C8 77 ld (hl),a
|
||
169: 1953+13 01C9 3A0042 ld a,(var_buffer_conin_in)
|
||
170: 1966+4 01CC 3C inc a
|
||
171: 1970+13 01CD 320042 ld (var_buffer_conin_in),a
|
||
172: ;TODO: check for overflow
|
||
173: 1983+10 01D0 E1 pop hl
|
||
174: 1993+10 01D1 C9 ret
|
||
175:
|
||
176:
|
||
177: ;MSG_CRSR_0:
|
||
178: ; db 0x1B, "[?25h",0
|
||
179: ;MSG_CRSR_1:
|
||
180: ; db 0x1B, "[?25l",0
|
||
181: - 01D2 MSG_CLEAR:
|
||
182: - 01D2 1B5B324A db 27, '[2J', 27, '[H',0
|
||
1B5B4800
|
||
183:
|
||
184:
|
||
185:
|
||
186: ; Serial Util Functions
|
||
187: - 01DA A_RTS_OFF:
|
||
188: 2003+7 01DA 3E05 ld a,005h ;write into WR0: select WR5
|
||
189: 2010+11 01DC D309 out (CS_SIO_A_C),A
|
||
190: 2021+7 01DE 3E68 ld a,068h ;DTR inactive, TX 8bit, BREAK off, TX on, RTS inactive
|
||
191: 2028+11 01E0 D309 out (CS_SIO_A_C),A
|
||
192: 2039+10 01E2 C9 ret
|
||
193: - 01E3 A_RTS_ON:
|
||
194: 2049+7 01E3 3E05 ld a,005h ;write into WR0: select WR5
|
||
195: 2056+11 01E5 D309 out (CS_SIO_A_C),A
|
||
196: 2067+7 01E7 3EEA ld a,0EAh ;DTR active, TX 8bit, BREAK off, TX on, RTS active
|
||
197: 2074+11 01E9 D309 out (CS_SIO_A_C),A
|
||
198: 2085+10 01EB C9 ret
|
||
199:
|
||
200: ;------------------------------------------------------------------------------
|
||
201: ; PRINTINLINE
|
||
202: ;
|
||
203: ; String output function
|
||
204: ;
|
||
205: ; Prints in-line data (bytes immediately following the PRINTINLINE call)
|
||
206: ; until a string terminator is encountered (0 - null char).
|
||
207: ;------------------------------------------------------------------------------
|
||
208: - 01EC PRINTINLINE:
|
||
209: 2095+19 01EC E3 EX (SP),HL ; PUSH HL and put RET ADDress into HL
|
||
210: 2114+11 01ED F5 PUSH AF
|
||
211: 2125+11 01EE C5 PUSH BC
|
||
212: - 01EF nxtILC:
|
||
213: 2136+7 01EF 7E LD A,(HL)
|
||
214: 2143+7 01F0 FE00 CP 0
|
||
215: 2150+7+5 01F2 2806 JR Z,endPrint
|
||
216: 2157+17 01F4 CDF600 CALL print_char
|
||
217: 2174+6 01F7 23 INC HL
|
||
218: 2180+12 01F8 18F5 JR nxtILC
|
||
219: - 01FA endPrint:
|
||
220: 2192+6 01FA 23 INC HL ; Get past "null" terminator
|
||
221: 2198+10 01FB C1 POP BC
|
||
222: 2208+10 01FC F1 POP AF
|
||
223: 2218+19 01FD E3 EX (SP),HL ; PUSH new RET ADDress on stack and restore HL
|
||
224: 2237+10 01FE C9 RET
|
||
225:
|
||
226: - 01FF print_reg:
|
||
227: 2247+11 01FF F5 push af
|
||
228: 2258+11 0200 D5 push de
|
||
229: 2269+11 0201 C5 push bc
|
||
230: 2280+11 0202 E5 push hl
|
||
231: 2291+11 0203 F5 push af
|
||
232: 2302+17 0204 CDEC01 call PRINTINLINE
|
||
233: - 0207 0A0D413A db 10,13,"A: ",0
|
||
202000
|
||
234: 2319+10 020E F1 pop af
|
||
235: 2329+17 020F CD2201 call print_a_hex
|
||
236: 2346+17 0212 CDEC01 call PRINTINLINE
|
||
237: - 0215 0A0D4243 db 10,13,"BC: ",0
|
||
3A2000
|
||
238: 2363+4 021C 78 ld a,b
|
||
239: 2367+17 021D CD2201 call print_a_hex
|
||
240: 2384+4 0220 79 ld a,c
|
||
241: 2388+17 0221 CD2201 call print_a_hex
|
||
242: 2405+17 0224 CDEC01 call PRINTINLINE
|
||
243: - 0227 0A0D4445 db 10,13,"DE: ",0
|
||
3A2000
|
||
244: 2422+4 022E 7A ld a,d
|
||
245: 2426+17 022F CD2201 call print_a_hex
|
||
246: 2443+4 0232 7B ld a,e
|
||
247: 2447+17 0233 CD2201 call print_a_hex
|
||
248: 2464+10 0236 F1 pop af
|
||
249: 2474+17 0237 CDEC01 call PRINTINLINE
|
||
250: - 023A 0A0D484C db 10,13,"HL: ",0
|
||
3A2000
|
||
251: 2491+4 0241 7C ld a,h
|
||
252: 2495+17 0242 CD2201 call print_a_hex
|
||
253: 2512+4 0245 7D ld a,l
|
||
254: 2516+17 0246 CD2201 call print_a_hex
|
||
255: 2533+17 0249 CD0C01 call print_newLine
|
||
256: 2550+10 024C E1 pop hl
|
||
257: 2560+10 024D C1 pop bc
|
||
258: 2570+10 024E D1 pop de
|
||
259: 2580+10 024F F1 pop af
|
||
**** main.asm ****
|
||
202: 2590+10 0250 C9 ret
|
||
203: .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: - 0251 DHEX_TO_BYTE:
|
||
7: 2600+11 0251 E5 PUSH HL ;Backup pointer
|
||
8: ; Load First Byte
|
||
9: 2611+7 0252 7E LD A,(HL) ;Load first char (high)
|
||
10: 2618+17 0253 CD7102 CALL HEX_TO_BIN ;Conv chart to 4bit
|
||
11: 2635+7+5 0256 3815 jr C, DHEX_TO_BYTE_FAILED ;If error jmp to DHEX_TO_BYTE_FAILED
|
||
12: 2642+8 0258 CB27 SLA A ;shift result to upper 4 bits
|
||
13: 2650+8 025A CB27 SLA A
|
||
14: 2658+8 025C CB27 SLA A
|
||
15: 2666+8 025E CB27 SLA A
|
||
16: 2674+4 0260 57 LD D,A ;store result in D
|
||
17:
|
||
18: 2678+6 0261 23 INC HL ;next byte
|
||
19: 2684+7 0262 7E LD A,(HL) ;load 2nd char (lower)
|
||
20: 2691+17 0263 CD7102 CALL HEX_TO_BIN ;Conv chart to 4bit
|
||
21: 2708+7+5 0266 3805 jr C, DHEX_TO_BYTE_FAILED ;If error jmp to DHEX_TO_BYTE_FAILED
|
||
22: 2715+4 0268 B2 OR D ;merge D with accumulator
|
||
23:
|
||
24: 2719+10 0269 E1 POP HL ;restor original pointer
|
||
25: 2729+7 026A 1E00 LD E,0x00 ;set error to 0x00 = no error
|
||
26: 2736+10 026C C9 RET
|
||
27: - 026D DHEX_TO_BYTE_FAILED:
|
||
28: 2746+7 026D 1EFF LD E,0xFF ;set error to oxFF
|
||
29: ;LD A,0x00
|
||
30: 2753+10 026F E1 POP HL
|
||
31: 2763+10 0270 C9 RET
|
||
32:
|
||
33: ; REG A Contains CHAR-Low
|
||
34: ; If failed, Carry is set
|
||
35: - 0271 HEX_TO_BIN:
|
||
36: 2773+7 0271 D630 SUB 48 ; 0 is 0
|
||
37: 2780+10 0273 EA8602 jp PE, HEX_TO_INVALID_2; to low (SUB overflow)
|
||
38: 2790+7 0276 FE0A CP 10 ; Value is between 0 and 9
|
||
39: 2797+7+5 0278 3805 JR C, HEX_TO_BIN_2
|
||
40: 2804+7 027A D607 SUB 7
|
||
41: 2811+10 027C EA8602 jp PE, HEX_TO_INVALID_2; to low (SUB overflow)
|
||
42: - 027F HEX_TO_BIN_2:
|
||
43: 2821+7 027F FE10 CP 16
|
||
44: 2828+7+5 0281 3003 JR NC, HEX_TO_INVALID_2; if bigger than 15-> fail
|
||
45: 2835+7 0283 E60F AND 0x0F
|
||
46: 2842+10 0285 C9 RET
|
||
47: - 0286 HEX_TO_INVALID_2:
|
||
48: 2852+4 0286 37 SCF ;set carry flag
|
||
49: 2856+10 0287 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: - 0288 STRCONV_BYTES_TO_HEX:
|
||
63: 2866+11 0288 F5 PUSH AF;Backup A Register
|
||
64: 2877+4 0289 1F RRA
|
||
65: 2881+4 028A 1F RRA
|
||
66: 2885+4 028B 1F RRA
|
||
67: 2889+4 028C 1F RRA
|
||
68: 2893+17 028D CD9702 CALL STRCONV_BYTES_TO_HEX_1
|
||
69: ;LD A,D
|
||
70: 2910+4 0290 47 LD B,A
|
||
71: 2914+10 0291 F1 POP AF ; Reload first Byte
|
||
72: 2924+17 0292 CD9702 CALL STRCONV_BYTES_TO_HEX_1
|
||
73: ;LD A,D
|
||
74: 2941+4 0295 4F LD C,A
|
||
75: 2945+10 0296 C9 RET
|
||
76:
|
||
77: - 0297 STRCONV_BYTES_TO_HEX_1:
|
||
78: 2955+7 0297 E60F AND 0x0F
|
||
79: 2962+7 0299 C630 ADD 48
|
||
80: 2969+7 029B FE3A CP 58 ; Check if less than 58 (less than ASCII 9)
|
||
81: ;JR C, STRCONV_BYTES_TO_HEX_2
|
||
82: 2976+5+6 029D D8 RET C
|
||
83: 2981+7 029E C607 ADD 7 ; A-F
|
||
84: 2988+10 02A0 C9 RET
|
||
85: - 02A1 STRCONV_BYTES_TO_HEX_2:
|
||
86: ;LD D,A
|
||
87: 2998+10 02A1 C9 RET
|
||
88:
|
||
89:
|
||
**** main.asm ****
|
||
204: .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: - 02A2 disassemble:
|
||
12: 3008+4 02A2 78 ld a,b
|
||
13: 3012+13 02A3 321A41 ld (var_bytes_count),a
|
||
14: - 02A6 disassemble_next:
|
||
15:
|
||
16:
|
||
17: 3025+16 02A6 221041 ld (var_opcode_start), hl ;16 bit pointer to opcode in mem
|
||
18: 3041+7 02A9 7E ld a,(hl) ;load opcode to find in A
|
||
19: 3048+13 02AA 321441 ld (var_opcode), a ;8 bit opcode value
|
||
20: 3061+6 02AD 23 inc hl
|
||
21: 3067+7 02AE 7E ld a,(hl) ;load opcode to find in A
|
||
22: 3074+13 02AF 321541 ld (var_opcode_x), a ;8 bit opcode extended value
|
||
23: 3087+6 02B2 2B dec hl
|
||
24: 3093+17 02B3 CD9603 call disassemble_table_seek
|
||
25: 3110+4 02B6 78 ld a,b
|
||
26: 3114+4 02B7 B1 or c
|
||
27: 3118+10 02B8 CA7803 jp z, disassemble_err ;if bc==0000h
|
||
28:
|
||
29: 3128+20 02BB ED431241 ld (var_opcode_table), bc ;16 bit pointer to opcode in table
|
||
30:
|
||
31: ;load params
|
||
32: 3148+6 02BF 03 inc bc
|
||
33: 3154+6 02C0 03 inc bc
|
||
34: 3160+6 02C1 03 inc bc
|
||
35: 3166+6 02C2 03 inc bc
|
||
36: 3172+7 02C3 0A ld a,(bc)
|
||
37: 3179+13 02C4 321641 ld (var_opcode_length),A ;8 bit opcode length (in bytes)
|
||
38: 3192+6 02C7 03 inc bc
|
||
39: 3198+7 02C8 0A ld a, (bc)
|
||
40: 3205+4 02C9 5F ld e,a
|
||
41: 3209+6 02CA 03 inc bc
|
||
42: 3215+7 02CB 0A ld a, (bc)
|
||
43: 3222+4 02CC 57 ld d,a
|
||
44: 3226+20 02CD ED531741 ld (var_opcode_string),de ;16 bit pointer to opcode string
|
||
45: 3246+6 02D1 03 inc bc
|
||
46: 3252+7 02D2 0A ld a,(bc)
|
||
47: 3259+13 02D3 321941 ld (var_opcode_pcount),A ;8 bit opcode param count
|
||
48:
|
||
49: ;values are prepared. Continue with print
|
||
50:
|
||
51: 3272+16 02D6 2A1041 ld hl,(var_opcode_start) ;print address
|
||
52: 3288+17 02D9 CDDE03 call dasm_print16hex_addr
|
||
53:
|
||
54: 3305+13 02DC 3A1641 ld a,(var_opcode_length)
|
||
55: 3318+4 02DF 47 ld b, a
|
||
56:
|
||
57: ;print up to 4 opcode bytes
|
||
58: 3322+16 02E0 2A1041 ld hl,(var_opcode_start)
|
||
59:
|
||
60: - 02E3 disassemble_print_opcode_raw
|
||
61: 3338+7 02E3 7E ld a,(hl) ;load first byte
|
||
62: 3345+17 02E4 CD2201 call print_a_hex
|
||
63: 3362+6 02E7 23 inc hl
|
||
64: 3368+8+5 02E8 10F9 djnz disassemble_print_opcode_raw
|
||
65:
|
||
66: 3376+7 02EA 3E68 ld a,"h"
|
||
67: 3383+17 02EC CDF600 call print_char
|
||
68: ;fill empty spots
|
||
69: 3400+13 02EF 3A1641 ld a,(var_opcode_length)
|
||
70: 3413+4 02F2 47 ld b,a
|
||
71: 3417+7 02F3 3E06 ld a,6
|
||
72: 3424+4 02F5 90 sub b
|
||
73: 3428+4 02F6 47 ld b,a
|
||
74:
|
||
75: - 02F7 disassemble_print_opcode_raw_fill:
|
||
76: 3432+7 02F7 3E20 ld a," "
|
||
77: 3439+17 02F9 CDF600 call print_char
|
||
78: 3456+7 02FC 3E20 ld a," "
|
||
79: 3463+17 02FE CDF600 call print_char
|
||
80: 3480+8+5 0301 10F4 djnz disassemble_print_opcode_raw_fill
|
||
81: 3488+7 0303 3E20 ld a," "
|
||
82: 3495+17 0305 CDF600 call print_char
|
||
83:
|
||
84: 3512+11 0308 E5 push hl
|
||
85: ;print opcode
|
||
86: 3523+16 0309 2A1741 ld hl,(var_opcode_string)
|
||
87: 3539+17 030C CDFC00 call print_str
|
||
88:
|
||
89:
|
||
90: ;print params
|
||
91: 3556+13 030F 3A1941 ld a,(var_opcode_pcount)
|
||
92: 3569+4 0312 B7 or a
|
||
93: 3573+10 0313 CA7503 jp z, disassemble_print_opcode_params_end ;skip if no params
|
||
94:
|
||
95: 3583+16 0316 2A1241 ld hl,(var_opcode_table)
|
||
96: 3599+10 0319 010800 ld bc, 8
|
||
97: 3609+11 031C 09 add hl,bc ;hl now has address of first param
|
||
98: 3620+13 031D 3A1941 ld a,(var_opcode_pcount)
|
||
99: 3633+4 0320 47 ld b,a
|
||
100: - 0321 disassemble_print_opcode_params_loop:
|
||
101: ;ld a,(hl) ;load param
|
||
102: ;call print_a_hex
|
||
103: 3637+7 0321 7E ld a,(hl) ;load param
|
||
104:
|
||
105: 3644+7 0322 FE01 cp 0x01
|
||
106: 3651+10+7 0324 CC0404 call z, param_01
|
||
107: 3661+7 0327 FE02 cp 0x02
|
||
108: 3668+10+7 0329 CC2B04 call z, param_02
|
||
109: 3678+7 032C FE03 cp 0x03
|
||
110: 3685+10+7 032E CC4804 call z, param_03
|
||
111: 3695+7 0331 FE04 cp 0x04
|
||
112: 3702+10+7 0333 CC8404 call z, param_04
|
||
113: 3712+7 0336 FE05 cp 0x05
|
||
114: 3719+10+7 0338 CC9A04 call z, param_05
|
||
115: 3729+7 033B FE06 cp 0x06
|
||
116: 3736+10+7 033D CCA704 call z, param_06
|
||
117: 3746+7 0340 FE07 cp 0x07
|
||
118: 3753+10+7 0342 CCC104 call z, param_07
|
||
119: 3763+7 0345 FE08 cp 0x08
|
||
120: 3770+10+7 0347 CCCE04 call z, param_08
|
||
121: 3780+7 034A FE09 cp 0x09
|
||
122: 3787+10+7 034C CCE304 call z, param_09
|
||
123: 3797+7 034F FE10 cp 0x10
|
||
124: 3804+10+7 0351 CCF804 call z, param_10
|
||
125: 3814+7 0354 FE11 cp 0x11
|
||
126: 3821+10+7 0356 CC0805 call z, param_11
|
||
127: 3831+7 0359 FE12 cp 0x12
|
||
128: 3838+10+7 035B CC1005 call z, param_12
|
||
129: 3848+7 035E FE13 cp 0x13
|
||
130: 3855+10+7 0360 CC4805 call z, param_13
|
||
131: 3865+7 0363 FE0A cp 0x0A
|
||
132: 3872+10+7 0365 CCDA04 call z, param_0A
|
||
133: ;strings
|
||
134: 3882+7 0368 FE80 cp 0x80
|
||
135: 3889+10+7 036A CC6705 call z, param_80
|
||
136: 3899+7 036D FE81 cp 0x81
|
||
137: 3906+10+7 036F CC5E05 call z, param_81
|
||
138: 3916+6 0372 23 inc hl
|
||
139: 3922+8+5 0373 10AC djnz disassemble_print_opcode_params_loop
|
||
140: - 0375 disassemble_print_opcode_params_end:
|
||
141: 3930+10 0375 E1 pop hl
|
||
142: 3940+12 0376 1810 jr disassemble_continue
|
||
143:
|
||
144:
|
||
145: - 0378 disassemble_err:
|
||
146: 3952+17 0378 CDDE03 call dasm_print16hex_addr
|
||
147: 3969+7 037B 7E ld a,(hl)
|
||
148: 3976+17 037C CDF603 call dasm_print8hex ;print value
|
||
149: 3993+6 037F 23 inc hl
|
||
150: 3999+11 0380 E5 push hl
|
||
151: 4010+10 0381 21B30D ld hl, [dasm_UU]
|
||
152: 4020+17 0384 CDFC00 call print_str
|
||
153: 4037+10 0387 E1 pop hl
|
||
154:
|
||
155: - 0388 disassemble_continue:
|
||
156:
|
||
157: 4047+17 0388 CD0C01 call print_newLine
|
||
158: ;inc hl
|
||
159: 4064+13 038B 3A1A41 ld a,(var_bytes_count)
|
||
160: 4077+4 038E 3D dec a
|
||
161: 4081+13 038F 321A41 ld (var_bytes_count),a
|
||
162: 4094+10 0392 C2A602 jp nz, disassemble_next
|
||
163: 4104+10 0395 C9 ret
|
||
164:
|
||
165:
|
||
166:
|
||
167: ;A contains opcode
|
||
168: ;BC contains returned position
|
||
169: - 0396 disassemble_table_seek:
|
||
170: 4114+11 0396 E5 push hl
|
||
171: 4125+10 0397 21B105 ld hl, [dasm_opcode_table]
|
||
172: - 039A disassemble_table_seek_loop:
|
||
173: 4135+13 039A 3A1441 ld a,(var_opcode)
|
||
174: 4148+4 039D 4F ld c,a
|
||
175: 4152+7 039E 7E ld a,(hl)
|
||
176: 4159+7 039F FEFF cp 0xFF ; if null
|
||
177: 4166+10 03A1 CAD803 jp z, disassemble_table_notfound
|
||
178:
|
||
179: ;apply mask
|
||
180: 4176+11 03A4 F5 push af
|
||
181: 4187+6 03A5 23 inc hl
|
||
182: 4193+7 03A6 46 ld b,(hl) ;load mask
|
||
183: 4200+6 03A7 2B dec hl
|
||
184: 4206+4 03A8 79 ld a,c
|
||
185: 4210+4 03A9 A0 and b ;apply mask
|
||
186: 4214+4 03AA 4F ld c,a
|
||
187: 4218+10 03AB F1 pop af
|
||
188:
|
||
189: 4228+4 03AC B9 cp c ; if match
|
||
190: 4232+7+5 03AD 280B jr z, disassemble_table_first_match
|
||
191: 4239+7 03AF 0600 ld b,0
|
||
192: 4246+7 03B1 0E07 ld c,7
|
||
193: 4253+11 03B3 09 add hl,bc
|
||
194: 4264+7 03B4 7E ld a,(hl)
|
||
195: 4271+4 03B5 4F ld c,a
|
||
196: 4275+11 03B6 09 add hl,bc
|
||
197: 4286+6 03B7 23 inc hl
|
||
198: 4292+12 03B8 18E0 jr disassemble_table_seek_loop
|
||
199:
|
||
200: - 03BA disassemble_table_first_match
|
||
201: 4304+6 03BA 23 inc hl
|
||
202: 4310+6 03BB 23 inc hl
|
||
203: 4316+7 03BC 4E ld c,(hl) ;load opcode x from table
|
||
204: 4323+6 03BD 23 inc hl
|
||
205: 4329+13 03BE 3A1541 ld a,(var_opcode_x) ;load current opcode x
|
||
206: 4342+7 03C1 46 ld b,(hl) ;load mask
|
||
207: 4349+4 03C2 A0 and b ;apply mask
|
||
208: 4353+4 03C3 B9 cp c ;compare to table
|
||
209: 4357+6 03C4 2B dec hl
|
||
210: 4363+6 03C5 2B dec hl
|
||
211: 4369+6 03C6 2B dec hl
|
||
212: 4375+7+5 03C7 280B jr z, disassemble_table_found ;IF FOUND
|
||
213: 4382+7 03C9 0600 ld b,0 ;else continue with next
|
||
214:
|
||
215: 4389+7 03CB 0E07 ld c,7
|
||
216: 4396+11 03CD 09 add hl,bc
|
||
217: 4407+7 03CE 7E ld a,(hl)
|
||
218: 4414+4 03CF 4F ld c,a
|
||
219: 4418+11 03D0 09 add hl,bc
|
||
220: 4429+6 03D1 23 inc hl
|
||
221: 4435+12 03D2 18C6 jr disassemble_table_seek_loop
|
||
222:
|
||
223: - 03D4 disassemble_table_found
|
||
224: 4447+4 03D4 44 ld b,H
|
||
225: 4451+4 03D5 4D ld c,l
|
||
226: 4455+10 03D6 E1 pop hl
|
||
227: 4465+10 03D7 C9 ret
|
||
228:
|
||
229: - 03D8 disassemble_table_notfound
|
||
230: 4475+7 03D8 0600 ld b,0
|
||
231: 4482+7 03DA 0E00 ld c,0
|
||
232: 4489+10 03DC E1 pop hl
|
||
233: 4499+10 03DD C9 ret
|
||
234:
|
||
235:
|
||
236:
|
||
237:
|
||
238: - 03DE dasm_print16hex_addr:
|
||
239: 4509+7 03DE 3E24 ld a,"$"
|
||
240: 4516+17 03E0 CDF600 call print_char
|
||
241: 4533+4 03E3 7C ld a,h
|
||
242: 4537+17 03E4 CD2201 call print_a_hex
|
||
243: 4554+4 03E7 7D ld a,l
|
||
244: 4558+17 03E8 CD2201 call print_a_hex
|
||
245: 4575+7 03EB 3E68 ld a,"h"
|
||
246: 4582+17 03ED CDF600 call print_char
|
||
247: 4599+7 03F0 3E20 ld a," "
|
||
248: 4606+17 03F2 CDF600 call print_char
|
||
249: 4623+10 03F5 C9 ret
|
||
250:
|
||
251: - 03F6 dasm_print8hex:
|
||
252: 4633+17 03F6 CD2201 call print_a_hex
|
||
253: 4650+7 03F9 3E68 ld a,"h"
|
||
254: 4657+17 03FB CDF600 call print_char
|
||
255: 4674+7 03FE 3E20 ld a," "
|
||
256: 4681+17 0400 CDF600 call print_char
|
||
257: 4698+10 0403 C9 ret
|
||
258:
|
||
259:
|
||
260:
|
||
261:
|
||
262:
|
||
263:
|
||
264:
|
||
265: - 0404 param_01: ; 0x01 16bit address pointer
|
||
266: 4708+11 0404 E5 push hl
|
||
267: 4719+20 0405 ED5B1041 ld de,(var_opcode_start)
|
||
268: 4739+6 0409 13 inc de
|
||
269: 4745+7 040A 1A ld a,(de)
|
||
270: 4752+4 040B 6F ld l,a
|
||
271: 4756+6 040C 13 inc de
|
||
272: 4762+7 040D 1A ld a,(de)
|
||
273: 4769+4 040E 67 ld h,a
|
||
274:
|
||
275: 4773+7 040F 3E24 ld a,"$"
|
||
276: 4780+17 0411 CDF600 call print_char
|
||
277: 4797+4 0414 7C ld a,h
|
||
278: 4801+17 0415 CD2201 call print_a_hex
|
||
279: 4818+4 0418 7D ld a,l
|
||
280: 4822+17 0419 CD2201 call print_a_hex
|
||
281: 4839+7 041C 3E68 ld a,"h"
|
||
282: 4846+17 041E CDF600 call print_char
|
||
283: 4863+7 0421 3E20 ld a," "
|
||
284: 4870+17 0423 CDF600 call print_char
|
||
285: 4887+17 0426 CDA205 call param_comma
|
||
286: 4904+10 0429 E1 pop hl
|
||
287: 4914+10 042A C9 ret
|
||
288:
|
||
289: - 042B param_02:
|
||
290: 4924+11 042B C5 push bc
|
||
291: 4935+20 042C ED5B1041 ld de,(var_opcode_start)
|
||
292: 4955+7 0430 1A ld a,(de)
|
||
293: 4962+4 0431 1F rra
|
||
294: 4966+4 0432 1F rra
|
||
295: 4970+7 0433 E60E and 0x0E
|
||
296:
|
||
297: 4977+11 0435 E5 push hl
|
||
298: 4988+10 0436 21BC0D ld hl, [dasm_printFlags_table]
|
||
299: 4998+7 0439 0600 ld b,0
|
||
300: 5005+4 043B 4F ld c,a
|
||
301: 5009+11 043C 09 add hl,bc
|
||
302: 5020+17 043D CDFC00 call print_str
|
||
303: 5037+7 0440 3E20 ld a, " "
|
||
304: 5044+17 0442 CDF600 call print_char
|
||
305: 5061+10 0445 E1 pop hl
|
||
306: 5071+10 0446 C1 pop bc
|
||
307: 5081+10 0447 C9 ret
|
||
308:
|
||
309:
|
||
310: - 0448 param_03:
|
||
311: 5091+20 0448 ED5B1041 ld de,(var_opcode_start)
|
||
312: 5111+6 044C 13 inc de
|
||
313: 5117+7 044D 1A ld a,(de)
|
||
314:
|
||
315: 5124+11 044E F5 push af
|
||
316: 5135+7 044F E680 and 0x80
|
||
317: 5142+10 0451 C26904 jp nz, param_03_neg
|
||
318: 5152+7 0454 3E24 ld a,"$"
|
||
319: 5159+17 0456 CDF600 call print_char
|
||
320: 5176+7 0459 3E2B ld a,"+"
|
||
321: 5183+17 045B CDF600 call print_char
|
||
322: 5200+10 045E F1 pop af
|
||
323: 5210+17 045F CD2201 call print_a_hex
|
||
324: 5227+7 0462 3E68 ld a,"h"
|
||
325: 5234+17 0464 CDF600 call print_char
|
||
326: 5251+12 0467 1817 jr param_03_done
|
||
327:
|
||
328: - 0469 param_03_neg:
|
||
329: 5263+7 0469 3E24 ld a,"$"
|
||
330: 5270+17 046B CDF600 call print_char
|
||
331: 5287+7 046E 3E2D ld a,"-"
|
||
332: 5294+17 0470 CDF600 call print_char
|
||
333: 5311+10 0473 F1 pop af
|
||
334: 5321+8 0474 ED44 neg
|
||
335: 5329+17 0476 CD2201 call print_a_hex
|
||
336: 5346+7 0479 3E68 ld a,"h"
|
||
337: 5353+17 047B CDF600 call print_char
|
||
338: 5370+12 047E 1800 jr param_03_done
|
||
339:
|
||
340: - 0480 param_03_done:
|
||
341: 5382+17 0480 CDA205 call param_comma
|
||
342: 5399+10 0483 C9 ret
|
||
343:
|
||
344:
|
||
345: - 0484 param_04:
|
||
346: 5409+20 0484 ED5B1041 ld de,(var_opcode_start)
|
||
347: 5429+6 0488 13 inc de
|
||
348: 5435+7 0489 1A ld a,(de)
|
||
349: 5442+7 048A FE4D cp 0x4D
|
||
350: 5449+7+5 048C 2806 jr z,param_04_i
|
||
351: 5456+7 048E 3E4E ld a,"N"
|
||
352: 5463+17 0490 CDF600 call print_char
|
||
353: 5480+10 0493 C9 ret
|
||
354: - 0494 param_04_i:
|
||
355: 5490+7 0494 3E49 ld a,"I"
|
||
356: 5497+17 0496 CDF600 call print_char
|
||
357: 5514+10 0499 C9 ret
|
||
358:
|
||
359: - 049A param_05:
|
||
360: 5524+11 049A C5 push bc
|
||
361: 5535+20 049B ED5B1041 ld de,(var_opcode_start)
|
||
362: 5555+7 049F 1A ld a,(de)
|
||
363: 5562+7 04A0 E638 and 0x38
|
||
364: ; print hex char
|
||
365: 5569+17 04A2 CDF603 call dasm_print8hex
|
||
366: 5586+10 04A5 C1 pop bc
|
||
367: 5596+10 04A6 C9 ret
|
||
368:
|
||
369:
|
||
370: - 04A7 param_06:
|
||
371: 5606+11 04A7 C5 push bc
|
||
372: 5617+20 04A8 ED5B1041 ld de,(var_opcode_start)
|
||
373: 5637+7 04AC 1A ld a,(de)
|
||
374: 5644+4 04AD 1F rra
|
||
375: 5648+4 04AE 1F rra
|
||
376: 5652+4 04AF 1F rra
|
||
377: 5656+7 04B0 E607 and 0x07
|
||
378: 5663+17 04B2 CD7D05 call param_printRegister
|
||
379: 5680+7 04B5 3E20 ld a," "
|
||
380: 5687+17 04B7 CDF600 call print_char
|
||
381: 5704+7 04BA 3E2C ld a,","
|
||
382: 5711+17 04BC CDF600 call print_char
|
||
383: 5728+10 04BF C1 pop bc
|
||
384: 5738+10 04C0 C9 ret
|
||
385:
|
||
386: - 04C1 param_07:
|
||
387: 5748+11 04C1 C5 push bc
|
||
388: 5759+20 04C2 ED5B1041 ld de,(var_opcode_start)
|
||
389: 5779+7 04C6 1A ld a,(de)
|
||
390: 5786+7 04C7 E607 and 0x07
|
||
391:
|
||
392: 5793+17 04C9 CD7D05 call param_printRegister
|
||
393: 5810+10 04CC C1 pop bc
|
||
394: 5820+10 04CD C9 ret
|
||
395:
|
||
396: - 04CE param_08:
|
||
397: 5830+11 04CE C5 push bc
|
||
398: 5841+20 04CF ED5B1041 ld de,(var_opcode_start)
|
||
399: 5861+6 04D3 13 inc de
|
||
400: 5867+7 04D4 1A ld a,(de)
|
||
401: 5874+17 04D5 CDF603 call dasm_print8hex
|
||
402: 5891+10 04D8 C1 pop bc
|
||
403: 5901+10 04D9 C9 ret
|
||
404:
|
||
405:
|
||
406: - 04DA param_0A:
|
||
407: 5911+11 04DA E5 push hl
|
||
408: 5922+20 04DB ED5B1041 ld de,(var_opcode_start)
|
||
409: 5942+6 04DF 13 inc de
|
||
410: 5948+6 04E0 13 inc de
|
||
411: 5954+12 04E1 1806 jr param_09_0A
|
||
412: - 04E3 param_09:
|
||
413: 5966+11 04E3 E5 push hl
|
||
414: 5977+20 04E4 ED5B1041 ld de,(var_opcode_start)
|
||
415: 5997+6 04E8 13 inc de
|
||
416: - 04E9 param_09_0A:
|
||
417: 6003+7 04E9 1A ld a,(de)
|
||
418: 6010+4 04EA 6F ld l,a
|
||
419: 6014+6 04EB 13 inc de
|
||
420: 6020+7 04EC 1A ld a,(de)
|
||
421: 6027+4 04ED 67 ld h,a
|
||
422: 6031+4 04EE 7C ld a,h
|
||
423: 6035+17 04EF CD2201 call print_a_hex
|
||
424: 6052+4 04F2 7D ld a,l
|
||
425: 6056+17 04F3 CD2201 call print_a_hex
|
||
426: 6073+10 04F6 E1 pop hl
|
||
427: 6083+10 04F7 C9 ret
|
||
428:
|
||
429: - 04F8 param_10:
|
||
430: 6093+11 04F8 C5 push bc
|
||
431: 6104+20 04F9 ED5B1041 ld de,(var_opcode_start)
|
||
432: 6124+7 04FD 1A ld a,(de)
|
||
433: 6131+4 04FE 1F rra
|
||
434: 6135+4 04FF 1F rra
|
||
435: 6139+4 0500 1F rra
|
||
436: 6143+7 0501 E607 and 0x07
|
||
437: 6150+17 0503 CD7D05 call param_printRegister
|
||
438: 6167+10 0506 C1 pop bc
|
||
439: 6177+10 0507 C9 ret
|
||
440:
|
||
441:
|
||
442: - 0508 param_11:
|
||
443: 6187+11 0508 E5 push hl
|
||
444: 6198+11 0509 C5 push bc
|
||
445: 6209+20 050A ED5B1041 ld de,(var_opcode_start)
|
||
446: 6229+12 050E 1807 jr param_11_12
|
||
447: - 0510 param_12:
|
||
448: 6241+11 0510 E5 push hl
|
||
449: 6252+11 0511 C5 push bc
|
||
450: 6263+20 0512 ED5B1041 ld de,(var_opcode_start)
|
||
451: 6283+6 0516 13 inc de
|
||
452:
|
||
453: - 0517 param_11_12:
|
||
454: 6289+7 0517 1A ld a,(de)
|
||
455: 6296+4 0518 1F rra
|
||
456: 6300+4 0519 1F rra
|
||
457: 6304+4 051A 1F rra
|
||
458: 6308+7 051B E606 and 0x06
|
||
459: 6315+11 051D F5 push af
|
||
460: ;check which table to use
|
||
461: 6326+16 051E 2A1041 ld hl, (var_opcode_start)
|
||
462: 6342+7 0521 7E ld a,(hl)
|
||
463: 6349+7 0522 FEDD cp 0xDD
|
||
464: 6356+7+5 0524 2809 jr z,param_11_12_ix
|
||
465: 6363+7 0526 FEFD cp 0xFD
|
||
466: 6370+7+5 0528 280A jr z,param_11_12_iy
|
||
467: - 052A param_11_12_def:
|
||
468: 6377+10 052A 21CC0D ld hl, [dasm_printRegister8_table]
|
||
469: 6387+12 052D 1808 jr param_11_12_all
|
||
470: - 052F param_11_12_ix:
|
||
471: 6399+10 052F 21D40D ld hl, [dasm_printRegisterIX_table]
|
||
472: 6409+12 0532 1803 jr param_11_12_all
|
||
473: - 0534 param_11_12_iy:
|
||
474: 6421+10 0534 21DC0D ld hl, [dasm_printRegisterIY_table]
|
||
475: - 0537 param_11_12_all:
|
||
476: 6431+10 0537 F1 pop af
|
||
477: 6441+7 0538 0600 ld b,0
|
||
478: 6448+4 053A 4F ld c,a
|
||
479: 6452+11 053B 09 add hl, bc
|
||
480: 6463+7 053C 7E ld a,(hl)
|
||
481: 6470+17 053D CDF600 call print_char
|
||
482: 6487+6 0540 23 inc hl
|
||
483: 6493+7 0541 7E ld a,(hl)
|
||
484: 6500+17 0542 CDF600 call print_char
|
||
485: 6517+10 0545 C1 pop bc
|
||
486: 6527+10 0546 E1 pop hl
|
||
487: 6537+10 0547 C9 ret
|
||
488:
|
||
489: - 0548 param_13:
|
||
490: 6547+11 0548 E5 push hl
|
||
491: 6558+11 0549 C5 push bc
|
||
492: 6569+20 054A ED5B1041 ld de,(var_opcode_start)
|
||
493: 6589+7 054E 1A ld a,(de)
|
||
494: 6596+4 054F 1F rra
|
||
495: 6600+4 0550 1F rra
|
||
496: 6604+4 0551 1F rra
|
||
497: 6608+7 0552 E606 and 0x06
|
||
498: 6615+11 0554 F5 push af
|
||
499: ;check which table to use
|
||
500: 6626+16 0555 2A1041 ld hl, (var_opcode_start)
|
||
501: 6642+7 0558 7E ld a,(hl)
|
||
502: 6649+10 0559 21E40D ld hl, [dasm_printRegisterSP_table]
|
||
503: 6659+12 055C 18D9 jr param_11_12_all ;reuse code from 11_12
|
||
504:
|
||
505:
|
||
506: - 055E param_81:
|
||
507: 6671+11 055E E5 push hl
|
||
508: 6682+11 055F C5 push bc
|
||
509: 6693+16 0560 2A1741 ld hl, (var_opcode_string)
|
||
510: 6709+7 0563 0602 ld b,2
|
||
511: 6716+12 0565 1807 jr param_80_seek
|
||
512: - 0567 param_80:
|
||
513: 6728+11 0567 E5 push hl
|
||
514: 6739+11 0568 C5 push bc
|
||
515: 6750+16 0569 2A1741 ld hl, (var_opcode_string)
|
||
516: 6766+7 056C 0601 ld b,1
|
||
517: - 056E param_80_seek:
|
||
518: 6773+7 056E 7E ld a,(hl)
|
||
519: 6780+6 056F 23 inc hl
|
||
520: 6786+4 0570 A7 and a
|
||
521: 6790+7+5 0571 20FB jr nz, param_80_seek
|
||
522: ;found
|
||
523: 6797+4 0573 05 dec b ;found but counter too high
|
||
524: 6801+10 0574 C26E05 jp nz, param_80_seek
|
||
525:
|
||
526: 6811+17 0577 CDFC00 call print_str
|
||
527: 6828+10 057A C1 pop bc
|
||
528: 6838+10 057B E1 pop hl
|
||
529: 6848+10 057C C9 ret
|
||
530:
|
||
531:
|
||
532:
|
||
533: - 057D param_printRegister:
|
||
534: 6858+11 057D E5 push hl
|
||
535: 6869+7 057E FE06 cp 0x06
|
||
536: 6876+7+5 0580 2811 jr z, param_printRegisterHL
|
||
537: 6883+7 0582 FE07 cp 0x07
|
||
538: 6890+7+5 0584 2815 jr z, param_printRegisterA
|
||
539: 6897+10 0586 21CC0D ld hl, [dasm_printRegister8_table]
|
||
540: 6907+7 0589 0600 ld b,0
|
||
541: 6914+4 058B 4F ld c,a
|
||
542: 6918+11 058C 09 add hl,bc
|
||
543: 6929+7 058D 7E ld a, (hl)
|
||
544: 6936+17 058E CDF600 call print_char
|
||
545: 6953+10 0591 E1 pop hl
|
||
546: 6963+10 0592 C9 ret
|
||
547:
|
||
548: - 0593 param_printRegisterHL:
|
||
549: 6973+10 0593 21EC0D ld hl, [dasm_printRegister8_table_HL]
|
||
550: 6983+17 0596 CDFC00 call print_str
|
||
551: 7000+10 0599 E1 pop hl
|
||
552: 7010+10 059A C9 ret
|
||
553:
|
||
554: - 059B param_printRegisterA:
|
||
555: 7020+7 059B 3E41 ld a,"A"
|
||
556: 7027+17 059D CDF600 call print_char
|
||
557: 7044+10 05A0 E1 pop hl
|
||
558: 7054+10 05A1 C9 ret
|
||
559:
|
||
560:
|
||
561: - 05A2 param_comma:
|
||
562: 7064+4 05A2 78 ld a,b
|
||
563: 7068+7 05A3 FE01 cp 1
|
||
564: 7075+5+6 05A5 C8 ret z
|
||
565: 7080+7 05A6 3E20 ld a," "
|
||
566: 7087+17 05A8 CDF600 call print_char
|
||
567: 7104+7 05AB 3E2C ld a,","
|
||
568: 7111+17 05AD CDF600 call print_char
|
||
**** main.asm ****
|
||
205: 7128+10 05B0 C9 ret
|
||
206: .include "disassembler_table.s"
|
||
**** include/disassembler_table.s ****
|
||
1: ;disassembler tables
|
||
2:
|
||
3: - 05B1 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: - 05B1 00FF0000 defb 0x00, 0xFF, 0x00, 0x00, 1, [dasm_00], [dasm_00]>>8,0 ;NOP
|
||
01090A00
|
||
29: ;General-Purpose Arithmetic and CPU Control Groups
|
||
30: - 05B9 27FF0000 defb 0x27, 0xFF, 0x00, 0x00, 1, [dasm_27], [dasm_27]>>8, 0 ;DAA
|
||
01D40A00
|
||
31: - 05C1 2FFF0000 defb 0x2F, 0xFF, 0x00, 0x00, 1, [dasm_2F], [dasm_2F]>>8, 0 ;CPL
|
||
01D80A00
|
||
32: - 05C9 EDFF44FF defb 0xED, 0xFF, 0x44, 0xFF, 2, [dasm_ED_44], [dasm_ED_44]>>8, 0 ;NEG
|
||
02DC0A00
|
||
33: - 05D1 3FFF0000 defb 0x3f, 0xFF, 0x00, 0x00, 1, [dasm_3F], [dasm_3F]>>8, 0 ;CCF
|
||
01E00A00
|
||
34: - 05D9 37FF0000 defb 0x37, 0xFF, 0x00, 0x00, 1, [dasm_37], [dasm_37]>>8, 0 ;SCF
|
||
01E40A00
|
||
35: ;defb 0x00, 0xFF, 0x00, 0x00, 1, [dasm_00], [dasm_00]>>8,0 ;NOP -> already at top for performance reasons
|
||
36: - 05E1 76FF0000 defb 0x76, 0xFF, 0x00, 0x00, 1, [dasm_76], [dasm_76]>>8, 0 ;HALT
|
||
01E80A00
|
||
37: - 05E9 F3FF0000 defb 0xF3, 0xFF, 0x00, 0x00, 1, [dasm_F3], [dasm_F3]>>8, 0 ;DI
|
||
01ED0A00
|
||
38: - 05F1 FBFF0000 defb 0xFB, 0xFF, 0x00, 0x00, 1, [dasm_FB], [dasm_FB]>>8, 0 ;EI
|
||
01F00A00
|
||
39: - 05F9 EDFF46FF defb 0xED, 0xFF, 0x46, 0xFF, 2, [dasm_ED_46], [dasm_ED_46]>>8, 0 ;IM 0
|
||
02F30A00
|
||
40: - 0601 EDFF56FF defb 0xED, 0xFF, 0x56, 0xFF, 2, [dasm_ED_56], [dasm_ED_56]>>8, 0 ;IM 1
|
||
02F80A00
|
||
41: - 0609 EDFF5EFF defb 0xED, 0xFF, 0x5E, 0xFF, 2, [dasm_ED_5E], [dasm_ED_5E]>>8, 0 ;IM 2
|
||
02FD0A00
|
||
42:
|
||
43: ;Exchange, Block Transfer, and Search Group
|
||
44: - 0611 EBFF0000 defb 0xEB, 0xFF, 0x00, 0x00, 1, [dasm_BE], [dasm_BE]>>8, 0 ;EX DE, HL
|
||
01020B00
|
||
45: - 0619 08FF0000 defb 0x08, 0xFF, 0x00, 0x00, 1, [dasm_08], [dasm_08]>>8, 0 ;EX AF, AF′
|
||
010C0B00
|
||
46: - 0621 D9FF0000 defb 0xD9, 0xFF, 0x00, 0x00, 1, [dasm_D9], [dasm_D9]>>8, 0 ;EXX
|
||
01190B00
|
||
47: - 0629 E3FF0000 defb 0xE3, 0xFF, 0x00, 0x00, 1, [dasm_E3], [dasm_E3]>>8, 0 ;EX (SP), HL
|
||
011D0B00
|
||
48: - 0631 DDFFE3FF defb 0xDD, 0xFF, 0xE3, 0xFF, 2, [dasm_DD_E3], [dasm_DD_E3]>>8, 0 ;EX (SP), IX
|
||
02290B00
|
||
49: - 0639 FDFFE3FF defb 0xFD, 0xFF, 0xE3, 0xFF, 2, [dasm_FD_E3], [dasm_FD_E3]>>8, 0 ;EX (SP), IY
|
||
02350B00
|
||
50: - 0641 EDFFA0FF defb 0xED, 0xFF, 0xA0, 0xFF, 2, [dasm_ED_A0], [dasm_ED_A0]>>8, 0 ;LDI
|
||
02410B00
|
||
51: - 0649 EDFFB0FF defb 0xED, 0xFF, 0xB0, 0xFF, 2, [dasm_ED_B0], [dasm_ED_B0]>>8, 0 ;LDIR
|
||
02450B00
|
||
52: - 0651 EDFFA8FF defb 0xED, 0xFF, 0xA8, 0xFF, 2, [dasm_ED_A8], [dasm_ED_A8]>>8, 0 ;LDD
|
||
024A0B00
|
||
53: - 0659 EDFFB8FF defb 0xED, 0xFF, 0xB8, 0xFF, 2, [dasm_ED_B8], [dasm_ED_B8]>>8, 0 ;LDDR
|
||
024E0B00
|
||
54: - 0661 EDFFA1FF defb 0xED, 0xFF, 0xA1, 0xFF, 2, [dasm_ED_A1], [dasm_ED_A1]>>8, 0 ;CPI
|
||
02530B00
|
||
55: - 0669 EDFFB1FF defb 0xED, 0xFF, 0xB1, 0xFF, 2, [dasm_ED_B1], [dasm_ED_B1]>>8, 0 ;CPIR
|
||
02570B00
|
||
56: - 0671 EDFFA9FF defb 0xED, 0xFF, 0xA9, 0xFF, 2, [dasm_ED_A9], [dasm_ED_A9]>>8, 0 ;CPD
|
||
025C0B00
|
||
57: - 0679 EDFFB9FF defb 0xED, 0xFF, 0xB9, 0xFF, 2, [dasm_ED_B9], [dasm_ED_B9]>>8, 0 ;CPDR
|
||
02600B00
|
||
58:
|
||
59: ;JUMP Group
|
||
60: - 0681 C3FF0000 defb 0xC3, 0xFF, 0x00, 0x00, 3, [dasm_C3], [dasm_C3]>>8,1, 0x01 ;JP nn
|
||
030D0A01
|
||
01
|
||
61: - 068A C2C70000 defb 0xC2, 0xC7, 0x00, 0x00, 3, [dasm_C3], [dasm_C3]>>8,3, 0x02, 0x80, 0x01 ;JP cc,nn
|
||
030D0A03
|
||
028001
|
||
62: - 0695 18FF0000 defb 0x18, 0xFF, 0x00, 0x00, 2, [dasm_18], [dasm_18]>>8,1, 0x03 ;JR e
|
||
02140A01
|
||
03
|
||
63: - 069E 38FF0000 defb 0x38, 0xFF, 0x00, 0x00, 2, [dasm_38], [dasm_38]>>8,1, 0x03 ;JR C,e
|
||
02180A01
|
||
03
|
||
64: - 06A7 30FF0000 defb 0x30, 0xFF, 0x00, 0x00, 2, [dasm_30], [dasm_30]>>8,1, 0x03 ;JR NC,e
|
||
021F0A01
|
||
03
|
||
65: - 06B0 28FF0000 defb 0x28, 0xFF, 0x00, 0x00, 2, [dasm_28], [dasm_28]>>8,1, 0x03 ;JR Z,e
|
||
02270A01
|
||
03
|
||
66: - 06B9 20FF0000 defb 0x20, 0xFF, 0x00, 0x00, 2, [dasm_20], [dasm_20]>>8,1, 0x03 ;JR NZ,e
|
||
022E0A01
|
||
03
|
||
67: - 06C2 E9FF0000 defb 0xE9, 0xFF, 0x00, 0x00, 2, [dasm_E9], [dasm_E9]>>8,0 ;JP (HL)
|
||
02360A00
|
||
68: - 06CA DDFFE9FF defb 0xDD, 0xFF, 0xE9, 0xFF, 2, [dasm_DD], [dasm_DD]>>8,0 ;JP (IX)
|
||
023F0A00
|
||
69: - 06D2 FDFFE9FF defb 0xFD, 0xFF, 0xE9, 0xFF, 2, [dasm_FD], [dasm_FD]>>8,0 ;JP (IY)
|
||
02480A00
|
||
70: - 06DA 10FF0000 defb 0x10, 0xFF, 0x00, 0x00, 2, [dasm_10], [dasm_10]>>8,1, 0x03 ;DJNZ, e
|
||
02510A01
|
||
03
|
||
71: ;Call and Return Group
|
||
72: - 06E3 CDFF0000 defb 0xCD, 0xFF, 0x00, 0x00, 3, [dasm_CD], [dasm_CD]>>8,1, 0x01 ;CALL nn
|
||
03570A01
|
||
01
|
||
73: - 06EC C4C70000 defb 0xC4, 0xC7, 0x00, 0x00, 3, [dasm_CD], [dasm_CD]>>8,2, 0x02, 0x01 ;CALL cc,nn
|
||
03570A02
|
||
0201
|
||
74: - 06F6 C9FF0000 defb 0xC9, 0xFF, 0x00, 0x00, 1, [dasm_C9], [dasm_C9]>>8,0 ;RET
|
||
015D0A00
|
||
75: - 06FE C0C70000 defb 0xC0, 0xC7, 0x00, 0x00, 1, [dasm_C9], [dasm_C9]>>8,1, 0x02 ;RET cc
|
||
015D0A01
|
||
02
|
||
76: - 0707 EDFF4DFF defb 0xED, 0xFF, 0x4D, 0xFF, 2, [dasm_ED_4D], [dasm_ED_4D]>>8,0 ;RETI
|
||
02620A00
|
||
77: - 070F EDFF45FF defb 0xED, 0xFF, 0x45, 0xFF, 2, [dasm_ED_45], [dasm_ED_45]>>8,0 ;RETN
|
||
02670A00
|
||
78:
|
||
79: - 0717 C7C70000 defb 0xC7, 0xC7, 0x00, 0x00, 1, [dasm_FF], [dasm_FF]>>8,1, 0x05 ;RST
|
||
016C0A01
|
||
05
|
||
80: ;8-Bit load group
|
||
81: - 0720 0AFF0000 defb 0x0A, 0xFF, 0x00, 0x00, 1, [dasm_0A], [dasm_0A]>>8, 0 ;LD A, (BC)
|
||
01710A00
|
||
82: - 0728 1AFF0000 defb 0x1A, 0xFF, 0x00, 0x00, 1, [dasm_1A], [dasm_1A]>>8, 0 ;LD A, (DE)
|
||
017B0A00
|
||
83: - 0730 3AFF0000 defb 0x3A, 0xFF, 0x00, 0x00, 3, [dasm_3A], [dasm_3A]>>8, 2, 0x09, 0x80 ;LD A, (nn)
|
||
03850A02
|
||
0980
|
||
84: - 073A 02FF0000 defb 0x02, 0xFF, 0x00, 0x00, 1, [dasm_02], [dasm_02]>>8, 0 ;LD (BC), A
|
||
018F0A00
|
||
85: - 0742 12FF0000 defb 0x12, 0xFF, 0x00, 0x00, 1, [dasm_12], [dasm_12]>>8, 0 ;LD (DE), A
|
||
019A0A00
|
||
86: - 074A 32FF0000 defb 0x32, 0xFF, 0x00, 0x00, 3, [dasm_32], [dasm_32]>>8, 2, 0x09, 0x80 ;LD (nn), A
|
||
03A50A02
|
||
0980
|
||
87: - 0754 EDFF57FF defb 0xED, 0xFF, 0x57, 0xFF, 2, [dasm__ED_57], [dasm__ED_57]>>8, 0 ;LD A, I
|
||
02B40A00
|
||
88: - 075C EDFF5FFF defb 0xED, 0xFF, 0x5F, 0xFF, 2, [dasm__ED_5F], [dasm__ED_5F]>>8, 0 ;LD A, R
|
||
02BC0A00
|
||
89: - 0764 EDFF47FF defb 0xED, 0xFF, 0x47, 0xFF, 2, [dasm__ED_47], [dasm__ED_47]>>8, 0 ;LD I, A
|
||
02C40A00
|
||
90: - 076C EDFF4FFF defb 0xED, 0xFF, 0x4F, 0xFF, 2, [dasm__ED_4F], [dasm__ED_4F]>>8, 0 ;LD R, A
|
||
02CC0A00
|
||
91:
|
||
92: - 0774 06C70000 defb 0x06, 0xC7, 0x00, 0x00, 2, [dasm__LD], [dasm__LD]>>8, 2, 0x06, 0x08 ;LD r, n
|
||
02B00A02
|
||
0608
|
||
93: - 077E 40C00000 defb 0x40, 0xC0, 0x00, 0x00, 1, [dasm__LD], [dasm__LD]>>8, 2, 0x06, 0x07 ;LD r, r' / LD r, (HL) / LD (HL), r
|
||
01B00A02
|
||
0607
|
||
94:
|
||
95: ;8-Bit Arithmetic Group
|
||
96: - 0788 80F80000 defb 0x80, 0xF8, 0x00, 0x00, 1, [dasm_80C6], [dasm_80C6]>>8, 1, 0x07 ;ADD A, r / ADD A, (HL)
|
||
01650B01
|
||
07
|
||
97: - 0791 C6FF0000 defb 0xC6, 0xFF, 0x00, 0x00, 2, [dasm_80C6], [dasm_80C6]>>8, 1, 0x08 ;ADD A, n
|
||
02650B01
|
||
08
|
||
98: - 079A DDFF86FF defb 0xDD, 0xFF, 0x86, 0xFF, 3, [dasm_DD_86], [dasm_DD_86]>>8, 2, 0x08, 0x80 ;ADD A, (IX + d)
|
||
036D0B02
|
||
0880
|
||
99: - 07A4 FDFF86FF defb 0xFD, 0xFF, 0x86, 0xFF, 3, [dasm_FD_86], [dasm_FD_86]>>8, 2, 0x08, 0x80 ;ADD A, (IY + d)
|
||
037C0B02
|
||
0880
|
||
100: - 07AE C8F80000 defb 0xC8, 0xF8, 0x00, 0x00, 1, [dasm_C88E], [dasm_C88E]>>8, 1, 0x07 ;ADC A, r / ADC A, (HL)
|
||
018B0B01
|
||
07
|
||
101: - 07B7 8EF80000 defb 0x8E, 0xF8, 0x00, 0x00, 2, [dasm_C88E], [dasm_C88E]>>8, 1, 0x08 ;ADC A, n
|
||
028B0B01
|
||
08
|
||
102: - 07C0 DDFF8EFF defb 0xDD, 0xFF, 0x8E, 0xFF, 3, [dasm_DD_8E], [dasm_DD_8E]>>8, 2, 0x08, 0x80 ;ADC A, (IX + d)
|
||
03930B02
|
||
0880
|
||
103: - 07CA FDFF8EFF defb 0xFD, 0xFF, 0x8E, 0xFF, 3, [dasm_FD_8E], [dasm_FD_8E]>>8, 2, 0x08, 0x80 ;ADC A, (IY + d)
|
||
03A20B02
|
||
0880
|
||
104: - 07D4 90F80000 defb 0x90, 0xF8, 0x00, 0x00, 1, [dasm__SUB], [dasm__SUB]>>8, 1, 0x07 ;SUB r / SUB A, (HL)
|
||
01B10B01
|
||
07
|
||
105: - 07DD D6FF0000 defb 0xD6, 0xFF, 0x00, 0x00, 2, [dasm__SUB], [dasm__SUB]>>8, 1, 0x08 ;SUB n
|
||
02B10B01
|
||
08
|
||
106: - 07E6 DDFF96FF defb 0xDD, 0xFF, 0x96, 0xFF, 3, [dasm_DD_96], [dasm_DD_96]>>8, 2, 0x08, 0x80 ;SUB (IX + d)
|
||
03B60B02
|
||
0880
|
||
107: - 07F0 FDFF96FF defb 0xFD, 0xFF, 0x96, 0xFF, 3, [dasm_FD_96], [dasm_FD_96]>>8, 2, 0x08, 0x80 ;SUB (IY + d)
|
||
03C20B02
|
||
0880
|
||
108: - 07FA 94F80000 defb 0x94, 0xF8, 0x00, 0x00, 1, [dasm__SBC], [dasm__SBC]>>8, 1, 0x07 ;SBC A,r / SBC A, (HL)
|
||
01CE0B01
|
||
07
|
||
109: - 0803 DEFF0000 defb 0xDE, 0xFF, 0x00, 0x00, 2, [dasm__SBC], [dasm__SBC]>>8, 1, 0x08 ;SBC A,n
|
||
02CE0B01
|
||
08
|
||
110: - 080C DDFF9EFF defb 0xDD, 0xFF, 0x9E, 0xFF, 3, [dasm_DD_9E], [dasm_DD_9E]>>8, 2, 0x08, 0x80 ;SBC A,(IX + d)
|
||
03D60B02
|
||
0880
|
||
111: - 0816 FDFF9EFF defb 0xFD, 0xFF, 0x9E, 0xFF, 3, [dasm_FD_9E], [dasm_FD_9E]>>8, 2, 0x08, 0x80 ;SBC A,(IY + d)
|
||
03E40B02
|
||
0880
|
||
112: - 0820 A0F80000 defb 0xA0, 0xF8, 0x00, 0x00, 1, [dasm__AND], [dasm__AND]>>8, 1, 0x07 ;AND A,r / AND A, (HL)
|
||
01F20B01
|
||
07
|
||
113: - 0829 E6FF0000 defb 0xE6, 0xFF, 0x00, 0x00, 2, [dasm__AND], [dasm__AND]>>8, 1, 0x08 ;AND A,n
|
||
02F20B01
|
||
08
|
||
114: - 0832 DDFFA6FF defb 0xDD, 0xFF, 0xA6, 0xFF, 3, [dasm_DD_A6], [dasm_DD_A6]>>8, 2, 0x08, 0x80 ;AND A,(IX + d)
|
||
03F70B02
|
||
0880
|
||
115: - 083C FDFFA6FF defb 0xFD, 0xFF, 0xA6, 0xFF, 3, [dasm_FD_A6], [dasm_FD_A6]>>8, 2, 0x08, 0x80 ;AND A,(IY + d)
|
||
03030C02
|
||
0880
|
||
116: - 0846 B0F80000 defb 0xB0, 0xF8, 0x00, 0x00, 1, [dasm__OR], [dasm__OR]>>8, 1, 0x07 ;OR A,r / OR A, (HL)
|
||
010F0C01
|
||
07
|
||
117: - 084F F6FF0000 defb 0xF6, 0xFF, 0x00, 0x00, 2, [dasm__OR], [dasm__OR]>>8, 1, 0x08 ;OR A,n
|
||
020F0C01
|
||
08
|
||
118: - 0858 DDFFB6FF defb 0xDD, 0xFF, 0xB6, 0xFF, 3, [dasm_DD_B6], [dasm_DD_B6]>>8, 2, 0x08, 0x80 ;OR A,(IX + d)
|
||
03130C02
|
||
0880
|
||
119: - 0862 FDFFB6FF defb 0xFD, 0xFF, 0xB6, 0xFF, 3, [dasm_FD_B6], [dasm_FD_B6]>>8, 2, 0x08, 0x80 ;OR A,(IY + d)
|
||
031E0C02
|
||
0880
|
||
120: - 086C A8F80000 defb 0xA8, 0xF8, 0x00, 0x00, 1, [dasm__XOR], [dasm__XOR]>>8, 1, 0x07 ;XOR A,r / XOR A, (HL)
|
||
01290C01
|
||
07
|
||
121: - 0875 EEFF0000 defb 0xEE, 0xFF, 0x00, 0x00, 2, [dasm__XOR], [dasm__XOR]>>8, 1, 0x08 ;XOR A,n
|
||
02290C01
|
||
08
|
||
122: - 087E DDFFAEFF defb 0xDD, 0xFF, 0xAE, 0xFF, 3, [dasm_DD_AE], [dasm_DD_AE]>>8, 2, 0x08, 0x80 ;XOR A,(IX + d)
|
||
032E0C02
|
||
0880
|
||
123: - 0888 FDFFAEFF defb 0xFD, 0xFF, 0xAE, 0xFF, 3, [dasm_FD_AE], [dasm_FD_AE]>>8, 2, 0x08, 0x80 ;XOR A,(IY + d)
|
||
033A0C02
|
||
0880
|
||
124: - 0892 B8F80000 defb 0xB8, 0xF8, 0x00, 0x00, 1, [dasm__CP], [dasm__CP]>>8, 1, 0x07 ;CP A,r / CP A, (HL)
|
||
01460C01
|
||
07
|
||
125: - 089B FEFF0000 defb 0xFE, 0xFF, 0x00, 0x00, 2, [dasm__CP], [dasm__CP]>>8, 1, 0x08 ;CP A,n
|
||
02460C01
|
||
08
|
||
126: - 08A4 DDFFBEFF defb 0xDD, 0xFF, 0xBE, 0xFF, 3, [dasm_DD_BE], [dasm_DD_BE]>>8, 2, 0x08, 0x80 ;CP A,(IX + d)
|
||
034A0C02
|
||
0880
|
||
127: - 08AE FDFFBEFF defb 0xFD, 0xFF, 0xBE, 0xFF, 3, [dasm_FD_BE], [dasm_FD_BE]>>8, 2, 0x08, 0x80 ;CP A,(IY + d)
|
||
03550C02
|
||
0880
|
||
128: - 08B8 04C70000 defb 0x04, 0xC7, 0x00, 0x00, 1, [dasm__INC], [dasm__INC]>>8, 1, 0x10 ;INC r / INC (HL)
|
||
01600C01
|
||
10
|
||
129: - 08C1 DDFF34FF defb 0xDD, 0xFF, 0x34, 0xFF, 3, [dasm_DD_34], [dasm_DD_34]>>8, 2, 0x08, 0x80 ;INC (IX + d)
|
||
03650C02
|
||
0880
|
||
130: - 08CB FDFF34FF defb 0xFD, 0xFF, 0x34, 0xFF, 3, [dasm_FD_34], [dasm_FD_34]>>8, 2, 0x08, 0x80 ;INC (IY + d)
|
||
03710C02
|
||
0880
|
||
131: - 08D5 05C70000 defb 0x05, 0xC7, 0x00, 0x00, 1, [dasm__DEC], [dasm__DEC]>>8, 1, 0x10 ;DEC r / DEC (HL)
|
||
017D0C01
|
||
10
|
||
132: - 08DE DDFF35FF defb 0xDD, 0xFF, 0x35, 0xFF, 3, [dasm_DD_35], [dasm_DD_35]>>8, 2, 0x08, 0x80 ;DEC (IX + d)
|
||
03820C02
|
||
0880
|
||
133: - 08E8 FDFF35FF defb 0xFD, 0xFF, 0x35, 0xFF, 3, [dasm_FD_35], [dasm_FD_35]>>8, 2, 0x08, 0x80 ;DEC (IY + d)
|
||
038E0C02
|
||
0880
|
||
134: ;16-Bit Arithmetic Group
|
||
135: - 08F2 09CF0000 defb 0x09, 0xCF, 0x00, 0x00, 1, [dasm_09], [dasm_09]>>8, 1, 0x11 ;ADD HL, ss
|
||
019A0C01
|
||
11
|
||
136: - 08FB EDFF4ACF defb 0xED, 0xFF, 0x4A, 0xCF, 2, [dasm_ED_4A], [dasm_ED_4A]>>8, 1, 0x12 ;ADC HL, ss
|
||
02A30C01
|
||
12
|
||
137: - 0904 EDFF42CF defb 0xED, 0xFF, 0x42, 0xCF, 2, [dasm_ED_42], [dasm_ED_42]>>8, 1, 0x12 ;SBC HL, ss
|
||
02AC0C01
|
||
12
|
||
138: - 090D DDFF09CF defb 0xDD, 0xFF, 0x09, 0xCF, 2, [dasm_DD_09], [dasm_DD_09]>>8, 1, 0x12 ;ADD IX, ss
|
||
02B50C01
|
||
12
|
||
139: - 0916 FDFF09CF defb 0xFD, 0xFF, 0x09, 0xCF, 2, [dasm_FD_09], [dasm_FD_09]>>8, 1, 0x12 ;ADD IY, ss
|
||
02BE0C01
|
||
12
|
||
140: - 091F 03CF0000 defb 0x03, 0xCF, 0x00, 0x00, 1, [dasm_03], [dasm_03]>>8, 1, 0x11 ;INC ss
|
||
01C70C01
|
||
11
|
||
141: - 0928 DDFF23FF defb 0xDD, 0xFF, 0x23, 0xFF, 2, [dasm_DD_23], [dasm_DD_23]>>8, 0 ;INC IX
|
||
02CC0C00
|
||
142: - 0930 FDFF23FF defb 0xFD, 0xFF, 0x23, 0xFF, 2, [dasm_FD_23], [dasm_FD_23]>>8, 0 ;INC IY
|
||
02D50C00
|
||
143: - 0938 0BCF0000 defb 0x0B, 0xCF, 0x00, 0x00, 1, [dasm_0B], [dasm_0B]>>8, 1, 0x11 ;DEC ss
|
||
01DE0C01
|
||
11
|
||
144: - 0941 DDFF2BFF defb 0xDD, 0xFF, 0x2B, 0xFF, 2, [dasm_DD_2B], [dasm_DD_2B]>>8, 0 ;DEC IX
|
||
02E30C00
|
||
145: - 0949 FDFF2BFF defb 0xFD, 0xFF, 0x2B, 0xFF, 2, [dasm_FD_2B], [dasm_FD_2B]>>8, 0 ;DEC IY
|
||
02EC0C00
|
||
146: ;16-Bit Load Group
|
||
147: - 0951 01CF0000 defb 0x01, 0xCF, 0x00, 0x00, 3, [dasm_01], [dasm_01]>>8, 3, 0x11, 0x80, 0x09 ;LD dd, nn
|
||
03F50C03
|
||
118009
|
||
148: - 095C DDFF21FF defb 0xDD, 0xFF, 0x21, 0xFF, 4, [dasm_DD_01], [dasm_DD_01]>>8, 1, 0x0A ;LD IX, nn
|
||
04FC0C01
|
||
0A
|
||
149: - 0965 FDFF21FF defb 0xFD, 0xFF, 0x21, 0xFF, 4, [dasm_FD_01], [dasm_FD_01]>>8, 1, 0x0A ;LD IY, nn
|
||
04040D01
|
||
0A
|
||
150: - 096E 2AFF0000 defb 0x2A, 0xFF, 0x00, 0x00, 3, [dasm_2A], [dasm_2A]>>8, 2, 0x09, 0x80 ;LD HL, (nn)
|
||
030C0D02
|
||
0980
|
||
151: - 0978 EDFF4BCF defb 0xED, 0xFF, 0x4B, 0xCF, 4, [dasm_ED_4B], [dasm_ED_4B]>>8, 4, 0x12, 0x80, 0x0A, 0x81 ;LD dd, (nn)
|
||
04180D04
|
||
12800A81
|
||
152: - 0984 DDFF2AFF defb 0xDD, 0xFF, 0x2A, 0xFF, 4, [dasm_DD_2A], [dasm_DD_2A]>>8, 1, 0x0A ;LD IX, (nn)
|
||
04230D01
|
||
0A
|
||
153: - 098D FDFF2AFF defb 0xFD, 0xFF, 0x2A, 0xFF, 4, [dasm_FD_2A], [dasm_FD_2A]>>8, 1, 0x0A ;LD IY, (nn)
|
||
042F0D01
|
||
0A
|
||
154: - 0996 22FF0000 defb 0x22, 0xFF, 0x00, 0x00, 3, [dasm_22], [dasm_22]>>8, 2, 0x0A, 0x80 ;LD (nn), HL
|
||
033B0D02
|
||
0A80
|
||
155: - 09A0 EDFF43CF defb 0xED, 0xFF, 0x43, 0xCF, 4, [dasm_ED_43], [dasm_ED_43]>>8, 3, 0x0A, 0x80, 0x12 ;LD (nn), dd
|
||
04470D03
|
||
0A8012
|
||
156: - 09AB DDFF22CF defb 0xDD, 0xFF, 0x22, 0xCF, 4, [dasm_DD_22], [dasm_DD_22]>>8, 2, 0x0A, 0x80 ;LD (nn), IX
|
||
04510D02
|
||
0A80
|
||
157: - 09B5 FDFF22CF defb 0xFD, 0xFF, 0x22, 0xCF, 4, [dasm_FD_22], [dasm_FD_22]>>8, 2, 0x0A, 0x80 ;LD (nn), IY
|
||
045D0D02
|
||
0A80
|
||
158: - 09BF F9FF0000 defb 0xF9, 0xFF, 0x00, 0x00, 1, [dasm_F9], [dasm_F9]>>8, 0 ;LD SP, HL
|
||
01690D00
|
||
159: - 09C7 DDFFF9FF defb 0xDD, 0xFF, 0xF9, 0xFF, 2, [dasm_DD_F9], [dasm_DD_F9]>>8, 0 ;LD SP, IX
|
||
02730D00
|
||
160: - 09CF FDFFF9FF defb 0xFD, 0xFF, 0xF9, 0xFF, 2, [dasm_FD_F9], [dasm_FD_F9]>>8, 0 ;LD SP, IY
|
||
027D0D00
|
||
161: - 09D7 C5CF0000 defb 0xC5, 0xCF, 0x00, 0x00, 1, [dasm_E5], [dasm_E5]>>8, 1, 0x13 ;PUSH qq
|
||
01870D01
|
||
13
|
||
162: - 09E0 DDFFE5FF defb 0xDD, 0xFF, 0xE5, 0xFF, 2, [dasm_DD_E5], [dasm_DD_E5]>>8, 0 ;PUSH IX
|
||
028D0D00
|
||
163: - 09E8 FDFFE5FF defb 0xFD, 0xFF, 0xE5, 0xFF, 2, [dasm_FD_E5], [dasm_FD_E5]>>8, 0 ;PUSH IY
|
||
02950D00
|
||
164: - 09F0 C1CF0000 defb 0xC1, 0xCF, 0x00, 0x00, 1, [dasm_E1], [dasm_E1]>>8, 1, 0x13 ;POP qq
|
||
019D0D01
|
||
13
|
||
165: - 09F9 DDFFE1FF defb 0xDD, 0xFF, 0xE1, 0xFF, 2, [dasm_DD_E1], [dasm_DD_E1]>>8, 0 ;POP IX
|
||
02A30D00
|
||
166: - 0A01 FDFFE1FF defb 0xFD, 0xFF, 0xE1, 0xFF, 2, [dasm_FD_E1], [dasm_FD_E1]>>8, 0 ;POP IY
|
||
02AB0D00
|
||
167:
|
||
168:
|
||
169: - 0A09 4E4F5000 dasm_00: db "NOP",0x00
|
||
170: ;JUMP Group
|
||
171: - 0A0D 4A502000 dasm_C3: db "JP ",0x00,", ",0x00
|
||
2C2000
|
||
172: - 0A14 4A522000 dasm_18: db "JR ",0x00
|
||
173: - 0A18 4A522043 dasm_38: db "JR C, ",0x00
|
||
2C2000
|
||
174: - 0A1F 4A52204E dasm_30: db "JR NC, ",0x00
|
||
432C2000
|
||
175: - 0A27 4A52205A dasm_28: db "JR Z, ",0x00
|
||
2C2000
|
||
176: - 0A2E 4A52204E dasm_20: db "JR NZ, ",0x00
|
||
5A2C2000
|
||
177: - 0A36 4A502028 dasm_E9: db "JP (HL) ",0x00
|
||
484C2920
|
||
00
|
||
178: - 0A3F 4A502028 dasm_DD: db "JP (IX) ",0x00
|
||
49582920
|
||
00
|
||
179: - 0A48 4A502028 dasm_FD: db "JP (IY) ",0x00
|
||
49592920
|
||
00
|
||
180: - 0A51 444A4E5A dasm_10: db "DJNZ ",0x00
|
||
2000
|
||
181: ;Call and Return Group
|
||
182: - 0A57 43414C4C dasm_CD: db "CALL ",0x00
|
||
2000
|
||
183: - 0A5D 52455420 dasm_C9: db "RET ",0x00
|
||
00
|
||
184: - 0A62 52455449 dasm_ED_4D: db "RETI",0x00
|
||
00
|
||
185: - 0A67 5245544E dasm_ED_45: db "RETN",0x00
|
||
00
|
||
186: - 0A6C 52535420 dasm_FF: db "RST ",0x00
|
||
00
|
||
187: ;8-Bit load group
|
||
188: - 0A71 4C442041 dasm_0A: db "LD A,(BC)",0x00
|
||
2C284243
|
||
2900
|
||
189: - 0A7B 4C442041 dasm_1A: db "LD A,(DE)",0x00
|
||
2C284445
|
||
2900
|
||
190: - 0A85 4C442041 dasm_3A: db "LD A,(",0x00, "h)",0x00
|
||
2C280068
|
||
2900
|
||
191: - 0A8F 4C442028 dasm_02: db "LD (BC), A",0x00
|
||
4243292C
|
||
204100
|
||
192: - 0A9A 4C442028 dasm_12: db "LD (DE), A",0x00
|
||
4445292C
|
||
204100
|
||
193: - 0AA5 4C442028 dasm_32: db "LD (",0x00, "h), A",0x00
|
||
0068292C
|
||
204100
|
||
194: - 0AB0 4C442000 dasm__LD: db "LD ",0x00
|
||
195: - 0AB4 4C442041 dasm__ED_57: db "LD A, I",0x00
|
||
2C204900
|
||
196: - 0ABC 4C442041 dasm__ED_5F: db "LD A, R",0x00
|
||
2C205200
|
||
197: - 0AC4 4C442049 dasm__ED_47: db "LD I, A",0x00
|
||
2C204100
|
||
198: - 0ACC 4C442052 dasm__ED_4F: db "LD R, A",0x00
|
||
2C204100
|
||
199: ;General-Purpose Arithmetic and CPU Control Groups
|
||
200: - 0AD4 44414100 dasm_27: db "DAA",0x00
|
||
201: - 0AD8 43504C00 dasm_2F: db "CPL",0x00
|
||
202: - 0ADC 4E454700 dasm_ED_44: db "NEG",0x00
|
||
203: - 0AE0 43434600 dasm_3F: db "CCF",0x00
|
||
204: - 0AE4 53434600 dasm_37: db "SCF",0x00
|
||
205: - 0AE8 48414C54 dasm_76: db "HALT",0x00
|
||
00
|
||
206: - 0AED 444900 dasm_F3: db "DI",0x00
|
||
207: - 0AF0 454900 dasm_FB: db "EI",0x00
|
||
208: - 0AF3 494D2030 dasm_ED_46: db "IM 0",0x00
|
||
00
|
||
209: - 0AF8 494D2031 dasm_ED_56: db "IM 1",0x00
|
||
00
|
||
210: - 0AFD 494D2032 dasm_ED_5E: db "IM 2",0x00
|
||
00
|
||
211: ;Exchange, Block Transfer, and Search Group
|
||
212: - 0B02 45582044 dasm_BE: db "EX DE, HL",0x00
|
||
452C2048
|
||
4C00
|
||
213: - 0B0C 45582041 dasm_08: db "EX AF, AF′",0x00
|
||
462C2041
|
||
46E280B2
|
||
00
|
||
214: - 0B19 45585800 dasm_D9: db "EXX",0x00
|
||
215: - 0B1D 45582028 dasm_E3: db "EX (SP), HL",0x00
|
||
5350292C
|
||
20484C00
|
||
216: - 0B29 45582028 dasm_DD_E3: db "EX (SP), IX",0x00
|
||
5350292C
|
||
20495800
|
||
217: - 0B35 45582028 dasm_FD_E3: db "EX (SP), IY",0x00
|
||
5350292C
|
||
20495900
|
||
218: - 0B41 4C444900 dasm_ED_A0: db "LDI",0x00
|
||
219: - 0B45 4C444952 dasm_ED_B0: db "LDIR",0x00
|
||
00
|
||
220: - 0B4A 4C444400 dasm_ED_A8: db "LDD",0x00
|
||
221: - 0B4E 4C444452 dasm_ED_B8: db "LDDR",0x00
|
||
00
|
||
222: - 0B53 43504900 dasm_ED_A1: db "CPI",0x00
|
||
223: - 0B57 43504952 dasm_ED_B1: db "CPIR",0x00
|
||
00
|
||
224: - 0B5C 43504400 dasm_ED_A9: db "CPD",0x00
|
||
225: - 0B60 43504452 dasm_ED_B9: db "CPDR",0x00
|
||
00
|
||
226: ;8-Bit Arithmetic Group
|
||
227: - 0B65 41444420 dasm_80C6: db "ADD A, ", 0x00
|
||
412C2000
|
||
228: - 0B6D 41444420 dasm_DD_86: db "ADD A, (IX+", 0x00, "h)",0x00
|
||
412C2028
|
||
49582B00
|
||
682900
|
||
229: - 0B7C 41444420 dasm_FD_86: db "ADD A, (IY+", 0x00, "h)",0x00
|
||
412C2028
|
||
49592B00
|
||
682900
|
||
230: - 0B8B 41444320 dasm_C88E: db "ADC A, ", 0x00
|
||
412C2000
|
||
231: - 0B93 41444320 dasm_DD_8E: db "ADC A, (IX+", 0x00, "h)",0x00
|
||
412C2028
|
||
49582B00
|
||
682900
|
||
232: - 0BA2 41444320 dasm_FD_8E: db "ADC A, (IY+", 0x00, "h)",0x00
|
||
412C2028
|
||
49592B00
|
||
682900
|
||
233: - 0BB1 53554220 dasm__SUB: db "SUB ", 0x00
|
||
00
|
||
234: - 0BB6 53554220 dasm_DD_96: db "SUB (IX+", 0x00, "h)",0x00
|
||
2849582B
|
||
00682900
|
||
235: - 0BC2 53554220 dasm_FD_96: db "SUB (IY+", 0x00, "h)",0x00
|
||
2849592B
|
||
00682900
|
||
236: - 0BCE 53424320 dasm__SBC: db "SBC A, ", 0x00
|
||
412C2000
|
||
237: - 0BD6 53424320 dasm_DD_9E: db "SBC A,(IX+", 0x00, "h)",0x00
|
||
412C2849
|
||
582B0068
|
||
2900
|
||
238: - 0BE4 53424320 dasm_FD_9E: db "SBC A,(IY+", 0x00, "h)",0x00
|
||
412C2849
|
||
592B0068
|
||
2900
|
||
239: - 0BF2 414E4420 dasm__AND: db "AND ", 0x00
|
||
00
|
||
240: - 0BF7 414E4420 dasm_DD_A6: db "AND (IX+", 0x00, "h)",0x00
|
||
2849582B
|
||
00682900
|
||
241: - 0C03 414E4420 dasm_FD_A6: db "AND (IY+", 0x00, "h)",0x00
|
||
2849592B
|
||
00682900
|
||
242: - 0C0F 4F522000 dasm__OR: db "OR ", 0x00
|
||
243: - 0C13 4F522028 dasm_DD_B6: db "OR (IX+", 0x00, "h)",0x00
|
||
49582B00
|
||
682900
|
||
244: - 0C1E 4F522028 dasm_FD_B6: db "OR (IY+", 0x00, "h)",0x00
|
||
49592B00
|
||
682900
|
||
245: - 0C29 584F5220 dasm__XOR: db "XOR ", 0x00
|
||
00
|
||
246: - 0C2E 584F5220 dasm_DD_AE: db "XOR (IX+", 0x00, "h)",0x00
|
||
2849582B
|
||
00682900
|
||
247: - 0C3A 584F5220 dasm_FD_AE: db "XOR (IY+", 0x00, "h)",0x00
|
||
2849592B
|
||
00682900
|
||
248: - 0C46 43502000 dasm__CP: db "CP ", 0x00
|
||
249: - 0C4A 43502028 dasm_DD_BE: db "CP (IX+", 0x00, "h)",0x00
|
||
49582B00
|
||
682900
|
||
250: - 0C55 43502028 dasm_FD_BE: db "CP (IY+", 0x00, "h)",0x00
|
||
49592B00
|
||
682900
|
||
251: - 0C60 494E4320 dasm__INC: db "INC ", 0x00
|
||
00
|
||
252: - 0C65 494E4320 dasm_DD_34: db "INC (IX+", 0x00, "h)",0x00
|
||
2849582B
|
||
00682900
|
||
253: - 0C71 494E4320 dasm_FD_34: db "INC (IY+", 0x00, "h)",0x00
|
||
2849592B
|
||
00682900
|
||
254: - 0C7D 44454320 dasm__DEC: db "DEC ", 0x00
|
||
00
|
||
255: - 0C82 44454320 dasm_DD_35: db "DEC (IX+", 0x00, "h)",0x00
|
||
2849582B
|
||
00682900
|
||
256: - 0C8E 44454320 dasm_FD_35: db "DEC (IY+", 0x00, "h)",0x00
|
||
2849592B
|
||
00682900
|
||
257: ;16-Bit Arithmetic Group
|
||
258: - 0C9A 41444420 dasm_09: db "ADD HL, ",0x00
|
||
484C2C20
|
||
00
|
||
259: - 0CA3 41444320 dasm_ED_4A: db "ADC HL, ",0x00
|
||
484C2C20
|
||
00
|
||
260: - 0CAC 53424320 dasm_ED_42: db "SBC HL, ",0x00
|
||
484C2C20
|
||
00
|
||
261: - 0CB5 41444420 dasm_DD_09: db "ADD IX, ",0x00
|
||
49582C20
|
||
00
|
||
262: - 0CBE 41444420 dasm_FD_09: db "ADD IY, ",0x00
|
||
49592C20
|
||
00
|
||
263: - 0CC7 494E4320 dasm_03: db "INC ",0x00
|
||
00
|
||
264: - 0CCC 494E4320 dasm_DD_23: db "INC IX, ",0x00
|
||
49582C20
|
||
00
|
||
265: - 0CD5 494E4320 dasm_FD_23: db "INC IY, ",0x00
|
||
49592C20
|
||
00
|
||
266: - 0CDE 44454320 dasm_0B: db "DEC ",0x00
|
||
00
|
||
267: - 0CE3 44454320 dasm_DD_2B: db "DEC IX, ",0x00
|
||
49582C20
|
||
00
|
||
268: - 0CEC 44454320 dasm_FD_2B: db "DEC IY, ",0x00
|
||
49592C20
|
||
00
|
||
269: ;16-Bit Load Group
|
||
270: - 0CF5 4C442000 dasm_01: db "LD ",0x00, ", ",0x00
|
||
2C2000
|
||
271: - 0CFC 4C442049 dasm_DD_01: db "LD IX, ",0x00
|
||
582C2000
|
||
272: - 0D04 4C442049 dasm_FD_01: db "LD IY, ",0x00
|
||
592C2000
|
||
273: - 0D0C 4C442048 dasm_2A: db "LD HL, (",0x00,"h)",0x00
|
||
4C2C2028
|
||
00682900
|
||
274: - 0D18 4C442000 dasm_ED_4B: db "LD ",0x00,", (",0x00,"h)",0x00
|
||
2C202800
|
||
682900
|
||
275: - 0D23 4C442049 dasm_DD_2A: db "LD IX, (",0x00,"h)",0x00
|
||
582C2028
|
||
00682900
|
||
276: - 0D2F 4C442049 dasm_FD_2A: db "LD IY, (",0x00,"h)",0x00
|
||
592C2028
|
||
00682900
|
||
277: - 0D3B 4C442028 dasm_22: db "LD (",0x00,"h), HL",0x00
|
||
0068292C
|
||
20484C00
|
||
278: - 0D47 4C442028 dasm_ED_43: db "LD (",0x00,"h), ",0x00
|
||
0068292C
|
||
2000
|
||
279: - 0D51 4C442028 dasm_DD_22: db "LD (",0x00,"h), IX",0x00
|
||
0068292C
|
||
20495800
|
||
280: - 0D5D 4C442028 dasm_FD_22: db "LD (",0x00,"h), IY",0x00
|
||
0068292C
|
||
20495900
|
||
281: - 0D69 4C442053 dasm_F9: db "LD SP, HL",0x00
|
||
502C2048
|
||
4C00
|
||
282: - 0D73 4C442053 dasm_DD_F9: db "LD SP, IX",0x00
|
||
502C2049
|
||
5800
|
||
283: - 0D7D 4C442053 dasm_FD_F9: db "LD SP, IY",0x00
|
||
502C2049
|
||
5900
|
||
284: - 0D87 50555348 dasm_E5: db "PUSH ",0x00
|
||
2000
|
||
285: - 0D8D 50555348 dasm_DD_E5: db "PUSH IX",0x00
|
||
20495800
|
||
286: - 0D95 50555348 dasm_FD_E5: db "PUSH IY",0x00
|
||
20495900
|
||
287: - 0D9D 50555348 dasm_E1: db "PUSH ",0x00
|
||
2000
|
||
288: - 0DA3 50555348 dasm_DD_E1: db "PUSH IX",0x00
|
||
20495800
|
||
289: - 0DAB 50555348 dasm_FD_E1: db "PUSH IY",0x00
|
||
20495900
|
||
290:
|
||
291: ;Misc
|
||
292: - 0DB3 2E3F2E00 dasm_UU: db ".?.",0x00
|
||
293: - 0DB7 20202020 dasm_UW: db " ",0x00
|
||
00
|
||
294:
|
||
295: - 0DBC dasm_printFlags_table:
|
||
296: - 0DBC 4E5A db "NZ"
|
||
297: - 0DBE 5A00 db "Z",0
|
||
298: - 0DC0 4E43 db "NC"
|
||
299: - 0DC2 4300 db "C",0
|
||
300: - 0DC4 504F db "PO"
|
||
301: - 0DC6 5045 db "PE"
|
||
302: - 0DC8 5000 db "P",0
|
||
303: - 0DCA 4D00 db "M",0
|
||
304:
|
||
305: - 0DCC dasm_printRegister8_table:
|
||
306: - 0DCC 42 db "B"
|
||
307: - 0DCD 43 db "C"
|
||
308: - 0DCE 44 db "D"
|
||
309: - 0DCF 45 db "E"
|
||
310: - 0DD0 48 db "H"
|
||
311: - 0DD1 4C db "L"
|
||
312: - 0DD2 53 db "S" ;only 18 bit (SP)
|
||
313: - 0DD3 50 db "P" ;only 18 bit (SP)
|
||
314:
|
||
315: - 0DD4 dasm_printRegisterIX_table:
|
||
316: - 0DD4 4243 db "BC"
|
||
317: - 0DD6 4445 db "DE"
|
||
318: - 0DD8 4958 db "IX"
|
||
319: - 0DDA 5350 db "SP"
|
||
320: - 0DDC dasm_printRegisterIY_table:
|
||
321: - 0DDC 4243 db "BC"
|
||
322: - 0DDE 4445 db "DE"
|
||
323: - 0DE0 4959 db "IY"
|
||
324: - 0DE2 5350 db "SP"
|
||
325:
|
||
326: - 0DE4 dasm_printRegisterSP_table:
|
||
327: - 0DE4 4243 db "BC"
|
||
328: - 0DE6 4445 db "DE"
|
||
329: - 0DE8 484C db "HL"
|
||
330: - 0DEA 4146 db "AF"
|
||
331:
|
||
332: - 0DEC dasm_printRegister8_table_HL:
|
||
**** main.asm ****
|
||
207: - 0DEC 28484C29 db "(HL)", 0
|
||
00
|
||
208: .include "rst.s"
|
||
**** include/rst.s ****
|
||
1: - 0DF1 EXEC_RST_08:
|
||
2: 7138+17 0DF1 CDF600 call print_char
|
||
3: 7155+10 0DF4 C9 ret
|
||
4:
|
||
5:
|
||
6: - 0DF5 EXEC_RST_10:
|
||
7: 7165+11 0DF5 C5 push bc
|
||
8: 7176+11 0DF6 D5 push de
|
||
9: 7187+11 0DF7 E5 push hl
|
||
10: ;call vdp_cursor_on
|
||
11: 7198+17 0DF8 CD4C01 call read_char
|
||
12: 7215+11 0DFB F5 push af
|
||
13: ;call vdp_cursor_off
|
||
14: 7226+10 0DFC F1 pop af
|
||
15: 7236+10 0DFD E1 pop hl
|
||
16: 7246+10 0DFE D1 pop de
|
||
17: 7256+10 0DFF C1 pop bc
|
||
18: 7266+10 0E00 C9 ret
|
||
19:
|
||
20: - 0E01 EXEC_RST_18:
|
||
21: 7276+7 0E01 3E00 ld a,0
|
||
22: 7283+10 0E03 C9 ret
|
||
**** main.asm ****
|
||
209: .include "beep.s"
|
||
**** include/beep.s ****
|
||
1: ;------------------------------------------------------------------------------
|
||
2: ; beep
|
||
3: ;
|
||
4: ; Beeps the speaker
|
||
5: ; DE sets duration
|
||
6: ;------------------------------------------------------------------------------
|
||
7: - 0E04 beep:
|
||
8: 7293+11 0E04 F5 push AF
|
||
9: 7304+11 0E05 D5 push DE
|
||
10: 7315+4 0E06 F3 di
|
||
11: - 0E07 beep_loop:
|
||
12: 7319+7 0E07 3E08 LD A,0x08
|
||
13: 7326+11 0E09 D3F4 OUT (CS_PIO_AD), A
|
||
14: 7337+17 0E0B CD1E0E CALL beep_pause
|
||
15: 7354+7 0E0E 3E00 LD A,0x00
|
||
16: 7361+11 0E10 D3F4 OUT (CS_PIO_AD), A
|
||
17: 7372+17 0E12 CD1E0E CALL beep_pause
|
||
18: 7389+6 0E15 1B DEC DE
|
||
19: 7395+4 0E16 7A ld A,D
|
||
20: 7399+4 0E17 B3 or E
|
||
21: 7403+7+5 0E18 20ED jr NZ, beep_loop
|
||
22: 7410+10 0E1A D1 pop de
|
||
23: 7420+10 0E1B F1 pop af
|
||
24: 7430+4 0E1C FB ei
|
||
25: 7434+10 0E1D C9 ret
|
||
26:
|
||
27: - 0E1E beep_pause:
|
||
28: 7444+11 0E1E C5 PUSH BC
|
||
29: - 0E1F _beep_pause_l1:
|
||
30: ;NEG ; 8 T-states
|
||
31: ;NEG ; 8 T-states
|
||
32: 7455+8 0E1F ED44 NEG ; 8 T-states
|
||
33: 7463+8 0E21 ED44 NEG ; 8 T-states
|
||
34: 7471+6 0E23 0B DEC BC ; 6 T-states
|
||
35: 7477+4 0E24 79 LD A,C ; 9 T-states
|
||
36: 7481+4 0E25 B0 OR B ; 4 T-states
|
||
37: 7485+10 0E26 C21F0E JP NZ,_beep_pause_l1 ; 10 T-states
|
||
38: 7495+10 0E29 C1 POP BC
|
||
**** main.asm ****
|
||
210: 7505+10 0E2A C9 RET ; Pause complete, RETurn
|
||
211: .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: ide_wait_rdy macro
|
||
41: local wait
|
||
42: wait:
|
||
43: ld b, IDE_REG_CMDSTS
|
||
44: call ide_regread_8
|
||
45: rla
|
||
46: jr c, wait
|
||
47: endm
|
||
48:
|
||
49: ide_wait_drq macro
|
||
50: local wait
|
||
51: wait:
|
||
52: ld b, IDE_REG_CMDSTS
|
||
53: call ide_regread_8
|
||
54: bit 0,a ;Error Bit set.
|
||
55: jp nz, ide_printerror
|
||
56: bit 3,a
|
||
57: jr z,wait
|
||
58: endm
|
||
59:
|
||
60:
|
||
61: ;================================================================
|
||
62: ; I/O access functions
|
||
63: ;================================================================
|
||
64:
|
||
65: ;------------------------------------------------------------------------------
|
||
66: ; ide_reset
|
||
67: ;
|
||
68: ; resets drives on bus
|
||
69: ;------------------------------------------------------------------------------
|
||
70: - 0E2B ide_reset:
|
||
71:
|
||
72: 7515+7 0E2B 3E80 LD A, 10000000b ;CommandByte-A, Mode 0, PA Out, PC Out, PB Out
|
||
73: 7522+11 0E2D D333 OUT (CS_PIA_CR), A ;Set Data direction to out
|
||
74: 7533+7 0E2F 3E80 LD A, IDE_RST
|
||
75: 7540+11 0E31 D332 OUT (CS_PIA_PC), A ;Reset IDE Device
|
||
76: 7551+4 0E33 AF XOR A
|
||
77: 7555+11 0E34 D332 OUT (CS_PIA_PC), A ;end device reset
|
||
78: 7566+10 0E36 C9 RET
|
||
79:
|
||
80:
|
||
81: ;------------------------------------------------------------------------------
|
||
82: ; ide_regwrite_8
|
||
83: ;
|
||
84: ; Sends data to the IDE device
|
||
85: ; A contains DATA
|
||
86: ; B contains register number
|
||
87: ;------------------------------------------------------------------------------
|
||
88: - 0E37 ide_regwrite_8:
|
||
89: 7576+11 0E37 F5 PUSH AF ;store date to stack
|
||
90: ; Prepare PIA Data Direction
|
||
91: 7587+7 0E38 3E80 LD A, 10000000b ;CommandByte-A, Mode 0, PA Out, PC Out, PB Out
|
||
92: 7594+11 0E3A D333 OUT (CS_PIA_CR), A ;Set Data direction to out
|
||
93: ; Write Data out
|
||
94: 7605+10 0E3C F1 POP AF
|
||
95: 7615+11 0E3D D330 OUT (CS_PIA_PA), A ;Write Data to bit 0-7
|
||
96: ;Prepare Address
|
||
97: 7626+4 0E3F 78 LD A, B ;Load register address
|
||
98: 7630+7 0E40 E61F AND 00011111b ;Mask unused bits
|
||
99: 7637+11 0E42 D332 OUT (CS_PIA_PC), A ;Write Data to bit controll lines
|
||
100: 7648+7 0E44 F620 OR IDE_WR ;Set Write bit
|
||
101: 7655+11 0E46 D332 OUT (CS_PIA_PC), A ;Set write signal
|
||
102: ;NOP ;delay to wait for processing
|
||
103: 7666+4 0E48 78 LD A, B ;Load register address
|
||
104: 7670+7 0E49 E61F AND 00011111b ;Mask unused bits
|
||
105: 7677+11 0E4B D332 OUT (CS_PIA_PC), A ;disable write signal
|
||
106: ;NOP
|
||
107: 7688+4 0E4D AF XOR A ;clear register A
|
||
108: 7692+11 0E4E D332 OUT (CS_PIA_PC), A ;clear controll lines
|
||
109: 7703+10 0E50 C9 RET
|
||
110:
|
||
111:
|
||
112: ;------------------------------------------------------------------------------
|
||
113: ; ide_regread_8
|
||
114: ;
|
||
115: ; Sends data to the IDE device
|
||
116: ; B contains register number
|
||
117: ; A returns data
|
||
118: ;------------------------------------------------------------------------------
|
||
119: - 0E51 ide_regread_8:
|
||
120: 7713+7 0E51 3E92 LD A, 10010010b ;CommandByte-A, Mode 0, PA IN, PC Out, PB IN
|
||
121: 7720+11 0E53 D333 OUT (CS_PIA_CR), A ;Set Data direction to in
|
||
122: ;Prepare Address
|
||
123: 7731+4 0E55 78 LD A, B ;Load register address
|
||
124: 7735+7 0E56 E61F AND 00011111b ;Mask unused bits
|
||
125: 7742+11 0E58 D332 OUT (CS_PIA_PC), A ;Write Data to bit controll lines
|
||
126: 7753+7 0E5A F640 OR IDE_RD ;Set Write bit
|
||
127: 7760+11 0E5C D332 OUT (CS_PIA_PC), A ;Write Data to bit controll lines
|
||
128: 7771+4 0E5E 00 NOP
|
||
129: 7775+11 0E5F DB30 IN A,(CS_PIA_PA) ;read data from ide device to b (because a is used later)
|
||
130: 7786+11 0E61 F5 PUSH AF
|
||
131: 7797+4 0E62 AF XOR A ;clear register A
|
||
132: 7801+11 0E63 D332 OUT (CS_PIA_PC), A ;clear controll lines
|
||
133: 7812+10 0E65 F1 POP AF ;put data in accumulator
|
||
134: 7822+10 0E66 C9 RET
|
||
135:
|
||
136: ;------------------------------------------------------------------------------
|
||
137: ; ide_readsector_512_fast
|
||
138: ;
|
||
139: ; Reads IDE Data until no more data is available (multiple sectors)
|
||
140: ; HL contains destination address
|
||
141: ; A returns 0 on success, 1 on error
|
||
142: ;------------------------------------------------------------------------------
|
||
143: - 0E67 ide_readsector_512_fast:
|
||
144: 7832+7 0E67 060F ld b, IDE_REG_CMDSTS ;check status
|
||
145: 7839+17 0E69 CD510E call ide_regread_8
|
||
146: 7856+8 0E6C CB47 bit 0,a ;Error Bit set
|
||
147: 7864+10 0E6E C2B20E jp nz, ide_printerror ;then abort
|
||
148: 7874+8 0E71 CB5F bit 3,a ;wait for drq
|
||
149: 7882+7+5 0E73 28F2 jr z,ide_readsector_512_fast
|
||
150: 7889+7 0E75 0600 ld b,0 ;256x
|
||
151: 7896+7 0E77 3E92 ld a, 10010010b ;CommandByte-A, Mode 0, PA IN, PC Out, PB IN
|
||
152: 7903+11 0E79 D333 out (CS_PIA_CR), a ;Set Data direction to IN
|
||
153: - 0E7B _ide_readsector_512_floop:
|
||
154: 7914+7 0E7B 3E08 ld a, IDE_REG_DATA ;CS0 and A=0 -> I/O register
|
||
155: 7921+11 0E7D D332 out (CS_PIA_PC), a ;set register
|
||
156: 7932+7 0E7F F640 or IDE_RD ;Set Read bit
|
||
157: 7939+11 0E81 D332 out (CS_PIA_PC), a ;Write Read to bit controll lines
|
||
158: 7950+11 0E83 DB30 in a,(CS_PIA_PA) ;load first byte
|
||
159: 7961+7 0E85 77 ld (hl), a
|
||
160: 7968+6 0E86 23 inc hl
|
||
161: 7974+11 0E87 DB31 in a,(CS_PIA_PB) ;load second byte
|
||
162: 7985+7 0E89 77 ld (hl), a
|
||
163: 7992+6 0E8A 23 inc hl
|
||
164: 7998+8+5 0E8B 10EE djnz _ide_readsector_512_floop ;loop 256 times (256words = 512 bytes)
|
||
165: 8006+7 0E8D 060F ld b, IDE_REG_CMDSTS;check drive status
|
||
166: 8013+17 0E8F CD510E call ide_regread_8 ;
|
||
167: 8030+7 0E92 E689 and 10001001b ;busy, DRQ, or error?
|
||
168: 8037+5+6 0E94 C8 ret z ;no more data or errors -> exit
|
||
169: 8042+8 0E95 CB5F bit 3,a ;test if more data available
|
||
170: 8050+7+5 0E97 20CE jr nz,ide_readsector_512_fast ;if true, repeat read function
|
||
171: 8057+10 0E99 C3B20E jp ide_printerror ;else exit function
|
||
172:
|
||
173: - 0E9C ide_readsector_timeout:
|
||
174: 8067+10 0E9C 21160F LD HL, [str_error_time]
|
||
175: 8077+17 0E9F CDFC00 CALL print_str
|
||
176: 8094+4 0EA2 79 LD A, C
|
||
177: 8098+17 0EA3 CD2201 CALL print_a_hex
|
||
178: 8115+7 0EA6 3E0A LD A,10
|
||
179: 8122+17 0EA8 CDF600 CALL print_char
|
||
180: 8139+7 0EAB 3E0D LD A,13
|
||
181: 8146+17 0EAD CDF600 CALL print_char
|
||
182: 8163+10 0EB0 C9 RET
|
||
183:
|
||
184: ;------------------------------------------------------------------------------
|
||
185: ; ide_writesector_256
|
||
186: ;
|
||
187: ; Writes 512 bytes (256 words) of IDE Data
|
||
188: ; HL contains data start address
|
||
189: ;------------------------------------------------------------------------------
|
||
190: - 0EB1 ide_writesector_256:
|
||
191: 8173+10 0EB1 C9 RET ;NOT IMPLEMENTED
|
||
192:
|
||
193:
|
||
194: ;================================================================
|
||
195: ; utility functions
|
||
196: ;================================================================
|
||
197:
|
||
198: ;------------------------------------------------------------------------------
|
||
199: ; ide_printerror
|
||
200: ;
|
||
201: ; prints IDE error to console
|
||
202: ;------------------------------------------------------------------------------
|
||
203: - 0EB2 ide_printerror:
|
||
204: 8183+10 0EB2 21E70E LD HL, [str_error_start]
|
||
205: 8193+17 0EB5 CDFC00 CALL print_str
|
||
206: 8210+7 0EB8 060F LD B, IDE_REG_CMDSTS
|
||
207: 8217+17 0EBA CD510E CALL ide_regread_8
|
||
208: 8234+17 0EBD CD2201 CALL print_a_hex
|
||
209: 8251+10 0EC0 21040F LD HL, [str_error_start1]
|
||
210: 8261+17 0EC3 CDFC00 CALL print_str
|
||
211: 8278+13 0EC6 3ACF42 LD A,(MEM_IDE_DEVICE)
|
||
212: 8291+17 0EC9 CD2201 CALL print_a_hex
|
||
213: 8308+10 0ECC 210D0F LD HL, [str_error_start2]
|
||
214: 8318+17 0ECF CDFC00 CALL print_str
|
||
215: 8335+7 0ED2 0609 LD B, IDE_REG_ERROR
|
||
216: 8342+17 0ED4 CD510E CALL ide_regread_8
|
||
217: 8359+17 0ED7 CD2201 CALL print_a_hex
|
||
218: 8376+7 0EDA 3E0A LD A,10
|
||
219: 8383+17 0EDC CDF600 CALL print_char
|
||
220: 8400+7 0EDF 3E0D LD A,13
|
||
221: 8407+17 0EE1 CDF600 CALL print_char
|
||
222: 8424+7 0EE4 3E01 LD A,1
|
||
223: 8431+10 0EE6 C9 RET
|
||
224:
|
||
225: - 0EE7 str_error_start:
|
||
226: - 0EE7 0D0A4469 db 13,10,"Disk I/O error. Status: 0x",0
|
||
736B2049
|
||
2F4F2065
|
||
72726F72
|
||
2E205374
|
||
61747573
|
||
3A203078
|
||
00
|
||
227: - 0F04 str_error_start1:
|
||
228: - 0F04 20446576 db " Dev: 0x",0
|
||
3A203078
|
||
00
|
||
229: - 0F0D str_error_start2:
|
||
230: - 0F0D 20457272 db " Err: 0x",0
|
||
3A203078
|
||
00
|
||
231:
|
||
232: - 0F16 str_error_time:
|
||
233: - 0F16 0D0A4469 db 13,10,"Disk I/O error. Data timeout @ 0x",0
|
||
736B2049
|
||
2F4F2065
|
||
72726F72
|
||
2E204461
|
||
74612074
|
||
696D656F
|
||
75742040
|
||
20307800
|
||
**** main.asm ****
|
||
212: .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: - 0030 IDE_CMD_WRITESEC .EQU 0x30 ;Write sectors.
|
||
12:
|
||
13: ;================================================================
|
||
14: ; IDE Variables
|
||
15: ;================================================================
|
||
16: - 42CF phase var_idebuffer
|
||
17: - 42CF MEM_IDE_DEVICE:
|
||
18: - 42CF ..42CF 00 defs 1
|
||
19: - 42D0 MEM_IDE_STATUS:
|
||
20: - 42D0 ..42D0 00 defs 1 ;1Byte: 0x00 if status is okay
|
||
21: - 42D1 MEM_IDE_PARTITION:
|
||
22: - 42D1 ..42D4 00 defs 4 ;4*16Bytes: LBA first sector
|
||
23: - 42D5 MEM_IDE_POINTER:
|
||
24: - 42D5 ..42D8 00 defs 4 ;4*16Bytes: LBA first sector
|
||
25: - 42D9 MEM_IDE_DEV_TABLE:
|
||
26: - 42D9 ..4318 00 defs 16*4
|
||
27: - 4319 MEM_IDE_SELECTED:
|
||
28: - 4319 ..4319 00 defs 1
|
||
29: - 431A MEM_IDE_STRING_0:
|
||
30: - 431A ..4341 00 defs 40
|
||
31: - 4342 MEM_IDE_STRING_1:
|
||
32: - 4342 ..4369 00 defs 40
|
||
33: - 436A MEM_IDE_STRING_2:
|
||
34: - 436A ..4391 00 defs 40
|
||
35: - 4392 MEM_IDE_STRING_3:
|
||
36: - 4392 ..43B9 00 defs 40
|
||
37: - 43BA MEM_IDE_BUFFER:
|
||
38: - 43BA ..45B9 00 defs 512
|
||
39: - 45BA MEM_IDE_FSBUFFER:
|
||
40: - 45BA ..46B9 00 defs 256
|
||
41: - 1325 dephase
|
||
42: ;DEV-Table layout
|
||
43: ;<STATUS> <TYPE> <FIRST-SECTOR (4-byte)> <Length (4-byte)> <I/O Addr> <Master/Slave> 0x00 0x00
|
||
44: ;Status: 0x00 -> Ready
|
||
45: ; 0x01 -> Not found
|
||
46: ; 0x02 -> No supported filesystem
|
||
47: ;I/O Addr: Base addr of 82C55
|
||
48: ;Type: File system type
|
||
49:
|
||
50:
|
||
51: - 1325 IDE_DEV_TABLE:
|
||
52: - 1325 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
|
||
1A430000
|
||
53: - 1335 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
|
||
42430000
|
||
54: - 1345 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
|
||
6A430000
|
||
55: - 1355 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
|
||
92430000
|
||
56:
|
||
57: ;================================================================
|
||
58: ; IDE funtions
|
||
59: ;================================================================
|
||
60:
|
||
61: ;------------------------------------------------------------------------------
|
||
62: ; ideif_init_table
|
||
63: ;
|
||
64: ; initializes drive table
|
||
65: ;------------------------------------------------------------------------------
|
||
66: - 1365 ideif_init_devtable:
|
||
67: ;copy default values to ram
|
||
68: 8441+10 1365 212513 ld hl,[IDE_DEV_TABLE]
|
||
69: 8451+10 1368 11D942 ld de,[MEM_IDE_DEV_TABLE]
|
||
70: 8461+10 136B 014000 ld bc,16*4
|
||
71: 8471+16+5 136E EDB0 ldir
|
||
72: ;set selected device
|
||
73: 8487+7 1370 3E00 ld a,0
|
||
74: 8494+13 1372 321943 ld (MEM_IDE_SELECTED),a
|
||
75: ;set empty names
|
||
76: 8507+4 1375 AF xor a
|
||
77: 8511+13 1376 321A43 ld (MEM_IDE_STRING_0),a
|
||
78: 8524+13 1379 324243 ld (MEM_IDE_STRING_1),a
|
||
79: 8537+13 137C 326A43 ld (MEM_IDE_STRING_2),a
|
||
80: 8550+13 137F 329243 ld (MEM_IDE_STRING_3),a
|
||
81: 8563+10 1382 C9 ret
|
||
82:
|
||
83: ;------------------------------------------------------------------------------
|
||
84: ; ideif_prnt_devtable
|
||
85: ;
|
||
86: ; prints drive table
|
||
87: ;------------------------------------------------------------------------------
|
||
88: - 1383 ideif_prnt_devtable:
|
||
89: 8573+17 1383 CD0C01 call print_newLine
|
||
90: 8590+10 1386 213016 ld hl,[_ideif_prnt_devtable_hdr]
|
||
91: 8600+17 1389 CDFC00 call print_str
|
||
92: 8617+10 138C 21D942 ld hl,[MEM_IDE_DEV_TABLE]
|
||
93: 8627+7 138F 0600 ld b,0 ;device number
|
||
94: - 1391 _ideif_prnt_devtable_l1: ;loop 1 -> for each device
|
||
95: ;print if selected
|
||
96: 8634+13 1391 3A1943 ld a,(MEM_IDE_SELECTED)
|
||
97: 8647+4 1394 B8 cp b
|
||
98: 8651+10 1395 CA9C13 jp z,_ideif_prnt_devtable_l1_sel
|
||
99: 8661+7 1398 3E20 ld a, ' '
|
||
100: 8668+12 139A 1802 jr _ideif_prnt_devtable_l1_nxt
|
||
101: - 139C _ideif_prnt_devtable_l1_sel:
|
||
102: 8680+7 139C 3E2A ld a, '*'
|
||
103: - 139E _ideif_prnt_devtable_l1_nxt:
|
||
104: 8687+17 139E CDF600 call print_char
|
||
105: ;print drive letter
|
||
106: 8704+4 13A1 78 ld a,b
|
||
107: 8708+7 13A2 C645 add 69 ;offset letter to D
|
||
108: 8715+17 13A4 CDF600 call print_char
|
||
109: 8732+7 13A7 3E3A ld a, ':'
|
||
110: 8739+17 13A9 CDF600 call print_char
|
||
111: 8756+7 13AC 3E20 ld a, ' '
|
||
112: 8763+17 13AE CDF600 call print_char
|
||
113: ;print status
|
||
114: 8780+11 13B1 E5 push hl
|
||
115: 8791+7 13B2 7E ld a,(HL)
|
||
116: 8798+4 13B3 B7 or a
|
||
117: 8802+7+5 13B4 280E jr z, _ideif_prnt_devtable_l1_s00
|
||
118: 8809+7 13B6 FE01 cp 0x01
|
||
119: 8816+7+5 13B8 280F jr z, _ideif_prnt_devtable_l1_s01
|
||
120: 8823+7 13BA FE02 cp 0x02
|
||
121: 8830+7+5 13BC 2810 jr z, _ideif_prnt_devtable_l1_s02
|
||
122: 8837+7 13BE FEFF cp 0xFF
|
||
123: 8844+7+5 13C0 2811 jr z, _ideif_prnt_devtable_l1_sFF
|
||
124: 8851+12 13C2 180F jr _ideif_prnt_devtable_l1_sFF
|
||
125: - 13C4 _ideif_prnt_devtable_l1_s00
|
||
126: 8863+10 13C4 216816 ld hl,[_ideif_prnt_devtable_s00]
|
||
127: 8873+12 13C7 180D jr _ideif_prnt_devtable_l1_es
|
||
128: - 13C9 _ideif_prnt_devtable_l1_s01
|
||
129: 8885+10 13C9 217316 ld hl,[_ideif_prnt_devtable_s01]
|
||
130: 8895+12 13CC 1808 jr _ideif_prnt_devtable_l1_es
|
||
131: - 13CE _ideif_prnt_devtable_l1_s02
|
||
132: 8907+10 13CE 217E16 ld hl,[_ideif_prnt_devtable_s02]
|
||
133: 8917+12 13D1 1803 jr _ideif_prnt_devtable_l1_es
|
||
134: - 13D3 _ideif_prnt_devtable_l1_sFF
|
||
135: 8929+10 13D3 218916 ld hl,[_ideif_prnt_devtable_sFF]
|
||
136: - 13D6 _ideif_prnt_devtable_l1_es
|
||
137: 8939+17 13D6 CDFC00 call print_str
|
||
138: 8956+10 13D9 E1 pop hl
|
||
139: 8966+6 13DA 23 inc hl
|
||
140: ;print FS-Type
|
||
141: 8972+7 13DB 3E30 ld a,'0'
|
||
142: 8979+17 13DD CDF600 call print_char
|
||
143: 8996+7 13E0 3E78 ld a,'x'
|
||
144: 9003+17 13E2 CDF600 call print_char
|
||
145: 9020+7 13E5 7E ld a,(HL)
|
||
146: 9027+17 13E6 CD2201 call print_a_hex
|
||
147: 9044+7 13E9 3E20 ld a,' '
|
||
148: 9051+17 13EB CDF600 call print_char
|
||
149: 9068+6 13EE 23 inc hl
|
||
150: ;print first sector
|
||
151: 9074+11 13EF E5 push hl
|
||
152: 9085+14 13F0 DDE1 pop ix
|
||
153:
|
||
154: 9099+6 13F2 23 inc hl
|
||
155: 9105+6 13F3 23 inc hl
|
||
156: 9111+6 13F4 23 inc hl
|
||
157: 9117+6 13F5 23 inc hl
|
||
158: 9123+6 13F6 23 inc hl
|
||
159: 9129+6 13F7 23 inc hl
|
||
160: 9135+6 13F8 23 inc hl
|
||
161: 9141+6 13F9 23 inc hl
|
||
162:
|
||
163: 9147+19 13FA DD7E03 ld a,(ix+3)
|
||
164: 9166+17 13FD CD2201 call print_a_hex
|
||
165: 9183+19 1400 DD7E02 ld a,(ix+2)
|
||
166: 9202+17 1403 CD2201 call print_a_hex
|
||
167: 9219+19 1406 DD7E01 ld a,(ix+1)
|
||
168: 9238+17 1409 CD2201 call print_a_hex
|
||
169: 9255+19 140C DD7E00 ld a,(ix+0)
|
||
170: 9274+17 140F CD2201 call print_a_hex
|
||
171: 9291+7 1412 3E20 ld a,' '
|
||
172: 9298+17 1414 CDF600 call print_char
|
||
173: ;print length
|
||
174: 9315+19 1417 DD7E07 ld a,(ix+7)
|
||
175: 9334+17 141A CD2201 call print_a_hex
|
||
176: 9351+19 141D DD7E06 ld a,(ix+6)
|
||
177: 9370+17 1420 CD2201 call print_a_hex
|
||
178: 9387+19 1423 DD7E05 ld a,(ix+5)
|
||
179: 9406+17 1426 CD2201 call print_a_hex
|
||
180: 9423+19 1429 DD7E04 ld a,(ix+4)
|
||
181: 9442+17 142C CD2201 call print_a_hex
|
||
182: 9459+7 142F 3E20 ld a,' '
|
||
183: 9466+17 1431 CDF600 call print_char
|
||
184: ;print Port
|
||
185: 9483+7 1434 3E30 ld a,'0'
|
||
186: 9490+17 1436 CDF600 call print_char
|
||
187: 9507+7 1439 3E78 ld a,'x'
|
||
188: 9514+17 143B CDF600 call print_char
|
||
189: 9531+7 143E 7E ld a,(HL)
|
||
190: 9538+17 143F CD2201 call print_a_hex
|
||
191: 9555+7 1442 3E20 ld a,' '
|
||
192: 9562+17 1444 CDF600 call print_char
|
||
193: 9579+6 1447 23 inc hl
|
||
194: ;print M/S
|
||
195: 9585+7 1448 7E ld a,(HL)
|
||
196: 9592+11 1449 E5 push hl
|
||
197: 9603+4 144A B7 or a
|
||
198: 9607+10 144B CA5414 jp z,_ideif_prnt_devtable_l1_ms
|
||
199: 9617+10 144E 219C16 ld hl,[_ideif_prnt_devtable_slave]
|
||
200: 9627+10 1451 C35714 jp _ideif_prnt_devtable_l1_e2
|
||
201: - 1454 _ideif_prnt_devtable_l1_ms
|
||
202: 9637+10 1454 219416 ld hl,[_ideif_prnt_devtable_master]
|
||
203: - 1457 _ideif_prnt_devtable_l1_e2
|
||
204: 9647+17 1457 CDFC00 call print_str
|
||
205: 9664+10 145A E1 pop hl
|
||
206: 9674+6 145B 23 inc hl
|
||
207: ;print str
|
||
208: 9680+11 145C C5 push bc
|
||
209: 9691+7 145D 7E ld a,(hl)
|
||
210: 9698+4 145E 4F ld c,a
|
||
211: 9702+6 145F 23 inc hl
|
||
212: 9708+7 1460 7E ld a,(hl)
|
||
213: 9715+4 1461 47 ld b,a
|
||
214: 9719+6 1462 23 inc hl
|
||
215: 9725+11 1463 E5 push hl
|
||
216: 9736+4 1464 60 ld h,b
|
||
217: 9740+4 1465 69 ld l,c
|
||
218: 9744+17 1466 CDFC00 call print_str
|
||
219: 9761+17 1469 CD0C01 call print_newLine
|
||
220: 9778+10 146C E1 pop hl
|
||
221: 9788+10 146D C1 pop bc
|
||
222: ;next
|
||
223: 9798+6 146E 23 inc hl
|
||
224: 9804+6 146F 23 inc hl
|
||
225: 9810+4 1470 04 inc b
|
||
226: 9814+4 1471 78 ld a,b
|
||
227: 9818+7 1472 FE04 cp 4
|
||
228: 9825+5+6 1474 C8 ret z
|
||
229: 9830+10 1475 C39113 jp _ideif_prnt_devtable_l1
|
||
230: ;------------------------------------------------------------------------------
|
||
231: ; ideif_init_drive
|
||
232: ;
|
||
233: ; initializes selected drive in table
|
||
234: ;------------------------------------------------------------------------------
|
||
235: - 1478 ideif_init_drive:
|
||
236: 9840+17 1478 CD5815 call ideif_get_drv_pointer
|
||
237: ; load addresses. not used atm
|
||
238: ;ld a,(IX+6) ;load IO Addr
|
||
239: ;ld d,a
|
||
240: ;ld a,(IX+7) ;load Master/Slave bit
|
||
241: ;ld e,a
|
||
242: 9857+17 147B CD2B0E call ide_reset
|
||
243:
|
||
244: 9874+10 147E 11FFAF ld de, 0xAFFF ;preload timeout counter
|
||
245: - 1481 _ideif_init_drive_loop:
|
||
246: 9884+7 1481 060F ld b, IDE_REG_CMDSTS
|
||
247: 9891+17 1483 CD510E call ide_regread_8 ;read drive status register
|
||
248: 9908+4 1486 B7 or a
|
||
249: 9912+7+5 1487 280B jr z,_ideif_init_drive_nodrv ;no drive found
|
||
250: 9919+8 1489 CB77 bit 6,a
|
||
251: 9927+7+5 148B 200C jr nz, _ideif_init_drive_found
|
||
252: 9934+6 148D 1B dec de
|
||
253: 9940+4 148E 7A ld a,d
|
||
254: 9944+4 148F B3 or e
|
||
255: 9948+7+5 1490 2802 jr z, _ideif_init_drive_nodrv
|
||
256: 9955+12 1492 18ED jr _ideif_init_drive_loop
|
||
257:
|
||
258: - 1494 _ideif_init_drive_nodrv:
|
||
259: 9967+19 1494 DD360001 ld(ix+0),0x01
|
||
260: 9986+10 1498 C9 ret
|
||
261:
|
||
262: - 1499 _ideif_init_drive_found:
|
||
263: 9996+19 1499 DD360002 ld (ix+0),0x02
|
||
264: ;get drive name
|
||
265:10015+7 149D 060F ld b, IDE_REG_CMDSTS ;Get drive identification
|
||
266:10022+7 149F 3EEC ld a, IDE_CMD_IDENT
|
||
267:10029+17 14A1 CD370E call ide_regwrite_8 ;Write command to drive
|
||
268:10046+10 14A4 21BA43 ld hl, MEM_IDE_BUFFER ;set read/write buffer start address
|
||
269:10056+17 14A7 CD670E call ide_readsector_512_fast ;read 256 words from device
|
||
270:10073+10 14AA 21F043 ld hl,MEM_IDE_BUFFER + 54 ;print device serial
|
||
271:10083+19 14AD DD7E0C ld a,(ix+12) ;load str pointer into de
|
||
272:10102+4 14B0 5F ld e,a
|
||
273:10106+19 14B1 DD7E0D ld a,(ix+13)
|
||
274:10125+4 14B4 57 ld d,a
|
||
275:10129+7 14B5 0614 ld b,20
|
||
276: - 14B7 _ideif_init_drive_charloop:
|
||
277:10136+7 14B7 7E ld a,(hl) ;load data from HL (buffer)
|
||
278:10143+6 14B8 23 inc hl
|
||
279:10149+4 14B9 08 ex af,af'
|
||
280:10153+7 14BA 7E ld a,(hl)
|
||
281:10160+6 14BB 23 inc hl
|
||
282:10166+7 14BC 12 ld (de),a
|
||
283:10173+6 14BD 13 inc de
|
||
284:10179+4 14BE 08 ex af,af'
|
||
285:10183+7 14BF 12 ld (de),a
|
||
286:10190+6 14C0 13 inc de
|
||
287:10196+8+5 14C1 10F4 djnz _ideif_init_drive_charloop
|
||
288: ;get partition table
|
||
289: ;read bootsector
|
||
290: - 14C3 ?a0000:
|
||
290:10204+7 14C3 060F ld b, IDE_REG_CMDSTS
|
||
290:10211+17 14C5 CD510E call ide_regread_8
|
||
290:10228+4 14C8 17 rla
|
||
290:10232+7+5 14C9 38F8 jr c, ?a0000
|
||
290: - 14CB endm
|
||
290:10204+35 14C3 060FCD51 ide_wait_rdy
|
||
0E1738F8
|
||
291:10239+7 14CB 3E01 ld a,1 ;read 1 sector
|
||
292:10246+7 14CD 060A ld B,IDE_REG_SECTOR
|
||
293:10253+17 14CF CD370E call ide_regwrite_8
|
||
294:10270+7 14D2 3E00 ld a,0 ;read sector 0
|
||
295:10277+7 14D4 060B ld b,IDE_REG_LBA0
|
||
296:10284+17 14D6 CD370E call ide_regwrite_8
|
||
297:10301+7 14D9 3E00 ld a,0 ;read cylinder 0
|
||
298:10308+7 14DB 060C ld b,IDE_REG_LBA1
|
||
299:10315+17 14DD CD370E call ide_regwrite_8
|
||
300:10332+7 14E0 3E00 ld a,0
|
||
301:10339+7 14E2 060D ld b,IDE_REG_LBA2
|
||
302:10346+17 14E4 CD370E call ide_regwrite_8
|
||
303:10363+7 14E7 3EE0 ld a,11100000b ;read head 0
|
||
304:10370+7 14E9 060E ld b,IDE_REG_LBA3
|
||
305:10377+17 14EB CD370E call ide_regwrite_8
|
||
306:
|
||
307:10394+7 14EE 3E20 ld a,IDE_CMD_READSEC ;send read command
|
||
308:10401+7 14F0 060F ld b,IDE_REG_CMDSTS
|
||
309:10408+17 14F2 CD370E call ide_regwrite_8
|
||
310:
|
||
311:10425+10 14F5 21BA43 ld hl, MEM_IDE_BUFFER ;set read/write buffer start address
|
||
312:10435+17 14F8 CD670E call ide_readsector_512_fast ;read 256 words from device
|
||
313: ;prepare partitions
|
||
314:10452+7 14FB 0604 ld b,4 ;Partition table length
|
||
315:10459+7 14FD 0E00 ld c,0 ;Partition ID counter
|
||
316:10466+14 14FF FD217845 ld iy,MEM_IDE_BUFFER+446 ;Load offest of first partition table entry
|
||
317: - 1503 _ideif_init_drive_prt_l1:
|
||
318:10480+19 1503 FD7E04 ld a,(iy+4) ;load status byte
|
||
319:10499+4 1506 B7 or a
|
||
320:10503+10 1507 C21515 jp NZ, _ideif_init_drive_prt_fnd ;If not zero, jump to print function
|
||
321:10513+10 150A C30D15 jp _ideif_init_drive_prt_ln
|
||
322: - 150D _ideif_init_drive_prt_ln:
|
||
323:10523+10 150D 111000 ld de,16
|
||
324:10533+15 1510 FD19 add iy,de
|
||
325:10548+8+5 1512 10EF djnz _ideif_init_drive_prt_l1
|
||
326:10556+10 1514 C9 ret
|
||
327: - 1515 _ideif_init_drive_prt_fnd;
|
||
328:10566+19 1515 FD7E04 ld a,(iy+4)
|
||
329:10585+19 1518 DD7701 ld (ix+1),a ;store partition type
|
||
330:10604+7 151B FE0E cp 0x0E ;if not 0xE0, continue with next entry
|
||
331:10611+7+5 151D 20EE jr nz, _ideif_init_drive_prt_ln
|
||
332: ;get start LBA
|
||
333:10618+19 151F FD7E08 ld a,(iy+0x08)
|
||
334:10637+19 1522 DD7702 ld (ix+0x02),a
|
||
335:10656+19 1525 FD7E09 ld a,(iy+0x09)
|
||
336:10675+19 1528 DD7703 ld (ix+0x03),a
|
||
337:10694+19 152B FD7E0A ld a,(iy+0x0A)
|
||
338:10713+19 152E DD7704 ld (ix+0x04),a
|
||
339:10732+19 1531 FD7E0B ld a,(iy+0x0B)
|
||
340:10751+19 1534 DD7705 ld (ix+0x05),a
|
||
341:10770+19 1537 DD360000 ld (ix+0),0x00
|
||
342: ;get count LBA
|
||
343:10789+19 153B FD7E0C ld a,(iy+0x0C)
|
||
344:10808+19 153E DD7706 ld (ix+0x06),a
|
||
345:10827+19 1541 FD7E0D ld a,(iy+0x0D)
|
||
346:10846+19 1544 DD7707 ld (ix+0x07),a
|
||
347:10865+19 1547 FD7E0E ld a,(iy+0x0E)
|
||
348:10884+19 154A DD7708 ld (ix+0x08),a
|
||
349:10903+19 154D FD7E0F ld a,(iy+0x0F)
|
||
350:10922+19 1550 DD7709 ld (ix+0x09),a
|
||
351:10941+19 1553 DD360000 ld (ix+0),0x00
|
||
352:10960+10 1557 C9 ret
|
||
353:
|
||
354: ;------------------------------------------------------------------------------
|
||
355: ; ideif_get_drv_pointer
|
||
356: ;
|
||
357: ; gets pointer to selected drive in table in IX
|
||
358: ;------------------------------------------------------------------------------
|
||
359: - 1558 ideif_get_drv_pointer:
|
||
360:10970+11 1558 F5 push af
|
||
361:10981+11 1559 C5 push bc
|
||
362: ;get selected drive
|
||
363:10992+13 155A 3A1943 ld a,(MEM_IDE_SELECTED)
|
||
364: ;multiply a *8
|
||
365:11005+4 155D 07 rlca ;*2
|
||
366:11009+4 155E 07 rlca ;*4
|
||
367:11013+4 155F 07 rlca ;*8
|
||
368:11017+7 1560 0600 ld b,0
|
||
369:11024+4 1562 4F ld c,a
|
||
370:11028+14 1563 DD21D942 ld ix,[MEM_IDE_DEV_TABLE]
|
||
371:11042+15 1567 DD09 add ix,bc
|
||
372:11057+10 1569 C1 pop bc
|
||
373:11067+10 156A F1 pop af
|
||
374:11077+10 156B C9 ret
|
||
375:
|
||
376: ;------------------------------------------------------------------------------
|
||
377: ; ideif_init_all
|
||
378: ;
|
||
379: ; initializes interface
|
||
380: ;------------------------------------------------------------------------------
|
||
381: - 156C ideif_init_all:
|
||
382:11087+10 156C 211016 ld hl, [str_dev_waitready]
|
||
383:11097+17 156F CDFC00 call print_str ;print waiting message
|
||
384:
|
||
385:11114+17 1572 CD6513 call ideif_init_devtable
|
||
386:11131+17 1575 CD7814 call ideif_init_drive
|
||
387:
|
||
388:11148+10 1578 212816 ld hl, [str_dev_done]
|
||
389:11158+17 157B CDFC00 call print_str
|
||
390:11175+10 157E C9 RET
|
||
391:
|
||
392:
|
||
393: ;------------------------------------------------------------------------------
|
||
394: ; ideif_drv_sel
|
||
395: ;
|
||
396: ; Selects drive from table and initializes the fat16 file system
|
||
397: ; A contains drive id
|
||
398: ;------------------------------------------------------------------------------
|
||
399:
|
||
400:
|
||
401:
|
||
402: ;------------------------------------------------------------------------------
|
||
403: ; read_lba_sector
|
||
404: ;
|
||
405: ; Reads A*512 byte sector into memory
|
||
406: ; HL contains pointer to LBA address
|
||
407: ; DE contains destination location
|
||
408: ; A contains sector count
|
||
409: ;------------------------------------------------------------------------------
|
||
410: - 157F read_lba_sector:
|
||
411:11185+11 157F F5 push af
|
||
412: - 1580 ?a0001:
|
||
412:11196+7 1580 060F ld b, IDE_REG_CMDSTS
|
||
412:11203+17 1582 CD510E call ide_regread_8
|
||
412:11220+4 1585 17 rla
|
||
412:11224+7+5 1586 38F8 jr c, ?a0001
|
||
412: - 1588 endm
|
||
412:11196+35 1580 060FCD51 ide_wait_rdy
|
||
0E1738F8
|
||
413:11231+10 1588 F1 pop af
|
||
414:11241+7 1589 060A LD B,IDE_REG_SECTOR ;amount of sectores
|
||
415:11248+17 158B CD370E CALL ide_regwrite_8
|
||
416:
|
||
417:11265+7 158E 7E LD A,(HL)
|
||
418:11272+7 158F 060B LD B,IDE_REG_LBA0
|
||
419:11279+17 1591 CD370E CALL ide_regwrite_8
|
||
420:11296+6 1594 23 INC HL
|
||
421:11302+7 1595 7E LD A,(HL)
|
||
422:11309+7 1596 060C LD B,IDE_REG_LBA1
|
||
423:11316+17 1598 CD370E CALL ide_regwrite_8
|
||
424:11333+6 159B 23 INC HL
|
||
425:11339+7 159C 7E LD A,(HL)
|
||
426:11346+7 159D 060D LD B,IDE_REG_LBA2
|
||
427:11353+17 159F CD370E CALL ide_regwrite_8
|
||
428:11370+6 15A2 23 INC HL
|
||
429:11376+7 15A3 7E LD A,(HL)
|
||
430:11383+7 15A4 E60F AND 00001111b
|
||
431:11390+7 15A6 F6E0 OR 11100000b
|
||
432:11397+7 15A8 060E LD B,IDE_REG_LBA3
|
||
433:11404+17 15AA CD370E CALL ide_regwrite_8
|
||
434:
|
||
435:11421+7 15AD 3E20 LD A,IDE_CMD_READSEC ;send read command
|
||
436:11428+7 15AF 060F LD B,IDE_REG_CMDSTS
|
||
437:11435+17 15B1 CD370E CALL ide_regwrite_8
|
||
438:
|
||
439: ;LD HL,MEM_IDE_BUFFER ;set read/write buffer start address
|
||
440:11452+4 15B4 EB EX DE,HL ;transfer destination in DE to HL
|
||
441:11456+10 15B5 C3670E jp ide_readsector_512_fast ;read 256 words from device
|
||
442:
|
||
443: ;------------------------------------------------------------------------------
|
||
444: ; ideif_drv_sel
|
||
445: ;
|
||
446: ; Select drive from table
|
||
447: ; Prepare variables
|
||
448: ;
|
||
449: ; A contains drive number
|
||
450: ;------------------------------------------------------------------------------
|
||
451: - 15B8 ideif_drv_sel:
|
||
452:11466+13 15B8 321943 ld (MEM_IDE_SELECTED),a
|
||
453:11479+11 15BB F5 push af
|
||
454:11490+17 15BC CD5815 call ideif_get_drv_pointer ;test if drive is marked as available
|
||
455:11507+19 15BF DD7E00 ld a,(ix+0)
|
||
456:11526+4 15C2 B7 or a
|
||
457:11530+10 15C3 C2F015 jp nz, _ideif_drv_sel_fail ;if not-> fail
|
||
458:
|
||
459:11540+17 15C6 CDCD21 call fat_get_root_table ;else get root table
|
||
460:
|
||
461:11557+10 15C9 21A416 ld hl,[_ideif_drv_sel_pstr] ;print success message
|
||
462:11567+17 15CC CDFC00 call print_str
|
||
463:11584+10 15CF F1 pop af
|
||
464:11594+7 15D0 C645 add 69
|
||
465:11601+13 15D2 322F42 ld (var_dir),a ;store drive letter
|
||
466:11614+17 15D5 CDF600 call print_char
|
||
467:11631+7 15D8 3E3A ld a, ':'
|
||
468:11638+13 15DA 323042 ld (var_dir+1),a
|
||
469:11651+7 15DD 3E5C ld a, '\'
|
||
470:11658+13 15DF 323142 ld (var_dir+2),a
|
||
471:11671+4 15E2 AF xor a ;set dir to empty
|
||
472:11675+13 15E3 323242 ld (var_dir+3),a
|
||
473:11688+13 15E6 327E42 ld (var_dir+79),a ;set depth counter
|
||
474:11701+10 15E9 21BB16 ld hl,[_ideif_drv_sel_sstr0]
|
||
475:11711+17 15EC CDFC00 call print_str
|
||
476:11728+10 15EF C9 ret
|
||
477: - 15F0 _ideif_drv_sel_fail:
|
||
478:11738+10 15F0 21A416 ld hl,[_ideif_drv_sel_pstr]
|
||
479:11748+17 15F3 CDFC00 call print_str
|
||
480:11765+10 15F6 F1 pop af
|
||
481:11775+7 15F7 C645 add 69
|
||
482:11782+17 15F9 CDF600 call print_char
|
||
483:11799+10 15FC 21AD16 ld hl,[_ideif_drv_sel_fstr0]
|
||
484:11809+17 15FF CDFC00 call print_str
|
||
485:11826+4 1602 AF xor a ;set dir to empty
|
||
486:11830+13 1603 322F42 ld (var_dir),a
|
||
487:11843+10 1606 112000 LD DE,0x20
|
||
488:11853+10 1609 017000 LD BC,0x70
|
||
489:11863+17 160C CD040E CALL beep
|
||
490:11880+10 160F C9 ret
|
||
491:
|
||
492:
|
||
493:
|
||
494:
|
||
495: ;================================================================
|
||
496: ; IDE strings
|
||
497: ;===============================================================
|
||
498:
|
||
499: - 1610 str_dev_waitready:
|
||
500: - 1610 0D0A4465 db 13,10,"Detecting drives ... ",0
|
||
74656374
|
||
696E6720
|
||
64726976
|
||
6573202E
|
||
2E2E2000
|
||
501: - 1628 str_dev_done:
|
||
502: - 1628 646F6E65 db "done!",13,10,0
|
||
210D0A00
|
||
503:
|
||
504: - 1630 _ideif_prnt_devtable_hdr:
|
||
505: - 1630 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
|
||
506: - 1668 _ideif_prnt_devtable_s00:
|
||
507: - 1668 41766169 db "Avail ",0
|
||
6C202020
|
||
202000
|
||
508: - 1673 _ideif_prnt_devtable_s01:
|
||
509: - 1673 4E6F7420 db "Not Found ",0
|
||
466F756E
|
||
642000
|
||
510: - 167E _ideif_prnt_devtable_s02:
|
||
511: - 167E 556E6B6F db "Unkown FS ",0
|
||
776E2046
|
||
532000
|
||
512: - 1689 _ideif_prnt_devtable_sFF:
|
||
513: - 1689 4374726C db "Ctrl. Err ",0
|
||
2E204572
|
||
722000
|
||
514: - 1694 _ideif_prnt_devtable_master:
|
||
515: - 1694 4D617374 db "Master ",0
|
||
65722000
|
||
516: - 169C _ideif_prnt_devtable_slave:
|
||
517: - 169C 536C6176 db "Slave ",0
|
||
65202000
|
||
518: - 16A4 _ideif_drv_sel_pstr:
|
||
519: - 16A4 0A0D4472 db 10,13,"Drive ",0
|
||
69766520
|
||
00
|
||
520: - 16AD _ideif_drv_sel_fstr0:
|
||
521: - 16AD 3A206E6F db ": not ready",10,13,0
|
||
74207265
|
||
6164790A
|
||
0D00
|
||
522: - 16BB _ideif_drv_sel_sstr0:
|
||
523: - 16BB 3A207365 db ": selected",10,13,0
|
||
6C656374
|
||
65640A0D
|
||
00
|
||
524: - 16C8 _ideif_drv_sel_syn:
|
||
525: - 16C8 0A0D496E db 10,13,"Invalid drive letter",10,13,0
|
||
76616C69
|
||
64206472
|
||
69766520
|
||
6C657474
|
||
65720A0D
|
||
00
|
||
**** main.asm ****
|
||
213: .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: - 16E1 iic_send_buffer:
|
||
28:11890+17 16E1 CD4717 CALL iic_send_sbit ;Send startbit
|
||
29:11907+4 16E4 79 LD A,C
|
||
30:11911+7 16E5 E6FE AND 0xFE ;Mask R/W bit (must be 0 for write)
|
||
31:11918+17 16E7 CDE117 CALL iic_send_byte ;Send Address
|
||
32:11935+17 16EA CD8117 CALL iic_read_ack
|
||
33:11952+4 16ED B7 OR A ; if no ack, error
|
||
34:11956+10 16EE C20517 JP NZ, iic_send_buffer_err
|
||
35: - 16F1 iic_send_buffer_loop;
|
||
36:11966+7 16F1 7E LD A,(HL)
|
||
37:11973+6 16F2 23 INC HL
|
||
38:11979+17 16F3 CDE117 CALL iic_send_byte
|
||
39:11996+17 16F6 CD8117 CALL iic_read_ack
|
||
40:12013+4 16F9 B7 OR A ; if no ack, error
|
||
41:12017+10 16FA C20517 JP NZ, iic_send_buffer_err
|
||
42:12027+8+5 16FD 10F2 DJNZ iic_send_buffer_loop ;loop for remaining bytes
|
||
43: - 16FF iic_send_buffer_done:
|
||
44:12035+17 16FF CD6017 CALL iic_send_ebit
|
||
45:12052+7 1702 3E00 LD A,0
|
||
46:12059+10 1704 C9 RET
|
||
47: - 1705 iic_send_buffer_err:
|
||
48:12069+17 1705 CD6017 CALL iic_send_ebit
|
||
49:12086+7 1708 3E01 LD A,1
|
||
50:12093+10 170A C9 RET
|
||
51:
|
||
52: ;HL contains buffer location
|
||
53: ;B defines amount of bytes to send
|
||
54: ;C contains device address
|
||
55: - 170B iic_receive_buffer:
|
||
56:12103+4 170B 05 DEC B
|
||
57:12107+17 170C CD4717 CALL iic_send_sbit ;Send startbit
|
||
58:12124+4 170F 79 LD A,C
|
||
59:12128+7 1710 F601 OR 0x01 ;set R/W bit (must be 1 for read)
|
||
60:12135+17 1712 CDE117 CALL iic_send_byte ;Send Address
|
||
61:12152+17 1715 CD8117 CALL iic_read_ack
|
||
62:12169+4 1718 B7 OR A ; if no ack, error
|
||
63:12173+10 1719 C23417 JP NZ, iic_receive_buffer_err
|
||
64: - 171C iic_receive_buffer_loop:
|
||
65:12183+17 171C CD0718 CALL iic_receive_byte
|
||
66:12200+7 171F 77 LD (HL),A
|
||
67:12207+6 1720 23 INC HL
|
||
68:12213+17 1721 CDA717 CALL iic_send_ack
|
||
69:12230+8+5 1724 10F6 DJNZ iic_receive_buffer_loop
|
||
70: ; last time:
|
||
71:12238+17 1726 CD0718 CALL iic_receive_byte
|
||
72:12255+7 1729 77 LD (HL),A
|
||
73:12262+6 172A 23 INC HL
|
||
74:12268+17 172B CDC417 CALL iic_send_nack
|
||
75:
|
||
76: - 172E iic_receive_buffer_done:
|
||
77:12285+17 172E CD6017 CALL iic_send_ebit
|
||
78:12302+7 1731 3E00 LD A,0
|
||
79:12309+10 1733 C9 RET
|
||
80: - 1734 iic_receive_buffer_err:
|
||
81:12319+17 1734 CD6017 CALL iic_send_ebit
|
||
82:12336+7 1737 3E01 LD A,1
|
||
83:12343+10 1739 C9 RET
|
||
84:
|
||
85:
|
||
86:
|
||
87: ;================================================================
|
||
88: ; I/O access functions
|
||
89: ;================================================================
|
||
90:
|
||
91: ;Reset PIO configuration
|
||
92: - 173A iic_init:
|
||
93: ;SCL HIGH, SDA HIGH
|
||
94:12353+7 173A 3E03 LD A,0x03
|
||
95:12360+11 173C D3F4 OUT (CS_PIO_AD), A
|
||
96: ;Set port to controll mode (MODE3)
|
||
97:12371+7 173E 3ECF LD A,0xCF
|
||
98:12378+11 1740 D3F6 OUT (CS_PIO_AC), A
|
||
99: ;Set inputs/outputs
|
||
100:12389+7 1742 3EF0 LD A,0xF0
|
||
101:12396+11 1744 D3F6 OUT (CS_PIO_AC), A
|
||
102:12407+10 1746 C9 RET
|
||
103:
|
||
104: ; send start bit
|
||
105: - 1747 iic_send_sbit:
|
||
106: ;SCL HIGH, SDA HIGH
|
||
107:12417+7 1747 3E03 LD A,0x03
|
||
108:12424+11 1749 D3F4 OUT (CS_PIO_AD), A
|
||
109: ;Set port to controll mode (MODE3)
|
||
110:12435+7 174B 3ECF LD A,0xCF
|
||
111:12442+11 174D D3F6 OUT (CS_PIO_AC), A
|
||
112: ;Set inputs/outputs (SDA and SCL is now output)
|
||
113:12453+7 174F 3EFC LD A,0xFC
|
||
114:12460+11 1751 D3F6 OUT (CS_PIO_AC), A
|
||
115: ;SCL HIGH, SDA LOW
|
||
116:12471+7 1753 3E02 LD A,0x02
|
||
117:12478+11 1755 D3F4 OUT (CS_PIO_AD), A
|
||
118:12489+4 1757 00 NOP
|
||
119:12493+4 1758 00 NOP
|
||
120:12497+7 1759 3E00 LD A,0x00
|
||
121:12504+11 175B D3F4 OUT (CS_PIO_AD), A
|
||
122:12515+4 175D 00 NOP
|
||
123:12519+4 175E 00 NOP
|
||
124:12523+10 175F C9 RET
|
||
125:
|
||
126: ; send end/stop bit
|
||
127: - 1760 iic_send_ebit:
|
||
128: ;Set port to controll mode (MODE3)
|
||
129:12533+7 1760 3ECF LD A,0xCF
|
||
130:12540+11 1762 D3F6 OUT (CS_PIO_AC), A
|
||
131:
|
||
132: ;Set inputs/outputs (SDA and SCL is now output)
|
||
133:12551+7 1764 3EFC LD A,0xFC
|
||
134:12558+11 1766 D3F6 OUT (CS_PIO_AC), A
|
||
135: ;SCL HIGH, SDA LOW
|
||
136:12569+7 1768 3E02 LD A,0x02
|
||
137:12576+11 176A D3F4 OUT (CS_PIO_AD), A
|
||
138:12587+4 176C 00 NOP
|
||
139:12591+4 176D 00 NOP
|
||
140:12595+7 176E 3E03 LD A,0x03 ; both high
|
||
141:12602+11 1770 D3F4 OUT (CS_PIO_AD), A
|
||
142:12613+4 1772 00 NOP
|
||
143:12617+4 1773 00 NOP
|
||
144: ;release bus
|
||
145: ;Set port to controll mode (MODE3)
|
||
146:12621+7 1774 3ECF LD A,0xCF
|
||
147:12628+11 1776 D3F6 OUT (CS_PIO_AC), A
|
||
148:12639+4 1778 00 NOP
|
||
149:12643+4 1779 00 NOP
|
||
150: ;Set inputs/outputs (SDA and SCL is now input, sound enabled)
|
||
151:12647+7 177A 3EF7 LD A,11110111b
|
||
152:12654+11 177C D3F6 OUT (CS_PIO_AC), A
|
||
153:12665+4 177E 00 NOP
|
||
154:12669+4 177F 00 NOP
|
||
155:12673+10 1780 C9 RET
|
||
156:
|
||
157:
|
||
158: - 1781 iic_read_ack:
|
||
159:12683+7 1781 3ECF LD A,0xCF
|
||
160:12690+11 1783 D3F6 OUT (CS_PIO_AC), A
|
||
161: ;Set inputs/outputs (SCL is now output, SDA input)
|
||
162:12701+7 1785 3EFD LD A,0xFD
|
||
163:12708+11 1787 D3F6 OUT (CS_PIO_AC), A
|
||
164:12719+4 1789 00 NOP
|
||
165:12723+4 178A 00 NOP
|
||
166:12727+7 178B 3E00 LD A,0x00 ;set SCL LOW
|
||
167:12734+11 178D D3F4 OUT (CS_PIO_AD), A
|
||
168:12745+4 178F 00 NOP
|
||
169:12749+4 1790 00 NOP
|
||
170:12753+7 1791 EE02 XOR 0x02 ;set SCL HIGH
|
||
171:12760+11 1793 D3F4 OUT (CS_PIO_AD), A
|
||
172:12771+4 1795 00 NOP
|
||
173:12775+11 1796 DBF4 IN A,(CS_PIO_AD) ; Read SDA
|
||
174:12786+4 1798 00 NOP
|
||
175:12790+4 1799 00 NOP
|
||
176:12794+11 179A F5 PUSH AF
|
||
177:12805+7 179B E6FE AND 0xFE ; Filter input
|
||
178:12812+7 179D EE02 XOR 0x02 ;set SCL LOW
|
||
179:12819+11 179F D3F4 OUT (CS_PIO_AD), A
|
||
180:12830+4 17A1 00 NOP
|
||
181:12834+4 17A2 00 NOP
|
||
182:12838+10 17A3 F1 POP AF
|
||
183:12848+7 17A4 E601 AND 1
|
||
184:12855+10 17A6 C9 RET
|
||
185:
|
||
186: - 17A7 iic_send_ack:
|
||
187: ;Set port to controll mode (MODE3)
|
||
188:12865+7 17A7 3ECF LD A,0xCF
|
||
189:12872+11 17A9 D3F6 OUT (CS_PIO_AC), A
|
||
190: ;Set inputs/outputs (SDA and SCL is now output)
|
||
191:12883+7 17AB 3EFC LD A,0xFC
|
||
192:12890+11 17AD D3F6 OUT (CS_PIO_AC), A
|
||
193:12901+4 17AF 00 NOP
|
||
194:12905+4 17B0 00 NOP
|
||
195:12909+7 17B1 3E00 LD A,0x00 ; SCL LOW, SDA LOW
|
||
196:12916+11 17B3 D3F4 OUT (CS_PIO_AD), A
|
||
197:12927+4 17B5 00 NOP
|
||
198:12931+4 17B6 00 NOP
|
||
199:12935+7 17B7 3E02 LD A,0x02 ; SCL HIGH, SDA LOW
|
||
200:12942+11 17B9 D3F4 OUT (CS_PIO_AD), A
|
||
201:12953+4 17BB 00 NOP
|
||
202:12957+4 17BC 00 NOP
|
||
203:12961+7 17BD 3E00 LD A,0x00 ; SCL LOW, SDA LOW
|
||
204:12968+11 17BF D3F4 OUT (CS_PIO_AD), A
|
||
205:12979+4 17C1 00 NOP
|
||
206:12983+4 17C2 00 NOP
|
||
207:12987+10 17C3 C9 RET
|
||
208:
|
||
209: - 17C4 iic_send_nack:
|
||
210: ;Set port to controll mode (MODE3)
|
||
211:12997+7 17C4 3ECF LD A,0xCF
|
||
212:13004+11 17C6 D3F6 OUT (CS_PIO_AC), A
|
||
213: ;Set inputs/outputs (SDA and SCL is now output)
|
||
214:13015+7 17C8 3EFC LD A,0xFC
|
||
215:13022+11 17CA D3F6 OUT (CS_PIO_AC), A
|
||
216:13033+4 17CC 00 NOP
|
||
217:13037+4 17CD 00 NOP
|
||
218:13041+7 17CE 3E02 LD A,0x02 ; SCL LOW, SDA HIGH
|
||
219:13048+11 17D0 D3F4 OUT (CS_PIO_AD), A
|
||
220:13059+4 17D2 00 NOP
|
||
221:13063+4 17D3 00 NOP
|
||
222:13067+7 17D4 3E03 LD A,0x03 ; both high
|
||
223:13074+11 17D6 D3F4 OUT (CS_PIO_AD), A
|
||
224:13085+4 17D8 00 NOP
|
||
225:13089+4 17D9 00 NOP
|
||
226:13093+7 17DA 3E02 LD A,0x02 ; SCL LOW, SDA HIGH
|
||
227:13100+11 17DC D3F4 OUT (CS_PIO_AD), A
|
||
228:13111+4 17DE 00 NOP
|
||
229:13115+4 17DF 00 NOP
|
||
230:13119+10 17E0 C9 RET
|
||
231:
|
||
232: ;A contains byte
|
||
233: - 17E1 iic_send_byte:
|
||
234:13129+11 17E1 C5 PUSH BC
|
||
235:13140+4 17E2 4F LD C,A ;buffer
|
||
236: ;Set port to controll mode (MODE3)
|
||
237:13144+7 17E3 3ECF LD A,0xCF
|
||
238:13151+11 17E5 D3F6 OUT (CS_PIO_AC), A
|
||
239: ;Set inputs/outputs (SDA and SCL is now output)
|
||
240:13162+7 17E7 3EFC LD A,0xFC
|
||
241:13169+11 17E9 D3F6 OUT (CS_PIO_AC), A
|
||
242:13180+7 17EB 0608 LD B,8 ;bit counter
|
||
243:
|
||
244: - 17ED iic_send_byte_loop:
|
||
245: ;prepare data
|
||
246:13187+8 17ED CB11 RL C
|
||
247:13195+7 17EF 3E00 LD A,0
|
||
248:13202+4 17F1 17 RLA ; set SCA bit from carry, SCL LOW
|
||
249:13206+11 17F2 D3F4 OUT (CS_PIO_AD), A
|
||
250:13217+4 17F4 00 NOP
|
||
251:13221+4 17F5 00 NOP
|
||
252:13225+7 17F6 EE02 XOR 0x02 ;set SCL HIGH
|
||
253:13232+11 17F8 D3F4 OUT (CS_PIO_AD), A
|
||
254:13243+4 17FA 00 NOP
|
||
255:13247+4 17FB 00 NOP
|
||
256:13251+7 17FC EE02 XOR 0x02 ;set SCL LOW
|
||
257:13258+11 17FE D3F4 OUT (CS_PIO_AD), A
|
||
258:13269+4 1800 00 NOP
|
||
259:13273+4 1801 00 NOP
|
||
260:13277+8+5 1802 10E9 DJNZ iic_send_byte_loop ;loop until counter is 0
|
||
261: ;transmittion end / end loop
|
||
262:13285+4 1804 79 LD A,C
|
||
263:13289+10 1805 C1 POP BC
|
||
264:13299+10 1806 C9 RET
|
||
265:
|
||
266: - 1807 iic_receive_byte:
|
||
267:13309+11 1807 C5 PUSH BC
|
||
268: ;Set port to controll mode (MODE3)
|
||
269:13320+7 1808 3ECF LD A,0xCF
|
||
270:13327+11 180A D3F6 OUT (CS_PIO_AC), A
|
||
271: ;Set inputs/outputs (SCL is now output, SDA input)
|
||
272:13338+7 180C 3EFD LD A,0xFD
|
||
273:13345+11 180E D3F6 OUT (CS_PIO_AC), A
|
||
274:13356+7 1810 0608 LD B,8 ;bit counter
|
||
275:13363+7 1812 0E00 LD C,0
|
||
276: - 1814 iic_receive_byte_loop:
|
||
277:13370+4 1814 AF XOR A ;set SCL LOW
|
||
278:13374+11 1815 D3F4 OUT (CS_PIO_AD), A
|
||
279:13385+4 1817 00 NOP
|
||
280:13389+4 1818 00 NOP
|
||
281:13393+7 1819 3E02 LD A,2 ;set SCL HIGH
|
||
282:13400+11 181B D3F4 OUT (CS_PIO_AD), A
|
||
283:13411+4 181D 00 NOP
|
||
284:13415+11 181E DBF4 IN A, (CS_PIO_AD)
|
||
285:13426+4 1820 00 NOP
|
||
286:13430+4 1821 1F RRA ;read SDA bit
|
||
287:13434+8 1822 CB11 RL C ;store bit
|
||
288:13442+4 1824 AF XOR A ;set SCL LOW again
|
||
289:13446+11 1825 D3F4 OUT (CS_PIO_AD), A
|
||
290:13457+4 1827 00 NOP
|
||
291:13461+4 1828 00 NOP
|
||
292:13465+8+5 1829 10E9 DJNZ iic_receive_byte_loop
|
||
293:13473+4 182B 79 LD A,C
|
||
294:13477+10 182C C1 POP BC
|
||
**** main.asm ****
|
||
214:13487+10 182D C9 RET
|
||
215: .include "kdrv_int.s"
|
||
**** include/kdrv_int.s ****
|
||
1:
|
||
2: - 4000 INT_VEC_TABLE .equ [interrupt_vectors]
|
||
3: - 00F4 INT_PIO_ADDRD .equ CS_PIO_AD
|
||
4: - 00F6 INT_PIO_ADDRC .equ CS_PIO_AC
|
||
5:
|
||
6: ;initialize interrupt controller
|
||
7: - 182E intctrl_init:
|
||
8: ;disable interrupt (just to make sure)
|
||
9:13497+4 182E F3 di
|
||
10: ;setup interrupt table
|
||
11:13501+7 182F 3E40 ld a,high [INT_VEC_TABLE]
|
||
12:13508+9 1831 ED47 ld i,a
|
||
13:
|
||
14: ; set port
|
||
15:13517+4 1833 AF xor a
|
||
16:13521+11 1834 D3F4 out (INT_PIO_ADDRD), a
|
||
17:
|
||
18: ;fill table
|
||
19:13532+10 1836 210040 ld hl,[INT_VEC_TABLE]
|
||
20:13542+7 1839 0680 ld b,128
|
||
21: - 183B _intctrl_init_fill_loop:
|
||
22:13549+7 183B 3E5A ld a, low [_int_invalid_int]
|
||
23:13556+7 183D 77 ld (hl),a
|
||
24:13563+6 183E 23 inc hl
|
||
25:13569+7 183F 3E18 ld a, high [_int_invalid_int]
|
||
26:13576+7 1841 77 ld (hl),a
|
||
27:13583+6 1842 23 inc hl
|
||
28:13589+8+5 1843 10F6 djnz _intctrl_init_fill_loop
|
||
29:
|
||
30: ;set int vector for PIO
|
||
31:13597+10 1845 214E18 ld hl, [_isr_pio]
|
||
32:13607+16 1848 220240 ld (INT_VEC_TABLE + 2), hl
|
||
33:
|
||
34: ;enable interrupts
|
||
35:13623+8 184B ED5E im 2
|
||
36:13631+10 184D C9 ret
|
||
37:
|
||
38: ;------------------------------------------------------------------------------
|
||
39: ; setup interrupt for PIO pin
|
||
40: ; inputs: a (interrupt pin)
|
||
41: ; hl (jump addr)
|
||
42: ;------------------------------------------------------------------------------
|
||
43: - 184E initctrl_int_register:
|
||
44:
|
||
45: ;------------------------------------------------------------------------------
|
||
46: ; removes interrupt for PIO pin
|
||
47: ; inputs: a (interrupt pin)
|
||
48: ;------------------------------------------------------------------------------
|
||
49: - 184E initctrl_int_abandon:
|
||
50:
|
||
51: ; jumps to isr. MUST be exited with RETI opcode!
|
||
52: - 184E _isr_pio:
|
||
53:13641+4 184E F3 di
|
||
54:13645+10 184F 219B18 ld hl, [_str_pio_interrupt]
|
||
55:13655+17 1852 CDFC00 call print_str
|
||
56: ;get int from pio
|
||
57:13672+11 1855 DBF4 in a,(INT_PIO_ADDRD)
|
||
58:13683+17 1857 CD2201 call print_a_hex
|
||
59:
|
||
60: - 185A _int_invalid_int:
|
||
61:13700+4 185A F3 di
|
||
62:13704+10 185B 216418 ld hl, [_str_invalid_interrupt]
|
||
63:13714+17 185E CDFC00 call print_str
|
||
64:13731+4 1861 FB ei
|
||
65:13735+14 1862 ED4D reti
|
||
66:
|
||
67: - 1864 _str_invalid_interrupt:
|
||
68: - 1864 0A0D5B4B db 10,13,"[KERNEL] INT: Invalid interrupt call! Exiting ISR.",10,13,0
|
||
45524E45
|
||
4C5D2049
|
||
4E543A20
|
||
496E7661
|
||
6C696420
|
||
696E7465
|
||
72727570
|
||
74206361
|
||
6C6C2120
|
||
45786974
|
||
696E6720
|
||
4953522E
|
||
0A0D00
|
||
69:
|
||
70: - 189B _str_pio_interrupt:
|
||
**** main.asm ****
|
||
216: - 189B 0A0D5B4B db 10,13,"[KERNEL] INT: (DEBUG) Interrupt call from PIO.",10,13,0
|
||
45524E45
|
||
4C5D2049
|
||
4E543A20
|
||
28444542
|
||
55472920
|
||
496E7465
|
||
72727570
|
||
74206361
|
||
6C6C2066
|
||
726F6D20
|
||
50494F2E
|
||
0A0D00
|
||
217: .include "kdrv_sio.s"
|
||
**** include/kdrv_sio.s ****
|
||
1: ;----------------------------------------------------------------
|
||
2: ;BIOS Driver for Serial Console
|
||
3: ;by Dennis Gunia (07/2024)
|
||
4: ;
|
||
5: ;----------------------------------------------------------------
|
||
6:
|
||
7: ;================================================================
|
||
8: ; I/O access functions
|
||
9: ;================================================================
|
||
10: ;initialize SIO Port A
|
||
11:
|
||
12: - 18CE consio_init_a:
|
||
13:13749+17 18CE CD1D19 call consio_init_ctc_a
|
||
14:13766+17 18D1 CDD518 call consio_init_a_sio
|
||
15: ;call consio_init_a_int
|
||
16:13783+10 18D4 C9 ret
|
||
17:
|
||
18: - 18D5 consio_init_a_sio:
|
||
19:13793+7 18D5 3E30 ld A, 00110000b ;write into WR0: error reset, select WR0
|
||
20:13800+11 18D7 D309 out (CS_SIO_A_C), a
|
||
21:13811+7 18D9 3E18 ld a, 018h ;write into WR0: channel reset
|
||
22:13818+11 18DB D309 out (CS_SIO_A_C), a
|
||
23:13829+7 18DD 3E04 ld a, 004h ;write into WR0: select WR4
|
||
24:13836+11 18DF D309 out (CS_SIO_A_C), a
|
||
25:13847+7 18E1 3E44 ld a, 01000100b ;write into WR4: clkx16,1 stop bit, no parity
|
||
26:13854+11 18E3 D309 out (CS_SIO_A_C), a
|
||
27:13865+7 18E5 3E05 ld a, 005h ;write into WR0: select WR5
|
||
28:13872+11 18E7 D309 out (CS_SIO_A_C), a
|
||
29:13883+7 18E9 3EE8 ld a, 11101000b ;DTR inactive, TX 8bit, BREAK off, TX on, RTS inactive
|
||
30:13890+11 18EB D309 out (CS_SIO_A_C), a
|
||
31:13901+7 18ED 3E01 ld a, 01h ;write into WR0: select WR1
|
||
32:13908+11 18EF D309 out (CS_SIO_A_C), a
|
||
33:13919+7 18F1 3E04 ld a, 00000100b ;no interrupt in CH B, special RX condition affects vect
|
||
34:13926+11 18F3 D309 out (CS_SIO_A_C), a
|
||
35:13937+7 18F5 3E02 ld a, 02h ;write into WR0: select WR2
|
||
36:13944+11 18F7 D309 out (CS_SIO_A_C), a
|
||
37:13955+7 18F9 3E00 ld a, 0h ;write into WR2: cmd line int vect (see int vec table)
|
||
38: ;bits D3,D2,D1 are changed according to RX condition
|
||
39:13962+11 18FB D309 out (CS_SIO_A_C), a
|
||
40:13973+7 18FD 3E03 ld a, 003h ;write into WR0: select WR3
|
||
41:13980+11 18FF D309 out (CS_SIO_A_C), a
|
||
42:13991+7 1901 3EC1 ld a, 0C1h ;RX 8bit, auto enable off, RX on
|
||
43:13998+11 1903 D309 out (CS_SIO_A_C), a
|
||
44:14009+10 1905 C9 ret
|
||
45:
|
||
46: - 1906 consio_init_a_int:
|
||
47: ;setup SIO interrupt vector
|
||
48:14019+7 1906 3E02 ld a, 2 ;write WR2
|
||
49:14026+11 1908 D30B out (CS_SIO_B_C), a
|
||
50:14037+7 190A 3E04 ld a, 00000100b ;write Vector
|
||
51:14044+11 190C D30B out (CS_SIO_B_C), a
|
||
52: ;setup SIO
|
||
53:14055+7 190E 3E01 ld a, 1 ;write WR1
|
||
54:14062+11 1910 D309 out (CS_SIO_A_C), a
|
||
55:14073+7 1912 3E18 ld a, 00011000b ;enable INT on all RX
|
||
56:14080+11 1914 D309 out (CS_SIO_A_C), a
|
||
57: ;set ISR addr
|
||
58:14091+10 1916 216019 ld hl, [consio_isr]
|
||
59:14101+16 1919 220440 ld (INT_VEC_TABLE + 4), hl
|
||
60:14117+10 191C C9 ret
|
||
61:
|
||
62: - 191D consio_init_ctc_a:
|
||
63:14127+7 191D 3E4F ld a, 01001111b; External Trigger, Time COnstant Follows
|
||
64:14134+11 191F D304 out (CS_CTC_0),a
|
||
65:14145+11 1921 DB01 in a, (CS_DIP) ; Read BAUD from DIP-Switches
|
||
66:14156+11 1923 D304 out (CS_CTC_0),a
|
||
67:14167+10 1925 C9 ret
|
||
68:
|
||
69:
|
||
70: - 1926 consio_tx_a:
|
||
71:14177+11 1926 D308 out (CS_SIO_A_D),a
|
||
72: - 1928 consio_tx_a_waitout:
|
||
73: ; check for TX buffer empty
|
||
74:14188+4 1928 97 sub a ;clear a, write into WR0: select RR0
|
||
75:14192+4 1929 3C inc a ;select RR1
|
||
76:14196+11 192A D309 out (CS_SIO_A_C),A
|
||
77:14207+11 192C DB09 in A,(CS_SIO_A_C) ;read RRx
|
||
78:14218+8 192E CB47 bit 0,A
|
||
79:14226+7+5 1930 28F6 jr z,consio_tx_a_waitout
|
||
80:14233+10 1932 C9 ret
|
||
81:
|
||
82: - 1933 consio_rx_a:
|
||
83:14243+17 1933 CD4419 call consio_rx_rts_a_on
|
||
84:14260+4 1936 AF xor a ; a = 0
|
||
85:14264+11 1937 D309 out (CS_SIO_A_C), a ; select reg 0
|
||
86:14275+11 1939 DB09 in a, (CS_SIO_A_C) ; read reg 0
|
||
87:14286+7 193B E601 and 1 ; mask D0 (recieve char available)
|
||
88:14293+17 193D CDDA01 call A_RTS_OFF
|
||
89:14310+5+6 1940 C8 ret Z ; return 0 if no char
|
||
90:14315+11 1941 DB08 in a, (CS_SIO_A_D) ; read char if avail
|
||
91:14326+10 1943 C9 ret ; return
|
||
92:
|
||
93: - 1944 consio_rx_rts_a_on:
|
||
94:14336+7 1944 3E05 ld a,005h ;write into WR0: select WR5
|
||
95:14343+11 1946 D309 out (CS_SIO_A_C),A
|
||
96:14354+7 1948 3EEA ld a,0EAh ;DTR active, TX 8bit, BREAK off, TX on, RTS active
|
||
97:14361+11 194A D309 out (CS_SIO_A_C),A
|
||
98:14372+10 194C C9 ret
|
||
99:
|
||
100: - 194D consio_rx_rts_a_off:
|
||
101:14382+7 194D 3E05 ld a,005h ;write into WR0: select WR5
|
||
102:14389+11 194F D309 out (CS_SIO_A_C),A
|
||
103:14400+7 1951 3E68 ld a,068h ;DTR inactive, TX 8bit, BREAK off, TX on, RTS inactive
|
||
104:14407+11 1953 D309 out (CS_SIO_A_C),A
|
||
105:14418+10 1955 C9 ret
|
||
106:
|
||
107: - 1956 consio_rx_a_sts:
|
||
108:14428+11 1956 D309 out (CS_SIO_A_C), a ; select reg 0
|
||
109:14439+11 1958 DB09 in a, (CS_SIO_A_C) ; read reg 0
|
||
110:14450+7 195A E601 and 1 ; mask D0 (recieve char available)
|
||
111:14457+5+6 195C C8 ret z
|
||
112:14462+7 195D 3EFF ld a, 0xFF
|
||
113:14469+10 195F C9 ret
|
||
114:
|
||
115:
|
||
116: ;Interrupt service routine
|
||
117: - 1960 consio_isr:
|
||
118:14479+4 1960 F3 di
|
||
119:14483+7 1961 3E38 ld a, 00111000b ;RET fro INT
|
||
120:14490+11 1963 D30B out (CS_SIO_B_C), a ;read data
|
||
121:14501+11 1965 DB08 in a, (CS_SIO_A_D)
|
||
122:14512+17 1967 CDBF01 call con_rb_write ;write to ringbuffer
|
||
123:14529+4 196A FB ei
|
||
**** main.asm ****
|
||
218:14533+14 196B ED4D reti
|
||
219: .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: - 196D dump_pretty:
|
||
15:14547+11 196D E5 PUSH HL
|
||
16:14558+10 196E 21C819 LD HL,[STR_PD_HEADER] ;Print header
|
||
17:14568+17 1971 CDFC00 CALL print_str
|
||
18:14585+10 1974 E1 POP HL
|
||
19: - 1975 dump_pretty_row:
|
||
20:14595+4 1975 78 LD A,B ;Check row counter
|
||
21:14599+4 1976 B7 OR A
|
||
22:14603+10 1977 CAC719 JP Z, dump_pretty_end ;If counter is 0, exit
|
||
23:14613+4 197A 05 DEC B ;Decrement row counter by 1
|
||
24:14617+7 197B 0E10 LD C, 16 ;Load column counter
|
||
25:14624+4 197D 7C LD A, H ;Print base address
|
||
26:14628+17 197E CD2201 CALL print_a_hex
|
||
27:14645+4 1981 7D LD A, L
|
||
28:14649+17 1982 CD2201 CALL print_a_hex
|
||
29:14666+7 1985 3E20 LD A, ' '
|
||
30:14673+17 1987 CDF600 CALL print_char
|
||
31: - 198A dump_pretty_col: ;Loop for column
|
||
32:14690+7 198A 7E LD A,(HL) ;Load byte to disply
|
||
33:14697+17 198B CD2201 CALL print_a_hex
|
||
34:14714+7 198E 3E20 LD A, ' '
|
||
35:14721+17 1990 CDF600 CALL print_char
|
||
36:14738+6 1993 23 INC HL
|
||
37:14744+4 1994 0D DEC C ;Decrement column counter
|
||
38:14748+7+5 1995 20F3 JR NZ, dump_pretty_col ;Loop if not 0
|
||
39: - 1997 dump_pretty_ascii:
|
||
40:14755+11 1997 C5 PUSH BC
|
||
41:14766+11 1998 E5 PUSH HL
|
||
42:14777+7 1999 0600 LD B,0
|
||
43:14784+7 199B 0E10 LD C,16
|
||
44:14791+15 199D ED42 SBC HL,BC ;Reset HL by column count
|
||
45: - 199F dump_pretty_ascii_loop:
|
||
46:14806+7 199F 7E LD A,(HL)
|
||
47:14813+6 19A0 23 INC HL
|
||
48:14819+7 19A1 FE20 CP 32
|
||
49:14826+10 19A3 DAB019 JP C, dump_pretty_ascii_none ;if less than 32, it is not a char
|
||
50:14836+7 19A6 FE7F CP 127
|
||
51:14843+10 19A8 D2B019 JP NC, dump_pretty_ascii_none ;if greater or equal than 128, it is not a char
|
||
52:14853+17 19AB CDF600 call print_char
|
||
53:14870+12 19AE 1805 jr dump_pretty_ascii_cont
|
||
54: - 19B0 dump_pretty_ascii_none:
|
||
55:14882+7 19B0 3E2E LD A,'.'
|
||
56:14889+17 19B2 CDF600 call print_char
|
||
57: - 19B5 dump_pretty_ascii_cont:
|
||
58:14906+4 19B5 0D DEC C
|
||
59:14910+10 19B6 C29F19 JP NZ, dump_pretty_ascii_loop
|
||
60:
|
||
61:
|
||
62:14920+10 19B9 E1 POP HL
|
||
63:14930+10 19BA C1 POP BC
|
||
64: - 19BB dump_pretty_nextrow:
|
||
65:14940+7 19BB 3E0A LD A,10 ;New line
|
||
66:14947+17 19BD CDF600 CALL print_char
|
||
67:14964+7 19C0 3E0D LD A,13
|
||
68:14971+17 19C2 CDF600 CALL print_char
|
||
69:14988+12 19C5 18AE JR dump_pretty_row ;Else next line
|
||
70: - 19C7 dump_pretty_end:
|
||
71:15000+10 19C7 C9 RET
|
||
72:
|
||
73: - 19C8 STR_PD_HEADER:
|
||
74: - 19C8 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: - 1A07 print_str_fixed:
|
||
85:15010+7 1A07 7E LD A,(HL)
|
||
86:15017+6 1A08 23 INC HL
|
||
87:15023+17 1A09 CDF600 CALL print_char
|
||
88:15040+8+5 1A0C 10F9 DJNZ print_str_fixed
|
||
89:15048+10 1A0E C9 RET
|
||
90:
|
||
**** main.asm ****
|
||
220: .include "command.s"
|
||
**** include/command.s ****
|
||
1: - 1A0F COMMAND_LUT:
|
||
2: - 1A0F 64617465 db "date", 0 , [OP_RTIME], [OP_RTIME]>>8 ;Read time
|
||
004F1D
|
||
3: - 1A16 73657464 db "setdate", 0 , [OP_STIME], [OP_STIME]>>8 ;Read time
|
||
61746500
|
||
E71E
|
||
4: - 1A20 70696E20 db "pin ", 0 , [OP_IO_IN], [OP_IO_IN]>>8 ;Read port
|
||
00681C
|
||
5: - 1A27 64756D70 db "dump ",0, [OP_DUMP], [OP_DUMP]>>8 ;print pretty hexdump
|
||
2000D71B
|
||
6: - 1A2F 706F7574 db "pout ", 0 , [OP_IO_OUT], [OP_IO_OUT]>>8 ;Write port
|
||
20007E1C
|
||
7: - 1A37 69696E20 db "iin ", 0, [OP_IIC_IN], [OP_IIC_IN]>>8 ;Read IIC
|
||
00FF1C
|
||
8: - 1A3E 696F7574 db "iout ", 0, [OP_IIC_OUT], [OP_IIC_OUT]>>8 ;Write IIC
|
||
20009F1C
|
||
9: - 1A46 63616C6C db "call ", 0, [OP_CALL], [OP_CALL]>>8 ;Call to addr
|
||
2000B71B
|
||
10: - 1A4E 636C7200 db "clr", 0, [OP_CLR], [OP_CLR]>>8 ;Call to addr
|
||
4B1D
|
||
11: - 1A54 6461736D db "dasm ", 0, [OP_DASM], [OP_DASM]>>8 ;Call to addr
|
||
2000381C
|
||
12: - 1A5C 6A702000 db "jp ", 0,[OP_EXEC], [OP_EXEC]>>8 ;jump to addr
|
||
9E1B
|
||
13: - 1A62 72737400 db "rst", 0,0x00,0x00 ;soft reset
|
||
0000
|
||
14: - 1A68 6C736473 db "lsdsk", 0,[OP_LSDSK], [OP_LSDSK]>>8 ;list disks
|
||
6B00601F
|
||
15: - 1A70 73656C64 db "seldsk ", 0,[OP_SELDSK], [OP_SELDSK]>>8 ;select disk
|
||
736B2000
|
||
641F
|
||
16: - 1A7A 63642000 db "cd ", 0 , [OP_CD], [OP_CD]>>8 ;Read time
|
||
871F
|
||
17: - 1A80 6C730083 db "ls", 0 , [OP_DIR], [OP_DIR]>>8 ;Read time
|
||
1F
|
||
18: - 1A85 72756E20 db "run ", 0 , [OP_FSEXEC], [OP_FSEXEC]>>8 ;Read time
|
||
00A41F
|
||
19: - 1A8C 24009E1B db "$", 0, [OP_EXEC], [OP_EXEC]>>8 ;jump to addr
|
||
20: - 1A90 6900681C db "i", 0, [OP_IO_IN], [OP_IO_IN]>>8 ;Read port
|
||
21: - 1A94 6F007E1C db "o", 0, [OP_IO_OUT], [OP_IO_OUT]>>8 ;Write port
|
||
22: - 1A98 2100071C db "!", 0, [OP_SET], [OP_SET]>>8 ;Write memory
|
||
23: - 1A9C 3F00D71B db "?", 0, [OP_DUMP], [OP_DUMP]>>8 ;Print memory
|
||
24: - 1AA0 FF db 0xFF ;End of Table
|
||
25:
|
||
26: - 1AA1 COMMAND_ABORT:
|
||
27: ;cleanup stack
|
||
28:15058+10 1AA1 31FFFF ld sp, STACK_RAM_TOP
|
||
29: ; return to prompt
|
||
30: - 1AA4 COMMAND:
|
||
31:15068+17 1AA4 CD0C01 call print_newLine
|
||
32:15085+10 1AA7 212F42 ld hl,[var_dir]
|
||
33:15095+17 1AAA CDFC00 call print_str
|
||
34:15112+7 1AAD 3E3E ld a,'>'
|
||
35:15119+17 1AAF CDF600 call print_char
|
||
36:15136+4 1AB2 AF xor a ;reset buffer len
|
||
37:15140+13 1AB3 320442 ld (var_buffer_len),a ;set buffer len to 0
|
||
38: - 1AB6 COMMAND_READ:
|
||
39:15153+17 1AB6 CD4C01 call read_char
|
||
40:15170+10 1AB9 CAB61A jp z, COMMAND_READ ;wait for input
|
||
41:15180+7 1ABC FE0D cp 13 ; enter
|
||
42:15187+10 1ABE CA0B1B jp z,COMMAND_PROCESS
|
||
43:15197+7 1AC1 FE0A cp 10
|
||
44:15204+10 1AC3 CAB61A jp z, COMMAND_READ; skip LF for file load
|
||
45:15214+7 1AC6 FE08 cp 0x08 ; backspace 0x08 VT102 0x7f Putty
|
||
46:15221+10 1AC8 CAE51A jp z,COMMAND_BACKSPACE
|
||
47:
|
||
48:15231+11 1ACB F5 push af
|
||
49: ; a contains latest char
|
||
50:15242+10 1ACC 217F42 ld hl,[var_input]
|
||
51:15252+7 1ACF 1600 ld d,0
|
||
52:15259+13 1AD1 3A0442 ld a,(var_buffer_len)
|
||
53:15272+4 1AD4 5F ld e,a
|
||
54:15276+11 1AD5 19 add hl,de ;hl now contains pointer to last position in buffer
|
||
55:15287+4 1AD6 3C inc a
|
||
56:15291+13 1AD7 320442 ld (var_buffer_len),a ;store incremented buffer length
|
||
57:
|
||
58:15304+10 1ADA F1 pop af
|
||
59:15314+7 1ADB 77 ld (hl),a
|
||
60:15321+17 1ADC CDF600 call print_char
|
||
61:15338+6 1ADF 23 inc hl
|
||
62:15344+4 1AE0 AF xor a ;a = 0
|
||
63:15348+7 1AE1 77 ld (hl),a ;always add null termination after last char
|
||
64:15355+10 1AE2 C3B61A jp COMMAND_READ
|
||
65:
|
||
66:
|
||
67: - 1AE5 COMMAND_BACKSPACE:
|
||
68:15365+13 1AE5 3A0442 ld a,(var_buffer_len)
|
||
69:15378+4 1AE8 A7 and a
|
||
70:15382+10 1AE9 CAB61A jp z, COMMAND_READ ; do not continue if already at char 0
|
||
71:15392+4 1AEC 3D dec a ;decrement length
|
||
72:15396+13 1AED 320442 ld (var_buffer_len),a ;and store it
|
||
73:15409+4 1AF0 5F ld e,a ;load de with decremented value
|
||
74:15413+7 1AF1 1600 ld d,0
|
||
75:15420+10 1AF3 217F42 ld hl,[var_input]
|
||
76:15430+11 1AF6 19 add hl,de ;hl now contains pointer to last position in buffer
|
||
77:15441+4 1AF7 AF xor a ; store null byte to current location
|
||
78:15445+7 1AF8 77 ld (hl),a
|
||
79: ;call print_delete
|
||
80:15452+7 1AF9 3E08 ld a, 0x08
|
||
81:15459+17 1AFB CDF600 call print_char
|
||
82:15476+7 1AFE 3E20 ld a, 0x20
|
||
83:15483+17 1B00 CDF600 call print_char
|
||
84:15500+7 1B03 3E08 ld a, 0x08
|
||
85:15507+17 1B05 CDF600 call print_char
|
||
86:15524+10 1B08 C3B61A jp COMMAND_READ
|
||
87: - 1B0B COMMAND_PROCESS:
|
||
88: ;compare
|
||
89:15534+10 1B0B 210F1A LD HL,[COMMAND_LUT] ;Lookup table
|
||
90: - 1B0E COMMAND_PROCESS_LOOP:
|
||
91:15544+10 1B0E 117F42 LD DE,[var_input] ;Buffer
|
||
92:15554+7 1B11 7E LD A,(HL) ;Load first byte of entry
|
||
93:15561+7 1B12 FEFF CP 0xFF
|
||
94:15568+10 1B14 CA3D1B JP Z,COMMAND_PROCESS_NOT_FOUND ;if first byte is 0xFF, End is reached
|
||
95: ; compare string loop
|
||
96: - 1B17 COMMAND_PROCESS_LOOP_STR1:
|
||
97:15578+7 1B17 1A LD A,(DE)
|
||
98:15585+4 1B18 47 LD B,A
|
||
99:15589+7 1B19 7E LD A,(HL)
|
||
100:15596+4 1B1A B0 OR B ;not 0 -> match
|
||
101:15600+10 1B1B CA461B JP Z, COMMAND_PROCESS_FOUND ;match
|
||
102:
|
||
103:15610+7 1B1E 1A LD A,(DE)
|
||
104:15617+4 1B1F 47 LD B,A
|
||
105: ;LD A,(HL) ;Load first byte of entry
|
||
106: ;call print_a_hex
|
||
107:15621+7 1B20 7E LD A,(HL)
|
||
108: ;compare byte
|
||
109:15628+4 1B21 A8 XOR B
|
||
110:15632+4 1B22 B7 OR A ;if identical = resoult shopuld be zero
|
||
111:15636+10 1B23 CA2D1B JP Z, COMMAND_PROCESS_LOOP_STR2 ;then continue
|
||
112: ; if not identical
|
||
113:15646+7 1B26 7E LD A,(HL)
|
||
114:15653+4 1B27 B7 OR A ;if reached end of compare string
|
||
115:15657+10 1B28 CA461B JP Z, COMMAND_PROCESS_FOUND ;match
|
||
116:15667+12 1B2B 1805 JR COMMAND_PROCESS_NEXT_ENTRY ;next entry on no match
|
||
117:
|
||
118: - 1B2D COMMAND_PROCESS_LOOP_STR2: ;continue with next char
|
||
119:15679+6 1B2D 23 INC HL
|
||
120:15685+6 1B2E 13 INC DE
|
||
121:15691+12 1B2F 18E6 JR COMMAND_PROCESS_LOOP_STR1
|
||
122:
|
||
123: - 1B31 COMMAND_PROCESS_NEXT_ENTRYI: ;do not jump here
|
||
124:15703+6 1B31 23 INC HL
|
||
125: - 1B32 COMMAND_PROCESS_NEXT_ENTRY: ;jump here
|
||
126:15709+7 1B32 7E LD A,(HL)
|
||
127:15716+4 1B33 B7 OR A
|
||
128:15720+10 1B34 C2311B JP NZ,COMMAND_PROCESS_NEXT_ENTRYI ;loop until end of string
|
||
129:15730+6 1B37 23 INC HL ;skip pointer
|
||
130:15736+6 1B38 23 INC HL
|
||
131:15742+6 1B39 23 INC HL
|
||
132:15748+10 1B3A C30E1B JP COMMAND_PROCESS_LOOP
|
||
133: - 1B3D COMMAND_PROCESS_NOT_FOUND:
|
||
134:15758+10 1B3D 21771B LD HL,[_STR_NOT_FOUND]
|
||
135:15768+17 1B40 CDFC00 CALL print_str
|
||
136:15785+10 1B43 C3A41A JP COMMAND
|
||
137:
|
||
138: - 1B46 COMMAND_PROCESS_FOUND:
|
||
139:15795+11 1B46 E5 PUSH HL
|
||
140:15806+10 1B47 C1 POP BC
|
||
141:15816+6 1B48 03 INC BC
|
||
142:15822+7 1B49 0A LD A,(BC)
|
||
143:15829+4 1B4A 6F LD L,A
|
||
144:15833+6 1B4B 03 INC BC
|
||
145:15839+7 1B4C 0A LD A,(BC)
|
||
146:15846+4 1B4D 67 LD H,A
|
||
147:
|
||
148: ;HL: pointer to start of routine
|
||
149: ;DE: buffer start of arguments
|
||
150:15850+17 1B4E CD541B CALL _COMMAND_PROCESS_FOUND
|
||
151:15867+10 1B51 C3A41A JP COMMAND
|
||
152: - 1B54 _COMMAND_PROCESS_FOUND
|
||
153:15877+4 1B54 E9 JP (HL)
|
||
154:
|
||
155:
|
||
156:
|
||
157: - 1B55 NOT_IMPLEMENTED:
|
||
158:15881+10 1B55 21631B LD HL,[_STR_NOT_IMPLEMENTED]
|
||
159:15891+17 1B58 CDFC00 CALL print_str
|
||
160:15908+10 1B5B C9 RET
|
||
161:
|
||
162: - 1B5C ERR_SYNTAX:
|
||
163:15918+10 1B5C 218B1B LD HL,[_STR_SYNTAX]
|
||
164:15928+17 1B5F CDFC00 CALL print_str
|
||
165:15945+10 1B62 C9 RET
|
||
166:
|
||
167: - 1B63 _STR_NOT_IMPLEMENTED:
|
||
168: - 1B63 0A0D6E6F db 10,13,"not implemented",10,13,0
|
||
7420696D
|
||
706C656D
|
||
656E7465
|
||
640A0D00
|
||
169:
|
||
170: - 1B77 _STR_NOT_FOUND:
|
||
171: - 1B77 0A0D696E db 10,13,"invalid command",10,13,0
|
||
76616C69
|
||
6420636F
|
||
6D6D616E
|
||
640A0D00
|
||
172:
|
||
173: - 1B8B _STR_SYNTAX:
|
||
**** main.asm ****
|
||
221: - 1B8B 0A0D696E db 10,13,"invalid syntax",10,13,0
|
||
76616C69
|
||
64207379
|
||
6E746178
|
||
0A0D00
|
||
222: .include "cmd_mem.s"
|
||
**** include/cmd_mem.s ****
|
||
1: - 1B9E OP_EXEC:
|
||
2: ;DE contains pointer
|
||
3:15955+11 1B9E D5 push DE
|
||
4:15966+10 1B9F E1 pop HL
|
||
5:15976+17 1BA0 CD5102 call DHEX_TO_BYTE
|
||
6:15993+4 1BA3 47 ld b,a ;store result in b
|
||
7:15997+4 1BA4 7B ld a,e ;check for error
|
||
8:16001+4 1BA5 A7 and a
|
||
9:16005+10 1BA6 C25C1B jp nz, ERR_SYNTAX
|
||
10:16015+6 1BA9 23 inc HL
|
||
11:16021+6 1BAA 23 inc HL
|
||
12:16027+17 1BAB CD5102 call DHEX_TO_BYTE
|
||
13:16044+4 1BAE 4F ld c,a
|
||
14:16048+4 1BAF 7B ld a,e ;check for error
|
||
15:16052+4 1BB0 A7 and a
|
||
16:16056+10 1BB1 C25C1B jp nz, ERR_SYNTAX
|
||
17:16066+4 1BB4 60 ld h,b
|
||
18:16070+4 1BB5 69 ld l,c
|
||
19:16074+4 1BB6 E9 jp (hl)
|
||
20: - 1BB7 OP_CALL:
|
||
21: ;DE contains pointer
|
||
22:16078+11 1BB7 D5 push DE
|
||
23:16089+10 1BB8 E1 pop HL
|
||
24:16099+17 1BB9 CD5102 call DHEX_TO_BYTE
|
||
25:16116+4 1BBC 47 ld b,a ;store result in b
|
||
26:16120+4 1BBD 7B ld a,e ;check for error
|
||
27:16124+4 1BBE A7 and a
|
||
28:16128+10 1BBF C25C1B jp nz, ERR_SYNTAX
|
||
29:16138+6 1BC2 23 inc HL
|
||
30:16144+6 1BC3 23 inc HL
|
||
31:16150+17 1BC4 CD5102 call DHEX_TO_BYTE
|
||
32:16167+4 1BC7 4F ld c,a
|
||
33:16171+4 1BC8 7B ld a,e ;check for error
|
||
34:16175+4 1BC9 A7 and a
|
||
35:16179+10 1BCA C25C1B jp nz, ERR_SYNTAX
|
||
36:16189+4 1BCD 60 ld h,b
|
||
37:16193+4 1BCE 69 ld l,c
|
||
38:16197+17 1BCF CDD61B call _OP_CALL
|
||
39:16214+17 1BD2 CD0C01 call print_newLine
|
||
40:16231+10 1BD5 C9 ret
|
||
41: - 1BD6 _OP_CALL
|
||
42:16241+4 1BD6 E9 jp (hl)
|
||
43:
|
||
44: - 1BD7 OP_DUMP:
|
||
45: ;DE contains pointer
|
||
46:16245+11 1BD7 D5 push DE
|
||
47:16256+10 1BD8 E1 pop HL
|
||
48:16266+17 1BD9 CD5102 call DHEX_TO_BYTE ;parse start address
|
||
49:16283+4 1BDC 47 ld b,a ;store result in b
|
||
50:16287+4 1BDD 7B ld a,e ;check for error
|
||
51:16291+4 1BDE A7 and a
|
||
52:16295+10 1BDF C25C1B jp nz, ERR_SYNTAX
|
||
53:16305+6 1BE2 23 inc HL
|
||
54:16311+6 1BE3 23 inc HL
|
||
55:16317+17 1BE4 CD5102 call DHEX_TO_BYTE
|
||
56:16334+4 1BE7 4F ld c,a
|
||
57:16338+4 1BE8 7B ld a,e ;check for error
|
||
58:16342+4 1BE9 A7 and a
|
||
59:16346+10 1BEA C25C1B jp nz, ERR_SYNTAX
|
||
60:16356+6 1BED 23 inc HL
|
||
61:16362+6 1BEE 23 inc HL
|
||
62:16368+7 1BEF 7E ld a,(HL)
|
||
63:16375+7 1BF0 FE20 cp ' '
|
||
64:16382+10 1BF2 C25C1B jp nz, ERR_SYNTAX
|
||
65:16392+6 1BF5 23 inc HL
|
||
66:16398+17 1BF6 CD5102 call DHEX_TO_BYTE
|
||
67:16415+11 1BF9 F5 push af
|
||
68:16426+4 1BFA 7B ld a,e ;check for error
|
||
69:16430+4 1BFB A7 and a
|
||
70:16434+10 1BFC C25C1B jp nz, ERR_SYNTAX
|
||
71:16444+10 1BFF F1 pop af
|
||
72:
|
||
73:16454+4 1C00 60 ld h,b
|
||
74:16458+4 1C01 69 ld l,c
|
||
75:16462+4 1C02 47 ld b,a
|
||
76:
|
||
77:16466+17 1C03 CD6D19 call dump_pretty
|
||
78:16483+10 1C06 C9 ret
|
||
79:
|
||
80: - 1C07 OP_SET:
|
||
81: ;DE contains pointer
|
||
82:16493+11 1C07 D5 push DE
|
||
83:16504+10 1C08 E1 pop HL
|
||
84:16514+17 1C09 CD5102 call DHEX_TO_BYTE ;parse start address
|
||
85:16531+4 1C0C 47 ld b,a ;store result in b
|
||
86:16535+4 1C0D 7B ld a,e ;check for error
|
||
87:16539+4 1C0E A7 and a
|
||
88:16543+10 1C0F C25C1B jp nz, ERR_SYNTAX
|
||
89:16553+6 1C12 23 inc HL
|
||
90:16559+6 1C13 23 inc HL
|
||
91:16565+17 1C14 CD5102 call DHEX_TO_BYTE
|
||
92:16582+4 1C17 4F ld c,a
|
||
93:16586+4 1C18 7B ld a,e ;check for error
|
||
94:16590+4 1C19 A7 and a
|
||
95:16594+10 1C1A C25C1B jp nz, ERR_SYNTAX
|
||
96: ;bc now contains the start address
|
||
97:16604+6 1C1D 23 INC HL
|
||
98:16610+6 1C1E 23 INC HL
|
||
99: ;hl now cointains start addr of data bytes
|
||
100: - 1C1F _OP_SET_LOOP:
|
||
101:16616+7 1C1F 7E ld a,(hl)
|
||
102:16623+7 1C20 FE00 cp 0 ;if 0 then end
|
||
103:16630+5+6 1C22 C8 RET Z
|
||
104:16635+7 1C23 FE20 cp ' '
|
||
105:16642+10 1C25 C25C1B jp nz, ERR_SYNTAX
|
||
106:16652+6 1C28 23 inc hl ;next byte
|
||
107:16658+17 1C29 CD5102 call DHEX_TO_BYTE
|
||
108:16675+7 1C2C 02 ld (bc),a ;load byte to
|
||
109:16682+4 1C2D 7B ld a,e
|
||
110:16686+4 1C2E A7 and a
|
||
111:16690+10 1C2F C25C1B jp nz, ERR_SYNTAX
|
||
112:16700+6 1C32 03 inc bc
|
||
113:16706+6 1C33 23 inc hl
|
||
114:16712+6 1C34 23 inc hl
|
||
115:16718+10 1C35 C31F1C jp _OP_SET_LOOP
|
||
116:
|
||
117: - 1C38 OP_DASM:
|
||
118:16728+11 1C38 D5 push DE
|
||
119:16739+10 1C39 E1 pop HL
|
||
120:16749+17 1C3A CD5102 call DHEX_TO_BYTE
|
||
121:16766+4 1C3D 47 ld b,a ;store result in b
|
||
122:16770+4 1C3E 7B ld a,e ;check for error
|
||
123:16774+4 1C3F A7 and a
|
||
124:16778+10 1C40 C25C1B jp nz, ERR_SYNTAX
|
||
125:16788+6 1C43 23 inc hl
|
||
126:16794+6 1C44 23 inc hl
|
||
127:16800+17 1C45 CD5102 call DHEX_TO_BYTE
|
||
128:16817+4 1C48 4F ld c,a
|
||
129:16821+4 1C49 7B ld a,e ;check for error
|
||
130:16825+4 1C4A A7 and a
|
||
131:16829+10 1C4B C25C1B jp nz, ERR_SYNTAX
|
||
132:16839+6 1C4E 23 inc hl
|
||
133:16845+6 1C4F 23 inc hl
|
||
134:16851+7 1C50 7E ld a,(HL)
|
||
135:16858+7 1C51 FE20 cp ' '
|
||
136:16865+10 1C53 C25C1B jp nz, ERR_SYNTAX
|
||
137:16875+6 1C56 23 inc hl
|
||
138:16881+17 1C57 CD5102 call DHEX_TO_BYTE
|
||
139:16898+11 1C5A F5 push af
|
||
140:16909+4 1C5B 7B ld a,e ;check for error
|
||
141:16913+4 1C5C A7 and a
|
||
142:16917+10 1C5D C25C1B jp nz, ERR_SYNTAX
|
||
143:16927+4 1C60 60 ld h,b
|
||
144:16931+4 1C61 69 ld l,c
|
||
145:16935+10 1C62 F1 pop af ;restore af
|
||
146:16945+4 1C63 47 ld b,a
|
||
147:16949+17 1C64 CDA202 call disassemble
|
||
**** main.asm ****
|
||
223:16966+10 1C67 C9 ret
|
||
224: .include "cmd_io.s"
|
||
**** include/cmd_io.s ****
|
||
1: - 1C68 OP_IO_IN:
|
||
2:16976+11 1C68 D5 push DE
|
||
3:16987+10 1C69 E1 pop HL
|
||
4:16997+17 1C6A CD5102 call DHEX_TO_BYTE
|
||
5:17014+4 1C6D 4F ld c,a ;store result in b
|
||
6:17018+4 1C6E 7B ld a,e ;check for error
|
||
7:17022+4 1C6F A7 and a
|
||
8:17026+10 1C70 C25C1B jp nz, ERR_SYNTAX
|
||
9:17036+12 1C73 ED78 in a,(c)
|
||
10:17048+11 1C75 F5 push af
|
||
11:17059+17 1C76 CD0C01 call print_newLine
|
||
12:17076+10 1C79 F1 pop af
|
||
13:17086+17 1C7A CD2201 call print_a_hex
|
||
14:17103+10 1C7D C9 ret
|
||
15:
|
||
16: - 1C7E OP_IO_OUT:
|
||
17:17113+11 1C7E D5 push DE
|
||
18:17124+10 1C7F E1 pop HL
|
||
19:17134+17 1C80 CD5102 call DHEX_TO_BYTE
|
||
20:17151+4 1C83 4F ld c,a ;store result in b
|
||
21:17155+4 1C84 7B ld a,e ;check for error
|
||
22:17159+4 1C85 A7 and a
|
||
23:17163+10 1C86 C25C1B jp nz, ERR_SYNTAX
|
||
24:17173+6 1C89 23 inc hl
|
||
25:17179+6 1C8A 23 inc hl
|
||
26:17185+7 1C8B 7E ld a,(hl)
|
||
27:17192+7 1C8C FE20 cp ' '
|
||
28:17199+10 1C8E C25C1B jp nz, ERR_SYNTAX
|
||
29:17209+6 1C91 23 inc hl
|
||
30:17215+17 1C92 CD5102 call DHEX_TO_BYTE
|
||
31:17232+11 1C95 F5 push af
|
||
32:17243+4 1C96 7B ld a,e ;check for error
|
||
33:17247+4 1C97 A7 and a
|
||
34:17251+10 1C98 C25C1B jp nz, ERR_SYNTAX
|
||
35:17261+10 1C9B F1 pop af
|
||
36:17271+12 1C9C ED79 out (c),a
|
||
37:17283+10 1C9E C9 ret
|
||
38:
|
||
39: - 1C9F OP_IIC_OUT:
|
||
40:17293+11 1C9F D5 push DE
|
||
41:17304+10 1CA0 E1 pop HL
|
||
42:17314+17 1CA1 CD5102 call DHEX_TO_BYTE ;load start addr
|
||
43:17331+13 1CA4 321042 ld (var_scratch+1),A ;store result in ram
|
||
44:17344+4 1CA7 7B ld a,e ;check for error
|
||
45:17348+4 1CA8 A7 and a
|
||
46:17352+10 1CA9 C25C1B jp nz, ERR_SYNTAX
|
||
47:17362+6 1CAC 23 inc hl
|
||
48:17368+6 1CAD 23 inc hl
|
||
49:17374+10 1CAE 011142 LD BC,[var_scratch + 2]
|
||
50:17384+4 1CB1 AF XOR A
|
||
51:17388+13 1CB2 320F42 LD (var_scratch),A
|
||
52: - 1CB5 _OP_IIC_OUT_LOOP:
|
||
53:17401+7 1CB5 7E ld a,(hl)
|
||
54:17408+7 1CB6 FE00 cp 0 ;if 0 then end
|
||
55:17415+10 1CB8 CAD11C jp z,_OP_IIC_OUT_SEND
|
||
56:17425+7 1CBB FE20 cp ' '
|
||
57:17432+10 1CBD C25C1B jp nz, ERR_SYNTAX
|
||
58:17442+6 1CC0 23 inc hl ;next byte
|
||
59:
|
||
60:17448+17 1CC1 CD5102 call DHEX_TO_BYTE
|
||
61:17465+7 1CC4 02 ld (bc),a
|
||
62:17472+6 1CC5 03 inc bc ;incerement pointer
|
||
63:17478+13 1CC6 3A0F42 ld a,(var_scratch)
|
||
64:17491+4 1CC9 3C inc a ;increment counter
|
||
65:17495+13 1CCA 320F42 ld (var_scratch),a
|
||
66:17508+6 1CCD 23 inc HL
|
||
67:17514+6 1CCE 23 inc HL
|
||
68:17520+12 1CCF 18E4 jr _OP_IIC_OUT_LOOP
|
||
69: - 1CD1 _OP_IIC_OUT_SEND:
|
||
70:17532+10 1CD1 211142 ld hl,[var_scratch + 2]
|
||
71:17542+13 1CD4 3A0F42 ld a,(var_scratch) ;load amount of bytes
|
||
72:17555+4 1CD7 47 ld b,a
|
||
73:17559+13 1CD8 3A1042 ld a,(var_scratch+1) ;load start addr
|
||
74:17572+4 1CDB 4F ld c,a
|
||
75:17576+17 1CDC CDE116 call iic_send_buffer
|
||
76:17593+4 1CDF B7 or a
|
||
77:17597+10 1CE0 C2E41C jp nz, _OP_IIC_ACK_ERR
|
||
78:17607+10 1CE3 C9 ret
|
||
79:
|
||
80: - 1CE4 _OP_IIC_ACK_ERR:
|
||
81:17617+10 1CE4 21EB1C LD HL,[_OP_IIC_ACK_ERR_str]
|
||
82:17627+17 1CE7 CDFC00 call print_str
|
||
83:17644+10 1CEA C9 ret
|
||
84: - 1CEB _OP_IIC_ACK_ERR_str:
|
||
85: - 1CEB 0A0D6275 db 10,13,"bus-error: no ACK",0
|
||
732D6572
|
||
726F723A
|
||
206E6F20
|
||
41434B00
|
||
86:
|
||
87: - 1CFF OP_IIC_IN:
|
||
88:17654+11 1CFF D5 push DE
|
||
89:17665+10 1D00 E1 pop HL
|
||
90:17675+17 1D01 CD5102 call DHEX_TO_BYTE ;load start addr
|
||
91:17692+4 1D04 4F ld C,a ;store start addr to B
|
||
92:17696+4 1D05 7B ld a,e ;check for error
|
||
93:17700+4 1D06 A7 and a
|
||
94:17704+10 1D07 C25C1B jp nz, ERR_SYNTAX
|
||
95:17714+6 1D0A 23 inc hl
|
||
96:17720+6 1D0B 23 inc hl
|
||
97:17726+7 1D0C 7E ld a,(hl)
|
||
98:17733+7 1D0D FE20 cp ' '
|
||
99:17740+10 1D0F C25C1B jp nz, ERR_SYNTAX
|
||
100:17750+6 1D12 23 inc hl
|
||
101:17756+17 1D13 CD5102 call DHEX_TO_BYTE ;read length
|
||
102:17773+4 1D16 47 ld b,a ;store length in B
|
||
103:17777+11 1D17 C5 push bc
|
||
104:17788+4 1D18 7B ld a,e ;check for error
|
||
105:17792+4 1D19 A7 and a
|
||
106:17796+10 1D1A C25C1B jp nz, ERR_SYNTAX
|
||
107:17806+10 1D1D 210F42 ld hl,[var_scratch]
|
||
108:17816+17 1D20 CD0B17 call iic_receive_buffer
|
||
109:17833+10 1D23 C1 pop bc
|
||
110:17843+4 1D24 B7 or a
|
||
111:17847+10 1D25 C2E41C jp nz, _OP_IIC_ACK_ERR
|
||
112:17857+10 1D28 213E1D ld hl,[_OP_IIC_IN_LOOP_TEXT]
|
||
113:17867+17 1D2B CDFC00 call print_str
|
||
114:17884+10 1D2E 210F42 ld hl,[var_scratch]
|
||
115: ;print data
|
||
116: - 1D31 _OP_IIC_IN_LOOP:
|
||
117:17894+7 1D31 7E ld a,(hl)
|
||
118:17901+17 1D32 CD2201 call print_a_hex
|
||
119:17918+7 1D35 3E20 ld a, ' '
|
||
120:17925+17 1D37 CDF600 call print_char
|
||
121:17942+6 1D3A 23 inc hl
|
||
122:17948+8+5 1D3B 10F4 djnz _OP_IIC_IN_LOOP
|
||
123:17956+10 1D3D C9 ret
|
||
124:
|
||
125: - 1D3E _OP_IIC_IN_LOOP_TEXT:
|
||
126: - 1D3E 0A0D7265 db 10,13,"rec-buff: ",0
|
||
632D6275
|
||
66663A20
|
||
00
|
||
127:
|
||
128: - 1D4B OP_CLR:
|
||
129:17966+17 1D4B CD0501 call print_clear
|
||
**** main.asm ****
|
||
225:17983+10 1D4E C9 ret
|
||
226: .include "cmd_date.s"
|
||
**** include/cmd_date.s ****
|
||
1: - 00D0 ADDR_RTC .equ 0xD0
|
||
2:
|
||
3: - 1D4F OP_RTIME:
|
||
4:17993+17 1D4F CD0C01 call print_newLine
|
||
5: - 1D52 _OP_RTIME_NN:
|
||
6: ;set pointer
|
||
7:18010+10 1D52 210A1E ld hl,[_OP_RTIME_RD_CMD]
|
||
8:18020+7 1D55 0601 ld b, 1
|
||
9:18027+7 1D57 0ED0 ld c, ADDR_RTC
|
||
10:18034+17 1D59 CDE116 call iic_send_buffer
|
||
11:18051+4 1D5C B7 or a
|
||
12:18055+10 1D5D C2E41C jp nz, _OP_IIC_ACK_ERR
|
||
13: ;read RTC data
|
||
14:18065+10 1D60 210F42 ld hl,[var_scratch]
|
||
15:18075+7 1D63 0608 ld b,8
|
||
16:18082+7 1D65 0ED0 ld c, ADDR_RTC
|
||
17:18089+17 1D67 CD0B17 call iic_receive_buffer
|
||
18:18106+4 1D6A B7 or a
|
||
19:18110+10 1D6B C2E41C jp nz, _OP_IIC_ACK_ERR
|
||
20: ;process display hours
|
||
21:18120+13 1D6E 3A1142 ld a,(var_scratch+2)
|
||
22:18133+7 1D71 E630 and 00110000b
|
||
23:18140+4 1D73 1F RRA
|
||
24:18144+4 1D74 1F RRA
|
||
25:18148+4 1D75 1F RRA
|
||
26:18152+4 1D76 1F RRA
|
||
27:18156+17 1D77 CD3401 call print_bcd
|
||
28:18173+13 1D7A 3A1142 ld a,(var_scratch+2)
|
||
29:18186+7 1D7D E60F and 00001111b
|
||
30:18193+17 1D7F CD3401 call print_bcd
|
||
31:18210+7 1D82 3E3A ld a,':'
|
||
32:18217+17 1D84 CDF600 call print_char
|
||
33: ;display minutes
|
||
34:18234+13 1D87 3A1042 ld a,(var_scratch+1)
|
||
35:18247+7 1D8A E670 and 01110000b
|
||
36:18254+4 1D8C 1F RRA
|
||
37:18258+4 1D8D 1F RRA
|
||
38:18262+4 1D8E 1F RRA
|
||
39:18266+4 1D8F 1F RRA
|
||
40:18270+17 1D90 CD3401 call print_bcd
|
||
41:18287+13 1D93 3A1042 ld a,(var_scratch+1)
|
||
42:18300+7 1D96 E60F and 00001111b
|
||
43:18307+17 1D98 CD3401 call print_bcd
|
||
44:18324+7 1D9B 3E3A ld a,':'
|
||
45:18331+17 1D9D CDF600 call print_char
|
||
46: ;display seconds
|
||
47:18348+13 1DA0 3A0F42 ld a,(var_scratch+0)
|
||
48:18361+7 1DA3 E670 and 01110000b
|
||
49:18368+4 1DA5 1F RRA
|
||
50:18372+4 1DA6 1F RRA
|
||
51:18376+4 1DA7 1F RRA
|
||
52:18380+4 1DA8 1F RRA
|
||
53:18384+17 1DA9 CD3401 call print_bcd
|
||
54:18401+13 1DAC 3A0F42 ld a,(var_scratch+0)
|
||
55:18414+7 1DAF E60F and 00001111b
|
||
56:18421+17 1DB1 CD3401 call print_bcd
|
||
57:18438+7 1DB4 3E20 ld a,' '
|
||
58:18445+17 1DB6 CDF600 call print_char
|
||
59: ;display date
|
||
60:18462+13 1DB9 3A1342 ld a,(var_scratch+4)
|
||
61:18475+7 1DBC E630 and 00110000b
|
||
62:18482+4 1DBE 1F RRA
|
||
63:18486+4 1DBF 1F RRA
|
||
64:18490+4 1DC0 1F RRA
|
||
65:18494+4 1DC1 1F RRA
|
||
66:18498+17 1DC2 CD3401 call print_bcd
|
||
67:18515+13 1DC5 3A1342 ld a,(var_scratch+4)
|
||
68:18528+7 1DC8 E60F and 00001111b
|
||
69:18535+17 1DCA CD3401 call print_bcd
|
||
70:18552+7 1DCD 3E2E ld a,'.'
|
||
71:18559+17 1DCF CDF600 call print_char
|
||
72:18576+13 1DD2 3A1442 ld a,(var_scratch+5)
|
||
73:18589+7 1DD5 E610 and 00010000b
|
||
74:18596+4 1DD7 1F RRA
|
||
75:18600+4 1DD8 1F RRA
|
||
76:18604+4 1DD9 1F RRA
|
||
77:18608+4 1DDA 1F RRA
|
||
78:18612+17 1DDB CD3401 call print_bcd
|
||
79:18629+13 1DDE 3A1442 ld a,(var_scratch+5)
|
||
80:18642+7 1DE1 E60F and 00001111b
|
||
81:18649+17 1DE3 CD3401 call print_bcd
|
||
82:18666+7 1DE6 3E2E ld a,'.'
|
||
83:18673+17 1DE8 CDF600 call print_char
|
||
84:18690+7 1DEB 3E32 ld a,'2'
|
||
85:18697+17 1DED CDF600 call print_char
|
||
86:18714+7 1DF0 3E30 ld a,'0'
|
||
87:18721+17 1DF2 CDF600 call print_char
|
||
88:18738+13 1DF5 3A1542 ld a,(var_scratch+6)
|
||
89:18751+7 1DF8 E6F0 and 11110000b
|
||
90:18758+4 1DFA 1F RRA
|
||
91:18762+4 1DFB 1F RRA
|
||
92:18766+4 1DFC 1F RRA
|
||
93:18770+4 1DFD 1F RRA
|
||
94:18774+17 1DFE CD3401 call print_bcd
|
||
95:18791+13 1E01 3A1542 ld a,(var_scratch+6)
|
||
96:18804+7 1E04 E60F and 00001111b
|
||
97:18811+17 1E06 CD3401 call print_bcd
|
||
98:
|
||
99:18828+10 1E09 C9 RET
|
||
100: - 1E0A _OP_RTIME_RD_CMD:
|
||
101: - 1E0A 00 db 0x00
|
||
102:
|
||
103: - 1E0B 0A0D456E _OP_STIME_STR_DAY: db 10,13,"Enter Date (00-31) : ",0
|
||
74657220
|
||
44617465
|
||
20202020
|
||
2830302D
|
||
33312920
|
||
3A2000
|
||
104: - 1E26 0A0D456E _OP_STIME_STR_MON: db 10,13,"Enter Month (00-12) : ",0
|
||
74657220
|
||
4D6F6E74
|
||
68202020
|
||
2830302D
|
||
31322920
|
||
3A2000
|
||
105: - 1E41 0A0D456E _OP_STIME_STR_YEAR: db 10,13,"Enter Year (00-99) : ",0
|
||
74657220
|
||
59656172
|
||
20202020
|
||
2830302D
|
||
39392920
|
||
3A2000
|
||
106: - 1E5C 0A0D456E _OP_STIME_STR_HOUR: db 10,13,"Enter Hours (00-23) : ",0
|
||
74657220
|
||
486F7572
|
||
73202020
|
||
2830302D
|
||
32332920
|
||
3A2000
|
||
107: - 1E77 0A0D456E _OP_STIME_STR_MIN: db 10,13,"Enter Minutes (00-59) : ",0
|
||
74657220
|
||
4D696E75
|
||
74657320
|
||
2830302D
|
||
35392920
|
||
3A2000
|
||
108: - 1E92 0A0D456E _OP_STIME_STR_SEC: db 10,13,"Enter Seconds (00-59) : ",0
|
||
74657220
|
||
5365636F
|
||
6E647320
|
||
2830302D
|
||
35392920
|
||
3A2000
|
||
109: - 1EAD 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: - 1EC4 _OP_STIME_PROMPT:
|
||
113:18838+11 1EC4 E5 push hl
|
||
114:18849+17 1EC5 CDFC00 call print_str
|
||
115:18866+10 1EC8 E1 pop hl
|
||
116:18876+17 1EC9 CD4F01 call read_bcd
|
||
117:18893+7 1ECC FEFF cp 0xFF ;if failed
|
||
118:18900+10 1ECE CADC1E jp Z, _OP_STIME_PROMPT_ERR
|
||
119:18910+4 1ED1 47 ld b,a
|
||
120:18914+17 1ED2 CD4F01 call read_bcd
|
||
121:18931+7 1ED5 FEFF cp 0xFF ;if failed
|
||
122:18938+10 1ED7 CADC1E jp Z, _OP_STIME_PROMPT_ERR
|
||
123:18948+4 1EDA 4F ld c,a
|
||
124:18952+10 1EDB C9 ret
|
||
125: - 1EDC _OP_STIME_PROMPT_ERR:
|
||
126:18962+11 1EDC E5 push HL
|
||
127:18973+10 1EDD 21AD1E ld hl, [_OP_STIME_INVALID]
|
||
128:18983+17 1EE0 CDFC00 call print_str
|
||
129:19000+10 1EE3 E1 pop hl
|
||
130:19010+10 1EE4 C3C41E jp _OP_STIME_PROMPT
|
||
131:
|
||
132:
|
||
133:
|
||
134: - 1EE7 OP_STIME:
|
||
135:19020+4 1EE7 AF xor a
|
||
136:19024+13 1EE8 320F42 ld (var_scratch),a ;set pointer
|
||
137: ;date
|
||
138:19037+10 1EEB 210B1E ld hl, [_OP_STIME_STR_DAY]
|
||
139:19047+17 1EEE CDC41E call _OP_STIME_PROMPT
|
||
140:19064+4 1EF1 78 ld a,b
|
||
141:19068+17 1EF2 CD5B1F call _shift4
|
||
142:19085+7 1EF5 E630 and 00110000b ;mask bits; bit6 low -> 24h mode
|
||
143:19092+4 1EF7 B1 or c ;add second digit
|
||
144:19096+13 1EF8 321442 ld (var_scratch+5),a
|
||
145: ;month
|
||
146:19109+10 1EFB 21261E ld hl, [_OP_STIME_STR_MON]
|
||
147:19119+17 1EFE CDC41E call _OP_STIME_PROMPT
|
||
148:19136+4 1F01 78 ld a,b
|
||
149:19140+17 1F02 CD5B1F call _shift4
|
||
150:19157+7 1F05 E610 and 00010000b ;mask bits; bit6 low -> 24h mode
|
||
151:19164+4 1F07 B1 or c ;add second digit
|
||
152:19168+13 1F08 321542 ld (var_scratch+6),a
|
||
153: ;year
|
||
154:19181+10 1F0B 21411E ld hl, [_OP_STIME_STR_YEAR]
|
||
155:19191+17 1F0E CDC41E call _OP_STIME_PROMPT
|
||
156:19208+4 1F11 78 ld a,b
|
||
157:19212+17 1F12 CD5B1F call _shift4
|
||
158:19229+7 1F15 E6F0 and 11110000b ;mask bits; bit6 low -> 24h mode
|
||
159:19236+4 1F17 B1 or c ;add second digit
|
||
160:19240+13 1F18 321642 ld (var_scratch+7),a
|
||
161: ;hours
|
||
162:19253+10 1F1B 215C1E ld hl, [_OP_STIME_STR_HOUR]
|
||
163:19263+17 1F1E CDC41E call _OP_STIME_PROMPT
|
||
164:19280+4 1F21 78 ld a,b
|
||
165:19284+17 1F22 CD5B1F call _shift4
|
||
166:19301+7 1F25 E630 and 00110000b ;mask bits; bit6 low -> 24h mode
|
||
167:19308+4 1F27 B1 or c ;add second digit
|
||
168:19312+13 1F28 321242 ld (var_scratch+3),a
|
||
169: ; minutes
|
||
170:19325+10 1F2B 21771E ld hl, [_OP_STIME_STR_MIN]
|
||
171:19335+17 1F2E CDC41E call _OP_STIME_PROMPT
|
||
172:19352+4 1F31 78 ld a,b
|
||
173:19356+17 1F32 CD5B1F call _shift4
|
||
174:19373+7 1F35 E670 and 01110000b ;mask bits
|
||
175:19380+4 1F37 B1 or c ;add second digit
|
||
176:19384+13 1F38 321142 ld (var_scratch+2),a
|
||
177: ; seconds
|
||
178:19397+10 1F3B 21921E ld hl, [_OP_STIME_STR_SEC]
|
||
179:19407+17 1F3E CDC41E call _OP_STIME_PROMPT
|
||
180:19424+4 1F41 78 ld a,b
|
||
181:19428+17 1F42 CD5B1F call _shift4
|
||
182:19445+7 1F45 E670 and 01110000b ;mask bits / bit6 low -> 24h mode (enable clock)
|
||
183:19452+4 1F47 B1 or c ;add second digit
|
||
184:19456+13 1F48 321042 ld (var_scratch+1),a
|
||
185:19469+6 1F4B 13 inc de ;next
|
||
186:
|
||
187:19475+7 1F4C 0ED0 ld c, ADDR_RTC
|
||
188:19482+7 1F4E 0608 ld b, 8
|
||
189:19489+10 1F50 210F42 ld hl,[var_scratch]
|
||
190:19499+17 1F53 CDE116 call iic_send_buffer
|
||
191:19516+4 1F56 B7 or a
|
||
192:19520+10 1F57 C2E41C jp nz, _OP_IIC_ACK_ERR
|
||
193:
|
||
194:19530+10 1F5A C9 ret
|
||
195:
|
||
196: - 1F5B _shift4:
|
||
197:19540+4 1F5B 07 RLCA
|
||
198:19544+4 1F5C 07 RLCA
|
||
199:19548+4 1F5D 07 RLCA
|
||
200:19552+4 1F5E 07 RLCA
|
||
**** main.asm ****
|
||
227:19556+10 1F5F C9 ret
|
||
228: .include "cmd_disk.s"
|
||
**** include/cmd_disk.s ****
|
||
1: - 1F60 OP_LSDSK:
|
||
2:19566+17 1F60 CD8313 call ideif_prnt_devtable
|
||
3:19583+10 1F63 C9 ret
|
||
4:
|
||
5: - 1F64 OP_SELDSK:
|
||
6: ;DE contains pointer
|
||
7:19593+11 1F64 D5 push de
|
||
8:19604+10 1F65 E1 pop hl
|
||
9:19614+7 1F66 7E ld a,(hl)
|
||
10:19621+7 1F67 DE45 sbc 69
|
||
11:19628+7+5 1F69 3808 jr c,_OP_SELDSK_INVALID
|
||
12:19635+7 1F6B FE04 cp 4
|
||
13:19642+7+5 1F6D 3004 jr nc, _OP_SELDSK_INVALID
|
||
14:19649+17 1F6F CDB815 call ideif_drv_sel
|
||
15:19666+10 1F72 C9 ret
|
||
16:
|
||
17: - 1F73 _OP_SELDSK_INVALID:
|
||
18:19676+10 1F73 218B1F ld hl,[_OP_SELDSK_INVALID_STR]
|
||
19:19686+17 1F76 CDFC00 call print_str
|
||
20:19703+10 1F79 112000 LD DE,0x20
|
||
21:19713+10 1F7C 017000 LD BC,0x70
|
||
22:19723+17 1F7F CD040E CALL beep
|
||
23:19740+10 1F82 C9 ret
|
||
24:
|
||
25: - 1F83 OP_DIR:
|
||
26:19750+17 1F83 CDE224 CALL fat_print_directory
|
||
27:19767+10 1F86 C9 ret
|
||
28:
|
||
29: - 1F87 OP_CD:
|
||
30:19777+17 1F87 CDFB25 call fat_cd_single
|
||
31:19794+10 1F8A C9 ret
|
||
32:
|
||
33: - 1F8B _OP_SELDSK_INVALID_STR:
|
||
34: - 1F8B 0A0D496E db 10,13,"Invalid drive letter",10,13,0
|
||
76616C69
|
||
64206472
|
||
69766520
|
||
6C657474
|
||
65720A0D
|
||
00
|
||
35:
|
||
36: - 1FA4 OP_FSEXEC:
|
||
37:19804+17 1FA4 CD1627 call fat_exec
|
||
**** main.asm ****
|
||
229:19821+10 1FA7 C9 ret
|
||
230: .include "post.s"
|
||
**** include/post.s ****
|
||
1: ;Power-On self test
|
||
2: - 1FA8 POST_START:
|
||
3:19831+17 1FA8 CDB81F call POST_CHECK_PIO
|
||
4:19848+17 1FAB CDDD1F call POST_CHECK_APU
|
||
5:19865+17 1FAE CD3520 call POST_TEST_RTC
|
||
6:19882+17 1FB1 CD0820 call POST_CHECK_IDE_30
|
||
7:19899+17 1FB4 CD1B20 call POST_CHECK_IDE_40
|
||
8:19916+10 1FB7 C9 ret
|
||
9:
|
||
10: - 1FB8 POST_CHECK_PIO:
|
||
11:19926+10 1FB8 21AC20 ld hl,[str_post_pio]
|
||
12:19936+17 1FBB CDFC00 call print_str
|
||
13:19953+11 1FBE DBF6 in a,(CS_PIO_AC) ;test read from pio
|
||
14:19964+7 1FC0 FE00 cp 0x00 ;0x78 when not installed
|
||
15:19971+10 1FC2 C2D11F jp nz, _POST_CHECK_PIO_FAILED
|
||
16:19981+7 1FC5 3E00 ld a, 0x00 ;set present flag
|
||
17:19988+13 1FC7 320D42 ld (var_pio_present),a
|
||
18:20001+10 1FCA 213521 ld hl,[str_post_ok]
|
||
19:20011+17 1FCD CDFC00 call print_str
|
||
20:20028+10 1FD0 C9 ret
|
||
21: - 1FD1 _POST_CHECK_PIO_FAILED:
|
||
22:20038+7 1FD1 3EFF ld a, 0xFF
|
||
23:20045+13 1FD3 320D42 ld (var_pio_present),a
|
||
24:20058+10 1FD6 21FD20 ld hl,[str_post_nd]
|
||
25:20068+17 1FD9 CDFC00 call print_str
|
||
26:20085+10 1FDC C9 ret
|
||
27:
|
||
28: - 1FDD POST_CHECK_APU:
|
||
29:20095+10 1FDD 21C720 ld hl,[str_post_apu]
|
||
30:20105+17 1FE0 CDFC00 call print_str
|
||
31:
|
||
32:20122+7 1FE3 3EFF ld a, 0xFF
|
||
33:20129+11 1FE5 D3F8 out (CS_APU_DATA),a
|
||
34:20140+4 1FE7 00 nop
|
||
35:20144+4 1FE8 00 nop
|
||
36:20148+11 1FE9 DBF8 in a,(CS_APU_DATA)
|
||
37:20159+7 1FEB FEFF cp 0xFF
|
||
38:20166+10 1FED C2FC1F jp nz, _POST_CHECK_APU_FAILED
|
||
39:20176+7 1FF0 3E00 ld a, 0x00 ;set present flag
|
||
40:20183+13 1FF2 320E42 ld (var_apu_present),a
|
||
41:20196+10 1FF5 213521 ld hl,[str_post_ok]
|
||
42:20206+17 1FF8 CDFC00 call print_str
|
||
43:20223+10 1FFB C9 ret
|
||
44: - 1FFC _POST_CHECK_APU_FAILED:
|
||
45:20233+7 1FFC 3EFF ld a, 0xFF
|
||
46:20240+13 1FFE 320E42 ld (var_apu_present),a
|
||
47:20253+10 2001 21FD20 ld hl,[str_post_nd]
|
||
48:20263+17 2004 CDFC00 call print_str
|
||
49:20280+10 2007 C9 ret
|
||
50:
|
||
51: - 2008 POST_CHECK_IDE_30:
|
||
52:20290+10 2008 217620 ld hl,[str_post_ide_30]
|
||
53:20300+17 200B CDFC00 call print_str
|
||
54:20317+11 200E DB30 in a,(0x30)
|
||
55:20328+4 2010 B7 or a
|
||
56:20332+10 2011 C22E20 jp nz, _POST_CHECK_IDE_FAILED
|
||
57:20342+10 2014 213521 ld hl,[str_post_ok]
|
||
58:20352+17 2017 CDFC00 call print_str
|
||
59:20369+10 201A C9 ret
|
||
60: - 201B POST_CHECK_IDE_40:
|
||
61:20379+10 201B 219120 ld hl,[str_post_ide_40]
|
||
62:20389+17 201E CDFC00 call print_str
|
||
63:20406+11 2021 DB40 in a,(0x40)
|
||
64:20417+4 2023 B7 or a
|
||
65:20421+10 2024 C22E20 jp nz, _POST_CHECK_IDE_FAILED
|
||
66:20431+10 2027 213521 ld hl,[str_post_ok]
|
||
67:20441+17 202A CDFC00 call print_str
|
||
68:20458+10 202D C9 ret
|
||
69:
|
||
70: - 202E _POST_CHECK_IDE_FAILED
|
||
71:20468+10 202E 21FD20 ld hl,[str_post_nd]
|
||
72:20478+17 2031 CDFC00 call print_str
|
||
73:20495+10 2034 C9 ret
|
||
74:
|
||
75: - 2035 POST_TEST_RTC:
|
||
76:20505+7 2035 3E06 ld a, 0x06
|
||
77:20512+13 2037 320F42 ld (var_scratch),a
|
||
78:20525+10 203A 21E220 ld hl,[str_post_rtc]
|
||
79:20535+17 203D CDFC00 call print_str
|
||
80:20552+10 2040 210F42 ld hl,[var_scratch]
|
||
81:20562+7 2043 0601 ld b, 1
|
||
82:20569+7 2045 0ED0 ld c, ADDR_RTC
|
||
83:20576+17 2047 CDE116 call iic_send_buffer
|
||
84:20593+4 204A B7 or a
|
||
85:20597+10 204B C26820 jp nz, _POST_TEST_RTC_NOTFOUND
|
||
86:20607+10 204E 210F42 ld hl,[var_scratch]
|
||
87:20617+7 2051 0601 ld b, 1
|
||
88:20624+7 2053 0ED0 ld c, ADDR_RTC
|
||
89:20631+17 2055 CD0B17 call iic_receive_buffer
|
||
90:20648+13 2058 3A0F42 ld a, (var_scratch)
|
||
91:20661+4 205B B7 or a
|
||
92:20665+10 205C CA6F20 jp z, _POST_TEST_RTC_INVALID
|
||
93:20675+10 205F 213521 ld hl,[str_post_ok]
|
||
94:20685+17 2062 CDFC00 call print_str
|
||
95:20702+10 2065 C3521D jp _OP_RTIME_NN
|
||
96: - 2068 _POST_TEST_RTC_NOTFOUND:
|
||
97:20712+10 2068 21FD20 ld hl,[str_post_nd]
|
||
98:20722+17 206B CDFC00 call print_str
|
||
99:20739+10 206E C9 ret
|
||
100: - 206F _POST_TEST_RTC_INVALID:
|
||
101:20749+10 206F 210B21 ld hl,[str_post_rtc_iv]
|
||
102:20759+17 2072 CDFC00 call print_str
|
||
103:20776+10 2075 C9 ret
|
||
104:
|
||
105: - 2076 str_post_ide_30:
|
||
106: - 2076 0D0A4368 db 13,10,"Check Diskctrl.@030h... ",0
|
||
65636B20
|
||
4469736B
|
||
6374726C
|
||
2E403033
|
||
30682E2E
|
||
2E2000
|
||
107: - 2091 str_post_ide_40:
|
||
108: - 2091 0D0A4368 db 13,10,"Check Diskctrl.@040h... ",0
|
||
65636B20
|
||
4469736B
|
||
6374726C
|
||
2E403034
|
||
30682E2E
|
||
2E2000
|
||
109: - 20AC str_post_pio:
|
||
110: - 20AC 0D0A4368 db 13,10,"Check IO-Controller ... ",0
|
||
65636B20
|
||
494F2D43
|
||
6F6E7472
|
||
6F6C6C65
|
||
72202E2E
|
||
2E2000
|
||
111: - 20C7 str_post_apu:
|
||
112: - 20C7 0D0A4368 db 13,10,"Check AMD8911 APU ... ",0
|
||
65636B20
|
||
414D4438
|
||
39313120
|
||
41505520
|
||
20202E2E
|
||
2E2000
|
||
113: - 20E2 str_post_rtc:
|
||
114: - 20E2 0D0A4368 db 13,10,"Check DS1307 RTC ... ",0
|
||
65636B20
|
||
44533133
|
||
30372052
|
||
54432020
|
||
20202E2E
|
||
2E2000
|
||
115: - 20FD str_post_nd:
|
||
116: - 20FD 6E6F7420 db "not detected!",0
|
||
64657465
|
||
63746564
|
||
2100
|
||
117: - 210B str_post_rtc_iv:
|
||
118: - 210B 6E6F7420 db "not set. Check battery and run 'setdate'!",0
|
||
7365742E
|
||
20436865
|
||
636B2062
|
||
61747465
|
||
72792061
|
||
6E642072
|
||
756E2027
|
||
73657464
|
||
61746527
|
||
2100
|
||
119: - 2135 str_post_ok:
|
||
**** main.asm ****
|
||
231: - 2135 6F6B2120 db "ok! ",0
|
||
00
|
||
232: .include "fat16.s"
|
||
**** include/fat16.s ****
|
||
1: ; VARS
|
||
2:
|
||
3: - 45BA phase MEM_IDE_FSBUFFER
|
||
4: - 45BA MEM_FAT_RESERVED: ; Reserved sectors (2byte)
|
||
5: - 45BA ..45BB 00 defs 2
|
||
6: - 45BC MEM_FAT_AMOUNT: ; Amount of FATs (1byte)
|
||
7: - 45BC ..45BC 00 defs 1
|
||
8: - 45BD MEM_FAT_SECTORS: ; Length of FAT (2byte)
|
||
9: - 45BD ..45BE 00 defs 2
|
||
10: - 45BF MEM_FAT_CLUSTERLEN: ; Length of Cluster (1byte)
|
||
11: - 45BF ..45BF 00 defs 1
|
||
12: - 45C0 MEM_FAT_COUNT1: ; Counter Var for reading FAT (2byte)
|
||
13: - 45C0 ..45C0 00 defs 1
|
||
14: - 45C1 MEM_FAT_TMPPOINTER: ; Temporary working pointer
|
||
15: - 45C1 ..45C4 00 defs 4
|
||
16: - 45C5 MEM_FAT_DATASTART: ; Start of data area
|
||
17: - 45C5 ..45C8 00 defs 4
|
||
18: - 45C9 MEM_FAT_ROOTSTART: ; Start of Root directory
|
||
19: - 45C9 ..45CC 00 defs 4
|
||
20: - 45CD MEM_FAT_FILEREMAIN: ; Remaining sectors in file
|
||
21: - 45CD ..45D0 00 defs 4
|
||
22: - 45D1 MEM_FAT_DIRSEC: ; Sectors per directory
|
||
23: - 45D1 ..45D2 00 defs 2
|
||
24: - 45D3 MEM_FAT_TMPFNAME: ; Temporary filename
|
||
25: - 45D3 ..45E2 00 defs 16
|
||
26: - 45E3 MEM_FAT_CURDIR: ; Current Directory
|
||
27: - 45E3 ..4632 00 defs 80
|
||
28: - 4633 MEM_FAT_OF0_ATTRIBUTE: ;Current file attribute
|
||
29: - 4633 0000 defw 0
|
||
30: - 4635 MEM_FAT_OF0_CCLUST: ;Current cluster of file
|
||
31: - 4635 0000 defw 0
|
||
32: - 4637 MEM_FAT_OF0_FATSEC: ;Current sector in FAT
|
||
33: - 4637 ..463A 00 defs 4
|
||
34: - 463B MEM_FAT_OF0_DATSEC: ;Current sector in Data
|
||
35: - 463B ..463E 00 defs 4
|
||
36: - 463F MEM_FAT_OF0_DATREM: ;Remaining bytes in Data
|
||
37: - 463F ..4642 00 defs 4
|
||
38: - 4643 MEM_FAT_CURRDIR: ;Current directory
|
||
39: - 4643 ..4646 00 defs 4
|
||
40: - 4647 MEM_FAT_EXEC_CURR:
|
||
41: - 4647 0000 defw 0
|
||
42: - 4649 MEM_FAT_EXEC_COUNT:
|
||
43: - 4649 0000 defw 0
|
||
44: - 464B MEM_FAT_EXEC_START:
|
||
45: - 464B 0000 defw 0
|
||
46:
|
||
47: - 21CD dephase
|
||
48:
|
||
49:
|
||
50:
|
||
51: ;-------------------------------------
|
||
52: ; Get FAT Root-Table position
|
||
53: ;-------------------------------------
|
||
54: - 21CD fat_get_root_table:
|
||
55:20786+17 21CD CD8E24 call fat_reset_pointer ;reset fat pointer
|
||
56:
|
||
57: ; Load first sector on active partition
|
||
58:20803+10 21D0 21D542 LD HL, MEM_IDE_POINTER ; pointer to LBA address
|
||
59:20813+7 21D3 3E01 LD A,1 ;read 1 sector
|
||
60:20820+10 21D5 11BA43 LD DE, MEM_IDE_BUFFER ;where to store data?
|
||
61:20830+17 21D8 CD7F15 call read_lba_sector
|
||
62:
|
||
63: ; check for valid Boot sector
|
||
64:20847+13 21DB 3ABA43 ld a,(MEM_IDE_BUFFER)
|
||
65:20860+7 21DE FEEB cp 0xEB ;first byte should be 0xEB
|
||
66:20867+10 21E0 C29A22 jp nz, _fat_get_root_table_invalid
|
||
67:
|
||
68: ; Read and store FS Properties
|
||
69:20877+14 21E3 DD21BA43 LD IX,MEM_IDE_BUFFER
|
||
70:20891+19 21E7 DD7E0D LD A,(IX+0x0D)
|
||
71:20910+13 21EA 32BF45 LD (MEM_FAT_CLUSTERLEN),A
|
||
72:20923+19 21ED DD7E0E LD A,(IX+0x0E)
|
||
73:20942+13 21F0 32BA45 LD (MEM_FAT_RESERVED),A
|
||
74:20955+19 21F3 DD7E0F LD A,(IX+0x0F)
|
||
75:20974+13 21F6 32BB45 LD (MEM_FAT_RESERVED+1),A
|
||
76:20987+19 21F9 DD7E10 LD A,(IX+0x10)
|
||
77:21006+13 21FC 32BC45 LD (MEM_FAT_AMOUNT),A
|
||
78:21019+19 21FF DD7E16 LD A,(IX+0x16)
|
||
79:21038+13 2202 32BD45 LD (MEM_FAT_SECTORS),A
|
||
80:21051+19 2205 DD7E17 LD A,(IX+0x17)
|
||
81:21070+13 2208 32BE45 LD (MEM_FAT_SECTORS+1),A
|
||
82:
|
||
83: ;Get Data Start Sector
|
||
84: ;calculate fat length
|
||
85:21083+20 220B ED4BBD45 ld bc,(MEM_FAT_SECTORS)
|
||
86:21103+13 220F 3ABC45 ld a,(MEM_FAT_AMOUNT) ;add fat to cluster number
|
||
87:21116+7 2212 1600 ld d,0
|
||
88:21123+4 2214 5F ld e,a
|
||
89:21127+17 2215 CD7524 call _fat_math_mul32
|
||
90: ; BCHL contains result -> store to PTR.MEM_FAT_ROOTSTART
|
||
91:21144+16 2218 22C945 ld (MEM_FAT_ROOTSTART+0),hl
|
||
92:21160+20 221B ED43CB45 ld (MEM_FAT_ROOTSTART+2),bc
|
||
93:
|
||
94: ;add offset (reserved sectors)
|
||
95:21180+16 221F 2AC843 ld hl,(MEM_IDE_BUFFER +0x0E) ; load sectors into hl
|
||
96:21196+16 2222 22C145 ld (MEM_FAT_TMPPOINTER), hl
|
||
97:21212+4 2225 AF xor a
|
||
98:21216+13 2226 32C345 ld (MEM_FAT_TMPPOINTER+2),a
|
||
99:21229+13 2229 32C445 ld (MEM_FAT_TMPPOINTER+3),a
|
||
100:
|
||
101:21242+10 222C 01C945 ld bc,[MEM_FAT_ROOTSTART]
|
||
102:21252+10 222F 11C145 ld de,[MEM_FAT_TMPPOINTER]
|
||
103:21262+17 2232 CD4424 call _fat_math_add32 ;MEM_FAT_ROOTSTART now contains the first sector
|
||
104: ;of the Root directory
|
||
105:
|
||
106: ;add offset (partition location)
|
||
107:21279+17 2235 CD5815 call ideif_get_drv_pointer
|
||
108:21296+10 2238 DD23 inc ix
|
||
109:21306+10 223A DD23 inc ix
|
||
110:21316+15 223C DDE5 push ix
|
||
111:21331+10 223E D1 pop de ;copy poiter to hl
|
||
112:21341+10 223F 01C945 ld bc,[MEM_FAT_ROOTSTART]
|
||
113:21351+17 2242 CD4424 call _fat_math_add32 ;MEM_FAT_OF0_DATSEC now contains the first sector
|
||
114: ;of the cluster
|
||
115: ;copy value from MEM_FAT_ROOTSTART to MEM_IDE_POINTER
|
||
116:21368+10 2245 21C945 ld hl,MEM_FAT_ROOTSTART
|
||
117:21378+10 2248 11D542 ld de,MEM_IDE_POINTER
|
||
118:21388+16 224B EDA0 ldi
|
||
119:21404+16 224D EDA0 ldi
|
||
120:21420+16 224F EDA0 ldi
|
||
121:21436+16 2251 EDA0 ldi
|
||
122:
|
||
123: ;copy value from MEM_FAT_ROOTSTART to MEM_IDE_POINTER
|
||
124:21452+10 2253 21C945 ld hl,MEM_FAT_ROOTSTART
|
||
125:21462+10 2256 11C545 ld de,MEM_FAT_DATASTART
|
||
126:21472+16 2259 EDA0 ldi
|
||
127:21488+16 225B EDA0 ldi
|
||
128:21504+16 225D EDA0 ldi
|
||
129:21520+16 225F EDA0 ldi
|
||
130:
|
||
131:21536+10 2261 21C945 ld hl,MEM_FAT_ROOTSTART
|
||
132:21546+10 2264 114346 ld de,MEM_FAT_CURRDIR
|
||
133:21556+16 2267 EDA0 ldi
|
||
134:21572+16 2269 EDA0 ldi
|
||
135:21588+16 226B EDA0 ldi
|
||
136:21604+16 226D EDA0 ldi
|
||
137:
|
||
138: ;add offset to data area
|
||
139: ;multiply cluster by length of cluster
|
||
140:
|
||
141: ;calculate sectors for root dir
|
||
142:21620+16 226F 2ACB43 ld hl,(MEM_IDE_BUFFER+0x11) ;load Maximum root directory entries
|
||
143:21636+4 2272 7C ld a,h
|
||
144:21640+4 2273 6F ld l,a
|
||
145:21644+4 2274 AF xor a ;set a 0, clear carry flag
|
||
146:21648+4 2275 67 ld h,a ;shift right by 8 bit = /512
|
||
147:
|
||
148: ;last step: multiply by 16
|
||
149:21652+4 2276 EB ex de,hl
|
||
150:21656+10 2277 011000 ld bc,16
|
||
151:21666+17 227A CD7524 call _fat_math_mul32
|
||
152: ; BCHL contains result -> store to PTR.MEM_FAT_TMPPOINTER
|
||
153:21683+16 227D 22C145 ld (MEM_FAT_TMPPOINTER+0),hl
|
||
154:21699+20 2280 ED43C345 ld (MEM_FAT_TMPPOINTER+2),bc
|
||
155:
|
||
156:21719+16 2284 22D145 ld (MEM_FAT_DIRSEC),hl
|
||
157: ; add offset to MEM_FAT_DATASTART
|
||
158:21735+10 2287 11C145 ld de,[MEM_FAT_TMPPOINTER]
|
||
159:21745+10 228A 01C545 ld bc,[MEM_FAT_DATASTART]
|
||
160:21755+17 228D CD4424 call _fat_math_add32 ;MEM_FAT_DATASTART now contains the correct sector
|
||
161: ;at teh beginnig of the data area
|
||
162:
|
||
163:
|
||
164: ;done all FS vars populated
|
||
165:
|
||
166: ;navigate to root directory
|
||
167:21772+7 2290 3E5C ld a,'\'
|
||
168:21779+13 2292 32E345 ld(MEM_FAT_CURDIR),a
|
||
169:21792+4 2295 AF xor a
|
||
170:21796+13 2296 32E445 ld(MEM_FAT_CURDIR+1),a
|
||
171:
|
||
172:21809+10 2299 C9 ret
|
||
173:
|
||
174: - 229A _fat_get_root_table_invalid:
|
||
175:21819+17 229A CDEC01 call PRINTINLINE
|
||
176: - 229D 0A0D4361 db 10,13,"Cannot find boot sector.",10,13,0
|
||
6E6E6F74
|
||
2066696E
|
||
6420626F
|
||
6F742073
|
||
6563746F
|
||
722E0A0D
|
||
00
|
||
177:21836+17 22BA CD5815 call ideif_get_drv_pointer
|
||
178:21853+19 22BD DD360002 ld (ix+0),0x02
|
||
179:21872+10 22C1 C9 ret
|
||
180:
|
||
181: ;-------------------------------------
|
||
182: ; fat_getfatsec
|
||
183: ;
|
||
184: ; gets sector in FAT table for the cluster stored in MEM_FAT_OF0_CCLUST
|
||
185: ;
|
||
186: ; store result in MEM_FAT_OF0_FATSEC
|
||
187: ; stores next cluster in MEM_FAT_OF0_CCLUST
|
||
188: ;-------------------------------------
|
||
189: - 22C2 fat_getfatsec:
|
||
190:21882+16 22C2 2A3546 ld HL,(MEM_FAT_OF0_CCLUST) ;load cluster
|
||
191:21898+4 22C5 7C ld a,h ;if not 0x0000
|
||
192:21902+4 22C6 B5 or l
|
||
193:21906+10 22C7 C2D922 jp nz, _fat_getfatsec_notroot
|
||
194: ;if 0x0000, goto root directory
|
||
195:21916+10 22CA 21C945 ld hl,MEM_FAT_ROOTSTART
|
||
196:21926+10 22CD 113B46 ld de,MEM_FAT_OF0_DATSEC
|
||
197:21936+16 22D0 EDA0 ldi ;quick and dirty hack to go back to root directory
|
||
198:21952+16 22D2 EDA0 ldi
|
||
199:21968+16 22D4 EDA0 ldi
|
||
200:21984+16 22D6 EDA0 ldi
|
||
201:22000+10 22D8 C9 ret
|
||
202:
|
||
203: - 22D9 _fat_getfatsec_notroot:
|
||
204:22010+16 22D9 2A3546 ld HL,(MEM_FAT_OF0_CCLUST) ;load cluster
|
||
205: ;each sector contains 256 clusters
|
||
206: ;first 8bits are not needed (/256)
|
||
207:22026+4 22DC 7C ld a,h ;divide by 256
|
||
208:22030+4 22DD 6F ld l,a
|
||
209:22034+4 22DE AF xor a
|
||
210:22038+4 22DF 67 ld h,a
|
||
211:
|
||
212:22042+20 22E0 ED4BBA45 ld bc,(MEM_FAT_RESERVED) ;add reserved sectors
|
||
213:22062+11 22E4 09 add hl,bc
|
||
214:22073+16 22E5 223746 ld(MEM_FAT_OF0_FATSEC+0),hl;store sector
|
||
215:22089+4 22E8 AF xor a
|
||
216:22093+13 22E9 323946 ld(MEM_FAT_OF0_FATSEC+2),a
|
||
217:22106+13 22EC 323A46 ld(MEM_FAT_OF0_FATSEC+3),a
|
||
218:
|
||
219:22119+17 22EF CD5815 call ideif_get_drv_pointer
|
||
220:22136+10 22F2 DD23 inc ix
|
||
221:22146+10 22F4 DD23 inc ix
|
||
222:22156+15 22F6 DDE5 push ix
|
||
223:22171+10 22F8 D1 pop de ;copy poiter to hl
|
||
224:22181+10 22F9 013746 ld bc,[MEM_FAT_OF0_FATSEC]
|
||
225:22191+17 22FC CD4424 call _fat_math_add32 ;MEM_FAT_OF0_FATSEC now contains the correct sector
|
||
226: ;in the FAT
|
||
227:
|
||
228: ;read FAT sector
|
||
229:22208+10 22FF 213746 ld hl,MEM_FAT_OF0_FATSEC ;read next sector
|
||
230:22218+7 2302 0601 ld b,1
|
||
231:22225+7 2304 3E01 ld a,1
|
||
232:22232+10 2306 11BA43 LD DE, MEM_IDE_BUFFER ;where to store data?
|
||
233:22242+17 2309 CD7F15 call read_lba_sector
|
||
234:
|
||
235: ;calculate data sector
|
||
236: ;multiply cluster by length of cluster
|
||
237:22259+4 230C AF xor a ;clear carry
|
||
238:22263+13 230D 3ABF45 ld a,(MEM_FAT_CLUSTERLEN)
|
||
239:22276+7 2310 0600 ld b,0
|
||
240:22283+4 2312 4F ld c,a
|
||
241:22287+20 2313 ED5B3546 ld de,(MEM_FAT_OF0_CCLUST) ;load cluster number
|
||
242:22307+6 2317 1B dec de ; sub 2 becaus fat starts at 3
|
||
243:22313+6 2318 1B dec de
|
||
244:22319+17 2319 CD7524 call _fat_math_mul32
|
||
245: ; BCHL contains result -> store to PTR.MEM_FAT_OF0_DATSEC
|
||
246:22336+16 231C 223B46 ld (MEM_FAT_OF0_DATSEC+0),hl
|
||
247:22352+20 231F ED433D46 ld (MEM_FAT_OF0_DATSEC+2),bc
|
||
248:
|
||
249: ; add start of data region to addr
|
||
250:22372+10 2323 013B46 ld bc,[MEM_FAT_OF0_DATSEC]
|
||
251:22382+10 2326 11C545 ld de,[MEM_FAT_DATASTART]
|
||
252:22392+17 2329 CD4424 call _fat_math_add32 ;MEM_FAT_OF0_FATSEC now contains the correct sector
|
||
253: ;in the FAT
|
||
254: ;MEM_FAT_OF0_DATSEC now has the first sector of the selected cluster
|
||
255:
|
||
256: ;reset MEM_FAT_OF0_DATREM to default cluster length
|
||
257:22409+13 232C 3ABF45 ld a,(MEM_FAT_CLUSTERLEN)
|
||
258:22422+4 232F 6F ld l,a
|
||
259:22426+7 2330 2600 ld h,0
|
||
260:22433+16 2332 223F46 ld (MEM_FAT_OF0_DATREM), hl
|
||
261:
|
||
262: ;get next cluster
|
||
263: ;calculate offset address
|
||
264:22449+13 2335 3A3546 ld a,(MEM_FAT_OF0_CCLUST)
|
||
265:22462+4 2338 17 RLA ;shift to left (x2)
|
||
266:22466+4 2339 6F ld l, a
|
||
267:22470+7 233A 3E00 ld a,0
|
||
268:22477+4 233C 17 RLA ;shift in carry flag
|
||
269:22481+4 233D 67 ld h,a
|
||
270:22485+10 233E 11BA43 ld de,MEM_IDE_BUFFER
|
||
271:22495+11 2341 19 add hl,de
|
||
272: ;copy pointer (hl to de)
|
||
273:22506+10 2342 113546 ld de,MEM_FAT_OF0_CCLUST
|
||
274:22516+16 2345 EDA0 ldi ;copy byte for next cluster from FAT
|
||
275:22532+16 2347 EDA0 ldi
|
||
276:22548+10 2349 C9 ret
|
||
277: ;store data
|
||
278:
|
||
279: ;-------------------------------------
|
||
280: ; fat_readfilesec
|
||
281: ;
|
||
282: ; reads single sector of file
|
||
283: ; must run fat_readfilesec before to initialize
|
||
284: ; if a ix 0x00, success
|
||
285: ; if a is 0xFF, end reached
|
||
286: ;
|
||
287: ; DE contains destination address
|
||
288: ;-------------------------------------
|
||
289: - 234A fat_readfilesec:
|
||
290: ;call fat_print_dbg
|
||
291:22558+10 234A 213B46 ld hl,[MEM_FAT_OF0_DATSEC]
|
||
292:22568+7 234D 0601 ld b,1
|
||
293:22575+7 234F 3E01 ld a,1
|
||
294: ;LD DE, MEM_IDE_BUFFER ;where to store data?
|
||
295:22582+17 2351 CD7F15 call read_lba_sector ;read sectore
|
||
296:22599+10 2354 213B46 ld hl,[MEM_FAT_OF0_DATSEC] ;increment pointer to next sector
|
||
297:22609+17 2357 CD3024 call _fat_increment_32 ;***
|
||
298:22626+16 235A 2A3F46 ld hl,(MEM_FAT_OF0_DATREM) ;reduce counter
|
||
299:22642+4 235D AF xor a
|
||
300:22646+10 235E 110100 ld de,1
|
||
301:22656+15 2361 ED52 sbc hl,de ;decrement counter
|
||
302:22671+16 2363 223F46 ld (MEM_FAT_OF0_DATREM),hl ;store decremented counter
|
||
303:22687+5+6 2366 C0 ret nz ;when not zero, exit function
|
||
304: ;if zero:
|
||
305:22692+7 2367 3EFF ld a, 0xFF ;preload error code
|
||
306:22699+16 2369 2A3546 ld hl,(MEM_FAT_OF0_CCLUST) ;check next chunk
|
||
307:22715+10 236C 11FFFF ld de,0xFFFF ;end mark
|
||
308:22725+15 236F ED52 sbc hl,de ;if Z match
|
||
309:22740+5+6 2371 C8 ret z ;If 0xFFFF, end is reched. Return
|
||
310: ;if next cluster available:
|
||
311:22745+4 2372 AF xor a
|
||
312:22749+17 2373 CDC222 call fat_getfatsec ; read next cluster information
|
||
313:22766+10 2376 C9 ret
|
||
314:
|
||
315:
|
||
316: ;-------------------------------------
|
||
317: ; fat_openfile
|
||
318: ; search for entry in current directory
|
||
319: ;
|
||
320: ; DE pointer to file name
|
||
321: ; sets:
|
||
322: ; - MEM_FAT_OF0_CCLUST
|
||
323: ; - MEM_FAT_OF0_ATTRIBUTE
|
||
324: ; - MEM_FAT_FILEREMAIN
|
||
325: ; if a is 0x00, success
|
||
326: ; if a is 0xFF, end reached
|
||
327: ;-------------------------------------
|
||
328: - 2377 fat_openfile:
|
||
329:22776+11 2377 D5 PUSH DE
|
||
330: ;MEM_FAT_TMPFNAME now has valid text to compare
|
||
331:22787+10 2378 21D345 LD HL,[MEM_FAT_TMPFNAME]
|
||
332:22797+17 237B CDBC24 call format_filename_fat16
|
||
333:22814+10 237E D1 POP DE
|
||
334: - 237F fat_openfile_noprepare:
|
||
335:22824+11 237F D5 PUSH DE
|
||
336: ;prepare pointer
|
||
337:22835+10 2380 214346 ld hl,MEM_FAT_CURRDIR
|
||
338:22845+10 2383 11D542 ld de,MEM_IDE_POINTER
|
||
339:22855+16 2386 EDA0 ldi
|
||
340:22871+16 2388 EDA0 ldi
|
||
341:22887+16 238A EDA0 ldi
|
||
342:22903+16 238C EDA0 ldi
|
||
343:
|
||
344:22919+13 238E 3AD145 LD A,(MEM_FAT_DIRSEC) ;init counter for FAT sectors
|
||
345:22932+13 2391 32C045 LD (MEM_FAT_COUNT1),A
|
||
346:
|
||
347:22945+10 2394 21D542 LD HL,MEM_IDE_POINTER ;read first sector
|
||
348:22955+7 2397 0601 LD B,1
|
||
349:22962+7 2399 3E01 ld a,1
|
||
350:22969+10 239B 11BA43 LD DE, MEM_IDE_BUFFER ;where to store data?
|
||
351:22979+17 239E CD7F15 call read_lba_sector
|
||
352:
|
||
353:22996+10 23A1 21BA43 LD HL, MEM_IDE_BUFFER ;set buffer start
|
||
354:23006+7 23A4 0E10 LD C,16 ;set entries counter
|
||
355:
|
||
356: - 23A6 _fat_lfs_loop:
|
||
357:23013+10 23A6 11D345 LD DE,[MEM_FAT_TMPFNAME]
|
||
358:23023+17 23A9 CDA624 CALL compare_filename
|
||
359:23040+7+5 23AC 3838 JR C, _fat_lfs_loop_compare_match ;on match
|
||
360:
|
||
361: ; prepare next entry
|
||
362:23047+4 23AE 0D DEC C ;next sector after 16 entries
|
||
363:23051+7+5 23AF 2807 JR Z,_fat_lfs_loop_compare_next_sector
|
||
364:23058+10 23B1 112000 LD DE, 32 ;length of entry
|
||
365:23068+11 23B4 19 ADD HL,DE ;increment
|
||
366:23079+10 23B5 C3A623 JP _fat_lfs_loop
|
||
367:
|
||
368: - 23B8 _fat_lfs_loop_compare_next_sector:
|
||
369:23089+10 23B8 21D542 ld hl,[MEM_IDE_POINTER]
|
||
370:23099+17 23BB CD3024 call _fat_increment_32 ;increment sector
|
||
371:
|
||
372:23116+13 23BE 3AC045 LD A,(MEM_FAT_COUNT1) ; decrement sector count (max FAT length)
|
||
373:23129+4 23C1 3D DEC A
|
||
374:23133+13 23C2 32C045 LD (MEM_FAT_COUNT1),A
|
||
375:23146+10 23C5 CAE223 JP Z, _fat_lfs_loop_compare_end ; if DE is 0, mmax is reached. End here
|
||
376: ;call print_a_hex
|
||
377:
|
||
378:23156+10 23C8 21D542 LD HL,MEM_IDE_POINTER ;read next sector
|
||
379:23166+7 23CB 0601 LD B,1
|
||
380:23173+7 23CD 3E01 ld a,1
|
||
381:23180+10 23CF 11BA43 LD DE, MEM_IDE_BUFFER ;where to store data?
|
||
382:23190+17 23D2 CD7F15 call read_lba_sector
|
||
383:
|
||
384:23207+10 23D5 21BA43 LD HL, MEM_IDE_BUFFER ;set buffer start
|
||
385:23217+7 23D8 0E10 LD C,16 ;set entries counter
|
||
386:
|
||
387:23224+7 23DA 7E ld a,(HL)
|
||
388:23231+4 23DB B7 or a
|
||
389:23235+10 23DC CAE223 jp z, _fat_lfs_loop_compare_end ;skip empty sectors
|
||
390:
|
||
391:23245+10 23DF C3A623 JP _fat_lfs_loop
|
||
392:
|
||
393: - 23E2 _fat_lfs_loop_compare_end:
|
||
394:23255+10 23E2 D1 POP DE
|
||
395:23265+7 23E3 3EFF ld a,0xFF
|
||
396:23272+10 23E5 C9 RET
|
||
397:
|
||
398: - 23E6 _fat_lfs_loop_compare_match:
|
||
399: ; get entry
|
||
400:23282+10 23E6 D1 POP DE
|
||
401:
|
||
402: ; HL points to Start of Table item
|
||
403:23292+11 23E7 E5 PUSH HL
|
||
404:23303+14 23E8 DDE1 POP IX
|
||
405: ; get important information
|
||
406:23317+19 23EA DD7E1B ld a,(ix+0x1B) ;first cluster number
|
||
407:23336+13 23ED 323646 ld (MEM_FAT_OF0_CCLUST+1),a
|
||
408:23349+19 23F0 DD7E1A ld a,(ix+0x1A)
|
||
409:23368+13 23F3 323546 ld (MEM_FAT_OF0_CCLUST+0),a
|
||
410:23381+19 23F6 DD7E0B ld a,(ix+0x0B)
|
||
411:23400+13 23F9 323346 ld (MEM_FAT_OF0_ATTRIBUTE+0),a
|
||
412:
|
||
413:23413+4 23FC AF xor a ;clear carry ;set MEM_FAT_OF0_DATREM to remaining sectors
|
||
414:23417+19 23FD DD7E1F ld a,(ix+0x1F) ;cluste length shift by 256
|
||
415:23436+4 2400 1F rra
|
||
416:23440+13 2401 32CF45 ld (MEM_FAT_FILEREMAIN+2),a
|
||
417:23453+19 2404 DD7E1E ld a,(ix+0x1E)
|
||
418:23472+4 2407 1F rra
|
||
419:23476+13 2408 32CE45 ld (MEM_FAT_FILEREMAIN+1),a
|
||
420:23489+19 240B DD7E1D ld a,(ix+0x1D)
|
||
421:23508+4 240E 1F rra
|
||
422:23512+13 240F 32CD45 ld (MEM_FAT_FILEREMAIN+0),a
|
||
423:23525+7 2412 3E00 ld a,0
|
||
424:23532+13 2414 32D045 ld (MEM_FAT_FILEREMAIN+3),a
|
||
425:23545+17 2417 CDC222 call fat_getfatsec ;get sector information
|
||
426:
|
||
427:23562+4 241A AF xor a
|
||
428:23566+10 241B C9 RET
|
||
429:
|
||
430:
|
||
431: ;=================== UTIL Functions ===========================
|
||
432: ; 32 Bit addition to pointer
|
||
433: ; HL has value
|
||
434: ;deprecated!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||
435: - 241C _fat_math_sector_add_16:
|
||
436:23576+16 241C 22C145 ld (MEM_FAT_TMPPOINTER), hl
|
||
437:23592+4 241F AF xor a
|
||
438:23596+13 2420 32C345 ld (MEM_FAT_TMPPOINTER+2),a
|
||
439:23609+13 2423 32C445 ld (MEM_FAT_TMPPOINTER+3),a
|
||
440:
|
||
441:23622+10 2426 11C145 ld de,[MEM_FAT_TMPPOINTER]
|
||
442:23632+10 2429 01D542 ld bc,[MEM_IDE_POINTER]
|
||
443:23642+17 242C CD4424 call _fat_math_add32
|
||
444:23659+10 242F C9 ret
|
||
445: ;deprecated!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||
446:
|
||
447: ;hl contains pointer
|
||
448: - 2430 _fat_increment_32
|
||
449:23669+7 2430 7E ld a,(HL) ; byte 0
|
||
450:23676+7 2431 C601 add 1
|
||
451:23683+7 2433 77 ld (hl),a
|
||
452:23690+6 2434 23 inc hl
|
||
453:23696+7 2435 7E ld a,(HL) ; byte 1
|
||
454:23703+7 2436 CE00 adc 0
|
||
455:23710+7 2438 77 ld (hl),a
|
||
456:23717+6 2439 23 inc hl
|
||
457:23723+7 243A 7E ld a,(HL) ; byte 2
|
||
458:23730+7 243B CE00 adc 0
|
||
459:23737+7 243D 77 ld (hl),a
|
||
460:23744+6 243E 23 inc hl
|
||
461:23750+7 243F 7E ld a,(HL) ; byte 3
|
||
462:23757+7 2440 CE00 adc 0
|
||
463:23764+7 2442 77 ld (hl),a
|
||
464:23771+10 2443 C9 ret
|
||
465: ;bc contains pointer to a (also result)
|
||
466: ;de contains pointer to b
|
||
467: - 2444 _fat_math_add32
|
||
468:23781+11 2444 E5 push hl
|
||
469:23792+11 2445 C5 push bc
|
||
470:23803+11 2446 D5 push de
|
||
471:23814+7 2447 1A ld a,(de) ; load lower 16bit for B int from (DE) to HL
|
||
472:23821+4 2448 6F ld l,a
|
||
473:23825+6 2449 13 inc de
|
||
474:23831+7 244A 1A ld a,(de)
|
||
475:23838+4 244B 67 ld h,a
|
||
476:23842+6 244C 13 inc de
|
||
477: ; HL, DE dirty
|
||
478:23848+7 244D 0A ld a,(bc) ; load lower 16bit for A int from (BC) to DE
|
||
479:23855+4 244E 5F ld e,a
|
||
480:23859+6 244F 03 inc bc
|
||
481:23865+7 2450 0A ld a,(bc)
|
||
482:23872+4 2451 57 ld d,a
|
||
483: ; HL now contains A, DE now contains D
|
||
484:23876+11 2452 19 add hl,de ;add lower bytes, store carry
|
||
485:23887+10 2453 D1 pop de ;restore pointers
|
||
486:23897+10 2454 C1 pop bc ;both now cointain first byte of long-value
|
||
487:23907+4 2455 7D ld a,l ;store lower result in (bc)
|
||
488:23911+7 2456 02 ld (bc),a
|
||
489:23918+6 2457 03 inc bc
|
||
490:23924+4 2458 7C ld a,h
|
||
491:23928+7 2459 02 ld (bc),a
|
||
492:23935+6 245A 03 inc bc
|
||
493:23941+6 245B 13 inc de ;also increment de to next byte
|
||
494:23947+6 245C 13 inc de
|
||
495: ; DE and HL now start at the upper byte
|
||
496:23953+11 245D C5 push bc
|
||
497:23964+11 245E D5 push de
|
||
498:23975+7 245F 1A ld a,(de) ; load upper 16bit for B
|
||
499:23982+4 2460 6F ld l,a
|
||
500:23986+6 2461 13 inc de
|
||
501:23992+7 2462 1A ld a,(de)
|
||
502:23999+4 2463 67 ld h,a
|
||
503:24003+6 2464 13 inc de
|
||
504:24009+7 2465 0A ld a,(bc) ; load upper 16bit for A
|
||
505:24016+4 2466 5F ld e,a
|
||
506:24020+6 2467 03 inc bc
|
||
507:24026+7 2468 0A ld a,(bc)
|
||
508:24033+4 2469 57 ld d,a
|
||
509:24037+15 246A ED5A adc hl,de ;add upper bytes, store carry
|
||
510:24052+10 246C D1 pop de
|
||
511:24062+10 246D C1 pop bc
|
||
512:24072+4 246E 7D ld a,l ;store lower result in (bc)
|
||
513:24076+7 246F 02 ld(bc),a
|
||
514:24083+6 2470 03 inc bc
|
||
515:24089+4 2471 7C ld a,h
|
||
516:24093+7 2472 02 ld(bc),a
|
||
517:24100+10 2473 E1 pop hl
|
||
518:24110+10 2474 C9 ret
|
||
519:
|
||
520:
|
||
521: ; Multiply 16-bit values (with 32-bit result)
|
||
522: ; Operands BC, DE
|
||
523: ; Result -> BCHL
|
||
524: - 2475 _fat_math_mul32:
|
||
525:24120+4 2475 79 ld a,c
|
||
526:24124+4 2476 48 ld c,b
|
||
527:24128+10 2477 210000 ld hl,0
|
||
528:24138+7 247A 0610 ld b,16
|
||
529: - 247C _fat_math_mul32_l:
|
||
530:24145+11 247C 29 add hl,hl
|
||
531:24156+4 247D 17 rla
|
||
532:24160+8 247E CB11 rl c
|
||
533:24168+7+5 2480 3007 jr nc,_fat_math_mul32_noadd
|
||
534:24175+11 2482 19 add hl,de
|
||
535:24186+7 2483 CE00 adc a,0
|
||
536:24193+10 2485 D28924 jp nc,_fat_math_mul32_noadd
|
||
537:24203+4 2488 0C inc c
|
||
538: - 2489 _fat_math_mul32_noadd:
|
||
539:24207+8+5 2489 10F1 djnz _fat_math_mul32_l
|
||
540:24215+4 248B 41 ld b,c
|
||
541:24219+4 248C 4F ld c,a
|
||
542:24223+10 248D C9 ret
|
||
543:
|
||
544: ; reset LBA pointer to first sector in selected partition
|
||
545: - 248E fat_reset_pointer:
|
||
546:24233+17 248E CD5815 call ideif_get_drv_pointer
|
||
547:24250+10 2491 DD23 inc ix
|
||
548:24260+10 2493 DD23 inc ix
|
||
549:24270+15 2495 DDE5 push ix
|
||
550:24285+10 2497 E1 pop hl ;copy poiter to hl
|
||
551:24295+10 2498 11D542 ld de, MEM_IDE_POINTER
|
||
552:24305+12 249B 1800 jr fat_copy_lba_pointer
|
||
553:
|
||
554: ; resets LBA pointer (4-byte) to partition start
|
||
555: ; HL = from here
|
||
556: ; DE = to this destimation
|
||
557: - 249D fat_copy_lba_pointer:
|
||
558:24317+11 249D C5 PUSH BC
|
||
559:24328+7 249E 0600 LD B,0
|
||
560:24335+7 24A0 0E04 LD C,4
|
||
561:24342+16+5 24A2 EDB0 LDIR
|
||
562:24358+10 24A4 C1 POP BC
|
||
563:24368+10 24A5 C9 ret
|
||
564:
|
||
565: ; compares filenames
|
||
566: ; HL points to name1
|
||
567: ; DE points to name2
|
||
568: ; Carry is set if match
|
||
569: ; Destroys DE, AF
|
||
570: - 24A6 compare_filename:
|
||
571:24378+11 24A6 E5 PUSH HL
|
||
572:24389+11 24A7 C5 push BC
|
||
573:24400+7 24A8 060B LD B, 11 ;Counter
|
||
574: - 24AA _compare_filename_loop:
|
||
575:24407+7 24AA 1A LD A,(DE)
|
||
576:24414+4 24AB 4F LD C,A
|
||
577:24418+7 24AC 7E LD A,(HL)
|
||
578:24425+6 24AD 23 INC HL
|
||
579:24431+6 24AE 13 INC DE
|
||
580:24437+4 24AF A9 XOR C ;check if identical (should return 0)
|
||
581:24441+7+5 24B0 2006 JR NZ, _compare_filename_nomatch
|
||
582:24448+8+5 24B2 10F6 djnz _compare_filename_loop ;if not last, continue
|
||
583:24456+10 24B4 C1 POP BC
|
||
584:24466+10 24B5 E1 POP HL
|
||
585:24476+4 24B6 37 SCF
|
||
586:24480+10 24B7 C9 RET
|
||
587: - 24B8 _compare_filename_nomatch:
|
||
588:24490+10 24B8 C1 POP BC
|
||
589:24500+10 24B9 E1 POP HL
|
||
590:24510+4 24BA AF XOR A ; clear carry flag
|
||
591:24514+10 24BB C9 RET
|
||
592:
|
||
593: ; formats filename to 8+3 format
|
||
594: ; DE points to source filename to string
|
||
595: ; HL points to destination
|
||
596: - 24BC format_filename_fat16:
|
||
597:24524+7 24BC 060B LD B, 11 ;counter
|
||
598:24531+11 24BE E5 PUSH HL
|
||
599:24542+7 24BF 3E20 LD A, ' '
|
||
600: - 24C1 _format_filename_fat16_clean:
|
||
601:24549+7 24C1 77 LD (HL),A
|
||
602:24556+6 24C2 23 INC HL
|
||
603:24562+8+5 24C3 10FC DJNZ _format_filename_fat16_clean
|
||
604:24570+10 24C5 E1 POP HL ; continue with copy
|
||
605:24580+7 24C6 060D LD B, 13
|
||
606: - 24C8 _format_filename_fat16_loop:
|
||
607:24587+7 24C8 1A LD A, (DE) ; load byte
|
||
608:24594+4 24C9 B7 OR A
|
||
609:24598+5+6 24CA C8 RET Z ;exit on 0byte
|
||
610:24603+4 24CB 05 DEC B ;reduce counter
|
||
611:24607+5+6 24CC C8 RET Z ;exit after 12 bytes 8+.+3
|
||
612:24612+7 24CD FE2E CP '.' ; check if dot
|
||
613:24619+7+5 24CF 200A JR NZ, _format_filename_fat16_loop_copy ; if not continue as usual
|
||
614:24626+6 24D1 13 INC DE ;else skip char
|
||
615: - 24D2 _format_filename_fat16_loop_skip_8:
|
||
616:24632+4 24D2 78 LD A,B
|
||
617:24636+7 24D3 FE05 CP 5
|
||
618:24643+7+5 24D5 38F1 JR C, _format_filename_fat16_loop
|
||
619:24650+6 24D7 23 INC HL
|
||
620:24656+4 24D8 05 DEC B
|
||
621:24660+12 24D9 18F7 JR _format_filename_fat16_loop_skip_8
|
||
622:
|
||
623: - 24DB _format_filename_fat16_loop_copy:
|
||
624:24672+7 24DB 1A LD A, (DE) ; load byte
|
||
625:24679+7 24DC 77 LD (HL), A ; copy byte
|
||
626:24686+6 24DD 23 INC HL
|
||
627:24692+6 24DE 13 INC DE
|
||
**** main.asm ****
|
||
233:24698+10 24DF C3C824 JP _format_filename_fat16_loop
|
||
234: .include "fat16_cmd.s"
|
||
**** include/fat16_cmd.s ****
|
||
1: ;-------------------------------------
|
||
2: ; Print current fat directory of MEM_FAT_CURRDIR
|
||
3: ;-------------------------------------
|
||
4: - 24E2 fat_print_directory:
|
||
5:24708+10 24E2 214346 ld hl,MEM_FAT_CURRDIR
|
||
6:24718+10 24E5 11D542 ld de,MEM_IDE_POINTER
|
||
7:24728+16 24E8 EDA0 ldi
|
||
8:24744+16 24EA EDA0 ldi
|
||
9:24760+16 24EC EDA0 ldi
|
||
10:24776+16 24EE EDA0 ldi
|
||
11:
|
||
12:24792+20 24F0 ED5BBD45 LD DE,(MEM_FAT_SECTORS)
|
||
13:24812+20 24F4 ED53C045 LD (MEM_FAT_COUNT1),DE
|
||
14:24832+10 24F8 21D542 LD HL,MEM_IDE_POINTER ;read first sector
|
||
15:24842+7 24FB 0601 LD B,1
|
||
16:24849+7 24FD 3E01 ld a,1
|
||
17:24856+10 24FF 11BA43 LD DE, MEM_IDE_BUFFER ;where to store data?
|
||
18:24866+17 2502 CD7F15 call read_lba_sector
|
||
19:
|
||
20:24883+17 2505 CDEC01 call PRINTINLINE
|
||
21: - 2508 0A0D2020 db 10,13," Filename Cluster Size",10,13,0
|
||
46696C65
|
||
6E616D65
|
||
20202020
|
||
20436C75
|
||
73746572
|
||
2053697A
|
||
650A0D00
|
||
22:
|
||
23:24900+10 2528 21BA43 LD HL, MEM_IDE_BUFFER ;set buffer start
|
||
24:24910+7 252B 0E10 LD C,16 ;set entries counter
|
||
25:
|
||
26: - 252D _fat_print_directory_loop: ;loop over each entry (32byte)
|
||
27:24917+7 252D 7E LD A,(HL) ; check first byte
|
||
28:24924+11 252E E5 PUSH HL ;backup start of entry
|
||
29:24935+14 252F DDE1 POP IX
|
||
30:24949+11 2531 E5 PUSH HL
|
||
31: ;ignore unwanted entries
|
||
32:24960+7 2532 FE41 CP 0x41 ;skip invisible
|
||
33:24967+10 2534 CAC525 JP Z, _fat_print_directory_loop_next
|
||
34:24977+7 2537 FEE5 CP 0xE5 ;skip deleted
|
||
35:24984+10 2539 CAC525 JP Z, _fat_print_directory_loop_next
|
||
36:24994+7 253C FE00 CP 0x00 ;reached end
|
||
37:25001+10 253E CAF925 JP Z, _fat_print_directory_loop_break
|
||
38:
|
||
39: ;check file attribute
|
||
40:25011+19 2541 DD7E0B ld a,(IX+0x0B)
|
||
41:25030+7 2544 FE10 cp 0x10 ;if subdirectors
|
||
42:25037+10 2546 CA9A25 jp z, _fat_print_directory_dir ;print dir
|
||
43: ;else print file
|
||
44: - 2549 _fat_print_directory_loop_file
|
||
45: ;print filename
|
||
46:25047+7 2549 3E20 ld a,' '
|
||
47:25054+17 254B CDF600 call print_char
|
||
48:25071+7 254E 3E20 ld a,' '
|
||
49:25078+17 2550 CDF600 call print_char
|
||
50:25095+7 2553 0608 LD B,8
|
||
51:25102+17 2555 CD071A call print_str_fixed
|
||
52:25119+7 2558 3E2E ld A,'.'
|
||
53:25126+17 255A CDF600 call print_char
|
||
54:25143+7 255D 0603 LD B,3
|
||
55:25150+17 255F CD071A call print_str_fixed
|
||
56:
|
||
57:25167+17 2562 CDEC01 call PRINTINLINE
|
||
58: - 2565 20307800 db " 0x",0
|
||
59: ;first cluster number
|
||
60:25184+19 2569 DD7E1B ld a,(ix+0x1B)
|
||
61:25203+17 256C CD2201 call print_a_hex
|
||
62:25220+19 256F DD7E1A ld a,(ix+0x1A)
|
||
63:25239+17 2572 CD2201 call print_a_hex
|
||
64:25256+17 2575 CDEC01 call PRINTINLINE
|
||
65: - 2578 20203078 db " 0x",0
|
||
00
|
||
66:25273+19 257D DD7E1F ld a,(ix+0x1F)
|
||
67:25292+17 2580 CD2201 call print_a_hex
|
||
68:25309+19 2583 DD7E1E ld a,(ix+0x1E)
|
||
69:25328+17 2586 CD2201 call print_a_hex
|
||
70:25345+19 2589 DD7E1D ld a,(ix+0x1D)
|
||
71:25364+17 258C CD2201 call print_a_hex
|
||
72:25381+19 258F DD7E1C ld a,(ix+0x1C)
|
||
73:25400+17 2592 CD2201 call print_a_hex
|
||
74:25417+17 2595 CD0C01 call print_newLine
|
||
75:25434+12 2598 182B jr _fat_print_directory_loop_next
|
||
76: - 259A _fat_print_directory_dir
|
||
77:25446+7 259A 3E44 ld a,'D'
|
||
78:25453+17 259C CDF600 call print_char
|
||
79:25470+7 259F 3E20 ld a,' '
|
||
80:25477+17 25A1 CDF600 call print_char
|
||
81:25494+7 25A4 0608 LD B,8
|
||
82:25501+17 25A6 CD071A call print_str_fixed
|
||
83:25518+17 25A9 CDEC01 call PRINTINLINE
|
||
84: - 25AC 20202020 db " 0x",0
|
||
20307800
|
||
85: ;first cluster number
|
||
86:25535+19 25B4 DD7E1B ld a,(ix+0x1B)
|
||
87:25554+17 25B7 CD2201 call print_a_hex
|
||
88:25571+19 25BA DD7E1A ld a,(ix+0x1A)
|
||
89:25590+17 25BD CD2201 call print_a_hex
|
||
90:25607+17 25C0 CD0C01 call print_newLine
|
||
91:25624+12 25C3 1800 jr _fat_print_directory_loop_next
|
||
92:
|
||
93: - 25C5 _fat_print_directory_loop_next: ; read next entry
|
||
94:25636+4 25C5 0D DEC C ;next sector after 32 entries
|
||
95:25640+7+5 25C6 2808 JR Z,_fat_print_directory_loop_next_sector
|
||
96:25647+10 25C8 E1 POP HL ;restore start
|
||
97:25657+10 25C9 112000 LD DE, 32 ;length of entry
|
||
98:25667+11 25CC 19 ADD HL,DE ;increment
|
||
99:25678+10 25CD C32D25 JP _fat_print_directory_loop
|
||
100:
|
||
101: - 25D0 _fat_print_directory_loop_next_sector: ; end fo sector. read next sector from disk
|
||
102:25688+10 25D0 E1 POP HL ;clear stack from old hl
|
||
103:25698+7 25D1 2600 LD H,0
|
||
104:25705+7 25D3 2E01 LD L,1
|
||
105:25712+17 25D5 CD1C24 call _fat_math_sector_add_16 ;increment sector
|
||
106:
|
||
107:25729+20 25D8 ED5BC045 LD DE,(MEM_FAT_COUNT1) ; decrement sector count (max FAT length)
|
||
108:25749+6 25DC 1B DEC DE
|
||
109:25755+20 25DD ED53C045 LD (MEM_FAT_COUNT1),DE
|
||
110:25775+4 25E1 7A LD A,D
|
||
111:25779+4 25E2 B3 OR E
|
||
112:25783+5+6 25E3 C8 RET Z ; if DE is 0, mmax is reached. End here
|
||
113:
|
||
114:25788+10 25E4 21D542 LD HL,MEM_IDE_POINTER ;read next sector
|
||
115:25798+7 25E7 0601 LD B,1
|
||
116:25805+7 25E9 3E01 ld a,1
|
||
117:25812+10 25EB 11BA43 LD DE, MEM_IDE_BUFFER ;where to store data?
|
||
118:25822+17 25EE CD7F15 call read_lba_sector
|
||
119:
|
||
120:25839+10 25F1 21BA43 LD HL, MEM_IDE_BUFFER ;set buffer start
|
||
121:25849+7 25F4 0E10 LD C,16 ;set entries counter
|
||
122:25856+10 25F6 C32D25 JP _fat_print_directory_loop
|
||
123:
|
||
124: - 25F9 _fat_print_directory_loop_break
|
||
125:25866+10 25F9 E1 POP HL
|
||
126:25876+10 25FA C9 ret
|
||
127:
|
||
128: ;-------------------------------------
|
||
129: ; Changes current fat directory of MEM_FAT_CURRDIR
|
||
130: ; input is relativ path
|
||
131: ; DE points to path
|
||
132: ;-------------------------------------
|
||
133: - 25FB fat_cd_single:
|
||
134:25886+11 25FB D5 push de
|
||
135: ; check if user wants to go back (input = '..')
|
||
136:25897+7 25FC 1A ld a,(de)
|
||
137:25904+7 25FD FE2E cp '.'
|
||
138:25911+7+5 25FF 205E jr nz, _fat_cd_navigate; if not, skip
|
||
139:25918+6 2601 13 inc de ;check next
|
||
140:25924+7 2602 1A ld a,(de)
|
||
141:25931+7 2603 FE2E cp '.'
|
||
142:25938+7+5 2605 2058 jr nz, _fat_cd_navigate; if not, skip
|
||
143:25945+13 2607 3A7E42 ld a,(var_dir+79) ;last byte contains depth
|
||
144:25958+4 260A B7 or a; Test if 0
|
||
145:25962+10 260B CAB726 jp z, _fat_cd_navigate_error ;cannot go back any more (already at root)
|
||
146: ; check if .. exists in directory
|
||
147:25972+7 260E 3E2E ld a,'.' ;prepare filename buffer
|
||
148:25979+10 2610 21D345 ld hl,[MEM_FAT_TMPFNAME]
|
||
149:25989+7 2613 77 ld (hl),a
|
||
150:25996+6 2614 23 inc hl
|
||
151:26002+7 2615 77 ld (hl),a
|
||
152:26009+6 2616 23 inc hl
|
||
153:26015+7 2617 3E20 ld a,0x20 ;clear char 3-11
|
||
154:26022+7 2619 060B ld b,11
|
||
155: - 261B _fat_cd_navigate_goback_fl:
|
||
156:26029+7 261B 77 ld (hl),a
|
||
157:26036+6 261C 23 inc hl
|
||
158:26042+8+5 261D 10FC djnz _fat_cd_navigate_goback_fl ;fill loop end
|
||
159:26050+17 261F CD7F23 call fat_openfile_noprepare ;load file table (only 1st sector needed)
|
||
160:26067+4 2622 B7 or a ;check for error
|
||
161:26071+10 2623 C2B726 jp nz, _fat_cd_navigate_error ;entry not found exception
|
||
162:
|
||
163:
|
||
164: ; find end of path
|
||
165:26081+10 2626 213242 ld hl,[var_dir+3] ;current position
|
||
166:26091+10 2629 014C00 ld bc,76
|
||
167:26101+7 262C 3E00 ld a,0x00 ;termination char
|
||
168:26108+16+5 262E EDB1 cpir ;find end
|
||
169:26124+10 2630 E2C526 jp po,_fat_cd_navigate_inerror ;in case of error, abort
|
||
170: ;hl is now at end of string
|
||
171:26134+10 2633 014C00 ld bc,76
|
||
172:26144+7 2636 3E5C ld a,'\' ;seperation char
|
||
173:26151+16+5 2638 EDB9 cpdr ;serach backwards for "/"
|
||
174:26167+10 263A E2C526 jp po,_fat_cd_navigate_inerror ;in case of error, abort
|
||
175: ;hl is now at end of string
|
||
176:26177+6 263D 23 inc hl
|
||
177:26183+4 263E AF xor a
|
||
178:26187+7 263F 77 ld (hl),a ;set termination char
|
||
179:26194+6 2640 23 inc hl
|
||
180:26200+7 2641 77 ld (hl),a ;set termination char
|
||
181:26207+13 2642 3A7E42 ld a,(var_dir+79)
|
||
182:26220+4 2645 3D dec a
|
||
183:26224+13 2646 327E42 ld (var_dir+79),a ;decrement dir depth counter
|
||
184:
|
||
185:26237+10 2649 D1 pop de
|
||
186:
|
||
187:26247+10 264A 213142 ld hl,[var_dir+2]
|
||
188:26257+7 264D 3E5C ld a,'\'
|
||
189:26264+7 264F 77 ld (hl),a ;set first /
|
||
190:
|
||
191:26271+10 2650 213B46 ld hl,MEM_FAT_OF0_DATSEC ;setup directory pointer
|
||
192:26281+10 2653 114346 ld de,MEM_FAT_CURRDIR
|
||
193:26291+16 2656 EDA0 ldi
|
||
194:26307+16 2658 EDA0 ldi
|
||
195:26323+16 265A EDA0 ldi
|
||
196:26339+16 265C EDA0 ldi
|
||
197:
|
||
198:26355+10 265E C9 ret
|
||
199:
|
||
200: - 265F _fat_cd_navigate
|
||
201:26365+10 265F D1 pop de ;get pointer to directory namme
|
||
202:26375+11 2660 D5 push de ;and re-store it for next use
|
||
203:26386+17 2661 CD7723 call fat_openfile ;find 'file' in current directory
|
||
204: - 2664 _fat_cd_navigate_findsec
|
||
205:26403+4 2664 B7 or a
|
||
206:26407+10 2665 C2B726 jp nz, _fat_cd_navigate_error ;entry not found
|
||
207:26417+13 2668 3A3346 ld a, (MEM_FAT_OF0_ATTRIBUTE)
|
||
208:26430+7 266B FE10 cp 0x10
|
||
209:26437+10 266D C2CD26 jp nz, _fat_cd_navigate_errfile
|
||
210:26447+13 2670 3A7E42 ld a,(var_dir+79)
|
||
211:26460+4 2673 3C inc a
|
||
212:26464+13 2674 327E42 ld (var_dir+79),a ;increment dir depth counter
|
||
213:26477+10 2677 213142 ld hl,[var_dir+2] ;load start of path string
|
||
214:26487+7 267A 3E00 ld a,0 ;load termination char
|
||
215:26494+10 267C 014C00 ld bc,76 ;max length of string
|
||
216:26504+16+5 267F EDB1 cpir ;find end of path string
|
||
217:26520+6 2681 2B dec hl
|
||
218:26526+10 2682 E2C526 jp po,_fat_cd_navigate_inerror ;in case of error, abort
|
||
219: ;HL now has last element, BC has remaining max length
|
||
220:26536+13 2685 3A7E42 ld a,(var_dir+79) ;last byte contains depth
|
||
221:26549+7 2688 FE01 cp 1 ;if first path, skip /
|
||
222:26556+7+5 268A 2804 jr z, _fat_cd_navigate_findsec_skipslash
|
||
223:26563+7 268C 3E5C ld a,'\'
|
||
224:26570+7 268E 77 ld (hl),a
|
||
225:26577+6 268F 23 inc hl
|
||
226: - 2690 _fat_cd_navigate_findsec_skipslash
|
||
227:26583+10 2690 D1 pop de ;get argument from stack
|
||
228:26593+4 2691 EB ex de,hl
|
||
229:26597+11 2692 D5 push de ;store start to stack
|
||
230: ;HL now has start of input string, DE has end of current path
|
||
231:26608+10 2693 010900 ld bc,09 ;maximum length of directory name +1
|
||
232: - 2696 _fat_cd_navigate_l2: ;copy new subdirectory
|
||
233:26618+16 2696 EDA0 ldi ;copy
|
||
234:26634+10 2698 E2BF26 jp po,_fat_cd_navigate_inerrorS ;in case of error, abort
|
||
235:26644+7 269B 7E ld a,(hl) ;check next char
|
||
236:26651+7 269C FE5C cp '\' ;end at '\'
|
||
237:26658+7+5 269E 2805 jr z, _fat_cd_navigate_end ;else next byte
|
||
238:26665+4 26A0 B7 or a ;or and at 0x00
|
||
239:26669+7+5 26A1 2802 jr z, _fat_cd_navigate_end ;else next byte
|
||
240:26676+12 26A3 18F1 jr _fat_cd_navigate_l2
|
||
241: - 26A5 _fat_cd_navigate_end:
|
||
242:26688+4 26A5 AF xor a
|
||
243:26692+7 26A6 12 ld (de),a ;set last byte to 0x00 (termination)
|
||
244:26699+10 26A7 213B46 ld hl,MEM_FAT_OF0_DATSEC
|
||
245: ;setup directory pointer
|
||
246:26709+10 26AA 114346 ld de,MEM_FAT_CURRDIR
|
||
247:26719+16 26AD EDA0 ldi
|
||
248:26735+16 26AF EDA0 ldi
|
||
249:26751+16 26B1 EDA0 ldi
|
||
250:26767+16 26B3 EDA0 ldi
|
||
251:26783+10 26B5 D1 pop de ;stack cleanup
|
||
252:26793+10 26B6 C9 ret
|
||
253:
|
||
254: - 26B7 _fat_cd_navigate_error:
|
||
255:26803+10 26B7 21D526 ld hl,[_fat_cd_navigate_error_str]
|
||
256:26813+17 26BA CDFC00 call print_str
|
||
257:26830+10 26BD D1 pop de
|
||
258:26840+10 26BE C9 ret
|
||
259:
|
||
260: - 26BF _fat_cd_navigate_inerrorS: ;with path reset
|
||
261:26850+10 26BF D1 pop de ;restore former path
|
||
262:26860+6 26C0 1B dec de ;change pointer to remove previous '\' as well
|
||
263:26866+4 26C1 AF xor a ;clear a to 0x00
|
||
264:26870+7 26C2 12 ld (de),a ;set last byte to 0x00 (termination)
|
||
265:26877+12 26C3 1801 jr _fat_cd_navigate_inerrore
|
||
266: - 26C5 _fat_cd_navigate_inerror: ;without path reset
|
||
267:26889+10 26C5 D1 pop de
|
||
268: - 26C6 _fat_cd_navigate_inerrore:
|
||
269:26899+10 26C6 21EC26 ld hl,[_fat_cd_navigate_inputerr_str]
|
||
270:26909+17 26C9 CDFC00 call print_str
|
||
271:26926+10 26CC C9 ret
|
||
272: - 26CD _fat_cd_navigate_errfile:
|
||
273:26936+10 26CD D1 pop de
|
||
274:26946+10 26CE 21FF26 ld hl,[_fat_cd_navigate_errfile_str]
|
||
275:26956+17 26D1 CDFC00 call print_str
|
||
276:26973+10 26D4 C9 ret
|
||
277:
|
||
278: - 26D5 _fat_cd_navigate_error_str:
|
||
279: - 26D5 0A0D4E6F db 10,13,"No such directory!",10,13,0
|
||
20737563
|
||
68206469
|
||
72656374
|
||
6F727921
|
||
0A0D00
|
||
280: - 26EC _fat_cd_navigate_inputerr_str:
|
||
281: - 26EC 0A0D496E db 10,13,"Invalid input!",10,13,0
|
||
76616C69
|
||
6420696E
|
||
70757421
|
||
0A0D00
|
||
282: - 26FF _fat_cd_navigate_errfile_str:
|
||
283: - 26FF 0A0D4361 db 10,13,"Cannot cd to file!",10,13,0
|
||
6E6E6F74
|
||
20636420
|
||
746F2066
|
||
696C6521
|
||
0A0D00
|
||
284:
|
||
285: - 2716 fat_exec:
|
||
286:26983+11 2716 D5 push de
|
||
287: ;DE has pointer to arguments
|
||
288:26994+17 2717 CD7723 call fat_openfile
|
||
289:27011+4 271A B7 or a
|
||
290:27015+10 271B C2AC27 jp nz, _fat_exec_notfound ;if not found, abort
|
||
291: ;call fat_print_dbg
|
||
292: ;load header
|
||
293:27025+10 271E 11BA43 ld de, MEM_IDE_BUFFER
|
||
294:27035+17 2721 CD4A23 call fat_readfilesec
|
||
295:
|
||
296:
|
||
297: ;ld hl, MEM_IDE_BUFFER ;print sector
|
||
298: ;ld b,0x20
|
||
299: ;call dump_pretty
|
||
300:
|
||
301:27052+13 2724 3ABA43 ld a,(MEM_IDE_BUFFER)
|
||
302:27065+7 2727 FEC3 cp 0xC3
|
||
303:27072+10 2729 C2C527 jp nz, _fat_exec_notexec
|
||
304:
|
||
305:27082+17 272C CDEC01 call PRINTINLINE
|
||
306: - 272F 0A0D4C6F db 10,13,"Loading ",0
|
||
6164696E
|
||
672000
|
||
307:27099+10 273A E1 pop hl ;get and re-store pointer ot filename from and to stack
|
||
308:27109+11 273B E5 push hl
|
||
309:27120+17 273C CDFC00 call print_str
|
||
310:27137+17 273F CDEC01 call PRINTINLINE
|
||
311: - 2742 20746F20 db " to 0x",0
|
||
307800
|
||
312: ;get start address
|
||
313:27154+20 2749 ED4BC443 ld bc,(MEM_IDE_BUFFER + 10)
|
||
314:27174+4 274D 78 ld a,b
|
||
315:27178+17 274E CD2201 call print_a_hex
|
||
316:27195+4 2751 79 ld a,c
|
||
317:27199+17 2752 CD2201 call print_a_hex
|
||
318:27216+17 2755 CDEC01 call PRINTINLINE
|
||
319: - 2758 202E2E2E db " ... ",0
|
||
2000
|
||
320: ;bc has start addr
|
||
321:27233+20 275E ED434746 ld (MEM_FAT_EXEC_CURR),bc
|
||
322:27253+20 2762 ED434B46 ld (MEM_FAT_EXEC_START),bc
|
||
323:
|
||
324: ;get amount of sectors to load
|
||
325:27273+16 2766 2AC843 ld hl,(MEM_IDE_BUFFER + 14)
|
||
326:27289+4 2769 6C ld l,h
|
||
327:27293+8 276A CB3D srl l
|
||
328:27301+7 276C 2600 ld h,0 ;divide by 512
|
||
329:27308+6 276E 23 inc hl ;increment because first sector is always loaded
|
||
330: ; hl contains sector count
|
||
331:27314+16 276F 224946 ld (MEM_FAT_EXEC_COUNT), hl
|
||
332:
|
||
333:27330+10 2772 D1 pop de ; restore filename
|
||
334:27340+17 2773 CD7723 call fat_openfile ;reset file information
|
||
335: ;start reading
|
||
336: - 2776 _fat_exec_readloop1:
|
||
337:27357+20 2776 ED5B4746 ld de,(MEM_FAT_EXEC_CURR)
|
||
338:27377+17 277A CD4A23 call fat_readfilesec
|
||
339:27394+16 277D 2A4746 ld hl,(MEM_FAT_EXEC_CURR)
|
||
340:27410+10 2780 110002 ld de,512
|
||
341:27420+11 2783 19 add hl,de
|
||
342:27431+16 2784 224746 ld (MEM_FAT_EXEC_CURR),hl
|
||
343:
|
||
344:27447+16 2787 2A4946 ld hl,(MEM_FAT_EXEC_COUNT)
|
||
345:27463+6 278A 2B dec hl
|
||
346:27469+16 278B 224946 ld (MEM_FAT_EXEC_COUNT),hl
|
||
347:27485+4 278E 7C ld a,h
|
||
348:27489+4 278F B5 or l
|
||
349:27493+7+5 2790 2802 jr z, _fat_exec_read_done
|
||
350:27500+12 2792 18E2 jr _fat_exec_readloop1
|
||
351: - 2794 _fat_exec_read_done:
|
||
352:27512+17 2794 CDEC01 call PRINTINLINE
|
||
353: - 2797 4C6F6164 db "Load complete!",10,13,0
|
||
20636F6D
|
||
706C6574
|
||
65210A0D
|
||
00
|
||
354:27529+16 27A8 2A4B46 ld hl,(MEM_FAT_EXEC_START)
|
||
355:27545+4 27AB E9 jp (hl)
|
||
356:
|
||
357:
|
||
358: - 27AC _fat_exec_notfound:
|
||
359:27549+10 27AC D1 pop de
|
||
360:27559+17 27AD CDEC01 call PRINTINLINE
|
||
361: - 27B0 0A0D4669 db 10,13,"File not found!",10,13,0
|
||
6C65206E
|
||
6F742066
|
||
6F756E64
|
||
210A0D00
|
||
362:27576+10 27C4 C9 ret
|
||
363:
|
||
364: - 27C5 _fat_exec_notexec:
|
||
365:27586+10 27C5 D1 pop de
|
||
366:27596+17 27C6 CDEC01 call PRINTINLINE
|
||
367: - 27C9 0A0D4669 db 10,13,"File is not an executable!",10,13,0
|
||
6C652069
|
||
73206E6F
|
||
7420616E
|
||
20657865
|
||
63757461
|
||
626C6521
|
||
0A0D00
|
||
**** main.asm ****
|
||
235:27613+10 27E8 C9 ret
|
||
236:
|
||
237: ;================================================================
|
||
238: ; Strings
|
||
239: ;================================================================
|
||
240: - 27E9 STR_Banner_Start:
|
||
241: - 27E9 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
|
||
611 symbols
|
||
11682 bytes
|
||
|
||
2 macro calls
|
||
244 macro bytes
|
||
8 invented symbols
|
||
|
||
|
||
|
||
Symbol Table:
|
||
|
||
?a0000 14C3 5315
|
||
?a0001 1580 5504
|
||
ADDR_RTC =D0 208
|
||
A_RTS_OFF 1DA 474
|
||
A_RTS_ON 1E3 483
|
||
BOOT_PHASE0 86 134
|
||
BOOT_PHASE1 B7 183
|
||
BOOT_PHASE1_LOOP C0 192
|
||
BOOT_PHASE2 CB 203
|
||
B_BEEP 50 80
|
||
B_DSKSEL 74 116
|
||
B_FATCD 7D 125
|
||
B_FATCREATE 80 128
|
||
B_FATOPEN 77 119
|
||
B_FATREAD 7A 122
|
||
B_FATWRITE 83 131
|
||
B_IICRECV 56 86
|
||
B_IICSEND 53 83
|
||
B_KEYREAD 6B 107
|
||
B_KEYREADASCII 6E 110
|
||
B_KEYSEND 71 113
|
||
B_PRINTAHEX 62 98
|
||
B_PRINTCHAR 59 89
|
||
B_PRINTINLINE 5F 95
|
||
B_PRINTLN 65 101
|
||
B_PRINTSTR 5C 92
|
||
B_READCHAR 68 104
|
||
COMMAND 1AA4 6820
|
||
COMMAND_ABORT 1AA1 6817
|
||
COMMAND_BACKSPACE 1AE5 6885
|
||
COMMAND_LUT 1A0F 6671
|
||
COMMAND_PROCESS 1B0B 6923
|
||
COMMAND_PROCESS_FOUND 1B46 6982
|
||
COMMAND_PROCESS_LOOP 1B0E 6926
|
||
COMMAND_PROCESS_LOOP_STR1 1B17 6935
|
||
COMMAND_PROCESS_LOOP_STR2 1B2D 6957
|
||
COMMAND_PROCESS_NEXT_ENTRY 1B32 6962
|
||
COMMAND_PROCESS_NEXT_ENTRYI 1B31 6961
|
||
COMMAND_PROCESS_NOT_FOUND 1B3D 6973
|
||
COMMAND_READ 1AB6 6838
|
||
CONSOLE_INIT EF 239
|
||
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 251 593
|
||
DHEX_TO_BYTE_FAILED 26D 621
|
||
ERR_SYNTAX 1B5C 7004
|
||
EXEC_RST_08 DF1 3569
|
||
EXEC_RST_10 DF5 3573
|
||
EXEC_RST_18 E01 3585
|
||
HEX_TO_BIN 271 625
|
||
HEX_TO_BIN_2 27F 639
|
||
HEX_TO_INVALID_2 286 646
|
||
IDE_CMD_IDENT =EC 236
|
||
IDE_CMD_READSEC=20 32
|
||
IDE_CMD_WRITESEC=30 48
|
||
IDE_DEV_TABLE 1325 4901
|
||
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_PIO_ADDRC =F6 246
|
||
INT_PIO_ADDRD =F4 244
|
||
INT_VEC 1B 27
|
||
INT_VEC_TABLE =4000 16384
|
||
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_FAT_AMOUNT 45BC 17852
|
||
MEM_FAT_CLUSTERLEN 45BF 17855
|
||
MEM_FAT_COUNT1 45C0 17856
|
||
MEM_FAT_CURDIR 45E3 17891
|
||
MEM_FAT_CURRDIR 4643 17987
|
||
MEM_FAT_DATASTART 45C5 17861
|
||
MEM_FAT_DIRSEC 45D1 17873
|
||
MEM_FAT_EXEC_COUNT 4649 17993
|
||
MEM_FAT_EXEC_CURR 4647 17991
|
||
MEM_FAT_EXEC_START 464B 17995
|
||
MEM_FAT_FILEREMAIN 45CD 17869
|
||
MEM_FAT_OF0_ATTRIBUTE 4633 17971
|
||
MEM_FAT_OF0_CCLUST 4635 17973
|
||
MEM_FAT_OF0_DATREM 463F 17983
|
||
MEM_FAT_OF0_DATSEC 463B 17979
|
||
MEM_FAT_OF0_FATSEC 4637 17975
|
||
MEM_FAT_RESERVED 45BA 17850
|
||
MEM_FAT_ROOTSTART 45C9 17865
|
||
MEM_FAT_SECTORS 45BD 17853
|
||
MEM_FAT_TMPFNAME 45D3 17875
|
||
MEM_FAT_TMPPOINTER 45C1 17857
|
||
MEM_IDE_BUFFER 43BA 17338
|
||
MEM_IDE_DEVICE 42CF 17103
|
||
MEM_IDE_DEV_TABLE 42D9 17113
|
||
MEM_IDE_FSBUFFER 45BA 17850
|
||
MEM_IDE_PARTITION 42D1 17105
|
||
MEM_IDE_POINTER 42D5 17109
|
||
MEM_IDE_SELECTED 4319 17177
|
||
MEM_IDE_STATUS 42D0 17104
|
||
MEM_IDE_STRING_0 431A 17178
|
||
MEM_IDE_STRING_1 4342 17218
|
||
MEM_IDE_STRING_2 436A 17258
|
||
MEM_IDE_STRING_3 4392 17298
|
||
MSG_CLEAR 1D2 466
|
||
NOT_IMPLEMENTED 1B55 6997
|
||
OP_CALL 1BB7 7095
|
||
OP_CD 1F87 8071
|
||
OP_CLR 1D4B 7499
|
||
OP_DASM 1C38 7224
|
||
OP_DIR 1F83 8067
|
||
OP_DUMP 1BD7 7127
|
||
OP_EXEC 1B9E 7070
|
||
OP_FSEXEC 1FA4 8100
|
||
OP_IIC_IN 1CFF 7423
|
||
OP_IIC_OUT 1C9F 7327
|
||
OP_IO_IN 1C68 7272
|
||
OP_IO_OUT 1C7E 7294
|
||
OP_LSDSK 1F60 8032
|
||
OP_RTIME 1D4F 7503
|
||
OP_SELDSK 1F64 8036
|
||
OP_SET 1C07 7175
|
||
OP_STIME 1EE7 7911
|
||
POST_CHECK_APU 1FDD 8157
|
||
POST_CHECK_IDE_30 2008 8200
|
||
POST_CHECK_IDE_40 201B 8219
|
||
POST_CHECK_PIO 1FB8 8120
|
||
POST_START 1FA8 8104
|
||
POST_TEST_RTC 2035 8245
|
||
PRG_RAM_START =4110 16656
|
||
PRG_RAM_TOP =FF00 65280
|
||
PRINTINLINE 1EC 492
|
||
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 288 648
|
||
STRCONV_BYTES_TO_HEX_1 297 663
|
||
STRCONV_BYTES_TO_HEX_2 2A1 673
|
||
STR_Banner_Start 27E9 10217
|
||
STR_PD_HEADER 19C8 6600
|
||
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 1B54 6996
|
||
_OP_CALL 1BD6 7126
|
||
_OP_IIC_ACK_ERR 1CE4 7396
|
||
_OP_IIC_ACK_ERR_str 1CEB 7403
|
||
_OP_IIC_IN_LOOP 1D31 7473
|
||
_OP_IIC_IN_LOOP_TEXT 1D3E 7486
|
||
_OP_IIC_OUT_LOOP 1CB5 7349
|
||
_OP_IIC_OUT_SEND 1CD1 7377
|
||
_OP_RTIME_NN 1D52 7506
|
||
_OP_RTIME_RD_CMD 1E0A 7690
|
||
_OP_SELDSK_INVALID 1F73 8051
|
||
_OP_SELDSK_INVALID_STR 1F8B 8075
|
||
_OP_SET_LOOP 1C1F 7199
|
||
_OP_STIME_INVALID 1EAD 7853
|
||
_OP_STIME_PROMPT 1EC4 7876
|
||
_OP_STIME_PROMPT_ERR 1EDC 7900
|
||
_OP_STIME_STR_DAY 1E0B 7691
|
||
_OP_STIME_STR_HOUR 1E5C 7772
|
||
_OP_STIME_STR_MIN 1E77 7799
|
||
_OP_STIME_STR_MON 1E26 7718
|
||
_OP_STIME_STR_SEC 1E92 7826
|
||
_OP_STIME_STR_YEAR 1E41 7745
|
||
_POST_CHECK_APU_FAILED 1FFC 8188
|
||
_POST_CHECK_IDE_FAILED 202E 8238
|
||
_POST_CHECK_PIO_FAILED 1FD1 8145
|
||
_POST_TEST_RTC_INVALID 206F 8303
|
||
_POST_TEST_RTC_NOTFOUND 2068 8296
|
||
_STR_NOT_FOUND 1B77 7031
|
||
_STR_NOT_IMPLEMENTED 1B63 7011
|
||
_STR_SYNTAX 1B8B 7051
|
||
_beep_pause_l1 E1F 3615
|
||
_compare_filename_loop 24AA 9386
|
||
_compare_filename_nomatch 24B8 9400
|
||
_fat_cd_navigate 265F 9823
|
||
_fat_cd_navigate_end 26A5 9893
|
||
_fat_cd_navigate_errfile 26CD 9933
|
||
_fat_cd_navigate_errfile_str 26FF 9983
|
||
_fat_cd_navigate_error 26B7 9911
|
||
_fat_cd_navigate_error_str 26D5 9941
|
||
_fat_cd_navigate_findsec 2664 9828
|
||
_fat_cd_navigate_findsec_skipslash 2690 9872
|
||
_fat_cd_navigate_goback_fl 261B 9755
|
||
_fat_cd_navigate_inerror 26C5 9925
|
||
_fat_cd_navigate_inerrorS 26BF 9919
|
||
_fat_cd_navigate_inerrore 26C6 9926
|
||
_fat_cd_navigate_inputerr_str 26EC 9964
|
||
_fat_cd_navigate_l2 2696 9878
|
||
_fat_exec_notexec 27C5 10181
|
||
_fat_exec_notfound 27AC 10156
|
||
_fat_exec_read_done 2794 10132
|
||
_fat_exec_readloop1 2776 10102
|
||
_fat_get_root_table_invalid 229A 8858
|
||
_fat_getfatsec_notroot 22D9 8921
|
||
_fat_increment_32 2430 9264
|
||
_fat_lfs_loop 23A6 9126
|
||
_fat_lfs_loop_compare_end 23E2 9186
|
||
_fat_lfs_loop_compare_match 23E6 9190
|
||
_fat_lfs_loop_compare_next_sector 23B8 9144
|
||
_fat_math_add32 2444 9284
|
||
_fat_math_mul32 2475 9333
|
||
_fat_math_mul32_l 247C 9340
|
||
_fat_math_mul32_noadd 2489 9353
|
||
_fat_math_sector_add_16 241C 9244
|
||
_fat_print_directory_dir 259A 9626
|
||
_fat_print_directory_loop 252D 9517
|
||
_fat_print_directory_loop_break 25F9 9721
|
||
_fat_print_directory_loop_file 2549 9545
|
||
_fat_print_directory_loop_next 25C5 9669
|
||
_fat_print_directory_loop_next_sector 25D0 9680
|
||
_format_filename_fat16_clean 24C1 9409
|
||
_format_filename_fat16_loop 24C8 9416
|
||
_format_filename_fat16_loop_copy 24DB 9435
|
||
_format_filename_fat16_loop_skip_8 24D2 9426
|
||
_ide_readsector_512_floop E7B 3707
|
||
_ideif_drv_sel_fail 15F0 5616
|
||
_ideif_drv_sel_fstr0 16AD 5805
|
||
_ideif_drv_sel_pstr 16A4 5796
|
||
_ideif_drv_sel_sstr0 16BB 5819
|
||
_ideif_drv_sel_syn 16C8 5832
|
||
_ideif_init_drive_charloop 14B7 5303
|
||
_ideif_init_drive_found 1499 5273
|
||
_ideif_init_drive_loop 1481 5249
|
||
_ideif_init_drive_nodrv 1494 5268
|
||
_ideif_init_drive_prt_fnd 1515 5397
|
||
_ideif_init_drive_prt_l1 1503 5379
|
||
_ideif_init_drive_prt_ln 150D 5389
|
||
_ideif_prnt_devtable_hdr 1630 5680
|
||
_ideif_prnt_devtable_l1 1391 5009
|
||
_ideif_prnt_devtable_l1_e2 1457 5207
|
||
_ideif_prnt_devtable_l1_es 13D6 5078
|
||
_ideif_prnt_devtable_l1_ms 1454 5204
|
||
_ideif_prnt_devtable_l1_nxt 139E 5022
|
||
_ideif_prnt_devtable_l1_s00 13C4 5060
|
||
_ideif_prnt_devtable_l1_s01 13C9 5065
|
||
_ideif_prnt_devtable_l1_s02 13CE 5070
|
||
_ideif_prnt_devtable_l1_sFF 13D3 5075
|
||
_ideif_prnt_devtable_l1_sel 139C 5020
|
||
_ideif_prnt_devtable_master 1694 5780
|
||
_ideif_prnt_devtable_s00 1668 5736
|
||
_ideif_prnt_devtable_s01 1673 5747
|
||
_ideif_prnt_devtable_s02 167E 5758
|
||
_ideif_prnt_devtable_sFF 1689 5769
|
||
_ideif_prnt_devtable_slave 169C 5788
|
||
_int_invalid_int 185A 6234
|
||
_intctrl_init_fill_loop 183B 6203
|
||
_isr_pio 184E 6222
|
||
_read_bcd_invalid 165 357
|
||
_shift4 1F5B 8027
|
||
_str_invalid_interrupt 1864 6244
|
||
_str_pio_interrupt 189B 6299
|
||
beep E04 3588
|
||
beep_loop E07 3591
|
||
beep_pause E1E 3614
|
||
compare_filename 24A6 9382
|
||
con_rb_init 18E 398
|
||
con_rb_read 199 409
|
||
con_rb_read_empty 1B6 438
|
||
con_rb_write 1BF 447
|
||
consio_init_a 18CE 6350
|
||
consio_init_a_int 1906 6406
|
||
consio_init_a_sio 18D5 6357
|
||
consio_init_ctc_a 191D 6429
|
||
consio_isr 1960 6496
|
||
consio_rx_a 1933 6451
|
||
consio_rx_a_sts 1956 6486
|
||
consio_rx_rts_a_off 194D 6477
|
||
consio_rx_rts_a_on 1944 6468
|
||
consio_tx_a 1926 6438
|
||
consio_tx_a_waitout 1928 6440
|
||
dasm_00 A09 2569
|
||
dasm_01 CF5 3317
|
||
dasm_02 A8F 2703
|
||
dasm_03 CC7 3271
|
||
dasm_08 B0C 2828
|
||
dasm_09 C9A 3226
|
||
dasm_0A A71 2673
|
||
dasm_0B CDE 3294
|
||
dasm_10 A51 2641
|
||
dasm_12 A9A 2714
|
||
dasm_18 A14 2580
|
||
dasm_1A A7B 2683
|
||
dasm_20 A2E 2606
|
||
dasm_22 D3B 3387
|
||
dasm_27 AD4 2772
|
||
dasm_28 A27 2599
|
||
dasm_2A D0C 3340
|
||
dasm_2F AD8 2776
|
||
dasm_30 A1F 2591
|
||
dasm_32 AA5 2725
|
||
dasm_37 AE4 2788
|
||
dasm_38 A18 2584
|
||
dasm_3A A85 2693
|
||
dasm_3F AE0 2784
|
||
dasm_76 AE8 2792
|
||
dasm_80C6 B65 2917
|
||
dasm_BE B02 2818
|
||
dasm_C3 A0D 2573
|
||
dasm_C88E B8B 2955
|
||
dasm_C9 A5D 2653
|
||
dasm_CD A57 2647
|
||
dasm_D9 B19 2841
|
||
dasm_DD A3F 2623
|
||
dasm_DD_01 CFC 3324
|
||
dasm_DD_09 CB5 3253
|
||
dasm_DD_22 D51 3409
|
||
dasm_DD_23 CCC 3276
|
||
dasm_DD_2A D23 3363
|
||
dasm_DD_2B CE3 3299
|
||
dasm_DD_34 C65 3173
|
||
dasm_DD_35 C82 3202
|
||
dasm_DD_86 B6D 2925
|
||
dasm_DD_8E B93 2963
|
||
dasm_DD_96 BB6 2998
|
||
dasm_DD_9E BD6 3030
|
||
dasm_DD_A6 BF7 3063
|
||
dasm_DD_AE C2E 3118
|
||
dasm_DD_B6 C13 3091
|
||
dasm_DD_BE C4A 3146
|
||
dasm_DD_E1 DA3 3491
|
||
dasm_DD_E3 B29 2857
|
||
dasm_DD_E5 D8D 3469
|
||
dasm_DD_F9 D73 3443
|
||
dasm_E1 D9D 3485
|
||
dasm_E3 B1D 2845
|
||
dasm_E5 D87 3463
|
||
dasm_E9 A36 2614
|
||
dasm_ED_42 CAC 3244
|
||
dasm_ED_43 D47 3399
|
||
dasm_ED_44 ADC 2780
|
||
dasm_ED_45 A67 2663
|
||
dasm_ED_46 AF3 2803
|
||
dasm_ED_4A CA3 3235
|
||
dasm_ED_4B D18 3352
|
||
dasm_ED_4D A62 2658
|
||
dasm_ED_56 AF8 2808
|
||
dasm_ED_5E AFD 2813
|
||
dasm_ED_A0 B41 2881
|
||
dasm_ED_A1 B53 2899
|
||
dasm_ED_A8 B4A 2890
|
||
dasm_ED_A9 B5C 2908
|
||
dasm_ED_B0 B45 2885
|
||
dasm_ED_B1 B57 2903
|
||
dasm_ED_B8 B4E 2894
|
||
dasm_ED_B9 B60 2912
|
||
dasm_F3 AED 2797
|
||
dasm_F9 D69 3433
|
||
dasm_FB AF0 2800
|
||
dasm_FD A48 2632
|
||
dasm_FD_01 D04 3332
|
||
dasm_FD_09 CBE 3262
|
||
dasm_FD_22 D5D 3421
|
||
dasm_FD_23 CD5 3285
|
||
dasm_FD_2A D2F 3375
|
||
dasm_FD_2B CEC 3308
|
||
dasm_FD_34 C71 3185
|
||
dasm_FD_35 C8E 3214
|
||
dasm_FD_86 B7C 2940
|
||
dasm_FD_8E BA2 2978
|
||
dasm_FD_96 BC2 3010
|
||
dasm_FD_9E BE4 3044
|
||
dasm_FD_A6 C03 3075
|
||
dasm_FD_AE C3A 3130
|
||
dasm_FD_B6 C1E 3102
|
||
dasm_FD_BE C55 3157
|
||
dasm_FD_E1 DAB 3499
|
||
dasm_FD_E3 B35 2869
|
||
dasm_FD_E5 D95 3477
|
||
dasm_FD_F9 D7D 3453
|
||
dasm_FF A6C 2668
|
||
dasm_UU DB3 3507
|
||
dasm_UW DB7 3511
|
||
dasm__AND BF2 3058
|
||
dasm__CP C46 3142
|
||
dasm__DEC C7D 3197
|
||
dasm__ED_47 AC4 2756
|
||
dasm__ED_4F ACC 2764
|
||
dasm__ED_57 AB4 2740
|
||
dasm__ED_5F ABC 2748
|
||
dasm__INC C60 3168
|
||
dasm__LD AB0 2736
|
||
dasm__OR C0F 3087
|
||
dasm__SBC BCE 3022
|
||
dasm__SUB BB1 2993
|
||
dasm__XOR C29 3113
|
||
dasm_opcode_table 5B1 1457
|
||
dasm_print16hex_addr 3DE 990
|
||
dasm_print8hex 3F6 1014
|
||
dasm_printFlags_table DBC 3516
|
||
dasm_printRegister8_table DCC 3532
|
||
dasm_printRegister8_table_HL DEC 3564
|
||
dasm_printRegisterIX_table DD4 3540
|
||
dasm_printRegisterIY_table DDC 3548
|
||
dasm_printRegisterSP_table DE4 3556
|
||
disassemble 2A2 674
|
||
disassemble_continue 388 904
|
||
disassemble_err 378 888
|
||
disassemble_next 2A6 678
|
||
disassemble_print_opcode_params_end 375 885
|
||
disassemble_print_opcode_params_loop 321 801
|
||
disassemble_print_opcode_raw 2E3 739
|
||
disassemble_print_opcode_raw_fill 2F7 759
|
||
disassemble_table_first_match 3BA 954
|
||
disassemble_table_found 3D4 980
|
||
disassemble_table_notfound 3D8 984
|
||
disassemble_table_seek 396 918
|
||
disassemble_table_seek_loop 39A 922
|
||
dump_pretty 196D 6509
|
||
dump_pretty_ascii 1997 6551
|
||
dump_pretty_ascii_cont 19B5 6581
|
||
dump_pretty_ascii_loop 199F 6559
|
||
dump_pretty_ascii_none 19B0 6576
|
||
dump_pretty_col 198A 6538
|
||
dump_pretty_end 19C7 6599
|
||
dump_pretty_nextrow 19BB 6587
|
||
dump_pretty_row 1975 6517
|
||
endPrint 1FA 506
|
||
fat_cd_single 25FB 9723
|
||
fat_copy_lba_pointer 249D 9373
|
||
fat_exec 2716 10006
|
||
fat_get_root_table 21CD 8653
|
||
fat_getfatsec 22C2 8898
|
||
fat_openfile 2377 9079
|
||
fat_openfile_noprepare 237F 9087
|
||
fat_print_directory 24E2 9442
|
||
fat_readfilesec 234A 9034
|
||
fat_reset_pointer 248E 9358
|
||
format_filename_fat16 24BC 9404
|
||
ide_printerror EB2 3762
|
||
ide_readsector_512_fast E67 3687
|
||
ide_readsector_timeout E9C 3740
|
||
ide_regread_8 E51 3665
|
||
ide_regwrite_8 E37 3639
|
||
ide_reset E2B 3627
|
||
ide_writesector_256 EB1 3761
|
||
ideif_drv_sel 15B8 5560
|
||
ideif_get_drv_pointer 1558 5464
|
||
ideif_init_all 156C 5484
|
||
ideif_init_devtable 1365 4965
|
||
ideif_init_drive 1478 5240
|
||
ideif_prnt_devtable 1383 4995
|
||
iic_init 173A 5946
|
||
iic_read_ack 1781 6017
|
||
iic_receive_buffer 170B 5899
|
||
iic_receive_buffer_done 172E 5934
|
||
iic_receive_buffer_err 1734 5940
|
||
iic_receive_buffer_loop 171C 5916
|
||
iic_receive_byte 1807 6151
|
||
iic_receive_byte_loop 1814 6164
|
||
iic_send_ack 17A7 6055
|
||
iic_send_buffer 16E1 5857
|
||
iic_send_buffer_done 16FF 5887
|
||
iic_send_buffer_err 1705 5893
|
||
iic_send_buffer_loop 16F1 5873
|
||
iic_send_byte 17E1 6113
|
||
iic_send_byte_loop 17ED 6125
|
||
iic_send_ebit 1760 5984
|
||
iic_send_nack 17C4 6084
|
||
iic_send_sbit 1747 5959
|
||
initctrl_int_abandon 184E 6222
|
||
initctrl_int_register 184E 6222
|
||
intctrl_init 182E 6190
|
||
interrupt_vectors 4000 16384
|
||
mon_var_template 44 68
|
||
mon_var_template_end 613 1555
|
||
mon_var_template_sof= 444 1092
|
||
nxtILC 1EF 495
|
||
param_01 404 1028
|
||
param_02 42B 1067
|
||
param_03 448 1096
|
||
param_03_done 480 1152
|
||
param_03_neg 469 1129
|
||
param_04 484 1156
|
||
param_04_i 494 1172
|
||
param_05 49A 1178
|
||
param_06 4A7 1191
|
||
param_07 4C1 1217
|
||
param_08 4CE 1230
|
||
param_09 4E3 1251
|
||
param_09_0A 4E9 1257
|
||
param_0A 4DA 1242
|
||
param_10 4F8 1272
|
||
param_11 508 1288
|
||
param_11_12 517 1303
|
||
param_11_12_all 537 1335
|
||
param_11_12_def 52A 1322
|
||
param_11_12_ix 52F 1327
|
||
param_11_12_iy 534 1332
|
||
param_12 510 1296
|
||
param_13 548 1352
|
||
param_80 567 1383
|
||
param_80_seek 56E 1390
|
||
param_81 55E 1374
|
||
param_comma 5A2 1442
|
||
param_printRegister 57D 1405
|
||
param_printRegisterA 59B 1435
|
||
param_printRegisterHL 593 1427
|
||
print_16_hex 181 385
|
||
print_32_hex 168 360
|
||
print_a_hex 122 290
|
||
print_bcd 134 308
|
||
print_char F6 246
|
||
print_clear 105 261
|
||
print_newLine 10C 268
|
||
print_reg 1FF 511
|
||
print_str FC 252
|
||
print_str_fixed 1A07 6663
|
||
print_wait_out 117 279
|
||
read_bcd 14F 335
|
||
read_char 14C 332
|
||
read_char_raw 13A 314
|
||
read_lba_sector 157F 5503
|
||
str_dev_done 1628 5672
|
||
str_dev_waitready 1610 5648
|
||
str_error_start EE7 3815
|
||
str_error_start1 F04 3844
|
||
str_error_start2 F0D 3853
|
||
str_error_time F16 3862
|
||
str_post_apu 20C7 8391
|
||
str_post_ide_30 2076 8310
|
||
str_post_ide_40 2091 8337
|
||
str_post_nd 20FD 8445
|
||
str_post_ok 2135 8501
|
||
str_post_pio 20AC 8364
|
||
str_post_rtc 20E2 8418
|
||
str_post_rtc_iv 210B 8459
|
||
var_apu_present 420E 16910
|
||
var_buffer_conin_data 4100 16640
|
||
var_buffer_conin_in 4200 16896
|
||
var_buffer_conin_out 4201 16897
|
||
var_buffer_conin_sts 4202 16898
|
||
var_buffer_conout 4203 16899
|
||
var_buffer_len 4204 16900
|
||
var_bytes_count=411A 16666
|
||
var_curserchar 420A 16906
|
||
var_curserlastaddr 420B 16907
|
||
var_curseron 4209 16905
|
||
var_curserstate 4208 16904
|
||
var_curserx 4206 16902
|
||
var_cursery 4207 16903
|
||
var_dir 422F 16943
|
||
var_idebuffer 42CF 17103
|
||
var_input 427F 17023
|
||
var_last_char 4205 16901
|
||
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 420D 16909
|
||
var_ps2mem 421F 16927
|
||
var_scratch 420F 16911
|