]> cloudbase.mooo.com Git - ddt180.git/blob - ddt180.z80
Rename ddtz to ddt180
[ddt180.git] / ddt180.z80
1 ; Disassembled ddtz.com, version "DDT/Z [8101]"
2 ; with modified relocater.
3 ;
4 ; Build steps:
5 ; - Assemble to a .REL file with M80 or a compatible assembler.
6 ; - Use Digital Research Link-80 to generate a .PRL file (op switch).
7 ; - Cut the .PRL header (first 256 byte) end rename the result to DDTZ.COM.
8
9 ;-------------------------------------------------------------------------------
10 ; Relocation loader
11 ;
12
13 TPA equ 0100h
14 cseg
15 .phase TPA
16
17 LD SP,ldr_end+(stack-ddtz_base)
18 LD DE,ldr_end+(expr_buf-ddtz_base)
19 LD C,BDOS_PSTR
20 CALL BDOS
21
22 LD HL,ldr_end+ddtz_size ;start of reloc bitmap
23 ld bc,0108h ;init bit counter
24
25 EXX
26 LD HL,(BDOS+1)
27 LD (ldr_end+1),HL
28 LD BC,ddtz_size-1
29 LD D,B
30 LD E,0FFH
31 INC DE ;size rounded up to next page boundary
32 INC BC ;ddtz_size
33 OR A
34 SBC HL,DE ;BDOS - size
35 LD (BDOS+1),HL ;-> new BDOS entry
36
37 push hl
38 PUSH BC
39 ld de,ldr_end
40 sbc hl,de
41 EX DE,HL ;-> DE
42 LD HL,ldr_size
43 add hl,bc
44 ld b,h
45 ld c,l
46 LD HL,TPA
47 reloc_lp:
48 EXX
49 djnz reloc_nl
50 ld b,c ;reload bit counter
51 LD e,(HL) ;get next 8 relocation bits
52 INC HL
53 reloc_nl:
54 sla e
55 EXX
56 JR NC,reloc_next
57 DEC HL
58 LD A,(HL)
59 ADD A,E
60 LD (HL),A
61 INC HL
62 LD A,(HL)
63 ADC A,D
64 LD (HL),A
65 reloc_next:
66 cpi
67 jp pe,reloc_lp
68 dec hl
69
70 POP BC
71 pop de
72 EX DE,HL
73 ADD HL,BC
74 EX DE,HL
75 DEC DE
76 LDDR
77 LD HL,conbuf+2-ddtz_base
78 ADD HL,DE
79 JP (HL)
80
81 ldr_end:
82 ldr_size equ $ - TPA
83
84 .dephase
85 ;-------------------------------------------------------------------------------
86 ; DDT/Z core
87 ;
88
89 ; Some greneral definitions
90
91 TAB equ 9
92 LF equ 10
93 CR equ 13
94
95 ; CP/M memory layout
96
97 BDOS equ 5
98 FCB equ 05ch
99 FCB2 equ 06ch
100 DMA_BUF equ 080h
101 TPA equ 0100h
102
103 ; BDOS function calls
104
105 BDOS_CIN equ 1 ;Console Input
106 BDOS_COUT equ 2 ;Console Output
107 BDOS_PSTR equ 9 ;Print String
108 BDOS_CBUF equ 10 ;Read Console Buffer
109 BDOS_CSTAT equ 11 ;Get Console Status
110 BDOS_OPEN equ 15 ;Open File
111 BDOS_CLOSE equ 16 ;Close File
112 BDOS_DELETE equ 19 ;Delete File
113 BDOS_READ equ 20 ;Read Sequential
114 BDOS_WRITE equ 21 ;Write Sequential
115 BDOS_CREATE equ 22 ;Make File
116 BDOS_SETDMA equ 26 ;Set DMA Address
117
118 ; ddtz specific definitions
119
120 STACK_SIZE equ 64 ;ddtz internal stack
121 CONBUF_SIZE equ 80 ;Size of console input buffer
122 EXPR_BUF_SIZE equ 128 ;expressen buffer for conditional breakpoints
123 BP_CNT equ 12 ;Number of breakpoints
124 BP_SIZE equ 8 ;Size of a breakpoint record
125 YREG_CNT equ 10 ;Number of Y registers (0..9)
126
127 ;-------------------------------------------------------------------------------
128
129 ddtz_base:
130 jp 0 ;0000 c3 00 00 . . .
131 l0003h:
132 rst 30h ;0003 f7 .
133 sub_0004h:
134 nop ;0004 00 .
135 ret ;0005 c9 .
136
137 ds STACK_SIZE
138
139 stack:
140 reg.l2: db 000h ;0046 00 .
141 reg.h2: db 000h ;0047 00 .
142 reg.e2: db 000h ;0048 00 .
143 reg.d2: db 000h ;0049 00 .
144 reg.c2: db 000h ;004a 00 .
145 reg.b2: db 000h ;004b 00 .
146 reg.f2: db 000h ;004c 00 .
147 reg.a2: db 000h ;004d 00 .
148 l004eh: db 000h ;004e 00 .
149 reg.i: db 000h ;004f 00 .
150 reg.iy: dw 0000h ;0050 00 .
151 reg.ix: dw 0000h ;0052 00 .
152 reg.f: db 000h ;0054 00 .
153 reg.a: db 000h ;0055 00 .
154 reg.c: db 000h ;0056 00 .
155 reg.b: db 000h ;0057 00 .
156 reg.e: db 000h ;0058 00 .
157 reg.d: db 000h ;0059 00 .
158 reg.l: db 000h ;005a 00 .
159 reg.h: db 000h ;005b 00 .
160 reg_sp: dw TPA ;005c 00 01 .
161 reg.iff:
162 db 0f3h ;005e f3 .
163 db 0c3h ;005f c3 .
164 REG.PC: dw TPA ;0060 00 01 .
165 l0062h: dw 0000h ;0062 00 00 .
166 offs.@: dw 0 ;0064 00 00 .
167
168 CMD_ERR:dw l0146h ;0066 46 01 F .
169 cmd_rpt:dw mainloop ;0068 bd 00 . .
170
171 conbuf:
172 db CONBUF_SIZE ;006a 50 P
173
174 ld sp,stack ;006b 31 46 00 1 F .
175 exx ;006e d9 .
176 ld de,ddtz_base ;006f 11 00 00 . . .
177 or a ;0072 b7 .
178 sbc hl,de ;0073 ed 52 . R
179 add hl,de ;0075 19 .
180 jr c,l0079h ;0076 38 01 8 .
181 ex de,hl ;0078 eb .
182 l0079h:
183 ld de,TPA ;0079 11 00 01 . . .
184 l007ch:
185 dec hl ;007c 2b +
186 ld (hl),000h ;007d 36 00 6 .
187 ld a,h ;007f 7c |
188 sub d ;0080 92 .
189 ld b,a ;0081 47 G
190 ld a,l ;0082 7d }
191 sub e ;0083 93 .
192 or b ;0084 b0 .
193 jr nz,l007ch ;0085 20 f5 .
194 ld a,i ;0087 ed 57 . W
195 ld (reg.i),a ;0089 32 4f 00 2 O .
196 ld a,0f3h ;008c 3e f3 > .
197 jp po,l0093h ;008e e2 93 00 . . .
198 ld a,0fbh ;0091 3e fb > .
199 l0093h:
200 ld (reg.iff),a ;0093 32 5e 00 2 ^ .
201 call sub_0004h ;0096 cd 04 00 . . .
202 ld hl,ddtz_base ;0099 21 00 00 ! . .
203 ld l,000h ;009c 2e 00 . .
204 ld (reg_sp),hl ;009e 22 5c 00 " \ .
205 ld a,(FCB+1) ;00a1 3a 5d 00 : ] .
206 cp ' ' ;00a4 fe 20 .
207 ld hl,0 ;00a6 21 00 00 ! . .
208 call nz,read_file ;00a9 c4 68 10 . h .
209 jr mainloop ;00ac 18 0f . .
210
211 ds CONBUF_SIZE + 3 - ($ - conbuf)
212
213 mainloop:
214 ld sp,stack ;00bd 31 46 00 1 F .
215 ld hl,l0146h ;00c0 21 46 01 ! F .
216 ld (CMD_ERR),hl ;00c3 22 66 00 " f .
217 ld hl,(REG.PC) ;00c6 2a 60 00 * ` .
218 ld (l0062h),hl ;00c9 22 62 00 " b .
219 call bp_clr_temporary ;00cc cd 54 07 . T .
220 ld hl,(cmd_rpt) ;00cf 2a 68 00 * h .
221 ld de,mainloop ;00d2 11 bd 00 . . .
222 call cp_hl_de ;00d5 cd ee 02 . . .
223 ld a,'>' ;00d8 3e 3e > >
224 call outchar ;00da cd 5d 02 . ] .
225 call nz,outchar ;00dd c4 5d 02 . ] .
226 call z,outbl ;00e0 cc 9f 02 . . .
227 call get_line ;00e3 cd 4e 01 . N .
228 call skipbl ;00e6 cd bf 02 . . .
229 jr z,exe_hl ;00e9 28 1f ( .
230 ld hl,mainloop ;00eb 21 bd 00 ! . .
231 ld (cmd_rpt),hl ;00ee 22 68 00 " h .
232 inc de ;00f1 13 .
233 sub '@' ;00f2 d6 40 . @
234 jr c,ERROR ;00f4 38 11 8 .
235 cp 'Z'+1-'@' ;00f6 fe 1b . .
236 jr nc,ERROR ;00f8 30 0d 0 .
237 add a,a ;00fa 87 .
238 ld hl,CMDTAB ;00fb 21 10 01 ! . .
239 call add_hl_a ;00fe cd b9 02 . . .
240 ld a,(hl) ;0101 7e ~
241 inc hl ;0102 23 #
242 ld h,(hl) ;0103 66 f
243 ld l,a ;0104 6f o
244 jr exe_hl ;0105 18 03 . .
245 ERROR:
246 ld hl,(CMD_ERR) ;0107 2a 66 00 * f .
247 exe_hl:
248 call CALL_HL ;010a cd 0f 01 . . .
249 jr mainloop ;010d 18 ae . .
250
251 CMDTAB:
252 defw cmd_@ ;0110 92 0d . .
253 defw cmd_A ;0112 fe 11 . .
254 defw cmd_B ;0114 6d 07 m .
255 defw cmd_C ;0116 17 21 . !
256 defw cmd_D ;0118 48 0f H .
257 defw ERROR ;011a 07 01 . .
258 defw cmd_F ;011c af 0f . .
259 defw cmd_G ;011e 31 07 1 .
260 defw cmd_H ;0120 3d 0e = .
261 defw cmd_I ;0122 a3 0d . .
262 defw ERROR ;0124 07 01 . .
263 defw ERROR ;0126 07 01 . .
264 defw cmd_L ;0128 cd 18 . .
265 defw cmd_M ;012a 19 0e . .
266 defw ERROR ;012c 07 01 . .
267 defw cmd_O ;012e c7 0d . .
268 defw ERROR ;0130 07 01 . .
269 defw cmd_Q ;0132 84 0e . .
270 defw cmd_R ;0134 62 10 b .
271 defw cmd_S ;0136 5a 0d Z .
272 defw cmd_T ;0138 1e 21 . !
273 defw ERROR ;013a 07 01 . .
274 defw cmd_V ;013c ea 0d . .
275 defw cmd_W ;013e a0 11 . .
276 defw cmd_X ;0140 f1 0b . .
277 defw cmd_Y ;0142 b2 0b . .
278 defw cmd_Z ;0144 ba 0e . .
279
280 l0146h:
281 ld a,'?' ;0146 3e 3f > ?
282 call outchar ;0148 cd 5d 02 . ] .
283 jp crlf ;014b c3 a3 02 . . .
284 get_line:
285 push hl ;014e e5 .
286 ld de,conbuf ;014f 11 6a 00 . j .
287 ld c,BDOS_CBUF ;0152 0e 0a . .
288 call ddtz_base ;0154 cd 00 00 . . .
289 call crlf ;0157 cd a3 02 . . .
290 ld de,conbuf+1 ;015a 11 6b 00 . k .
291 ld a,(de) ;015d 1a .
292 ld b,a ;015e 47 G
293 ld c,0 ;015f 0e 00 . .
294 inc b ;0161 04 .
295 l0162h:
296 inc de ;0162 13 .
297 dec b ;0163 05 .
298 jr z,l0194h ;0164 28 2e ( .
299 ld a,(de) ;0166 1a .
300 bit 0,c ;0167 cb 41 . A
301 call z,toupper ;0169 cc 9b 01 . . .
302 ld (de),a ;016c 12 .
303 cp '''' ;016d fe 27 . '
304 jr nz,l0162h ;016f 20 f1 .
305 push de ;0171 d5 .
306 dec de ;0172 1b .
307 ld a,(de) ;0173 1a .
308 cp '''' ;0174 fe 27 . '
309 jr z,l0190h ;0176 28 18 ( .
310 dec de ;0178 1b .
311 ld a,(de) ;0179 1a .
312 cp '^' ;017a fe 5e . ^
313 jr z,l0184h ;017c 28 06 ( .
314 dec de ;017e 1b .
315 ld a,(de) ;017f 1a .
316 cp '^' ;0180 fe 5e . ^
317 jr nz,l0190h ;0182 20 0c .
318 l0184h:
319 inc de ;0184 13 .
320 push bc ;0185 c5 .
321 call sub_0303h ;0186 cd 03 03 . . .
322 pop bc ;0189 c1 .
323 dec de ;018a 1b .
324 ld a,(de) ;018b 1a .
325 cp '''' ;018c fe 27 . '
326 jr z,l0191h ;018e 28 01 ( .
327 l0190h:
328 inc c ;0190 0c .
329 l0191h:
330 pop de ;0191 d1 .
331 jr l0162h ;0192 18 ce . .
332 l0194h:
333 xor a ;0194 af .
334 ld (de),a ;0195 12 .
335 ld de,conbuf+2 ;0196 11 6c 00 . l .
336 pop hl ;0199 e1 .
337 ret ;019a c9 .
338
339 toupper:
340 cp 'a' ;019b fe 61 . a
341 ret c ;019d d8 .
342 cp 'z'+1 ;019e fe 7b . {
343 ret nc ;01a0 d0 .
344 and 05fh ;01a1 e6 5f . _
345 ret ;01a3 c9 .
346
347 out.hl.@:
348 call out_hl ;01a4 cd 13 02 . . .
349 push de ;01a7 d5 .
350 push hl ;01a8 e5 .
351 ld de,(offs.@) ;01a9 ed 5b 64 00 . [ d .
352 ld a,d ;01ad 7a z
353 or e ;01ae b3 .
354 jr z,l01bfh ;01af 28 0e ( .
355 call outbl ;01b1 cd 9f 02 . . .
356 ld a,'@' ;01b4 3e 40 > @
357 call outchar ;01b6 cd 5d 02 . ] .
358 and a ;01b9 a7 .
359 sbc hl,de ;01ba ed 52 . R
360 call out_hl ;01bc cd 13 02 . . .
361 l01bfh:
362 pop hl ;01bf e1 .
363 pop de ;01c0 d1 .
364 ret ;01c1 c9 .
365 out.bin.w:
366 ld a,h ;01c2 7c |
367 call out.bin.b ;01c3 cd c7 01 . . .
368 ld a,l ;01c6 7d }
369 out.bin.b:
370 ld b,8 ;01c7 06 08 . .
371 l01c9h:
372 add a,a ;01c9 87 .
373 push af ;01ca f5 .
374 ld a,00 ;01cb 3e 00 > .
375 adc a,a ;01cd 8f .
376 call out_dgt ;01ce cd 21 02 . ! .
377 pop af ;01d1 f1 .
378 djnz l01c9h ;01d2 10 f5 . .
379 ld a,'"' ;01d4 3e 22 > "
380 jp outchar ;01d6 c3 5d 02 . ] .
381
382 sub_01d9h:
383 ld a,'-' ;01d9 3e 2d > -
384 call outchar ;01db cd 5d 02 . ] .
385 dec hl ;01de 2b +
386 jp cpl.hl ;01df c3 79 05 . y .
387
388 out_hl_dec_neg:
389 push hl ;01e2 e5 .
390 call sub_01d9h ;01e3 cd d9 01 . . .
391 defb 03eh ;01e6 3e >
392 out.hl.dec:
393 push hl ;01e7 e5 .
394 ld b,006h ;01e8 06 06 . .
395 call sub_01f9h ;01ea cd f9 01 . . .
396 pop hl ;01ed e1 .
397 ld a,'.' ;01ee 3e 2e > .
398 call outchar ;01f0 cd 5d 02 . ] .
399 l01f3h:
400 call outbl ;01f3 cd 9f 02 . . .
401 djnz l01f3h ;01f6 10 fb . .
402 ret ;01f8 c9 .
403 sub_01f9h:
404 dec b ;01f9 05 .
405 push de ;01fa d5 .
406 ld de,10 ;01fb 11 0a 00 . . .
407 call div_hl_de ;01fe cd 75 04 . u .
408 ld a,h ;0201 7c |
409 or l ;0202 b5 .
410 call nz,sub_01f9h ;0203 c4 f9 01 . . .
411 ld a,e ;0206 7b {
412 pop de ;0207 d1 .
413 jr out_dgt ;0208 18 17 . .
414
415 out_hl_neg:
416 push hl ;020a e5 .
417 call sub_01d9h ;020b cd d9 01 . . .
418 call out_hl ;020e cd 13 02 . . .
419 pop hl ;0211 e1 .
420 ret ;0212 c9 .
421
422 out_hl:
423 ld a,h ;0213 7c |
424 call out_hex ;0214 cd 18 02 . . .
425 ld a,l ;0217 7d }
426
427 out_hex:
428 push af ;0218 f5 .
429 rra ;0219 1f .
430 rra ;021a 1f .
431 rra ;021b 1f .
432 rra ;021c 1f .
433 call out_dgt ;021d cd 21 02 . ! .
434 pop af ;0220 f1 .
435
436 out_dgt:
437 and 0fh ;0221 e6 0f . .
438 cp 10 ;0223 fe 0a . .
439 jr c,l0229h ;0225 38 02 8 .
440 add a,007h ;0227 c6 07 . .
441 l0229h:
442 add a,'0' ;0229 c6 30 . 0
443 jr outchar ;022b 18 30 . 0
444 l022dh:
445 ld a,'-' ;022d 3e 2d > -
446 call outchar ;022f cd 5d 02 . ] .
447 ld a,040h ;0232 3e 40 > @
448 out.ascii:
449 ex af,af' ;0234 08 .
450 call outquote ;0235 cd 5b 02 . [ .
451 ex af,af' ;0238 08 .
452 push af ;0239 f5 .
453 res 7,a ;023a cb bf . .
454 cp ' ' ;023c fe 20 .
455 jr nc,l0242h ;023e 30 02 0 .
456 sub 0c0h ;0240 d6 c0 . .
457 l0242h:
458 call outchar ;0242 cd 5d 02 . ] .
459 push af ;0245 f5 .
460 cp '''' ;0246 fe 27 . '
461 call z,outchar ;0248 cc 5d 02 . ] .
462 pop af ;024b f1 .
463 ex af,af' ;024c 08 .
464 call outquote ;024d cd 5b 02 . [ .
465 pop af ;0250 f1 .
466 or a ;0251 b7 .
467 ld a,'.' ;0252 3e 2e > .
468 call m,outchar ;0254 fc 5d 02 . ] .
469 ex af,af' ;0257 08 .
470 jr c,l022dh ;0258 38 d3 8 .
471 ret ;025a c9 .
472
473 p_char_lparen:
474 ld a,'('
475 jr outchar
476
477 outquote:
478 ld a,'''' ;025b 3e 27 > '
479 outchar:
480 push hl ;025d e5 .
481 push de ;025e d5 .
482 push bc ;025f c5 .
483 push af ;0260 f5 .
484 and 07fh ;0261 e6 7f . \7f
485 ld e,a ;0263 5f _
486 ld c,BDOS_COUT ;0264 0e 02 . .
487 call ddtz_base ;0266 cd 00 00 . . .
488 ld hl,con_col ;0269 21 72 02 ! r .
489 inc (hl) ;026c 34 4
490 pop af ;026d f1 .
491 pop bc ;026e c1 .
492 pop de ;026f d1 .
493 pop hl ;0270 e1 .
494 ret ;0271 c9 .
495 con_col:
496 db 0 ;0272 00 .
497 inchar:
498 push hl ;0273 e5 .
499 push de ;0274 d5 .
500 push bc ;0275 c5 .
501 ld c,BDOS_CSTAT ;0276 0e 0b . .
502 call ddtz_base ;0278 cd 00 00 . . .
503 and a ;027b a7 .
504 jr z,l0284h ;027c 28 06 ( .
505 ld c,BDOS_CIN ;027e 0e 01 . .
506 call ddtz_base ;0280 cd 00 00 . . .
507 scf ;0283 37 7
508 l0284h:
509 pop bc ;0284 c1 .
510 pop de ;0285 d1 .
511 pop hl ;0286 e1 .
512 ret ;0287 c9 .
513 pstr:
514 ld c,0 ;0288 0e 00 . .
515 l028ah:
516 ld a,(hl) ;028a 7e ~
517 and a ;028b a7 .
518 ret z ;028c c8 .
519 call outchar ;028d cd 5d 02 . ] .
520 inc c ;0290 0c .
521 inc hl ;0291 23 #
522 and a ;0292 a7 .
523 ret m ;0293 f8 .
524 jr l028ah ;0294 18 f4 . .
525
526 outbl6:
527 call outbl2 ;0296 cd 9c 02 . . .
528 outbl4:
529 call outbl2 ;0299 cd 9c 02 . . .
530 outbl2:
531 call outbl ;029c cd 9f 02 . . .
532 outbl:
533 ld a,' ' ;029f 3e 20 >
534 jr outchar ;02a1 18 ba . .
535 crlf:
536 call inchar ;02a3 cd 73 02 . s .
537 ld a,CR ;02a6 3e 0d > .
538 call outchar ;02a8 cd 5d 02 . ] .
539 ld a,LF ;02ab 3e 0a > .
540 call outchar ;02ad cd 5d 02 . ] .
541 ld a,0 ;02b0 3e 00 > .
542 ld (con_col),a ;02b2 32 72 02 2 r .
543 jp c,mainloop ;02b5 da bd 00 . . .
544 ret ;02b8 c9 .
545 add_hl_a:
546 add a,l ;02b9 85 .
547 ld l,a ;02ba 6f o
548 ret nc ;02bb d0 .
549 inc h ;02bc 24 $
550 ret ;02bd c9 .
551
552 skipbl0:
553 inc de ;02be 13 .
554 skipbl:
555 ld a,(de) ;02bf 1a .
556 cp ' ' ;02c0 fe 20 .
557 jr z,skipbl0 ;02c2 28 fa ( .
558 cp TAB ;02c4 fe 09 . .
559 jr z,skipbl0 ;02c6 28 f6 ( .
560 or a ;02c8 b7 .
561 ret ;02c9 c9 .
562
563 next_arg:
564 call skipbl ;02ca cd bf 02 . . .
565 cp ',' ;02cd fe 2c . ,
566 ret nz ;02cf c0 .
567 inc de ;02d0 13 .
568 call skipbl ;02d1 cd bf 02 . . .
569 cp a ;02d4 bf .
570 ret ;02d5 c9 .
571
572 assert_eol:
573 call skipbl ;02d6 cd bf 02 . . .
574 ret z ;02d9 c8 .
575 to_error:
576 jp ERROR ;02da c3 07 01 . . .
577
578 chk_sp:
579 push hl ;02dd e5 .
580 push de ;02de d5 .
581 ld hl,0 ;02df 21 00 00 ! . .
582 add hl,sp ;02e2 39 9
583 ld de,stack-40 ;02e3 11 1e 00 . . .
584 call cp_hl_de ;02e6 cd ee 02 . . .
585 pop de ;02e9 d1 .
586 pop hl ;02ea e1 .
587 jr c,to_error ;02eb 38 ed 8 .
588 ret ;02ed c9 .
589
590 cp_hl_de:
591 and a ;02ee a7 .
592 sbc hl,de ;02ef ed 52 . R
593 add hl,de ;02f1 19 .
594 ret ;02f2 c9 .
595
596 lookupch:
597 ld b,0 ;02f3 06 00 . .
598 l02f5h:
599 ld a,(hl) ;02f5 7e ~
600 and a ;02f6 a7 .
601 ret z ;02f7 c8 .
602 ld a,(de) ;02f8 1a .
603 cp (hl) ;02f9 be .
604 jr z,l0300h ;02fa 28 04 ( .
605 inc hl ;02fc 23 #
606 inc b ;02fd 04 .
607 jr l02f5h ;02fe 18 f5 . .
608 l0300h:
609 scf ;0300 37 7
610 inc de ;0301 13 .
611 ret ;0302 c9 .
612
613 sub_0303h:
614 ld hl,b_0cc3_start ;0303 21 c3 0c ! . .
615 ld b,07fh ;0306 06 7f .
616 jr l030ch ;0308 18 02 . .
617
618 sub_030ah:
619 ld b,0ffh ;030a 06 ff . .
620 l030ch:
621 inc b ;030c 04 .
622 ld a,(hl) ;030d 7e ~
623 and a ;030e a7 .
624 ret z ;030f c8 .
625 call sub_031ch ;0310 cd 1c 03 . . .
626 jr nc,l030ch ;0313 30 f7 0 .
627 res 7,b ;0315 cb b8 . .
628 ret ;0317 c9 .
629
630 sub_0318h:
631 push bc ;0318 c5 .
632 res 7,b ;0319 cb b8 . .
633 defb 03eh ;031b 3e >
634 sub_031ch:
635 push bc ;031c c5 .
636 push de ;031d d5 .
637 l031eh:
638 ld a,(de) ;031e 1a .
639 xor (hl) ;031f ae .
640 and 07fh ;0320 e6 7f .
641 jr nz,l0336h ;0322 20 12 .
642 bit 7,(hl) ;0324 cb 7e . ~
643 inc hl ;0326 23 #
644 inc de ;0327 13 .
645 jr z,l031eh ;0328 28 f4 ( .
646 scf ;032a 37 7
647 bit 7,b ;032b cb 78 . x
648 call z,sub_060ch ;032d cc 0c 06 . . .
649 jr nc,l0339h ;0330 30 07 0 .
650 pop af ;0332 f1 .
651 scf ;0333 37 7
652 pop bc ;0334 c1 .
653 ret ;0335 c9 .
654 l0336h:
655 call sub_0345h ;0336 cd 45 03 . E .
656 l0339h:
657 pop de ;0339 d1 .
658 and a ;033a a7 .
659 pop bc ;033b c1 .
660 ret ;033c c9 .
661
662 sel_dc_string:
663 inc b ;033d 04 .
664 l033eh:
665 dec b ;033e 05 .
666 ret z ;033f c8 .
667 call sub_0345h ;0340 cd 45 03 . E .
668 jr l033eh ;0343 18 f9 . .
669
670 sub_0345h:
671 ld a,(hl) ;0345 7e ~
672 and a ;0346 a7 .
673 ret z ;0347 c8 .
674 l0348h:
675 ld a,(hl) ;0348 7e ~
676 inc hl ;0349 23 #
677 and a ;034a a7 .
678 ret m ;034b f8 .
679 jr l0348h ;034c 18 fa . .
680
681 sub_034eh:
682 call get_arg_range ;034e cd 7d 03 . } .
683 push hl ;0351 e5 .
684 push bc ;0352 c5 .
685 call next_arg ;0353 cd ca 02 . . .
686 call sub_0363h ;0356 cd 63 03 . c .
687 ex de,hl ;0359 eb .
688 pop bc ;035a c1 .
689 pop hl ;035b e1 .
690 ret ;035c c9 .
691
692 sub_035dh:
693 call expr ;035d cd be 03 . . .
694 jr c,error0 ;0360 38 33 8 3
695 ret ;0362 c9 .
696
697 sub_0363h:
698 call sub_035dh ;0363 cd 5d 03 . ] .
699 l0366h:
700 jp assert_eol ;0366 c3 d6 02 . . .
701
702 get_lastarg_def:
703 call get_arg_def ;0369 cd 6e 03 . n .
704 jr l0366h ;036c 18 f8 . .
705
706 get_arg_def:
707 push hl ;036e e5 .
708 call expr ;036f cd be 03 . . .
709 jr c,l0375h ;0372 38 01 8 .
710 ex (sp),hl ;0374 e3 .
711 l0375h:
712 pop hl ;0375 e1 .
713 ret ;0376 c9 .
714
715 sub_0377h:
716 call b_037c_start ;0377 cd 7c 03 . | .
717 jr l0366h ;037a 18 ea . .
718
719 b_037c_start:
720 defb 0e6h ;037c e6 .
721 get_arg_range:
722 scf ;037d 37 7
723 ex af,af' ;037e 08 .
724 push bc ;037f c5 .
725 push hl ;0380 e5 .
726 call expr ;0381 cd be 03 . . .
727 jr nc,l038ch ;0384 30 06 0 .
728 ex af,af' ;0386 08 .
729 jr c,error0 ;0387 38 0c 8 .
730 ex af,af' ;0389 08 .
731 pop hl ;038a e1 .
732 defb 03eh ;038b 3e >
733 l038ch:
734 pop af ;038c f1 .
735 call get_range ;038d cd 9a 03 . . .
736 jr nc,l0398h ;0390 30 06 0 .
737 ex af,af' ;0392 08 .
738 pop bc ;0393 c1 .
739 ret nc ;0394 d0 .
740 error0:
741 jp ERROR ;0395 c3 07 01 . . .
742 l0398h:
743 pop af ;0398 f1 .
744 ret ;0399 c9 .
745
746 get_range:
747 call next_arg ;039a cd ca 02 . . .
748 cp 'S' ;039d fe 53 . S
749 jr nz,l03a2h ;039f 20 01 .
750 inc de ;03a1 13 .
751 l03a2h:
752 push hl ;03a2 e5 .
753 push af ;03a3 f5 .
754 call expr ;03a4 cd be 03 . . .
755 jr c,l03b8h ;03a7 38 0f 8 .
756 ld b,h ;03a9 44 D
757 ld c,l ;03aa 4d M
758 pop af ;03ab f1 .
759 pop hl ;03ac e1 .
760 jr z,l03b6h ;03ad 28 07 ( .
761 ld a,c ;03af 79 y
762 sub l ;03b0 95 .
763 ld c,a ;03b1 4f O
764 ld a,b ;03b2 78 x
765 sbc a,h ;03b3 9c .
766 ld b,a ;03b4 47 G
767 inc bc ;03b5 03 .
768 l03b6h:
769 and a ;03b6 a7 .
770 ret ;03b7 c9 .
771 l03b8h:
772 pop af ;03b8 f1 .
773 pop hl ;03b9 e1 .
774 jr z,error0 ;03ba 28 d9 ( .
775 scf ;03bc 37 7
776 ret ;03bd c9 .
777
778 expr:
779 call skipbl ;03be cd bf 02 . . .
780 expr1:
781 call do_subexpr ;03c1 cd 2f 04 . / .
782 ret c ;03c4 d8 .
783 call do_rel_op ;03c5 cd ef 03 . . .
784 ret nc ;03c8 d0 .
785 push bc ;03c9 c5 .
786 push hl ;03ca e5 .
787 call do_subexpr ;03cb cd 2f 04 . / .
788 jr c,error0 ;03ce 38 c5 8 .
789 ex de,hl ;03d0 eb .
790 ex (sp),hl ;03d1 e3 .
791 and a ;03d2 a7 .
792 sbc hl,de ;03d3 ed 52 . R
793 ld hl,0ffffh ;03d5 21 ff ff ! . .
794 pop de ;03d8 d1 .
795 ret ;03d9 c9 .
796
797 do_op_eq:
798 jr z,l03edh ;03da 28 11 ( .
799 jr l03ech ;03dc 18 0e . .
800 do_op_ne:
801 jr nz,l03edh ;03de 20 0d .
802 jr l03ech ;03e0 18 0a . .
803 do_op_le:
804 jr z,l03edh ;03e2 28 09 ( .
805 do_op_lt:
806 jr c,l03edh ;03e4 38 07 8 .
807 jr l03ech ;03e6 18 04 . .
808 do_op_gt:
809 jr z,l03ech ;03e8 28 02 ( .
810 do_op_ge:
811 jr nc,l03edh ;03ea 30 01 0 .
812 l03ech:
813 inc hl ;03ec 23 #
814 l03edh:
815 and a ;03ed a7 .
816 ret ;03ee c9 .
817 do_rel_op:
818 push hl ;03ef e5 .
819 ld hl,tab_eq_le_ge ;03f0 21 1f 04 ! . .
820 call lookupch ;03f3 cd f3 02 . . .
821 jr nc,l041dh ;03f6 30 25 0 %
822 ld a,b ;03f8 78 x
823 or a ;03f9 b7 .
824 jr z,l0411h ;03fa 28 15 ( .
825 ld a,(de) ;03fc 1a .
826 cp '=' ;03fd fe 3d . =
827 jr nz,l0406h ;03ff 20 05 .
828 inc de ;0401 13 .
829 inc b ;0402 04 .
830 inc b ;0403 04 .
831 jr l0411h ;0404 18 0b . .
832 l0406h:
833 bit 0,b ;0406 cb 40 . @
834 jr z,l0411h ;0408 28 07 ( .
835 cp '>' ;040a fe 3e . >
836 jr nz,l0411h ;040c 20 03 .
837 inc de ;040e 13 .
838 ld b,005h ;040f 06 05 . .
839 l0411h:
840 ld hl,tab_func_eqlege ;0411 21 23 04 ! # .
841 ld a,b ;0414 78 x
842 add a,a ;0415 87 .
843 call add_hl_a ;0416 cd b9 02 . . .
844 ld c,(hl) ;0419 4e N
845 inc hl ;041a 23 #
846 ld b,(hl) ;041b 46 F
847 scf ;041c 37 7
848 l041dh:
849 pop hl ;041d e1 .
850 ret ;041e c9 .
851
852 tab_eq_le_ge:
853 db '=<>',0
854
855 tab_func_eqlege:
856 defw do_op_eq ;0423 da 03 . .
857 defw do_op_lt ;0425 e4 03 . .
858 defw do_op_gt ;0427 e8 03 . .
859 defw do_op_le ;0429 e2 03 . .
860 defw do_op_ge ;042b ea 03 . .
861 defw do_op_ne ;042d de 03 . .
862
863 do_subexpr:
864 call do_factor ;042f cd e4 04 . . .
865 ret c ;0432 d8 .
866 l0433h:
867 call do_binary_op ;0433 cd ae 04 . . .
868 push hl ;0436 e5 .
869 push bc ;0437 c5 .
870 call do_factor ;0438 cd e4 04 . . .
871 pop bc ;043b c1 .
872 ex de,hl ;043c eb .
873 ex (sp),hl ;043d e3 .
874 jr nc,l0447h ;043e 30 07 0 .
875 pop de ;0440 d1 .
876 ld a,b ;0441 78 x
877 or c ;0442 b1 .
878 ret z ;0443 c8 .
879 jp ERROR ;0444 c3 07 01 . . .
880
881 l0447h:
882 ld a,b ;0447 78 x
883 or c ;0448 b1 .
884 push bc ;0449 c5 .
885 ret nz ;044a c0 .
886 pop bc ;044b c1 .
887
888 doop_add:
889 add hl,de ;044c 19 .
890 l044dh:
891 pop de ;044d d1 .
892 jr l0433h ;044e 18 e3 . .
893
894 doop_sub:
895 and a ;0450 a7 .
896 sbc hl,de ;0451 ed 52 . R
897 jr l044dh ;0453 18 f8 . .
898
899 doop_mlt:
900 push bc ;0455 c5 .
901 ld b,h ;0456 44 D
902 ld c,l ;0457 4d M
903 ld hl,0 ;0458 21 00 00 ! . .
904 ld a,010h ;045b 3e 10 > .
905 l045dh:
906 add hl,hl ;045d 29 )
907 ex de,hl ;045e eb .
908 add hl,hl ;045f 29 )
909 ex de,hl ;0460 eb .
910 jr nc,l0464h ;0461 30 01 0 .
911 add hl,bc ;0463 09 .
912 l0464h:
913 dec a ;0464 3d =
914 jr nz,l045dh ;0465 20 f6 .
915 pop bc ;0467 c1 .
916 jr l044dh ;0468 18 e3 . .
917
918 doop_div:
919 call div_hl_de ;046a cd 75 04 . u .
920 jr l044dh ;046d 18 de . .
921
922 doop_mod:
923 call div_hl_de ;046f cd 75 04 . u .
924 ex de,hl ;0472 eb .
925 jr l044dh ;0473 18 d8 . .
926
927 ; divide x/y
928 ; hl: x
929 ; de: y
930 ; return:
931 ; hl: q (x/y)
932 ; de: r (x%y)
933
934 div_hl_de:
935 push bc ;0475 c5 .
936 ex de,hl ;0476 eb .
937 ld b,h ;0477 44 D
938 ld c,l ;0478 4d M
939 ld hl,0 ;0479 21 00 00 ! . .
940 ld a,16 ;047c 3e 10 > .
941
942 ; de: x (x shifted out, q shifted in)
943 ; bc: y
944 ; hl: r (initially 0)
945
946 l047eh:
947 push af ;047e f5 .
948 add hl,hl ;047f 29 )
949 ex de,hl ;0480 eb .
950 xor a ;0481 af .
951 add hl,hl ;0482 29 )
952 ex de,hl ;0483 eb .
953 adc a,l ;0484 8d .
954 sub c ;0485 91 .
955 ld l,a ;0486 6f o
956 ld a,h ;0487 7c |
957 sbc a,b ;0488 98 .
958 ld h,a ;0489 67 g
959 inc de ;048a 13 .
960 jr nc,l048fh ;048b 30 02 0 .
961 add hl,bc ;048d 09 .
962 dec de ;048e 1b .
963 l048fh:
964 pop af ;048f f1 .
965 dec a ;0490 3d =
966 jr nz,l047eh ;0491 20 eb .
967 ex de,hl ;0493 eb .
968 pop bc ;0494 c1 .
969 ret ;0495 c9 .
970
971 doop_and:
972 ld a,h ;0496 7c |
973 and d ;0497 a2 .
974 ld h,a ;0498 67 g
975 ld a,l ;0499 7d }
976 and e ;049a a3 .
977 ld l,a ;049b 6f o
978 jr l044dh ;049c 18 af . .
979
980 doop_or:
981 ld a,h ;049e 7c |
982 or d ;049f b2 .
983 ld h,a ;04a0 67 g
984 ld a,l ;04a1 7d }
985 or e ;04a2 b3 .
986 ld l,a ;04a3 6f o
987 jr l044dh ;04a4 18 a7 . .
988
989 doop_xor:
990 ld a,h ;04a6 7c |
991 xor d ;04a7 aa .
992 ld h,a ;04a8 67 g
993 ld a,l ;04a9 7d }
994 xor e ;04aa ab .
995 ld l,a ;04ab 6f o
996 jr l044dh ;04ac 18 9f . .
997
998 do_binary_op:
999 push hl ;04ae e5 .
1000 ld hl,tab_op_a ;04af 21 c2 04 ! . .
1001 call lookupch ;04b2 cd f3 02 . . .
1002 ld a,b ;04b5 78 x
1003 ld hl,tblf_opa ;04b6 21 cb 04 ! . .
1004 add a,a ;04b9 87 .
1005 call add_hl_a ;04ba cd b9 02 . . .
1006 ld c,(hl) ;04bd 4e N
1007 inc hl ;04be 23 #
1008 ld b,(hl) ;04bf 46 F
1009 pop hl ;04c0 e1 .
1010 ret ;04c1 c9 .
1011
1012 tab_op_a:
1013 DB '+-*/%&!#',0
1014
1015 tblf_opa:
1016 defw doop_add ;04cb 4c 04 L .
1017 defw doop_sub ;04cd 50 04 P .
1018 defw doop_mlt ;04cf 55 04 U .
1019 defw doop_div ;04d1 6a 04 j .
1020 defw doop_mod ;04d3 6f 04 o .
1021 defw doop_and ;04d5 96 04 . .
1022 defw doop_or ;04d7 9e 04 . .
1023 defw doop_xor ;04d9 a6 04 . .
1024 defw 0 ;04db 00 00 . .
1025
1026 fact_factor:
1027 call do_factor ;04dd cd e4 04 . . .
1028 ret nc ;04e0 d0 .
1029 jp ERROR ;04e1 c3 07 01 . . .
1030
1031 do_factor:
1032 call chk_sp ;04e4 cd dd 02 . . .
1033 call get.number ;04e7 cd aa 05 . . .
1034 ret nc ;04ea d0 .
1035 inc de ;04eb 13 .
1036 ld hl,ddtz_base-1 ;04ec 21 ff ff ! . .
1037 cp 'T' ;04ef fe 54 . T
1038 ret z ;04f1 c8 .
1039 ld hl,(high_load) ;04f2 2a 9c 11 * . .
1040 cp 'H' ;04f5 fe 48 . H
1041 ret z ;04f7 c8 .
1042 ld hl,(max_load) ;04f8 2a 9e 11 * . .
1043 cp 'M' ;04fb fe 4d . M
1044 ret z ;04fd c8 .
1045 ld hl,TPA ;04fe 21 00 01 ! . .
1046 cp 'L' ;0501 fe 4c . L
1047 ret z ;0503 c8 .
1048 ld hl,(offs.@) ;0504 2a 64 00 * d .
1049 cp '@' ;0507 fe 40 . @
1050 ret z ;0509 c8 .
1051 ld hl,(l0062h) ;050a 2a 62 00 * b .
1052 cp '$' ;050d fe 24 . $
1053 ret z ;050f c8 .
1054 cp '-' ;0510 fe 2d . -
1055 jr z,fact_factneg ;0512 28 61 ( a
1056 cp '~' ;0514 fe 7e . ~
1057 jr z,fact_factinv ;0516 28 68 ( h
1058 cp '+' ;0518 fe 2b . +
1059 jr z,fact_factor ;051a 28 c1 ( .
1060 cp '^' ;051c fe 5e . ^
1061 jr z,fact_reg.CPU ;051e 28 45 ( E
1062 cp 'Y' ;0520 fe 59 . Y
1063 jr z,fact_reg.Y ;0522 28 10 ( .
1064 cp '(' ;0524 fe 28 . (
1065 jr z,fact_mem ;0526 28 5d ( ]
1066 cp '[' ;0528 fe 5b . [
1067 jp z,expr_brckt ;052a ca 9d 05 . . .
1068 cp '''' ;052d fe 27 . '
1069 jr z,fact_factstring ;052f 28 17 ( .
1070 dec de ;0531 1b .
1071 scf ;0532 37 7
1072 ret ;0533 c9 .
1073
1074 fact_reg.Y:
1075 call get.decdigit ;0534 cd 1d 06 . . .
1076 jp c,ERROR ;0537 da 07 01 . . .
1077 inc de ;053a 13 .
1078 add a,a ;053b 87 .
1079 ld hl,reg_Y ;053c 21 9e 0b ! . .
1080 call add_hl_a ;053f cd b9 02 . . .
1081 ld a,(hl) ;0542 7e ~
1082 inc hl ;0543 23 #
1083 ld h,(hl) ;0544 66 f
1084 ld l,a ;0545 6f o
1085 and a ;0546 a7 .
1086 ret ;0547 c9 .
1087
1088 fact_factstring:
1089 ld hl,0 ;0548 21 00 00 ! . .
1090 l054bh:
1091 ld a,(de) ;054b 1a .
1092 cp '''' ;054c fe 27 . '
1093 jr z,l0557h ;054e 28 07 ( .
1094 and a ;0550 a7 .
1095 ret z ;0551 c8 .
1096 l0552h:
1097 ld h,l ;0552 65 e
1098 ld l,a ;0553 6f o
1099 inc de ;0554 13 .
1100 jr l054bh ;0555 18 f4 . .
1101 l0557h:
1102 inc de ;0557 13 .
1103 ld a,(de) ;0558 1a .
1104 cp '''' ;0559 fe 27 . '
1105 jr z,l0552h ;055b 28 f5 ( .
1106 sub '.' ;055d d6 2e . .
1107 or a ;055f b7 .
1108 ret nz ;0560 c0 .
1109 inc de ;0561 13 .
1110 set 7,l ;0562 cb fd . .
1111 ret ;0564 c9 .
1112
1113 fact_reg.CPU:
1114 call sub_0caeh ;0565 cd ae 0c . . .
1115 jr nc,error4 ;0568 30 3d 0 =
1116 ld a,(hl) ;056a 7e ~
1117 inc hl ;056b 23 #
1118 ld h,(hl) ;056c 66 f
1119 ld l,a ;056d 6f o
1120 and a ;056e a7 .
1121 bit 0,c ;056f cb 41 . A
1122 ret nz ;0571 c0 .
1123 ld h,000h ;0572 26 00 & .
1124 ret ;0574 c9 .
1125
1126 fact_factneg:
1127 call fact_factor ;0575 cd dd 04 . . .
1128 dec hl ;0578 2b +
1129 cpl.hl:
1130 ld a,h ;0579 7c |
1131 cpl ;057a 2f /
1132 ld h,a ;057b 67 g
1133 ld a,l ;057c 7d }
1134 cpl ;057d 2f /
1135 ld l,a ;057e 6f o
1136 ret ;057f c9 .
1137
1138 fact_factinv:
1139 call fact_factor ;0580 cd dd 04 . . .
1140 jr cpl.hl ;0583 18 f4 . .
1141
1142 fact_mem:
1143 call expr1 ;0585 cd c1 03 . . .
1144 jr c,error4 ;0588 38 1d 8 .
1145 ld a,(de) ;058a 1a .
1146 cp ')' ;058b fe 29 . )
1147 jr nz,error4 ;058d 20 18 .
1148 inc de ;058f 13 .
1149 ld a,(hl) ;0590 7e ~
1150 inc hl ;0591 23 #
1151 ld h,(hl) ;0592 66 f
1152 ld l,a ;0593 6f o
1153 ld a,(de) ;0594 1a .
1154 inc de ;0595 13 .
1155 cp '.' ;0596 fe 2e . .
1156 ret z ;0598 c8 .
1157 dec de ;0599 1b .
1158 xor a ;059a af .
1159 ld h,a ;059b 67 g
1160 ret ;059c c9 .
1161
1162 expr_brckt:
1163 call expr1 ;059d cd c1 03 . . .
1164 jr c,error4 ;05a0 38 05 8 .
1165 ld a,(de) ;05a2 1a .
1166 cp ']' ;05a3 fe 5d . ]
1167 inc de ;05a5 13 .
1168 ret z ;05a6 c8 .
1169 error4:
1170 jp ERROR ;05a7 c3 07 01 . . .
1171
1172 get.number:
1173 call get.hexdigit ;05aa cd 11 06 . . .
1174 ret c ;05ad d8 .
1175 push de ;05ae d5 .
1176 test_number:
1177 inc de ;05af 13 .
1178 call get.hexdigit ;05b0 cd 11 06 . . .
1179 jr nc,test_number ;05b3 30 fa 0 .
1180 pop de ;05b5 d1 .
1181 cp '.' ;05b6 fe 2e . .
1182 jr z,get_dec_number ;05b8 28 36 ( 6
1183 cp '"' ;05ba fe 22 . "
1184 jr z,get_bin_number ;05bc 28 17 ( .
1185 ld hl,0 ;05be 21 00 00 ! . .
1186 next_hexdigit:
1187 call get.hexdigit ;05c1 cd 11 06 . . .
1188 jr c,hexnum_done ;05c4 38 0a 8 .
1189 add hl,hl ;05c6 29 )
1190 add hl,hl ;05c7 29 )
1191 add hl,hl ;05c8 29 )
1192 add hl,hl ;05c9 29 )
1193 call add_hl_a ;05ca cd b9 02 . . .
1194 inc de ;05cd 13 .
1195 jr next_hexdigit ;05ce 18 f1 . .
1196
1197 hexnum_done:
1198 xor 'H' ;05d0 ee 48 . H
1199 ret nz ;05d2 c0 .
1200 inc de ;05d3 13 .
1201 ret ;05d4 c9 .
1202
1203 get_bin_number:
1204 ld hl,0 ;05d5 21 00 00 ! . .
1205 next_bindigit:
1206 call get.bindigit ;05d8 cd 22 06 . " .
1207 l05dbh:
1208 inc de ;05db 13 .
1209 jr c,l05e4h ;05dc 38 06 8 .
1210 add hl,hl ;05de 29 )
1211 call add_hl_a ;05df cd b9 02 . . .
1212 jr next_bindigit ;05e2 18 f4 . .
1213 l05e4h:
1214 cp '"' ;05e4 fe 22 . "
1215 jp nz,ERROR ;05e6 c2 07 01 . . .
1216 call get.bindigit ;05e9 cd 22 06 . " .
1217 jr nc,l05dbh ;05ec 30 ed 0 .
1218 or a ;05ee b7 .
1219 ret ;05ef c9 .
1220
1221 get_dec_number:
1222 ld hl,0 ;05f0 21 00 00 ! . .
1223 next_decdigit:
1224 call get.decdigit ;05f3 cd 1d 06 . . .
1225 inc de ;05f6 13 .
1226 jr c,decnum_done ;05f7 38 0d 8 .
1227 push bc ;05f9 c5 .
1228 add hl,hl ;05fa 29 )
1229 ld b,h ;05fb 44 D
1230 ld c,l ;05fc 4d M
1231 add hl,hl ;05fd 29 )
1232 add hl,hl ;05fe 29 )
1233 add hl,bc ;05ff 09 .
1234 pop bc ;0600 c1 .
1235 call add_hl_a ;0601 cd b9 02 . . .
1236 jr next_decdigit ;0604 18 ed . .
1237 decnum_done:
1238 cp '.' ;0606 fe 2e . .
1239 ret z ;0608 c8 .
1240 jp ERROR ;0609 c3 07 01 . . .
1241
1242 sub_060ch:
1243 ld a,(de) ;060c 1a .
1244 cp '[' ;060d fe 5b . [
1245 jr l0614h ;060f 18 03 . .
1246
1247 get.hexdigit:
1248 ld a,(de) ;0611 1a .
1249 hex_digit:
1250 cp 'F'+1 ;0612 fe 47 . G
1251 l0614h:
1252 ccf ;0614 3f ?
1253 ret c ;0615 d8 .
1254 cp 'A' ;0616 fe 41 . A
1255 jr c,l061eh ;0618 38 04 8 .
1256 sub 'A'-10 ;061a d6 37 . 7
1257 ret ;061c c9 .
1258
1259 get.decdigit:
1260 ld a,(de) ;061d 1a .
1261 l061eh:
1262 cp '9'+1 ;061e fe 3a . :
1263 jr l0625h ;0620 18 03 . .
1264
1265 get.bindigit:
1266 ld a,(de) ;0622 1a .
1267 cp '1'+1 ;0623 fe 32 . 2
1268 l0625h:
1269 ccf ;0625 3f ?
1270 ret c ;0626 d8 .
1271 cp '0' ;0627 fe 30 . 0
1272 ret c ;0629 d8 .
1273 sub '0' ;062a d6 30 . 0
1274 ret ;062c c9 .
1275
1276 p_cpustat0:
1277 call assert_eol ;062d cd d6 02 . . .
1278 p_cpustat:
1279 call p_f ;0630 cd 6e 06 . n .
1280 call outbl2 ;0633 cd 9c 02 . . .
1281 ld hl,b_06e9_start ;0636 21 e9 06 ! . .
1282 ld de,b_0709_start ;0639 11 09 07 . . .
1283 ld b,6 ;063c 06 06 . .
1284 l063eh:
1285 call p_regs ;063e cd b2 06 . . .
1286 djnz l063eh ;0641 10 fb . .
1287 push hl ;0643 e5 .
1288 push de ;0644 d5 .
1289 ld iy,(REG.PC) ;0645 fd 2a 60 00 . * ` .
1290 call p_disas_instr ;0649 cd 65 19 . e .
1291 exx ;064c d9 .
1292 ex af,af' ;064d 08 .
1293 call crlf ;064e cd a3 02 . . .
1294 call p_f2 ;0651 cd 81 06 . . .
1295 call outbl2 ;0654 cd 9c 02 . . .
1296 pop de ;0657 d1 .
1297 pop hl ;0658 e1 .
1298 ld b,7 ;0659 06 07 . .
1299 l065bh:
1300 call p_regs ;065b cd b2 06 . . .
1301 djnz l065bh ;065e 10 fb . .
1302 exx ;0660 d9 .
1303 ex af,af' ;0661 08 .
1304 and a ;0662 a7 .
1305 jr z,l066bh ;0663 28 06 ( .
1306 call outbl6 ;0665 cd 96 02 . . .
1307 call p_offset ;0668 cd 49 19 . I .
1308 l066bh:
1309 jp crlf ;066b c3 a3 02 . . .
1310
1311 p_f:
1312 ld a,(reg.f) ;066e 3a 54 00 : T .
1313 call p_flags ;0671 cd 8a 06 . . .
1314 ld a,(reg.iff) ;0674 3a 5e 00 : ^ .
1315 cp 0f3h ;0677 fe f3 . .
1316 jp z,outbl ;0679 ca 9f 02 . . .
1317 ld a,'E' ;067c 3e 45 > E
1318 jp outchar ;067e c3 5d 02 . ] .
1319 p_f2:
1320 ld a,(reg.f2) ;0681 3a 4c 00 : L .
1321 call p_flags ;0684 cd 8a 06 . . .
1322 jp outbl ;0687 c3 9f 02 . . .
1323 p_flags:
1324 ld b,a ;068a 47 G
1325 ld a,'S' ;068b 3e 53 > S
1326 call sub_06aah ;068d cd aa 06 . . .
1327 ld a,'Z' ;0690 3e 5a > Z
1328 call sub_06aah ;0692 cd aa 06 . . .
1329 rl b ;0695 cb 10 . .
1330 ld a,'H' ;0697 3e 48 > H
1331 call sub_06aah ;0699 cd aa 06 . . .
1332 rl b ;069c cb 10 . .
1333 ld a,'V' ;069e 3e 56 > V
1334 call sub_06aah ;06a0 cd aa 06 . . .
1335 ld a,'N' ;06a3 3e 4e > N
1336 call sub_06aah ;06a5 cd aa 06 . . .
1337 ld a,'C' ;06a8 3e 43 > C
1338 sub_06aah:
1339 rl b ;06aa cb 10 . .
1340 jp c,outchar ;06ac da 5d 02 . ] .
1341 jp outbl ;06af c3 9f 02 . . .
1342
1343 p_regs:
1344 push bc ;06b2 c5 .
1345 push de ;06b3 d5 .
1346 call pstr ;06b4 cd 88 02 . . .
1347 ld a,'=' ;06b7 3e 3d > =
1348 call outchar ;06b9 cd 5d 02 . ] .
1349 ex (sp),hl ;06bc e3 .
1350 ld e,(hl) ;06bd 5e ^
1351 inc hl ;06be 23 #
1352 ld d,(hl) ;06bf 56 V
1353 inc hl ;06c0 23 #
1354 ld a,(hl) ;06c1 7e ~
1355 inc hl ;06c2 23 #
1356 push hl ;06c3 e5 .
1357 and a ;06c4 a7 .
1358 jr z,l06deh ;06c5 28 17 ( .
1359 push af ;06c7 f5 .
1360 ld a,(de) ;06c8 1a .
1361 ld l,a ;06c9 6f o
1362 inc de ;06ca 13 .
1363 ld a,(de) ;06cb 1a .
1364 ld h,a ;06cc 67 g
1365 pop af ;06cd f1 .
1366 dec a ;06ce 3d =
1367 jr z,l06d9h ;06cf 28 08 ( .
1368 call out.hl.@ ;06d1 cd a4 01 . . .
1369 call z,outbl6 ;06d4 cc 96 02 . . .
1370 jr l06e2h ;06d7 18 09 . .
1371 l06d9h:
1372 call out_hl ;06d9 cd 13 02 . . .
1373 jr l06e2h ;06dc 18 04 . .
1374 l06deh:
1375 ld a,(de) ;06de 1a .
1376 call out_hex ;06df cd 18 02 . . .
1377 l06e2h:
1378 call outbl ;06e2 cd 9f 02 . . .
1379 pop de ;06e5 d1 .
1380 pop hl ;06e6 e1 .
1381 pop bc ;06e7 c1 .
1382 ret ;06e8 c9 .
1383
1384 b_06e9_start:
1385 DC 'A '
1386 DC 'BC '
1387 DC 'DE '
1388 DC 'HL '
1389 DC 'SP'
1390 DC 'PC'
1391 DC 'A'''
1392 DC 'BC'''
1393 DC 'DE'''
1394 DC 'HL'''
1395 DC 'IX'
1396 DC 'IY'
1397 DC 'I'
1398 DB 0
1399
1400 b_0709_start:
1401 defw reg.a ;0709 55 00 U .
1402 defb 000h ;070b 00 .
1403 defw reg.c ;070c 56 00 V .
1404 defb 001h ;070e 01 .
1405 defw reg.e ;070f 58 00 X .
1406 defb 001h ;0711 01 .
1407 defw reg.l ;0712 5a 00 Z .
1408 defb 001h ;0714 01 .
1409 defw reg_sp ;0715 5c 00 \ .
1410 defb 001h ;0717 01 .
1411 defw REG.PC ;0718 60 00 ` .
1412 defb 002h ;071a 02 .
1413 defw reg.a2 ;071b 4d 00 M .
1414 defb 000h ;071d 00 .
1415 defw reg.c2 ;071e 4a 00 J .
1416 defb 001h ;0720 01 .
1417 defw reg.e2 ;0721 48 00 H .
1418 defb 001h ;0723 01 .
1419 defw reg.l2 ;0724 46 00 F .
1420 defb 001h ;0726 01 .
1421 defw reg.ix ;0727 52 00 R .
1422 defb 001h ;0729 01 .
1423 defw reg.iy ;072a 50 00 P .
1424 defb 001h ;072c 01 .
1425 defw reg.i ;072d 4f 00 O .
1426 defb 000h ;072f 00 .
1427 defb 000h ;0730 00 .
1428
1429 cmd_G:
1430 sub a ;0731 97 .
1431 ld (trace_call_flag),a ;0732 32 e3 21 2 . !
1432 ld (l0941h),a ;0735 32 41 09 2 A .
1433 call expr ;0738 cd be 03 . . .
1434 jr c,l0740h ;073b 38 03 8 .
1435 ld (REG.PC),hl ;073d 22 60 00 " ` .
1436 l0740h:
1437 call skipbl ;0740 cd bf 02 . . .
1438 jp z,user_go ;0743 ca 25 0a . % .
1439 cp ';' ;0746 fe 3b . ;
1440 jp nz,ERROR ;0748 c2 07 01 . . .
1441 inc de ;074b 13 .
1442 ld a,002h ;074c 3e 02 > .
1443 call bp_enter ;074e cd 10 08 . . .
1444 jp user_go ;0751 c3 25 0a . % .
1445
1446 bp_clr_temporary:
1447 ld b,BP_CNT ;0754 06 0c . .
1448 ld ix,bp_tab ;0756 dd 21 b8 0a . ! . .
1449 l075ah:
1450 ld a,(ix+000h) ;075a dd 7e 00 . ~ .
1451 and 0f1h ;075d e6 f1 . .
1452 ld (ix+000h),a ;075f dd 77 00 . w .
1453 call bp_clr_condition ;0762 cd 5f 0a . _ .
1454 ld de,BP_SIZE ;0765 11 08 00 . . .
1455 add ix,de ;0768 dd 19 . .
1456 djnz l075ah ;076a 10 ee . .
1457 ret ;076c c9 .
1458
1459 cmd_B:
1460 call skipbl ;076d cd bf 02 . . .
1461 jr z,l07b7h ;0770 28 45 ( E
1462 inc de ;0772 13 .
1463 cp 'X' ;0773 fe 58 . X
1464 jr z,l077dh ;0775 28 06 ( .
1465 dec de ;0777 1b .
1466 ld a,001h ;0778 3e 01 > .
1467 jp bp_enter ;077a c3 10 08 . . .
1468 l077dh:
1469 call skipbl ;077d cd bf 02 . . .
1470 jr z,bp_clr_all ;0780 28 10 ( .
1471 l0782h:
1472 call expr ;0782 cd be 03 . . .
1473 jp c,assert_eol ;0785 da d6 02 . . .
1474 push de ;0788 d5 .
1475 call bp_clr ;0789 cd 93 07 . . .
1476 pop de ;078c d1 .
1477 call next_arg ;078d cd ca 02 . . .
1478 jr l0782h ;0790 18 f0 . .
1479
1480 bp_clr_all:
1481 scf ;0792 37 7
1482 bp_clr:
1483 ld b,BP_CNT ;0793 06 0c . .
1484 ld ix,bp_tab ;0795 dd 21 b8 0a . ! . .
1485 l0799h:
1486 push af ;0799 f5 .
1487 jr c,l07a7h ;079a 38 0b 8 .
1488 ld e,(ix+002h) ;079c dd 5e 02 . ^ .
1489 ld d,(ix+003h) ;079f dd 56 03 . V .
1490 call cp_hl_de ;07a2 cd ee 02 . . .
1491 jr nz,l07aeh ;07a5 20 07 .
1492 l07a7h:
1493 ld (ix+000h),000h ;07a7 dd 36 00 00 . 6 . .
1494 call bp_clr_condition ;07ab cd 5f 0a . _ .
1495 l07aeh:
1496 ld de,BP_SIZE ;07ae 11 08 00 . . .
1497 add ix,de ;07b1 dd 19 . .
1498 pop af ;07b3 f1 .
1499 djnz l0799h ;07b4 10 e3 . .
1500 ret ;07b6 c9 .
1501
1502 l07b7h:
1503 ld b,BP_CNT ;07b7 06 0c . .
1504 ld ix,bp_tab ;07b9 dd 21 b8 0a . ! . .
1505 l07bdh:
1506 bit 0,(ix+000h) ;07bd dd cb 00 46 . . . F
1507 jr z,l0808h ;07c1 28 45 ( E
1508 ld a,'R' ;07c3 3e 52 > R
1509 bit 4,(ix+000h) ;07c5 dd cb 00 66 . . . f
1510 jr nz,l07cdh ;07c9 20 02 .
1511 ld a,' ' ;07cb 3e 20 >
1512 l07cdh:
1513 call outchar ;07cd cd 5d 02 . ] .
1514 call outbl ;07d0 cd 9f 02 . . .
1515 ld l,(ix+002h) ;07d3 dd 6e 02 . n .
1516 ld h,(ix+003h) ;07d6 dd 66 03 . f .
1517 call out.hl.@ ;07d9 cd a4 01 . . .
1518 call outbl2 ;07dc cd 9c 02 . . .
1519 ld a,':' ;07df 3e 3a > :
1520 call outchar ;07e1 cd 5d 02 . ] .
1521 ld l,(ix+004h) ;07e4 dd 6e 04 . n .
1522 ld h,(ix+005h) ;07e7 dd 66 05 . f .
1523 call out_hl ;07ea cd 13 02 . . .
1524 ld l,(ix+006h) ;07ed dd 6e 06 . n .
1525 ld h,(ix+007h) ;07f0 dd 66 07 . f .
1526 ld a,h ;07f3 7c |
1527 or l ;07f4 b5 .
1528 jr z,l0805h ;07f5 28 0e ( .
1529 call outbl4 ;07f7 cd 99 02 . . .
1530 ld a,'I' ;07fa 3e 49 > I
1531 call outchar ;07fc cd 5d 02 . ] .
1532 call outbl2 ;07ff cd 9c 02 . . .
1533 call pstr ;0802 cd 88 02 . . .
1534 l0805h:
1535 call crlf ;0805 cd a3 02 . . .
1536 l0808h:
1537 ld de,BP_SIZE ;0808 11 08 00 . . .
1538 add ix,de ;080b dd 19 . .
1539 djnz l07bdh ;080d 10 ae . .
1540 ret ;080f c9 .
1541
1542 ; Add break points to list
1543 ; A = 1 Permanent (B command)
1544 ; A = 2 Temporary (G command)
1545
1546 bp_enter:
1547 ld b,a ;0810 47 G
1548 call skipbl ;0811 cd bf 02 . . .
1549 ret z ;0814 c8 .
1550 cp 'R' ;0815 fe 52 . R
1551 jr nz,l081ch ;0817 20 03 .
1552 inc de ;0819 13 .
1553 set 4,b ;081a cb e0 . .
1554 l081ch:
1555 push bc ;081c c5 .
1556 call expr ;081d cd be 03 . . .
1557 jp c,ERROR ;0820 da 07 01 . . .
1558 pop bc ;0823 c1 .
1559 bit 0,b ;0824 cb 40 . @
1560 push bc ;0826 c5 .
1561 push de ;0827 d5 .
1562 push hl ;0828 e5 .
1563 call nz,bp_clr ;0829 c4 93 07 . . .
1564 pop hl ;082c e1 .
1565 call bp_get_freeslot ;082d cd 54 08 . T .
1566 pop de ;0830 d1 .
1567 ld (ix+002h),l ;0831 dd 75 02 . u .
1568 ld (ix+003h),h ;0834 dd 74 03 . t .
1569 call bp_get_count ;0837 cd 6c 08 . l .
1570 ld (ix+004h),l ;083a dd 75 04 . u .
1571 ld (ix+005h),h ;083d dd 74 05 . t .
1572 call bp_get_condition ;0840 cd 7d 08 . } .
1573 ld (ix+006h),l ;0843 dd 75 06 . u .
1574 ld (ix+007h),h ;0846 dd 74 07 . t .
1575 call next_arg ;0849 cd ca 02 . . .
1576 pop af ;084c f1 .
1577 ld (ix+000h),a ;084d dd 77 00 . w .
1578 and 00fh ;0850 e6 0f . .
1579 jr bp_enter ;0852 18 bc . .
1580
1581 bp_get_freeslot:
1582 ld b,BP_CNT ;0854 06 0c . .
1583 ld ix,bp_tab ;0856 dd 21 b8 0a . ! . .
1584 l085ah:
1585 ld a,(ix+000h) ;085a dd 7e 00 . ~ .
1586 and 00fh ;085d e6 0f . .
1587 ret z ;085f c8 .
1588 push bc ;0860 c5 .
1589 ld bc,BP_SIZE ;0861 01 08 00 . . .
1590 add ix,bc ;0864 dd 09 . .
1591 pop bc ;0866 c1 .
1592 djnz l085ah ;0867 10 f1 . .
1593 jp ERROR ;0869 c3 07 01 . . .
1594
1595 bp_get_count:
1596 call skipbl ;086c cd bf 02 . . .
1597 ld hl,1 ;086f 21 01 00 ! . .
1598 cp ':' ;0872 fe 3a . :
1599 ret nz ;0874 c0 .
1600 inc de ;0875 13 .
1601 call expr ;0876 cd be 03 . . .
1602 jp c,ERROR ;0879 da 07 01 . . .
1603 ret ;087c c9 .
1604
1605 bp_get_condition:
1606 call skipbl ;087d cd bf 02 . . .
1607 cp 'I' ;0880 fe 49 . I
1608 ld hl,0 ;0882 21 00 00 ! . .
1609 ret nz ;0885 c0 .
1610 inc de ;0886 13 .
1611 call skipbl ;0887 cd bf 02 . . .
1612 push de ;088a d5 .
1613 call expr ;088b cd be 03 . . .
1614 jp c,ERROR ;088e da 07 01 . . .
1615 ex de,hl ;0891 eb .
1616 pop de ;0892 d1 .
1617 push de ;0893 d5 .
1618 sbc hl,de ;0894 ed 52 . R
1619 ld b,h ;0896 44 D
1620 ld c,l ;0897 4d M
1621 ld hl,(expr_p1) ;0898 2a 18 0b * . .
1622 push hl ;089b e5 .
1623 add hl,bc ;089c 09 .
1624 ld de,expr_bufe ;089d 11 9c 0b . . .
1625 call cp_hl_de ;08a0 cd ee 02 . . .
1626 jp nc,ERROR ;08a3 d2 07 01 . . .
1627 pop hl ;08a6 e1 .
1628 ld (expr_p2),hl ;08a7 22 1a 0b " . .
1629 pop de ;08aa d1 .
1630 ex de,hl ;08ab eb .
1631 ldir ;08ac ed b0 . .
1632 xor a ;08ae af .
1633 ld (de),a ;08af 12 .
1634 inc de ;08b0 13 .
1635 ex de,hl ;08b1 eb .
1636 ld (expr_p1),hl ;08b2 22 18 0b " . .
1637 ld hl,(expr_p2) ;08b5 2a 1a 0b * . .
1638 ret ;08b8 c9 .
1639
1640 bpddtz:
1641 ld (reg.l),hl ;08b9 22 5a 00 " Z .
1642 pop hl ;08bc e1 .
1643 dec hl ;08bd 2b +
1644 ld (REG.PC),hl ;08be 22 60 00 " ` .
1645 ld (reg_sp),sp ;08c1 ed 73 5c 00 . s \ .
1646 ld sp,reg.l ;08c5 31 5a 00 1 Z .
1647 push de ;08c8 d5 .
1648 push bc ;08c9 c5 .
1649 push af ;08ca f5 .
1650 push ix ;08cb dd e5 . .
1651 push iy ;08cd fd e5 . .
1652 ld a,i ;08cf ed 57 . W
1653 call sub_0004h ;08d1 cd 04 00 . . .
1654 ld h,a ;08d4 67 g
1655 ld l,000h ;08d5 2e 00 . .
1656 push hl ;08d7 e5 .
1657 ld a,0f3h ;08d8 3e f3 > .
1658 jp po,l08dfh ;08da e2 df 08 . . .
1659 ld a,0fbh ;08dd 3e fb > .
1660 l08dfh:
1661 ld (reg.iff),a ;08df 32 5e 00 2 ^ .
1662 ex af,af' ;08e2 08 .
1663 push af ;08e3 f5 .
1664 exx ;08e4 d9 .
1665 push bc ;08e5 c5 .
1666 push de ;08e6 d5 .
1667 push hl ;08e7 e5 .
1668 call sub_097ah ;08e8 cd 7a 09 . z .
1669 ld a,(b_21e2_start) ;08eb 3a e2 21 : . !
1670 dec a ;08ee 3d =
1671 jr z,l090bh ;08ef 28 1a ( .
1672 call inchar ;08f1 cd 73 02 . s .
1673 jr c,l0902h ;08f4 38 0c 8 .
1674 call sub_0913h ;08f6 cd 13 09 . . .
1675 and a ;08f9 a7 .
1676 jp z,user_go ;08fa ca 25 0a . % .
1677 and 083h ;08fd e6 83 . .
1678 jp z,l2151h ;08ff ca 51 21 . Q !
1679 l0902h:
1680 call bp_clr_temporary ;0902 cd 54 07 . T .
1681 call p_cpustat ;0905 cd 30 06 . 0 .
1682 jp mainloop ;0908 c3 bd 00 . . .
1683
1684 l090bh:
1685 ld (b_21e2_start),a ;090b 32 e2 21 2 . !
1686 ld c,007h ;090e 0e 07 . .
1687 jp l0a41h ;0910 c3 41 0a . A .
1688
1689 sub_0913h:
1690 ld a,080h ;0913 3e 80 > .
1691 ex af,af' ;0915 08 .
1692 sub a ;0916 97 .
1693 ld (l0941h),a ;0917 32 41 09 2 A .
1694 ld b,BP_CNT ;091a 06 0c . .
1695 ld ix,bp_tab ;091c dd 21 b8 0a . ! . .
1696 l0920h:
1697 ld a,(ix+000h) ;0920 dd 7e 00 . ~ .
1698 and 007h ;0923 e6 07 . .
1699 jr z,l0938h ;0925 28 11 ( .
1700 ld e,(ix+002h) ;0927 dd 5e 02 . ^ .
1701 ld d,(ix+003h) ;092a dd 56 03 . V .
1702 ld hl,(REG.PC) ;092d 2a 60 00 * ` .
1703 call cp_hl_de ;0930 cd ee 02 . . .
1704 push bc ;0933 c5 .
1705 call z,sub_0942h ;0934 cc 42 09 . B .
1706 pop bc ;0937 c1 .
1707 l0938h:
1708 ld de,BP_SIZE ;0938 11 08 00 . . .
1709 add ix,de ;093b dd 19 . .
1710 djnz l0920h ;093d 10 e1 . .
1711 ex af,af' ;093f 08 .
1712 ret ;0940 c9 .
1713
1714 l0941h:
1715 db 0 ;0941 00 .
1716
1717 sub_0942h:
1718 ex af,af' ;0942 08 .
1719 res 7,a ;0943 cb bf . .
1720 ex af,af' ;0945 08 .
1721 ld e,(ix+006h) ;0946 dd 5e 06 . ^ .
1722 ld d,(ix+007h) ;0949 dd 56 07 . V .
1723 ld a,d ;094c 7a z
1724 or e ;094d b3 .
1725 ld hl,0ffffh ;094e 21 ff ff ! . .
1726 call nz,expr ;0951 c4 be 03 . . .
1727 ld a,h ;0954 7c |
1728 or l ;0955 b5 .
1729 jr z,l0969h ;0956 28 11 ( .
1730 ld e,(ix+004h) ;0958 dd 5e 04 . ^ .
1731 ld d,(ix+005h) ;095b dd 56 05 . V .
1732 dec de ;095e 1b .
1733 ld a,d ;095f 7a z
1734 or e ;0960 b3 .
1735 jr z,l0974h ;0961 28 11 ( .
1736 ld (ix+004h),e ;0963 dd 73 04 . s .
1737 ld (ix+005h),d ;0966 dd 72 05 . r .
1738 l0969h:
1739 bit 4,(ix+000h) ;0969 dd cb 00 66 . . . f
1740 ret z ;096d c8 .
1741 ld a,001h ;096e 3e 01 > .
1742 ld (l0941h),a ;0970 32 41 09 2 A .
1743 ret ;0973 c9 .
1744 l0974h:
1745 ex af,af' ;0974 08 .
1746 or (ix+000h) ;0975 dd b6 00 . . .
1747 ex af,af' ;0978 08 .
1748 ret ;0979 c9 .
1749
1750 sub_097ah:
1751 ld b,BP_CNT ;097a 06 0c . .
1752 ld ix,bp_tab ;097c dd 21 b8 0a . ! . .
1753 l0980h:
1754 bit 5,(ix+000h) ;0980 dd cb 00 6e . . . n
1755 res 5,(ix+000h) ;0984 dd cb 00 ae . . . .
1756 jr z,l099ah ;0988 28 10 ( .
1757 ld l,(ix+002h) ;098a dd 6e 02 . n .
1758 ld h,(ix+003h) ;098d dd 66 03 . f .
1759 ld a,(l0003h) ;0990 3a 03 00 : . .
1760 cp (hl) ;0993 be .
1761 jr nz,l099ah ;0994 20 04 .
1762 ld a,(ix+001h) ;0996 dd 7e 01 . ~ .
1763 ld (hl),a ;0999 77 w
1764 l099ah:
1765 res 3,(ix+000h) ;099a dd cb 00 9e . . . .
1766 ld de,BP_SIZE ;099e 11 08 00 . . .
1767 add ix,de ;09a1 dd 19 . .
1768 djnz l0980h ;09a3 10 db . .
1769 ret ;09a5 c9 .
1770
1771 sub_09a6h:
1772 ld b,BP_CNT ;09a6 06 0c . .
1773 ld ix,bp_tab ;09a8 dd 21 b8 0a . ! . .
1774 l09ach:
1775 ld a,(ix+000h) ;09ac dd 7e 00 . ~ .
1776 and 003h ;09af e6 03 . .
1777 jr z,l09c0h ;09b1 28 0d ( .
1778 ld e,(ix+002h) ;09b3 dd 5e 02 . ^ .
1779 ld d,(ix+003h) ;09b6 dd 56 03 . V .
1780 ld hl,(REG.PC) ;09b9 2a 60 00 * ` .
1781 call cp_hl_de ;09bc cd ee 02 . . .
1782 ret z ;09bf c8 .
1783 l09c0h:
1784 ld de,BP_SIZE ;09c0 11 08 00 . . .
1785 add ix,de ;09c3 dd 19 . .
1786 djnz l09ach ;09c5 10 e5 . .
1787 sub a ;09c7 97 .
1788 inc a ;09c8 3c <
1789 ret ;09c9 c9 .
1790
1791 sub_09cah:
1792 call bp_get_freeslot ;09ca cd 54 08 . T .
1793 ld (ix+004h),001h ;09cd dd 36 04 01 . 6 . .
1794 ld (ix+005h),000h ;09d1 dd 36 05 00 . 6 . .
1795 ld (ix+002h),l ;09d5 dd 75 02 . u .
1796 ld (ix+003h),h ;09d8 dd 74 03 . t .
1797 ld (ix+006h),000h ;09db dd 36 06 00 . 6 . .
1798 ld (ix+007h),000h ;09df dd 36 07 00 . 6 . .
1799 ld a,(b_21e2_start) ;09e3 3a e2 21 : . !
1800 and a ;09e6 a7 .
1801 ld a,008h ;09e7 3e 08 > .
1802 jr nz,l09edh ;09e9 20 02 .
1803 ld a,004h ;09eb 3e 04 > .
1804 l09edh:
1805 ld (ix+000h),a ;09ed dd 77 00 . w .
1806 ret ;09f0 c9 .
1807
1808 sub_09f1h:
1809 ld b,BP_CNT ;09f1 06 0c . .
1810 ld ix,bp_tab ;09f3 dd 21 b8 0a . ! . .
1811 l09f7h:
1812 ld a,(ix+000h) ;09f7 dd 7e 00 . ~ .
1813 and c ;09fa a1 .
1814 jr z,l0a1dh ;09fb 28 20 (
1815 set 5,(ix+000h) ;09fd dd cb 00 ee . . . .
1816 ld l,(ix+002h) ;0a01 dd 6e 02 . n .
1817 ld h,(ix+003h) ;0a04 dd 66 03 . f .
1818 ld a,(hl) ;0a07 7e ~
1819 ld (ix+001h),a ;0a08 dd 77 01 . w .
1820 ld a,(l0003h) ;0a0b 3a 03 00 : . .
1821 ld (hl),a ;0a0e 77 w
1822 and 038h ;0a0f e6 38 . 8
1823 ld h,000h ;0a11 26 00 & .
1824 ld l,a ;0a13 6f o
1825 ld (hl),0c3h ;0a14 36 c3 6 .
1826 inc hl ;0a16 23 #
1827 ld de,bpddtz ;0a17 11 b9 08 . . .
1828 ld (hl),e ;0a1a 73 s
1829 inc hl ;0a1b 23 #
1830 ld (hl),d ;0a1c 72 r
1831 l0a1dh:
1832 ld de,BP_SIZE ;0a1d 11 08 00 . . .
1833 add ix,de ;0a20 dd 19 . .
1834 djnz l09f7h ;0a22 10 d3 . .
1835 ret ;0a24 c9 .
1836
1837 user_go:
1838 sub a ;0a25 97 .
1839 ld (b_21e2_start),a ;0a26 32 e2 21 2 . !
1840 ld a,(l0941h) ;0a29 3a 41 09 : A .
1841 and a ;0a2c a7 .
1842 call nz,p_cpustat ;0a2d c4 30 06 . 0 .
1843 call sub_09a6h ;0a30 cd a6 09 . . .
1844 ld c,007h ;0a33 0e 07 . .
1845 jr nz,l0a41h ;0a35 20 0a .
1846 ld a,001h ;0a37 3e 01 > .
1847 ld (b_21e2_start),a ;0a39 32 e2 21 2 . !
1848 call sub_1ffeh ;0a3c cd fe 1f . . .
1849 ld c,008h ;0a3f 0e 08 . .
1850 l0a41h:
1851 call sub_09f1h ;0a41 cd f1 09 . . .
1852 ld sp,reg.l2 ;0a44 31 46 00 1 F .
1853 pop hl ;0a47 e1 .
1854 pop de ;0a48 d1 .
1855 pop bc ;0a49 c1 .
1856 pop af ;0a4a f1 .
1857 exx ;0a4b d9 .
1858 ex af,af' ;0a4c 08 .
1859 pop af ;0a4d f1 .
1860 ld i,a ;0a4e ed 47 . G
1861 pop iy ;0a50 fd e1 . .
1862 pop ix ;0a52 dd e1 . .
1863 pop af ;0a54 f1 .
1864 pop bc ;0a55 c1 .
1865 pop de ;0a56 d1 .
1866 pop hl ;0a57 e1 .
1867 ld sp,(reg_sp) ;0a58 ed 7b 5c 00 . { \ .
1868 jp reg.iff ;0a5c c3 5e 00 . ^ .
1869
1870 bp_clr_condition:
1871 ld a,(ix+000h) ;0a5f dd 7e 00 . ~ .
1872 and 003h ;0a62 e6 03 . .
1873 ret nz ;0a64 c0 .
1874 ld e,(ix+006h) ;0a65 dd 5e 06 . ^ .
1875 ld d,(ix+007h) ;0a68 dd 56 07 . V .
1876 ld a,d ;0a6b 7a z
1877 or e ;0a6c b3 .
1878 ret z ;0a6d c8 .
1879 push bc ;0a6e c5 .
1880 ld h,d ;0a6f 62 b
1881 ld l,e ;0a70 6b k
1882 sub a ;0a71 97 .
1883 ld (ix+006h),a ;0a72 dd 77 06 . w .
1884 ld (ix+007h),a ;0a75 dd 77 07 . w .
1885 ld bc,0ffffh ;0a78 01 ff ff . . .
1886 cpir ;0a7b ed b1 . .
1887 l0a7dh:
1888 push de ;0a7d d5 .
1889 ld de,(expr_p1) ;0a7e ed 5b 18 0b . [ . .
1890 call cp_hl_de ;0a82 cd ee 02 . . .
1891 pop de ;0a85 d1 .
1892 jr nc,l0a93h ;0a86 30 0b 0 .
1893 call sub_0a99h ;0a88 cd 99 0a . . .
1894 l0a8bh:
1895 ld a,(hl) ;0a8b 7e ~
1896 ldi ;0a8c ed a0 . .
1897 and a ;0a8e a7 .
1898 jr nz,l0a8bh ;0a8f 20 fa .
1899 jr l0a7dh ;0a91 18 ea . .
1900 l0a93h:
1901 ld (expr_p1),de ;0a93 ed 53 18 0b . S . .
1902 pop bc ;0a97 c1 .
1903 ret ;0a98 c9 .
1904
1905 sub_0a99h:
1906 ld iy,bp_tab ;0a99 fd 21 b8 0a . ! . .
1907 push de ;0a9d d5 .
1908 l0a9eh:
1909 ld e,(iy+006h) ;0a9e fd 5e 06 . ^ .
1910 ld d,(iy+007h) ;0aa1 fd 56 07 . V .
1911 call cp_hl_de ;0aa4 cd ee 02 . . .
1912 jr z,l0ab0h ;0aa7 28 07 ( .
1913 ld de,BP_SIZE ;0aa9 11 08 00 . . .
1914 add iy,de ;0aac fd 19 . .
1915 jr l0a9eh ;0aae 18 ee . .
1916 l0ab0h:
1917 pop de ;0ab0 d1 .
1918 ld (iy+006h),e ;0ab1 fd 73 06 . s .
1919 ld (iy+007h),d ;0ab4 fd 72 07 . r .
1920 ret ;0ab7 c9 .
1921
1922 bp_tab:
1923 rept BP_CNT
1924 rept BP_SIZE
1925 db 0
1926 endm
1927 endm
1928
1929 expr_p1:
1930 defw expr_buf ;0b18 1c 0b . .
1931 expr_p2:
1932 defw expr_buf ;0b1a 1c 0b . .
1933
1934 expr_buf:
1935 db 'DDT/180',TAB
1936 db '[8101] 001',CR,LF,'$'
1937
1938 ds EXPR_BUF_SIZE - ($ - expr_buf)
1939 expr_bufe:
1940
1941 msg_Y:
1942 dc 'Yn' ;0b9c 59 ee Y n.
1943 reg_Y:
1944 rept YREG_CNT
1945 dw 0
1946 endm
1947
1948 cmd_Y:
1949 call get.decdigit ;0bb2 cd 1d 06 . . .
1950 jr c,l0bc3h ;0bb5 38 0c 8 .
1951 inc de ;0bb7 13 .
1952 push af ;0bb8 f5 .
1953 call assert_eol ;0bb9 cd d6 02 . . .
1954 pop af ;0bbc f1 .
1955 call sub_0bdch ;0bbd cd dc 0b . . .
1956 jp l0c15h ;0bc0 c3 15 0c . . .
1957 l0bc3h:
1958 call assert_eol ;0bc3 cd d6 02 . . .
1959 xor a ;0bc6 af .
1960 l0bc7h:
1961 push af ;0bc7 f5 .
1962 call sub_0bdch ;0bc8 cd dc 0b . . .
1963 call outbl4 ;0bcb cd 99 02 . . .
1964 pop af ;0bce f1 .
1965 inc a ;0bcf 3c <
1966 bit 0,a ;0bd0 cb 47 . G
1967 push af ;0bd2 f5 .
1968 call z,crlf ;0bd3 cc a3 02 . . .
1969 pop af ;0bd6 f1 .
1970 cp YREG_CNT ;0bd7 fe 0a . .
1971 jr c,l0bc7h ;0bd9 38 ec 8 .
1972 ret ;0bdb c9 .
1973
1974 sub_0bdch:
1975 ld c,a ;0bdc 4f O
1976 ld b,0 ;0bdd 06 00 . .
1977 add a,'0'+080h ;0bdf c6 b0 . .
1978 ld de,msg_Y+1 ;0be1 11 9d 0b . . .
1979 ld (de),a ;0be4 12 .
1980 dec de ;0be5 1b .
1981 ld hl,reg_Y ;0be6 21 9e 0b ! . .
1982 add hl,bc ;0be9 09 .
1983 add hl,bc ;0bea 09 .
1984 ex de,hl ;0beb eb .
1985 ld c,003h ;0bec 0e 03 . .
1986 jp l0c33h ;0bee c3 33 0c . 3 .
1987
1988 cmd_X:
1989 call skipbl ;0bf1 cd bf 02 . . .
1990 call sub_0caeh ;0bf4 cd ae 0c . . .
1991 jp nc,p_cpustat0 ;0bf7 d2 2d 06 . - .
1992 call assert_eol ;0bfa cd d6 02 . . .
1993 ld a,b ;0bfd 78 x
1994 cp 01eh ;0bfe fe 1e . .
1995 jr z,l0c5fh ;0c00 28 5d ( ]
1996 cp 01fh ;0c02 fe 1f . .
1997 jr z,l0c4fh ;0c04 28 49 ( I
1998 cp 01dh ;0c06 fe 1d . .
1999 jp z,ERROR ;0c08 ca 07 01 . . .
2000 ex de,hl ;0c0b eb .
2001 ld hl,b_0cc3_start ;0c0c 21 c3 0c ! . .
2002 call sel_dc_string ;0c0f cd 3d 03 . = .
2003 l0c12h:
2004 call l0c33h ;0c12 cd 33 0c . 3 .
2005 l0c15h:
2006 call outbl ;0c15 cd 9f 02 . . .
2007 push de ;0c18 d5 .
2008 push bc ;0c19 c5 .
2009 call get_line ;0c1a cd 4e 01 . N .
2010 call skipbl ;0c1d cd bf 02 . . .
2011 jr z,l0c30h ;0c20 28 0e ( .
2012 call sub_0363h ;0c22 cd 63 03 . c .
2013 ld b,h ;0c25 44 D
2014 ld c,l ;0c26 4d M
2015 pop af ;0c27 f1 .
2016 pop hl ;0c28 e1 .
2017 ld (hl),c ;0c29 71 q
2018 bit 0,a ;0c2a cb 47 . G
2019 ret z ;0c2c c8 .
2020 inc hl ;0c2d 23 #
2021 ld (hl),b ;0c2e 70 p
2022 ret ;0c2f c9 .
2023 l0c30h:
2024 pop af ;0c30 f1 .
2025 pop hl ;0c31 e1 .
2026 ret ;0c32 c9 .
2027 l0c33h:
2028 ld b,c ;0c33 41 A
2029 call pstr ;0c34 cd 88 02 . . .
2030 ld a,'=' ;0c37 3e 3d > =
2031 call outchar ;0c39 cd 5d 02 . ] .
2032 ld a,(de) ;0c3c 1a .
2033 bit 0,b ;0c3d cb 40 . @
2034 jp z,out_hex ;0c3f ca 18 02 . . .
2035 ld l,a ;0c42 6f o
2036 inc de ;0c43 13 .
2037 ld a,(de) ;0c44 1a .
2038 dec de ;0c45 1b .
2039 ld h,a ;0c46 67 g
2040 bit 1,b ;0c47 cb 48 . H
2041 jp z,out_hl ;0c49 ca 13 02 . . .
2042 jp out.hl.@ ;0c4c c3 a4 01 . . .
2043
2044 l0c4fh:
2045 call p_f ;0c4f cd 6e 06 . n .
2046 ld a,0f3h ;0c52 3e f3 > .
2047 ld (reg.iff),a ;0c54 32 5e 00 2 ^ .
2048 scf ;0c57 37 7
2049 call sub_0c6ah ;0c58 cd 6a 0c . j .
2050 ld (reg.f),a ;0c5b 32 54 00 2 T .
2051 ret ;0c5e c9 .
2052 l0c5fh:
2053 call p_f2 ;0c5f cd 81 06 . . .
2054 and a ;0c62 a7 .
2055 call sub_0c6ah ;0c63 cd 6a 0c . j .
2056 ld (reg.f2),a ;0c66 32 4c 00 2 L .
2057 ret ;0c69 c9 .
2058 sub_0c6ah:
2059 ex af,af' ;0c6a 08 .
2060 ld b,000h ;0c6b 06 00 . .
2061 call outbl ;0c6d cd 9f 02 . . .
2062 call assert_eol ;0c70 cd d6 02 . . .
2063 call get_line ;0c73 cd 4e 01 . N .
2064 l0c76h:
2065 call skipbl ;0c76 cd bf 02 . . .
2066 ld a,b ;0c79 78 x
2067 ret z ;0c7a c8 .
2068 push bc ;0c7b c5 .
2069 ld hl,b_0ca4_start ;0c7c 21 a4 0c ! . .
2070 call lookupch ;0c7f cd f3 02 . . .
2071 jp nc,ERROR ;0c82 d2 07 01 . . .
2072 ld a,b ;0c85 78 x
2073 cp 008h ;0c86 fe 08 . .
2074 jr z,l0c97h ;0c88 28 0d ( .
2075 pop bc ;0c8a c1 .
2076 rlca ;0c8b 07 .
2077 rlca ;0c8c 07 .
2078 rlca ;0c8d 07 .
2079 add a,0c0h ;0c8e c6 c0 . .
2080 ld (l0c94h),a ;0c90 32 94 0c 2 . .
2081 defb 0cbh ;0c93 cb .
2082 l0c94h:
2083 defb 0c0h ;0c94 c0 .
2084 jr l0c76h ;0c95 18 df . .
2085 l0c97h:
2086 ex af,af' ;0c97 08 .
2087 jp nc,ERROR ;0c98 d2 07 01 . . .
2088 ex af,af' ;0c9b 08 .
2089 ld a,0fbh ;0c9c 3e fb > .
2090 ld (reg.iff),a ;0c9e 32 5e 00 2 ^ .
2091 pop bc ;0ca1 c1 .
2092 jr l0c76h ;0ca2 18 d2 . .
2093
2094 b_0ca4_start:
2095 db 'CNV H ZSE',0
2096
2097 sub_0caeh:
2098 call sub_0303h ;0cae cd 03 03 . . .
2099 ret nc ;0cb1 d0 .
2100 ld a,b ;0cb2 78 x
2101 add a,b ;0cb3 80 .
2102 add a,b ;0cb4 80 .
2103 ld hl,b_0cfa_start ;0cb5 21 fa 0c ! . .
2104 call add_hl_a ;0cb8 cd b9 02 . . .
2105 ld c,(hl) ;0cbb 4e N
2106 inc hl ;0cbc 23 #
2107 ld a,(hl) ;0cbd 7e ~
2108 inc hl ;0cbe 23 #
2109 ld h,(hl) ;0cbf 66 f
2110 ld l,a ;0cc0 6f o
2111 scf ;0cc1 37 7
2112 ret ;0cc2 c9 .
2113
2114 b_0cc3_start:
2115 DC 'BC'''
2116 DC 'DE'''
2117 DC 'HL'''
2118 DC 'BC'
2119 DC 'DE'
2120 DC 'HL'
2121 DC 'A'''
2122 DC 'B'''
2123 DC 'C'''
2124 DC 'D'''
2125 DC 'E'''
2126 DC 'H'''
2127 DC 'L'''
2128 DC 'A'
2129 DC 'B'
2130 DC 'C'
2131 DC 'D'
2132 DC 'E'
2133 DC 'H'
2134 DC 'L'
2135 DC 'IX'
2136 DC 'IY'
2137 DC 'SP'
2138 DC 'PC'
2139 DC 'X'
2140 DC 'Y'
2141 DC 'S'
2142 DC 'P'
2143 DC 'I'
2144 DC 'IP'
2145 DC 'F'''
2146 DC 'F'
2147 DB 0
2148
2149 b_0cfa_start:
2150 defb 003h ;0cfa 03 .
2151 defw reg.c2 ;0cfb 4a 00 J .
2152 defb 003h ;0cfd 03 .
2153 defw reg.e2 ;0cfe 48 00 H .
2154 defb 003h ;0d00 03 .
2155 defw reg.l2 ;0d01 46 00 F .
2156 defb 003h ;0d03 03 .
2157 defw reg.c ;0d04 56 00 V .
2158 defb 003h ;0d06 03 .
2159 defw reg.e ;0d07 58 00 X .
2160 defb 003h ;0d09 03 .
2161 defw reg.l ;0d0a 5a 00 Z .
2162 defb 000h ;0d0c 00 .
2163 defw reg.a2 ;0d0d 4d 00 M .
2164 defb 000h ;0d0f 00 .
2165 defw reg.b2 ;0d10 4b 00 K .
2166 defb 000h ;0d12 00 .
2167 defw reg.c2 ;0d13 4a 00 J .
2168 defb 000h ;0d15 00 .
2169 defw reg.d2 ;0d16 49 00 I .
2170 defb 000h ;0d18 00 .
2171 defw reg.e2 ;0d19 48 00 H .
2172 defb 000h ;0d1b 00 .
2173 defw reg.h2 ;0d1c 47 00 G .
2174 defb 000h ;0d1e 00 .
2175 defw reg.l2 ;0d1f 46 00 F .
2176 defb 000h ;0d21 00 .
2177 defw reg.a ;0d22 55 00 U .
2178 defb 000h ;0d24 00 .
2179 defw reg.b ;0d25 57 00 W .
2180 defb 000h ;0d27 00 .
2181 defw reg.c ;0d28 56 00 V .
2182 defb 000h ;0d2a 00 .
2183 defw reg.d ;0d2b 59 00 Y .
2184 defb 000h ;0d2d 00 .
2185 defw reg.e ;0d2e 58 00 X .
2186 defb 000h ;0d30 00 .
2187 defw reg.h ;0d31 5b 00 [ .
2188 defb 000h ;0d33 00 .
2189 defw reg.l ;0d34 5a 00 Z .
2190 defb 003h ;0d36 03 .
2191 defw reg.ix ;0d37 52 00 R .
2192 defb 003h ;0d39 03 .
2193 defw reg.iy ;0d3a 50 00 P .
2194 defb 003h ;0d3c 03 .
2195 defw reg_sp ;0d3d 5c 00 \ .
2196 defb 003h ;0d3f 03 .
2197 defw REG.PC ;0d40 60 00 ` .
2198 defb 003h ;0d42 03 .
2199 defw reg.ix ;0d43 52 00 R .
2200 defb 003h ;0d45 03 .
2201 defw reg.iy ;0d46 50 00 P .
2202 defb 003h ;0d48 03 .
2203 defw reg_sp ;0d49 5c 00 \ .
2204 defb 003h ;0d4b 03 .
2205 defw REG.PC ;0d4c 60 00 ` .
2206 defb 000h ;0d4e 00 .
2207 defw reg.i ;0d4f 4f 00 O .
2208 defb 003h ;0d51 03 .
2209 defw l004eh ;0d52 4e 00 N .
2210 defb 000h ;0d54 00 .
2211 defw reg.f2 ;0d55 4c 00 L .
2212 defb 000h ;0d57 00 .
2213 defw reg.f ;0d58 54 00 T .
2214
2215 cmd_S:
2216 ld hl,(last_S) ;0d5a 2a 90 0d * . .
2217 call get_lastarg_def ;0d5d cd 69 03 . i .
2218 l0d60h:
2219 ld (last_S),hl ;0d60 22 90 0d " . .
2220 call out.hl.@ ;0d63 cd a4 01 . . .
2221 call outbl ;0d66 cd 9f 02 . . .
2222 ld a,(hl) ;0d69 7e ~
2223 call out_hex ;0d6a cd 18 02 . . .
2224 call outbl2 ;0d6d cd 9c 02 . . .
2225 call get_line ;0d70 cd 4e 01 . N .
2226 call skipbl ;0d73 cd bf 02 . . .
2227 inc hl ;0d76 23 #
2228 jr z,l0d60h ;0d77 28 e7 ( .
2229 dec hl ;0d79 2b +
2230 inc de ;0d7a 13 .
2231 cp '.' ;0d7b fe 2e . .
2232 jp z,assert_eol ;0d7d ca d6 02 . . .
2233 cp '-' ;0d80 fe 2d . -
2234 jr nz,l0d8ah ;0d82 20 06 .
2235 ld a,(de) ;0d84 1a .
2236 or a ;0d85 b7 .
2237 dec hl ;0d86 2b +
2238 jr z,l0d60h ;0d87 28 d7 ( .
2239 inc hl ;0d89 23 #
2240 l0d8ah:
2241 dec de ;0d8a 1b .
2242 call sub_0ef8h ;0d8b cd f8 0e . . .
2243 jr l0d60h ;0d8e 18 d0 . .
2244
2245 last_S:
2246 defw TPA ;0d90 00 01 . .
2247 cmd_@:
2248 call assert_eol ;0d92 cd d6 02 . . .
2249 ld hl,msg_offset ;0d95 21 a0 0d ! . .
2250 ld de,offs.@ ;0d98 11 64 00 . d .
2251 ld c,001h ;0d9b 0e 01 . .
2252 jp l0c12h ;0d9d c3 12 0c . . .
2253
2254 msg_offset:
2255 dc '@' ;0da0 c0 .
2256
2257 last_I:
2258 defw 0 ;0da1 00 00 . .
2259 cmd_I:
2260 ld hl,cmd_I ;0da3 21 a3 0d ! . .
2261 ld (cmd_rpt),hl ;0da6 22 68 00 " h .
2262 ld hl,(last_I) ;0da9 2a a1 0d * . .
2263 call get_lastarg_def ;0dac cd 69 03 . i .
2264 ld (last_I),hl ;0daf 22 a1 0d " . .
2265 ld b,h ;0db2 44 D
2266 ld c,l ;0db3 4d M
2267 in a,(c) ;0db4 ed 78 . x
2268 push af ;0db6 f5 .
2269 call out_hex ;0db7 cd 18 02 . . .
2270 call outbl4 ;0dba cd 99 02 . . .
2271 pop af ;0dbd f1 .
2272 call out.bin.b ;0dbe cd c7 01 . . .
2273 jp crlf ;0dc1 c3 a3 02 . . .
2274
2275 last_O_addr:
2276 dw 0 ;0dc4 00 .
2277 last_O_val:
2278 db 0 ;0dc6 00 .
2279 cmd_O:
2280 ld hl,cmd_O ;0dc7 21 c7 0d ! . .
2281 ld (cmd_rpt),hl ;0dca 22 68 00 " h .
2282 ld hl,(last_O_val) ;0dcd 2a c6 0d * . .
2283 call get_arg_def ;0dd0 cd 6e 03 . n .
2284 ld a,l ;0dd3 7d }
2285 ld (last_O_val),a ;0dd4 32 c6 0d 2 . .
2286 push af ;0dd7 f5 .
2287 call next_arg ;0dd8 cd ca 02 . . .
2288 ld hl,(last_O_addr) ;0ddb 2a c4 0d * . .
2289 call get_lastarg_def ;0dde cd 69 03 . i .
2290 ld (last_O_addr),hl ;0de1 22 c4 0d " . .
2291 ld b,h ;0de4 44 D
2292 ld c,l ;0de5 4d M
2293 pop af ;0de6 f1 .
2294 out (c),a ;0de7 ed 79 . y
2295 ret ;0de9 c9 .
2296
2297 cmd_V:
2298 call sub_034eh ;0dea cd 4e 03 . N .
2299 l0dedh:
2300 push bc ;0ded c5 .
2301 ld a,(de) ;0dee 1a .
2302 ld b,(hl) ;0def 46 F
2303 cp b ;0df0 b8 .
2304 jr z,l0e10h ;0df1 28 1d ( .
2305 ld c,a ;0df3 4f O
2306 call out.hl.@ ;0df4 cd a4 01 . . .
2307 call outbl ;0df7 cd 9f 02 . . .
2308 ld a,b ;0dfa 78 x
2309 call out_hex ;0dfb cd 18 02 . . .
2310 call outbl2 ;0dfe cd 9c 02 . . .
2311 ld a,c ;0e01 79 y
2312 call out_hex ;0e02 cd 18 02 . . .
2313 call outbl ;0e05 cd 9f 02 . . .
2314 ex de,hl ;0e08 eb .
2315 call out.hl.@ ;0e09 cd a4 01 . . .
2316 ex de,hl ;0e0c eb .
2317 call crlf ;0e0d cd a3 02 . . .
2318 l0e10h:
2319 pop bc ;0e10 c1 .
2320 inc hl ;0e11 23 #
2321 inc de ;0e12 13 .
2322 dec bc ;0e13 0b .
2323 ld a,b ;0e14 78 x
2324 or c ;0e15 b1 .
2325 jr nz,l0dedh ;0e16 20 d5 .
2326 ret ;0e18 c9 .
2327
2328 cmd_M:
2329 ld a,(de) ;0e19 1a .
2330 cp 'V' ;0e1a fe 56 . V
2331 jr nz,l0e1fh ;0e1c 20 01 .
2332 inc de ;0e1e 13 .
2333 l0e1fh:
2334 push af ;0e1f f5 .
2335 call sub_034eh ;0e20 cd 4e 03 . N .
2336 push hl ;0e23 e5 .
2337 push de ;0e24 d5 .
2338 push bc ;0e25 c5 .
2339 call cp_hl_de ;0e26 cd ee 02 . . .
2340 jr nc,$+11 ;0e29 30 09 0 .
2341 add hl,bc ;0e2b 09 .
2342 ex de,hl ;0e2c eb .
2343 add hl,bc ;0e2d 09 .
2344 ex de,hl ;0e2e eb .
2345 dec hl ;0e2f 2b +
2346 dec de ;0e30 1b .
2347 lddr ;0e31 ed b8 . .
2348 ld bc,0b0edh ;0e33 01 ed b0 . . .
2349 pop bc ;0e36 c1 .
2350 pop de ;0e37 d1 .
2351 pop hl ;0e38 e1 .
2352 pop af ;0e39 f1 .
2353 jr z,l0dedh ;0e3a 28 b1 ( .
2354 ret ;0e3c c9 .
2355
2356 cmd_H:
2357 call expr ;0e3d cd be 03 . . .
2358 jp c,p_max_high0 ;0e40 da 6f 11 . o .
2359 call next_arg ;0e43 cd ca 02 . . .
2360 push hl ;0e46 e5 .
2361 call expr ;0e47 cd be 03 . . .
2362 push af ;0e4a f5 .
2363 call assert_eol ;0e4b cd d6 02 . . .
2364 pop af ;0e4e f1 .
2365 ex de,hl ;0e4f eb .
2366 pop hl ;0e50 e1 .
2367 jr c,l0e5eh ;0e51 38 0b 8 .
2368 push hl ;0e53 e5 .
2369 push de ;0e54 d5 .
2370 add hl,de ;0e55 19 .
2371 call l0e5eh ;0e56 cd 5e 0e . ^ .
2372 pop de ;0e59 d1 .
2373 pop hl ;0e5a e1 .
2374 and a ;0e5b a7 .
2375 sbc hl,de ;0e5c ed 52 . R
2376 l0e5eh:
2377 call out_hl ;0e5e cd 13 02 . . .
2378 call outbl2 ;0e61 cd 9c 02 . . .
2379 call out_hl_neg ;0e64 cd 0a 02 . . .
2380 call outbl4 ;0e67 cd 99 02 . . .
2381 call out.hl.dec ;0e6a cd e7 01 . . .
2382 call outbl2 ;0e6d cd 9c 02 . . .
2383 call out_hl_dec_neg ;0e70 cd e2 01 . . .
2384 call outbl4 ;0e73 cd 99 02 . . .
2385 call out.bin.w ;0e76 cd c2 01 . . .
2386 call outbl2 ;0e79 cd 9c 02 . . .
2387 ld a,l ;0e7c 7d }
2388 call out.ascii ;0e7d cd 34 02 . 4 .
2389 jp crlf ;0e80 c3 a3 02 . . .
2390
2391 cmd_Q_jopt:
2392 db -1 ;0e83 ff .
2393
2394 cmd_Q:
2395 ld a,(de) ;0e84 1a .
2396 sub 'J' ;0e85 d6 4a . J
2397 ld (cmd_Q_jopt),a ;0e87 32 83 0e 2 . .
2398 jr nz,l0e8dh ;0e8a 20 01 .
2399 inc de ;0e8c 13 .
2400 l0e8dh:
2401 call get_arg_range ;0e8d cd 7d 03 . } .
2402 push bc ;0e90 c5 .
2403 push hl ;0e91 e5 .
2404 call sub_0ee6h ;0e92 cd e6 0e . . .
2405 pop hl ;0e95 e1 .
2406 l0e96h:
2407 call sub_0ed7h ;0e96 cd d7 0e . . .
2408 jr nz,l0eb0h ;0e99 20 15 .
2409 push bc ;0e9b c5 .
2410 push hl ;0e9c e5 .
2411 ld a,(cmd_Q_jopt) ;0e9d 3a 83 0e : . .
2412 or a ;0ea0 b7 .
2413 jr nz,l0ea7h ;0ea1 20 04 .
2414 ld bc,-8 ;0ea3 01 f8 ff . . .
2415 add hl,bc ;0ea6 09 .
2416 l0ea7h:
2417 ld bc,16 ;0ea7 01 10 00 . . .
2418 and a ;0eaa a7 .
2419 call sub_0f58h ;0eab cd 58 0f . X .
2420 pop hl ;0eae e1 .
2421 pop bc ;0eaf c1 .
2422 l0eb0h:
2423 inc hl ;0eb0 23 #
2424 ex (sp),hl ;0eb1 e3 .
2425 dec hl ;0eb2 2b +
2426 ld a,h ;0eb3 7c |
2427 or l ;0eb4 b5 .
2428 ex (sp),hl ;0eb5 e3 .
2429 jr nz,l0e96h ;0eb6 20 de .
2430 pop bc ;0eb8 c1 .
2431 ret ;0eb9 c9 .
2432
2433 cmd_Z:
2434 call get_arg_range ;0eba cd 7d 03 . } .
2435 push bc ;0ebd c5 .
2436 push hl ;0ebe e5 .
2437 call sub_0ee6h ;0ebf cd e6 0e . . .
2438 ld a,b ;0ec2 78 x
2439 pop hl ;0ec3 e1 .
2440 pop bc ;0ec4 c1 .
2441 push hl ;0ec5 e5 .
2442 ex de,hl ;0ec6 eb .
2443 l0ec7h:
2444 ldi ;0ec7 ed a0 . .
2445 jp po,l0ed3h ;0ec9 e2 d3 0e . . .
2446 dec a ;0ecc 3d =
2447 jr nz,l0ec7h ;0ecd 20 f8 .
2448 pop hl ;0ecf e1 .
2449 ldir ;0ed0 ed b0 . .
2450 ret ;0ed2 c9 .
2451 l0ed3h:
2452 pop hl ;0ed3 e1 .
2453 ret ;0ed4 c9 .
2454
2455 last_D:
2456 dw TPA
2457
2458 sub_0ed7h:
2459 push hl ;0ed7 e5 d5 . .
2460 push de
2461 push bc ;0ed9 c5 .
2462 l0edah:
2463 ld a,(de) ;0eda 1a .
2464 cp (hl) ;0edb be .
2465 jr nz,l0ee2h ;0edc 20 04 .
2466 inc de ;0ede 13 .
2467 inc hl ;0edf 23 #
2468 djnz l0edah ;0ee0 10 f8 . .
2469 l0ee2h:
2470 pop bc ;0ee2 c1 .
2471 pop de ;0ee3 d1 .
2472 pop hl ;0ee4 e1 .
2473 ret ;0ee5 c9 .
2474
2475 sub_0ee6h:
2476 ld hl,conbuf+1 ;0ee6 21 6b 00 ! k .
2477 call sub_0ef7h ;0ee9 cd f7 0e . . .
2478 ld de,conbuf+1 ;0eec 11 6b 00 . k .
2479 and a ;0eef a7 .
2480 sbc hl,de ;0ef0 ed 52 . R
2481 ld b,l ;0ef2 45 E
2482 ret nz ;0ef3 c0 .
2483 jp ERROR ;0ef4 c3 07 01 . . .
2484
2485 sub_0ef7h:
2486 db 0e6h ;0ef7 e6 and 037h (clear carry)
2487 sub_0ef8h:
2488 scf ;0ef8 37 . 7
2489 l0ef9h:
2490 push af ;0ef9 f5 .
2491 call next_arg ;0efa cd ca 02 . . .
2492 cp 'W' ;0efd fe 57 . W
2493 jr nz,l0f0eh ;0eff 20 0d .
2494 inc de ;0f01 13 .
2495 push hl ;0f02 e5 .
2496 call sub_035dh ;0f03 cd 5d 03 . ] .
2497 ex de,hl ;0f06 eb .
2498 ex (sp),hl ;0f07 e3 .
2499 ld (hl),e ;0f08 73 s
2500 inc hl ;0f09 23 #
2501 ld a,d ;0f0a 7a z
2502 pop de ;0f0b d1 .
2503 jr l0f1ah ;0f0c 18 0c . .
2504 l0f0eh:
2505 cp '''' ;0f0e fe 27 . '
2506 jr z,l0f1eh ;0f10 28 0c ( .
2507 push hl ;0f12 e5 .
2508 call expr ;0f13 cd be 03 . . .
2509 ld a,l ;0f16 7d }
2510 pop hl ;0f17 e1 .
2511 jr c,l0f42h ;0f18 38 28 8 (
2512 l0f1ah:
2513 ld (hl),a ;0f1a 77 w
2514 inc hl ;0f1b 23 #
2515 jr l0f3ah ;0f1c 18 1c . .
2516 l0f1eh:
2517 inc de ;0f1e 13 .
2518 ld a,(de) ;0f1f 1a .
2519 cp '''' ;0f20 fe 27 . '
2520 jr z,l0f2bh ;0f22 28 07 ( .
2521 or a ;0f24 b7 .
2522 jr z,l0f42h ;0f25 28 1b ( .
2523 l0f27h:
2524 ld (hl),a ;0f27 77 w
2525 inc hl ;0f28 23 #
2526 jr l0f1eh ;0f29 18 f3 . .
2527 l0f2bh:
2528 inc de ;0f2b 13 .
2529 ld a,(de) ;0f2c 1a .
2530 cp '''' ;0f2d fe 27 . '
2531 jr z,l0f27h ;0f2f 28 f6 ( .
2532 cp '.' ;0f31 fe 2e . .
2533 jr nz,l0f3ah ;0f33 20 05 .
2534 inc de ;0f35 13 .
2535 dec hl ;0f36 2b +
2536 set 7,(hl) ;0f37 cb fe . .
2537 inc hl ;0f39 23 #
2538 l0f3ah:
2539 pop af ;0f3a f1 .
2540 jr nc,l0ef9h ;0f3b 30 bc 0 .
2541 ld (last_S),hl ;0f3d 22 90 0d " . .
2542 jr l0ef9h ;0f40 18 b7 . .
2543 l0f42h:
2544 pop af ;0f42 f1 .
2545 ret nc ;0f43 d0 .
2546 ld (last_S),hl ;0f44 22 90 0d " . .
2547 ret ;0f47 c9 .
2548
2549 cmd_D:
2550 ld hl,cmd_D ;0f48 21 48 0f ! H .
2551 ld (cmd_rpt),hl ;0f4b 22 68 00 " h .
2552 ld hl,(last_D) ;0f4e 2a d5 0e * . .
2553 ld bc,128 ;0f51 01 80 00 . . .
2554 call sub_0377h ;0f54 cd 77 03 . w .
2555 scf ;0f57 37 7
2556 sub_0f58h:
2557 push bc ;0f58 c5 .
2558 push de ;0f59 d5 .
2559 push hl ;0f5a e5 .
2560 ex af,af' ;0f5b 08 .
2561 l0f5ch:
2562 call out.hl.@ ;0f5c cd a4 01 . . .
2563 call z,outbl2 ;0f5f cc 9c 02 . . .
2564 call outbl ;0f62 cd 9f 02 . . .
2565 ld de,0 ;0f65 11 00 00 . . .
2566 l0f68h:
2567 ld a,(hl) ;0f68 7e ~
2568 inc hl ;0f69 23 #
2569 call out_hex ;0f6a cd 18 02 . . .
2570 call outbl ;0f6d cd 9f 02 . . .
2571 dec bc ;0f70 0b .
2572 inc e ;0f71 1c .
2573 ld a,e ;0f72 7b {
2574 cp 010h ;0f73 fe 10 . .
2575 jr z,l0f80h ;0f75 28 09 ( .
2576 and 003h ;0f77 e6 03 . .
2577 call z,outbl ;0f79 cc 9f 02 . . .
2578 ld a,b ;0f7c 78 x
2579 or c ;0f7d b1 .
2580 jr nz,l0f68h ;0f7e 20 e8 .
2581 l0f80h:
2582 call outbl ;0f80 cd 9f 02 . . .
2583 and a ;0f83 a7 .
2584 sbc hl,de ;0f84 ed 52 . R
2585 l0f86h:
2586 ld a,(hl) ;0f86 7e ~
2587 call sub_0fa3h ;0f87 cd a3 0f . . .
2588 call outchar ;0f8a cd 5d 02 . ] .
2589 inc hl ;0f8d 23 #
2590 dec e ;0f8e 1d .
2591 jr nz,l0f86h ;0f8f 20 f5 .
2592 ex af,af' ;0f91 08 .
2593 jr nc,l0f97h ;0f92 30 03 0 .
2594 ld (last_D),hl ;0f94 22 d5 0e " . .
2595 l0f97h:
2596 ex af,af' ;0f97 08 .
2597 call crlf ;0f98 cd a3 02 . . .
2598 ld a,b ;0f9b 78 x
2599 or c ;0f9c b1 .
2600 jr nz,l0f5ch ;0f9d 20 bd .
2601 pop hl ;0f9f e1 .
2602 pop de ;0fa0 d1 .
2603 pop bc ;0fa1 c1 .
2604 ret ;0fa2 c9 .
2605
2606 sub_0fa3h:
2607 and 07fh ;0fa3 e6 7f . \7f
2608 cp 07fh ;0fa5 fe 7f . \7f
2609 jr z,l0fach ;0fa7 28 03 ( .
2610 cp ' ' ;0fa9 fe 20 .
2611 ret nc ;0fab d0 .
2612 l0fach:
2613 ld a,'.' ;0fac 3e 2e > .
2614 ret ;0fae c9 .
2615
2616 cmd_F:
2617 push de ;0faf d5 .
2618 ld hl,DMA_BUF+1 ;0fb0 21 81 00 ! . .
2619 ld (hl),' ' ;0fb3 36 20 6
2620 inc hl ;0fb5 23 #
2621 l0fb6h:
2622 ld a,(de) ;0fb6 1a .
2623 ld (hl),a ;0fb7 77 w
2624 inc hl ;0fb8 23 #
2625 inc de ;0fb9 13 .
2626 and a ;0fba a7 .
2627 jr nz,l0fb6h ;0fbb 20 f9 .
2628 ld a,l ;0fbd 7d }
2629 sub DMA_BUF+2 ;0fbe d6 82 . .
2630 ld (DMA_BUF),a ;0fc0 32 80 00 2 . .
2631 pop hl ;0fc3 e1 .
2632 ld de,FCB ;0fc4 11 5c 00 . \ .
2633 call parse_filename ;0fc7 cd cd 0f . . .
2634 ld de,FCB2 ;0fca 11 6c 00 . l .
2635
2636 parse_filename:
2637 call sub_102ch ;0fcd cd 2c 10 . , .
2638 push de ;0fd0 d5 .
2639 push bc ;0fd1 c5 .
2640 ld b,(hl) ;0fd2 46 F
2641 inc hl ;0fd3 23 #
2642 ld a,(hl) ;0fd4 7e ~
2643 cp ':' ;0fd5 fe 3a . :
2644 jr nz,l0fe1h ;0fd7 20 08 .
2645 inc hl ;0fd9 23 #
2646 ld a,b ;0fda 78 x
2647 sub 040h ;0fdb d6 40 . @
2648 and 01fh ;0fdd e6 1f . .
2649 jr l0fe3h ;0fdf 18 02 . .
2650 l0fe1h:
2651 dec hl ;0fe1 2b +
2652 xor a ;0fe2 af .
2653 l0fe3h:
2654 ld (de),a ;0fe3 12 .
2655 inc de ;0fe4 13 .
2656 ld b,8 ;0fe5 06 08 . .
2657 call sub_0ff2h ;0fe7 cd f2 0f . . .
2658 ld b,3 ;0fea 06 03 . .
2659 call sub_0ff2h ;0fec cd f2 0f . . .
2660 pop bc ;0fef c1 .
2661 pop de ;0ff0 d1 .
2662 ret ;0ff1 c9 .
2663
2664 sub_0ff2h:
2665 call sub_1012h ;0ff2 cd 12 10 . . .
2666 jr z,l0ffeh ;0ff5 28 07 ( .
2667 inc hl ;0ff7 23 #
2668 ld (de),a ;0ff8 12 .
2669 inc de ;0ff9 13 .
2670 djnz sub_0ff2h ;0ffa 10 f6 . .
2671 jr l1003h ;0ffc 18 05 . .
2672 l0ffeh:
2673 ld a,c ;0ffe 79 y
2674 l0fffh:
2675 ld (de),a ;0fff 12 .
2676 inc de ;1000 13 .
2677 djnz l0fffh ;1001 10 fc . .
2678 l1003h:
2679 call sub_1012h ;1003 cd 12 10 . . .
2680 inc hl ;1006 23 #
2681 jr nz,l1003h ;1007 20 fa .
2682 cp '*' ;1009 fe 2a . *
2683 jr z,l1003h ;100b 28 f6 ( .
2684 cp '.' ;100d fe 2e . .
2685 ret z ;100f c8 .
2686 dec hl ;1010 2b +
2687 ret ;1011 c9 .
2688
2689 sub_1012h:
2690 ld a,(hl) ;1012 7e ~
2691 ld c,' ' ;1013 0e 20 .
2692 and 01fh ;1015 e6 1f . .
2693 ret z ;1017 c8 .
2694 ld a,(hl) ;1018 7e ~
2695 cp ' ' ;1019 fe 20 .
2696 ret z ;101b c8 .
2697 call sub_1043h ;101c cd 43 10 . C .
2698 ret z ;101f c8 .
2699 cp '/' ;1020 fe 2f . /
2700 ret z ;1022 c8 .
2701 cp '.' ;1023 fe 2e . .
2702 ret z ;1025 c8 .
2703 ld c,'?' ;1026 0e 3f . ?
2704 cp '*' ;1028 fe 2a . *
2705 ret ;102a c9 .
2706
2707 l102bh:
2708 inc hl ;102b 23 #
2709 sub_102ch:
2710 ld a,(hl) ;102c 7e ~
2711 cp '/' ;102d fe 2f . /
2712 jr z,l103bh ;102f 28 0a ( .
2713 call sub_1043h ;1031 cd 43 10 . C .
2714 jr z,l102bh ;1034 28 f5 ( .
2715 l1036h:
2716 cp ' ' ;1036 fe 20 .
2717 jr z,l102bh ;1038 28 f1 ( .
2718 ret ;103a c9 .
2719
2720 l103bh:
2721 ld a,(hl) ;103b 7e ~
2722 cp ' '+1 ;103c fe 21 . !
2723 jr c,l1036h ;103e 38 f6 8 .
2724 inc hl ;1040 23 #
2725 jr l103bh ;1041 18 f8 . .
2726
2727 sub_1043h:
2728 cp '=' ;1043 fe 3d . =
2729 ret z ;1045 c8 .
2730 cp '_' ;1046 fe 5f . _
2731 ret z ;1048 c8 .
2732 cp ',' ;1049 fe 2c . ,
2733 ret ;104b c9 .
2734
2735 fcb_clear_rc:
2736 xor a ;104c af .
2737 ld hl,FCB+12 ;104d 21 68 00 ! h .
2738 ld b,21 ;1050 06 15 . .
2739 l1052h:
2740 ld (hl),a ;1052 77 w
2741 inc hl ;1053 23 #
2742 djnz l1052h ;1054 10 fc . .
2743 ld de,DMA_BUF ;1056 11 80 00 . . .
2744 ld c,BDOS_SETDMA ;1059 0e 1a . .
2745 call ddtz_base ;105b cd 00 00 . . .
2746 ld de,FCB ;105e 11 5c 00 . \ .
2747 ret ;1061 c9 .
2748
2749 cmd_R:
2750 ld hl,0 ;1062 21 00 00 ! . .
2751 call get_lastarg_def ;1065 cd 69 03 . i .
2752 read_file:
2753 push hl ;1068 e5 .
2754 ld hl,0 ;1069 21 00 00 ! . .
2755 ld (high_load),hl ;106c 22 9c 11 " . .
2756 call fcb_clear_rc ;106f cd 4c 10 . L .
2757 ld c,BDOS_OPEN ;1072 0e 0f . .
2758 call ddtz_base ;1074 cd 00 00 . . .
2759 inc a ;1077 3c <
2760 jp z,ERROR ;1078 ca 07 01 . . .
2761 ld hl,FCB+9 ;107b 21 65 00 ! e .
2762 ld de,str_hex ;107e 11 a5 10 . . .
2763 ld b,3 ;1081 06 03 . .
2764 call strncmp ;1083 cd 67 11 . g .
2765 pop hl ;1086 e1 .
2766 jr z,read_hexfile ;1087 28 1f ( .
2767 ld de,TPA ;1089 11 00 01 . . .
2768 add hl,de ;108c 19 .
2769 push hl ;108d e5 .
2770 l108eh:
2771 call read_sector ;108e cd 21 11 . ! .
2772 pop hl ;1091 e1 .
2773 jp z,p_max_high ;1092 ca 72 11 . r .
2774 ld de,DMA_BUF ;1095 11 80 00 . . .
2775 ld b,080h ;1098 06 80 . .
2776 l109ah:
2777 ld a,(de) ;109a 1a .
2778 call cmdR_storebyte ;109b cd 36 11 . 6 .
2779 inc de ;109e 13 .
2780 inc hl ;109f 23 #
2781 djnz l109ah ;10a0 10 f8 . .
2782 push hl ;10a2 e5 .
2783 jr l108eh ;10a3 18 e9 . .
2784
2785 str_hex:
2786 db 'HEX' ;10a5 48 H E X
2787
2788 read_hexfile:
2789 push hl ;10a8 e5 .
2790 ld a,080h ;10a9 3e 80 > .
2791 ld (cmdR_rindex),a ;10ab 32 20 11 2 .
2792 l10aeh:
2793 call read_byte ;10ae cd 05 11 . . .
2794 jr z,rdhex_done ;10b1 28 31 ( 1
2795 cp ':' ;10b3 fe 3a . :
2796 jr nz,l10aeh ;10b5 20 f7 .
2797 ld c,0 ;10b7 0e 00 . .
2798 call read_hexchar ;10b9 cd e8 10 . . .
2799 ld b,a ;10bc 47 G
2800 call read_hexchar ;10bd cd e8 10 . . .
2801 ld h,a ;10c0 67 g
2802 call read_hexchar ;10c1 cd e8 10 . . .
2803 ld l,a ;10c4 6f o
2804 ld a,b ;10c5 78 x
2805 and a ;10c6 a7 .
2806 jr z,rdhex_done ;10c7 28 1b ( .
2807 call read_hexchar ;10c9 cd e8 10 . . .
2808 l10cch:
2809 call read_hexchar ;10cc cd e8 10 . . .
2810 pop de ;10cf d1 .
2811 push de ;10d0 d5 .
2812 push hl ;10d1 e5 .
2813 add hl,de ;10d2 19 .
2814 call cmdR_storebyte ;10d3 cd 36 11 . 6 .
2815 pop hl ;10d6 e1 .
2816 inc hl ;10d7 23 #
2817 djnz l10cch ;10d8 10 f2 . .
2818 call read_hexchar ;10da cd e8 10 . . .
2819 ld a,c ;10dd 79 y
2820 and a ;10de a7 .
2821 jp nz,ERROR ;10df c2 07 01 . . .
2822 jr l10aeh ;10e2 18 ca . .
2823 rdhex_done:
2824 pop hl ;10e4 e1 .
2825 jp p_max_high ;10e5 c3 72 11 . r .
2826
2827 read_hexchar:
2828 call read_hexdigit ;10e8 cd f9 10 . . .
2829 rlca ;10eb 07 .
2830 rlca ;10ec 07 .
2831 rlca ;10ed 07 .
2832 rlca ;10ee 07 .
2833 ld d,a ;10ef 57 W
2834 call read_hexdigit ;10f0 cd f9 10 . . .
2835 add a,d ;10f3 82 .
2836 ld d,a ;10f4 57 W
2837 add a,c ;10f5 81 .
2838 ld c,a ;10f6 4f O
2839 ld a,d ;10f7 7a z
2840 ret ;10f8 c9 .
2841
2842 read_hexdigit:
2843 call read_byte ;10f9 cd 05 11 . . .
2844 jr z,l1102h ;10fc 28 04 ( .
2845 call hex_digit ;10fe cd 12 06 . . .
2846 ret nc ;1101 d0 .
2847 l1102h:
2848 jp ERROR ;1102 c3 07 01 . . .
2849
2850 read_byte:
2851 ld a,(cmdR_rindex) ;1105 3a 20 11 : .
2852 cp 080h ;1108 fe 80 . .
2853 jr nz,l1111h ;110a 20 05 .
2854 call read_sector ;110c cd 21 11 . ! .
2855 ret z ;110f c8 .
2856 sub a ;1110 97 .
2857 l1111h:
2858 inc a ;1111 3c <
2859 ld (cmdR_rindex),a ;1112 32 20 11 2 .
2860 push hl ;1115 e5 .
2861 add a,07fh ;1116 c6 7f . \7f
2862 ld l,a ;1118 6f o
2863 ld h,000h ;1119 26 00 & .
2864 ld a,(hl) ;111b 7e ~
2865 pop hl ;111c e1 .
2866 cp 01ah ;111d fe 1a . .
2867 ret ;111f c9 .
2868
2869 cmdR_rindex:
2870 db 0 ;1120 00 .
2871
2872 read_sector:
2873 push hl ;1121 e5 .
2874 push de ;1122 d5 .
2875 push bc ;1123 c5 .
2876 ld de,FCB ;1124 11 5c 00 . \ .
2877 ld c,BDOS_READ ;1127 0e 14 . .
2878 call ddtz_base ;1129 cd 00 00 . . .
2879 dec a ;112c 3d =
2880 jr z,l1132h ;112d 28 03 ( .
2881 jp p,ERROR ;112f f2 07 01 . . .
2882 l1132h:
2883 pop bc ;1132 c1 .
2884 pop de ;1133 d1 .
2885 pop hl ;1134 e1 .
2886 ret ;1135 c9 .
2887
2888 cmdR_storebyte:
2889 push af ;1136 f5 .
2890 push de ;1137 d5 .
2891 ld de,TPA ;1138 11 00 01 . . .
2892 call cp_hl_de ;113b cd ee 02 . . .
2893 jp c,ERROR ;113e da 07 01 . . .
2894 ld de,(BDOS+1) ;1141 ed 5b 06 00 . [ . .
2895 call cp_hl_de ;1145 cd ee 02 . . .
2896 jp nc,ERROR ;1148 d2 07 01 . . .
2897 ld de,(high_load) ;114b ed 5b 9c 11 . [ . .
2898 call cp_hl_de ;114f cd ee 02 . . .
2899 jr c,l1157h ;1152 38 03 8 .
2900 ld (high_load),hl ;1154 22 9c 11 " . .
2901 l1157h:
2902 ld de,(max_load) ;1157 ed 5b 9e 11 . [ . .
2903 call cp_hl_de ;115b cd ee 02 . . .
2904 jr c,l1163h ;115e 38 03 8 .
2905 ld (max_load),hl ;1160 22 9e 11 " . .
2906 l1163h:
2907 pop de ;1163 d1 .
2908 pop af ;1164 f1 .
2909 ld (hl),a ;1165 77 w
2910 ret ;1166 c9 .
2911
2912 strncmp:
2913 ld a,(de) ;1167 1a .
2914 cp (hl) ;1168 be .
2915 inc de ;1169 13 .
2916 inc hl ;116a 23 #
2917 ret nz ;116b c0 .
2918 djnz strncmp ;116c 10 f9 . .
2919 ret ;116e c9 .
2920
2921 p_max_high0:
2922 call assert_eol ;116f cd d6 02 . . .
2923 p_max_high:
2924 ld hl,msg_high ;1172 21 8d 11 ! . .
2925 call pstr ;1175 cd 88 02 . . .
2926 ld hl,(high_load) ;1178 2a 9c 11 * . .
2927 call out_hl ;117b cd 13 02 . . .
2928 ld hl,msg_max ;117e 21 94 11 ! . .
2929 call pstr ;1181 cd 88 02 . . .
2930 ld hl,(max_load) ;1184 2a 9e 11 * . .
2931 call out_hl ;1187 cd 13 02 . . .
2932 jp crlf ;118a c3 a3 02 . . .
2933
2934 msg_high:
2935 DC 'High = '
2936 msg_max:
2937 DC ' Max = '
2938
2939 high_load:
2940 defw TPA ;119c 00 01 . .
2941 max_load:
2942 defw TPA ;119e 00 01 . .
2943
2944 cmd_W:
2945 call get_arg_range ;11a0 cd 7d 03 . } .
2946 call assert_eol ;11a3 cd d6 02 . . .
2947 push hl ;11a6 e5 .
2948 ld a,c ;11a7 79 y
2949 add a,07fh ;11a8 c6 7f . \7f
2950 jr nc,l11adh ;11aa 30 01 0 .
2951 inc b ;11ac 04 .
2952 l11adh:
2953 and 080h ;11ad e6 80 . .
2954 ld c,a ;11af 4f O
2955 push bc ;11b0 c5 .
2956 ld a,(FCB+1) ;11b1 3a 5d 00 : ] .
2957 cp ' ' ;11b4 fe 20 .
2958 jr z,error5 ;11b6 28 3b ( ;
2959 call fcb_clear_rc ;11b8 cd 4c 10 . L .
2960 push de ;11bb d5 .
2961 ld c,BDOS_DELETE ;11bc 0e 13 . .
2962 call ddtz_base ;11be cd 00 00 . . .
2963 pop de ;11c1 d1 .
2964 ld c,BDOS_CREATE ;11c2 0e 16 . .
2965 call ddtz_base ;11c4 cd 00 00 . . .
2966 inc a ;11c7 3c <
2967 jr z,error5 ;11c8 28 29 ( )
2968 pop bc ;11ca c1 .
2969 pop hl ;11cb e1 .
2970 l11cch:
2971 ld a,b ;11cc 78 x
2972 or c ;11cd b1 .
2973 jr z,close_file ;11ce 28 26 ( &
2974 push bc ;11d0 c5 .
2975 ld de,080h ;11d1 11 80 00 . . . DMA_BUF
2976 ld b,d ;11d4 42 B
2977 ld c,e ;11d5 4b K
2978 ldir ;11d6 ed b0 . .
2979 call write_sector ;11d8 cd e4 11 . . .
2980 ex (sp),hl ;11db e3 .
2981 ld bc,0ff80h ;11dc 01 80 ff . . .
2982 add hl,bc ;11df 09 .
2983 ex (sp),hl ;11e0 e3 .
2984 pop bc ;11e1 c1 .
2985 jr l11cch ;11e2 18 e8 . .
2986
2987 write_sector:
2988 push hl ;11e4 e5 .
2989 ld de,FCB ;11e5 11 5c 00 . \ .
2990 ld c,BDOS_WRITE ;11e8 0e 15 . .
2991 call ddtz_base ;11ea cd 00 00 . . .
2992 pop hl ;11ed e1 .
2993 and a ;11ee a7 .
2994 ret z ;11ef c8 .
2995 call close_file ;11f0 cd f6 11 . . .
2996 error5:
2997 jp ERROR ;11f3 c3 07 01 . . .
2998
2999 close_file:
3000 ld de,FCB ;11f6 11 5c 00 . \ .
3001 ld c,BDOS_CLOSE ;11f9 0e 10 . .
3002 jp ddtz_base ;11fb c3 00 00 . . .
3003
3004 cmd_A:
3005 ld hl,(last_A) ;11fe 2a 64 12 * d .
3006 call get_lastarg_def ;1201 cd 69 03 . i .
3007 push hl ;1204 e5 .
3008 pop iy ;1205 fd e1 . .
3009 ld hl,l1259h ;1207 21 59 12 ! Y .
3010 ld (CMD_ERR),hl ;120a 22 66 00 " f .
3011 ld (l1262h),sp ;120d ed 73 62 12 . s b .
3012 l1211h:
3013 push iy ;1211 fd e5 . .
3014 pop hl ;1213 e1 .
3015 ld (last_A),hl ;1214 22 64 12 " d .
3016 ld (l0062h),hl ;1217 22 62 00 " b .
3017 push hl ;121a e5 .
3018 call p_disas_line ;121b cd 2d 19 . - .
3019 pop iy ;121e fd e1 . .
3020 ld c,b ;1220 48 H
3021 ld de,(offs.@) ;1221 ed 5b 64 00 . [ d .
3022 ld a,d ;1225 7a z
3023 or e ;1226 b3 .
3024 ld b,011h ;1227 06 11 . .
3025 jr z,l122dh ;1229 28 02 ( .
3026 ld b,019h ;122b 06 19 . .
3027 l122dh:
3028 call outbl ;122d cd 9f 02 . . .
3029 ld a,(con_col) ;1230 3a 72 02 : r .
3030 cp b ;1233 b8 .
3031 jr c,l122dh ;1234 38 f7 8 .
3032 push bc ;1236 c5 .
3033 call get_line ;1237 cd 4e 01 . N .
3034 pop bc ;123a c1 .
3035 call skipbl ;123b cd bf 02 . . .
3036 cp '.' ;123e fe 2e . .
3037 ret z ;1240 c8 .
3038 cp '-' ;1241 fe 2d . -
3039 jr nz,l124bh ;1243 20 06 .
3040 ld iy,(cmd_A_prev) ;1245 fd 2a 66 12 . * f .
3041 jr l1211h ;1249 18 c6 . .
3042 l124bh:
3043 and a ;124b a7 .
3044 call nz,sub_1268h ;124c c4 68 12 . h .
3045 ld (cmd_A_prev),iy ;124f fd 22 66 12 . " f .
3046 ld b,0 ;1253 06 00 . .
3047 add iy,bc ;1255 fd 09 . .
3048 jr l1211h ;1257 18 b8 . .
3049 l1259h:
3050 call l0146h ;1259 cd 46 01 . F .
3051 ld sp,(l1262h) ;125c ed 7b 62 12 . { b .
3052 jr l1211h ;1260 18 af . .
3053
3054 l1262h:
3055 dw 0 ;1262 00 00 .
3056 last_A:
3057 dw TPA ;1264 00 01 .
3058 cmd_A_prev:
3059 dw TPA ;1266 00 01 . .
3060
3061 sub_1268h:
3062 call skipbl ;1268 cd bf 02 . . .
3063 ld hl,t_MNEMONICS ;126b 21 c6 1e ! . .
3064 call sub_030ah ;126e cd 0a 03 . . .
3065 jp nc,ERROR ;1271 d2 07 01 . . .
3066 call skipbl ;1274 cd bf 02 . . .
3067 push de ;1277 d5 .
3068 ld a,b ;1278 78 x
3069 add a,b ;1279 80 .
3070 add a,b ;127a 80 .
3071 ld hl,b_1289_start ;127b 21 89 12 ! . .
3072 call add_hl_a ;127e cd b9 02 . . .
3073 ld e,(hl) ;1281 5e ^
3074 inc hl ;1282 23 #
3075 ld d,(hl) ;1283 56 V
3076 inc hl ;1284 23 #
3077 ld b,(hl) ;1285 46 F
3078 ex de,hl ;1286 eb .
3079 pop de ;1287 d1 .
3080
3081 CALL_HL:
3082 jp (hl) ;1288 e9 .
3083
3084 b_1289_start:
3085 defw as.ADC_SBC ;ADC 1289 51 15 Q .
3086 defb 088h ; 128b 88 .
3087 defw as.ADD ;ADD 128c 71 15 q .
3088 defb 080h ; 128e 80 .
3089 defw as.AND_CP_OR_SUB_XOR ;AND 128f a8 15 . .
3090 defb 0a0h ; 1291 a0 .
3091 defw as.BITOP ;BIT 1292 09 16 . .
3092 defb 040h ; 1294 40 @
3093 defw as.CALL ;CALL 1295 2d 16 - .
3094 defb 0c4h ; 1297 c4 .
3095 defw as.opc.noarg ;CCF 1298 3b 15 ; .
3096 defb 03fh ; 129a 3f ?
3097 defw as.AND_CP_OR_SUB_XOR ;CP 129b a8 15 . .
3098 defb 0b8h ; 129d b8 .
3099 defw gen.opc.ED2 ;CPD 129e 44 15 D .
3100 defb 0a9h ; 12a0 a9 .
3101 defw gen.opc.ED2 ;CPDR 12a1 44 15 D .
3102 defb 0b9h ; 12a3 b9 .
3103 defw gen.opc.ED2 ;CPI 12a4 44 15 D .
3104 defb 0a1h ; 12a6 a1 .
3105 defw gen.opc.ED2 ;CPIR 12a7 44 15 D .
3106 defb 0b1h ; 12a9 b1 .
3107 defw as.opc.noarg ;CPL 12aa 3b 15 ; .
3108 defb 02fh ; 12ac 2f /
3109 defw as.opc.noarg ;DAA 12ad 3b 15 ; .
3110 defb 027h ; 12af 27 '
3111 defw as.DEC_INC ;DEC 12b0 98 17 . .
3112 defb 005h ; 12b2 05 .
3113 defw as.opc.noarg ;DI 12b3 3b 15 ; .
3114 defb 0f3h ; 12b5 f3 .
3115 defw as.DJNZ ;DJNZ 12b6 99 16 . .
3116 defb 010h ; 12b8 10 .
3117 defw as.opc.noarg ;EI 12b9 3b 15 ; .
3118 defb 0fbh ; 12bb fb .
3119 defw as.EX ;EX 12bc 49 17 I .
3120 defb 0e3h ; 12be e3 .
3121 defw as.opc.noarg ;EXX 12bf 3b 15 ; .
3122 defb 0d9h ; 12c1 d9 .
3123 defw as.opc.noarg ;HALT 12c2 3b 15 ; .
3124 defb 076h ; 12c4 76 v
3125 defw as.IM ;IM 12c5 b4 16 . .
3126 defb 046h ; 12c7 46 F
3127 defw as.IN ;IN 12c8 ed 16 . .
3128 defb 040h ; 12ca 40 @
3129 defw as.DEC_INC ;INC 12cb 98 17 . .
3130 defb 004h ; 12cd 04 .
3131 defw gen.opc.ED2 ;IND 12ce 44 15 D .
3132 defb 0aah ; 12d0 aa .
3133 defw gen.opc.ED2 ;INDR 12d1 44 15 D .
3134 defb 0bah ; 12d3 ba .
3135 defw gen.opc.ED2 ;INI 12d4 44 15 D .
3136 defb 0a2h ; 12d6 a2 .
3137 defw gen.opc.ED2 ;INIR 12d7 44 15 D .
3138 defb 0b2h ; 12d9 b2 .
3139 defw as.JP ;JP 12da 53 16 S .
3140 defb 0c2h ; 12dc c2 .
3141 defw as.JR ;JR 12dd a0 16 . .
3142 defb 020h ; 12df 20
3143 defw as.LD ;LD 12e0 52 13 R .
3144 defb 040h ; 12e2 40 @
3145 defw gen.opc.ED2 ;LDD 12e3 44 15 D .
3146 defb 0a8h ; 12e5 a8 .
3147 defw gen.opc.ED2 ;LDDR 12e6 44 15 D .
3148 defb 0b8h ; 12e8 b8 .
3149 defw gen.opc.ED2 ;LDI 12e9 44 15 D .
3150 defb 0a0h ; 12eb a0 .
3151 defw gen.opc.ED2 ;LDIR 12ec 44 15 D .
3152 defb 0b0h ; 12ee b0 .
3153 defw gen.opc.ED2 ;NEG 12ef 44 15 D .
3154 defb 044h ; 12f1 44 D
3155 defw as.opc.noarg ;NOP 12f2 3b 15 ; .
3156 defb 000h ; 12f4 00 .
3157 defw as.AND_CP_OR_SUB_XOR ;OR 12f5 a8 15 . .
3158 defb 0b0h ; 12f7 b0 .
3159 defw gen.opc.ED2 ;OTDR 12f8 44 15 D .
3160 defb 0bbh ; 12fa bb .
3161 defw gen.opc.ED2 ;OTIR 12fb 44 15 D .
3162 defb 0b3h ; 12fd b3 .
3163 defw as.OUT ;OUT 12fe 21 17 ! .
3164 defb 041h ; 1300 41 A
3165 defw gen.opc.ED2 ;OUTD 1301 44 15 D .
3166 defb 0abh ; 1303 ab .
3167 defw gen.opc.ED2 ;OUTI 1304 44 15 D .
3168 defb 0a3h ; 1306 a3 .
3169 defw as.POP_PUSH ;POP 1307 d9 16 . .
3170 defb 0c1h ; 1309 c1 .
3171 defw as.POP_PUSH ;PUSH 130a d9 16 . .
3172 defb 0c5h ; 130c c5 .
3173 defw as.BITOP ;RES 130d 09 16 . .
3174 defb 080h ; 130f 80 .
3175 defw as.RET ;RET 1310 45 16 E .
3176 defb 0c0h ; 1312 c0 .
3177 defw gen.opc.ED2 ;RETI 1313 44 15 D .
3178 defb 04dh ; 1315 4d M
3179 defw gen.opc.ED2 ;RETN 1316 44 15 D .
3180 defb 045h ; 1318 45 E
3181 defw as.SHIFTOP ;RL 1319 d5 15 . .
3182 defb 010h ; 131b 10 .
3183 defw as.opc.noarg ;RLA 131c 3b 15 ; .
3184 defb 017h ; 131e 17 .
3185 defw as.SHIFTOP ;RLC 131f d5 15 . .
3186 defb 000h ; 1321 00 .
3187 defw as.opc.noarg ;RLCA 1322 3b 15 ; .
3188 defb 007h ; 1324 07 .
3189 defw gen.opc.ED2 ;RLD 1325 44 15 D .
3190 defb 06fh ; 1327 6f o
3191 defw as.SHIFTOP ;RR 1328 d5 15 . .
3192 defb 018h ; 132a 18 .
3193 defw as.opc.noarg ;RRA 132b 3b 15 ; .
3194 defb 01fh ; 132d 1f .
3195 defw as.SHIFTOP ;RRC 132e d5 15 . .
3196 defb 008h ; 1330 08 .
3197 defw as.opc.noarg ;RRCA 1331 3b 15 ; .
3198 defb 00fh ; 1333 0f .
3199 defw gen.opc.ED2 ;RRD 1334 44 15 D .
3200 defb 067h ; 1336 67 g
3201 defw as.RST ;RST 1337 ca 16 . .
3202 defb 0c7h ; 1339 c7 .
3203 defw as.ADC_SBC ;SBC 133a 51 15 Q .
3204 defb 098h ; 133c 98 .
3205 defw as.opc.noarg ;SCF 133d 3b 15 ; .
3206 defb 037h ; 133f 37 7
3207 defw as.BITOP ;SET 1340 09 16 . .
3208 defb 0c0h ; 1342 c0 .
3209 defw as.SHIFTOP ;SLA 1343 d5 15 . .
3210 defb 020h ; 1345 20
3211 defw as.SHIFTOP ;SRA 1346 d5 15 . .
3212 defb 028h ; 1348 28 (
3213 defw as.SHIFTOP ;SRL 1349 d5 15 . .
3214 defb 038h ; 134b 38 8
3215 defw as.AND_CP_OR_SUB_XOR ;SUB 134c a8 15 . .
3216 defb 090h ; 134e 90 .
3217 defw as.AND_CP_OR_SUB_XOR ;XOR 134f a8 15 . .
3218 defb 0a8h ; 1351 a8 .
3219
3220 defw as.IN0 ;IN0
3221 defb 000h ;
3222 defw as.MLT ;MLT
3223 defb 04ch ;
3224 defw gen.opc.ED2 ;OTDM
3225 defb 08bh ;
3226 defw gen.opc.ED2 ;OTDMR
3227 defb 09bh ;
3228 defw gen.opc.ED2 ;OTIM
3229 defb 083h ;
3230 defw gen.opc.ED2 ;OTIMR
3231 defb 093h ;
3232 defw as.OUTO ;OUT0
3233 defb 001h ;
3234 defw gen.opc.ED2 ;SLP
3235 defb 076h ;
3236 defw as.TST ;TST
3237 defb 004h ;
3238 defw as.TSTIO ;TSTIO
3239 defb 074h ;
3240
3241 as.TST:
3242 call arg.r_HL_A ;
3243 jr nc,as.tst_0
3244 rlca
3245 rlca
3246 rlca
3247 add a,b
3248 ld b,a
3249 jp gen.opc.ED2
3250 as.tst_0:
3251 ld b,064h
3252 as.TSTIO:
3253 call arg.imm_8bit ;
3254 jr as.store_io0
3255
3256 as.IN0:
3257 call arg.r_HL_A ;
3258 jr nc,error7
3259 cp 006h
3260 jr z,error7
3261 rlca
3262 rlca
3263 rlca
3264 add a,b
3265 ld b,a
3266 call assert_comma ;
3267 call arg.addr_8bit ;
3268 jr as.store_io0
3269
3270 as.OUTO:
3271 call arg.addr_8bit ;
3272 call assert_comma ;
3273 call arg.r_HL_A ;
3274 jr nc,error7
3275 cp 006h
3276 jr z,error7
3277 rlca
3278 rlca
3279 rlca
3280 add a,b
3281 ld b,a
3282
3283 as.store_io0:
3284 call assert_eol
3285 ld (iy+000h),0edh
3286 ld (iy+001h),b
3287 ld (iy+002h),l
3288 ld c,003h
3289 ret
3290
3291 as.MLT:
3292 call arg.ww ;
3293 jr nc,error7
3294 add a,b
3295 ld b,a
3296 jp gen.opc.ED2
3297
3298 error7:
3299 jp ERROR
3300
3301 as.LD:
3302 call arg.r_HL_A ;1352 cd 2e 18 . . .
3303 jr c,l13d4h ;1355 38 7d 8 }
3304 call arg.IDX_displcmnt ;1357 cd 55 18 . U .
3305 jp c,l1471h ;135a da 71 14 . q .
3306 call arg.ww ;135d cd 1b 18 . . .
3307 jp c,l149ch ;1360 da 9c 14 . . .
3308 call arg.IX_IY ;1363 cd 3d 18 . = .
3309 jp c,l14f5h ;1366 da f5 14 . . .
3310 ld a,(de) ;1369 1a .
3311 cp 'I' ;136a fe 49 . I
3312 jp z,l1511h ;136c ca 11 15 . . .
3313 cp 'R' ;136f fe 52 . R
3314 jp z,l1519h ;1371 ca 19 15 . . .
3315 cp '(' ;1374 fe 28 . (
3316 jp nz,ERROR ;1376 c2 07 01 . . .
3317 inc de ;1379 13 .
3318 call arg.ww ;137a cd 1b 18 . . .
3319 jp c,l1528h ;137d da 28 15 . ( .
3320 call test_expr ;1380 cd 09 18 . . .
3321 call test_paren_close ;1383 cd c5 18 . . .
3322 call assert_comma ;1386 cd be 18 . . .
3323 call arg.ww ;1389 cd 1b 18 . . .
3324 jr c,l13c2h ;138c 38 34 8 4
3325 call arg.IX_IY ;138e cd 3d 18 . = .
3326 jr nc,l13aah ;1391 30 17 0 .
3327 ld b,022h ;1393 06 22 . "
3328 l1395h:
3329 call assert_eol ;1395 cd d6 02 . . .
3330 ld a,(prefix_ixiy) ;1398 3a cc 18 : . .
3331 l139bh:
3332 ld (iy+000h),a ;139b fd 77 00 . w .
3333 ld (iy+001h),b ;139e fd 70 01 . p .
3334 ld (iy+002h),l ;13a1 fd 75 02 . u .
3335 ld (iy+003h),h ;13a4 fd 74 03 . t .
3336 ld c,004h ;13a7 0e 04 . .
3337 ret ;13a9 c9 .
3338 l13aah:
3339 ld a,(de) ;13aa 1a .
3340 cp 'A' ;13ab fe 41 . A
3341 jp nz,ERROR ;13ad c2 07 01 . . .
3342 inc de ;13b0 13 .
3343 ld b,032h ;13b1 06 32 . 2
3344 as.store_3:
3345 call assert_eol ;13b3 cd d6 02 . . .
3346 ld (iy+000h),b ;13b6 fd 70 00 . p .
3347 ld (iy+001h),l ;13b9 fd 75 01 . u .
3348 ld (iy+002h),h ;13bc fd 74 02 . t .
3349 ld c,003h ;13bf 0e 03 . .
3350 ret ;13c1 c9 .
3351 l13c2h:
3352 cp 020h ;13c2 fe 20 .
3353 jr z,l13d0h ;13c4 28 0a ( .
3354 add a,043h ;13c6 c6 43 . C
3355 ld b,a ;13c8 47 G
3356 l13c9h:
3357 call assert_eol ;13c9 cd d6 02 . . .
3358 ld a,0edh ;13cc 3e ed > .
3359 jr l139bh ;13ce 18 cb . .
3360 l13d0h:
3361 ld b,022h ;13d0 06 22 . "
3362 jr as.store_3 ;13d2 18 df . .
3363 l13d4h:
3364 ld b,a ;13d4 47 G
3365 call assert_comma ;13d5 cd be 18 . . .
3366 call arg.r_HL_A ;13d8 cd 2e 18 . . .
3367 jr nc,l13f0h ;13db 30 13 0 .
3368 push af ;13dd f5 .
3369 ld a,b ;13de 78 x
3370 rlca ;13df 07 .
3371 rlca ;13e0 07 .
3372 rlca ;13e1 07 .
3373 ld b,a ;13e2 47 G
3374 pop af ;13e3 f1 .
3375 add a,b ;13e4 80 .
3376 add a,040h ;13e5 c6 40 . @
3377 cp 076h ;13e7 fe 76 . v
3378 jp z,ERROR ;13e9 ca 07 01 . . .
3379 l13ech:
3380 ld b,a ;13ec 47 G
3381 jp as.opc.noarg ;13ed c3 3b 15 . ; .
3382 l13f0h:
3383 call arg.IDX_displcmnt ;13f0 cd 55 18 . U .
3384 jr nc,l1413h ;13f3 30 1e 0 .
3385 ld a,b ;13f5 78 x
3386 rlca ;13f6 07 .
3387 rlca ;13f7 07 .
3388 rlca ;13f8 07 .
3389 add a,046h ;13f9 c6 46 . F
3390 cp 076h ;13fb fe 76 . v
3391 jp z,ERROR ;13fd ca 07 01 . . .
3392
3393 l1400h:
3394 ld b,a ;1400 47 G
3395 call assert_eol ;1401 cd d6 02 . . .
3396 ld (iy+001h),b ;1404 fd 70 01 . p .
3397 ld (iy+002h),c ;1407 fd 71 02 . q .
3398 ld a,(prefix_ixiy) ;140a 3a cc 18 : . .
3399 ld (iy+000h),a ;140d fd 77 00 . w .
3400 ld c,003h ;1410 0e 03 . .
3401 ret ;1412 c9 .
3402 l1413h:
3403 ld a,(de) ;1413 1a .
3404 cp 'I' ;1414 fe 49 . I
3405 jr z,l1426h ;1416 28 0e ( .
3406 cp 'R' ;1418 fe 52 . R
3407 jr nz,l1432h ;141a 20 16 .
3408 ld a,b ;141c 78 x
3409 cp 007h ;141d fe 07 . .
3410 jp nz,ERROR ;141f c2 07 01 . . .
3411 ld b,05fh ;1422 06 5f . _
3412 jr l142eh ;1424 18 08 . .
3413 l1426h:
3414 ld a,b ;1426 78 x
3415 cp 007h ;1427 fe 07 . .
3416 jp nz,ERROR ;1429 c2 07 01 . . .
3417 ld b,057h ;142c 06 57 . W
3418 l142eh:
3419 inc de ;142e 13 .
3420 jp gen.opc.ED2 ;142f c3 44 15 . D .
3421 l1432h:
3422 cp '(' ;1432 fe 28 . (
3423 jr z,l144ch ;1434 28 16 ( .
3424 call arg.imm_8bit ;1436 cd ff 17 . . .
3425 ld a,b ;1439 78 x
3426 rlca ;143a 07 .
3427 rlca ;143b 07 .
3428 rlca ;143c 07 .
3429 add a,006h ;143d c6 06 . .
3430 l143fh:
3431 ld b,a ;143f 47 G
3432 as.store_2:
3433 call assert_eol ;1440 cd d6 02 . . .
3434 ld (iy+000h),b ;1443 fd 70 00 . p .
3435 ld (iy+001h),l ;1446 fd 75 01 . u .
3436 ld c,002h ;1449 0e 02 . .
3437 ret ;144b c9 .
3438 l144ch:
3439 inc de ;144c 13 .
3440 ld a,b ;144d 78 x
3441 cp 007h ;144e fe 07 . .
3442 jp nz,ERROR ;1450 c2 07 01 . . .
3443 call arg.ww ;1453 cd 1b 18 . . .
3444 jr nc,l1466h ;1456 30 0e 0 .
3445 cp 030h ;1458 fe 30 . 0
3446 jp nc,ERROR ;145a d2 07 01 . . .
3447 add a,00ah ;145d c6 0a . .
3448 ld b,a ;145f 47 G
3449 call test_paren_close ;1460 cd c5 18 . . .
3450 jp as.opc.noarg ;1463 c3 3b 15 . ; .
3451 l1466h:
3452 call test_expr ;1466 cd 09 18 . . .
3453 call test_paren_close ;1469 cd c5 18 . . .
3454 ld b,03ah ;146c 06 3a . :
3455 jp as.store_3 ;146e c3 b3 13 . . .
3456
3457 l1471h:
3458 call assert_comma ;1471 cd be 18 . . .
3459 call arg.r_HL_A ;1474 cd 2e 18 . . .
3460 jr nc,l1483h ;1477 30 0a 0 .
3461 cp 006h ;1479 fe 06 . .
3462 jp z,ERROR ;147b ca 07 01 . . .
3463 add a,070h ;147e c6 70 . p
3464 jp l1400h ;1480 c3 00 14 . . .
3465
3466 l1483h:
3467 call arg.imm_8bit ;1483 cd ff 17 . . .
3468 call assert_eol ;1486 cd d6 02 . . .
3469 ld a,(prefix_ixiy) ;1489 3a cc 18 : . .
3470 ld (iy+000h),a ;148c fd 77 00 . w .
3471 ld (iy+001h),036h ;148f fd 36 01 36 . 6 . 6
3472 ld (iy+002h),c ;1493 fd 71 02 . q .
3473 ld (iy+003h),l ;1496 fd 75 03 . u .
3474 ld c,004h ;1499 0e 04 . .
3475 ret ;149b c9 .
3476 l149ch:
3477 ld b,a ;149c 47 G
3478 call assert_comma ;149d cd be 18 . . .
3479 ld hl,t_HL.AF ;14a0 21 af 1f ! . .
3480 call sub_0318h ;14a3 cd 18 03 . . .
3481 jr c,l14c3h ;14a6 38 1b 8 .
3482 call arg.IX_IY ;14a8 cd 3d 18 . = .
3483 jr nc,l14cch ;14ab 30 1f 0 .
3484 ld a,b ;14ad 78 x
3485 cp 030h ;14ae fe 30 . 0
3486 jr nz,error6 ;14b0 20 73 s
3487 ld b,0f9h ;14b2 06 f9 . .
3488 l14b4h:
3489 call assert_eol ;14b4 cd d6 02 . . .
3490 ld a,(prefix_ixiy) ;14b7 3a cc 18 : . .
3491 ld (iy+000h),a ;14ba fd 77 00 . w .
3492 ld (iy+001h),b ;14bd fd 70 01 . p .
3493 ld c,002h ;14c0 0e 02 . .
3494 ret ;14c2 c9 .
3495 l14c3h:
3496 ld a,b ;14c3 78 x
3497 cp 030h ;14c4 fe 30 . 0
3498 jr nz,error6 ;14c6 20 5d ]
3499 ld b,0f9h ;14c8 06 f9 . .
3500 jr as.opc.noarg ;14ca 18 6f . o
3501 l14cch:
3502 ld a,(de) ;14cc 1a .
3503 cp '(' ;14cd fe 28 . (
3504 jr nz,l14e8h ;14cf 20 17 .
3505 inc de ;14d1 13 .
3506 call test_expr ;14d2 cd 09 18 . . .
3507 call test_paren_close ;14d5 cd c5 18 . . .
3508 ld a,b ;14d8 78 x
3509 cp 020h ;14d9 fe 20 .
3510 jr z,l14e3h ;14db 28 06 ( .
3511 add a,04bh ;14dd c6 4b . K
3512 ld b,a ;14df 47 G
3513 jp l13c9h ;14e0 c3 c9 13 . . .
3514 l14e3h:
3515 ld b,02ah ;14e3 06 2a . *
3516 jp as.store_3 ;14e5 c3 b3 13 . . .
3517 l14e8h:
3518 call test_expr ;14e8 cd 09 18 . . .
3519 call assert_eol ;14eb cd d6 02 . . .
3520 ld a,001h ;14ee 3e 01 > .
3521 add a,b ;14f0 80 .
3522 ld b,a ;14f1 47 G
3523 jp as.store_3 ;14f2 c3 b3 13 . . .
3524 l14f5h:
3525 call assert_comma ;14f5 cd be 18 . . .
3526 ld a,(de) ;14f8 1a .
3527 cp '(' ;14f9 fe 28 . (
3528 jr nz,l1509h ;14fb 20 0c .
3529 inc de ;14fd 13 .
3530 call test_expr ;14fe cd 09 18 . . .
3531 call test_paren_close ;1501 cd c5 18 . . .
3532 ld b,02ah ;1504 06 2a . *
3533 jp l1395h ;1506 c3 95 13 . . .
3534 l1509h:
3535 call test_expr ;1509 cd 09 18 . . .
3536 ld b,021h ;150c 06 21 . !
3537 jp l1395h ;150e c3 95 13 . . .
3538 l1511h:
3539 inc de ;1511 13 .
3540 call assert_comma ;1512 cd be 18 . . .
3541 ld b,047h ;1515 06 47 . G
3542 jr l151fh ;1517 18 06 . .
3543 l1519h:
3544 inc de ;1519 13 .
3545 call assert_comma ;151a cd be 18 . . .
3546 ld b,04fh ;151d 06 4f . O
3547 l151fh:
3548 ld a,(de) ;151f 1a .
3549 inc de ;1520 13 .
3550 cp 'A' ;1521 fe 41 . A
3551 jr z,gen.opc.ED2 ;1523 28 1f ( .
3552 error6:
3553 jp ERROR ;1525 c3 07 01 . . .
3554
3555 l1528h:
3556 cp 020h ;1528 fe 20 .
3557 jr nc,error6 ;152a 30 f9 0 .
3558 add a,002h ;152c c6 02 . .
3559 ld b,a ;152e 47 G
3560 call test_paren_close ;152f cd c5 18 . . .
3561 call assert_comma ;1532 cd be 18 . . .
3562 ld a,(de) ;1535 1a .
3563 cp 'A' ;1536 fe 41 . A
3564 jr nz,error6 ;1538 20 eb .
3565 inc de ;153a 13 .
3566 as.opc.noarg:
3567 call assert_eol ;153b cd d6 02 . . .
3568 ld (iy+000h),b ;153e fd 70 00 . p .
3569 ld c,001h ;1541 0e 01 . .
3570 ret ;1543 c9 .
3571
3572 gen.opc.ED2:
3573 call assert_eol ;1544 cd d6 02 . . .
3574 ld (iy+000h),0edh ;1547 fd 36 00 ed . 6 . .
3575 ld (iy+001h),b ;154b fd 70 01 . p .
3576 ld c,002h ;154e 0e 02 . .
3577 ret ;1550 c9 .
3578
3579 as.ADC_SBC:
3580 ld hl,t_HL.AF ;1551 21 af 1f ! . .
3581 call sub_0318h ;1554 cd 18 03 . . .
3582 jr nc,as.AND_CP_OR_SUB_XOR ;1557 30 4f 0 O
3583 call assert_comma ;1559 cd be 18 . . .
3584 call arg.ww ;155c cd 1b 18 . . .
3585 jp nc,ERROR ;155f d2 07 01 . . .
3586 push af ;1562 f5 .
3587 ld a,b ;1563 78 x
3588 cp 088h ;1564 fe 88 . .
3589 ld b,04ah ;1566 06 4a . J
3590 jr z,l156ch ;1568 28 02 ( .
3591 ld b,042h ;156a 06 42 . B
3592 l156ch:
3593 pop af ;156c f1 .
3594 add a,b ;156d 80 .
3595 l156eh:
3596 ld b,a ;156e 47 G
3597 jr gen.opc.ED2 ;156f 18 d3 . .
3598 as.ADD:
3599 ld hl,t_HL.AF ;1571 21 af 1f ! . .
3600 call sub_0318h ;1574 cd 18 03 . . .
3601 jr c,l159ah ;1577 38 21 8 !
3602 call arg.IX_IY ;1579 cd 3d 18 . = .
3603 jr nc,as.AND_CP_OR_SUB_XOR ;157c 30 2a 0 *
3604 call assert_comma ;157e cd be 18 . . .
3605 ld hl,t_BC.DE.IX.SP ;1581 21 bd 1f ! . .
3606 ld a,(prefix_ixiy) ;1584 3a cc 18 : . .
3607 cp 0fdh ;1587 fe fd . .
3608 jr nz,l158eh ;1589 20 03 .
3609 ld hl,t_BC.DE.IY.SP ;158b 21 b4 1f ! . .
3610 l158eh:
3611 call arg.reg_16bit ;158e cd 18 18 . . .
3612 jp nc,ERROR ;1591 d2 07 01 . . .
3613 add a,009h ;1594 c6 09 . .
3614 l1596h:
3615 ld b,a ;1596 47 G
3616 jp l14b4h ;1597 c3 b4 14 . . .
3617 l159ah:
3618 call assert_comma ;159a cd be 18 . . .
3619 call arg.ww ;159d cd 1b 18 . . .
3620 jp nc,ERROR ;15a0 d2 07 01 . . .
3621 add a,009h ;15a3 c6 09 . .
3622 jp l13ech ;15a5 c3 ec 13 . . .
3623 as.AND_CP_OR_SUB_XOR:
3624 ld a,(de) ;15a8 1a .
3625 cp 'A' ;15a9 fe 41 . A
3626 jr nz,l15b8h ;15ab 20 0b .
3627 push de ;15ad d5 .
3628 inc de ;15ae 13 .
3629 call next_arg ;15af cd ca 02 . . .
3630 jr z,l15b7h ;15b2 28 03 ( .
3631 pop de ;15b4 d1 .
3632 jr l15b8h ;15b5 18 01 . .
3633 l15b7h:
3634 pop af ;15b7 f1 .
3635 l15b8h:
3636 call arg.r_HL_A ;15b8 cd 2e 18 . . .
3637 jr c,l15cbh ;15bb 38 0e 8 .
3638 call arg.IDX_displcmnt ;15bd cd 55 18 . U .
3639 jr c,l15cfh ;15c0 38 0d 8 .
3640 call arg.imm_8bit ;15c2 cd ff 17 . . .
3641 ld a,b ;15c5 78 x
3642 add a,046h ;15c6 c6 46 . F
3643 jp l143fh ;15c8 c3 3f 14 . ? .
3644 l15cbh:
3645 add a,b ;15cb 80 .
3646 jp l13ech ;15cc c3 ec 13 . . .
3647 l15cfh:
3648 ld a,b ;15cf 78 x
3649 add a,006h ;15d0 c6 06 . .
3650 jp l1400h ;15d2 c3 00 14 . . .
3651
3652 as.SHIFTOP:
3653 call arg.r_HL_A ;15d5 cd 2e 18 . . .
3654 jr c,l15fah ;15d8 38 20 8
3655 call arg.IDX_displcmnt ;15da cd 55 18 . U .
3656 jp nc,ERROR ;15dd d2 07 01 . . .
3657 ld a,b ;15e0 78 x
3658 add a,006h ;15e1 c6 06 . .
3659 ld b,a ;15e3 47 G
3660 l15e4h:
3661 call assert_eol ;15e4 cd d6 02 . . .
3662 ld a,(prefix_ixiy) ;15e7 3a cc 18 : . .
3663 ld (iy+000h),a ;15ea fd 77 00 . w .
3664 ld (iy+001h),0cbh ;15ed fd 36 01 cb . 6 . .
3665 ld (iy+002h),c ;15f1 fd 71 02 . q .
3666 ld (iy+003h),b ;15f4 fd 70 03 . p .
3667 ld c,004h ;15f7 0e 04 . .
3668 ret ;15f9 c9 .
3669
3670 l15fah:
3671 add a,b ;15fa 80 .
3672 l15fbh:
3673 ld b,a ;15fb 47 G
3674 call assert_eol ;15fc cd d6 02 . . .
3675 ld (iy+001h),b ;15ff fd 70 01 . p .
3676 ld (iy+000h),0cbh ;1602 fd 36 00 cb . 6 . .
3677 ld c,002h ;1606 0e 02 . .
3678 ret ;1608 c9 .
3679
3680 as.BITOP:
3681 call arg.bit ;1609 cd d3 17 . . .
3682 call assert_comma ;160c cd be 18 . . .
3683 call arg.r_HL_A ;160f cd 2e 18 . . .
3684 jr c,l1624h ;1612 38 10 8 .
3685 call arg.IDX_displcmnt ;1614 cd 55 18 . U .
3686 jp nc,ERROR ;1617 d2 07 01 . . .
3687 ld a,l ;161a 7d }
3688 rlca ;161b 07 .
3689 rlca ;161c 07 .
3690 rlca ;161d 07 .
3691 add a,006h ;161e c6 06 . .
3692 add a,b ;1620 80 .
3693 ld b,a ;1621 47 G
3694 jr l15e4h ;1622 18 c0 . .
3695 l1624h:
3696 add a,b ;1624 80 .
3697 ld b,a ;1625 47 G
3698 ld a,l ;1626 7d }
3699 rlca ;1627 07 .
3700 rlca ;1628 07 .
3701 rlca ;1629 07 .
3702 add a,b ;162a 80 .
3703 jr l15fbh ;162b 18 ce . .
3704
3705 as.CALL:
3706 push de ;162d d5 .
3707 call arg.cc_ZCPS ;162e cd a5 18 . . .
3708 jr nc,l163ch ;1631 30 09 0 .
3709 add a,b ;1633 80 .
3710 ld b,a ;1634 47 G
3711 call next_arg ;1635 cd ca 02 . . .
3712 jr z,l163eh ;1638 28 04 ( .
3713 pop de ;163a d1 .
3714 push de ;163b d5 .
3715 l163ch:
3716 ld b,0cdh ;163c 06 cd . .
3717 l163eh:
3718 pop af ;163e f1 .
3719 call test_expr ;163f cd 09 18 . . .
3720 jp as.store_3 ;1642 c3 b3 13 . . .
3721
3722 as.RET:
3723 call arg.cc_ZCPS ;1645 cd a5 18 . . .
3724 jr nc,l164eh ;1648 30 04 0 .
3725 add a,b ;164a 80 .
3726 ld b,a ;164b 47 G
3727 jr l1650h ;164c 18 02 . .
3728 l164eh:
3729 ld b,0c9h ;164e 06 c9 . .
3730 l1650h:
3731 jp as.opc.noarg ;1650 c3 3b 15 . ; .
3732
3733 as.JP:
3734 push de ;1653 d5 .
3735 call arg.cc_ZCPS ;1654 cd a5 18 . . .
3736 jr c,l1666h ;1657 38 0d 8 .
3737 l1659h:
3738 pop de ;1659 d1 .
3739 ld hl,l168ch ;165a 21 8c 16 ! . .
3740 call sub_030ah ;165d cd 0a 03 . . .
3741 jr c,l1674h ;1660 38 12 8 .
3742 ld b,0c3h ;1662 06 c3 . .
3743 jr l166eh ;1664 18 08 . .
3744
3745 l1666h:
3746 add a,b ;1666 80 .
3747 ld b,a ;1667 47 G
3748 call next_arg ;1668 cd ca 02 . . .
3749 jr nz,l1659h ;166b 20 ec .
3750 pop af ;166d f1 .
3751 l166eh:
3752 call test_expr ;166e cd 09 18 . . .
3753 jp as.store_3 ;1671 c3 b3 13 . . .
3754 l1674h:
3755 call assert_eol ;1674 cd d6 02 . . .
3756 ld a,b ;1677 78 x
3757 and a ;1678 a7 .
3758 jr nz,l1680h ;1679 20 05 .
3759 ld b,0e9h ;167b 06 e9 . .
3760 jp as.opc.noarg ;167d c3 3b 15 . ; .
3761 l1680h:
3762 ld b,0ddh ;1680 06 dd . .
3763 dec a ;1682 3d =
3764 jr z,l1687h ;1683 28 02 ( .
3765 ld b,0fdh ;1685 06 fd . .
3766 l1687h:
3767 ld l,0e9h ;1687 2e e9 . .
3768 jp as.store_2 ;1689 c3 40 14 . @ .
3769
3770 l168ch:
3771 DC '(HL)'
3772 DC '(IX)'
3773 DC '(IY)'
3774 DB 0
3775
3776 as.DJNZ:
3777 call next_arg ;1699 cd ca 02 . . .
3778 ld b,010h ;169c 06 10 . .
3779 jr l16aeh ;169e 18 0e . .
3780 as.JR:
3781 call arg.cc_ZC ;16a0 cd ac 18 . . .
3782 jr c,l16a9h ;16a3 38 04 8 .
3783 ld b,018h ;16a5 06 18 . .
3784 jr l16aeh ;16a7 18 05 . .
3785 l16a9h:
3786 add a,b ;16a9 80 .
3787 ld b,a ;16aa 47 G
3788 call assert_comma ;16ab cd be 18 . . .
3789 l16aeh:
3790 call arg.j_displ ;16ae cd dc 17 . . .
3791 jp as.store_2 ;16b1 c3 40 14 . @ .
3792
3793 as.IM:
3794 call arg.imm_8bit ;16b4 cd ff 17 . . .
3795 ld a,l ;16b7 7d }
3796 cp 003h ;16b8 fe 03 . .
3797 jr nc,error2 ;16ba 30 5c 0 \
3798 and a ;16bc a7 .
3799 jr z,l16c7h ;16bd 28 08 ( .
3800 ld b,056h ;16bf 06 56 . V
3801 cp 001h ;16c1 fe 01 . .
3802 jr z,l16c7h ;16c3 28 02 ( .
3803 ld b,05eh ;16c5 06 5e . ^
3804 l16c7h:
3805 jp gen.opc.ED2 ;16c7 c3 44 15 . D .
3806
3807 as.RST:
3808 call arg.imm_8bit ;16ca cd ff 17 . . .
3809 ld a,l ;16cd 7d }
3810 push af ;16ce f5 .
3811 add a,b ;16cf 80 .
3812 ld b,a ;16d0 47 G
3813 pop af ;16d1 f1 .
3814 and 0c7h ;16d2 e6 c7 . .
3815 jr nz,error2 ;16d4 20 42 B
3816 jp as.opc.noarg ;16d6 c3 3b 15 . ; .
3817
3818 as.POP_PUSH:
3819 call arg.IX_IY ;16d9 cd 3d 18 . = .
3820 jr c,l16e7h ;16dc 38 09 8 .
3821 call arg.zz ;16de cd 12 18 . . .
3822 jr nc,error2 ;16e1 30 35 0 5
3823 add a,b ;16e3 80 .
3824 jp l13ech ;16e4 c3 ec 13 . . .
3825 l16e7h:
3826 ld a,b ;16e7 78 x
3827 add a,020h ;16e8 c6 20 .
3828 jp l1596h ;16ea c3 96 15 . . .
3829
3830 as.IN:
3831 call arg.r_HL_A ;16ed cd 2e 18 . . .
3832 jr nc,error2 ;16f0 30 26 0 &
3833 cp 006h ;16f2 fe 06 . .
3834 jr z,error2 ;16f4 28 22 ( "
3835 rlca ;16f6 07 .
3836 rlca ;16f7 07 .
3837 rlca ;16f8 07 .
3838 add a,b ;16f9 80 .
3839 ld b,a ;16fa 47 G
3840 cp 078h ;16fb fe 78 . x
3841 jr nz,l170fh ;16fd 20 10 .
3842 call assert_comma ;16ff cd be 18 . . .
3843 call sub_171bh ;1702 cd 1b 17 . . .
3844 jr c,l1715h ;1705 38 0e 8 .
3845 call arg.addr_8bit ;1707 cd f3 17 . . .
3846 ld b,0dbh ;170a 06 db . .
3847 jp as.store_2 ;170c c3 40 14 . @ .
3848 l170fh:
3849 call assert_comma ;170f cd be 18 . . .
3850 call sub_171bh ;1712 cd 1b 17 . . .
3851 l1715h:
3852 jp c,gen.opc.ED2 ;1715 da 44 15 . D .
3853 error2:
3854 jp ERROR ;1718 c3 07 01 . . .
3855
3856 sub_171bh:
3857 ld hl,t__C_ ;171b 21 f4 1f ! . .
3858 jp sub_0318h ;171e c3 18 03 . . .
3859
3860 as.OUT:
3861 call sub_171bh ;1721 cd 1b 17 . . .
3862 jr nc,l1739h ;1724 30 13 0 .
3863 call assert_comma ;1726 cd be 18 . . .
3864 call arg.r_HL_A ;1729 cd 2e 18 . . .
3865 jr nc,error2 ;172c 30 ea 0 .
3866 cp 006h ;172e fe 06 . .
3867 jr z,error2 ;1730 28 e6 ( .
3868 rlca ;1732 07 .
3869 rlca ;1733 07 .
3870 rlca ;1734 07 .
3871 add a,b ;1735 80 .
3872 jp l156eh ;1736 c3 6e 15 . n .
3873
3874 l1739h:
3875 call arg.addr_8bit ;1739 cd f3 17 . . .
3876 call assert_comma ;173c cd be 18 . . .
3877 cp 'A' ;173f fe 41 . A
3878 jr nz,error2 ;1741 20 d5 .
3879 inc de ;1743 13 .
3880 ld b,0d3h ;1744 06 d3 . .
3881 jp as.store_2 ;1746 c3 40 14 . @ .
3882
3883 as.EX:
3884 ld hl,b_176d_start ;1749 21 6d 17 ! m .
3885 call sub_030ah ;174c cd 0a 03 . . .
3886 jp nc,ERROR ;174f d2 07 01 . . .
3887 ld c,b ;1752 48 H
3888 call assert_eol ;1753 cd d6 02 . . .
3889 ld b,000h ;1756 06 00 . .
3890 ld hl,l178eh ;1758 21 8e 17 ! . .
3891 add hl,bc ;175b 09 .
3892 add hl,bc ;175c 09 .
3893 ld a,(hl) ;175d 7e ~
3894 ld (iy+000h),a ;175e fd 77 00 . w .
3895 ld c,001h ;1761 0e 01 . .
3896 inc hl ;1763 23 #
3897 ld a,(hl) ;1764 7e ~
3898 and a ;1765 a7 .
3899 ret z ;1766 c8 .
3900 ld (iy+001h),a ;1767 fd 77 01 . w .
3901 ld c,002h ;176a 0e 02 . .
3902 ret ;176c c9 .
3903
3904 b_176d_start:
3905 DC 'AF,AF'''
3906 l1773h:
3907 DC 'DE,HL'
3908 DC '(SP),HL'
3909 DC '(SP),IX'
3910 DC '(SP),IY'
3911 db 0
3912 l178eh:
3913 db 008h,000h ;178e 08 .
3914 db 0ebh,000h ;1790 eb .
3915 db 0e3h,000h ;1792 e3 .
3916 db 0ddh,0e3h ;1794 dd .
3917 db 0fdh,0e3h ;1796 fd .
3918
3919 as.DEC_INC:
3920 call arg.IX_IY ;1798 cd 3d 18 . = .
3921 jr c,l17b3h ;179b 38 16 8 .
3922 call arg.ww ;179d cd 1b 18 . . .
3923 jr c,l17bfh ;17a0 38 1d 8 .
3924 call arg.r_HL_A ;17a2 cd 2e 18 . . .
3925 jr c,l17cch ;17a5 38 25 8 %
3926 call arg.IDX_displcmnt ;17a7 cd 55 18 . U .
3927 jp nc,ERROR ;17aa d2 07 01 . . .
3928 ld a,b ;17ad 78 x
3929 add a,030h ;17ae c6 30 . 0
3930 jp l1400h ;17b0 c3 00 14 . . .
3931 l17b3h:
3932 ld a,b ;17b3 78 x
3933 ld b,023h ;17b4 06 23 . #
3934 cp 004h ;17b6 fe 04 . .
3935 jr z,l17bch ;17b8 28 02 ( .
3936 ld b,02bh ;17ba 06 2b . +
3937 l17bch:
3938 jp l14b4h ;17bc c3 b4 14 . . .
3939 l17bfh:
3940 push af ;17bf f5 .
3941 ld a,b ;17c0 78 x
3942 ld b,003h ;17c1 06 03 . .
3943 cp 004h ;17c3 fe 04 . .
3944 jr z,l17c9h ;17c5 28 02 ( .
3945 ld b,00bh ;17c7 06 0b . .
3946 l17c9h:
3947 pop af ;17c9 f1 .
3948 jr l17cfh ;17ca 18 03 . .
3949 l17cch:
3950 rlca ;17cc 07 .
3951 rlca ;17cd 07 .
3952 rlca ;17ce 07 .
3953 l17cfh:
3954 add a,b ;17cf 80 .
3955 jp l13ech ;17d0 c3 ec 13 . . .
3956
3957 arg.bit:
3958 call arg.imm_8bit ;17d3 cd ff 17 . . .
3959 ld a,l ;17d6 7d }
3960 cp 008h ;17d7 fe 08 . .
3961 jr nc,error3 ;17d9 30 34 0 4
3962 ret ;17db c9 .
3963
3964 arg.j_displ:
3965 call test_expr ;17dc cd 09 18 . . .
3966 push bc ;17df c5 .
3967 push iy ;17e0 fd e5 . .
3968 pop bc ;17e2 c1 .
3969 and a ;17e3 a7 .
3970 sbc hl,bc ;17e4 ed 42 . B
3971 dec hl ;17e6 2b +
3972 dec hl ;17e7 2b +
3973 pop bc ;17e8 c1 .
3974 call sub_1802h ;17e9 cd 02 18 . . .
3975 ld a,h ;17ec 7c |
3976 xor l ;17ed ad .
3977 bit 7,a ;17ee cb 7f . \7f
3978 jr nz,error3 ;17f0 20 1d .
3979 ret ;17f2 c9 .
3980
3981 arg.addr_8bit:
3982 ld a,(de) ;17f3 1a .
3983 cp '(' ;17f4 fe 28 . (
3984 jr nz,arg.imm_8bit ;17f6 20 07 .
3985 inc de ;17f8 13 .
3986 call arg.imm_8bit ;17f9 cd ff 17 . . .
3987 jp test_paren_close ;17fc c3 c5 18 . . .
3988
3989 arg.imm_8bit:
3990 call test_expr ;17ff cd 09 18 . . .
3991 sub_1802h:
3992 ld a,h ;1802 7c |
3993 and a ;1803 a7 .
3994 ret z ;1804 c8 .
3995 inc a ;1805 3c <
3996 ret z ;1806 c8 .
3997 jr error3 ;1807 18 06 . .
3998
3999 test_expr:
4000 push bc ;1809 c5 .
4001 call expr ;180a cd be 03 . . .
4002 pop bc ;180d c1 .
4003 ret nc ;180e d0 .
4004 error3:
4005 jp ERROR ;180f c3 07 01 . . .
4006
4007 arg.zz:
4008 push hl ;1812 e5 .
4009 ld hl,t_BC.DE.HL.AF ;1813 21 ab 1f ! . .
4010 jr l181fh ;1816 18 07 . .
4011
4012 arg.reg_16bit:
4013 push hl ;1818 e5 .
4014 jr l181fh ;1819 18 04 . .
4015
4016 arg.ww:
4017 push hl ;181b e5 .
4018 ld hl,t_BC.DE.HL.SP ;181c 21 a2 1f ! . .
4019 l181fh:
4020 push bc ;181f c5 .
4021 call sub_030ah ;1820 cd 0a 03 . . .
4022 jr nc,l182bh ;1823 30 06 0 .
4023 ld a,b ;1825 78 x
4024 rlca ;1826 07 .
4025 rlca ;1827 07 .
4026 rlca ;1828 07 .
4027 rlca ;1829 07 .
4028 scf ;182a 37 7
4029 l182bh:
4030 pop bc ;182b c1 .
4031 pop hl ;182c e1 .
4032 ret ;182d c9 .
4033
4034 arg.r_HL_A:
4035 call skipbl ;182e cd bf 02 . . .
4036 push bc ;1831 c5 .
4037 push hl ;1832 e5 .
4038 ld hl,t_BCDEHL_HL_A ;1833 21 96 1f ! . .
4039 call sub_030ah ;1836 cd 0a 03 . . .
4040 ld a,b ;1839 78 x
4041 pop hl ;183a e1 .
4042 pop bc ;183b c1 .
4043 ret ;183c c9 .
4044
4045 arg.IX_IY:
4046 push hl ;183d e5 .
4047 push bc ;183e c5 .
4048 ld hl,t_IX.IY ;183f 21 c8 1f ! . .
4049 call sub_030ah ;1842 cd 0a 03 . . .
4050 jr nc,l1852h ;1845 30 0b 0 .
4051 ld a,0ddh ;1847 3e dd > .
4052 dec b ;1849 05 .
4053 jr nz,l184eh ;184a 20 02 .
4054 ld a,0fdh ;184c 3e fd > .
4055 l184eh:
4056 ld (prefix_ixiy),a ;184e 32 cc 18 2 . .
4057 scf ;1851 37 7
4058 l1852h:
4059 pop bc ;1852 c1 .
4060 pop hl ;1853 e1 .
4061 ret ;1854 c9 .
4062
4063 arg.IDX_displcmnt:
4064 push hl ;1855 e5 .
4065 push bc ;1856 c5 .
4066 ld a,(de) ;1857 1a .
4067 cp '(' ;1858 fe 28 . (
4068 jr nz,l18a1h ;185a 20 45 E
4069 push de ;185c d5 .
4070 inc de ;185d 13 .
4071 ld hl,t_IX.IY ;185e 21 c8 1f ! . .
4072 call sub_030ah ;1861 cd 0a 03 . . .
4073 jr nc,l18a0h ;1864 30 3a 0 :
4074 pop af ;1866 f1 .
4075 ld a,0ddh ;1867 3e dd > .
4076 dec b ;1869 05 .
4077 jr nz,l186eh ;186a 20 02 .
4078 ld a,0fdh ;186c 3e fd > .
4079 l186eh:
4080 ld (prefix_ixiy),a ;186e 32 cc 18 2 . .
4081 ld a,(de) ;1871 1a .
4082 cp '+' ;1872 fe 2b . +
4083 jr z,l1882h ;1874 28 0c ( .
4084 cp ')' ;1876 fe 29 . )
4085 ld hl,0 ;1878 21 00 00 ! . .
4086 jr z,l189ah ;187b 28 1d ( .
4087 cp '-' ;187d fe 2d . -
4088 jp nz,ERROR ;187f c2 07 01 . . .
4089 l1882h:
4090 push af ;1882 f5 .
4091 inc de ;1883 13 .
4092 call arg.imm_8bit ;1884 cd ff 17 . . .
4093 pop af ;1887 f1 .
4094 cp '+' ;1888 fe 2b . +
4095 jr z,l1894h ;188a 28 08 ( .
4096 ld b,h ;188c 44 D
4097 ld c,l ;188d 4d M
4098 ld hl,0 ;188e 21 00 00 ! . .
4099 and a ;1891 a7 .
4100 sbc hl,bc ;1892 ed 42 . B
4101 l1894h:
4102 ld a,(de) ;1894 1a .
4103 cp ')' ;1895 fe 29 . )
4104 jp nz,ERROR ;1897 c2 07 01 . . .
4105 l189ah:
4106 inc de ;189a 13 .
4107 pop bc ;189b c1 .
4108 ld c,l ;189c 4d M
4109 pop hl ;189d e1 .
4110 scf ;189e 37 7
4111 ret ;189f c9 .
4112 l18a0h:
4113 pop de ;18a0 d1 .
4114 l18a1h:
4115 pop bc ;18a1 c1 .
4116 pop hl ;18a2 e1 .
4117 and a ;18a3 a7 .
4118 ret ;18a4 c9 .
4119
4120 arg.cc_ZCPS:
4121 ld hl,t_tstfl_ZCPS ;18a5 21 dc 1f ! . .
4122 ld c,007h ;18a8 0e 07 . .
4123 jr l18b1h ;18aa 18 05 . .
4124
4125 arg.cc_ZC:
4126 ld hl,t_tstfl_ZC ;18ac 21 cd 1f ! . .
4127 ld c,003h ;18af 0e 03 . .
4128 l18b1h:
4129 push bc ;18b1 c5 .
4130 call sub_030ah ;18b2 cd 0a 03 . . .
4131 ld a,b ;18b5 78 x
4132 pop bc ;18b6 c1 .
4133 ret nc ;18b7 d0 .
4134 and c ;18b8 a1 .
4135 rlca ;18b9 07 .
4136 rlca ;18ba 07 .
4137 rlca ;18bb 07 .
4138 scf ;18bc 37 7
4139 ret ;18bd c9 .
4140
4141 assert_comma:
4142 call next_arg ;18be cd ca 02 . . .
4143 ret z ;18c1 c8 .
4144 l18c2h:
4145 jp ERROR ;18c2 c3 07 01 . . .
4146
4147 test_paren_close:
4148 ld a,(de) ;18c5 1a .
4149 cp ')' ;18c6 fe 29 . )
4150 jr nz,l18c2h ;18c8 20 f8 .
4151 inc de ;18ca 13 .
4152 ret ;18cb c9 .
4153
4154 prefix_ixiy:
4155 db 0 ;18cc 00 .
4156
4157 cmd_L:
4158 ld hl,cmd_L ;18cd 21 cd 18 ! . .
4159 ld (cmd_rpt),hl ;18d0 22 68 00 " h .
4160 call expr ;18d3 cd be 03 . . .
4161 jr nc,l18dbh ;18d6 30 03 0 .
4162 ld hl,(last_L) ;18d8 2a f9 1f * . .
4163 l18dbh:
4164 push hl ;18db e5 .
4165 pop iy ;18dc fd e1 . .
4166 call next_arg ;18de cd ca 02 . . .
4167 call get_range ;18e1 cd 9a 03 . . .
4168 jr nc,l1905h ;18e4 30 1f 0 .
4169 call assert_eol ;18e6 cd d6 02 . . .
4170 ld b,16 ;18e9 06 10 . .
4171 l18ebh:
4172 push bc ;18eb c5 .
4173 push iy ;18ec fd e5 . .
4174 pop hl ;18ee e1 .
4175 push hl ;18ef e5 .
4176 call p_disas_line ;18f0 cd 2d 19 . - .
4177 call crlf ;18f3 cd a3 02 . . .
4178 pop iy ;18f6 fd e1 . .
4179 ld c,b ;18f8 48 H
4180 ld b,0 ;18f9 06 00 . .
4181 add iy,bc ;18fb fd 09 . .
4182 ld (last_L),iy ;18fd fd 22 f9 1f . " . .
4183 pop bc ;1901 c1 .
4184 djnz l18ebh ;1902 10 e7 . .
4185 ret ;1904 c9 .
4186 l1905h:
4187 call assert_eol ;1905 cd d6 02 . . .
4188 ld h,b ;1908 60 `
4189 ld l,c ;1909 69 i
4190 ld a,b ;190a 78 x
4191 or c ;190b b1 .
4192 jr nz,l190fh ;190c 20 01 .
4193 dec hl ;190e 2b +
4194 l190fh:
4195 push hl ;190f e5 .
4196 push iy ;1910 fd e5 . .
4197 pop hl ;1912 e1 .
4198 push hl ;1913 e5 .
4199 call p_disas_line ;1914 cd 2d 19 . - .
4200 call crlf ;1917 cd a3 02 . . .
4201 pop iy ;191a fd e1 . .
4202 ld e,b ;191c 58 X
4203 ld d,000h ;191d 16 00 . .
4204 add iy,de ;191f fd 19 . .
4205 ld (last_L),iy ;1921 fd 22 f9 1f . " . .
4206 pop hl ;1925 e1 .
4207 and a ;1926 a7 .
4208 sbc hl,de ;1927 ed 52 . R
4209 ret z ;1929 c8 .
4210 ret c ;192a d8 .
4211 jr l190fh ;192b 18 e2 . .
4212
4213 p_disas_line:
4214 call out.hl.@ ;192d cd a4 01 . . .
4215 call z,outbl ;1930 cc 9f 02 . . .
4216 call outbl ;1933 cd 9f 02 . . .
4217 sub a ;1936 97 .
4218 ld (con_col),a ;1937 32 72 02 2 r .
4219 call p_disas_instr ;193a cd 65 19 . e .
4220 and a ;193d a7 .
4221 ret z ;193e c8 .
4222
4223 l193fh:
4224 call outbl ;193f cd 9f 02 . . .
4225 ld a,(con_col) ;1942 3a 72 02 : r .
4226 cp 16 ;1945 fe 10 . .
4227 jr c,l193fh ;1947 38 f6 8 .
4228
4229 p_offset:
4230 ld de,(offs.@) ;1949 ed 5b 64 00 . [ d .
4231 ld a,d ;194d 7a z
4232 or e ;194e b3 .
4233 ret z ;194f c8 .
4234 call p_char_lparen ;1952 cd 5d 02 . ] .
4235 ld a,'@' ;1955 3e 40 > @
4236 call outchar ;1957 cd 5d 02 . ] .
4237 and a ;195a a7 .
4238 sbc hl,de ;195b ed 52 . R
4239 call out_hl ;195d cd 13 02 . . .
4240 jp out_rparen ;1962 c3 5d 02 . ] .
4241
4242 p_disas_instr:
4243 sub a ;1965 97 .
4244 ld (l1ffdh),a ;1966 32 fd 1f 2 . .
4245 call disas_get_instrlen ;1969 cd 8c 19 . . .
4246 jr nc,l197fh ;196c 30 11 0 .
4247 push bc ;196e c5 .
4248 call p_mnemonic ;196f cd b9 1e . . .
4249 ex de,hl ;1972 eb .
4250 call call_hl ;1973 cd c1 19 . . .
4251 pop bc ;1976 c1 .
4252 ld a,(l1ffdh) ;1977 3a fd 1f : . .
4253 ld hl,(l1ffbh) ;197a 2a fb 1f * . .
4254 scf ;197d 37 7
4255 ret ;197e c9 .
4256
4257 l197fh:
4258 ld hl,msg_undef_opcode ;197f 21 89 19 ! . .
4259 call pstr ;1982 cd 88 02 . . .
4260 ld b,001h ;1985 06 01 . .
4261 sub a ;1987 97 .
4262 ret ;1988 c9 .
4263
4264 msg_undef_opcode:
4265 DC '???'
4266
4267 disas_get_instrlen:
4268 sub a ;198c 97 .
4269 ld (isprefix_ixiy),a ;198d 32 f8 1f 2 . .
4270 ld a,(iy+000h) ;1990 fd 7e 00 . ~ .
4271 cp 0edh ;1993 fe ed . .
4272 jp z,disas_pfx.ED ;1995 ca 19 1a . . .
4273 cp 0ddh ;1998 fe dd . .
4274 jr z,l19abh ;199a 28 0f ( .
4275 cp 0fdh ;199c fe fd . .
4276 jr z,l19afh ;199e 28 0f ( .
4277 sub_19a0h:
4278 ld a,(iy+000h) ;19a0 fd 7e 00 . ~ .
4279 cp 0cbh ;19a3 fe cb . .
4280 jp z,disas_pfx.CB ;19a5 ca 36 1a . 6 .
4281 jp disas_nopfx ;19a8 c3 4d 1a . M .
4282 l19abh:
4283 ld a,1 ;19ab 3e 01 > .
4284 jr l19b1h ;19ad 18 02 . .
4285 l19afh:
4286 ld a,2 ;19af 3e 02 > .
4287 l19b1h:
4288 ld (isprefix_ixiy),a ;19b1 32 f8 1f 2 . .
4289 call disas_pfx.DDFD ;19b4 cd c2 19 . . .
4290 ret nc ;19b7 d0 .
4291 push bc ;19b8 c5 .
4292 call sub_19a0h ;19b9 cd a0 19 . . .
4293 pop af ;19bc f1 .
4294 add a,b ;19bd 80 .
4295 ld b,a ;19be 47 G
4296 scf ;19bf 37 7
4297 ret ;19c0 c9 .
4298
4299 disas_pfx.DDFD:
4300 inc iy ;19c2 fd 23 . #
4301 ld hl,b_19ef_start ;19c4 21 ef 19 ! . .
4302 call test_DDFD ;19c7 cd 8c 1a . . .
4303 ld b,002h ;19ca 06 02 . .
4304 ret c ;19cc d8 .
4305 ld hl,l1a0ah ;19cd 21 0a 1a ! . .
4306 call test_DDFD ;19d0 cd 8c 1a . . .
4307 ld b,001h ;19d3 06 01 . .
4308 ret c ;19d5 d8 .
4309 ld a,(iy+000h) ;19d6 fd 7e 00 . ~ .
4310 cp 0cbh ;19d9 fe cb . .
4311 jr nz,l19edh ;19db 20 10 .
4312 ld a,(iy+002h) ;19dd fd 7e 02 . ~ .
4313 cp 036h ;19e0 fe 36 . 6
4314 ret z ;19e2 c8 .
4315 and 007h ;19e3 e6 07 . .
4316 cp 006h ;19e5 fe 06 . .
4317 jr nz,l19edh ;19e7 20 04 .
4318 ld b,002h ;19e9 06 02 . .
4319 scf ;19eb 37 7
4320 ret ;19ec c9 .
4321 l19edh:
4322 and a ;19ed a7 .
4323 ret ;19ee c9 .
4324
4325 ; DD/FD 3 byte (ix+d)/(iy+d)
4326 b_19ef_start:
4327 defb 034h ;19ef 34 4
4328 defb 035h ;19f0 35 5
4329 defb 036h ;19f1 36 6
4330 defb 046h ;19f2 46 F
4331 defb 04eh ;19f3 4e N
4332 defb 056h ;19f4 56 V
4333 defb 05eh ;19f5 5e ^
4334 defb 066h ;19f6 66 f
4335 defb 06eh ;19f7 6e n
4336 defb 070h ;19f8 70 p
4337 defb 071h ;19f9 71 q
4338 defb 072h ;19fa 72 r
4339 defb 073h ;19fb 73 s
4340 defb 074h ;19fc 74 t
4341 defb 075h ;19fd 75 u
4342 defb 077h ;19ff 77 w
4343 defb 07eh ;1a00 7e ~
4344 defb 086h ;1a01 86 .
4345 defb 08eh ;1a02 8e .
4346 defb 096h ;1a03 96 .
4347 defb 09eh ;1a04 9e .
4348 defb 0a6h ;1a05 a6 .
4349 defb 0aeh ;1a06 ae .
4350 defb 0b6h ;1a07 b6 .
4351 defb 0beh ;1a08 be .
4352 defb 0 ;1a09 00 .
4353
4354 ; DD/FD 2 byte
4355 l1a0ah:
4356 defb 009h ;1a0a 09 .
4357 defb 019h ;1a0b 19 .
4358 defb 021h ;1a0c 21 !
4359 defb 022h ;1a0d 22 "
4360 defb 023h ;1a0e 23 #
4361 defb 029h ;1a0f 29 )
4362 defb 02ah ;1a10 2a *
4363 defb 02bh ;1a11 2b +
4364 defb 039h ;1a12 39 9
4365 defb 0e1h ;1a13 e1 .
4366 defb 0e3h ;1a14 e3 .
4367 defb 0e5h ;1a15 e5 .
4368 defb 0e9h ;1a16 e9 .
4369 defb 0f9h ;1a17 f9 .
4370 defb 0 ;1a18 00 .
4371
4372 disas_pfx.ED:
4373 inc iy ;1a19 fd 23 . #
4374 ld hl,b_1bc9_start ;1a1b 21 c9 1b ! . .
4375 call sub_1a72h ;1a1e cd 72 1a . r .
4376 ld b,2 ;1a21 06 02 . .
4377 ret c ;1a23 d8 .
4378 ld hl,b_1bf4_start ;1a24 21 f4 1b ! . .
4379 call lookup_opc ;1a27 cd 97 1a . . .
4380 ld b,2 ;1a2a 06 02 . .
4381 ret c ;1a2c d8 .
4382
4383 ld hl,l228bh
4384 call lookup_opc
4385 ld b,3
4386 ret c
4387 ld hl,b_1c40_start ;1a2d 21 40 1c ! @ .
4388 call lookup_opc ;1a30 cd 97 1a . . .
4389 ld b,4 ;1a33 06 04 . .
4390 ret ;1a35 c9 .
4391
4392 disas_pfx.CB:
4393 push iy ;1a36 fd e5 . .
4394 inc iy ;1a38 fd 23 . #
4395 ld a,(isprefix_ixiy) ;1a3a 3a f8 1f : . .
4396 and a ;1a3d a7 .
4397 jr z,l1a42h ;1a3e 28 02 ( .
4398 inc iy ;1a40 fd 23 . #
4399 l1a42h:
4400 ld hl,b_1c55_start ;1a42 21 55 1c ! U .
4401 call lookup_opc ;1a45 cd 97 1a . . .
4402 pop iy ;1a48 fd e1 . .
4403 ld b,2 ;1a4a 06 02 . .
4404 ret ;1a4c c9 .
4405
4406 disas_nopfx:
4407 ld hl,b_1b54_start ;1a4d 21 54 1b ! T .
4408 call lookup_opc ;1a50 cd 97 1a . . .
4409 ld b,2 ;1a53 06 02 . .
4410 ret c ;1a55 d8 .
4411 ld hl,b_1ab6_start ;1a56 21 b6 1a ! . .
4412 call sub_1a72h ;1a59 cd 72 1a . r .
4413 ld b,1 ;1a5c 06 01 . .
4414 ret c ;1a5e d8 .
4415 ld hl,b_1ad1_start ;1a5f 21 d1 1a ! . .
4416 call lookup_opc ;1a62 cd 97 1a . . .
4417 ld b,1 ;1a65 06 01 . .
4418 ret c ;1a67 d8 .
4419 ld hl,b_1b9b_start ;1a68 21 9b 1b ! . .
4420 call lookup_opc ;1a6b cd 97 1a . . .
4421 ret nc ;1a6e d0 .
4422 ld b,3 ;1a6f 06 03 . .
4423 ret ;1a71 c9 .
4424
4425 sub_1a72h:
4426 ld a,(hl) ;1a72 7e ~
4427 cp 0ffh ;1a73 fe ff . .
4428 ret z ;1a75 c8 .
4429 cp (iy+000h) ;1a76 fd be 00 . . .
4430 jr z,l1a7fh ;1a79 28 04 ( .
4431 inc hl ;1a7b 23 #
4432 inc hl ;1a7c 23 #
4433 jr sub_1a72h ;1a7d 18 f3 . .
4434 l1a7fh:
4435 inc hl ;1a7f 23 #
4436 ld c,(hl) ;1a80 4e N
4437 ld hl,t_MNEMONICS ;1a81 21 c6 1e ! . .
4438 ld b,0 ;1a84 06 00 . .
4439 add hl,bc ;1a86 09 .
4440 ld de,l1c97h ;1a87 11 97 1c . . .
4441 scf ;1a8a 37 7
4442 ret ;1a8b c9 .
4443
4444 test_DDFD:
4445 ld a,(hl) ;1a8c 7e ~
4446 and a ;1a8d a7 .
4447 ret z ;1a8e c8 .
4448 inc hl ;1a8f 23 #
4449 cp (iy+000h) ;1a90 fd be 00 . . .
4450 jr nz,test_DDFD ;1a93 20 f7 .
4451 scf ;1a95 37 7
4452 ret ;1a96 c9 .
4453
4454 lookup_opc:
4455 ld a,(iy+000h) ;1a97 fd 7e 00 . ~ .
4456 and (hl) ;1a9a a6 .
4457 inc hl ;1a9b 23 #
4458 cp (hl) ;1a9c be .
4459 jr z,l1aa8h ;1a9d 28 09 ( .
4460 inc hl ;1a9f 23 #
4461 inc hl ;1aa0 23 #
4462 inc hl ;1aa1 23 #
4463 inc hl ;1aa2 23 #
4464 ld a,(hl) ;1aa3 7e ~
4465 and a ;1aa4 a7 .
4466 jr nz,lookup_opc ;1aa5 20 f0 .
4467 ret ;1aa7 c9 .
4468 l1aa8h:
4469 inc hl ;1aa8 23 #
4470 ld c,(hl) ;1aa9 4e N
4471 inc hl ;1aaa 23 #
4472 ld e,(hl) ;1aab 5e ^
4473 inc hl ;1aac 23 #
4474 ld d,(hl) ;1aad 56 V
4475 ld hl,t_MNEMONICS ;1aae 21 c6 1e ! . .
4476 ld b,000h ;1ab1 06 00 . .
4477 add hl,bc ;1ab3 09 .
4478 scf ;1ab4 37 7
4479 ret ;1ab5 c9 .
4480
4481 ; 1 byte opcodes (no parameters)
4482 ; Format: db opcode, t_MNEMONICS-index
4483 b_1ab6_start:
4484 db 076h,039h ;halt
4485 db 0d9h,036h ;exx
4486 db 0f3h,02ch ;di
4487 db 0fbh,032h ;ei
4488 db 000h,069h ;nop
4489 db 007h,09eh ;rlca
4490 db 00fh,0adh ;rrca
4491 db 017h,098h ;rla
4492 db 01fh,0a7h ;rra
4493 db 027h,026h ;daa
4494 db 02fh,023h ;cpl
4495 db 037h,0bah ;scf
4496 db 03fh,010h ;ccf
4497 db 0ffh
4498
4499
4500 ; 1 byte opcodes
4501 ; Format: db mask, match, t_MNEMONICS-index
4502 ; dw argument formating fuction
4503 b_1ad1_start:
4504 db 0c0h,040h,056h ;ld r,r
4505 dw p_arg_r_r
4506 db 0f8h,080h,003h ;add a,r
4507 dw p_arg_a_r
4508 db 0f8h,088h,000h ;adc a,r
4509 dw p_arg_a_r
4510 db 0f8h,090h,0c9h ;sub r
4511 dw p_arg_rs
4512 db 0f8h,098h,0b7h ;sbc a,r
4513 dw p_arg_a_r
4514 db 0f8h,0a0h,006h ;and r
4515 dw p_arg_rs
4516 db 0f8h,0a8h,0cch ;xor r
4517 dw p_arg_rs
4518 db 0f8h,0b0h,06ch ;or r
4519 dw p_arg_rs
4520 db 0f8h,0b8h,013h ;cp r
4521 dw p_arg_rs
4522 db 0c7h,0c0h,08bh ;ret cc
4523 dw p_arg_cc
4524 db 0c7h,0c7h,0b4h ;rst
4525 dw l1c98h
4526 db 0ffh,0c9h,08bh ;ret
4527 dw l1c97h
4528 db 0cfh,0c1h,081h ;pop rr
4529 dw p_arg_zz
4530 db 0cfh,0c5h,084h ;push rr
4531 dw p_arg_zz
4532 db 0ffh,0e3h,034h ;ex (sp),hl
4533 dw l1ca0h
4534 db 0ffh,0e9h,052h ;jp (hl)
4535 dw l1caeh
4536 db 0ffh,0ebh,034h ;ex de,hl
4537 dw p_arg_ex_dehl
4538 db 0ffh,0f9h,056h ;ld sp,hl
4539 dw l1cc1h
4540 db 0cfh,003h,041h ;inc rr
4541 dw p_arg_ww
4542 db 0cfh,00bh,029h ;dec rr
4543 dw p_arg_ww
4544 db 0c7h,004h,041h ;inc r
4545 dw p_arg_r
4546 db 0c7h,005h,029h ;dec r
4547 dw p_arg_r
4548 db 0ffh,008h,034h ;ex af,af'
4549 dw p_arg_ex_afaf
4550 db 0cfh,009h,003h ;add hl,rr
4551 dw l1cd3h
4552 db 0efh,002h,056h ;ld (rr),a ;rr=bc,de
4553 dw l1cdch
4554 db 0efh,00ah,056h ;ld a,(rr) ;rr=bc,de
4555 dw l1ce5h
4556 db 0
4557
4558 ; 2 byte opdodes
4559 b_1b54_start:
4560 db 0c7h,006h,056h ;ld r,nn
4561 dw l1cfah
4562 db 0ffh,0c6h,003h ;add a,nn
4563 dw l1cf5h
4564 db 0ffh,0ceh,000h ;adc a,nn
4565 dw l1cf5h
4566 db 0ffh,0d6h,0c9h ;sub a,nn
4567 dw l1d09h
4568 db 0ffh,0deh,0b7h ;sbc a,nn
4569 dw l1cf5h
4570 db 0ffh,0e6h,006h ;and a,nn
4571 dw l1d09h
4572 db 0ffh,0eeh,0cch ;xor nn
4573 dw l1d09h
4574 db 0ffh,0f6h,06ch ;or nn
4575 dw l1d09h
4576 db 0ffh,0feh,013h ;cp a,nn
4577 dw l1d09h
4578 db 0ffh,010h,02eh ;djnz
4579 dw l1d1ah
4580 db 0ffh,018h,054h ;jr
4581 dw l1d1ah
4582 db 0e7h,020h,054h ;jr,cc
4583 dw l1d0fh
4584 db 0ffh,0d3h,076h ;out (nn),a
4585 dw l1d37h
4586 db 0ffh,0dbh,03fh ;in a,(nn)
4587 dw l1d29h
4588 db 0
4589
4590 ; 3 byte opcodes
4591 b_1b9b_start:
4592 db 0c7h,0c2h,052h ;jp cc,mn
4593 dw p_arg_cc_mn
4594 db 0c7h,0c4h,00ch ;call cc,mn
4595 dw p_arg_cc_mn
4596 db 0cfh,001h,056h ;ld ww,mn
4597 dw p_arg_ww_mn
4598 db 0ffh,0c3h,052h ;jp mn
4599 dw p_arg_mn
4600 db 0ffh,0cdh,00ch ;call mn
4601 dw p_arg_mn
4602 db 0ffh,022h,056h ;ld (mn),hl
4603 dw p_arg_addr_hl
4604 db 0ffh,02ah,056h ;ld hl,(mn)
4605 dw p_arg_hl_addr
4606 db 0ffh,032h,056h ;ld (mn),a
4607 dw p_arg_addr_a
4608 db 0ffh,03ah,056h ;ld a,(mn)
4609 dw p_arg_a_addr
4610 db 0
4611
4612 ; Prefix ED + 1 byte opcode, no arguments
4613 ; Format: opcode, t_MNEMONICS index
4614 b_1bc9_start:
4615 db 044h,066h ;neg
4616 db 045h,092h ;retn
4617 db 04dh,08eh ;reti
4618 db 067h,0b1h ;rrd
4619 db 06fh,0a2h ;rld
4620 db 0a0h,05fh ;ldi
4621 db 0a1h,01ch ;cpi
4622 db 0a2h,04bh ;ini
4623 db 0a3h,07dh ;outi
4624 db 0a8h,058h ;ldd
4625 db 0a9h,015h ;cpd
4626 db 0aah,044h ;ind
4627 db 0abh,079h ;outd
4628 db 0b0h,062h ;ldir
4629 db 0b1h,01fh ;cpir
4630 db 0b2h,04eh ;inir
4631 db 0b3h,072h ;otir
4632 db 0b8h,05bh ;lddr
4633 db 0b9h,018h ;cpdr
4634 db 0bah,047h ;indr
4635 db 0bbh,06eh ;otdr
4636 db 08bh,0d5h ;otdm
4637 db 09bh,0d9h ;otdmr
4638 db 083h,0deh ;otim
4639 db 093h,0e2h ;otimr
4640 db 076h,0ebh ;slp
4641 db 0ffh ;<end mark>
4642
4643 b_1bf4_start:
4644 db 0e7h,040h,03fh ;in r,(c) ;r=b,c,d,e
4645 dw p_arg_in_c ;
4646 db 0f7h,060h,03fh ;in r,(c) ;r=h,l
4647 dw p_arg_in_c ;
4648 db 0ffh,078h,03fh ;in r,(c) ;r=a
4649 dw p_arg_in_c ;
4650 db 0e7h,041h,076h ;out (c),r ;r=b,c,d,e
4651 dw p_arg_out_c ;
4652 db 0f7h,061h,076h ;out (c),r ;r=h,l
4653 dw p_arg_out_c ;
4654 db 0ffh,079h,076h ;out (c),r ;r=a
4655 dw p_arg_out_c ;
4656 db 0cfh,042h,0b7h ;sbc hl,rr
4657 dw l1dcah ;
4658 db 0cfh,04ah,000h ;adc hl,rr
4659 dw l1dcah ;
4660 db 0ffh,046h,03dh ;im 0
4661 dw l1d85h ;
4662 db 0ffh,056h,03dh ;im 1
4663 dw l1d89h ;
4664 db 0ffh,05eh,03dh ;im 2
4665 dw l1d8dh ;
4666 db 0ffh,047h,056h ;ld i,a
4667 dw l1d92h ;
4668 db 0ffh,057h,056h ;ld a,i
4669 dw l1d97h ;
4670 db 0ffh,04fh,056h ;ld r,a
4671 dw l1d9ch ;
4672 db 0ffh,05fh,056h ;ld a,r
4673 dw l1da1h
4674 db 0cfh,04ch,0d2h ;mlt rr
4675 dw p_arg_ww
4676 db 0c7h,004h,0eeh ;tst r
4677 dw p_arg_r
4678 db 0
4679
4680 l228bh:
4681 db 0e7h,000h,0cfh ;in0 r,(m) ;r=b,c,d,e
4682 dw p_arg_r_m
4683 db 0f7h,020h,0cfh ;in0 r,(m) ;r=h,l
4684 dw p_arg_r_m
4685 db 0ffh,038h,0cfh ;in0 a,(m)
4686 dw p_arg_r_m
4687 db 0e7h,001h,0e7h ;out0 (m),r ;r=b,c,d,e
4688 dw p_arg_m_r
4689 db 0f7h,021h,0e7h ;out0 (m),r ;r=h,l
4690 dw p_arg_m_r
4691 db 0ffh,039h,0e7h ;out0 (m),a
4692 dw p_arg_m_r
4693 db 0ffh,064h,0eeh ;tst m
4694 dw l1d09h
4695 db 0ffh,074h,0f1h ;tstio m
4696 dw l1d09h
4697 db 0
4698
4699 b_1c40_start:
4700 db 0efh,043h,056h ;ld (mn),ww ;ww=bc,de
4701 dw p_arg_addr_ww
4702 db 0ffh,073h,056h ;ld (mn),sp
4703 dw p_arg_addr_ww
4704 db 0efh,04bh,056h ;ld ww,(mn) ;ww=bc,de
4705 dw p_arg_ww_addr
4706 db 0ffh,07bh,056h ;ld sp,(mn)
4707 dw p_arg_ww_addr
4708 db 0
4709
4710 ; CB
4711 b_1c55_start:
4712 db 0f8h,000h,09bh ;rlc g
4713 dw l1e03h
4714 db 0f8h,008h,0aah ;rrc g
4715 dw l1e03h
4716 db 0f8h,010h,096h ;rl g
4717 dw l1e03h
4718 db 0f8h,018h,0a5h ;rr g
4719 dw l1e03h
4720 db 0f8h,020h,0c0h ;sla g
4721 dw l1e03h
4722 db 0f8h,028h,0c3h ;sra g
4723 dw l1e03h
4724 db 0f8h,038h,0c6h ;srl g
4725 dw l1e03h
4726 db 0c0h,040h,009h ;bit b,g
4727 dw p_arg_bitop
4728 db 0c0h,080h,088h ;res b,g
4729 dw p_arg_bitop
4730 db 0c0h,0c0h,0bdh ;set b,g
4731 dw p_arg_bitop
4732 db 0
4733
4734 p_arg_r_r:
4735 call p_arg_r ;1c88 cd 28 1e . ( .
4736 call p_char_comma ;1c8b cd b4 1e . . .
4737 jp p_arg_rs ;1c8e c3 30 1e . 0 .
4738 p_arg_a_r:
4739 call p_A_comma ;1c91 cd b1 1e . . .
4740 jp p_arg_rs ;1c94 c3 30 1e . 0 .
4741 l1c97h:
4742 ret ;1c97 c9 .
4743
4744 ;-----------------------------------------------------
4745 p_arg_r_m:
4746 call p_arg_r
4747 call p_char_comma
4748 jp sub_1d2ch
4749
4750 p_arg_m_r:
4751 call sub_1d2ch
4752 call p_char_comma
4753 jp p_arg_r
4754 ;-----------------------------------------------------
4755
4756 l1c98h:
4757 ld a,(iy+000h) ;1c98 fd 7e 00 . ~ .
4758 and 038h ;1c9b e6 38 . 8
4759 jp out_hex ;1c9d c3 18 02 . . .
4760
4761 l1ca0h:
4762 ld hl,b_1ca9_start ;1ca0 21 a9 1c ! . .
4763 call pstr ;1ca3 cd 88 02 . . .
4764 jp p_arg_hlixiy ;1ca6 c3 7e 1e . ~ .
4765
4766 b_1ca9_start:
4767 DC '(SP),'
4768
4769 l1caeh:
4770 call p_char_lparen ;1cb0 cd 5d 02 . ] .
4771 call p_arg_hlixiy ;1cb3 cd 7e 1e . ~ .
4772 jr out_rparen
4773
4774 p_arg_ex_dehl:
4775 ld hl,l1773h ;1cbb 21 73 17 ! s .
4776 jp pstr ;1cbe c3 88 02 . . .
4777
4778 l1cc1h:
4779 ld hl,b_1cca_start ;1cc1 21 ca 1c ! . .
4780 call pstr ;1cc4 cd 88 02 . . .
4781 jp p_arg_hlixiy ;1cc7 c3 7e 1e . ~ .
4782
4783 b_1cca_start:
4784 DC 'SP,'
4785
4786 p_arg_ex_afaf:
4787 ld hl,b_176d_start ;1ccd 21 6d 17 ! m .
4788 jp pstr ;1cd0 c3 88 02 . . .
4789
4790 l1cd3h:
4791 call p_arg_hlixiy ;1cd3 cd 7e 1e . ~ .
4792 call p_char_comma ;1cd6 cd b4 1e . . .
4793 jp p_arg_ww ;1cd9 c3 8b 1e . . .
4794 l1cdch:
4795 call sub_1ce8h ;1cdc cd e8 1c . . .
4796 call p_char_comma ;1cdf cd b4 1e . . .
4797 jp p_char_A ;1ce2 c3 3d 1d . = .
4798
4799 l1ce5h:
4800 call p_A_comma ;1ce5 cd b1 1e . . .
4801 sub_1ce8h:
4802 call p_char_lparen ;1cea cd 5d 02 . ] .
4803 call p_arg_ww ;1ced cd 8b 1e . . .
4804 out_rparen:
4805 jp p_char_rparen ;1cf2 c3 5d 02 . ] .
4806
4807 l1cf5h:
4808 call p_A_comma ;1cf5 cd b1 1e . . .
4809 jr l1d09h ;1cf8 18 0f . .
4810 l1cfah:
4811 call p_arg_r ;1cfa cd 28 1e . ( .
4812 call p_char_comma ;1cfd cd b4 1e . . .
4813 ld a,(isprefix_ixiy) ;1d00 3a f8 1f : . .
4814 and a ;1d03 a7 .
4815 ld a,(iy+002h) ;1d04 fd 7e 02 . ~ .
4816 jr nz,l1d0ch ;1d07 20 03 .
4817 l1d09h:
4818 ld a,(iy+001h) ;1d09 fd 7e 01 . ~ .
4819 l1d0ch:
4820 jp out_hex ;1d0c c3 18 02 . . .
4821
4822 l1d0fh:
4823 ld a,(iy+000h) ;1d0f fd 7e 00 . ~ .
4824 and 018h ;1d12 e6 18 . .
4825 call p_arg_cc0 ;1d14 cd a0 1e . . .
4826 call p_char_comma ;1d17 cd b4 1e . . .
4827 l1d1ah:
4828 ld c,(iy+001h) ;1d1a fd 4e 01 . N .
4829 ld a,c ;1d1d 79 y
4830 rla ;1d1e 17 .
4831 sbc a,a ;1d1f 9f .
4832 ld b,a ;1d20 47 G
4833 push iy ;1d21 fd e5 . .
4834 pop hl ;1d23 e1 .
4835 add hl,bc ;1d24 09 .
4836 inc hl ;1d25 23 #
4837 inc hl ;1d26 23 #
4838 jr l1d4eh ;1d27 18 25 . %
4839 l1d29h:
4840 call p_A_comma ;1d29 cd b1 1e . . .
4841 sub_1d2ch:
4842 call p_char_lparen ;1d2e cd 5d 02 . ] .
4843 ld a,(iy+001h) ;1d31 fd 7e 01 . ~ .
4844 jp l1e6bh ;1d34 c3 6b 1e . k .
4845 l1d37h:
4846 call sub_1d2ch ;1d37 cd 2c 1d . , .
4847 jr p_char_comma_A
4848
4849 p_arg_cc_mn:
4850 call p_arg_cc ;1d42 cd 9d 1e . . .
4851 call p_char_comma ;1d45 cd b4 1e . . .
4852 p_arg_mn:
4853 ld l,(iy+001h) ;1d48 fd 6e 01 . n .
4854 ld h,(iy+002h) ;1d4b fd 66 02 . f .
4855 l1d4eh:
4856 ld a,002h ;1d4e 3e 02 > .
4857 sub_1d50h:
4858 ld (l1ffdh),a ;1d50 32 fd 1f 2 . .
4859 ld (l1ffbh),hl ;1d53 22 fb 1f " . .
4860 call out_hl ;1d56 cd 13 02 . . .
4861 ret ;1d59 c9 .
4862 p_arg_ww_mn:
4863 call p_arg_ww ;1d5a cd 8b 1e . . .
4864 call p_char_comma ;1d5d cd b4 1e . . .
4865 jr p_arg_mn ;1d60 18 e6 . .
4866
4867 p_arg_addr_hl:
4868 call sub_1e13h ;1d62 cd 13 1e . . .
4869 call p_char_comma ;1d65 cd b4 1e . . .
4870 jp p_arg_hlixiy ;1d68 c3 7e 1e . ~ .
4871 p_arg_hl_addr:
4872 call p_arg_hlixiy ;1d6b cd 7e 1e . ~ .
4873 call p_char_comma ;1d6e cd b4 1e . . .
4874 jp sub_1e13h ;1d71 c3 13 1e . . .
4875
4876 p_arg_addr_a:
4877 call sub_1e13h ;1d74 cd 13 1e . . .
4878 p_char_comma_A:
4879 call p_char_comma ;1d77 cd b4 1e . . .
4880 p_char_A:
4881 ld a,'A' ;1d7a 3e 41 > A
4882 jr outchar1 ;1d87 18 06 . .
4883 p_arg_a_addr:
4884 call p_A_comma ;1d7f cd b1 1e . . .
4885 jp sub_1e13h ;1d82 c3 13 1e . . .
4886 l1d85h:
4887 ld a,'0' ;1d85 3e 30 > 0
4888 jr outchar1 ;1d87 18 06 . .
4889 l1d89h:
4890 ld a,'1' ;1d89 3e 31 > 1
4891 jr outchar1 ;1d8b 18 02 . .
4892 l1d8dh:
4893 ld a,'2' ;1d8d 3e 32 > 2
4894 jr outchar1 ;1d8b 18 02 . .
4895
4896 p_A_comma:
4897 call p_char_A ;1eb1 cd 3d 1d . = .
4898 p_char_comma:
4899 ld a,',' ;1eb4 3e 2c > ,
4900 outchar1:
4901 jp outchar ;1eb6 c3 5d 02 . ] .
4902
4903 l1d92h:
4904 ld hl,b_1da7_start ;1d92 21 a7 1d ! . .
4905 jr l1da4h ;1d95 18 0d . .
4906 l1d97h:
4907 ld hl,l1daah ;1d97 21 aa 1d ! . .
4908 jr l1da4h ;1d9a 18 08 . .
4909 l1d9ch:
4910 ld hl,l1dadh ;1d9c 21 ad 1d ! . .
4911 jr l1da4h ;1d9f 18 03 . .
4912 l1da1h:
4913 ld hl,l1db0h ;1da1 21 b0 1d ! . .
4914 l1da4h:
4915 jp pstr ;1da4 c3 88 02 . . .
4916
4917 b_1da7_start:
4918 DC 'I,A'
4919 l1daah:
4920 DC 'A,I'
4921 l1dadh:
4922 DC 'R,A'
4923 l1db0h:
4924 DC 'A,R'
4925
4926 p_arg_in_c:
4927 call p_arg_r ;1db3 cd 28 1e . ( .
4928 call p_char_comma ;1db6 cd b4 1e . . .
4929 ld hl,t__C_ ;1db9 21 f4 1f ! . .
4930 jp pstr ;1dbc c3 88 02 . . .
4931
4932 p_arg_out_c:
4933 ld hl,t__C_ ;1dbf 21 f4 1f ! . .
4934 call pstr ;1dc2 cd 88 02 . . .
4935 call p_char_comma ;1dc5 cd b4 1e . . .
4936 jr p_arg_r ;1dc8 18 5e . ^
4937
4938 l1dcah:
4939 call p_arg_hlixiy ;1dca cd 7e 1e . ~ .
4940 call p_char_comma ;1dcd cd b4 1e . . .
4941 jp p_arg_ww ;1dd0 c3 8b 1e . . .
4942
4943 p_arg_addr_ww:
4944 call sub_1e13h ;1dd3 cd 13 1e . . .
4945 call p_char_comma ;1dd6 cd b4 1e . . .
4946 jp p_arg_ww ;1dd9 c3 8b 1e . . .
4947
4948 p_arg_ww_addr:
4949 call p_arg_ww ;1ddc cd 8b 1e . . .
4950 call p_char_comma ;1ddf cd b4 1e . . .
4951 jr sub_1e13h ;1de2 18 2f . /
4952
4953 p_arg_bitop:
4954 ld a,(isprefix_ixiy) ;1de4 3a f8 1f : . .
4955 and a ;1de7 a7 .
4956 jr nz,l1defh ;1de8 20 05 .
4957 ld a,(iy+001h) ;1dea fd 7e 01 . ~ .
4958 jr l1df2h ;1ded 18 03 . .
4959 l1defh:
4960 ld a,(iy+002h) ;1def fd 7e 02 . ~ .
4961 l1df2h:
4962 push af ;1df2 f5 .
4963 rra ;1df3 1f .
4964 rra ;1df4 1f .
4965 rra ;1df5 1f .
4966 and 007h ;1df6 e6 07 . .
4967 add a,'0' ;1df8 c6 30 . 0
4968 call outchar ;1dfa cd 5d 02 . ] .
4969 call p_char_comma ;1dfd cd b4 1e . . .
4970 pop af ;1e00 f1 .
4971 jr p_arg_r0 ;1e01 18 30 . 0
4972
4973 l1e03h:
4974 ld a,(isprefix_ixiy) ;1e03 3a f8 1f : . .
4975 and a ;1e06 a7 .
4976 jr nz,l1e0eh ;1e07 20 05 .
4977 ld a,(iy+001h) ;1e09 fd 7e 01 . ~ .
4978 jr l1e11h ;1e0c 18 03 . .
4979 l1e0eh:
4980 ld a,(iy+002h) ;1e0e fd 7e 02 . ~ .
4981 l1e11h:
4982 jr p_arg_r0 ;1e11 18 20 .
4983
4984 sub_1e13h:
4985 call p_char_lparen ;1e15 cd 5d 02 . ] .
4986 ld l,(iy+001h) ;1e18 fd 6e 01 . n .
4987 ld h,(iy+002h) ;1e1b fd 66 02 . f .
4988 ld a,001h ;1e1e 3e 01 > .
4989 call sub_1d50h ;1e20 cd 50 1d . P .
4990
4991 p_char_rparen:
4992 ld a,')' ;1e23 3e 29 > )
4993 jp outchar ;1e25 c3 5d 02 . ] .
4994
4995 p_arg_r:
4996 ld a,(iy+000h) ;1e28 fd 7e 00 . ~ .
4997 rra ;1e2b 1f .
4998 rra ;1e2c 1f .
4999 rra ;1e2d 1f .
5000 jr p_arg_r0 ;1e2e 18 03 . .
5001 p_arg_rs:
5002 ld a,(iy+000h) ;1e30 fd 7e 00 . ~ .
5003 p_arg_r0:
5004 and 007h ;1e33 e6 07 . .
5005 cp 006h ;1e35 fe 06 . .
5006 jr nz,p_arg_r1 ;1e37 20 3a :
5007 ld a,(isprefix_ixiy) ;1e39 3a f8 1f : . .
5008 and a ;1e3c a7 .
5009 ld a,006h ;1e3d 3e 06 > .
5010 jr z,p_arg_r1 ;1e3f 28 32 ( 2
5011 ld hl,b_1e78_start ;1e41 21 78 1e ! x .
5012 ld a,(isprefix_ixiy) ;1e44 3a f8 1f : . .
5013 dec a ;1e47 3d =
5014 jr z,l1e4dh ;1e48 28 03 ( .
5015 ld hl,l1e7bh ;1e4a 21 7b 1e ! { .
5016 l1e4dh:
5017 call pstr ;1e4d cd 88 02 . . .
5018 ld a,(iy+001h) ;1e50 fd 7e 01 . ~ .
5019 and a ;1e53 a7 .
5020 jp m,l1e61h ;1e54 fa 61 1e . a .
5021 ld a,'+' ;1e57 3e 2b > +
5022 call outchar ;1e59 cd 5d 02 . ] .
5023 ld a,(iy+001h) ;1e5c fd 7e 01 . ~ .
5024 jr l1e6bh ;1e5f 18 0a . .
5025 l1e61h:
5026 ld a,'-' ;1e61 3e 2d > -
5027 call outchar ;1e63 cd 5d 02 . ] .
5028 ld a,(iy+001h) ;1e66 fd 7e 01 . ~ .
5029 neg ;1e69 ed 44 . D
5030 l1e6bh:
5031 call out_hex ;1e6b cd 18 02 . . .
5032 jr p_char_rparen
5033
5034 p_arg_r1:
5035 ld hl,t_BCDEHL_HL_A ;1e73 21 96 1f ! . .
5036 jr p_arg ;1e76 18 32 . 2
5037
5038 b_1e78_start:
5039 DC '(IX'
5040 l1e7bh:
5041 DC '(IY'
5042
5043 p_arg_hlixiy:
5044 ld a,(isprefix_ixiy) ;1e7e 3a f8 1f : . .
5045 ld hl,t_HL.IX.IY ;1e81 21 c6 1f ! . .
5046 jr p_arg ;1e84 18 24 . $
5047 p_arg_zz:
5048 ld hl,t_BC.DE.HL.AF ;1e86 21 ab 1f ! . .
5049 jr l1e8eh ;1e89 18 03 . .
5050 p_arg_ww:
5051 ld hl,t_BC.DE.HL.SP ;1e8b 21 a2 1f ! . .
5052 l1e8eh:
5053 ld a,(iy+000h) ;1e8e fd 7e 00 . ~ .
5054 rra ;1e91 1f .
5055 rra ;1e92 1f .
5056 rra ;1e93 1f .
5057 rra ;1e94 1f .
5058 and 003h ;1e95 e6 03 . .
5059 cp 002h ;1e97 fe 02 . .
5060 jr z,p_arg_hlixiy ;1e99 28 e3 ( .
5061 jr p_arg ;1e9b 18 0d . .
5062
5063 p_arg_cc:
5064 ld a,(iy+000h) ;1e9d fd 7e 00 . ~ .
5065 p_arg_cc0:
5066 rra ;1ea0 1f .
5067 rra ;1ea1 1f .
5068 rra ;1ea2 1f .
5069 and 007h ;1ea3 e6 07 . .
5070 ld hl,t_tstfl_ZCPS ;1ea5 21 dc 1f ! . .
5071 p_arg:
5072 ld b,a ;1eaa 47 G
5073 call sel_dc_string ;1eab cd 3d 03 . = .
5074 jp pstr ;1eae c3 88 02 . . .
5075
5076 p_mnemonic:
5077 call pstr ;1eb9 cd 88 02 . . .
5078 l1ebch:
5079 call outbl ;1ebc cd 9f 02 . . .
5080 inc c ;1ebf 0c .
5081 ld a,c ;1ec0 79 y
5082 cp 5 ;1ec1 fe 05 . .
5083 jr c,l1ebch ;1ec3 20 f7 .
5084 ret ;1ec5 c9 .
5085
5086 t_MNEMONICS:
5087 DC 'ADC'
5088 DC 'ADD'
5089 DC 'AND'
5090 DC 'BIT'
5091 DC 'CALL'
5092 DC 'CCF'
5093 DC 'CP'
5094 DC 'CPD'
5095 DC 'CPDR'
5096 DC 'CPI'
5097 DC 'CPIR'
5098 DC 'CPL'
5099 DC 'DAA'
5100 DC 'DEC'
5101 DC 'DI'
5102 DC 'DJNZ'
5103 DC 'EI'
5104 DC 'EX'
5105 DC 'EXX'
5106 DC 'HALT'
5107 DC 'IM'
5108 DC 'IN'
5109 DC 'INC'
5110 DC 'IND'
5111 DC 'INDR'
5112 DC 'INI'
5113 DC 'INIR'
5114 DC 'JP'
5115 DC 'JR'
5116 DC 'LD'
5117 DC 'LDD'
5118 DC 'LDDR'
5119 DC 'LDI'
5120 DC 'LDIR'
5121 DC 'NEG'
5122 DC 'NOP'
5123 DC 'OR'
5124 DC 'OTDR'
5125 DC 'OTIR'
5126 DC 'OUT'
5127 DC 'OUTD'
5128 DC 'OUTI'
5129 DC 'POP'
5130 DC 'PUSH'
5131 DC 'RES'
5132 DC 'RET'
5133 DC 'RETI'
5134 DC 'RETN'
5135 DC 'RL'
5136 DC 'RLA'
5137 DC 'RLC'
5138 DC 'RLCA'
5139 DC 'RLD'
5140 DC 'RR'
5141 DC 'RRA'
5142 DC 'RRC'
5143 DC 'RRCA'
5144 DC 'RRD'
5145 DC 'RST'
5146 DC 'SBC'
5147 DC 'SCF'
5148 DC 'SET'
5149 DC 'SLA'
5150 DC 'SRA'
5151 DC 'SRL'
5152 DC 'SUB'
5153 DC 'XOR'
5154 DC 'IN0'
5155 DC 'MLT'
5156 DC 'OTDM'
5157 DC 'OTDMR'
5158 DC 'OTIM'
5159 DC 'OTIMR'
5160 DC 'OUT0'
5161 DC 'SLP'
5162 DC 'TST'
5163 DC 'TSTIO'
5164 DB 0
5165
5166 t_BCDEHL_HL_A:
5167 DC 'B'
5168 DC 'C'
5169 DC 'D'
5170 DC 'E'
5171 DC 'H'
5172 DC 'L'
5173 DC '(HL)'
5174 DC 'A'
5175 DB 0
5176 t_BC.DE.HL.SP:
5177 DC 'BC'
5178 DC 'DE'
5179 DC 'HL'
5180 DC 'SP'
5181 DB 0
5182 t_BC.DE.HL.AF:
5183 DC 'BC'
5184 DC 'DE'
5185 t_HL.AF:
5186 DC 'HL'
5187 DC 'AF'
5188 DB 0
5189 t_BC.DE.IY.SP:
5190 DC 'BC'
5191 DC 'DE'
5192 DC 'IY'
5193 DC 'SP'
5194 DB 0
5195 t_BC.DE.IX.SP:
5196 DC 'BC'
5197 DC 'DE'
5198 DC 'IX'
5199 DC 'SP'
5200 DB 0
5201 t_HL.IX.IY:
5202 DC 'HL'
5203 t_IX.IY:
5204 DC 'IX'
5205 DC 'IY'
5206 DB 0
5207 t_tstfl_ZC:
5208 DC 'NZ'
5209 DC 'Z'
5210 DC 'NC'
5211 DC 'C'
5212 DC 'NE'
5213 DC 'EQ'
5214 DC 'GE'
5215 DC 'LT'
5216 DB 0
5217 t_tstfl_ZCPS:
5218 DC 'NZ'
5219 DC 'Z'
5220 DC 'NC'
5221 DC 'C'
5222 DC 'PO'
5223 DC 'PE'
5224 DC 'P'
5225 DC 'M'
5226 DC 'NE'
5227 DC 'EQ'
5228 DC 'GE'
5229 DC 'LT'
5230 DC 'NV'
5231 DC 'V'
5232 DB 0
5233 t__C_:
5234 DC '(C)'
5235 DB 0
5236
5237 isprefix_ixiy:
5238 db 0 ;1ff8 00 .
5239 last_L:
5240 dw TPA ;1ff9 00 01 .
5241 l1ffbh:
5242 dw 0 ;1ffb 00 00 .
5243 l1ffdh:
5244 db 0 ;1ffd 00 .
5245
5246 sub_1ffeh:
5247 ld hl,(REG.PC) ;1ffe 2a 60 00 * ` .
5248 ld a,h ;2001 7c |
5249 or l ;2002 b5 .
5250 jr z,l2037h ;2003 28 32 ( 2
5251 ld de,BDOS ;2005 11 05 00 . . .
5252 and a ;2008 a7 .
5253 sbc hl,de ;2009 ed 52 . R
5254 ld hl,l20edh ;200b 21 ed 20 ! .
5255 jr z,l2031h ;200e 28 21 ( !
5256 ld iy,(REG.PC) ;2010 fd 2a 60 00 . * ` .
5257 call disas_get_instrlen ;2014 cd 8c 19 . . .
5258 jp nc,ERROR ;2017 d2 07 01 . . .
5259 ld c,b ;201a 48 H
5260 ld b,000h ;201b 06 00 . .
5261 ld hl,(REG.PC) ;201d 2a 60 00 * ` .
5262 add hl,bc ;2020 09 .
5263 call sub_09cah ;2021 cd ca 09 . . .
5264 ld iy,(REG.PC) ;2024 fd 2a 60 00 . * ` .
5265 ld hl,b_2039_start ;2028 21 39 20 ! 9
5266 call lookup_opc ;202b cd 97 1a . . .
5267 ccf ;202e 3f ?
5268 ret c ;202f d8 .
5269 ex de,hl ;2030 eb .
5270 l2031h:
5271 call CALL_HL ;2031 cd 0f 01 . . .
5272 call c,sub_09cah ;2034 dc ca 09 . . .
5273 l2037h:
5274 scf ;2037 37 7
5275 ret ;2038 c9 .
5276
5277 b_2039_start:
5278 db 0ffh,0ddh,000h ;Prefix DD
5279 dw l20a7h
5280 db 0ffh,0fdh,000h ;Prefix FD
5281 dw l20ach
5282 db 0ffh,0edh,000h ;Prefix ED
5283 dw l20b8h
5284
5285 b_2048_start:
5286 db 0ffh,0cdh,000h ;call mn
5287 dw l2080h
5288 db 0ffh,0c3h,000h ;jp mn
5289 dw l208bh
5290 db 0ffh,0e9h,000h ;jp ()
5291 dw l20a2h
5292 db 0ffh,0c9h,000h ;ret
5293 dw l20dch
5294 db 0ffh,0cfh,000h ;rst 8
5295 dw l2115h
5296 db 0c7h,0c7h,000h ;
5297 dw l20f9h
5298 db 0c7h,0c4h,000h ;
5299 dw l2080h
5300 db 0f7h,010h,000h ;
5301 dw l2093h
5302 db 0e7h,020h,000h ;
5303 dw l2093h
5304 db 0c7h,0c2h,000h ;
5305 dw l208bh
5306 db 0c7h,0c0h,000h ;
5307 dw l20c5h
5308 db 0
5309
5310 l2080h:
5311 ld a,(b_21e2_start) ;2080 3a e2 21 : . !
5312 and a ;2083 a7 .
5313 jr nz,l208bh ;2084 20 05 .
5314 ld a,(trace_call_flag) ;2086 3a e3 21 : . !
5315 and a ;2089 a7 .
5316 ret nz ;208a c0 .
5317 l208bh:
5318 ld l,(iy+001h) ;208b fd 6e 01 . n .
5319 ld h,(iy+002h) ;208e fd 66 02 . f .
5320 scf ;2091 37 7
5321 ret ;2092 c9 .
5322 l2093h:
5323 ld c,(iy+001h) ;2093 fd 4e 01 . N .
5324 ld a,c ;2096 79 y
5325 rla ;2097 17 .
5326 sbc a,a ;2098 9f .
5327 ld b,a ;2099 47 G
5328 ld hl,(REG.PC) ;209a 2a 60 00 * ` .
5329 add hl,bc ;209d 09 .
5330 inc hl ;209e 23 #
5331 inc hl ;209f 23 #
5332 scf ;20a0 37 7
5333 ret ;20a1 c9 .
5334 l20a2h:
5335 ld hl,(reg.l) ;20a2 2a 5a 00 * Z .
5336 scf ;20a5 37 7
5337 ret ;20a6 c9 .
5338 l20a7h:
5339 ld hl,(reg.ix) ;20a7 2a 52 00 * R .
5340 jr l20afh ;20aa 18 03 . .
5341 l20ach:
5342 ld hl,(reg.iy) ;20ac 2a 50 00 * P .
5343 l20afh:
5344 ld a,(iy+001h) ;20af fd 7e 01 . ~ .
5345 cp 0e9h ;20b2 fe e9 . .
5346 scf ;20b4 37 7
5347 ret z ;20b5 c8 .
5348 and a ;20b6 a7 .
5349 ret ;20b7 c9 .
5350 l20b8h:
5351 ld a,(iy+001h) ;20b8 fd 7e 01 . ~ .
5352 cp 04dh ;20bb fe 4d . M
5353 jr z,l20dch ;20bd 28 1d ( .
5354 cp 045h ;20bf fe 45 . E
5355 jr z,l20dch ;20c1 28 19 ( .
5356 and a ;20c3 a7 .
5357 ret ;20c4 c9 .
5358 l20c5h:
5359 ld a,(iy+000h) ;20c5 fd 7e 00 . ~ .
5360 ld (l20d7h),a ;20c8 32 d7 20 2 .
5361 ld hl,(reg.f) ;20cb 2a 54 00 * T .
5362 push hl ;20ce e5 .
5363 pop af ;20cf f1 .
5364 call l20d7h ;20d0 cd d7 20 . .
5365 scf ;20d3 37 7
5366 jr c,l20dch ;20d4 38 06 8 .
5367 ret ;20d6 c9 .
5368 l20d7h:
5369 nop ;20d7 00 .
5370 and a ;20d8 a7 .
5371 pop hl ;20d9 e1 .
5372 inc hl ;20da 23 #
5373 jp (hl) ;20db e9 .
5374
5375 l20dch:
5376 ld a,(b_21e2_start) ;20dc 3a e2 21 : . !
5377 and a ;20df a7 .
5378 jr nz,l20edh ;20e0 20 0b .
5379 ld a,(trace_call_flag) ;20e2 3a e3 21 : . !
5380 and a ;20e5 a7 .
5381 jr z,l20edh ;20e6 28 05 ( .
5382 call l20edh ;20e8 cd ed 20 . .
5383 pop hl ;20eb e1 .
5384 ret ;20ec c9 .
5385 l20edh:
5386 ld hl,(reg_sp) ;20ed 2a 5c 00 * \ .
5387 ld e,(hl) ;20f0 5e ^
5388 inc hl ;20f1 23 #
5389 ld d,(hl) ;20f2 56 V
5390 ex de,hl ;20f3 eb .
5391 call sub_09cah ;20f4 cd ca 09 . . .
5392 and a ;20f7 a7 .
5393 ret ;20f8 c9 .
5394
5395 l20f9h:
5396 ld a,(l0003h) ;20f9 3a 03 00 : . .
5397 cp (iy+000h) ;20fc fd be 00 . . .
5398 ret z ;20ff c8 .
5399 ld a,(iy+000h) ;2100 fd 7e 00 . ~ .
5400 and 038h ;2103 e6 38 . 8
5401 ld l,a ;2105 6f o
5402 ld h,000h ;2106 26 00 & .
5403 ld a,(b_21e2_start) ;2108 3a e2 21 : . !
5404 and a ;210b a7 .
5405 jr nz,l2113h ;210c 20 05 .
5406 ld a,(trace_call_flag) ;210e 3a e3 21 : . !
5407 and a ;2111 a7 .
5408 ret nz ;2112 c0 .
5409 l2113h:
5410 scf ;2113 37 7
5411 ret ;2114 c9 .
5412 l2115h:
5413 and a ;2115 a7 .
5414 ret ;2116 c9 .
5415 cmd_C:
5416 ld hl,cmd_C ;2117 21 17 21 ! . !
5417 ld a,001h ;211a 3e 01 > .
5418 jr l2122h ;211c 18 04 . .
5419 cmd_T:
5420 xor a ;211e af .
5421 ld hl,cmd_T ;211f 21 1e 21 ! . !
5422 l2122h:
5423 ld (cmd_rpt),hl ;2122 22 68 00 " h .
5424 ld (trace_call_flag),a ;2125 32 e3 21 2 . !
5425 ld a,(de) ;2128 1a .
5426 sub 'N' ;2129 d6 4e . N
5427 jr nz,l212eh ;212b 20 01 .
5428 inc de ;212d 13 .
5429 l212eh:
5430 ld (trace_N_flag),a ;212e 32 e7 21 2 . !
5431 ld a,(de) ;2131 1a .
5432 sub 'J' ;2132 d6 4a . J
5433 jr nz,l2137h ;2134 20 01 .
5434 inc de ;2136 13 .
5435 l2137h:
5436 ld (trace_J_flag),a ;2137 32 e8 21 2 . !
5437 call sub_21a6h ;213a cd a6 21 . . !
5438 jr z,l2145h ;213d 28 06 ( .
5439 ld hl,1 ;213f 21 01 00 ! . .
5440 call get_lastarg_def ;2142 cd 69 03 . i .
5441 l2145h:
5442 ld (trace_count),hl ;2145 22 e5 21 " . !
5443 sub a ;2148 97 .
5444 ld (l0941h),a ;2149 32 41 09 2 A .
5445 l214ch:
5446 call sub_1ffeh ;214c cd fe 1f . . .
5447 jr l21a3h ;214f 18 52 . R
5448
5449 l2151h:
5450 call bp_clr_temporary ;2151 cd 54 07 . T .
5451 ld a,(trace_J_flag) ;2154 3a e8 21 : . !
5452 and a ;2157 a7 .
5453 jr nz,l216bh ;2158 20 11 .
5454 ld iy,(REG.PC) ;215a fd 2a 60 00 . * ` .
5455 call sub_21c8h ;215e cd c8 21 . . !
5456 jr z,l216bh ;2161 28 08 ( .
5457 ld hl,b_2048_start ;2163 21 48 20 ! H
5458 call lookup_opc ;2166 cd 97 1a . . .
5459 jr nc,l214ch ;2169 30 e1 0 .
5460 l216bh:
5461 ld a,(trace_UW_flag) ;216b 3a e4 21 : . !
5462 and a ;216e a7 .
5463 jr z,l2188h ;216f 28 17 ( .
5464 ld de,(trace_count) ;2171 ed 5b e5 21 . [ . !
5465 call expr ;2175 cd be 03 . . .
5466 ld a,h ;2178 7c |
5467 or l ;2179 b5 .
5468 add a,0ffh ;217a c6 ff . .
5469 sbc a,a ;217c 9f .
5470 ld hl,trace_UW_flag ;217d 21 e4 21 ! . !
5471 xor (hl) ;2180 ae .
5472 bit 1,a ;2181 cb 4f . O
5473 jr z,l2193h ;2183 28 0e ( .
5474 l2185h:
5475 jp l0902h ;2185 c3 02 09 . . .
5476 l2188h:
5477 ld hl,(trace_count) ;2188 2a e5 21 * . !
5478 dec hl ;218b 2b +
5479 ld (trace_count),hl ;218c 22 e5 21 " . !
5480 ld a,h ;218f 7c |
5481 or l ;2190 b5 .
5482 jr z,l2185h ;2191 28 f2 ( .
5483 l2193h:
5484 call sub_1ffeh ;2193 cd fe 1f . . .
5485 jr nc,l2185h ;2196 30 ed 0 .
5486 ld a,(trace_N_flag) ;2198 3a e7 21 : . !
5487 ld b,a ;219b 47 G
5488 ld a,(l0941h) ;219c 3a 41 09 : A .
5489 or b ;219f b0 .
5490 ld (l0941h),a ;21a0 32 41 09 2 A .
5491 l21a3h:
5492 jp user_go ;21a3 c3 25 0a . % .
5493
5494 sub_21a6h:
5495 call skipbl ;21a6 cd bf 02 . . .
5496 xor a ;21a9 af .
5497 ld (trace_UW_flag),a ;21aa 32 e4 21 2 . !
5498 ld a,(de) ;21ad 1a .
5499 cp 'U' ;21ae fe 55 . U
5500 jr z,l21b5h ;21b0 28 03 ( .
5501 cp 'W' ;21b2 fe 57 . W
5502 ret nz ;21b4 c0 .
5503 l21b5h:
5504 inc de ;21b5 13 .
5505 push af ;21b6 f5 .
5506 push de ;21b7 d5 .
5507 call expr ;21b8 cd be 03 . . .
5508 jp c,ERROR ;21bb da 07 01 . . .
5509 call assert_eol ;21be cd d6 02 . . .
5510 pop hl ;21c1 e1 .
5511 pop af ;21c2 f1 .
5512 ld (trace_UW_flag),a ;21c3 32 e4 21 2 . !
5513 sub a ;21c6 97 .
5514 ret ;21c7 c9 .
5515
5516 sub_21c8h:
5517 ld a,(iy+000h) ;21c8 fd 7e 00 . ~ .
5518 cp 0edh ;21cb fe ed . .
5519 jr z,l21dah ;21cd 28 0b ( .
5520 and 0dfh ;21cf e6 df . .
5521 cp 0ddh ;21d1 fe dd . .
5522 ret nz ;21d3 c0 .
5523 ld a,(iy+001h) ;21d4 fd 7e 01 . ~ .
5524 cp 0e9h ;21d7 fe e9 . .
5525 ret ;21d9 c9 .
5526 l21dah:
5527 ld a,(iy+001h) ;21da fd 7e 01 . ~ .
5528 and 0f7h ;21dd e6 f7 . .
5529 cp 045h ;21df fe 45 . E
5530 ret ;21e1 c9 .
5531
5532 b_21e2_start:
5533 db 0 ;21e2 00 .
5534 trace_call_flag:
5535 db 0 ;1=call, 0=trace 21e3 00 .
5536 trace_UW_flag:
5537 db 0 ;0 or 'U' or 'W' 21e4 00 .
5538 trace_count:
5539 dw 0 ;21e5 00 00 .
5540 trace_N_flag:
5541 db 0 ;0 if 'N' 21e7 00 .
5542 trace_J_flag:
5543 db 0 ;0 if 'J' 21e8 00 .
5544
5545 ddtz_size equ $-ddtz_base
5546 ddtz_end:
5547
5548 ;-------------------------------------------------------------------------------
5549
5550 end