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