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