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