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