]> cloudbase.mooo.com Git - ddt180.git/blob - ddt180.z80
Command A,L: Reorg (HL instead of IY). Save/restore IX/IY around BDOS calls.
[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 TPA equ 0100h
13 cseg
14 .phase TPA
15
16 jp start
17
18 ldr_end:
19 ldr_size equ $ - TPA
20 current_phase defl $
21
22 .dephase
23 current_cseg defl $
24
25 ;-------------------------------------------------------------------------------
26 ; DDT/Z core
27 ;
28
29 ; Some greneral definitions
30
31 TAB equ 9
32 LF equ 10
33 CR equ 13
34
35 ; CP/M memory layout
36
37 BDOS equ 5
38 dfcb1 equ 05ch
39 dfcb2 equ 06ch
40 DMA_BUF equ 080h
41 TPA equ 0100h
42
43 ; BDOS function calls
44
45 BDOS_CIN equ 1 ;Console Input
46 BDOS_COUT equ 2 ;Console Output
47 BDOS_PSTR equ 9 ;Print String
48 BDOS_CBUF equ 10 ;Read Console Buffer
49 BDOS_CSTAT equ 11 ;Get Console Status
50 BDOS_OPEN equ 15 ;Open File
51 BDOS_CLOSE equ 16 ;Close File
52 BDOS_DELETE equ 19 ;Delete File
53 BDOS_READ equ 20 ;Read Sequential
54 BDOS_WRITE equ 21 ;Write Sequential
55 BDOS_CREATE equ 22 ;Make File
56 BDOS_SETDMA equ 26 ;Set DMA Address
57
58 ; ddtz specific definitions
59
60 STACK_SIZE equ 64 ;ddtz internal stack
61 CONBUF_SIZE equ 80 ;Size of console input buffer
62 EXPR_BUF_SIZE equ 128 ;expressen buffer for conditional breakpoints
63 BP_CNT equ 12 ;Number of breakpoints
64 BP_SIZE equ 8 ;Size of a breakpoint record
65 YREG_CNT equ 10 ;Number of Y registers (0..9)
66
67 ;-------------------------------------------------------------------------------
68
69 ddtz_base:
70 jp ddtz_bdos
71 l0003h:
72 rst 30h
73 sub_0004h:
74 nop
75 ret
76 ddtz_bdos:
77 jp 0
78
79 current_cseg defl $ - current_cseg
80 .phase current_phase + current_cseg
81 signon:
82 db 'Symbolic DDTZ/180'
83 db ' - Version '
84 maclib version.inc
85 defvers
86 db CR,LF,'$'
87 msgz80:
88 db 'Z80 or better required!',cr,lf,'$'
89
90 current_phase defl $
91 .dephase
92 current_cseg defl $
93 ds STACK_SIZE - (current_phase - signon)
94
95
96 stack:
97 reg.l2: db 000h
98 reg.h2: db 000h
99 reg.e2: db 000h
100 reg.d2: db 000h
101 reg.c2: db 000h
102 reg.b2: db 000h
103 reg.f2: db 000h
104 reg.a2: db 000h
105 l004eh: db 000h
106 reg.i: db 000h
107 reg.iy: dw 0000h
108 reg.ix: dw 0000h
109 reg.f: db 000h
110 reg.a: db 000h
111 reg.c: db 000h
112 reg.b: db 000h
113 reg.e: db 000h
114 reg.d: db 000h
115 reg.l: db 000h
116 reg.h: db 000h
117 reg_sp: dw TPA
118 reg.iff:
119 db 0f3h
120 db 0c3h
121 reg.pc: dw TPA
122 var.$: dw 0000h
123 var.@: dw 0
124
125 error_func:dw l0146h
126 cmd_rpt:dw mainloop
127
128 conbuf:
129 db CONBUF_SIZE
130
131 ld sp,stack
132 exx
133 ld de,ddtz_base
134 or a
135 sbc hl,de
136 add hl,de
137 jr c,l0079h
138 ex de,hl
139 l0079h:
140 ld de,TPA
141 l007ch:
142 dec hl
143 ld (hl),000h
144 ld a,h
145 sub d
146 ld b,a
147 ld a,l
148 sub e
149 or b
150 jr nz,l007ch
151 ld a,i
152 ld (reg.i),a
153 ld a,0f3h
154 jp po,l0093h
155 ld a,0fbh
156 l0093h:
157 ld (reg.iff),a
158 call sub_0004h
159 ld hl,ddtz_base
160 ld l,000h
161 ld (reg_sp),hl
162 call cpy_fcb2
163 ld a,(dfcb1+1)
164 cp ' '
165 ld hl,0
166 call nz,read_file
167 jr mainloop
168
169 ds CONBUF_SIZE + 3 - ($ - conbuf)
170
171 CMDTAB:
172 dw cmd_@ ;examine/substitute the displacement register @
173 dw cmd_A ;Assemble
174 dw cmd_B ;Breakpoints display/set/clear
175 dw cmd_C ;trace over Calls
176 dw cmd_D ;Display memory in hex and ascii
177 dw ERROR ;
178 dw cmd_F ;specify Filename and command line
179 dw cmd_G ;Go
180 dw cmd_H ;compute Hex and other expressions
181 dw cmd_I ;Input a byte from port
182 dw ERROR ;
183 dw ERROR ;
184 dw cmd_L ;List disassembled code
185 dw cmd_M ;Move memory [and verify]
186 dw ERROR ;
187 dw cmd_O ;Output a byte to port
188 dw ERROR ;
189 dw cmd_Q ;Qery memory for byte string
190 dw cmd_R ;Read binary or hex file and/or symbol file
191 dw cmd_S ;Substitute memory
192 dw cmd_T ;Trace
193 dw ERROR ;
194 dw cmd_V ;Verify (compare) two memory areas
195 dw cmd_W ;Write a file to disk
196 dw cmd_X ;eXamine [and substitute] registers
197 dw cmd_Y ;examine [and substitute] Y variables
198 dw cmd_Z ;Zap (fill) memory with a byte string
199
200 mainloop:
201 ld sp,stack
202 ld hl,l0146h
203 ld (error_func),hl
204 ld hl,(reg.pc)
205 ld (var.$),hl
206 call bp_clr_temporary
207 ld hl,(cmd_rpt)
208 ld de,mainloop
209 call cp_hl_de
210 ld a,'>'
211 call outchar
212 call nz,outchar
213 call z,outbl
214 call get_line
215 call skipbl
216 jr z,exe_hl
217 ld hl,mainloop
218 ld (cmd_rpt),hl
219 inc de
220 sub '@'
221 jr c,ERROR
222 cp 'Z'+1-'@'
223 jr nc,ERROR
224 add a,a
225 ld hl,CMDTAB
226 call add_hl_a
227 ld a,(hl)
228 inc hl
229 ld h,(hl)
230 ld l,a
231 jr exe_hl
232
233 ERROR:
234 ld hl,(error_func)
235 exe_hl:
236 call CALL_HL
237 jr mainloop
238
239 l0146h:
240 call pstr_inl
241 dc '?'
242 ;fall thru
243 crlf:
244 call pstr_inl
245 db CR,LF+80h
246 call inchar
247 ld a,0
248 ld (con_col),a
249 jr c,mainloop
250 ret
251
252 out.hl.@:
253 call out_hl
254 push de
255 push hl
256 ld de,(var.@)
257 ld a,d
258 or e
259 jr z,l01bfh
260 call outbl
261 call pstr_inl
262 dc '@'
263 and a
264 sbc hl,de
265 call out_hl
266 l01bfh:
267 pop hl
268 pop de
269 ret
270
271 sub_01d9h:
272 call pstr_inl
273 dc '-'
274 dec hl
275 jp cpl.hl
276
277 out_hl_dec_neg:
278 push hl
279 call sub_01d9h
280 defb 03eh
281 out.hl.dec:
282 push hl
283 ld b,006h
284 call sub_01f9h
285 pop hl
286 call pstr_inl
287 dc '.'
288 l01f3h:
289 call outbl
290 djnz l01f3h
291 ret
292
293 sub_01f9h:
294 dec b
295 push de
296 ld de,10
297 call div_hl_de
298 ld a,h
299 or l
300 call nz,sub_01f9h
301 ld a,e
302 pop de
303 jr out_dgt
304
305 out_hl_neg:
306 push hl
307 call sub_01d9h
308 call out_hl
309 pop hl
310 ret
311
312 out_hl:
313 ld a,h
314 call out_hex
315 ld a,l
316
317 out_hex:
318 push af
319 rra
320 rra
321 rra
322 rra
323 call out_dgt
324 pop af
325
326 out_dgt:
327 and 0fh
328 cp 10
329 jr c,l0229h
330 add a,007h
331 l0229h:
332 add a,'0'
333 jr outchar
334
335 out.bin.w:
336 ld a,h
337 call out.bin.b
338 ld a,l
339 out.bin.b:
340 ld b,8
341 l01c9h:
342 add a,a
343 push af
344 ld a,00
345 adc a,a
346 call out_dgt
347 pop af
348 djnz l01c9h
349 ld a,'"'
350 jr outchar
351
352 out.ascii:
353 push bc
354 ld c,a
355 res 7,a
356 cp ' '
357 push af
358 call nc,outbl
359 call outquote
360 pop af
361 jr nc,l0242h
362 sub 0c0h
363 ld b,a
364 call pstr_inl
365 dc '^'
366 ld a,b
367 l0242h:
368 call outchar
369 cp ''''
370 call z,outchar
371 call outquote
372 sla c
373 pop bc
374 ret nc
375 ld a,'.'
376 jr outchar
377
378 outbl6:
379 call outbl2
380 outbl4:
381 call outbl2
382 outbl2:
383 call outbl
384 outbl:
385 ld a,' '
386 jr outchar
387
388 p_char_lparen:
389 ld a,'('
390 jr outchar
391
392 outquote:
393 ld a,''''
394 outchar:
395 push ix
396 push iy
397 push hl
398 push de
399 push bc
400 push af
401 and 07fh
402 ld e,a
403 ld c,BDOS_COUT
404 call ddtz_bdos
405 ld hl,con_col
406 inc (hl)
407 pop af
408 pop bc
409 pop de
410 pop hl
411 pop iy
412 pop ix
413 ret
414
415 pstr:
416 ld a,(hl)
417 inc hl
418 and a
419 ret z
420 call outchar
421 and a
422 ret m
423 jr pstr
424
425 pstr_inl:
426 ex (sp),hl
427 call pstr
428 ex (sp),hl
429 ret
430
431 p_fill_space:
432 call outbl
433 ld a,(con_col)
434 cp c
435 jr c,p_fill_space
436 ret
437
438 inchar:
439 push hl
440 push de
441 push bc
442 ld c,BDOS_CSTAT
443 call ddtz_bdos
444 and a
445 jr z,l0284h
446 ld c,BDOS_CIN
447 call ddtz_bdos
448 scf
449 l0284h:
450 pop bc
451 pop de
452 pop hl
453 ret
454
455 get_line:
456 push hl
457 ld de,conbuf
458 ld c,BDOS_CBUF
459 call ddtz_bdos
460 call crlf
461 ld de,conbuf+1
462 ld a,(de)
463 ld b,a
464 ld c,0
465 inc b
466 l0162h:
467 inc de
468 dec b
469 jr z,l0194h
470 ld a,(de)
471 bit 0,c
472 call z,toupper
473 ld (de),a
474 cp ''''
475 jr nz,l0162h
476 push de
477 dec de
478 ld a,(de)
479 cp ''''
480 jr z,l0190h
481 dec de
482 ld a,(de)
483 cp '^'
484 jr z,l0184h
485 dec de
486 ld a,(de)
487 cp '^'
488 jr nz,l0190h
489 l0184h:
490 inc de
491 push bc
492 call sub_0303h
493 pop bc
494 dec de
495 ld a,(de)
496 cp ''''
497 jr z,l0191h
498 l0190h:
499 inc c
500 l0191h:
501 pop de
502 jr l0162h
503 l0194h:
504 xor a
505 ld (de),a
506 ld de,conbuf+2
507 pop hl
508 ret
509
510 toupper:
511 cp 'a'
512 ret c
513 cp 'z'+1
514 ret nc
515 and 05fh
516 ret
517
518 skipbl0:
519 inc de
520 skipbl:
521 ld a,(de)
522 call test_whitespace
523 jr z,skipbl0
524 or a
525 ret
526
527 next_arg:
528 call skipbl
529 cp ','
530 ret nz
531 inc de
532 call skipbl
533 cp a
534 ret
535
536 assert_eol:
537 call skipbl
538 ret z
539 to_error:
540 jp ERROR
541
542 chk_stack:
543 push hl
544 push de
545 ld hl,0
546 add hl,sp
547 ld de,stack-40
548 call cp_hl_de
549 pop de
550 pop hl
551 jr c,to_error
552 ret
553
554 add_hl_a:
555 add a,l
556 ld l,a
557 ret nc
558 inc h
559 ret
560
561 cp_hl_de:
562 and a
563 sbc hl,de
564 add hl,de
565 ret
566
567 sub_hl_a1:
568 dec hl
569 sub_hl_a:
570 push bc
571 ld c,a
572 ld b,0
573 or a
574 sbc hl,bc
575 pop bc
576 ret
577
578 sym_getname:
579 push de
580 push hl
581 ld hl,ddtz_base+2
582 sgn_l:
583 ld d,(hl)
584 dec hl
585 ld e,(hl)
586 dec hl
587 ld a,(hl)
588 cp 0c3h
589 jr z,sgn_e
590
591 ex (sp),hl
592 call cp_hl_de
593 jr z,sgn_e
594 ex (sp),hl
595 call sub_hl_a1
596 jr sgn_l
597 sgn_e:
598 sub 0c3h
599 pop hl
600 pop de
601 ret
602
603 p_symstr:
604 push bc
605 ld b,(hl)
606 pss_l:
607 dec hl
608 ld a,(hl)
609 call outchar
610 djnz pss_l
611 dec hl
612 pop bc
613 ret
614
615 p_sym_space:
616 if 0
617 ld a,(dash_flag)
618 or a
619 ret nz
620 endif
621
622 push hl
623 push bc
624 ld c,a
625 ld a,(con_col)
626 ld b,a
627 call sym_getname
628 jr z,psb_align
629 bit 7,c
630 jr z,psb_nd
631 call pstr_inl
632 dc ' .'
633 psb_nd:
634 call p_symstr
635
636 psb_align:
637 ld a,(con_col)
638 sub b
639 ld b,a
640 ld a,(symlen_max)
641 bit 7,c
642 jr z,$+4
643 add a,2
644 res 7,c
645 add c
646 sub b
647 ld b,a
648 jr z,psb_e
649 psb_a_l:
650 call outbl
651 djnz psb_a_l
652 psb_e:
653 pop bc
654 pop hl
655 ret
656
657 p_label:
658 if 0
659 ld a,(dash_flag)
660 or a
661 ret nz
662 endif
663 push hl
664 call sym_getname
665 jr z,pl_e
666 call p_symstr
667 call pstr_inl
668 dc ':'
669 call crlf
670 pl_e:
671 pop hl
672 ret
673
674 lookupch:
675 ld b,0
676 l02f5h:
677 ld a,(hl)
678 and a
679 ret z
680 ld a,(de)
681 cp (hl)
682 jr z,l0300h
683 inc hl
684 inc b
685 jr l02f5h
686 l0300h:
687 scf
688 inc de
689 ret
690
691 sub_0303h:
692 ld hl,b_0cc3_start
693 ld b,07fh
694 jr l030ch
695
696 sub_030ah:
697 ld b,0ffh
698 l030ch:
699 inc b
700 ld a,(hl)
701 and a
702 ret z
703 call sub_031ch
704 jr nc,l030ch
705 res 7,b
706 ret
707
708 sub_0318h:
709 push bc
710 res 7,b
711 defb 03eh
712 sub_031ch:
713 push bc
714 push de
715 l031eh:
716 ld a,(de)
717 xor (hl)
718 and 07fh
719 jr nz,l0336h
720 bit 7,(hl)
721 inc hl
722 inc de
723 jr z,l031eh
724 scf
725 bit 7,b
726 call z,sub_060ch
727 jr nc,l0339h
728 pop af
729 scf
730 pop bc
731 ret
732 l0336h:
733 call sub_0345h
734 l0339h:
735 pop de
736 and a
737 pop bc
738 ret
739
740 sel_dc_string:
741 inc b
742 l033eh:
743 dec b
744 ret z
745 call sub_0345h
746 jr l033eh
747
748 sub_0345h:
749 ld a,(hl)
750 and a
751 ret z
752 l0348h:
753 ld a,(hl)
754 inc hl
755 and a
756 ret m
757 jr l0348h
758
759 sub_034eh:
760 call get_arg_range
761 push hl
762 push bc
763 call next_arg
764 call sub_0363h
765 ex de,hl
766 pop bc
767 pop hl
768 ret
769
770 sub_035dh:
771 call expr
772 jr c,error0
773 ret
774
775 sub_0363h:
776 call sub_035dh
777 l0366h:
778 jp assert_eol
779
780 get_lastarg_def:
781 call get_arg_def
782 jr l0366h
783
784 get_arg_def:
785 push hl
786 call expr
787 jr c,l0375h
788 ex (sp),hl
789 l0375h:
790 pop hl
791 ret
792
793 sub_0377h:
794 call b_037c_start
795 jr l0366h
796
797 b_037c_start:
798 defb 0e6h
799 get_arg_range:
800 scf
801 ex af,af'
802 push bc
803 push hl
804 call expr
805 jr nc,l038ch
806 ex af,af'
807 jr c,error0
808 ex af,af'
809 pop hl
810 defb 03eh
811 l038ch:
812 pop af
813 call get_range
814 jr nc,l0398h
815 ex af,af'
816 pop bc
817 ret nc
818 error0:
819 jp ERROR
820 l0398h:
821 pop af
822 ret
823
824 get_range:
825 call next_arg
826 cp 'S'
827 jr nz,l03a2h
828 inc de
829 l03a2h:
830 push hl
831 push af ;'S' flag
832 call expr
833 jr c,l03b8h
834 ld b,h
835 ld c,l
836 pop af
837 pop hl
838 jr z,l03b6h ;'S'?
839 ld a,c
840 sub l
841 ld c,a
842 ld a,b
843 sbc a,h
844 ld b,a
845 inc bc
846 l03b6h:
847 and a
848 ret
849 l03b8h:
850 pop af
851 pop hl
852 jr z,error0 ;'S', but no expression following
853 scf
854 ret
855
856 expr:
857 call skipbl
858 expr1:
859 call do_subexpr
860 ret c
861 call do_rel_op
862 ret nc
863 push bc
864 push hl
865 call do_subexpr
866 jr c,error0
867 ex de,hl
868 ex (sp),hl
869 and a
870 sbc hl,de
871 ld hl,0ffffh
872 pop de
873 ret
874
875 do_op_eq:
876 jr z,l03edh
877 jr l03ech
878 do_op_ne:
879 jr nz,l03edh
880 jr l03ech
881 do_op_le:
882 jr z,l03edh
883 do_op_lt:
884 jr c,l03edh
885 jr l03ech
886 do_op_gt:
887 jr z,l03ech
888 do_op_ge:
889 jr nc,l03edh
890 l03ech:
891 inc hl
892 l03edh:
893 and a
894 ret
895 do_rel_op:
896 push hl
897 ld hl,tab_eq_le_ge
898 call lookupch
899 jr nc,l041dh
900 ld a,b
901 or a
902 jr z,l0411h
903 ld a,(de)
904 cp '='
905 jr nz,l0406h
906 inc de
907 inc b
908 inc b
909 jr l0411h
910 l0406h:
911 bit 0,b
912 jr z,l0411h
913 cp '>'
914 jr nz,l0411h
915 inc de
916 ld b,005h
917 l0411h:
918 ld hl,tab_func_eqlege
919 ld a,b
920 add a,a
921 call add_hl_a
922 ld c,(hl)
923 inc hl
924 ld b,(hl)
925 scf
926 l041dh:
927 pop hl
928 ret
929
930 tab_eq_le_ge:
931 db '=<>',0
932
933 tab_func_eqlege:
934 dw do_op_eq
935 dw do_op_lt
936 dw do_op_gt
937 dw do_op_le
938 dw do_op_ge
939 dw do_op_ne
940
941 do_subexpr:
942 call do_factor
943 ret c
944 l0433h:
945 call do_binary_op
946 push hl
947 push bc
948 call do_factor
949 pop bc
950 ex de,hl
951 ex (sp),hl
952 jr nc,l0447h
953 pop de
954 ld a,b
955 or c
956 ret z
957 jp ERROR
958
959 l0447h:
960 ld a,b
961 or c
962 push bc
963 ret nz
964 pop bc
965
966 doop_add:
967 add hl,de
968 l044dh:
969 pop de
970 jr l0433h
971
972 doop_sub:
973 and a
974 sbc hl,de
975 jr l044dh
976
977 doop_mlt:
978 push bc
979 ld b,h
980 ld c,l
981 ld hl,0
982 ld a,010h
983 l045dh:
984 add hl,hl
985 ex de,hl
986 add hl,hl
987 ex de,hl
988 jr nc,l0464h
989 add hl,bc
990 l0464h:
991 dec a
992 jr nz,l045dh
993 pop bc
994 jr l044dh
995
996 doop_div:
997 call div_hl_de
998 jr l044dh
999
1000 doop_mod:
1001 call div_hl_de
1002 ex de,hl
1003 jr l044dh
1004
1005 ; divide x/y
1006 ; hl: x
1007 ; de: y
1008 ; return:
1009 ; hl: q (x/y)
1010 ; de: r (x%y)
1011
1012 div_hl_de:
1013 push bc
1014 ex de,hl
1015 ld b,h
1016 ld c,l
1017 ld hl,0
1018 ld a,16
1019
1020 ; de: x (x shifted out, q shifted in)
1021 ; bc: y
1022 ; hl: r (initially 0)
1023
1024 l047eh:
1025 push af
1026 add hl,hl
1027 ex de,hl
1028 xor a
1029 add hl,hl
1030 ex de,hl
1031 adc a,l
1032 sub c
1033 ld l,a
1034 ld a,h
1035 sbc a,b
1036 ld h,a
1037 inc de
1038 jr nc,l048fh
1039 add hl,bc
1040 dec de
1041 l048fh:
1042 pop af
1043 dec a
1044 jr nz,l047eh
1045 ex de,hl
1046 pop bc
1047 ret
1048
1049 doop_and:
1050 ld a,h
1051 and d
1052 ld h,a
1053 ld a,l
1054 and e
1055 ld l,a
1056 jr l044dh
1057
1058 doop_or:
1059 ld a,h
1060 or d
1061 ld h,a
1062 ld a,l
1063 or e
1064 ld l,a
1065 jr l044dh
1066
1067 doop_xor:
1068 ld a,h
1069 xor d
1070 ld h,a
1071 ld a,l
1072 xor e
1073 ld l,a
1074 jr l044dh
1075
1076 do_binary_op:
1077 push hl
1078 ld hl,tab_op_a
1079 call lookupch
1080 ld a,b
1081 ld hl,tblf_opa
1082 add a,a
1083 call add_hl_a
1084 ld c,(hl)
1085 inc hl
1086 ld b,(hl)
1087 pop hl
1088 ret
1089
1090 tab_op_a:
1091 DB '+-*/%&!#',0
1092
1093 tblf_opa:
1094 dw doop_add
1095 dw doop_sub
1096 dw doop_mlt
1097 dw doop_div
1098 dw doop_mod
1099 dw doop_and
1100 dw doop_or
1101 dw doop_xor
1102 dw 0
1103
1104 fact_factor:
1105 call do_factor
1106 ret nc
1107 jp ERROR
1108
1109 do_factor:
1110 call chk_stack
1111 call get.number
1112 ret nc
1113 inc de
1114 ld hl,(BDOS+1)
1115 cp 'T'
1116 ret z
1117 ld hl,(high_load)
1118 cp 'H'
1119 ret z
1120 ld hl,(max_load)
1121 cp 'M'
1122 ret z
1123 ld hl,TPA
1124 cp 'L'
1125 ret z
1126 ld hl,(var.@)
1127 cp '@'
1128 ret z
1129 ld hl,(var.$)
1130 cp '$'
1131 ret z
1132 cp '-'
1133 jr z,fact_factneg
1134 cp '~'
1135 jr z,fact_factinv
1136 cp '+'
1137 jr z,fact_factor
1138 cp '^'
1139 jr z,fact_reg.CPU
1140 cp 'Y'
1141 jr z,fact_reg.Y
1142 cp '('
1143 jr z,fact_mem
1144 cp '['
1145 jr z,expr_brckt
1146 cp ''''
1147 jr z,fact_factstring
1148 cp '.'
1149 jr z,fact_symbol
1150 dec de
1151 scf
1152 ret
1153
1154 fact_reg.Y:
1155 call get.decdigit
1156 jr c,error1
1157 inc de
1158 get_y_val:
1159 add a,a
1160 ld hl,reg_Y
1161 call add_hl_a
1162 ld a,(hl)
1163 inc hl
1164 ld h,(hl)
1165 ld l,a
1166 and a
1167 ret
1168
1169 fact_factstring:
1170 ld hl,0
1171 l054bh:
1172 ld a,(de)
1173 cp ''''
1174 jr z,l0557h
1175 and a
1176 ret z
1177 l0552h:
1178 ld h,l
1179 ld l,a
1180 inc de
1181 jr l054bh
1182 l0557h:
1183 inc de
1184 ld a,(de)
1185 cp ''''
1186 jr z,l0552h
1187 sub '.'
1188 or a
1189 ret nz
1190 inc de
1191 set 7,l
1192 ret
1193
1194 fact_reg.CPU:
1195 call sub_0caeh
1196 jr nc,error1
1197 ld a,(hl)
1198 inc hl
1199 ld h,(hl)
1200 ld l,a
1201 and a
1202 bit 0,c
1203 ret nz
1204 ld h,000h
1205 ret
1206
1207 fact_factneg:
1208 call fact_factor
1209 dec hl
1210 cpl.hl:
1211 ld a,h
1212 cpl
1213 ld h,a
1214 ld a,l
1215 cpl
1216 ld l,a
1217 ret
1218
1219 fact_factinv:
1220 call fact_factor
1221 jr cpl.hl
1222
1223 fact_mem:
1224 call expr1
1225 jr c,error1
1226 ld a,(de)
1227 cp ')'
1228 jr nz,error1
1229 inc de
1230 ld a,(hl)
1231 inc hl
1232 ld h,(hl)
1233 ld l,a
1234 ld a,(de)
1235 inc de
1236 cp '.'
1237 ret z
1238 dec de
1239 xor a
1240 ld h,a
1241 ret
1242
1243 expr_brckt:
1244 call expr1
1245 jr c,error1
1246 ld a,(de)
1247 cp ']'
1248 inc de
1249 ret z
1250 error1:
1251 jp ERROR
1252
1253 fact_symbol:
1254 push bc
1255 ld hl,ddtz_base ;symtbl start
1256
1257 fs_nxtsym:
1258 ld a,(hl) ;symlen
1259 cp 0c3h
1260 jr z,error1
1261 ld b,a ;symlen
1262 inc b
1263 push hl ;symtbl ptr
1264 push de ;inpsym ptr
1265 fs_2:
1266 ld a,(de)
1267 djnz fs_3
1268 call test_sym_char
1269 jr z,fs_cont
1270 pop hl ;inpsym ptr (discard)
1271 pop hl ;symtbl ptr
1272 inc hl
1273 ld a,(hl) ;symval h
1274 inc hl
1275 ld h,(hl) ;symval l
1276 ld l,a
1277 or a ;clear carry
1278 pop bc
1279 ret
1280 fs_3:
1281 inc de
1282 dec hl
1283 cp (hl)
1284 jr z,fs_2
1285 fs_cont: ;start over
1286 pop de ;inpsym ptr
1287 pop hl ;symtbl ptr
1288 ld a,(hl)
1289 add a,3
1290 call sub_hl_a
1291 jr fs_nxtsym
1292
1293 get.number:
1294 call get.hexdigit
1295 ret c
1296 push de
1297 test_number:
1298 inc de
1299 call get.hexdigit
1300 jr nc,test_number
1301 pop de
1302 cp '.'
1303 jr z,get_dec_number
1304 cp '"'
1305 jr z,get_bin_number
1306 ld hl,0
1307 next_hexdigit:
1308 call get.hexdigit
1309 jr c,hexnum_done
1310 add hl,hl
1311 add hl,hl
1312 add hl,hl
1313 add hl,hl
1314 call add_hl_a
1315 inc de
1316 jr next_hexdigit
1317
1318 hexnum_done:
1319 xor 'H'
1320 ret nz
1321 inc de
1322 ret
1323
1324 get_bin_number:
1325 ld hl,0
1326 next_bindigit:
1327 call get.bindigit
1328 l05dbh:
1329 inc de
1330 jr c,l05e4h
1331 add hl,hl
1332 call add_hl_a
1333 jr next_bindigit
1334 l05e4h:
1335 cp '"'
1336 jp nz,ERROR
1337 call get.bindigit
1338 jr nc,l05dbh
1339 or a
1340 ret
1341
1342 get_dec_number:
1343 ld hl,0
1344 next_decdigit:
1345 call get.decdigit
1346 inc de
1347 jr c,decnum_done
1348 push bc
1349 add hl,hl
1350 ld b,h
1351 ld c,l
1352 add hl,hl
1353 add hl,hl
1354 add hl,bc
1355 pop bc
1356 call add_hl_a
1357 jr next_decdigit
1358 decnum_done:
1359 cp '.'
1360 ret z
1361 jp ERROR
1362
1363 sub_060ch:
1364 ld a,(de)
1365 cp '['
1366 jr l0614h
1367
1368 get.hexdigit:
1369 ld a,(de)
1370 hex_digit:
1371 cp 'F'+1
1372 l0614h:
1373 ccf
1374 ret c
1375 cp 'A'
1376 jr c,l061eh
1377 sub 'A'-10
1378 ret
1379
1380 get.decdigit:
1381 ld a,(de)
1382 l061eh:
1383 cp '9'+1
1384 jr l0625h
1385
1386 get.bindigit:
1387 ld a,(de)
1388 cp '1'+1
1389 l0625h:
1390 ccf
1391 ret c
1392 cp '0'
1393 ret c
1394 sub '0'
1395 ret
1396
1397 p_cpustat0:
1398 call assert_eol
1399 p_cpustat:
1400 call p_f
1401 call outbl2
1402 ld hl,b_06e9_start
1403 ld de,b_0709_start
1404 ld b,6
1405 l063eh:
1406 call p_regs
1407 djnz l063eh
1408 push hl
1409 push de
1410 ld iy,(reg.pc)
1411 call p_disas_instr
1412 pop de
1413 ex (sp),hl
1414 push af
1415 call crlf
1416 call p_f2
1417 call outbl2
1418 ld b,7
1419 l065bh:
1420 call p_regs
1421 djnz l065bh
1422 pop af
1423 pop hl
1424 and a
1425 call nz,outbl6
1426 call nz,p_offset
1427 jp crlf
1428
1429 p_f:
1430 ld a,(reg.f)
1431 call p_flags
1432 ld a,(reg.iff)
1433 cp 0f3h
1434 jp z,outbl
1435 ld a,'E'
1436 jp outchar
1437 p_f2:
1438 ld a,(reg.f2)
1439 call p_flags
1440 jp outbl
1441
1442 p_flags:
1443 ld b,a
1444 ld a,'S'
1445 call sub_06aah
1446 ld a,'Z'
1447 call sub_06aah
1448 rl b
1449 ld a,'H'
1450 call sub_06aah
1451 rl b
1452 ld a,'V'
1453 call sub_06aah
1454 ld a,'N'
1455 call sub_06aah
1456 ld a,'C'
1457 sub_06aah:
1458 rl b
1459 jp c,outchar
1460 jp outbl
1461
1462 p_regs:
1463 push de
1464 call pstr
1465 call pstr_inl
1466 dc '='
1467 ex (sp),hl
1468 ld e,(hl)
1469 inc hl
1470 ld d,(hl)
1471 inc hl
1472 ld a,(hl)
1473 inc hl
1474 push hl
1475 and a
1476 jr z,l06deh
1477 ex de,hl
1478 ld e,(hl)
1479 inc hl
1480 ld d,(hl)
1481 ex de,hl
1482 dec a
1483 jr z,l06d9h
1484 call out.hl.@
1485 call z,outbl6
1486 jr l06e2h
1487 l06d9h:
1488 call out_hl
1489 jr l06e2h
1490 l06deh:
1491 ld a,(de)
1492 call out_hex
1493 l06e2h:
1494 call outbl
1495 pop de
1496 pop hl
1497 ret
1498
1499 b_06e9_start:
1500 DC 'A '
1501 DC 'BC '
1502 DC 'DE '
1503 DC 'HL '
1504 DC 'SP'
1505 DC 'PC'
1506 DC 'a'''
1507 DC 'bc'''
1508 DC 'de'''
1509 DC 'hl'''
1510 DC 'IX'
1511 DC 'IY'
1512 DC 'I'
1513 DB 0
1514
1515 b_0709_start:
1516 dw reg.a
1517 db 000h
1518 dw reg.c
1519 db 001h
1520 dw reg.e
1521 db 001h
1522 dw reg.l
1523 db 001h
1524 dw reg_sp
1525 db 001h
1526 dw reg.pc
1527 db 002h
1528 dw reg.a2
1529 db 000h
1530 dw reg.c2
1531 db 001h
1532 dw reg.e2
1533 db 001h
1534 dw reg.l2
1535 db 001h
1536 dw reg.ix
1537 db 001h
1538 dw reg.iy
1539 db 001h
1540 dw reg.i
1541 db 000h
1542 db 000h
1543
1544 cmd_G:
1545 sub a
1546 ld (trace_call_flag),a
1547 ld (l0941h),a
1548 call expr
1549 jr c,l0740h
1550 ld (reg.pc),hl
1551 l0740h:
1552 call skipbl
1553 jp z,user_go
1554 cp ';'
1555 jp nz,ERROR
1556 inc de
1557 ld a,002h
1558 call bp_enter
1559 jp user_go
1560
1561 bp_clr_temporary:
1562 ld b,BP_CNT
1563 ld ix,bp_tab
1564 l075ah:
1565 ld a,(ix+000h)
1566 and 0f1h
1567 ld (ix+000h),a
1568 call bp_clr_condition
1569 ld de,BP_SIZE
1570 add ix,de
1571 djnz l075ah
1572 ret
1573
1574 cmd_B:
1575 call skipbl
1576 jr z,bp_print
1577 inc de
1578 cp 'X'
1579 jr z,bp_clr0
1580 dec de
1581 ld a,001h
1582 jp bp_enter
1583 bp_clr0:
1584 call skipbl
1585 jr z,bp_clr_all
1586 bp_clr_next:
1587 call expr
1588 jp c,assert_eol
1589 push de
1590 call bp_clr
1591 pop de
1592 call next_arg
1593 jr bp_clr_next
1594
1595 bp_clr_all:
1596 scf
1597 bp_clr:
1598 ld b,BP_CNT
1599 ld ix,bp_tab
1600 l0799h:
1601 push af
1602 jr c,l07a7h
1603 ld e,(ix+002h)
1604 ld d,(ix+003h)
1605 call cp_hl_de
1606 jr nz,l07aeh
1607 l07a7h:
1608 ld (ix+000h),000h
1609 call bp_clr_condition
1610 l07aeh:
1611 ld de,BP_SIZE
1612 add ix,de
1613 pop af
1614 djnz l0799h
1615 ret
1616
1617 bp_print:
1618 ld b,BP_CNT
1619 ld ix,bp_tab
1620 bp_pr_l:
1621 bit 0,(ix+000h)
1622 jr z,bp_pr_cont
1623 ld a,'R'
1624 bit 4,(ix+000h)
1625 jr nz,l07cdh
1626 ld a,' '
1627 l07cdh:
1628 call outchar
1629 call outbl
1630 ld l,(ix+002h)
1631 ld h,(ix+003h)
1632 call out.hl.@
1633 ld a,82h
1634 call p_sym_space
1635 call pstr_inl
1636 dc ':'
1637 ld l,(ix+004h)
1638 ld h,(ix+005h)
1639 call out_hl
1640 ld l,(ix+006h)
1641 ld h,(ix+007h)
1642 ld a,h
1643 or l
1644 jr z,l0805h
1645 call outbl4
1646 call pstr_inl
1647 dc 'I '
1648 call pstr
1649 l0805h:
1650 call crlf
1651 bp_pr_cont:
1652 ld de,BP_SIZE
1653 add ix,de
1654 djnz bp_pr_l
1655 ret
1656
1657 ; Add break points to list
1658 ; A = 1 Permanent (B command)
1659 ; A = 2 Temporary (G command)
1660
1661 bp_enter:
1662 ld b,a
1663 call skipbl
1664 ret z
1665 cp 'R'
1666 jr nz,bp_e_1
1667 inc de
1668 set 4,b
1669 bp_e_1:
1670 push bc
1671 call expr
1672 jp c,ERROR
1673 pop bc
1674 bit 0,b
1675 push bc
1676 push de
1677 push hl
1678 call nz,bp_clr
1679 pop hl
1680 call bp_get_freeslot
1681 pop de
1682 ld (ix+002h),l
1683 ld (ix+003h),h
1684 call bp_get_count
1685 ld (ix+004h),l
1686 ld (ix+005h),h
1687 call bp_get_condition
1688 ld (ix+006h),l
1689 ld (ix+007h),h
1690 call next_arg
1691 pop af
1692 ld (ix+000h),a
1693 and 00fh
1694 jr bp_enter
1695
1696 bp_get_freeslot:
1697 ld b,BP_CNT
1698 ld ix,bp_tab
1699 bp_gf_l:
1700 ld a,(ix+000h)
1701 and 00fh
1702 ret z
1703 push bc
1704 ld bc,BP_SIZE
1705 add ix,bc
1706 pop bc
1707 djnz bp_gf_l
1708 jp ERROR
1709
1710 bp_get_count:
1711 call skipbl
1712 ld hl,1
1713 cp ':'
1714 ret nz
1715 inc de
1716 call expr
1717 jp c,ERROR
1718 ret
1719
1720 bp_get_condition:
1721 call skipbl
1722 cp 'I'
1723 ld hl,0
1724 ret nz
1725 inc de
1726 call skipbl
1727 push de
1728 call expr
1729 jp c,ERROR
1730 ex de,hl
1731 pop de
1732 push de
1733 sbc hl,de
1734 ld b,h
1735 ld c,l
1736 ld hl,(expr_p1)
1737 push hl
1738 add hl,bc
1739 ld de,expr_bufe
1740 call cp_hl_de
1741 jp nc,ERROR
1742 pop hl
1743 ld (expr_p2),hl
1744 pop de
1745 ex de,hl
1746 ldir
1747 xor a
1748 ld (de),a
1749 inc de
1750 ex de,hl
1751 ld (expr_p1),hl
1752 ld hl,(expr_p2)
1753 ret
1754
1755 bpddtz:
1756 ld (reg.l),hl
1757 pop hl
1758 dec hl
1759 ld (reg.pc),hl
1760 ld (reg_sp),sp
1761 ld sp,reg.l
1762 push de
1763 push bc
1764 push af
1765 push ix
1766 push iy
1767 ld a,i
1768 call sub_0004h
1769 ld h,a
1770 ld l,000h
1771 push hl
1772 ld a,0f3h
1773 jp po,l08dfh
1774 ld a,0fbh
1775 l08dfh:
1776 ld (reg.iff),a
1777 ex af,af'
1778 push af
1779 exx
1780 push bc
1781 push de
1782 push hl
1783 call sub_097ah
1784 ld a,(b_21e2_start)
1785 dec a
1786 jr z,l090bh
1787 call inchar
1788 jr c,l0902h
1789 call sub_0913h
1790 and a
1791 jp z,user_go
1792 and 083h
1793 jp z,l2151h
1794 l0902h:
1795 call bp_clr_temporary
1796 call p_cpustat
1797 jp mainloop
1798
1799 l090bh:
1800 ld (b_21e2_start),a
1801 ld c,007h
1802 jp l0a41h
1803
1804 sub_0913h:
1805 ld a,080h
1806 ex af,af'
1807 sub a
1808 ld (l0941h),a
1809 ld b,BP_CNT
1810 ld ix,bp_tab
1811 l0920h:
1812 ld a,(ix+000h)
1813 and 007h
1814 jr z,l0938h
1815 ld e,(ix+002h)
1816 ld d,(ix+003h)
1817 ld hl,(reg.pc)
1818 call cp_hl_de
1819 push bc
1820 call z,sub_0942h
1821 pop bc
1822 l0938h:
1823 ld de,BP_SIZE
1824 add ix,de
1825 djnz l0920h
1826 ex af,af'
1827 ret
1828
1829 sub_0942h:
1830 ex af,af'
1831 res 7,a
1832 ex af,af'
1833 ld e,(ix+006h)
1834 ld d,(ix+007h)
1835 ld a,d
1836 or e
1837 ld hl,0ffffh
1838 call nz,expr
1839 ld a,h
1840 or l
1841 jr z,l0969h
1842 ld e,(ix+004h)
1843 ld d,(ix+005h)
1844 dec de
1845 ld a,d
1846 or e
1847 jr z,l0974h
1848 ld (ix+004h),e
1849 ld (ix+005h),d
1850 l0969h:
1851 bit 4,(ix+000h)
1852 ret z
1853 ld a,001h
1854 ld (l0941h),a
1855 ret
1856 l0974h:
1857 ex af,af'
1858 or (ix+000h)
1859 ex af,af'
1860 ret
1861
1862 sub_097ah:
1863 ld b,BP_CNT
1864 ld ix,bp_tab
1865 l0980h:
1866 bit 5,(ix+000h)
1867 res 5,(ix+000h)
1868 jr z,l099ah
1869 ld l,(ix+002h)
1870 ld h,(ix+003h)
1871 ld a,(l0003h)
1872 cp (hl)
1873 jr nz,l099ah
1874 ld a,(ix+001h)
1875 ld (hl),a
1876 l099ah:
1877 res 3,(ix+000h)
1878 ld de,BP_SIZE
1879 add ix,de
1880 djnz l0980h
1881 ret
1882
1883 sub_09a6h:
1884 ld b,BP_CNT
1885 ld ix,bp_tab
1886 l09ach:
1887 ld a,(ix+000h)
1888 and 003h
1889 jr z,l09c0h
1890 ld e,(ix+002h)
1891 ld d,(ix+003h)
1892 ld hl,(reg.pc)
1893 call cp_hl_de
1894 ret z
1895 l09c0h:
1896 ld de,BP_SIZE
1897 add ix,de
1898 djnz l09ach
1899 sub a
1900 inc a
1901 ret
1902
1903 sub_09cah:
1904 call bp_get_freeslot
1905 ld (ix+004h),001h
1906 ld (ix+005h),000h
1907 ld (ix+002h),l
1908 ld (ix+003h),h
1909 ld (ix+006h),000h
1910 ld (ix+007h),000h
1911 ld a,(b_21e2_start)
1912 and a
1913 ld a,008h
1914 jr nz,l09edh
1915 ld a,004h
1916 l09edh:
1917 ld (ix+000h),a
1918 ret
1919
1920 sub_09f1h:
1921 ld b,BP_CNT
1922 ld ix,bp_tab
1923 l09f7h:
1924 ld a,(ix+000h)
1925 and c
1926 jr z,l0a1dh
1927 set 5,(ix+000h)
1928 ld l,(ix+002h)
1929 ld h,(ix+003h)
1930 ld a,(hl)
1931 ld (ix+001h),a
1932 ld a,(l0003h)
1933 ld (hl),a
1934 and 038h
1935 ld h,000h
1936 ld l,a
1937 ld (hl),0c3h
1938 inc hl
1939 ld de,bpddtz
1940 ld (hl),e
1941 inc hl
1942 ld (hl),d
1943 l0a1dh:
1944 ld de,BP_SIZE
1945 add ix,de
1946 djnz l09f7h
1947 ret
1948
1949 user_go:
1950 sub a
1951 ld (b_21e2_start),a
1952 ld a,(l0941h)
1953 and a
1954 call nz,p_cpustat
1955 call sub_09a6h
1956 ld c,007h
1957 jr nz,l0a41h
1958 ld a,001h
1959 ld (b_21e2_start),a
1960 call sub_1ffeh
1961 ld c,008h
1962 l0a41h:
1963 call sub_09f1h
1964 ld sp,reg.l2
1965 pop hl
1966 pop de
1967 pop bc
1968 pop af
1969 exx
1970 ex af,af'
1971 pop af
1972 ld i,a
1973 pop iy
1974 pop ix
1975 pop af
1976 pop bc
1977 pop de
1978 pop hl
1979 ld sp,(reg_sp)
1980 jp reg.iff
1981
1982 bp_clr_condition:
1983 ld a,(ix+000h)
1984 and 003h
1985 ret nz
1986 ld e,(ix+006h)
1987 ld d,(ix+007h)
1988 ld a,d
1989 or e
1990 ret z
1991 push bc
1992 ld h,d
1993 ld l,e
1994 sub a
1995 ld (ix+006h),a
1996 ld (ix+007h),a
1997 ld bc,0ffffh
1998 cpir
1999 l0a7dh:
2000 push de
2001 ld de,(expr_p1)
2002 call cp_hl_de
2003 pop de
2004 jr nc,l0a93h
2005 call sub_0a99h
2006 l0a8bh:
2007 ld a,(hl)
2008 ldi
2009 and a
2010 jr nz,l0a8bh
2011 jr l0a7dh
2012 l0a93h:
2013 ld (expr_p1),de
2014 pop bc
2015 ret
2016
2017 sub_0a99h:
2018 ld iy,bp_tab
2019 push de
2020 l0a9eh:
2021 ld e,(iy+006h)
2022 ld d,(iy+007h)
2023 call cp_hl_de
2024 jr z,l0ab0h
2025 ld de,BP_SIZE
2026 add iy,de
2027 jr l0a9eh
2028 l0ab0h:
2029 pop de
2030 ld (iy+006h),e
2031 ld (iy+007h),d
2032 ret
2033
2034 cmd_Y:
2035 call get.decdigit
2036 jr c,l0bc3h
2037 inc de
2038 push af
2039 call assert_eol
2040 pop af
2041 call sub_0bdch
2042 jp l0c15h
2043 l0bc3h:
2044 call assert_eol
2045 xor a
2046 l0bc7h:
2047 push af
2048 call sub_0bdch
2049 pop af
2050 push af
2051 call get_y_val
2052 ld a,82h
2053 call p_sym_space
2054 pop af
2055 inc a
2056 bit 0,a
2057 push af
2058 call z,crlf
2059 pop af
2060 cp YREG_CNT
2061 jr c,l0bc7h
2062 ret
2063
2064 sub_0bdch:
2065 ld c,a
2066 ld b,0
2067 add a,'0'+080h
2068 ld de,msg_Y+1
2069 ld (de),a
2070 dec de
2071 ld hl,reg_Y
2072 add hl,bc
2073 add hl,bc
2074 ex de,hl
2075 ld c,003h
2076 jp l0c33h
2077
2078 cmd_X:
2079 call skipbl
2080 call sub_0caeh
2081 jp nc,p_cpustat0
2082 call assert_eol
2083 ld a,b
2084 cp 01eh
2085 jr z,l0c5fh
2086 cp 01fh
2087 jr z,l0c4fh
2088 cp 01dh
2089 jp z,ERROR
2090 ex de,hl
2091 ld hl,b_0cc3_start
2092 call sel_dc_string
2093 l0c12h:
2094 call l0c33h
2095 l0c15h:
2096 call outbl
2097 push de
2098 push bc
2099 call get_line
2100 call skipbl
2101 jr z,l0c30h
2102 call sub_0363h
2103 ex de,hl
2104 pop bc
2105 pop hl
2106 ld (hl),e
2107 bit 0,c
2108 ret z
2109 inc hl
2110 ld (hl),d
2111 ret
2112 l0c30h:
2113 pop af
2114 pop hl
2115 ret
2116
2117 l0c33h:
2118 call pstr
2119 call pstr_inl
2120 dc '='
2121 ld a,(de)
2122 bit 0,c
2123 jp z,out_hex
2124 ld l,a
2125 inc de
2126 ld a,(de)
2127 dec de
2128 ld h,a
2129 bit 1,c
2130 jp z,out_hl
2131 jp out.hl.@
2132
2133 l0c4fh:
2134 call p_f
2135 ld a,0f3h
2136 ld (reg.iff),a
2137 scf
2138 call sub_0c6ah
2139 ld (reg.f),a
2140 ret
2141 l0c5fh:
2142 call p_f2
2143 and a
2144 call sub_0c6ah
2145 ld (reg.f2),a
2146 ret
2147
2148 sub_0c6ah:
2149 push af
2150 ld b,000h
2151 call outbl
2152 call assert_eol
2153 call get_line
2154 pop af
2155 ex af,af'
2156 l0c76h:
2157 call skipbl
2158 ld a,b
2159 ret z
2160 push bc
2161 ld hl,b_0ca4_start
2162 call lookupch
2163 jp nc,ERROR
2164 ld a,b
2165 cp 008h
2166 jr z,l0c97h
2167 pop bc
2168 rlca
2169 rlca
2170 rlca
2171 add a,0c0h
2172 ld (l0c94h),a
2173 defb 0cbh
2174 l0c94h:
2175 defb 0c0h
2176 jr l0c76h
2177 l0c97h:
2178 ex af,af'
2179 jp nc,ERROR
2180 ex af,af'
2181 ld a,0fbh
2182 ld (reg.iff),a
2183 pop bc
2184 jr l0c76h
2185
2186 b_0ca4_start:
2187 db 'CNV H ZSE',0
2188
2189 sub_0caeh:
2190 call sub_0303h
2191 ret nc
2192 ld a,b
2193 add a,b
2194 add a,b
2195 ld hl,b_0cfa_start
2196 call add_hl_a
2197 ld c,(hl)
2198 inc hl
2199 ld a,(hl)
2200 inc hl
2201 ld h,(hl)
2202 ld l,a
2203 scf
2204 ret
2205
2206 b_0cc3_start:
2207 DC 'BC'''
2208 DC 'DE'''
2209 DC 'HL'''
2210 DC 'BC'
2211 DC 'DE'
2212 DC 'HL'
2213 DC 'A'''
2214 DC 'B'''
2215 DC 'C'''
2216 DC 'D'''
2217 DC 'E'''
2218 DC 'H'''
2219 DC 'L'''
2220 DC 'A'
2221 DC 'B'
2222 DC 'C'
2223 DC 'D'
2224 DC 'E'
2225 DC 'H'
2226 DC 'L'
2227 DC 'IX'
2228 DC 'IY'
2229 DC 'SP'
2230 DC 'PC'
2231 DC 'X'
2232 DC 'Y'
2233 DC 'S'
2234 DC 'P'
2235 DC 'I'
2236 DC 'IP'
2237 DC 'F'''
2238 DC 'F'
2239 DB 0
2240
2241 b_0cfa_start:
2242 db 003h
2243 dw reg.c2
2244 db 003h
2245 dw reg.e2
2246 db 003h
2247 dw reg.l2
2248 db 003h
2249 dw reg.c
2250 db 003h
2251 dw reg.e
2252 db 003h
2253 dw reg.l
2254 db 000h
2255 dw reg.a2
2256 db 000h
2257 dw reg.b2
2258 db 000h
2259 dw reg.c2
2260 db 000h
2261 dw reg.d2
2262 db 000h
2263 dw reg.e2
2264 db 000h
2265 dw reg.h2
2266 db 000h
2267 dw reg.l2
2268 db 000h
2269 dw reg.a
2270 db 000h
2271 dw reg.b
2272 db 000h
2273 dw reg.c
2274 db 000h
2275 dw reg.d
2276 db 000h
2277 dw reg.e
2278 db 000h
2279 dw reg.h
2280 db 000h
2281 dw reg.l
2282 db 003h
2283 dw reg.ix
2284 db 003h
2285 dw reg.iy
2286 db 003h
2287 dw reg_sp
2288 db 003h
2289 dw reg.pc
2290 db 003h
2291 dw reg.ix
2292 db 003h
2293 dw reg.iy
2294 db 003h
2295 dw reg_sp
2296 db 003h
2297 dw reg.pc
2298 db 000h
2299 dw reg.i
2300 db 003h
2301 dw l004eh
2302 db 000h
2303 dw reg.f2
2304 db 000h
2305 dw reg.f
2306
2307 cmd_S:
2308 ld hl,(last_S)
2309 call get_lastarg_def
2310 l0d60h:
2311 ld (last_S),hl
2312 call out.hl.@
2313 call outbl
2314 ld a,(hl)
2315 call out_hex
2316 call outbl2
2317 call get_line
2318 call skipbl
2319 inc hl
2320 jr z,l0d60h
2321 dec hl
2322 inc de
2323 cp '.'
2324 jr nz,cmds_dash
2325 ld a,(de)
2326 or a
2327 jr nz,l0d8ah
2328 ret
2329 cmds_dash:
2330 jp z,assert_eol
2331 cp '-'
2332 jr nz,l0d8ah
2333 ld a,(de)
2334 or a
2335 dec hl
2336 jr z,l0d60h
2337 inc hl
2338 l0d8ah:
2339 dec de
2340 call sub_0ef8h
2341 jr l0d60h
2342
2343 cmd_@:
2344 call assert_eol
2345 ld hl,msg_@
2346 ld de,var.@
2347 ld c,001h
2348 jp l0c12h
2349
2350 msg_@:
2351 dc '@'
2352
2353 cmd_I:
2354 ld hl,cmd_I
2355 ld (cmd_rpt),hl
2356 ld hl,(last_I)
2357 call get_lastarg_def
2358 ld (last_I),hl
2359 ld b,h
2360 ld c,l
2361 in a,(c)
2362 push af
2363 call out_hex
2364 call outbl4
2365 pop af
2366 call out.bin.b
2367 jp crlf
2368
2369 cmd_O:
2370 ld hl,cmd_O
2371 ld (cmd_rpt),hl
2372 ld hl,(last_O_val)
2373 call get_arg_def
2374 ld a,l
2375 ld (last_O_val),a
2376 push af
2377 call next_arg
2378 ld hl,(last_O_addr)
2379 call get_lastarg_def
2380 ld (last_O_addr),hl
2381 ld b,h
2382 ld c,l
2383 pop af
2384 out (c),a
2385 ret
2386
2387 cmd_V:
2388 call sub_034eh
2389 l0dedh:
2390 push bc
2391 ld a,(de)
2392 ld b,(hl)
2393 cp b
2394 jr z,l0e10h
2395 ld c,a
2396 call out.hl.@
2397 call outbl
2398 ld a,b
2399 call out_hex
2400 call outbl2
2401 ld a,c
2402 call out_hex
2403 call outbl
2404 ex de,hl
2405 call out.hl.@
2406 ex de,hl
2407 call crlf
2408 l0e10h:
2409 pop bc
2410 inc hl
2411 inc de
2412 dec bc
2413 ld a,b
2414 or c
2415 jr nz,l0dedh
2416 ret
2417
2418 cmd_M:
2419 ld a,(de)
2420 cp 'V'
2421 jr nz,l0e1fh
2422 inc de
2423 l0e1fh:
2424 push af
2425 call sub_034eh
2426 push hl
2427 push de
2428 push bc
2429 call cp_hl_de
2430 jr nc,cmdm_up
2431 add hl,bc
2432 ex de,hl
2433 add hl,bc
2434 ex de,hl
2435 dec hl
2436 dec de
2437 lddr
2438 db 01h ;swallow ldir instruction (ld bc,...)
2439 cmdm_up:
2440 ldir
2441 pop bc
2442 pop de
2443 pop hl
2444 pop af
2445 jr z,l0dedh
2446 ret
2447
2448 cmd_H:
2449 ld a,(de)
2450 cp 'S'
2451 jr z,p_symbols
2452
2453 call expr
2454 jp c,p_max_high0
2455 call next_arg
2456 push hl
2457 call expr
2458 push af
2459 call assert_eol
2460 pop af
2461 ex de,hl
2462 pop hl
2463 jr c,l0e5eh
2464 push hl
2465 push de
2466 add hl,de
2467 call l0e5eh
2468 pop de
2469 pop hl
2470 and a
2471 sbc hl,de
2472 l0e5eh:
2473 call out_hl
2474 call outbl2
2475 call out_hl_neg
2476 call outbl4
2477 call out.hl.dec
2478 call outbl2
2479 call out_hl_dec_neg
2480 call outbl4
2481 call out.bin.w
2482 call outbl
2483 ld a,l
2484 call out.ascii
2485 ld a,80h
2486 call p_sym_space
2487 jp crlf
2488
2489 p_symbols:
2490 inc de
2491 call assert_eol
2492 ld a,(symlen_max)
2493 add a,7
2494 ld b,a
2495 ld c,0
2496 ld hl,ddtz_base+2
2497 psym_nxtsym:
2498 ld d,(hl)
2499 dec hl
2500 ld e,(hl)
2501 dec hl
2502 ld a,(hl)
2503 cp 0c3h
2504 jr z,psym_e
2505
2506 ex de,hl
2507 call out_hl
2508 call outbl
2509 ex de,hl
2510 call p_symstr
2511
2512 ld a,c
2513 add b
2514 ld c,a
2515 ld a,80 ;screen width
2516 sub b
2517 cp c
2518 jr c,psym_nxtline
2519 call p_fill_space
2520 jr psym_nxtsym
2521
2522 psym_nxtline:
2523 ld c,0
2524 call crlf
2525 jr psym_nxtsym
2526
2527 psym_e:
2528 ld a,c
2529 or a
2530 ret z
2531 jp crlf
2532
2533
2534 cmd_Q:
2535 ld a,(de)
2536 sub 'J'
2537 ld (cmd_Q_jopt),a
2538 jr nz,l0e8dh
2539 inc de
2540 l0e8dh:
2541 call get_arg_range
2542 push bc
2543 push hl
2544 call sub_0ee6h
2545 pop hl
2546 l0e96h:
2547 call sub_0ed7h
2548 jr nz,l0eb0h
2549 push bc
2550 push hl
2551 ld a,(cmd_Q_jopt)
2552 or a
2553 jr nz,l0ea7h
2554 ld bc,-8
2555 add hl,bc
2556 l0ea7h:
2557 ld bc,16
2558 and a
2559 call sub_0f58h
2560 pop hl
2561 pop bc
2562 l0eb0h:
2563 inc hl
2564 ex (sp),hl
2565 dec hl
2566 ld a,h
2567 or l
2568 ex (sp),hl
2569 jr nz,l0e96h
2570 pop bc
2571 ret
2572
2573 cmd_Z:
2574 call get_arg_range
2575 push bc
2576 push hl
2577 call sub_0ee6h
2578 ld a,b
2579 pop hl
2580 pop bc
2581 push hl
2582 ex de,hl
2583 l0ec7h:
2584 ldi
2585 jp po,l0ed3h
2586 dec a
2587 jr nz,l0ec7h
2588 pop hl
2589 ldir
2590 ret
2591 l0ed3h:
2592 pop hl
2593 ret
2594
2595 sub_0ed7h:
2596 push hl
2597 push de
2598 push bc
2599 l0edah:
2600 ld a,(de)
2601 cp (hl)
2602 jr nz,l0ee2h
2603 inc de
2604 inc hl
2605 djnz l0edah
2606 l0ee2h:
2607 pop bc
2608 pop de
2609 pop hl
2610 ret
2611
2612 sub_0ee6h:
2613 ld hl,conbuf+1
2614 call sub_0ef7h
2615 ld de,conbuf+1
2616 and a
2617 sbc hl,de
2618 ld b,l
2619 ret nz
2620 jp ERROR
2621
2622 sub_0ef7h:
2623 db 0e6h ; and 037h (clear carry)
2624 sub_0ef8h:
2625 scf
2626 l0ef9h:
2627 push af
2628 call next_arg
2629 cp 'W'
2630 jr nz,l0f0eh
2631 inc de
2632 push hl
2633 call sub_035dh
2634 ex de,hl
2635 ex (sp),hl
2636 ld (hl),e
2637 inc hl
2638 ld a,d
2639 pop de
2640 jr l0f1ah
2641 l0f0eh:
2642 cp ''''
2643 jr z,l0f1eh
2644 push hl
2645 call expr
2646 ld a,l
2647 pop hl
2648 jr c,l0f42h
2649 l0f1ah:
2650 ld (hl),a
2651 inc hl
2652 jr l0f3ah
2653 l0f1eh:
2654 inc de
2655 ld a,(de)
2656 cp ''''
2657 jr z,l0f2bh
2658 or a
2659 jr z,l0f42h
2660 l0f27h:
2661 ld (hl),a
2662 inc hl
2663 jr l0f1eh
2664 l0f2bh:
2665 inc de
2666 ld a,(de)
2667 cp ''''
2668 jr z,l0f27h
2669 cp '.'
2670 jr nz,l0f3ah
2671 inc de
2672 dec hl
2673 set 7,(hl)
2674 inc hl
2675 l0f3ah:
2676 pop af
2677 jr nc,l0ef9h
2678 ld (last_S),hl
2679 jr l0ef9h
2680 l0f42h:
2681 pop af
2682 ret nc
2683 ld (last_S),hl
2684 ret
2685
2686 cmd_D:
2687 ld hl,cmd_D
2688 ld (cmd_rpt),hl
2689 ld hl,(last_D)
2690 ld bc,128
2691 call sub_0377h
2692 scf
2693 sub_0f58h:
2694 push bc
2695 push de
2696 push hl
2697 push af
2698 l0f5ch:
2699 call out.hl.@
2700 call z,outbl2
2701 call outbl
2702 ld de,0
2703 l0f68h:
2704 ld a,(hl)
2705 inc hl
2706 call out_hex
2707 call outbl
2708 dec bc
2709 inc e
2710 ld a,e
2711 cp 010h
2712 jr z,l0f80h
2713 and 003h
2714 call z,outbl
2715 ld a,b
2716 or c
2717 jr nz,l0f68h
2718 l0f80h:
2719 call outbl
2720 and a
2721 sbc hl,de
2722 l0f86h:
2723 ld a,(hl)
2724 call sub_0fa3h
2725 call outchar
2726 inc hl
2727 dec e
2728 jr nz,l0f86h
2729 pop af
2730 push af
2731 jr nc,l0f97h
2732 ld (last_D),hl
2733 l0f97h:
2734 call crlf
2735 ld a,b
2736 or c
2737 jr nz,l0f5ch
2738 pop af
2739 pop hl
2740 pop de
2741 pop bc
2742 ret
2743
2744 sub_0fa3h:
2745 and 07fh
2746 cp 07fh
2747 jr z,l0fach
2748 cp ' '
2749 ret nc
2750 l0fach:
2751 ld a,'.'
2752 ret
2753
2754 cmd_F:
2755 push de
2756 ld hl,DMA_BUF+1
2757 ld (hl),' '
2758 inc hl
2759 l0fb6h:
2760 ld a,(de)
2761 ld (hl),a
2762 inc hl
2763 inc de
2764 and a
2765 jr nz,l0fb6h
2766 ld a,l
2767 sub DMA_BUF+2
2768 ld (DMA_BUF),a
2769 pop hl
2770 ld de,dfcb1
2771 call parse_filename
2772 ld de,dfcb2
2773 call parse_filename
2774 ;fall thru
2775
2776 cpy_fcb2:
2777 ld hl,dfcb2
2778 ld de,fcbsym
2779 ld bc,16
2780 ldir
2781 ret
2782
2783 parse_filename:
2784 call sub_102ch
2785 push de
2786 push bc
2787 ld b,(hl)
2788 inc hl
2789 ld a,(hl)
2790 cp ':'
2791 jr nz,l0fe1h
2792 inc hl
2793 ld a,b
2794 sub 040h
2795 and 01fh
2796 jr l0fe3h
2797 l0fe1h:
2798 dec hl
2799 xor a
2800 l0fe3h:
2801 ld (de),a
2802 inc de
2803 ld b,8
2804 call sub_0ff2h
2805 ld b,3
2806 call sub_0ff2h
2807 pop bc
2808 pop de
2809 ret
2810
2811 sub_0ff2h:
2812 call sub_1012h
2813 jr z,l0ffeh
2814 inc hl
2815 ld (de),a
2816 inc de
2817 djnz sub_0ff2h
2818 jr l1003h
2819 l0ffeh:
2820 ld a,c
2821 l0fffh:
2822 ld (de),a
2823 inc de
2824 djnz l0fffh
2825 l1003h:
2826 call sub_1012h
2827 inc hl
2828 jr nz,l1003h
2829 cp '*'
2830 jr z,l1003h
2831 cp '.'
2832 ret z
2833 dec hl
2834 ret
2835
2836 sub_1012h:
2837 ld a,(hl)
2838 ld c,' '
2839 and 01fh
2840 ret z
2841 ld a,(hl)
2842 cp ' '
2843 ret z
2844 call sub_1043h
2845 ret z
2846 cp '/'
2847 ret z
2848 cp '.'
2849 ret z
2850 ld c,'?'
2851 cp '*'
2852 ret
2853
2854 l102bh:
2855 inc hl
2856 sub_102ch:
2857 ld a,(hl)
2858 cp '/'
2859 jr z,l103bh
2860 call sub_1043h
2861 jr z,l102bh
2862 l1036h:
2863 cp ' '
2864 jr z,l102bh
2865 ret
2866
2867 l103bh:
2868 ld a,(hl)
2869 cp ' '+1
2870 jr c,l1036h
2871 inc hl
2872 jr l103bh
2873
2874 sub_1043h:
2875 cp '='
2876 ret z
2877 cp '_'
2878 ret z
2879 cp ','
2880 ret
2881
2882 setup_fcb:
2883 push de
2884 ld hl,12
2885 add hl,de
2886 xor a
2887 ld b,21
2888 l1052h:
2889 ld (hl),a
2890 inc hl
2891 djnz l1052h
2892 ld de,DMA_BUF
2893 ld c,BDOS_SETDMA
2894 call ddtz_bdos
2895 pop de
2896 ret
2897
2898 file_open:
2899 ld (cur_fcb),de
2900 call setup_fcb
2901 ld c,BDOS_OPEN
2902 call ddtz_bdos
2903 inc a
2904 jp z,ERROR
2905 ld a,080h
2906 ld (cmdR_rindex),a
2907 ret
2908
2909 read_byte:
2910 ld a,(cmdR_rindex)
2911 cp 080h
2912 jr nz,l1111h
2913 call read_sector
2914 ld a,01ah
2915 ret z
2916 sub a
2917 l1111h:
2918 inc a
2919 ld (cmdR_rindex),a
2920 push hl
2921 add a,07fh
2922 ld l,a
2923 ld h,000h
2924 ld a,(hl)
2925 pop hl
2926 cp 01ah
2927 ret
2928
2929 read_sector:
2930 push hl
2931 push de
2932 push bc
2933 ld de,(cur_fcb)
2934 ld c,BDOS_READ
2935 call ddtz_bdos
2936 sub a,1
2937 jr z,l1132h
2938 jr nc,error2
2939 l1132h:
2940 pop bc
2941 pop de
2942 pop hl
2943 ret
2944
2945 cmdR_storebyte:
2946 push af
2947 push de
2948 ld de,TPA
2949 call cp_hl_de
2950 jr c,error2
2951 ld de,(BDOS+1)
2952 call cp_hl_de
2953 jr nc,error2
2954 ld de,(high_load)
2955 call cp_hl_de
2956 jr c,l1157h
2957 ld (high_load),hl
2958 l1157h:
2959 ld de,(max_load)
2960 call cp_hl_de
2961 jr c,l1163h
2962 ld (max_load),hl
2963 l1163h:
2964 pop de
2965 pop af
2966 ld (hl),a
2967 ret
2968
2969 strncmp:
2970 ld a,(de)
2971 cp (hl)
2972 inc de
2973 inc hl
2974 ret nz
2975 djnz strncmp
2976 ret
2977
2978 str_hex:
2979 db 'HEX'
2980
2981 read_hexchar:
2982 call read_hexdigit
2983 rlca
2984 rlca
2985 rlca
2986 rlca
2987 ld d,a
2988 call read_hexdigit
2989 add a,d
2990 ld d,a
2991 add a,c
2992 ld c,a
2993 ld a,d
2994 ret
2995
2996 read_hexdigit:
2997 call read_byte
2998 jr z,error2
2999 hex_digit_v:
3000 call hex_digit
3001 ret nc
3002 error2:
3003 jp ERROR
3004
3005 read_hexbyte:
3006 call read_byte
3007 read_hexbyte0:
3008 push bc
3009 call hex_digit_v
3010 rlca
3011 rlca
3012 rlca
3013 rlca
3014 ld c,a
3015 call read_byte
3016 call hex_digit_v
3017 or c
3018 pop bc
3019 ret
3020
3021 cmd_R:
3022 ld hl,0
3023 call get_lastarg_def
3024 read_file:
3025 ld de,dfcb1+1
3026 ld a,(de)
3027 cp '?'
3028 jr z,read_symfile
3029 dec de
3030 push hl
3031 ld hl,0
3032 ld (high_load),hl
3033 call file_open
3034 ld hl,dfcb1+9
3035 ld de,str_hex
3036 ld b,3
3037 call strncmp
3038 pop hl
3039 jr z,read_hexfile
3040 ld de,TPA
3041 push hl
3042 add hl,de
3043 l108eh:
3044 call read_sector
3045 jr nz,read_file_nxt
3046 pop hl
3047 jr read_symfile
3048
3049 read_file_nxt:
3050 ld de,DMA_BUF
3051 ld b,080h
3052 l109ah:
3053 ld a,(de)
3054 call cmdR_storebyte
3055 inc de
3056 inc hl
3057 djnz l109ah
3058 jr l108eh
3059
3060 read_hexfile:
3061 push hl
3062 l10aeh:
3063 call read_byte ; RECORD MARK
3064 jr z,rdhex_done
3065 cp ':'
3066 jr nz,l10aeh
3067 ld c,0
3068 call read_hexchar ; RECLEN
3069 ld b,a
3070 call read_hexchar ; LOAD ADDR H
3071 ld h,a
3072 call read_hexchar ; LOAD ADDR L
3073 ld l,a
3074 ld a,b
3075 and a
3076 jr z,rdhex_done
3077 call read_hexchar ; RECTYP
3078 l10cch:
3079 call read_hexchar ; DATA
3080 pop de
3081 push de
3082 push hl
3083 add hl,de
3084 call cmdR_storebyte
3085 pop hl
3086 inc hl
3087 djnz l10cch
3088 call read_hexchar ; CHKSUM
3089 ld a,c
3090 and a
3091 jr nz,error3
3092 jr l10aeh
3093 rdhex_done:
3094 pop hl
3095 jr read_symfile
3096
3097 read_symfile:
3098 ld de,fcbsym+1
3099 ld a,(de)
3100 cp ' '
3101 jp z,p_max_high
3102
3103 push hl ; offset
3104 call pstr_inl
3105 db 'SYMBOLS',CR,LF+80h
3106
3107 dec de
3108 call file_open
3109 rs_1:
3110 call read_byte
3111 rs_2:
3112 pop de ; offset
3113 cp 1ah
3114 jp z,p_max_high
3115 push de ; offset
3116 cp '!'
3117 jr c,rs_1
3118 call read_hexbyte0 ; symval H
3119 ld h,a
3120 call read_hexbyte ; symval L
3121 ld l,a
3122 add hl,de
3123 call read_byte
3124 cp ' '
3125 jr z,rs_4
3126 rs_3: call read_byte
3127 cp ' '
3128 jr nc,rs_3
3129 jr rs_2
3130
3131 rs_4:
3132 push hl ; symval
3133 ld hl,(BDOS+1) ;
3134 ld b,0 ; setup symlen
3135 rs_5:
3136 dec hl ;
3137 call read_byte ; next char of symbol name
3138 call test_sym_char ; valid char?
3139 jr nz,rs_6
3140 ld (hl),a ;
3141 inc b ; symlen++
3142 ld a,b ;
3143 cp 10h+1 ;
3144 jr c,rs_5 ;
3145 error3:
3146 jp ERROR ;
3147
3148 rs_6:
3149 call test_symterm_ch
3150 jr nz,error3
3151
3152 push bc ; symlen
3153 ex de,hl ;
3154 ld hl,(BDOS+1) ;
3155 inc hl ;
3156 ld c,(hl) ;
3157 inc hl ;
3158 ld b,(hl) ;
3159 ex de,hl
3160 ld (hl),b ;
3161 dec hl ;
3162 ld (hl),c ;
3163 dec hl ;
3164 ld (hl),0c3h ;
3165
3166 ld de,(max_load) ;
3167 call cp_hl_de ;
3168 jr c,error3 ;
3169 ld de,(reg_sp) ;
3170 call cp_hl_de ;
3171 jr nc,rs_61 ;
3172 ld (reg_sp),hl ;
3173 rs_61:
3174 ld de,(BDOS+1) ;
3175 ld (BDOS+1),hl ;
3176 ex de,hl ;
3177 pop af ; symlen
3178 ld (hl),a ;
3179 inc hl ;
3180 pop de ; symval
3181 ld (hl),e ;
3182 inc hl ;
3183 ld (hl),d ;
3184 ld hl,symlen_max ;
3185 cp (hl) ; new max?
3186 jr c,$+3 ;
3187 ld (hl),a ;
3188 jp rs_1 ;
3189
3190
3191 ; test for valid character for symbols
3192 ; return z if valid
3193
3194 test_sym_char:
3195 cp '$'
3196 ret z
3197 cp '%'
3198 ret z
3199 cp '.'
3200 ret z
3201 cp '_'
3202 ret z
3203 call test_alphanum
3204 ret c ; cy == 1 --> z == 0
3205 cp a ; return z
3206 ret
3207
3208
3209 ; check if char is in [0..9,?,@,A..Z,a..z]
3210 ; return cy if invalid
3211 ; return nc if valid alfanumeric char
3212
3213 test_alphanum:
3214 cp 'z'+1
3215 ccf
3216 ret c
3217 cp 'a'
3218 ret nc
3219 cp 'Z'+1
3220 ccf
3221 ret c
3222 cp '?'
3223 ret nc
3224 test_numeral:
3225 cp '9'+1
3226 ccf
3227 ret c
3228 cp '0'
3229 ret
3230
3231 test_symterm_ch:
3232 cp CR
3233 ret z
3234 cp LF
3235 ret z
3236 test_whitespace:
3237 cp ' '
3238 ret z
3239 cp TAB
3240 ret
3241
3242 p_max_high0:
3243 call assert_eol
3244 p_max_high:
3245 call pstr_inl
3246 DC 'High = '
3247 ld hl,(high_load)
3248 call out_hl
3249 call pstr_inl
3250 DC ' Max = '
3251 ld hl,(max_load)
3252 call out_hl
3253 call pstr_inl
3254 DC ' Top = '
3255 ld hl,(BDOS+1)
3256 call out_hl
3257 jp crlf
3258
3259 cmd_W:
3260 call get_arg_range
3261 call assert_eol
3262 push hl
3263 ld a,c
3264 add a,07fh
3265 jr nc,l11adh
3266 inc b
3267 l11adh:
3268 and 080h
3269 ld c,a
3270 push bc
3271 ld a,(dfcb1+1)
3272 cp ' '
3273 jr z,error4
3274 ld de,dfcb1
3275 call setup_fcb
3276 push de
3277 ld c,BDOS_DELETE
3278 call ddtz_bdos
3279 pop de
3280 ld c,BDOS_CREATE
3281 call ddtz_bdos
3282 inc a
3283 jr z,error4
3284 pop bc
3285 pop hl
3286 l11cch:
3287 ld a,b
3288 or c
3289 jr z,close_file
3290 push bc
3291 ld de,080h ; DMA_BUF
3292 ld b,d
3293 ld c,e
3294 ldir
3295 call write_sector
3296 ex (sp),hl
3297 ld bc,0ff80h
3298 add hl,bc
3299 ex (sp),hl
3300 pop bc
3301 jr l11cch
3302
3303 write_sector:
3304 push hl
3305 ld de,dfcb1
3306 ld c,BDOS_WRITE
3307 call ddtz_bdos
3308 pop hl
3309 and a
3310 ret z
3311 call close_file
3312 error4:
3313 jp ERROR
3314
3315 close_file:
3316 ld de,dfcb1
3317 ld c,BDOS_CLOSE
3318 jp ddtz_bdos
3319
3320 cmd_A:
3321 ld hl,(last_A)
3322 call get_lastarg_def
3323 ld (last_A),hl
3324 ld (cmd_A_prev),hl
3325 ld hl,cmda_restart
3326 ld (error_func),hl
3327 ld (l1262h),sp
3328 cmda_loop:
3329 ld hl,(last_A)
3330 ld (var.$),hl
3331 push hl
3332 call p_disas_line
3333 ld de,(var.@)
3334 ld a,d
3335 or e
3336 ld c,19
3337 jr z,l122dh
3338 ld c,19+7
3339 l122dh:
3340 call p_fill_space
3341 ld c,b
3342 push bc
3343 call get_line
3344 pop bc
3345 pop hl
3346 call skipbl
3347 cp '.'
3348 ret z
3349 cp '-'
3350 jr nz,l124bh
3351 ld hl,(cmd_A_prev)
3352 jr cmda_lpend
3353 l124bh:
3354 push hl
3355 pop iy
3356 push hl
3357 and a
3358 call nz,asemble_line
3359 ld b,0
3360 pop hl
3361 ld (cmd_A_prev),hl
3362 add hl,bc
3363 cmda_lpend:
3364 ld (last_A),hl
3365 jr cmda_loop
3366
3367 cmda_restart:
3368 call l0146h
3369 ld sp,(l1262h)
3370 jr cmda_loop
3371
3372 asemble_line:
3373 call skipbl
3374 ld hl,t_MNEMONICS
3375 call sub_030ah
3376 jp nc,ERROR
3377 call skipbl
3378 push de
3379 ld a,b
3380 add a,b
3381 add a,b
3382 ld hl,b_1289_start
3383 call add_hl_a
3384 ld e,(hl)
3385 inc hl
3386 ld d,(hl)
3387 inc hl
3388 ld b,(hl)
3389 ex de,hl
3390 pop de
3391
3392 CALL_HL:
3393 jp (hl)
3394
3395 b_1289_start:
3396 dw as.ADC_SBC ;ADC
3397 db 088h ;
3398 dw as.ADD ;ADD
3399 db 080h ;
3400 dw as.AND_CP_OR_SUB_XOR ;AND
3401 db 0a0h ;
3402 dw as.BITOP ;BIT
3403 db 040h ;
3404 dw as.CALL ;CALL
3405 db 0c4h ;
3406 dw as.opc.noarg ;CCF
3407 db 03fh ;
3408 dw as.AND_CP_OR_SUB_XOR ;CP
3409 db 0b8h ;
3410 dw gen.opc.ED2 ;CPD
3411 db 0a9h ;
3412 dw gen.opc.ED2 ;CPDR
3413 db 0b9h ;
3414 dw gen.opc.ED2 ;CPI
3415 db 0a1h ;
3416 dw gen.opc.ED2 ;CPIR
3417 db 0b1h ;
3418 dw as.opc.noarg ;CPL
3419 db 02fh ;
3420 dw as.opc.noarg ;DAA
3421 db 027h ;
3422 dw as.DEC_INC ;DEC
3423 db 005h ;
3424 dw as.opc.noarg ;DI
3425 db 0f3h ;
3426 dw as.DJNZ ;DJNZ
3427 db 010h ;
3428 dw as.opc.noarg ;EI
3429 db 0fbh ;
3430 dw as.EX ;EX
3431 db 0e3h ;
3432 dw as.opc.noarg ;EXX
3433 db 0d9h ;
3434 dw as.opc.noarg ;HALT
3435 db 076h ;
3436 dw as.IM ;IM
3437 db 046h ;
3438 dw as.IN ;IN
3439 db 040h ;
3440 dw as.DEC_INC ;INC
3441 db 004h ;
3442 dw gen.opc.ED2 ;IND
3443 db 0aah ;
3444 dw gen.opc.ED2 ;INDR
3445 db 0bah ;
3446 dw gen.opc.ED2 ;INI
3447 db 0a2h ;
3448 dw gen.opc.ED2 ;INIR
3449 db 0b2h ;
3450 dw as.JP ;JP
3451 db 0c2h ;
3452 dw as.JR ;JR
3453 db 020h ;
3454 dw as.LD ;LD
3455 db 040h ;
3456 dw gen.opc.ED2 ;LDD
3457 db 0a8h ;
3458 dw gen.opc.ED2 ;LDDR
3459 db 0b8h ;
3460 dw gen.opc.ED2 ;LDI
3461 db 0a0h ;
3462 dw gen.opc.ED2 ;LDIR
3463 db 0b0h ;
3464 dw gen.opc.ED2 ;NEG
3465 db 044h ;
3466 dw as.opc.noarg ;NOP
3467 db 000h ;
3468 dw as.AND_CP_OR_SUB_XOR ;OR
3469 db 0b0h ;
3470 dw gen.opc.ED2 ;OTDR
3471 db 0bbh ;
3472 dw gen.opc.ED2 ;OTIR
3473 db 0b3h ;
3474 dw as.OUT ;OUT
3475 db 041h ;
3476 dw gen.opc.ED2 ;OUTD
3477 db 0abh ;
3478 dw gen.opc.ED2 ;OUTI
3479 db 0a3h ;
3480 dw as.POP_PUSH ;POP
3481 db 0c1h ;
3482 dw as.POP_PUSH ;PUSH
3483 db 0c5h ;
3484 dw as.BITOP ;RES
3485 db 080h ;
3486 dw as.RET ;RET
3487 db 0c0h ;
3488 dw gen.opc.ED2 ;RETI
3489 db 04dh ;
3490 dw gen.opc.ED2 ;RETN
3491 db 045h ;
3492 dw as.SHIFTOP ;RL
3493 db 010h ;
3494 dw as.opc.noarg ;RLA
3495 db 017h ;
3496 dw as.SHIFTOP ;RLC
3497 db 000h ;
3498 dw as.opc.noarg ;RLCA
3499 db 007h ;
3500 dw gen.opc.ED2 ;RLD
3501 db 06fh ;
3502 dw as.SHIFTOP ;RR
3503 db 018h ;
3504 dw as.opc.noarg ;RRA
3505 db 01fh ;
3506 dw as.SHIFTOP ;RRC
3507 db 008h ;
3508 dw as.opc.noarg ;RRCA
3509 db 00fh ;
3510 dw gen.opc.ED2 ;RRD
3511 db 067h ;
3512 dw as.RST ;RST
3513 db 0c7h ;
3514 dw as.ADC_SBC ;SBC
3515 db 098h ;
3516 dw as.opc.noarg ;SCF
3517 db 037h ;
3518 dw as.BITOP ;SET
3519 db 0c0h ;
3520 dw as.SHIFTOP ;SLA
3521 db 020h ;
3522 dw as.SHIFTOP ;SRA
3523 db 028h ;
3524 dw as.SHIFTOP ;SRL
3525 db 038h ;
3526 dw as.AND_CP_OR_SUB_XOR ;SUB
3527 db 090h ;
3528 dw as.AND_CP_OR_SUB_XOR ;XOR
3529 db 0a8h ;
3530
3531 dw as.IN0 ;IN0
3532 db 000h ;
3533 dw as.MLT ;MLT
3534 db 04ch ;
3535 dw gen.opc.ED2 ;OTDM
3536 db 08bh ;
3537 dw gen.opc.ED2 ;OTDMR
3538 db 09bh ;
3539 dw gen.opc.ED2 ;OTIM
3540 db 083h ;
3541 dw gen.opc.ED2 ;OTIMR
3542 db 093h ;
3543 dw as.OUTO ;OUT0
3544 db 001h ;
3545 dw gen.opc.ED2 ;SLP
3546 db 076h ;
3547 dw as.TST ;TST
3548 db 004h ;
3549 dw as.TSTIO ;TSTIO
3550 db 074h ;
3551
3552 as.TST:
3553 call arg.r_HL_A ;
3554 jr nc,as.tst_0
3555 rlca
3556 rlca
3557 rlca
3558 add a,b
3559 ld b,a
3560 jp gen.opc.ED2
3561 as.tst_0:
3562 ld b,064h
3563 as.TSTIO:
3564 call arg.imm_8bit ;
3565 jr as.store_io0
3566
3567 as.IN0:
3568 call arg.r_HL_A ;
3569 jr nc,error5
3570 cp 006h
3571 jr z,error5
3572 rlca
3573 rlca
3574 rlca
3575 add a,b
3576 ld b,a
3577 call assert_comma ;
3578 call arg.addr_8bit ;
3579 jr as.store_io0
3580
3581 as.OUTO:
3582 call arg.addr_8bit ;
3583 call assert_comma ;
3584 call arg.r_HL_A ;
3585 jr nc,error5
3586 cp 006h
3587 jr z,error5
3588 rlca
3589 rlca
3590 rlca
3591 add a,b
3592 ld b,a
3593
3594 as.store_io0:
3595 call assert_eol
3596 ld (iy+000h),0edh
3597 ld (iy+001h),b
3598 ld (iy+002h),l
3599 ld c,003h
3600 ret
3601
3602 as.MLT:
3603 call arg.ww ;
3604 jr nc,error5
3605 add a,b
3606 ld b,a
3607 jp gen.opc.ED2
3608
3609 error5:
3610 jp ERROR
3611
3612 as.LD:
3613 call arg.r_HL_A
3614 jr c,l13d4h
3615 call arg.IDX_displcmnt
3616 jp c,l1471h
3617 call arg.ww
3618 jp c,l149ch
3619 call arg.IX_IY
3620 jp c,l14f5h
3621 ld a,(de)
3622 cp 'I'
3623 jp z,l1511h
3624 cp 'R'
3625 jp z,l1519h
3626 cp '('
3627 jp nz,ERROR
3628 inc de
3629 call arg.ww
3630 jp c,l1528h
3631 call test_expr
3632 call test_paren_close
3633 call assert_comma
3634 call arg.ww
3635 jr c,l13c2h
3636 call arg.IX_IY
3637 jr nc,l13aah
3638 ld b,022h
3639 l1395h:
3640 call assert_eol
3641 ld a,(prefix_ixiy)
3642 l139bh:
3643 ld (iy+000h),a
3644 ld (iy+001h),b
3645 ld (iy+002h),l
3646 ld (iy+003h),h
3647 ld c,004h
3648 ret
3649 l13aah:
3650 ld a,(de)
3651 cp 'A'
3652 jp nz,ERROR
3653 inc de
3654 ld b,032h
3655 as.store_3:
3656 call assert_eol
3657 ld (iy+000h),b
3658 ld (iy+001h),l
3659 ld (iy+002h),h
3660 ld c,003h
3661 ret
3662 l13c2h:
3663 cp 020h
3664 jr z,l13d0h
3665 add a,043h
3666 ld b,a
3667 l13c9h:
3668 call assert_eol
3669 ld a,0edh
3670 jr l139bh
3671 l13d0h:
3672 ld b,022h
3673 jr as.store_3
3674 l13d4h:
3675 ld b,a
3676 call assert_comma
3677 call arg.r_HL_A
3678 jr nc,l13f0h
3679 push af
3680 ld a,b
3681 rlca
3682 rlca
3683 rlca
3684 ld b,a
3685 pop af
3686 add a,b
3687 add a,040h
3688 cp 076h
3689 jp z,ERROR
3690 l13ech:
3691 ld b,a
3692 jp as.opc.noarg
3693 l13f0h:
3694 call arg.IDX_displcmnt
3695 jr nc,l1413h
3696 ld a,b
3697 rlca
3698 rlca
3699 rlca
3700 add a,046h
3701 cp 076h
3702 jp z,ERROR
3703
3704 l1400h:
3705 ld b,a
3706 call assert_eol
3707 ld (iy+001h),b
3708 ld (iy+002h),c
3709 ld a,(prefix_ixiy)
3710 ld (iy+000h),a
3711 ld c,003h
3712 ret
3713 l1413h:
3714 ld a,(de)
3715 cp 'I'
3716 jr z,l1426h
3717 cp 'R'
3718 jr nz,l1432h
3719 ld a,b
3720 cp 007h
3721 jp nz,ERROR
3722 ld b,05fh
3723 jr l142eh
3724 l1426h:
3725 ld a,b
3726 cp 007h
3727 jp nz,ERROR
3728 ld b,057h
3729 l142eh:
3730 inc de
3731 jp gen.opc.ED2
3732 l1432h:
3733 cp '('
3734 jr z,l144ch
3735 call arg.imm_8bit
3736 ld a,b
3737 rlca
3738 rlca
3739 rlca
3740 add a,006h
3741 l143fh:
3742 ld b,a
3743 as.store_2:
3744 call assert_eol
3745 ld (iy+000h),b
3746 ld (iy+001h),l
3747 ld c,002h
3748 ret
3749 l144ch:
3750 inc de
3751 ld a,b
3752 cp 007h
3753 jp nz,ERROR
3754 call arg.ww
3755 jr nc,l1466h
3756 cp 030h
3757 jp nc,ERROR
3758 add a,00ah
3759 ld b,a
3760 call test_paren_close
3761 jp as.opc.noarg
3762 l1466h:
3763 call test_expr
3764 call test_paren_close
3765 ld b,03ah
3766 jp as.store_3
3767
3768 l1471h:
3769 call assert_comma
3770 call arg.r_HL_A
3771 jr nc,l1483h
3772 cp 006h
3773 jp z,ERROR
3774 add a,070h
3775 jp l1400h
3776
3777 l1483h:
3778 call arg.imm_8bit
3779 call assert_eol
3780 ld a,(prefix_ixiy)
3781 ld (iy+000h),a
3782 ld (iy+001h),036h
3783 ld (iy+002h),c
3784 ld (iy+003h),l
3785 ld c,004h
3786 ret
3787 l149ch:
3788 ld b,a
3789 call assert_comma
3790 ld hl,t_HL.AF
3791 call sub_0318h
3792 jr c,l14c3h
3793 call arg.IX_IY
3794 jr nc,l14cch
3795 ld a,b
3796 cp 030h
3797 jr nz,error6
3798 ld b,0f9h
3799 l14b4h:
3800 call assert_eol
3801 ld a,(prefix_ixiy)
3802 ld (iy+000h),a
3803 ld (iy+001h),b
3804 ld c,002h
3805 ret
3806 l14c3h:
3807 ld a,b
3808 cp 030h
3809 jr nz,error6
3810 ld b,0f9h
3811 jr as.opc.noarg ;14ca
3812 l14cch:
3813 ld a,(de)
3814 cp '('
3815 jr nz,l14e8h
3816 inc de
3817 call test_expr
3818 call test_paren_close
3819 ld a,b
3820 cp 020h
3821 jr z,l14e3h
3822 add a,04bh
3823 ld b,a
3824 jp l13c9h
3825 l14e3h:
3826 ld b,02ah
3827 jp as.store_3
3828 l14e8h:
3829 call test_expr
3830 call assert_eol
3831 ld a,001h
3832 add a,b
3833 ld b,a
3834 jp as.store_3
3835 l14f5h:
3836 call assert_comma
3837 ld a,(de)
3838 cp '('
3839 jr nz,l1509h
3840 inc de
3841 call test_expr
3842 call test_paren_close
3843 ld b,02ah
3844 jp l1395h
3845 l1509h:
3846 call test_expr
3847 ld b,021h
3848 jp l1395h
3849 l1511h:
3850 inc de
3851 call assert_comma
3852 ld b,047h
3853 jr l151fh
3854 l1519h:
3855 inc de
3856 call assert_comma
3857 ld b,04fh
3858 l151fh:
3859 ld a,(de)
3860 inc de
3861 cp 'A'
3862 jr z,gen.opc.ED2
3863 error6:
3864 jp ERROR
3865
3866 l1528h:
3867 cp 020h
3868 jr nc,error6
3869 add a,002h
3870 ld b,a
3871 call test_paren_close
3872 call assert_comma
3873 ld a,(de)
3874 cp 'A'
3875 jr nz,error6
3876 inc de
3877 as.opc.noarg:
3878 call assert_eol
3879 ld (iy+000h),b
3880 ld c,001h
3881 ret
3882
3883 gen.opc.ED2:
3884 call assert_eol
3885 ld (iy+000h),0edh
3886 ld (iy+001h),b
3887 ld c,002h
3888 ret
3889
3890 as.ADC_SBC:
3891 ld hl,t_HL.AF
3892 call sub_0318h
3893 jr nc,as.AND_CP_OR_SUB_XOR
3894 call assert_comma
3895 call arg.ww
3896 jp nc,ERROR
3897 push af
3898 ld a,b
3899 cp 088h
3900 ld b,04ah
3901 jr z,l156ch
3902 ld b,042h
3903 l156ch:
3904 pop af
3905 add a,b
3906 l156eh:
3907 ld b,a
3908 jr gen.opc.ED2
3909 as.ADD:
3910 ld hl,t_HL.AF
3911 call sub_0318h
3912 jr c,l159ah
3913 call arg.IX_IY
3914 jr nc,as.AND_CP_OR_SUB_XOR
3915 call assert_comma
3916 ld hl,t_BC.DE.IX.SP
3917 ld a,(prefix_ixiy)
3918 cp 0fdh
3919 jr nz,l158eh
3920 ld hl,t_BC.DE.IY.SP
3921 l158eh:
3922 call arg.reg_16bit
3923 jp nc,ERROR
3924 add a,009h
3925 l1596h:
3926 ld b,a
3927 jp l14b4h
3928 l159ah:
3929 call assert_comma
3930 call arg.ww
3931 jp nc,ERROR
3932 add a,009h
3933 jp l13ech
3934 as.AND_CP_OR_SUB_XOR:
3935 ld a,(de)
3936 cp 'A'
3937 jr nz,l15b8h
3938 push de
3939 inc de
3940 call next_arg
3941 jr z,l15b7h
3942 pop de
3943 jr l15b8h
3944 l15b7h:
3945 pop af
3946 l15b8h:
3947 call arg.r_HL_A
3948 jr c,l15cbh
3949 call arg.IDX_displcmnt
3950 jr c,l15cfh
3951 call arg.imm_8bit
3952 ld a,b
3953 add a,046h
3954 jp l143fh
3955 l15cbh:
3956 add a,b
3957 jp l13ech
3958 l15cfh:
3959 ld a,b
3960 add a,006h
3961 jp l1400h
3962
3963 as.SHIFTOP:
3964 call arg.r_HL_A
3965 jr c,l15fah
3966 call arg.IDX_displcmnt
3967 jp nc,ERROR
3968 ld a,b
3969 add a,006h
3970 ld b,a
3971 l15e4h:
3972 call assert_eol
3973 ld a,(prefix_ixiy)
3974 ld (iy+000h),a
3975 ld (iy+001h),0cbh
3976 ld (iy+002h),c
3977 ld (iy+003h),b
3978 ld c,004h
3979 ret
3980
3981 l15fah:
3982 add a,b
3983 l15fbh:
3984 ld b,a
3985 call assert_eol
3986 ld (iy+001h),b
3987 ld (iy+000h),0cbh
3988 ld c,002h
3989 ret
3990
3991 as.BITOP:
3992 call arg.bit
3993 call assert_comma
3994 call arg.r_HL_A
3995 jr c,l1624h
3996 call arg.IDX_displcmnt
3997 jp nc,ERROR
3998 ld a,l
3999 rlca
4000 rlca
4001 rlca
4002 add a,006h
4003 add a,b
4004 ld b,a
4005 jr l15e4h
4006 l1624h:
4007 add a,b
4008 ld b,a
4009 ld a,l
4010 rlca
4011 rlca
4012 rlca
4013 add a,b
4014 jr l15fbh
4015
4016 as.CALL:
4017 push de
4018 call arg.cc_ZCPS
4019 jr nc,l163ch
4020 add a,b
4021 ld b,a
4022 call next_arg
4023 jr z,l163eh
4024 pop de
4025 push de
4026 l163ch:
4027 ld b,0cdh
4028 l163eh:
4029 pop af
4030 call test_expr
4031 jp as.store_3
4032
4033 as.RET:
4034 call arg.cc_ZCPS
4035 jr nc,l164eh
4036 add a,b
4037 ld b,a
4038 jr l1650h
4039 l164eh:
4040 ld b,0c9h
4041 l1650h:
4042 jp as.opc.noarg
4043
4044 as.JP:
4045 push de
4046 call arg.cc_ZCPS
4047 jr c,l1666h
4048 l1659h:
4049 pop de
4050 ld hl,l168ch
4051 call sub_030ah
4052 jr c,l1674h
4053 ld b,0c3h
4054 jr l166eh
4055
4056 l1666h:
4057 add a,b
4058 ld b,a
4059 call next_arg
4060 jr nz,l1659h
4061 pop af
4062 l166eh:
4063 call test_expr
4064 jp as.store_3
4065 l1674h:
4066 call assert_eol
4067 ld a,b
4068 and a
4069 jr nz,l1680h
4070 ld b,0e9h
4071 jp as.opc.noarg
4072 l1680h:
4073 ld b,0ddh
4074 dec a
4075 jr z,l1687h
4076 ld b,0fdh
4077 l1687h:
4078 ld l,0e9h
4079 jp as.store_2
4080
4081 l168ch:
4082 DC '(HL)'
4083 DC '(IX)'
4084 DC '(IY)'
4085 DB 0
4086
4087 as.DJNZ:
4088 call next_arg
4089 ld b,010h
4090 jr l16aeh
4091 as.JR:
4092 call arg.cc_ZC
4093 jr c,l16a9h
4094 ld b,018h
4095 jr l16aeh
4096 l16a9h:
4097 add a,b
4098 ld b,a
4099 call assert_comma
4100 l16aeh:
4101 call arg.j_displ
4102 jp as.store_2
4103
4104 as.IM:
4105 call arg.imm_8bit
4106 ld a,l
4107 cp 003h
4108 jr nc,error7
4109 and a
4110 jr z,l16c7h
4111 ld b,056h
4112 cp 001h
4113 jr z,l16c7h
4114 ld b,05eh
4115 l16c7h:
4116 jp gen.opc.ED2
4117
4118 as.RST:
4119 call arg.imm_8bit
4120 ld a,l
4121 push af
4122 add a,b
4123 ld b,a
4124 pop af
4125 and 0c7h
4126 jr nz,error7
4127 jp as.opc.noarg
4128
4129 as.POP_PUSH:
4130 call arg.IX_IY
4131 jr c,l16e7h
4132 call arg.zz
4133 jr nc,error7
4134 add a,b
4135 jp l13ech
4136 l16e7h:
4137 ld a,b
4138 add a,020h
4139 jp l1596h
4140
4141 as.IN:
4142 call arg.r_HL_A
4143 jr nc,error7
4144 cp 006h
4145 jr z,error7
4146 rlca
4147 rlca
4148 rlca
4149 add a,b
4150 ld b,a
4151 cp 078h
4152 jr nz,l170fh
4153 call assert_comma
4154 call sub_171bh
4155 jr c,l1715h
4156 call arg.addr_8bit
4157 ld b,0dbh
4158 jp as.store_2
4159 l170fh:
4160 call assert_comma
4161 call sub_171bh
4162 l1715h:
4163 jp c,gen.opc.ED2
4164 error7:
4165 jp ERROR
4166
4167 sub_171bh:
4168 ld hl,t__C_
4169 jp sub_0318h
4170
4171 as.OUT:
4172 call sub_171bh
4173 jr nc,l1739h
4174 call assert_comma
4175 call arg.r_HL_A
4176 jr nc,error7
4177 cp 006h
4178 jr z,error7
4179 rlca
4180 rlca
4181 rlca
4182 add a,b
4183 jp l156eh
4184
4185 l1739h:
4186 call arg.addr_8bit
4187 call assert_comma
4188 cp 'A'
4189 jr nz,error7
4190 inc de
4191 ld b,0d3h
4192 jp as.store_2
4193
4194 as.EX:
4195 ld hl,b_176d_start
4196 call sub_030ah
4197 jp nc,ERROR
4198 ld c,b
4199 call assert_eol
4200 ld b,000h
4201 ld hl,l178eh
4202 add hl,bc
4203 add hl,bc
4204 ld a,(hl)
4205 ld (iy+000h),a
4206 ld c,001h
4207 inc hl
4208 ld a,(hl)
4209 and a
4210 ret z
4211 ld (iy+001h),a
4212 ld c,002h
4213 ret
4214
4215 b_176d_start:
4216 DC 'AF,AF'''
4217 l1773h:
4218 DC 'DE,HL'
4219 DC '(SP),HL'
4220 DC '(SP),IX'
4221 DC '(SP),IY'
4222 db 0
4223 l178eh:
4224 db 008h,000h
4225 db 0ebh,000h
4226 db 0e3h,000h
4227 db 0ddh,0e3h
4228 db 0fdh,0e3h
4229
4230 as.DEC_INC:
4231 call arg.IX_IY
4232 jr c,l17b3h
4233 call arg.ww
4234 jr c,l17bfh
4235 call arg.r_HL_A
4236 jr c,l17cch
4237 call arg.IDX_displcmnt
4238 jp nc,ERROR
4239 ld a,b
4240 add a,030h
4241 jp l1400h
4242 l17b3h:
4243 ld a,b
4244 ld b,023h
4245 cp 004h
4246 jr z,l17bch
4247 ld b,02bh
4248 l17bch:
4249 jp l14b4h
4250 l17bfh:
4251 push af
4252 ld a,b
4253 ld b,003h
4254 cp 004h
4255 jr z,l17c9h
4256 ld b,00bh
4257 l17c9h:
4258 pop af
4259 jr l17cfh
4260 l17cch:
4261 rlca
4262 rlca
4263 rlca
4264 l17cfh:
4265 add a,b
4266 jp l13ech
4267
4268 arg.bit:
4269 call arg.imm_8bit
4270 ld a,l
4271 cp 008h
4272 jr nc,error8
4273 ret
4274
4275 arg.j_displ:
4276 call test_expr
4277 push bc
4278 push iy
4279 pop bc
4280 and a
4281 sbc hl,bc
4282 dec hl
4283 dec hl
4284 pop bc
4285 call sub_1802h
4286 ld a,h
4287 xor l
4288 bit 7,a
4289 jr nz,error8
4290 ret
4291
4292 arg.addr_8bit:
4293 ld a,(de)
4294 cp '('
4295 jr nz,arg.imm_8bit
4296 inc de
4297 call arg.imm_8bit
4298 jp test_paren_close
4299
4300 arg.imm_8bit:
4301 call test_expr
4302 sub_1802h:
4303 ld a,h
4304 and a
4305 ret z
4306 inc a
4307 ret z
4308 jr error8
4309
4310 test_expr:
4311 push bc
4312 call expr
4313 pop bc
4314 ret nc
4315 error8:
4316 jp ERROR
4317
4318 arg.zz:
4319 push hl
4320 ld hl,t_BC.DE.HL.AF
4321 jr l181fh
4322
4323 arg.reg_16bit:
4324 push hl
4325 jr l181fh
4326
4327 arg.ww:
4328 push hl
4329 ld hl,t_BC.DE.HL.SP
4330 l181fh:
4331 push bc
4332 call sub_030ah
4333 jr nc,l182bh
4334 ld a,b
4335 rlca
4336 rlca
4337 rlca
4338 rlca
4339 scf
4340 l182bh:
4341 pop bc
4342 pop hl
4343 ret
4344
4345 arg.r_HL_A:
4346 call skipbl
4347 push bc
4348 push hl
4349 ld hl,t_BCDEHL_HL_A
4350 call sub_030ah
4351 ld a,b
4352 pop hl
4353 pop bc
4354 ret
4355
4356 arg.IX_IY:
4357 push hl
4358 push bc
4359 ld hl,t_IX.IY
4360 call sub_030ah
4361 jr nc,l1852h
4362 ld a,0ddh
4363 dec b
4364 jr nz,l184eh
4365 ld a,0fdh
4366 l184eh:
4367 ld (prefix_ixiy),a
4368 scf
4369 l1852h:
4370 pop bc
4371 pop hl
4372 ret
4373
4374 arg.IDX_displcmnt:
4375 push hl
4376 push bc
4377 ld a,(de)
4378 cp '('
4379 jr nz,l18a1h
4380 push de
4381 inc de
4382 ld hl,t_IX.IY
4383 call sub_030ah
4384 jr nc,l18a0h
4385 pop af
4386 ld a,0ddh
4387 dec b
4388 jr nz,l186eh
4389 ld a,0fdh
4390 l186eh:
4391 ld (prefix_ixiy),a
4392 ld a,(de)
4393 cp '+'
4394 jr z,l1882h
4395 cp ')'
4396 ld hl,0
4397 jr z,l189ah
4398 cp '-'
4399 jp nz,ERROR
4400 l1882h:
4401 push af
4402 inc de
4403 call arg.imm_8bit
4404 pop af
4405 cp '+'
4406 jr z,l1894h
4407 ld b,h
4408 ld c,l
4409 ld hl,0
4410 and a
4411 sbc hl,bc
4412 l1894h:
4413 ld a,(de)
4414 cp ')'
4415 jp nz,ERROR
4416 l189ah:
4417 inc de
4418 pop bc
4419 ld c,l
4420 pop hl
4421 scf
4422 ret
4423 l18a0h:
4424 pop de
4425 l18a1h:
4426 pop bc
4427 pop hl
4428 and a
4429 ret
4430
4431 arg.cc_ZCPS:
4432 ld hl,t_tstfl_ZCPS
4433 ld c,007h
4434 jr l18b1h
4435
4436 arg.cc_ZC:
4437 ld hl,t_tstfl_ZC
4438 ld c,003h
4439 l18b1h:
4440 push bc
4441 call sub_030ah
4442 ld a,b
4443 pop bc
4444 ret nc
4445 and c
4446 rlca
4447 rlca
4448 rlca
4449 scf
4450 ret
4451
4452 assert_comma:
4453 call next_arg
4454 ret z
4455 l18c2h:
4456 jp ERROR
4457
4458 test_paren_close:
4459 ld a,(de)
4460 cp ')'
4461 jr nz,l18c2h
4462 inc de
4463 ret
4464
4465 cmd_L:
4466 ld hl,cmd_L
4467 ld (cmd_rpt),hl
4468 call expr
4469 jr nc,l18dbh
4470 ld hl,(last_L)
4471 l18dbh:
4472 call next_arg
4473 call get_range
4474 jr nc,l1905h
4475 call assert_eol
4476 ld b,16
4477 l18ebh:
4478 push bc
4479 call cmdl_p_line
4480 pop bc
4481 djnz l18ebh
4482 ret
4483
4484 l1905h:
4485 call assert_eol
4486 ld d,h
4487 ld e,l
4488 add hl,bc
4489 ex de,hl
4490 l190fh:
4491 push de
4492 call cmdl_p_line
4493 pop de
4494 call cp_hl_de
4495 jr c,l190fh
4496 ret
4497
4498 cmdl_p_line:
4499 push hl
4500 call p_disas_line
4501 call crlf
4502 pop hl
4503 ld c,b
4504 ld b,0
4505 add hl,bc
4506 ld (last_L),hl
4507 ret
4508
4509 p_disas_line:
4510 call p_label
4511 call outbl2
4512 call out.hl.@
4513 call z,outbl
4514 call outbl
4515 sub a
4516 ld (con_col),a
4517 push hl
4518 pop iy
4519 call p_disas_instr
4520 and a
4521 ret z
4522
4523 ld c,16
4524 call p_fill_space
4525 call p_offset
4526 ld a,80h
4527 jp p_sym_space
4528
4529 p_offset:
4530 ld de,(var.@)
4531 ld a,d
4532 or e
4533 ret z
4534 call pstr_inl
4535 dc '(@'
4536 and a
4537 sbc hl,de
4538 call out_hl
4539 add hl,de
4540 jp out_rparen
4541
4542 p_disas_instr:
4543 sub a
4544 ld (l1ffdh),a
4545 call disas_get_instrlen
4546 jr nc,l197fh
4547 push bc
4548 ld a,(con_col)
4549 add a,5
4550 ld c,a
4551 call pstr
4552 call p_fill_space
4553 ex de,hl
4554 call call_hl
4555 pop bc
4556 ld a,(l1ffdh)
4557 ld hl,(disas_arg_16)
4558 scf
4559 ret
4560
4561 l197fh:
4562 call pstr_inl
4563 DC '???'
4564 ld b,1
4565 sub a
4566 ret
4567
4568 disas_get_instrlen:
4569 sub a
4570 ld (isprefix_ixiy),a
4571 ld a,(iy+000h)
4572 cp 0edh
4573 jp z,disas_pfx.ED
4574 cp 0ddh
4575 jr z,l19abh
4576 cp 0fdh
4577 jr z,l19afh
4578 sub_19a0h:
4579 ld a,(iy+000h)
4580 cp 0cbh
4581 jp z,disas_pfx.CB
4582 jp disas_nopfx
4583 l19abh:
4584 ld a,1
4585 jr l19b1h
4586 l19afh:
4587 ld a,2
4588 l19b1h:
4589 ld (isprefix_ixiy),a
4590 call disas_pfx.DDFD
4591 ret nc
4592 push bc
4593 call sub_19a0h
4594 pop af
4595 add a,b
4596 ld b,a
4597 scf
4598 ret
4599
4600 disas_pfx.DDFD:
4601 inc iy
4602 ld hl,b_19ef_start
4603 call test_DDFD
4604 ld b,002h
4605 ret c
4606 ld hl,l1a0ah
4607 call test_DDFD
4608 ld b,001h
4609 ret c
4610 ld a,(iy+000h)
4611 cp 0cbh
4612 jr nz,l19edh
4613 ld a,(iy+002h)
4614 cp 036h
4615 ret z
4616 and 007h
4617 cp 006h
4618 jr nz,l19edh
4619 ld b,002h
4620 scf
4621 ret
4622 l19edh:
4623 and a
4624 ret
4625
4626 ; DD/FD 3 byte (ix+d)/(iy+d)
4627 b_19ef_start:
4628 db 034h
4629 db 035h
4630 db 036h
4631 db 046h
4632 db 04eh
4633 db 056h
4634 db 05eh
4635 db 066h
4636 db 06eh
4637 db 070h
4638 db 071h
4639 db 072h
4640 db 073h
4641 db 074h
4642 db 075h
4643 db 077h
4644 db 07eh
4645 db 086h
4646 db 08eh
4647 db 096h
4648 db 09eh
4649 db 0a6h
4650 db 0aeh
4651 db 0b6h
4652 db 0beh
4653 db 0
4654
4655 ; DD/FD 2 byte
4656 l1a0ah:
4657 db 009h
4658 db 019h
4659 db 021h
4660 db 022h
4661 db 023h
4662 db 029h
4663 db 02ah
4664 db 02bh
4665 db 039h
4666 db 0e1h
4667 db 0e3h
4668 db 0e5h
4669 db 0e9h
4670 db 0f9h
4671 db 0
4672
4673 disas_pfx.ED:
4674 inc iy
4675 ld hl,b_1bc9_start
4676 call sub_1a72h
4677 ld b,2
4678 ret c
4679 ld hl,b_1bf4_start
4680 call lookup_opc
4681 ld b,2
4682 ret c
4683
4684 ld hl,l228bh
4685 call lookup_opc
4686 ld b,3
4687 ret c
4688 ld hl,b_1c40_start
4689 call lookup_opc
4690 ld b,4
4691 ret
4692
4693 disas_pfx.CB:
4694 push iy
4695 inc iy
4696 ld a,(isprefix_ixiy)
4697 and a
4698 jr z,l1a42h
4699 inc iy
4700 l1a42h:
4701 ld hl,b_1c55_start
4702 call lookup_opc
4703 pop iy
4704 ld b,2
4705 ret
4706
4707 disas_nopfx:
4708 ld hl,b_1b54_start
4709 call lookup_opc
4710 ld b,2
4711 ret c
4712 ld hl,b_1ab6_start
4713 call sub_1a72h
4714 ld b,1
4715 ret c
4716 ld hl,b_1ad1_start
4717 call lookup_opc
4718 ld b,1
4719 ret c
4720 ld hl,b_1b9b_start
4721 call lookup_opc
4722 ret nc
4723 ld b,3
4724 ret
4725
4726 sub_1a72h:
4727 ld a,(hl)
4728 cp 0ffh
4729 ret z
4730 cp (iy+000h)
4731 jr z,l1a7fh
4732 inc hl
4733 inc hl
4734 jr sub_1a72h
4735 l1a7fh:
4736 ld de,l1c97h
4737 inc hl
4738 ld c,(hl)
4739 jr get_mnemonic
4740
4741
4742 test_DDFD:
4743 ld a,(hl)
4744 and a
4745 ret z
4746 inc hl
4747 cp (iy+000h)
4748 jr nz,test_DDFD
4749 scf
4750 ret
4751
4752 lookup_opc:
4753 ld a,(iy+000h)
4754 and (hl)
4755 inc hl
4756 cp (hl)
4757 jr z,l1aa8h
4758 inc hl
4759 inc hl
4760 inc hl
4761 inc hl
4762 ld a,(hl)
4763 and a
4764 jr nz,lookup_opc
4765 ret
4766
4767 l1aa8h:
4768 inc hl
4769 ld c,(hl)
4770 inc hl
4771 ld e,(hl)
4772 inc hl
4773 ld d,(hl)
4774 get_mnemonic:
4775 ld hl,t_MNEMONICS
4776 ld b,0
4777 add hl,bc
4778 scf
4779 ret
4780
4781 ; 1 byte opcodes (no parameters)
4782 ; Format: db opcode, t_MNEMONICS-index
4783 b_1ab6_start:
4784 db 076h,039h ;halt
4785 db 0d9h,036h ;exx
4786 db 0f3h,02ch ;di
4787 db 0fbh,032h ;ei
4788 db 000h,069h ;nop
4789 db 007h,09eh ;rlca
4790 db 00fh,0adh ;rrca
4791 db 017h,098h ;rla
4792 db 01fh,0a7h ;rra
4793 db 027h,026h ;daa
4794 db 02fh,023h ;cpl
4795 db 037h,0bah ;scf
4796 db 03fh,010h ;ccf
4797 db 0ffh
4798
4799
4800 ; 1 byte opcodes
4801 ; Format: db mask, match, t_MNEMONICS-index
4802 ; dw argument formating fuction
4803 b_1ad1_start:
4804 db 0c0h,040h,056h ;ld r,r
4805 dw p_arg_r_r
4806 db 0f8h,080h,003h ;add a,r
4807 dw p_arg_a_r
4808 db 0f8h,088h,000h ;adc a,r
4809 dw p_arg_a_r
4810 db 0f8h,090h,0c9h ;sub r
4811 dw p_arg_rs
4812 db 0f8h,098h,0b7h ;sbc a,r
4813 dw p_arg_a_r
4814 db 0f8h,0a0h,006h ;and r
4815 dw p_arg_rs
4816 db 0f8h,0a8h,0cch ;xor r
4817 dw p_arg_rs
4818 db 0f8h,0b0h,06ch ;or r
4819 dw p_arg_rs
4820 db 0f8h,0b8h,013h ;cp r
4821 dw p_arg_rs
4822 db 0c7h,0c0h,08bh ;ret cc
4823 dw p_arg_cc
4824 db 0c7h,0c7h,0b4h ;rst
4825 dw l1c98h
4826 db 0ffh,0c9h,08bh ;ret
4827 dw l1c97h
4828 db 0cfh,0c1h,081h ;pop rr
4829 dw p_arg_zz
4830 db 0cfh,0c5h,084h ;push rr
4831 dw p_arg_zz
4832 db 0ffh,0e3h,034h ;ex (sp),hl
4833 dw l1ca0h
4834 db 0ffh,0e9h,052h ;jp (hl)
4835 dw l1caeh
4836 db 0ffh,0ebh,034h ;ex de,hl
4837 dw p_arg_ex_dehl
4838 db 0ffh,0f9h,056h ;ld sp,hl
4839 dw l1cc1h
4840 db 0cfh,003h,041h ;inc rr
4841 dw p_arg_ww
4842 db 0cfh,00bh,029h ;dec rr
4843 dw p_arg_ww
4844 db 0c7h,004h,041h ;inc r
4845 dw p_arg_r
4846 db 0c7h,005h,029h ;dec r
4847 dw p_arg_r
4848 db 0ffh,008h,034h ;ex af,af'
4849 dw p_arg_ex_afaf
4850 db 0cfh,009h,003h ;add hl,rr
4851 dw l1cd3h
4852 db 0efh,002h,056h ;ld (rr),a ;rr=bc,de
4853 dw l1cdch
4854 db 0efh,00ah,056h ;ld a,(rr) ;rr=bc,de
4855 dw l1ce5h
4856 db 0
4857
4858 ; 2 byte opdodes
4859 b_1b54_start:
4860 db 0c7h,006h,056h ;ld r,nn
4861 dw l1cfah
4862 db 0ffh,0c6h,003h ;add a,nn
4863 dw l1cf5h
4864 db 0ffh,0ceh,000h ;adc a,nn
4865 dw l1cf5h
4866 db 0ffh,0d6h,0c9h ;sub a,nn
4867 dw l1d09h
4868 db 0ffh,0deh,0b7h ;sbc a,nn
4869 dw l1cf5h
4870 db 0ffh,0e6h,006h ;and a,nn
4871 dw l1d09h
4872 db 0ffh,0eeh,0cch ;xor nn
4873 dw l1d09h
4874 db 0ffh,0f6h,06ch ;or nn
4875 dw l1d09h
4876 db 0ffh,0feh,013h ;cp a,nn
4877 dw l1d09h
4878 db 0ffh,010h,02eh ;djnz
4879 dw l1d1ah
4880 db 0ffh,018h,054h ;jr
4881 dw l1d1ah
4882 db 0e7h,020h,054h ;jr,cc
4883 dw l1d0fh
4884 db 0ffh,0d3h,076h ;out (nn),a
4885 dw l1d37h
4886 db 0ffh,0dbh,03fh ;in a,(nn)
4887 dw l1d29h
4888 db 0
4889
4890 ; 3 byte opcodes
4891 b_1b9b_start:
4892 db 0c7h,0c2h,052h ;jp cc,mn
4893 dw p_arg_cc_mn
4894 db 0c7h,0c4h,00ch ;call cc,mn
4895 dw p_arg_cc_mn
4896 db 0cfh,001h,056h ;ld ww,mn
4897 dw p_arg_ww_mn
4898 db 0ffh,0c3h,052h ;jp mn
4899 dw p_arg_mn
4900 db 0ffh,0cdh,00ch ;call mn
4901 dw p_arg_mn
4902 db 0ffh,022h,056h ;ld (mn),hl
4903 dw p_arg_addr_hl
4904 db 0ffh,02ah,056h ;ld hl,(mn)
4905 dw p_arg_hl_addr
4906 db 0ffh,032h,056h ;ld (mn),a
4907 dw p_arg_addr_a
4908 db 0ffh,03ah,056h ;ld a,(mn)
4909 dw p_arg_a_addr
4910 db 0
4911
4912 ; Prefix ED + 1 byte opcode, no arguments
4913 ; Format: opcode, t_MNEMONICS index
4914 b_1bc9_start:
4915 db 044h,066h ;neg
4916 db 045h,092h ;retn
4917 db 04dh,08eh ;reti
4918 db 067h,0b1h ;rrd
4919 db 06fh,0a2h ;rld
4920 db 0a0h,05fh ;ldi
4921 db 0a1h,01ch ;cpi
4922 db 0a2h,04bh ;ini
4923 db 0a3h,07dh ;outi
4924 db 0a8h,058h ;ldd
4925 db 0a9h,015h ;cpd
4926 db 0aah,044h ;ind
4927 db 0abh,079h ;outd
4928 db 0b0h,062h ;ldir
4929 db 0b1h,01fh ;cpir
4930 db 0b2h,04eh ;inir
4931 db 0b3h,072h ;otir
4932 db 0b8h,05bh ;lddr
4933 db 0b9h,018h ;cpdr
4934 db 0bah,047h ;indr
4935 db 0bbh,06eh ;otdr
4936 db 08bh,0d5h ;otdm
4937 db 09bh,0d9h ;otdmr
4938 db 083h,0deh ;otim
4939 db 093h,0e2h ;otimr
4940 db 076h,0ebh ;slp
4941 db 0ffh ;<end mark>
4942
4943 b_1bf4_start:
4944 db 0e7h,040h,03fh ;in r,(c) ;r=b,c,d,e
4945 dw p_arg_in_c ;
4946 db 0f7h,060h,03fh ;in r,(c) ;r=h,l
4947 dw p_arg_in_c ;
4948 db 0ffh,078h,03fh ;in r,(c) ;r=a
4949 dw p_arg_in_c ;
4950 db 0e7h,041h,076h ;out (c),r ;r=b,c,d,e
4951 dw p_arg_out_c ;
4952 db 0f7h,061h,076h ;out (c),r ;r=h,l
4953 dw p_arg_out_c ;
4954 db 0ffh,079h,076h ;out (c),r ;r=a
4955 dw p_arg_out_c ;
4956 db 0cfh,042h,0b7h ;sbc hl,rr
4957 dw l1dcah ;
4958 db 0cfh,04ah,000h ;adc hl,rr
4959 dw l1dcah ;
4960 db 0ffh,046h,03dh ;im 0
4961 dw l1d85h ;
4962 db 0ffh,056h,03dh ;im 1
4963 dw l1d89h ;
4964 db 0ffh,05eh,03dh ;im 2
4965 dw l1d8dh ;
4966 db 0ffh,047h,056h ;ld i,a
4967 dw l1d92h ;
4968 db 0ffh,057h,056h ;ld a,i
4969 dw l1d97h ;
4970 db 0ffh,04fh,056h ;ld r,a
4971 dw l1d9ch ;
4972 db 0ffh,05fh,056h ;ld a,r
4973 dw l1da1h
4974 db 0cfh,04ch,0d2h ;mlt rr
4975 dw p_arg_ww
4976 db 0c7h,004h,0eeh ;tst r
4977 dw p_arg_r
4978 db 0
4979
4980 l228bh:
4981 db 0e7h,000h,0cfh ;in0 r,(m) ;r=b,c,d,e
4982 dw p_arg_r_m
4983 db 0f7h,020h,0cfh ;in0 r,(m) ;r=h,l
4984 dw p_arg_r_m
4985 db 0ffh,038h,0cfh ;in0 a,(m)
4986 dw p_arg_r_m
4987 db 0e7h,001h,0e7h ;out0 (m),r ;r=b,c,d,e
4988 dw p_arg_m_r
4989 db 0f7h,021h,0e7h ;out0 (m),r ;r=h,l
4990 dw p_arg_m_r
4991 db 0ffh,039h,0e7h ;out0 (m),a
4992 dw p_arg_m_r
4993 db 0ffh,064h,0eeh ;tst m
4994 dw l1d09h
4995 db 0ffh,074h,0f1h ;tstio m
4996 dw l1d09h
4997 db 0
4998
4999 b_1c40_start:
5000 db 0efh,043h,056h ;ld (mn),ww ;ww=bc,de
5001 dw p_arg_addr_ww
5002 db 0ffh,073h,056h ;ld (mn),sp
5003 dw p_arg_addr_ww
5004 db 0efh,04bh,056h ;ld ww,(mn) ;ww=bc,de
5005 dw p_arg_ww_addr
5006 db 0ffh,07bh,056h ;ld sp,(mn)
5007 dw p_arg_ww_addr
5008 db 0
5009
5010 ; CB
5011 b_1c55_start:
5012 db 0f8h,000h,09bh ;rlc g
5013 dw l1e03h
5014 db 0f8h,008h,0aah ;rrc g
5015 dw l1e03h
5016 db 0f8h,010h,096h ;rl g
5017 dw l1e03h
5018 db 0f8h,018h,0a5h ;rr g
5019 dw l1e03h
5020 db 0f8h,020h,0c0h ;sla g
5021 dw l1e03h
5022 db 0f8h,028h,0c3h ;sra g
5023 dw l1e03h
5024 db 0f8h,038h,0c6h ;srl g
5025 dw l1e03h
5026 db 0c0h,040h,009h ;bit b,g
5027 dw p_arg_bitop
5028 db 0c0h,080h,088h ;res b,g
5029 dw p_arg_bitop
5030 db 0c0h,0c0h,0bdh ;set b,g
5031 dw p_arg_bitop
5032 db 0
5033
5034 p_arg_r_r:
5035 call p_arg_r
5036 call p_char_comma
5037 jp p_arg_rs
5038 p_arg_a_r:
5039 call p_A_comma
5040 jp p_arg_rs
5041 l1c97h:
5042 ret
5043
5044 p_arg_r_m:
5045 call p_arg_r
5046 call p_char_comma
5047 jp sub_1d2ch
5048
5049 p_arg_m_r:
5050 call sub_1d2ch
5051 call p_char_comma
5052 jp p_arg_r
5053
5054 l1c98h:
5055 ld a,(iy+000h)
5056 and 038h
5057 jp out_hex
5058
5059 l1ca0h:
5060 call pstr_inl
5061 DC '(SP),'
5062 jp p_arg_hlixiy
5063
5064 l1caeh:
5065 call p_char_lparen
5066 call p_arg_hlixiy
5067 jr out_rparen
5068
5069 p_arg_ex_dehl:
5070 ld hl,l1773h
5071 jp pstr
5072
5073 l1cc1h:
5074 call pstr_inl
5075 DC 'SP,'
5076 jp p_arg_hlixiy
5077
5078 p_arg_ex_afaf:
5079 ld hl,b_176d_start
5080 jp pstr
5081
5082 l1cd3h:
5083 call p_arg_hlixiy
5084 call p_char_comma
5085 jp p_arg_ww
5086 l1cdch:
5087 call sub_1ce8h
5088 call p_char_comma
5089 jp p_char_A
5090
5091 l1ce5h:
5092 call p_A_comma
5093 sub_1ce8h:
5094 call p_char_lparen
5095 call p_arg_ww
5096 out_rparen:
5097 jp p_char_rparen
5098
5099 l1cf5h:
5100 call p_A_comma
5101 jr l1d09h
5102 l1cfah:
5103 call p_arg_r
5104 call p_char_comma
5105 ld a,(isprefix_ixiy)
5106 and a
5107 ld a,(iy+002h)
5108 jr nz,l1d0ch
5109 l1d09h:
5110 ld a,(iy+001h)
5111 l1d0ch:
5112 jp out_hex
5113
5114 l1d0fh:
5115 ld a,(iy+000h)
5116 and 018h
5117 call p_arg_cc0
5118 call p_char_comma
5119 l1d1ah:
5120 ld c,(iy+001h)
5121 ld a,c
5122 rla
5123 sbc a,a
5124 ld b,a
5125 push iy
5126 pop hl
5127 add hl,bc
5128 inc hl
5129 inc hl
5130 jr l1d4eh
5131 l1d29h:
5132 call p_A_comma
5133 sub_1d2ch:
5134 call p_char_lparen
5135 ld a,(iy+001h)
5136 jp l1e6bh
5137 l1d37h:
5138 call sub_1d2ch
5139 jr p_char_comma_A
5140
5141 p_arg_cc_mn:
5142 call p_arg_cc
5143 call p_char_comma
5144 p_arg_mn:
5145 ld l,(iy+001h)
5146 ld h,(iy+002h)
5147 l1d4eh:
5148 ld a,002h
5149 sub_1d50h:
5150 ld (l1ffdh),a
5151 ld (disas_arg_16),hl
5152 jp out_hl
5153
5154 p_arg_ww_mn:
5155 call p_arg_ww
5156 call p_char_comma
5157 jr p_arg_mn
5158
5159 p_arg_addr_hl:
5160 call sub_1e13h
5161 call p_char_comma
5162 jp p_arg_hlixiy
5163
5164 p_arg_hl_addr:
5165 call p_arg_hlixiy
5166 call p_char_comma
5167 jp sub_1e13h
5168
5169 p_arg_addr_a:
5170 call sub_1e13h
5171 p_char_comma_A:
5172 call p_char_comma
5173 p_char_A:
5174 ld a,'A'
5175 jr outchar1
5176 p_arg_a_addr:
5177 call p_A_comma
5178 jp sub_1e13h
5179 l1d85h:
5180 ld a,'0'
5181 jr outchar1
5182 l1d89h:
5183 ld a,'1'
5184 jr outchar1
5185 l1d8dh:
5186 ld a,'2'
5187 jr outchar1
5188
5189 p_A_comma:
5190 call p_char_A
5191 p_char_comma:
5192 ld a,','
5193 outchar1:
5194 jp outchar
5195
5196 l1d92h:
5197 ld hl,b_1da7_start
5198 jr l1da4h
5199 l1d97h:
5200 ld hl,l1daah
5201 jr l1da4h
5202 l1d9ch:
5203 ld hl,l1dadh
5204 jr l1da4h
5205 l1da1h:
5206 ld hl,l1db0h
5207 l1da4h:
5208 jp pstr
5209
5210 b_1da7_start:
5211 DC 'I,A'
5212 l1daah:
5213 DC 'A,I'
5214 l1dadh:
5215 DC 'R,A'
5216 l1db0h:
5217 DC 'A,R'
5218
5219 p_arg_in_c:
5220 call p_arg_r
5221 call p_char_comma
5222 ld hl,t__C_
5223 jp pstr
5224
5225 p_arg_out_c:
5226 ld hl,t__C_
5227 call pstr
5228 call p_char_comma
5229 jr p_arg_r
5230
5231 l1dcah:
5232 call p_arg_hlixiy
5233 call p_char_comma
5234 jp p_arg_ww
5235
5236 p_arg_addr_ww:
5237 call sub_1e13h
5238 call p_char_comma
5239 jp p_arg_ww
5240
5241 p_arg_ww_addr:
5242 call p_arg_ww
5243 call p_char_comma
5244 jr sub_1e13h
5245
5246 p_arg_bitop:
5247 ld a,(isprefix_ixiy)
5248 and a
5249 jr nz,l1defh
5250 ld a,(iy+001h)
5251 jr l1df2h
5252 l1defh:
5253 ld a,(iy+002h)
5254 l1df2h:
5255 push af
5256 rra
5257 rra
5258 rra
5259 and 007h
5260 add a,'0'
5261 call outchar
5262 call p_char_comma
5263 pop af
5264 jr p_arg_r0
5265
5266 l1e03h:
5267 ld a,(isprefix_ixiy)
5268 and a
5269 jr nz,l1e0eh
5270 ld a,(iy+001h)
5271 jr l1e11h
5272 l1e0eh:
5273 ld a,(iy+002h)
5274 l1e11h:
5275 jr p_arg_r0
5276
5277 sub_1e13h:
5278 call p_char_lparen
5279 ld l,(iy+001h)
5280 ld h,(iy+002h)
5281 ld a,001h
5282 call sub_1d50h
5283
5284 p_char_rparen:
5285 ld a,')'
5286 jp outchar
5287
5288 p_arg_r:
5289 ld a,(iy+000h)
5290 rra
5291 rra
5292 rra
5293 jr p_arg_r0
5294 p_arg_rs:
5295 ld a,(iy+000h)
5296 p_arg_r0:
5297 and 007h
5298 cp 006h
5299 jr nz,p_arg_r1
5300 ld a,(isprefix_ixiy)
5301 and a
5302 ld a,006h
5303 jr z,p_arg_r1
5304 ld hl,b_1e78_start
5305 ld a,(isprefix_ixiy)
5306 dec a
5307 jr z,l1e4dh
5308 ld hl,l1e7bh
5309 l1e4dh:
5310 call pstr
5311 ld a,(iy+001h)
5312 and a
5313 jp m,l1e61h
5314 call pstr_inl
5315 dc '+'
5316 ld a,(iy+001h)
5317 jr l1e6bh
5318 l1e61h:
5319 call pstr_inl
5320 dc '-'
5321 ld a,(iy+001h)
5322 neg
5323 l1e6bh:
5324 call out_hex
5325 jr p_char_rparen
5326
5327 p_arg_r1:
5328 ld hl,t_BCDEHL_HL_A
5329 jr p_arg
5330
5331 b_1e78_start:
5332 DC '(IX'
5333 l1e7bh:
5334 DC '(IY'
5335
5336 p_arg_hlixiy:
5337 ld a,(isprefix_ixiy)
5338 ld hl,t_HL.IX.IY
5339 jr p_arg
5340 p_arg_zz:
5341 ld hl,t_BC.DE.HL.AF
5342 jr l1e8eh
5343 p_arg_ww:
5344 ld hl,t_BC.DE.HL.SP
5345 l1e8eh:
5346 ld a,(iy+000h)
5347 rra
5348 rra
5349 rra
5350 rra
5351 and 003h
5352 cp 002h
5353 jr z,p_arg_hlixiy
5354 jr p_arg
5355
5356 p_arg_cc:
5357 ld a,(iy+000h)
5358 p_arg_cc0:
5359 rra
5360 rra
5361 rra
5362 and 007h
5363 ld hl,t_tstfl_ZCPS
5364 p_arg:
5365 ld b,a
5366 call sel_dc_string
5367 jp pstr
5368
5369 t_MNEMONICS:
5370 DC 'ADC'
5371 DC 'ADD'
5372 DC 'AND'
5373 DC 'BIT'
5374 DC 'CALL'
5375 DC 'CCF'
5376 DC 'CP'
5377 DC 'CPD'
5378 DC 'CPDR'
5379 DC 'CPI'
5380 DC 'CPIR'
5381 DC 'CPL'
5382 DC 'DAA'
5383 DC 'DEC'
5384 DC 'DI'
5385 DC 'DJNZ'
5386 DC 'EI'
5387 DC 'EX'
5388 DC 'EXX'
5389 DC 'HALT'
5390 DC 'IM'
5391 DC 'IN'
5392 DC 'INC'
5393 DC 'IND'
5394 DC 'INDR'
5395 DC 'INI'
5396 DC 'INIR'
5397 DC 'JP'
5398 DC 'JR'
5399 DC 'LD'
5400 DC 'LDD'
5401 DC 'LDDR'
5402 DC 'LDI'
5403 DC 'LDIR'
5404 DC 'NEG'
5405 DC 'NOP'
5406 DC 'OR'
5407 DC 'OTDR'
5408 DC 'OTIR'
5409 DC 'OUT'
5410 DC 'OUTD'
5411 DC 'OUTI'
5412 DC 'POP'
5413 DC 'PUSH'
5414 DC 'RES'
5415 DC 'RET'
5416 DC 'RETI'
5417 DC 'RETN'
5418 DC 'RL'
5419 DC 'RLA'
5420 DC 'RLC'
5421 DC 'RLCA'
5422 DC 'RLD'
5423 DC 'RR'
5424 DC 'RRA'
5425 DC 'RRC'
5426 DC 'RRCA'
5427 DC 'RRD'
5428 DC 'RST'
5429 DC 'SBC'
5430 DC 'SCF'
5431 DC 'SET'
5432 DC 'SLA'
5433 DC 'SRA'
5434 DC 'SRL'
5435 DC 'SUB'
5436 DC 'XOR'
5437 DC 'IN0'
5438 DC 'MLT'
5439 DC 'OTDM'
5440 DC 'OTDMR'
5441 DC 'OTIM'
5442 DC 'OTIMR'
5443 DC 'OUT0'
5444 DC 'SLP'
5445 DC 'TST'
5446 DC 'TSTIO'
5447 DB 0
5448
5449 t_BCDEHL_HL_A:
5450 DC 'B'
5451 DC 'C'
5452 DC 'D'
5453 DC 'E'
5454 DC 'H'
5455 DC 'L'
5456 DC '(HL)'
5457 DC 'A'
5458 DB 0
5459 t_BC.DE.HL.SP:
5460 DC 'BC'
5461 DC 'DE'
5462 DC 'HL'
5463 DC 'SP'
5464 DB 0
5465 t_BC.DE.HL.AF:
5466 DC 'BC'
5467 DC 'DE'
5468 t_HL.AF:
5469 DC 'HL'
5470 DC 'AF'
5471 DB 0
5472 t_BC.DE.IY.SP:
5473 DC 'BC'
5474 DC 'DE'
5475 DC 'IY'
5476 DC 'SP'
5477 DB 0
5478 t_BC.DE.IX.SP:
5479 DC 'BC'
5480 DC 'DE'
5481 DC 'IX'
5482 DC 'SP'
5483 DB 0
5484 t_HL.IX.IY:
5485 DC 'HL'
5486 t_IX.IY:
5487 DC 'IX'
5488 DC 'IY'
5489 DB 0
5490 t_tstfl_ZC:
5491 DC 'NZ'
5492 DC 'Z'
5493 DC 'NC'
5494 DC 'C'
5495 DC 'NE'
5496 DC 'EQ'
5497 DC 'GE'
5498 DC 'LT'
5499 DB 0
5500 t_tstfl_ZCPS:
5501 DC 'NZ'
5502 DC 'Z'
5503 DC 'NC'
5504 DC 'C'
5505 DC 'PO'
5506 DC 'PE'
5507 DC 'P'
5508 DC 'M'
5509 DC 'NE'
5510 DC 'EQ'
5511 DC 'GE'
5512 DC 'LT'
5513 DC 'NV'
5514 DC 'V'
5515 DB 0
5516 t__C_:
5517 DC '(C)'
5518 DB 0
5519
5520 sub_1ffeh:
5521 ld hl,(reg.pc)
5522 ld a,h
5523 or l
5524 jr z,l2037h
5525 ld de,BDOS
5526 and a
5527 sbc hl,de
5528 ld hl,l20edh
5529 jr z,l2031h
5530 ld iy,(reg.pc)
5531 call disas_get_instrlen
5532 jp nc,ERROR
5533 ld c,b
5534 ld b,0
5535 ld hl,(reg.pc)
5536 add hl,bc
5537 call sub_09cah
5538 ld iy,(reg.pc)
5539 ld hl,b_2039_start
5540 call lookup_opc
5541 ccf
5542 ret c
5543 ex de,hl
5544 l2031h:
5545 call CALL_HL
5546 call c,sub_09cah
5547 l2037h:
5548 scf
5549 ret
5550
5551 b_2039_start:
5552 db 0ffh,0ddh,000h ;Prefix DD
5553 dw l20a7h
5554 db 0ffh,0fdh,000h ;Prefix FD
5555 dw l20ach
5556 db 0ffh,0edh,000h ;Prefix ED
5557 dw l20b8h
5558
5559 b_2048_start:
5560 db 0ffh,0cdh,000h ;call mn
5561 dw l2080h
5562 db 0ffh,0c3h,000h ;jp mn
5563 dw l208bh
5564 db 0ffh,0e9h,000h ;jp ()
5565 dw l20a2h
5566 db 0ffh,0c9h,000h ;ret
5567 dw l20dch
5568 db 0ffh,0cfh,000h ;rst 8
5569 dw l2115h
5570 db 0c7h,0c7h,000h ;
5571 dw l20f9h
5572 db 0c7h,0c4h,000h ;
5573 dw l2080h
5574 db 0f7h,010h,000h ;
5575 dw l2093h
5576 db 0e7h,020h,000h ;
5577 dw l2093h
5578 db 0c7h,0c2h,000h ;
5579 dw l208bh
5580 db 0c7h,0c0h,000h ;
5581 dw l20c5h
5582 db 0
5583
5584 l2080h:
5585 ld a,(b_21e2_start)
5586 and a
5587 jr nz,l208bh
5588 ld a,(trace_call_flag)
5589 and a
5590 ret nz
5591 l208bh:
5592 ld l,(iy+001h)
5593 ld h,(iy+002h)
5594 scf
5595 ret
5596 l2093h:
5597 ld c,(iy+001h)
5598 ld a,c
5599 rla
5600 sbc a,a
5601 ld b,a
5602 ld hl,(reg.pc)
5603 add hl,bc
5604 inc hl
5605 inc hl
5606 scf
5607 ret
5608 l20a2h:
5609 ld hl,(reg.l)
5610 scf
5611 ret
5612 l20a7h:
5613 ld hl,(reg.ix)
5614 jr l20afh
5615 l20ach:
5616 ld hl,(reg.iy)
5617 l20afh:
5618 ld a,(iy+001h)
5619 cp 0e9h
5620 scf
5621 ret z
5622 and a
5623 ret
5624 l20b8h:
5625 ld a,(iy+001h)
5626 cp 04dh
5627 jr z,l20dch
5628 cp 045h
5629 jr z,l20dch
5630 and a
5631 ret
5632 l20c5h:
5633 ld a,(iy+000h)
5634 ld (l20d7h),a
5635 ld hl,(reg.f)
5636 push hl
5637 pop af
5638 call l20d7h
5639 scf
5640 jr c,l20dch
5641 ret
5642 l20d7h:
5643 nop
5644 and a
5645 pop hl
5646 inc hl
5647 jp (hl)
5648
5649 l20dch:
5650 ld a,(b_21e2_start)
5651 and a
5652 jr nz,l20edh
5653 ld a,(trace_call_flag)
5654 and a
5655 jr z,l20edh
5656 call l20edh
5657 pop hl
5658 ret
5659 l20edh:
5660 ld hl,(reg_sp)
5661 ld e,(hl)
5662 inc hl
5663 ld d,(hl)
5664 ex de,hl
5665 call sub_09cah
5666 and a
5667 ret
5668
5669 l20f9h:
5670 ld a,(l0003h)
5671 cp (iy+000h)
5672 ret z
5673 ld a,(iy+000h)
5674 and 038h
5675 ld l,a
5676 ld h,000h
5677 ld a,(b_21e2_start)
5678 and a
5679 jr nz,l2113h
5680 ld a,(trace_call_flag)
5681 and a
5682 ret nz
5683 l2113h:
5684 scf
5685 ret
5686 l2115h:
5687 and a
5688 ret
5689 cmd_C:
5690 ld hl,cmd_C
5691 ld a,1
5692 jr l2122h
5693 cmd_T:
5694 xor a
5695 ld hl,cmd_T
5696 l2122h:
5697 ld (cmd_rpt),hl
5698 ld (trace_call_flag),a
5699 ld a,(de)
5700 sub 'N'
5701 jr nz,l212eh
5702 inc de
5703 l212eh:
5704 ld (trace_N_flag),a
5705 ld a,(de)
5706 sub 'J'
5707 jr nz,l2137h
5708 inc de
5709 l2137h:
5710 ld (trace_J_flag),a
5711 call sub_21a6h
5712 jr z,l2145h
5713 ld hl,1
5714 call get_lastarg_def
5715 l2145h:
5716 ld (trace_count),hl
5717 sub a
5718 ld (l0941h),a
5719 l214ch:
5720 call sub_1ffeh
5721 jr l21a3h
5722
5723 l2151h:
5724 call bp_clr_temporary
5725 ld a,(trace_J_flag)
5726 and a
5727 jr nz,l216bh
5728 ld iy,(reg.pc)
5729 call sub_21c8h
5730 jr z,l216bh
5731 ld hl,b_2048_start
5732 call lookup_opc
5733 jr nc,l214ch
5734 l216bh:
5735 ld a,(trace_UW_flag)
5736 and a
5737 jr z,l2188h
5738 ld de,(trace_count)
5739 call expr
5740 ld a,h
5741 or l
5742 add a,0ffh
5743 sbc a,a
5744 ld hl,trace_UW_flag
5745 xor (hl)
5746 bit 1,a
5747 jr z,l2193h
5748 l2185h:
5749 jp l0902h
5750 l2188h:
5751 ld hl,(trace_count)
5752 dec hl
5753 ld (trace_count),hl
5754 ld a,h
5755 or l
5756 jr z,l2185h
5757 l2193h:
5758 call sub_1ffeh
5759 jr nc,l2185h
5760 ld a,(trace_N_flag)
5761 ld b,a
5762 ld a,(l0941h)
5763 or b
5764 ld (l0941h),a
5765 l21a3h:
5766 jp user_go
5767
5768 sub_21a6h:
5769 call skipbl
5770 xor a
5771 ld (trace_UW_flag),a
5772 ld a,(de)
5773 cp 'U'
5774 jr z,l21b5h
5775 cp 'W'
5776 ret nz
5777 l21b5h:
5778 inc de
5779 push af
5780 push de
5781 call expr
5782 jp c,ERROR
5783 call assert_eol
5784 pop hl
5785 pop af
5786 ld (trace_UW_flag),a
5787 sub a
5788 ret
5789
5790 sub_21c8h:
5791 ld a,(iy+000h)
5792 cp 0edh
5793 jr z,l21dah
5794 and 0dfh
5795 cp 0ddh
5796 ret nz
5797 ld a,(iy+001h)
5798 cp 0e9h
5799 ret
5800 l21dah:
5801 ld a,(iy+001h)
5802 and 0f7h
5803 cp 045h
5804 ret
5805
5806 b_21e2_start:
5807 db 0
5808 trace_call_flag:
5809 db 0 ;1=call, 0=trace
5810 trace_UW_flag:
5811 db 0 ;0 or 'U' or 'W'
5812 trace_count:
5813 dw 0
5814 trace_N_flag:
5815 db 0 ;0 if 'N'
5816 trace_J_flag:
5817 db 0 ;0 if 'J'
5818
5819 ;-------------------------------------------------------------------------------
5820
5821 con_col:
5822 db 0
5823
5824 l0941h:
5825 db 0
5826
5827 bp_tab:
5828 rept BP_CNT
5829 rept BP_SIZE
5830 db 0
5831 endm
5832 endm
5833
5834 expr_p1:
5835 dw expr_buf
5836 expr_p2:
5837 dw expr_buf
5838
5839 expr_buf:
5840 current_cseg defl $ - current_cseg
5841 .phase current_phase + current_cseg
5842
5843 start:
5844 LD SP,ldr_end+(stack-ddtz_base)
5845 LD DE,signon ;ldr_end+(expr_buf-ddtz_base)
5846 LD C,BDOS_PSTR
5847 CALL BDOS
5848
5849 xor a
5850 dec a
5851 jp po,reloc
5852 ld de,msgz80
5853 LD C,BDOS_PSTR
5854 CALL BDOS
5855 jp 0
5856
5857 reloc:
5858 LD HL,ldr_end+ddtz_size ;start of reloc bitmap
5859 ld bc,0108h ;init bit counter
5860
5861 EXX
5862 LD HL,(BDOS+1)
5863 LD (ldr_end+(ddtz_bdos+1-ddtz_base)),HL
5864 LD BC,ddtz_size-1
5865 LD D,B
5866 LD E,0FFH
5867 INC DE ;size rounded up to next page boundary
5868 INC BC ;ddtz_size
5869 OR A
5870 SBC HL,DE ;BDOS - size
5871 LD (BDOS+1),HL ;-> new BDOS entry
5872
5873 push hl
5874 PUSH BC
5875 ld de,ldr_end
5876 sbc hl,de
5877 EX DE,HL ;-> DE
5878 LD HL,ldr_size
5879 add hl,bc
5880 ld b,h
5881 ld c,l
5882 LD HL,TPA
5883 reloc_lp:
5884 EXX
5885 djnz reloc_nl
5886 ld b,c ;reload bit counter
5887 LD e,(HL) ;get next 8 relocation bits
5888 INC HL
5889 reloc_nl:
5890 sla e
5891 EXX
5892 JR NC,reloc_next
5893 DEC HL
5894 LD A,(HL)
5895 ADD A,E
5896 LD (HL),A
5897 INC HL
5898 LD A,(HL)
5899 ADC A,D
5900 LD (HL),A
5901 reloc_next:
5902 cpi
5903 jp pe,reloc_lp
5904 dec hl
5905
5906 POP BC
5907 pop de
5908 EX DE,HL
5909 ADD HL,BC
5910 EX DE,HL
5911 DEC DE
5912 LDDR
5913 LD HL,conbuf+2-ddtz_base
5914 ADD HL,DE
5915 JP (HL)
5916
5917 current_phase defl $
5918 .dephase
5919 current_cseg defl $
5920
5921 ds EXPR_BUF_SIZE - ($ - expr_buf)
5922 expr_bufe:
5923
5924 msg_Y:
5925 dc 'Yn'
5926 reg_Y:
5927 rept YREG_CNT
5928 dw 0
5929 endm
5930
5931 last_S:
5932 dw TPA
5933
5934 last_I:
5935 dw 0
5936
5937 last_O_addr:
5938 dw 0
5939 last_O_val:
5940 db 0
5941
5942 cmd_Q_jopt:
5943 db -1
5944
5945 last_D:
5946 dw TPA
5947
5948 cmdR_rindex:
5949 db 0
5950
5951 high_load:
5952 dw TPA
5953 max_load:
5954 dw TPA
5955
5956 l1262h:
5957 dw 0
5958 last_A:
5959 dw TPA
5960 cmd_A_prev:
5961 dw TPA
5962
5963 prefix_ixiy:
5964 db 0
5965
5966 isprefix_ixiy:
5967 db 0
5968 last_L:
5969 dw TPA
5970 disas_arg_16:
5971 dw 0
5972 l1ffdh:
5973 db 0
5974
5975 symlen_max: ;max length of symbols read so far
5976 db 0
5977 cur_fcb:
5978 dw 0
5979 fcbsym:
5980 ds 33
5981
5982 ddtz_size equ $-ddtz_base
5983 ddtz_end:
5984
5985 ;-------------------------------------------------------------------------------
5986
5987 end