]> cloudbase.mooo.com Git - z180-stamp.git/blob - z180/ddtz.180
Remove memory test and bank manager.
[z180-stamp.git] / z180 / ddtz.180
1 page 255
2 .z80
3
4 extrn ?const,?conin,?cono
5 extrn getiff
6 extrn selbnk,@cbnk
7
8 global ddtz,bpent
9 global $stack
10
11
12 include config.inc
13 if CPU_Z180
14 include z180reg.inc
15 include z180.lib
16 endif
17
18 BS equ 08h
19 TAB equ 09h
20 CR equ 0dh
21 LF equ 0ah
22 DEL equ 7fh
23 CNTRX equ 'X'-'@'
24
25 TPA equ 100h
26 TOPRAM equ 0f000h
27
28
29 MEMDUMP_CNT equ 16 ;mem dump bytes per line
30 BP_CNT equ 12 ;number of breakbpoints
31
32
33 ;--------------------------------------------------
34 ;
35
36 ; copy code to common memory and execute it there
37 comst macro
38 call ?excom
39 ds 1
40 ?lcs defl $
41 endm
42
43 ; mark end of common code snippet
44 comend macro
45 ?lce defl $
46 ?lclen defl ?lce-?lcs
47 org ?lcs-1
48 db ?lclen
49 org ?lce
50 ifndef ?lcmax
51 ?lcmax defl 0
52 endif
53 if ?lclen gt ?lcmax
54 ?lcmax defl ?lclen
55 endif
56 endm
57
58
59
60
61 cseg
62
63 ;----------------------------------------------------------
64
65 MSG:
66 DB 'DDT/Z - HD64180 (ROM)'
67 DB CR,LF,0
68
69 HLPMSG:
70 DB 'DDT/Z180 (ROM) Commands:',CR,LF
71 DB '> @ examine/substitute the displacement register @',CR,LF
72 DB '> A [address] Assemble',CR,LF
73 DB '> B[X] display [or clear] all Breakpoints',CR,LF
74 DB ' B breakp [:count] [breakp..] set Breakpoints',CR,LF
75 DB ' BX address [address..] clear Breakpoints',CR,LF
76 DB '>>C[N][J] [count] trace over Calls [No list] [Jumps only]',CR,LF
77 DB ' C[N][J] W|U expression trace over Calls While|Until ...',CR,LF
78 DB '>>D [startadr] [endadr] Display memory in hex and ascii',CR,LF
79 DB '> G [startadr] [;breakp..] Go [to start] [temporary breakpoints]',CR,LF
80 DB '> H [expression [expression]] compute expressions / show High/max load adr.',CR,LF
81 DB '>>I [port] Input a byte from port',CR,LF
82 DB '>>L [startadr] [endadr] List disassembled code',CR,LF
83 DB '> M[V] startadr endadr destadr Move memory [and verify]',CR,LF
84 DB '>>O [byte] [port] Output a byte to port',CR,LF
85 DB '> Q[J] startadr endadr bytes Qery memory for byte string [Justified]',CR,LF
86 DB '> R [displacement] Read intel hex from console [add displacemt]',CR,LF
87 DB '> S address Substitute memory',CR,LF
88 DB '>>T[N][J] [count] Trace [No list] [Jumps only] [count steps]',CR,LF
89 DB ' T[N][J] W|U expression Trace While|Until expression',CR,LF
90 DB '> V startadr endadr destadr Verify (compare) two memory areas',CR,LF
91 DB '> X[register] eXamine [and substitute] registers',CR,LF
92 DB '> Y[0..9] eXamine [and substitute] Y variables',CR,LF
93 DB '> Z startadr endadr bytes Zap (fill) memory with a byte string',CR,LF
94 DB 0
95
96 ddtz:
97 ld sp,$stack
98 ld a,(wstrtflg) ;check warm start flag
99 or a
100 ;;; jr nz,ddtz_w
101
102 exx
103 ld hl,sysramc
104 ld de,topcodbeg
105 ld bc,topcodend-topcodbeg
106 ldir
107
108 exx
109
110 if CPU_Z180
111 ld a,e
112 ld (ubbr),a
113 endif
114
115 ddtz_w:
116 ld hl,MSG
117 call PSTR
118 call ddtei
119
120 ; DDTZ main loop
121
122 DDTZML:
123 ld sp,$stack
124 ld hl,l07eah
125 ld (CMD_ERR),hl
126 ld hl,(REG.PC)
127 ld (OFFS.pc),hl
128 call sub_0e68h
129 ld hl,(CMD_RPT)
130 ld de,DDTZML
131 call CP.HL.DE
132 ld a,'>'
133 call OUTCHAR
134 call nz,OUTCHAR
135 call z,OUTBL
136 call INLINE
137 call SKIPBL
138 jr z,exe_hl
139 ld hl,DDTZML
140 ld (CMD_RPT),hl
141 inc de
142 sub '?'
143 jr c,ERROR
144 cp 'Z'+1-'?'
145 jr nc,ERROR
146 add a,a
147 ld hl,CMDTAB
148 call ADD_HL_A
149 ld a,(hl)
150 inc hl
151 ld h,(hl)
152 ld l,a
153 jr exe_hl
154 ERROR:
155 ld hl,(CMD_ERR)
156 exe_hl:
157 call CALL.HL
158 jr DDTZML
159
160 CALL.HL:
161 jp (hl)
162
163
164 CMDTAB:
165 defw CMD.? ;Help
166 defw CMD.@ ;Offset
167 defw CMD.A ;Assemble
168 defw CMD.B ;Breakpoint
169 defw CMD.C ;Call
170 defw CMD.D ;Display
171 defw ERROR ;
172 defw ERROR ;
173 defw CMD.G ;Go
174 defw CMD.H ;Hex Math
175 defw CMD.I ;In Port
176 defw ERROR ;
177 defw ERROR ;
178 defw CMD.L ;List
179 defw CMD.M ;Move
180 defw ERROR ;
181 defw CMD.O ;Out Port
182 defw ERROR ;
183 defw CMD.Q ;Query
184 defw CMD.R ;Read Intel Hex
185 defw CMD.S ;Substitute
186 defw CMD.T ;Trace
187 defw ERROR ;
188 defw CMD.V ;Verify
189 defw ERROR ;
190 defw CMD.X ;eXamine
191 defw CMD.Y ;eXamine Y Registers
192 defw CMD.Z ;Zap (fill) memory
193 l07eah:
194 ld a,'?'
195 call OUTCHAR
196 jp CRLF
197
198 CMD.?:
199 call assert_eol
200 ld hl,HLPMSG
201 call PSTR
202 ret
203
204 $ci:
205 push hl
206 push de
207 push bc
208 call ?conin
209 pop bc
210 pop de
211 pop hl
212 ret
213
214 $co:
215 push hl
216 push de
217 push bc
218 ld c,a
219 call ?cono
220 pop bc
221 pop de
222 pop hl
223 ret
224
225 DELC:
226 ld a,b
227 or a
228 ret z
229 call DELC1
230 dec hl
231 dec b
232 inc c
233 ld a,(hl)
234 cp ' '
235 ret nc
236 DELC1:
237 push de
238 push hl
239 push bc
240 ld c,BS
241 call ?cono
242 ld c,' '
243 call ?cono
244 ld c,BS
245 call ?cono
246 pop bc
247 pop hl
248 pop de
249 ret
250
251 DELL:
252 ld a,b ;
253 or a ;
254 ret z ;
255 call DELC ;
256 jr DELL ;
257
258 INLINE:
259 push hl ;
260 ld hl,CI.BUF ;
261 ld c,(hl) ;
262 inc hl ;
263 ld b,000h ;
264 inc hl ;
265 inlnxtch:
266 ld a,c ;
267 or a ;
268 jr z,inl_e ;
269 call $ci ;
270 cp CR ;
271 jr z,inl_e ;Accept line
272 cp LF ;
273 jr z,inl_e ;Accept line
274 cp BS ;
275 jr nz,l0844h ;
276 call DELC ;Delete Char
277 jr inlnxtch ;
278 l0844h:
279 cp DEL ;
280 jr nz,l084dh ;
281 call DELC ;Delete Char
282 jr inlnxtch ;
283 l084dh:
284 cp CNTRX ;
285 jr nz,l0856h ;
286 call DELL ;Delete Line
287 jr inlnxtch ;
288 l0856h:
289 cp TAB ;
290 jr nz,l085ch ;
291 ld a,' ' ;
292 l085ch:
293 ld (hl),a ;
294 cp ' ' ;
295 jr nc,l0869h ;
296 ld a,'^' ;Controll characters
297 call $co ;
298 ld a,(hl) ;
299 add a,'@' ;
300 l0869h:
301 call $co ;
302 inc hl ;
303 inc b ;
304 dec c ;
305 jr inlnxtch ;
306
307 inl_e:
308 ld hl,ci.buf+1 ;
309 ld (hl),b ;
310 call CRLF ;
311 ld de,ci.buf+1 ;
312 ld a,(de) ;
313 ld b,a ;
314 ld c,000h ;
315 inc b ;
316 l0880h:
317 inc de ;
318 dec b ;
319 jr z,l08b2h ;
320 ld a,(de) ;
321 bit 0,c ;
322 call z,UPCASE ;
323 ld (de),a ;
324 cp '''' ;
325 jr nz,l0880h ;
326 push de ;
327 dec de ;
328 ld a,(de) ;
329 cp '''' ;
330 jr z,l08aeh ;
331 dec de ;
332 ld a,(de) ;
333 cp '^' ;
334 jr z,l08a2h ;
335 dec de ;
336 ld a,(de) ;
337 cp '^' ;
338 jr nz,l08aeh ;
339 l08a2h:
340 inc de ;
341 push bc ;
342 call sub_0a0eh ;
343 pop bc ;
344 dec de ;
345 ld a,(de) ;
346 cp '''' ;
347 jr z,l08afh ;
348 l08aeh:
349 inc c ;
350 l08afh:
351 pop de ;
352 jr l0880h ;
353 l08b2h:
354 xor a ;
355 ld (de),a ;
356 ld de,ci.buf+2 ;
357 pop hl ;
358 ret ;
359
360 UPCASE:
361 cp 'a' ;
362 ret c ;
363 cp 'z'+1 ;
364 ret nc ;
365 and 05fh ;
366 ret ;
367
368 out.hl.@:
369 call out.hl ;
370 push de ;
371 push hl ;
372 ld de,(offs.@) ;
373 ld a,d ;
374 or e ;
375 jr z,l08ddh ;
376 call OUTBL ;
377 ld a,'@' ;
378 call OUTCHAR ;
379 and a ;
380 sbc hl,de ;
381 call out.hl ;
382 l08ddh:
383 pop hl ;
384 pop de ;
385 ret ;
386
387 out.bin.w:
388 ld a,h ;
389 call out.bin.b ;
390 ld a,l ;
391 out.bin.b:
392 ld b,008h ;
393 l08e7h:
394 add a,a ;
395 push af ;
396 ld a,0 ;
397 adc a,a ;
398 call out.digit ;
399 pop af ;
400 djnz l08e7h ;
401 ld a,'"' ;
402 jp OUTCHAR ;
403
404 sub_08f7h:
405 ld a,'-' ;
406 call OUTCHAR ;
407 dec hl ;
408 jp cpl.hl ;
409
410 out.hl.decm:
411 push hl ;
412 call sub_08f7h ;
413 db 3eh ; ld a,0E5h
414 out.hl.dec:
415 push hl
416 ld b,6 ;
417 call sub_0917h ;
418 pop hl ;
419 ld a,'.' ;
420 call OUTCHAR ;
421 l0911h:
422 call OUTBL ;
423 djnz l0911h ;
424 ret ;
425
426
427 sub_0917h:
428 dec b
429 push de
430 ld de,10
431 call DIV_HL_DE
432 ld a,h
433 or l
434 call nz,sub_0917h
435 ld a,e
436 pop de
437 jr out.digit
438
439 sub_0928h:
440 push hl
441 call sub_08f7h
442 call out.hl
443 pop hl
444 ret
445 out.hl:
446 ld a,h
447 call out.hex
448 ld a,l
449 out.hex:
450 push af
451 rra
452 rra
453 rra
454 rra
455 call out.digit
456 pop af
457 out.digit:
458 and 00fh
459 cp 10
460 jr c,l0947h
461 add a,007h
462 l0947h:
463 add a,'0'
464 jr OUTCHAR
465 l094bh:
466 ld a,'-'
467 call OUTCHAR
468 ld a,040h
469 out.ascii:
470 ex af,af'
471 call outquote
472 ex af,af'
473 push af
474 res 7,a
475 cp ' '
476 jr nc,l0960h
477 sub 0c0h
478 l0960h:
479 call OUTCHAR
480 push af
481 cp ''''
482 call z,OUTCHAR
483 pop af
484 ex af,af'
485 call outquote
486 pop af
487 or a
488 ld a,'.'
489 call m,OUTCHAR
490 ex af,af'
491 jr c,l094bh
492 ret
493
494 outquote:
495 ld a,''''
496 OUTCHAR:
497 push hl
498 push de
499 push bc
500 push af
501 and 07fh
502 ld c,a
503 call ?cono
504 ld hl,CON.COL
505 inc (hl)
506 pop af
507 pop bc
508 pop de
509 pop hl
510 ret
511
512 inchar:
513 push hl
514 push de
515 push bc
516 call ?const
517 and a
518 jr z,inch1
519 call ?conin
520 scf
521 inch1:
522 pop bc
523 pop de
524 pop hl
525 ret
526
527 PSTR:
528 ld c,000h
529 l0995h:
530 ld a,(hl)
531 and a
532 ret z
533 call OUTCHAR
534 inc c
535 inc hl
536 and a
537 ret m
538 jr l0995h
539
540 outbl6:
541 call outbl2
542 outbl4:
543 call outbl2
544 outbl2:
545 call OUTBL
546 OUTBL:
547 ld a,' '
548 jr OUTCHAR
549 CRLF:
550 call inchar
551 ld a,CR
552 call OUTCHAR
553 ld a,LF
554 call OUTCHAR
555 ld a,000h
556 ld (CON.COL),a
557 jp c,DDTZML
558 ret
559
560 ADD_HL_A:
561 add a,l
562 ld l,a
563 ret nc
564 inc h
565 ret
566
567 SKIPBL0:
568 inc de
569 SKIPBL:
570 ld a,(de)
571 cp ' '
572 jr z,SKIPBL0
573 cp 009h
574 jr z,SKIPBL0
575 or a
576 ret
577
578 skip_to_nextarg:
579 call SKIPBL
580 cp ','
581 ret nz
582 inc de
583 call SKIPBL
584 cp a
585 ret
586
587 assert_eol:
588 call SKIPBL
589 ret z
590 l09e5h:
591 jp ERROR
592
593 chk.sp:
594 push hl
595 push de
596 ld hl,0
597 add hl,sp
598 ld de,$stack-50
599 call CP.HL.DE
600 pop de
601 pop hl
602 jr c,l09e5h
603 ret
604
605 CP.HL.DE:
606 and a
607 sbc hl,de
608 add hl,de
609 ret
610
611 lookupch:
612 ld b,000h
613 l0a00h:
614 ld a,(hl)
615 and a
616 ret z
617 ld a,(de)
618 cp (hl)
619 jr z,l0a0bh
620 inc hl
621 inc b
622 jr l0a00h
623 l0a0bh:
624 scf
625 inc de
626 ret
627
628 sub_0a0eh:
629 ld hl,b_0x132A_start
630 ld b,07fh
631 jr l0a17h
632
633 sub_0a15h:
634 ld b,0ffh
635 l0a17h:
636 inc b
637 ld a,(hl)
638 and a
639 ret z
640 call l0a27
641 jr nc,l0a17h
642 res 7,b
643 ret
644
645 sub_0a23h:
646 push bc
647 res 7,b
648 db 3eh ;0a26 ld a,0c5h
649 l0a27:
650 push bc
651 push de
652 l0a29h:
653 ld a,(de)
654 xor (hl)
655 and 07fh
656 jr nz,l0a41h
657 bit 7,(hl)
658 inc hl
659 inc de
660 jr z,l0a29h
661 scf
662 bit 7,b
663 call z,sub_0d20h
664 jr nc,l0a44h
665 pop af
666 scf
667 pop bc
668 ret
669
670 l0a41h:
671 call sub_0a50h
672 l0a44h:
673 pop de
674 and a
675 pop bc
676 ret
677
678 sub_0a48h:
679 inc b
680 l0a49h:
681 dec b
682 ret z
683 call sub_0a50h
684 jr l0a49h
685 sub_0a50h:
686 ld a,(hl)
687 and a
688 ret z
689 l0a53h:
690 ld a,(hl)
691 inc hl
692 and a
693 ret m
694 jr l0a53h
695
696 get_arg3:
697 call get_arg_range
698 push hl
699 push bc
700 call skip_to_nextarg
701 call get_arg
702 ex de,hl
703 pop bc
704 pop hl
705 ret
706
707 sub_0a68h:
708 call EXPR
709 jr c,error0
710 ret
711
712 get_arg:
713 call sub_0a68h
714 l0a71h:
715 jp assert_eol
716
717 get_lastarg_def:
718 call get_arg_def
719 jr l0a71h
720
721 get_arg_def:
722 push hl
723 call EXPR
724 jr c,l0a80h
725 ex (sp),hl
726 l0a80h:
727 pop hl
728 ret
729
730 sub_0a82h:
731 call sub_0a87h
732 jr l0a71h
733
734 sub_0a87h:
735 db 0e6h ;0a87 and 037h (clear carry)
736 get_arg_range:
737 scf
738 ex af,af'
739 push bc
740 push hl
741 call EXPR
742 jr nc,l0a97h
743 ex af,af'
744 jr c,error0
745 ex af,af'
746 pop hl
747
748 defb 03eh
749 l0a97h:
750 pop af
751 call sub_0aa5h
752 jr nc,l0aa3h
753 ex af,af'
754 pop bc
755 ret nc
756 error0:
757 jp ERROR
758
759 l0aa3h:
760 pop af
761 ret
762
763 sub_0aa5h:
764 call skip_to_nextarg
765 cp 'S'
766 jr nz,l0aadh
767 inc de
768 l0aadh:
769 push hl
770 push af
771 call EXPR
772 jr c,l0ac3h
773 ld b,h
774 ld c,l
775 pop af
776 pop hl
777 jr z,l0ac1h
778 ld a,c
779 sub l
780 ld c,a
781 ld a,b
782 sbc a,h
783 ld b,a
784 inc bc
785 l0ac1h:
786 and a
787 ret
788
789 l0ac3h:
790 pop af
791 pop hl
792 jr z,error0
793 scf
794 ret
795
796 EXPR:
797 call SKIPBL
798 EXPR1:
799 call do_subexpr
800 ret c
801 call do_rel_op
802 ret nc
803 push bc
804 push hl
805 call do_subexpr
806 jr c,error0
807 ex de,hl
808 ex (sp),hl
809 and a
810 sbc hl,de
811 ld hl,0ffffh
812 pop de
813 ret
814
815 do_op_eq:
816 jr z,l0af8h
817 jr l0af7h
818 do_op_ne:
819 jr nz,l0af8h
820 jr l0af7h
821 do_op_le:
822 jr z,l0af8h
823 do_op_lt:
824 jr c,l0af8h
825 jr l0af7h
826 do_op_gt:
827 jr z,l0af7h
828 do_op_ge:
829 jr nc,l0af8h
830 l0af7h:
831 inc hl
832 l0af8h:
833 and a
834 ret
835
836 do_rel_op:
837 push hl
838 ld hl,tab_eq_le_ge
839 call lookupch
840 jr nc,l0b28h
841 ld a,b
842 or a
843 jr z,l0b1ch
844 ld a,(de)
845 cp '='
846 jr nz,l0b11h
847 inc de
848 inc b
849 inc b
850 jr l0b1ch
851
852 l0b11h:
853 bit 0,b
854 jr z,l0b1ch
855 cp '>'
856 jr nz,l0b1ch
857 inc de
858 ld b,005h
859 l0b1ch:
860 ld hl,tab_func_eqlege
861 ld a,b
862 add a,a
863 call ADD_HL_A
864 ld c,(hl)
865 inc hl
866 ld b,(hl)
867 scf
868 l0b28h:
869 pop hl
870 ret
871
872 tab_eq_le_ge:
873 db '=<>',0
874
875 tab_func_eqlege:
876 defw do_op_eq
877 defw do_op_lt
878 defw do_op_gt
879 defw do_op_le
880 defw do_op_ge
881 defw do_op_ne
882
883 do_subexpr:
884 call do_factor
885 ret c
886 l0b3eh:
887 call do_binary_op
888 push hl
889 push bc
890 call do_factor
891 pop bc
892 ex de,hl
893 ex (sp),hl
894 jr nc,l0b52h
895 pop de
896 ld a,b
897 or c
898 ret z
899 jp ERROR
900
901 l0b52h:
902 ld a,b
903 or c
904 push bc
905 ret nz
906 pop bc
907 do_op_add:
908 add hl,de
909 l0b58h:
910 pop de
911 jr l0b3eh
912
913 do_op_sub:
914 and a
915 sbc hl,de
916 jr l0b58h
917
918 do_op_mlt:
919 push bc
920 if CPU_Z180
921 ld b,h
922 ld c,e
923 ld h,e
924 ld e,l
925 mlt bc
926 mlt de
927 mlt hl
928 ld a,h
929 add a,c
930 add a,e
931 ld h,a
932 else
933 ld b,h
934 ld c,l
935 ld hl,0
936 ld a,16
937 mlt_1:
938 add hl,hl
939 ex de,hl
940 add hl,hl
941 ex de,hl
942 jr nc,mlt_2
943 add hl,bc
944 mlt_2:
945 dec a
946 jr nz,mlt_1
947 endif
948 pop bc
949 jr l0b58h
950
951 do_op_div:
952 call DIV_HL_DE
953 jr l0b58h
954
955 do_op_mod:
956 call DIV_HL_DE
957 ex de,hl
958 jr l0b58h
959
960 DIV_HL_DE:
961 push bc
962 ex de,hl
963 ld b,h
964 ld c,l
965 ld hl,0
966 ld a,16
967 l0b89h:
968 push af
969 add hl,hl
970 ex de,hl
971 xor a
972 add hl,hl
973 ex de,hl
974 adc a,l
975 sub c
976 ld l,a
977 ld a,h
978 sbc a,b
979 ld h,a
980 inc de
981 jr nc,l0b9ah
982 add hl,bc
983 dec de
984 l0b9ah:
985 pop af
986 dec a
987 jr nz,l0b89h
988 ex de,hl
989 pop bc
990 ret
991
992 do_op_and:
993 ld a,h
994 and d
995 ld h,a
996 ld a,l
997 and e
998 ld l,a
999 jr l0b58h
1000
1001 do_op_or:
1002 ld a,h
1003 or d
1004 ld h,a
1005 ld a,l
1006 or e
1007 ld l,a
1008 jr l0b58h
1009
1010 do_op_xor:
1011 ld a,h
1012 xor d
1013 ld h,a
1014 ld a,l
1015 xor e
1016 ld l,a
1017 jr l0b58h
1018
1019 do_binary_op:
1020 push hl
1021 ld hl,tab_op_a
1022 call lookupch
1023 ld a,b
1024 ld hl,tab_func_opa
1025 add a,a
1026 call ADD_HL_A
1027 ld c,(hl)
1028 inc hl
1029 ld b,(hl)
1030 pop hl
1031 ret
1032
1033 tab_op_a:
1034 DB '+-*/%&!#',0
1035 tab_func_opa:
1036 defw do_op_add
1037 defw do_op_sub
1038 defw do_op_mlt
1039 defw do_op_div
1040 defw do_op_mod
1041 defw do_op_and
1042 defw do_op_or
1043 defw do_op_xor
1044 defw 0
1045
1046 fact_factor:
1047 call do_factor
1048 ret nc
1049 jp ERROR
1050
1051 do_factor:
1052 call chk.sp
1053 call get.number
1054 ret nc
1055 inc de
1056 ld hl,TOPRAM
1057 cp 'T'
1058 ret z
1059 ld hl,(HILOD)
1060 cp 'H'
1061 ret z
1062 ld hl,(MAXLOD)
1063 cp 'M'
1064 ret z
1065 ld hl,TPA
1066 cp 'L'
1067 ret z
1068 ld hl,(offs.@)
1069 cp '@'
1070 ret z
1071 ld hl,(OFFS.pc)
1072 cp '$'
1073 ret z
1074 cp '-'
1075 jr z,fact_factneg
1076 cp '~'
1077 jr z,fact_factinv
1078 cp '+'
1079 jr z,fact_factor
1080 cp '^'
1081 jr z,fact_reg.CPU
1082 cp 'Y'
1083 jr z,fact_reg.Y
1084 cp '('
1085 jr z,fact_mem
1086 cp '['
1087 jp z,EXPR_BRCKT ;0c35 [ expression ]
1088 cp ''''
1089 jr z,fact_factstring
1090 dec de
1091 scf
1092 ret
1093
1094 fact_reg.Y:
1095 call get.decdigit
1096 jp c,ERROR
1097 inc de
1098 add a,a
1099 ld hl,reg.Y
1100 call ADD_HL_A
1101 ld a,(hl)
1102 inc hl
1103 ld h,(hl)
1104 ld l,a
1105 and a
1106 ret
1107 fact_factstring:
1108 ld hl,0
1109 l0c56h:
1110 ld a,(de)
1111 cp ''''
1112 jr z,l0c62h
1113 and a
1114 ret z
1115 l0c5dh:
1116 ld h,l
1117 ld l,a
1118 inc de
1119 jr l0c56h
1120
1121 l0c62h:
1122 inc de
1123 ld a,(de)
1124 cp ''''
1125 jr z,l0c5dh
1126 sub '.'
1127 or a
1128 ret nz
1129 inc de
1130 set 7,l
1131 ret
1132
1133 fact_reg.CPU:
1134 call sub_1315h
1135 jr nc,l0cbbh
1136 ld a,(hl)
1137 inc hl
1138 ld h,(hl)
1139 ld l,a
1140 and a
1141 bit 0,c
1142 ret nz
1143 ld h,000h
1144 ret
1145
1146 fact_factneg:
1147 call fact_factor
1148 dec hl
1149 cpl.hl:
1150 ld a,h
1151 cpl
1152 ld h,a
1153 ld a,l
1154 cpl
1155 ld l,a
1156 ret
1157 fact_factinv:
1158 call fact_factor
1159 jr cpl.hl
1160
1161 fact_mem:
1162 call EXPR1
1163 jr c,l0cbbh
1164 ld a,(de)
1165 cp ')'
1166 jr nz,l0cbbh
1167 inc de
1168 comst
1169 ld a,(hl)
1170 inc hl ;
1171 ld h,(hl) ;
1172 comend
1173 ld l,a
1174 ld a,(de)
1175 inc de
1176 cp '.'
1177 ret z
1178 dec de
1179 xor a
1180 ld h,a
1181 ret
1182
1183 EXPR_BRCKT:
1184 call EXPR1
1185 jr c,l0cbbh
1186 ld a,(de)
1187 cp ']'
1188 inc de
1189 ret z
1190 l0cbbh:
1191 jp ERROR
1192
1193 get.number:
1194 call get.hexdigit
1195 ret c
1196 push de
1197 l0cc3h:
1198 inc de
1199 call get.hexdigit
1200 jr nc,l0cc3h
1201 pop de
1202 cp '.'
1203 jr z,l0d04h
1204 cp '"'
1205 jr z,l0ce9h
1206 ld hl,0
1207 l0cd5h:
1208 call get.hexdigit
1209 jr c,l0ce4h
1210 add hl,hl
1211 add hl,hl
1212 add hl,hl
1213 add hl,hl
1214 call ADD_HL_A
1215 inc de
1216 jr l0cd5h
1217 l0ce4h:
1218 xor 'H'
1219 ret nz
1220 inc de
1221 ret
1222
1223 l0ce9h:
1224 ld hl,0
1225 l0cech:
1226 call get.decdigit
1227 l0cefh:
1228 inc de
1229 jr c,l0cf8h
1230 add hl,hl
1231 call ADD_HL_A
1232 jr l0cech
1233 l0cf8h:
1234 cp '"'
1235 jp nz,ERROR
1236 call get.decdigit
1237 jr nc,l0cefh
1238 or a
1239 ret
1240 l0d04h:
1241 ld hl,0
1242 l0d07h:
1243 call get.decdigit
1244 inc de
1245 jr c,l0d1ah
1246 push bc
1247 add hl,hl ;0d0e hl *= 10
1248 ld b,h
1249 ld c,l
1250 add hl,hl
1251 add hl,hl
1252 add hl,bc
1253 pop bc
1254 call ADD_HL_A
1255 jr l0d07h
1256 l0d1ah:
1257 cp '.'
1258 ret z
1259 jp ERROR
1260
1261 sub_0d20h:
1262 ld a,(de)
1263 cp 05bh
1264 jr l0d28h
1265
1266 get.hexdigit:
1267 ld a,(de)
1268 sub_0d26h:
1269 cp 'F'+1
1270 l0d28h:
1271 ccf
1272 ret c
1273 cp 'A'
1274 jr c,l0d32h
1275 sub 'A'-10
1276 ret
1277
1278 get.decdigit:
1279 ld a,(de)
1280 l0d32h:
1281 cp '9'+1
1282 jr l0d39h
1283 get.bindigit:
1284 ld a,(de)
1285 cp '1'+1
1286 l0d39h:
1287 ccf
1288 ret c
1289 cp '0'
1290 ret c
1291 sub '0'
1292 ret
1293
1294 l0d41h:
1295 call assert_eol
1296
1297 prnt_cpustat:
1298 call prnt_f
1299 call outbl2
1300 ld hl,b_0x0DFD_start
1301 ld de,b_0x0E1D_start
1302 ld b,006h
1303 l0d52h:
1304 call prnt_regs
1305 djnz l0d52h
1306 push hl
1307 push de
1308 ld iy,(REG.PC)
1309 call sub_1f77h
1310 exx
1311 ex af,af'
1312 call CRLF
1313 call prnt_f2
1314 call outbl2
1315 pop de
1316 pop hl
1317 ld b,007h
1318 l0d6fh:
1319 call prnt_regs
1320 djnz l0d6fh
1321 exx
1322 ex af,af'
1323 and a
1324 jr z,l0d7fh
1325 call outbl6
1326 call sub_1f5bh
1327 l0d7fh:
1328 jp crlf
1329
1330 prnt_f:
1331 ld a,(reg.f)
1332 call prnt_flags
1333 ld a,(reg.iff)
1334 cp 0f3h
1335 jp z,outbl
1336 ld a,'E'
1337 jp outchar
1338
1339 prnt_f2:
1340 ld a,(reg.f2)
1341 call prnt_flags
1342 jp outbl
1343
1344 prnt_flags:
1345 ld b,a
1346 ld a,'S'
1347 call sub_0dbeh
1348 ld a,'Z'
1349 call sub_0dbeh
1350 rl b
1351 ld a,'H'
1352 call sub_0dbeh
1353 rl b
1354 ld a,'V'
1355 call sub_0dbeh
1356 ld a,'N'
1357 call sub_0dbeh
1358 ld a,'C'
1359 sub_0dbeh:
1360 rl b
1361 jp c,OUTCHAR
1362 jp OUTBL
1363
1364 prnt_regs:
1365 push bc
1366 push de
1367 call PSTR
1368 ld a,'='
1369 call OUTCHAR
1370 ex (sp),hl
1371 ld e,(hl)
1372 inc hl
1373 ld d,(hl)
1374 inc hl
1375 ld a,(hl)
1376 inc hl
1377 push hl
1378 and a
1379 jr z,l0df2h
1380 push af
1381 ld a,(de)
1382 ld l,a
1383 inc de
1384 ld a,(de)
1385 ld h,a
1386 pop af
1387 dec a
1388 jr z,l0dedh
1389 call out.hl.@
1390 call z,outbl6
1391 jr l0df6h
1392 l0dedh:
1393 call out.hl
1394 jr l0df6h
1395 l0df2h:
1396 ld a,(de)
1397 call out.hex
1398 l0df6h:
1399 call OUTBL
1400 pop de
1401 pop hl
1402 pop bc
1403 ret
1404
1405 b_0x0DFD_start:
1406 DC 'A '
1407 DC 'BC '
1408 DC 'DE '
1409 DC 'HL '
1410 DC 'SP'
1411 DC 'PC'
1412 DC 'A'''
1413 DC 'BC'''
1414 DC 'DE'''
1415 DC 'HL'''
1416 DC 'IX'
1417 DC 'IY'
1418 DC 'I'
1419 DB 0
1420
1421 b_0x0E1D_start:
1422 defw reg.a
1423 defb 000h
1424 defw reg.c
1425 defb 001h
1426 defw reg.e
1427 defb 001h
1428 defw reg.l
1429 defb 001h
1430 defw reg.sp
1431 defb 001h
1432 defw reg.pc
1433 defb 002h
1434 defw reg.a2
1435 defb 000h
1436 defw reg.c2
1437 defb 001h
1438 defw reg.e2
1439 defb 001h
1440 defw reg.l2
1441 defb 001h
1442 defw reg.ix
1443 defb 001h
1444 defw reg.iy
1445 defb 001h
1446 defw reg.i
1447 dw 0
1448
1449 CMD.G:
1450 sub a
1451 ld (TCFLG),a
1452 ld (XA747),a
1453 call EXPR
1454 jr c,l0e54h
1455 ld (REG.PC),hl
1456 l0e54h:
1457 call SKIPBL
1458 jp z,l1183h
1459 cp ';'
1460 jp nz,ERROR
1461 inc de
1462 ld a,002h
1463 call sub_0f24h
1464 jp l1183h
1465
1466 sub_0e68h:
1467 ld b,BP_CNT
1468 ld ix,bp_tab
1469 l0e6eh:
1470 ld a,(ix+000h)
1471 and 0f1h
1472 ld (ix+000h),a
1473 call sub_11c5h
1474 ld de,BP_SIZE
1475 add ix,de
1476 djnz l0e6eh
1477 ret
1478
1479 CMD.B:
1480 call SKIPBL
1481 jr z,l0ecbh
1482 inc de
1483 cp 'X'
1484 jr z,l0e91h
1485 dec de
1486 ld a,001h
1487 jp sub_0f24h
1488 l0e91h:
1489 call SKIPBL
1490 jr z,l0ea6h
1491 l0e96h:
1492 call EXPR
1493 jp c,assert_eol
1494 push de
1495 call sub_0ea7h
1496 pop de
1497 call skip_to_nextarg
1498 jr l0e96h
1499 l0ea6h:
1500 scf
1501 sub_0ea7h:
1502 ld b,BP_CNT
1503 ld ix,bp_tab
1504 l0eadh:
1505 push af
1506 jr c,l0ebbh
1507 ld e,(ix+002h)
1508 ld d,(ix+003h)
1509 call CP.HL.DE
1510 jr nz,l0ec2h
1511 l0ebbh:
1512 ld (ix+000h),000h
1513 call sub_11c5h
1514 l0ec2h:
1515 ld de,BP_SIZE
1516 add ix,de
1517 pop af
1518 djnz l0eadh
1519 ret
1520 l0ecbh:
1521 ld b,BP_CNT
1522 ld ix,bp_tab
1523 l0ed1h:
1524 bit 0,(ix+000h)
1525 jr z,l0f1ch
1526 ld a,'R'
1527 bit 4,(ix+000h)
1528 jr nz,l0ee1h
1529 ld a,' '
1530 l0ee1h:
1531 call OUTCHAR
1532 call OUTBL
1533 ld l,(ix+002h)
1534 ld h,(ix+003h)
1535 call out.hl.@
1536 call outbl2
1537 ld a,':'
1538 call OUTCHAR
1539 ld l,(ix+004h)
1540 ld h,(ix+005h)
1541 call out.hl
1542 ld l,(ix+006h)
1543 ld h,(ix+007h)
1544 ld a,h
1545 or l
1546 jr z,l0f19h
1547 call outbl4
1548 ld a,'I'
1549 call OUTCHAR
1550 call outbl2
1551 call PSTR
1552 l0f19h:
1553 call CRLF
1554 l0f1ch:
1555 ld de,BP_SIZE
1556 add ix,de
1557 djnz l0ed1h
1558 ret
1559
1560 sub_0f24h:
1561 ld b,a
1562 call SKIPBL
1563 ret z
1564 cp 'R'
1565 jr nz,l0f30h
1566 inc de
1567 set 4,b
1568 l0f30h:
1569 push bc
1570 call EXPR
1571 jp c,ERROR
1572 pop bc
1573 bit 0,b
1574 push bc
1575 push de
1576 push hl
1577 call nz,sub_0ea7h
1578 pop hl
1579 call sub_0f68h
1580 pop de
1581 ld (ix+002h),l
1582 ld (ix+003h),h
1583 call sub_0f80h
1584 ld (ix+004h),l
1585 ld (ix+005h),h
1586 call sub_0f91h
1587 ld (ix+006h),l
1588 ld (ix+007h),h
1589 call skip_to_nextarg
1590 pop af
1591 ld (ix+000h),a
1592 and 00fh
1593 jr sub_0f24h
1594 sub_0f68h:
1595 ld b,BP_CNT
1596 ld ix,bp_tab
1597 l0f6eh:
1598 ld a,(ix+000h)
1599 and 00fh
1600 ret z
1601 push bc
1602 ld bc,BP_SIZE
1603 add ix,bc
1604 pop bc
1605 djnz l0f6eh
1606 jp ERROR
1607
1608 sub_0f80h:
1609 call SKIPBL
1610 ld hl,1
1611 cp 03ah
1612 ret nz
1613 inc de
1614 call EXPR
1615 jp c,ERROR
1616 ret
1617 sub_0f91h:
1618 call SKIPBL
1619 cp 049h
1620 ld hl,0
1621 ret nz
1622 inc de
1623 call SKIPBL
1624 push de
1625 call EXPR
1626 jp c,ERROR
1627 ex de,hl
1628 pop de
1629 push de
1630 sbc hl,de
1631 ld b,h
1632 ld c,l
1633 ld hl,(sexp1)
1634 push hl
1635 add hl,bc
1636 ld de,sexpbufe
1637 call CP.HL.DE
1638 jp nc,ERROR
1639 pop hl
1640 ld (sexp2),hl
1641 pop de
1642 ex de,hl
1643 ldir
1644 xor a
1645 ld (de),a
1646 inc de
1647 ex de,hl
1648 ld (sexp1),hl
1649 ld hl,(sexp2)
1650 ret
1651
1652 bpddtz:
1653 if ROMSYS
1654 ld h,ROMEN
1655 jr z,l0fd2h
1656 inc h
1657 l0fd2h:
1658 push hl ;save rom enable stat
1659 endif
1660 push bc
1661 push de
1662 push ix
1663 push iy
1664 ld a,i
1665 ld h,a
1666 ld l,000h
1667 push hl ;save I register
1668
1669 if CPU_Z180
1670 ld a,0f3h ;DI
1671 jp po,l0fe6h
1672 ld a,0fbh ;EI
1673 else ;NMOS Z80 design flaw
1674 call getiff ;return Carry set, if INTs are disabled.
1675 ld a,0f3h ;DI
1676 jr c,l0fe6h
1677 ld a,0fbh ;EI
1678 endif
1679 l0fe6h:
1680 ld (reg.iff),a
1681 ld hl,ivtab
1682 ld a,h
1683 ld i,a
1684 call ddtei
1685 ex af,af'
1686 push af
1687 exx
1688 push bc
1689 push de
1690 push hl
1691 call bp.unset
1692 if CPU_Z180
1693 in0 a,(itc)
1694 jp p,l1017h
1695 res TRAP,a
1696 out0 (itc),a
1697 bit UFO,a
1698 jr z,l1011h
1699 ld hl,(REG.PC)
1700 dec hl
1701 ld (REG.PC),hl
1702 l1011h:
1703 ld hl,MSG_trap
1704 call PSTR
1705 l1017h:
1706 endif
1707
1708 ld a,(XBFE8)
1709 dec a
1710 jr z,l1051h
1711 call inchar
1712 jr c,l102eh
1713 call sub_1059h
1714 and a
1715 jp z,l1183h
1716 and 083h
1717 jp z,l284ah
1718 l102eh:
1719 call sub_0e68h
1720 call prnt_cpustat
1721 jp DDTZML
1722
1723 if CPU_Z180
1724 MSG_trap:
1725 DB CR,LF,'Undefined opcode trap'
1726 DB CR,LF,0
1727 endif
1728
1729 l1051h:
1730 ld (XBFE8),a
1731 ld c,007h
1732 jp l119fh
1733 sub_1059h:
1734 ld a,080h
1735 ex af,af'
1736 sub a
1737 ld (XA747),a
1738 ld b,BP_CNT
1739 ld ix,bp_tab
1740 l1066h:
1741 ld a,(ix+000h)
1742 and 007h
1743 jr z,l107eh
1744 ld e,(ix+002h)
1745 ld d,(ix+003h)
1746 ld hl,(REG.PC)
1747 call CP.HL.DE
1748 push bc
1749 call z,sub_1087h
1750 pop bc
1751 l107eh:
1752 ld de,BP_SIZE
1753 add ix,de
1754 djnz l1066h
1755 ex af,af'
1756 ret
1757 sub_1087h:
1758 ex af,af'
1759 res 7,a
1760 ex af,af'
1761 ld e,(ix+006h)
1762 ld d,(ix+007h)
1763 ld a,d
1764 or e
1765 ld hl,0ffffh
1766 call nz,EXPR
1767 ld a,h
1768 or l
1769 jr z,l10aeh
1770 ld e,(ix+004h)
1771 ld d,(ix+005h)
1772 dec de
1773 ld a,d
1774 or e
1775 jr z,l10b9h
1776 ld (ix+004h),e
1777 ld (ix+005h),d
1778 l10aeh:
1779 bit 4,(ix+000h)
1780 ret z
1781 ld a,001h
1782 ld (XA747),a
1783 ret
1784 l10b9h:
1785 ex af,af'
1786 or (ix+000h)
1787 ex af,af'
1788 ret
1789
1790 bp.unset:
1791 ld b,BP_CNT
1792 ld ix,bp_tab
1793 l10c5h:
1794 bit 5,(ix+000h)
1795 res 5,(ix+000h)
1796 jr z,l10e7h
1797 ld l,(ix+002h)
1798 ld h,(ix+003h)
1799 ld a,(ddtrst)
1800 comst
1801 cp (hl)
1802 comend
1803 jr nz,l10e7h
1804 ld a,(ix+001h)
1805 comst
1806 ld (hl),a
1807 comend
1808 l10e7h:
1809 res 3,(ix+000h)
1810 ld de,BP_SIZE
1811 add ix,de
1812 djnz l10c5h
1813 ret
1814 sub_10f3h:
1815 ld b,BP_CNT
1816 ld ix,bp_tab
1817 l10f9h:
1818 ld a,(ix+000h)
1819 and 003h
1820 jr z,l110dh
1821 ld e,(ix+002h)
1822 ld d,(ix+003h)
1823 ld hl,(REG.PC)
1824 call CP.HL.DE
1825 ret z
1826 l110dh:
1827 ld de,BP_SIZE
1828 add ix,de
1829 djnz l10f9h
1830 sub a
1831 inc a
1832 ret
1833 sub_1117h:
1834 call sub_0f68h
1835 ld (ix+004h),001h
1836 ld (ix+005h),000h
1837 ld (ix+002h),l
1838 ld (ix+003h),h
1839 ld (ix+006h),000h
1840 ld (ix+007h),000h
1841 ld a,(XBFE8)
1842 and a
1843 ld a,008h
1844 jr nz,l113ah
1845 ld a,004h
1846 l113ah:
1847 ld (ix+000h),a
1848 ret
1849
1850 bp.set:
1851 ld b,BP_CNT
1852 ld ix,bp_tab
1853 l1144h:
1854 ld a,(ix+000h)
1855 and c
1856 jr z,l117bh
1857 set 5,(ix+000h)
1858 ld l,(ix+002h)
1859 ld h,(ix+003h)
1860
1861
1862 ld a,(ddtrst)
1863 comst
1864 ld e,(hl)
1865 ld (hl),a
1866 comend
1867 ld (ix+001h),e
1868 and 038h
1869 ld h,0
1870 ld l,a
1871 ld de,bpent
1872 comst ;
1873 ld (hl),0c3h
1874 inc hl
1875 ld (hl),e
1876 inc hl
1877 ld (hl),d
1878 comend
1879
1880
1881 l117bh:
1882 ld de,BP_SIZE
1883 add ix,de
1884 djnz l1144h
1885 ret
1886
1887 l1183h:
1888 sub a
1889 ld (XBFE8),a
1890 ld a,(XA747)
1891 and a
1892 call nz,prnt_cpustat
1893 call sub_10f3h
1894 ld c,007h
1895 jr nz,l119fh
1896 ld a,001h
1897 ld (XBFE8),a
1898 call sub_26e7h
1899 ld c,008h
1900 l119fh:
1901 call bp.set
1902 ld sp,$stack ;11a2 set/restore user cpu state
1903 pop hl
1904 pop de
1905 pop bc
1906 pop af
1907 exx
1908 ex af,af'
1909 pop af
1910 ld i,a
1911 pop iy
1912 pop ix
1913 pop de
1914 pop bc
1915 if ROMSYS
1916 pop hl
1917 ld a,l
1918 and M_MWI
1919 ld l,a
1920 di
1921 in0 a,(dcntl)
1922 and ~M_MWI
1923 or l
1924 ld l,a
1925 ld a,h
1926 else
1927 pop hl
1928 di
1929 endif
1930 jp $go ;11c2 common ram, switch banks and go to user prog
1931
1932 sub_11c5h:
1933 ld a,(ix+000h)
1934 and 003h
1935 ret nz
1936 ld e,(ix+006h)
1937 ld d,(ix+007h)
1938 ld a,d
1939 or e
1940 ret z
1941 push bc
1942 ld h,d
1943 ld l,e
1944 sub a
1945 ld (ix+006h),a
1946 ld (ix+007h),a
1947 ld bc,0ffffh
1948 cpir
1949 l11e3h:
1950 push de
1951 ld de,(sexp1)
1952 call CP.HL.DE
1953 pop de
1954 jr nc,l11f9h
1955 call sub_11ffh
1956 l11f1h:
1957 ld a,(hl)
1958 ldi
1959 and a
1960 jr nz,l11f1h
1961 jr l11e3h
1962 l11f9h:
1963 ld (sexp1),de
1964 pop bc
1965 ret
1966 sub_11ffh:
1967 ld iy,bp_tab
1968 push de
1969 l1204h:
1970 ld e,(iy+006h)
1971 ld d,(iy+007h)
1972 call CP.HL.DE
1973 jr z,l1216h
1974 ld de,BP_SIZE
1975 add iy,de
1976 jr l1204h
1977 l1216h:
1978 pop de
1979 ld (iy+006h),e
1980 ld (iy+007h),d
1981 ret
1982
1983 CMD.Y:
1984 call get.decdigit
1985 jr c,l122fh
1986 inc de
1987 push af
1988 call assert_eol
1989 pop af
1990 call sub_1248h
1991 jp l127ch
1992 l122fh:
1993 call assert_eol
1994 xor a
1995 l1233h:
1996 push af
1997 call sub_1248h
1998 call outbl4
1999 pop af
2000 inc a
2001 bit 0,a
2002 push af
2003 call z,CRLF
2004 pop af
2005 cp LF
2006 jr c,l1233h
2007 ret
2008
2009 sub_1248h:
2010 ld c,a
2011 ld b,0
2012 add a,'0'+080h
2013 ld de,msg.Y+1
2014 ld (de),a
2015 dec de
2016 ld hl,reg.Y
2017 add hl,bc
2018 add hl,bc
2019 ex de,hl
2020 ld c,003h
2021 jp l129ah
2022
2023 CMD.X:
2024 call SKIPBL
2025 call sub_1315h
2026 jp nc,l0d41h
2027 call assert_eol
2028 ld a,b
2029 cp 01fh
2030 jr z,l12c6h
2031 cp 020h
2032 jr z,l12b6h
2033 ex de,hl
2034 ld hl,b_0x132A_start
2035 call sub_0a48h
2036 l1279h:
2037 call l129ah
2038 l127ch:
2039 call OUTBL
2040 push de
2041 push bc
2042 call INLINE
2043 call SKIPBL
2044 jr z,l1297h
2045 call get_arg
2046 ld b,h
2047 ld c,l
2048 pop af
2049 pop hl
2050 ld (hl),c
2051 bit 0,a
2052 ret z
2053 inc hl
2054 ld (hl),b
2055 ret
2056 l1297h:
2057 pop af
2058 pop hl
2059 ret
2060 l129ah:
2061 ld b,c
2062 call PSTR
2063 ld a,'='
2064 call OUTCHAR
2065 ld a,(de)
2066 bit 0,b
2067 jp z,out.hex
2068 ld l,a
2069 inc de
2070 ld a,(de)
2071 dec de
2072 ld h,a
2073 bit 1,b
2074 jp z,out.hl
2075 jp out.hl.@
2076
2077 l12b6h:
2078 call prnt_f
2079 ld a,0f3h
2080 ld (reg.iff),a
2081 scf
2082 call sub_12d1h
2083 ld (reg.f),a
2084 ret
2085
2086 l12c6h:
2087 call prnt_f2
2088 and a
2089 call sub_12d1h
2090 ld (reg.f2),a
2091 ret
2092
2093 sub_12d1h:
2094 ex af,af'
2095 ld b,000h
2096 call outbl
2097 call assert_eol
2098 call inline
2099 l12ddh:
2100 call skipbl
2101 ld a,b
2102 ret z
2103 push bc
2104 ld hl,tab_pr_flags
2105 call lookupch
2106 jp nc,error
2107 ld a,b
2108 cp 008h
2109 jr z,l12feh
2110 inc b
2111 ld a,001h
2112 jr l12f7h
2113 l12f6h:
2114 rlca
2115 l12f7h:
2116 djnz l12f6h
2117 pop bc
2118 or b
2119 ld b,a
2120 jr l12ddh
2121 l12feh:
2122 ex af,af'
2123 jp nc,ERROR
2124 ex af,af'
2125 ld a,0FBh
2126 ld (reg.iff),a
2127 pop bc
2128 jr l12ddh
2129
2130 tab_pr_flags:
2131 db 'CNV H ZSE'
2132 db 0
2133
2134 sub_1315h:
2135 call sub_0a0eh
2136 ret nc
2137 ld a,b
2138 add a,b
2139 add a,b
2140 ld hl,b_0x136C_start
2141 call ADD_HL_A
2142 ld c,(hl)
2143 inc hl
2144 ld a,(hl)
2145 inc hl
2146 ld h,(hl)
2147 ld l,a
2148 scf
2149 ret
2150
2151 b_0x132A_start:
2152 if ROMSYS
2153 DC 'ROMSEL'
2154 endif
2155 if CPU_Z180
2156 DC 'CBAR'
2157 DC 'BBR'
2158 else
2159 DC 'BNK'
2160 endif
2161 DC 'BC'''
2162 DC 'DE'''
2163 DC 'HL'''
2164 DC 'BC'
2165 DC 'DE'
2166 DC 'HL'
2167 DC 'A'''
2168 DC 'B'''
2169 DC 'C'''
2170 DC 'D'''
2171 DC 'E'''
2172 DC 'H'''
2173 DC 'L'''
2174 DC 'A'
2175 DC 'B'
2176 DC 'C'
2177 DC 'D'
2178 DC 'E'
2179 DC 'H'
2180 DC 'L'
2181 DC 'IX'
2182 DC 'IY'
2183 DC 'SP'
2184 DC 'PC'
2185 DC 'X'
2186 DC 'Y'
2187 DC 'S'
2188 DC 'P'
2189 DC 'I'
2190 DC 'F'''
2191 DC 'F'
2192 DB 0
2193 b_0x136C_start:
2194 if ROMSYS
2195 defb 000h
2196 defw uromen
2197 endif
2198 if CPU_Z180
2199 defb 000h
2200 defw ucbar
2201 defb 000h
2202 defw ubbr
2203 else
2204 defb 000h
2205 defw ubnk
2206 endif
2207 defb 003h
2208 defw reg.c2
2209 defb 003h
2210 defw reg.e2
2211 defb 003h
2212 defw reg.l2
2213 defb 003h
2214 defw reg.c
2215 defb 003h
2216 defw reg.e
2217 defb 003h
2218 defw reg.l
2219 defb 000h
2220 defw reg.a2
2221 defb 000h
2222 defw reg.b2
2223 defb 000h
2224 defw reg.c2
2225 defb 000h
2226 defw reg.d2
2227 defb 000h
2228 defw reg.e2
2229 defb 000h
2230 defw reg.h2
2231 defb 000h
2232 defw reg.l2
2233 defb 000h
2234 defw reg.a
2235 defb 000h
2236 defw reg.b
2237 defb 000h
2238 defw reg.c
2239 defb 000h
2240 defw reg.d
2241 defb 000h
2242 defw reg.e
2243 defb 000h
2244 defw reg.h
2245 defb 000h
2246 defw reg.l
2247 defb 003h
2248 defw reg.ix
2249 defb 003h
2250 defw reg.iy
2251 defb 003h
2252 defw reg.sp
2253 defb 003h
2254 defw reg.pc
2255 defb 003h
2256 defw reg.ix
2257 defb 003h
2258 defw reg.iy
2259 defb 003h
2260 defw reg.sp
2261 defb 003h
2262 defw reg.pc
2263 defb 000h
2264 defw reg.i
2265 defb 000h
2266 defw reg.f2
2267 defb 000h
2268 defw reg.f
2269 CMD.S:
2270 ld hl,(lst.S)
2271 call get_lastarg_def
2272 l13d8h:
2273 ld (lst.S),hl
2274 call out.hl.@
2275 call OUTBL
2276 comst
2277 ld a,(hl)
2278 comend
2279 call out.hex
2280 call outbl2
2281 call INLINE
2282 call SKIPBL
2283 inc hl
2284 jr z,l13d8h
2285 dec hl
2286 inc de
2287 cp '.'
2288 jp z,assert_eol
2289 cp '-'
2290 jr nz,l1406h
2291 ld a,(de)
2292 or a
2293 dec hl
2294 jr z,l13d8h
2295 inc hl
2296 l1406h:
2297 dec de
2298 call get_bytes_m
2299 jr l13d8h
2300
2301 CMD.@:
2302 call assert_eol
2303 ld hl,MSG_at
2304 ld de,offs.@
2305 ld c,001h
2306 jp l1279h
2307 MSG_at:
2308 dc '@'
2309
2310 CMD.I:
2311 ld hl,CMD.I
2312 ld (CMD_RPT),hl
2313 ld hl,(lst.IP)
2314 call get_lastarg_def
2315 ld (lst.IP),hl
2316 ld b,h
2317 ld c,l
2318 if CPU_Z180
2319 ld a,b
2320 or a
2321 jr nz,l1442h
2322 ld a,c
2323 ld hl,ucbar
2324 cp cbar
2325 jr z,l143fh
2326 ld hl,ubbr
2327 cp bbr
2328 jr nz,l1442h
2329 l143fh:
2330 ld a,(hl)
2331 jr l1444h
2332 l1442h:
2333 endif
2334 in a,(c)
2335 l1444h:
2336 push af
2337 call out.hex
2338 call outbl4
2339 pop af
2340 call out.bin.b
2341 jp CRLF
2342 CMD.O:
2343 ld hl,CMD.O
2344 ld (CMD_RPT),hl
2345 ld hl,(lst.OD)
2346 call get_arg_def
2347 ld a,l
2348 ld (lst.OD),a
2349 push af
2350 call skip_to_nextarg
2351 ld hl,(lst.OP)
2352 call get_lastarg_def
2353 ld (lst.OP),hl
2354 ld b,h
2355 ld c,l
2356 if CPU_Z180
2357 ld a,b
2358 or a
2359 jr nz,l1489h
2360 ld a,c
2361 ld hl,ucbar
2362 cp cbar
2363 jr z,l148dh
2364 ld hl,ubbr
2365 cp bbr
2366 jr z,l148dh
2367 cp cbr
2368 jp z,ERROR
2369 l1489h:
2370 endif
2371 pop af
2372 out (c),a
2373 ret
2374 if CPU_Z180
2375 l148dh:
2376 pop af
2377 ld (hl),a
2378 ret
2379 endif
2380
2381 CMD.V:
2382 call get_arg3 ;1490 get from, size, to
2383 cmp_mem:
2384 push bc
2385 comst
2386 ld a,(de)
2387 ld b,(hl)
2388 comend
2389 cp b
2390 jr z,l14bah
2391 ld c,a
2392 call out.hl.@
2393 call OUTBL
2394 ld a,b
2395 call out.hex
2396 call outbl2
2397 ld a,c
2398 call out.hex
2399 call OUTBL
2400 ex de,hl
2401 call out.hl.@
2402 ex de,hl
2403 call CRLF
2404 l14bah:
2405 pop bc
2406 inc hl
2407 inc de
2408 dec bc
2409 ld a,b
2410 or c
2411 jr nz,cmp_mem
2412 ret
2413
2414 CMD.M:
2415 ld a,(de)
2416 cp 'V'
2417 jr nz,bm_nv
2418 inc de
2419 bm_nv:
2420 push af ;14c9 save 'V' flag
2421 call get_arg3
2422 push hl
2423 push de
2424 push bc
2425 call CP.HL.DE
2426 jr nc,bm_mvdown
2427 add hl,bc
2428 ex de,hl
2429 add hl,bc
2430 ex de,hl
2431 dec hl
2432 dec de
2433 comst
2434 lddr
2435 comend
2436 jr bm_done
2437 bm_mvdown:
2438 comst
2439 ldir
2440 comend
2441 bm_done:
2442 pop bc
2443 pop de
2444 pop hl
2445 pop af
2446 jr z,cmp_mem ;14ed validate?
2447 ret
2448 CMD.H:
2449 call EXPR
2450 jp c,l173ch
2451 call skip_to_nextarg
2452 push hl
2453 call EXPR
2454 push af
2455 call assert_eol
2456 pop af
2457 ex de,hl
2458 pop hl
2459 jr c,l1511h
2460 push hl
2461 push de
2462 add hl,de
2463 call l1511h
2464 pop de
2465 pop hl
2466 and a
2467 sbc hl,de
2468 l1511h:
2469 call out.hl ;1511 val
2470 call outbl2
2471 call sub_0928h ;1517 -val
2472 call outbl4
2473 call out.hl.dec ;151d dec
2474 call outbl2
2475 call out.hl.decm ;1523 -dec
2476 call outbl4
2477 call out.bin.w ;1529 bin
2478 call outbl2
2479 ld a,l
2480 call out.ascii
2481 jp CRLF
2482
2483 CMD.Q:
2484 ld a,(de)
2485 sub 'J'
2486 ld (lst.Qj),a
2487 jr nz,l153fh
2488 inc de
2489 l153fh:
2490 call get_arg_range
2491 push bc
2492 push hl
2493 call sub_15a7h
2494 pop hl
2495 l1548h:
2496 call sub_1594h
2497 jr nz,l1562h
2498 push bc
2499 push hl
2500 ld a,(lst.Qj)
2501 or a
2502 jr nz,l1559h
2503 ld bc,-8
2504 add hl,bc
2505 l1559h:
2506 ld bc,MEMDUMP_CNT
2507 and a
2508 call memdump
2509 pop hl
2510 pop bc
2511 l1562h:
2512 inc hl
2513 ex (sp),hl
2514 dec hl
2515 ld a,h
2516 or l
2517 ex (sp),hl
2518 jr nz,l1548h
2519 pop bc
2520 ret
2521
2522 CMD.Z:
2523 call get_arg_range
2524 push bc
2525 push hl
2526 call sub_15a7h
2527 ld a,b
2528 pop hl
2529 pop bc
2530 push hl
2531 ex de,hl
2532 l1579h:
2533 push af
2534 ld a,(hl)
2535 comst
2536 ld (de),a
2537 comend
2538 pop af
2539 inc de
2540 cpi
2541 jp po,l1592h
2542 dec a
2543 jr nz,l1579h
2544 pop hl
2545 comst
2546 ldir
2547 comend
2548 ret
2549 l1592h:
2550 pop hl
2551 ret
2552
2553 sub_1594h:
2554 push hl
2555 push de
2556 push bc
2557 l1597h:
2558 ld a,(de)
2559 comst
2560 cp (hl)
2561 comend
2562 jr nz,l15a3h
2563 inc de
2564 inc hl
2565 djnz l1597h
2566 l15a3h:
2567 pop bc
2568 pop de
2569 pop hl
2570 ret
2571
2572 sub_15a7h:
2573 ld hl,ci.buf+1
2574 call get_bytes
2575 ld de,ci.buf+1
2576 and a
2577 sbc hl,de
2578 ld b,l
2579 ret nz
2580 jp ERROR
2581
2582 get_bytes:
2583 db 0e6h ;15b8 and 037h (clear carry, skip next opc)
2584 get_bytes_m:
2585 scf
2586 l15bah:
2587 push af
2588 call skip_to_nextarg
2589 cp 'W'
2590 jr nz,l15d9h
2591 inc de
2592 push hl
2593 call sub_0a68h
2594 ex de,hl
2595 pop bc
2596 pop af
2597 push af
2598 push bc
2599 ex (sp),hl
2600 jr nc,l15d3h
2601 comst
2602 l15d3h:
2603 ld (hl),e
2604 comend
2605 inc hl
2606 ld c,d
2607 pop de
2608 jr l15e5h
2609 l15d9h:
2610 cp ''''
2611 jr z,l15f1h
2612 push hl
2613 call EXPR
2614 ld c,l
2615 pop hl
2616 jr c,l1626h
2617 l15e5h:
2618 pop af
2619 push af
2620 jr nc,l15edh
2621 comst
2622 l15edh:
2623 ld (hl),c
2624 comend
2625 inc hl
2626 jr l161eh
2627 l15f1h:
2628 inc de
2629 ld a,(de)
2630 cp ''''
2631 jr z,l1607h
2632 or a
2633 jr z,l1626h
2634 l15fah:
2635 ld c,a
2636 pop af
2637 push af
2638 jr nc,l1603h
2639 comst
2640 l1603h:
2641 ld (hl),c
2642 comend
2643 inc hl
2644 jr l15f1h
2645 l1607h:
2646 inc de
2647 ld a,(de)
2648 cp ''''
2649 jr z,l15fah
2650 cp '.'
2651 jr nz,l161eh
2652 inc de
2653 dec hl
2654 pop af
2655 push af
2656 jr nc,l161bh
2657 comst
2658 l161bh:
2659 set 7,(hl)
2660 comend
2661 inc hl
2662 l161eh:
2663 pop af
2664 jr nc,l15bah
2665 ld (lst.S),hl
2666 jr l15bah
2667
2668 l1626h:
2669 pop af
2670 ret nc
2671 ld (lst.S),hl
2672 ret
2673
2674 CMD.D:
2675 ld hl,CMD.D
2676 ld (CMD_RPT),hl
2677 ld hl,(lst.D)
2678 ld bc,00080h
2679 call sub_0a82h
2680 scf
2681 memdump:
2682 push bc
2683 push de
2684 push hl
2685 ex af,af'
2686 l1640h:
2687 call out.hl.@
2688 call z,outbl2
2689 call OUTBL
2690 ld de,0
2691 l164ch:
2692 comst
2693 ld a,(hl)
2694 comend
2695 inc hl
2696 call out.hex
2697 call OUTBL
2698 dec bc
2699 inc e
2700 ld a,e
2701 cp 010h
2702 jr z,l1668h
2703 and 003h
2704 call z,OUTBL
2705 ld a,b
2706 or c
2707 jr nz,l164ch
2708 l1668h:
2709 call OUTBL
2710 and a
2711 sbc hl,de
2712 l166eh:
2713 comst
2714 ld a,(hl)
2715 comend
2716 call sub_168fh
2717 call OUTCHAR
2718 inc hl
2719 dec e
2720 jr nz,l166eh
2721 ex af,af'
2722 jr nc,l1683h
2723 ld (lst.D),hl
2724 l1683h:
2725 ex af,af'
2726 call CRLF
2727 ld a,b
2728 or c
2729 jr nz,l1640h
2730 pop hl
2731 pop de
2732 pop bc
2733 ret
2734 sub_168fh:
2735 and 07fh
2736 cp 07fh
2737 jr z,l1698h
2738 cp 020h
2739 ret nc
2740 l1698h:
2741 ld a,02eh
2742 ret
2743
2744 ; Read Intel Hex File from console.
2745 CMD.R:
2746 ld hl,0
2747 call get_lastarg_def ;169e get offset from command line
2748 push hl
2749 ld hl,0
2750 ld (HILOD),hl
2751 w_recstart:
2752 call i.getchar
2753 jr z,l16deh
2754 cp ':'
2755 jr nz,w_recstart
2756 ld c,0 ;16b1 init checksum
2757 call i.gethexbyte ;16b3 record len
2758 ld b,a
2759 call i.gethexbyte ;16b7 address high
2760 ld h,a
2761 call i.gethexbyte ;16bb address low
2762 ld l,a
2763 call i.gethexbyte ;16bf record type (ignored)
2764 ld a,b
2765 and a ;16c3 record len == 0?
2766 jr z,l16deh
2767 l16c6h:
2768 call i.gethexbyte
2769 pop de ;16c9 offset
2770 push de
2771 push hl
2772 add hl,de
2773 call i.storebyte
2774 pop hl
2775 inc hl
2776 djnz l16c6h ;16d2 repeat for record len
2777 call i.gethexbyte ;16d4 checksum
2778 ld a,c
2779 and a
2780 jp nz,ERROR ;16d9 exit if checksum error
2781 jr w_recstart ;16dc next record
2782 l16deh:
2783 pop hl
2784 call i.gethexbyte
2785 jp l173fh
2786
2787 i.gethexbyte:
2788 call sub_16f6h
2789 rlca
2790 rlca
2791 rlca
2792 rlca
2793 ld d,a
2794 call sub_16f6h
2795 add a,d
2796 ld d,a
2797 add a,c
2798 ld c,a
2799 ld a,d
2800 ret
2801
2802 sub_16f6h:
2803 call i.getchar
2804 jr z,l16ffh
2805 call sub_0d26h
2806 ret nc
2807 l16ffh:
2808 jp ERROR
2809
2810 i.getchar:
2811 call $ci
2812 cp 01ah
2813 ret
2814
2815 i.storebyte:
2816 push af
2817 push de
2818 ld de,TPA ;170a lowest allowed load address
2819 call CP.HL.DE
2820 jp c,ERROR
2821 ld de,$stcka ;1713 highest allowed load address
2822 call CP.HL.DE
2823 jp nc,ERROR
2824 ld de,(HILOD)
2825 call CP.HL.DE
2826 jr c,l1728h
2827 ld (HILOD),hl
2828 l1728h:
2829 ld de,(MAXLOD)
2830 call CP.HL.DE
2831 jr c,l1734h
2832 ld (MAXLOD),hl
2833 l1734h:
2834 pop de
2835 pop af
2836 comst
2837 ld (hl),a ;173a store byte
2838 comend
2839 ret
2840
2841 l173ch:
2842 call assert_eol
2843 l173fh:
2844 ld hl,MSG_high
2845 call PSTR
2846 ld hl,(HILOD)
2847 call out.hl
2848 ld hl,MSG_max
2849 call PSTR
2850 ld hl,(MAXLOD)
2851 call out.hl
2852 jp CRLF
2853
2854 MSG_high:
2855 DC 'High = '
2856 MSG_max:
2857 DC ' Max = '
2858
2859 CMD.A:
2860 ld hl,(lst.A)
2861 call get_lastarg_def
2862 push hl
2863 pop iy
2864 ld hl,l17c4h
2865 ld (CMD_ERR),hl
2866 ld (XB068),sp
2867 l177ch:
2868 push iy
2869 pop hl
2870 ld (lst.A),hl
2871 ld (OFFS.pc),hl
2872 push hl
2873 call sub_1f3fh
2874 pop iy
2875 ld c,b
2876 ld de,(offs.@)
2877 ld a,d
2878 or e
2879 ld b,011h
2880 jr z,l1798h
2881 ld b,019h
2882 l1798h:
2883 call OUTBL
2884 ld a,(CON.COL)
2885 cp b
2886 jr c,l1798h
2887 push bc
2888 call INLINE
2889 pop bc
2890 call SKIPBL
2891 cp '.'
2892 ret z
2893 cp '-'
2894 jr nz,l17b6h
2895 ld iy,(XB06C)
2896 jr l177ch
2897 l17b6h:
2898 and a
2899 call nz,sub_17cdh
2900 ld (XB06C),iy
2901 ld b,0
2902 add iy,bc
2903 jr l177ch
2904 l17c4h:
2905 call l07eah
2906 ld sp,(XB068)
2907 jr l177ch
2908
2909 sub_17cdh:
2910 call SKIPBL
2911 ld hl,t_MNEMONICS
2912 call sub_0a15h
2913 jp nc,ERROR
2914 call SKIPBL
2915 push de
2916 ld a,b
2917 add a,b
2918 add a,b
2919 ld hl,b_0x17EE_start
2920 call ADD_HL_A
2921 ld e,(hl)
2922 inc hl
2923 ld d,(hl)
2924 inc hl
2925 ld b,(hl)
2926 ex de,hl
2927 pop de
2928 jp (hl)
2929
2930 b_0x17EE_start:
2931 defw l1b54h
2932
2933 b_0x17F0_start:
2934 defb 088h
2935
2936 b_0x17F1_start:
2937 defw l1b74h
2938
2939 b_0x17F3_start:
2940 defb 080h
2941
2942 b_0x17F4_start:
2943 defw l1babh
2944
2945 b_0x17F6_start:
2946 defb 0a0h
2947
2948 b_0x17F7_start:
2949 defw l1c14h
2950
2951 b_0x17F9_start:
2952 defb 040h
2953
2954 b_0x17FA_start:
2955 defw l1c38h
2956
2957 b_0x17FC_start:
2958 defb 0c4h
2959
2960 b_0x17FD_start:
2961 defw l1b36h
2962
2963 b_0x17FF_start:
2964 defb 03fh
2965
2966 b_0x1800_start:
2967 defw l1babh
2968
2969 b_0x1802_start:
2970 defb 0b8h
2971
2972 b_0x1803_start:
2973 defw gen.opc.ED2
2974
2975 b_0x1805_start:
2976 defb 0a9h
2977
2978 b_0x1806_start:
2979 defw gen.opc.ED2
2980
2981 b_0x1808_start:
2982 defb 0b9h
2983
2984 b_0x1809_start:
2985 defw gen.opc.ED2
2986
2987 b_0x180B_start:
2988 defb 0a1h
2989
2990 b_0x180C_start:
2991 defw gen.opc.ED2
2992
2993 b_0x180E_start:
2994 defb 0b1h
2995
2996 b_0x180F_start:
2997 defw l1b36h
2998
2999 b_0x1811_start:
3000 defb 02fh
3001
3002 b_0x1812_start:
3003 defw l1b36h
3004
3005 b_0x1814_start:
3006 defb 027h
3007
3008 b_0x1815_start:
3009 defw l1dabh
3010
3011 b_0x1817_start:
3012 defb 005h
3013
3014 b_0x1818_start:
3015 defw l1b36h
3016
3017 b_0x181A_start:
3018 defb 0f3h
3019
3020 b_0x181B_start:
3021 defw l1ca4h
3022
3023 b_0x181D_start:
3024 defb 010h
3025
3026 b_0x181E_start:
3027 defw l1b36h
3028
3029 b_0x1820_start:
3030 defb 0fbh
3031
3032 b_0x1821_start:
3033 defw l1d54h
3034
3035 b_0x1823_start:
3036 defb 0e3h
3037
3038 b_0x1824_start:
3039 defw l1b36h
3040
3041 b_0x1826_start:
3042 defb 0d9h
3043
3044 b_0x1827_start:
3045 defw l1b36h
3046
3047 b_0x1829_start:
3048 defb 076h
3049
3050 b_0x182A_start:
3051 defw l1cbfh
3052
3053 b_0x182C_start:
3054 defb 046h
3055
3056 b_0x182D_start:
3057 defw l1cf8h
3058
3059 b_0x182F_start:
3060 defb 040h
3061
3062 b_0x1830_start:
3063 defw l1dabh
3064
3065 b_0x1832_start:
3066 defb 004h
3067
3068 b_0x1833_start:
3069 defw gen.opc.ED2
3070
3071 b_0x1835_start:
3072 defb 0aah
3073
3074 b_0x1836_start:
3075 defw gen.opc.ED2
3076
3077 b_0x1838_start:
3078 defb 0bah
3079
3080 b_0x1839_start:
3081 defw gen.opc.ED2
3082
3083 b_0x183B_start:
3084 defb 0a2h
3085
3086 b_0x183C_start:
3087 defw gen.opc.ED2
3088
3089 b_0x183E_start:
3090 defb 0b2h
3091
3092 b_0x183F_start:
3093 defw l1c5eh
3094
3095 b_0x1841_start:
3096 defb 0c2h
3097
3098 b_0x1842_start:
3099 defw l1cabh
3100
3101 b_0x1844_start:
3102 defb 020h
3103
3104 b_0x1845_start:
3105 defw l1934h
3106
3107 b_0x1847_start:
3108 defb 040h
3109
3110 b_0x1848_start:
3111 defw gen.opc.ED2
3112
3113 b_0x184A_start:
3114 defb 0a8h
3115
3116 b_0x184B_start:
3117 defw gen.opc.ED2
3118
3119 b_0x184D_start:
3120 defb 0b8h
3121
3122 b_0x184E_start:
3123 defw gen.opc.ED2
3124
3125 b_0x1850_start:
3126 defb 0a0h
3127
3128 b_0x1851_start:
3129 defw gen.opc.ED2
3130
3131 b_0x1853_start:
3132 defb 0b0h
3133
3134 b_0x1854_start:
3135 defw gen.opc.ED2
3136
3137 b_0x1856_start:
3138 defb 044h
3139
3140 b_0x1857_start:
3141 defw l1b36h
3142
3143 b_0x1859_start:
3144 defb 000h
3145
3146 b_0x185A_start:
3147 defw l1babh
3148
3149 b_0x185C_start:
3150 defb 0b0h
3151
3152 b_0x185D_start:
3153 defw gen.opc.ED2
3154
3155 b_0x185F_start:
3156 defb 0bbh
3157
3158 b_0x1860_start:
3159 defw gen.opc.ED2
3160
3161 b_0x1862_start:
3162 defb 0b3h
3163
3164 b_0x1863_start:
3165 defw l1d2ch
3166
3167 b_0x1865_start:
3168 defb 041h
3169
3170 b_0x1866_start:
3171 defw gen.opc.ED2
3172
3173 b_0x1868_start:
3174 defb 0abh
3175
3176 b_0x1869_start:
3177 defw gen.opc.ED2
3178
3179 b_0x186B_start:
3180 defb 0a3h
3181
3182 b_0x186C_start:
3183 defw l1ce4h
3184
3185 b_0x186E_start:
3186 defb 0c1h
3187
3188 b_0x186F_start:
3189 defw l1ce4h
3190
3191 b_0x1871_start:
3192 defb 0c5h
3193
3194 b_0x1872_start:
3195 defw l1c14h
3196
3197 b_0x1874_start:
3198 defb 080h
3199
3200 b_0x1875_start:
3201 defw l1c50h
3202
3203 b_0x1877_start:
3204 defb 0c0h
3205
3206 b_0x1878_start:
3207 defw gen.opc.ED2
3208
3209 b_0x187A_start:
3210 defb 04dh
3211
3212 b_0x187B_start:
3213 defw gen.opc.ED2
3214
3215 b_0x187D_start:
3216 defb 045h
3217
3218 b_0x187E_start:
3219 defw l1bd8h
3220
3221 b_0x1880_start:
3222 defb 010h
3223
3224 b_0x1881_start:
3225 defw l1b36h
3226
3227 b_0x1883_start:
3228 defb 017h
3229
3230 b_0x1884_start:
3231 defw l1bd8h
3232
3233 b_0x1886_start:
3234 defb 000h
3235
3236 b_0x1887_start:
3237 defw l1b36h
3238
3239 b_0x1889_start:
3240 defb 007h
3241
3242 b_0x188A_start:
3243 defw gen.opc.ED2
3244
3245 b_0x188C_start:
3246 defb 06fh
3247
3248 b_0x188D_start:
3249 defw l1bd8h
3250
3251 b_0x188F_start:
3252 defb 018h
3253
3254 b_0x1890_start:
3255 defw l1b36h
3256
3257 b_0x1892_start:
3258 defb 01fh
3259
3260 b_0x1893_start:
3261 defw l1bd8h
3262
3263 b_0x1895_start:
3264 defb 008h
3265
3266 b_0x1896_start:
3267 defw l1b36h
3268
3269 b_0x1898_start:
3270 defb 00fh
3271
3272 b_0x1899_start:
3273 defw gen.opc.ED2
3274
3275 b_0x189B_start:
3276 defb 067h
3277
3278 b_0x189C_start:
3279 defw l1cd5h
3280
3281 b_0x189E_start:
3282 defb 0c7h
3283
3284 b_0x189F_start:
3285 defw l1b54h
3286
3287 b_0x18A1_start:
3288 defb 098h
3289
3290 b_0x18A2_start:
3291 defw l1b36h
3292
3293 b_0x18A4_start:
3294 defb 037h
3295
3296 b_0x18A5_start:
3297 defw l1c14h
3298
3299 b_0x18A7_start:
3300 defb 0c0h
3301
3302 b_0x18A8_start:
3303 defw l1bd8h
3304
3305 b_0x18AA_start:
3306 defb 020h
3307
3308 b_0x18AB_start:
3309 defw l1bd8h
3310
3311 b_0x18AD_start:
3312 defb 028h
3313
3314 b_0x18AE_start:
3315 defw l1bd8h
3316
3317 b_0x18B0_start:
3318 defb 038h
3319
3320 b_0x18B1_start:
3321 defw l1babh
3322
3323 b_0x18B3_start:
3324 defb 090h
3325
3326 b_0x18B4_start:
3327 defw l1babh
3328
3329 b_0x18B6_start:
3330 defb 0a8h
3331
3332 b_0x18B7_start:
3333 defw A.IN0
3334
3335 b_0x18B9_start:
3336 defb 000h
3337
3338 b_0x18BA_start:
3339 defw A.MLT
3340
3341 b_0x18BC_start:
3342 defb 04ch
3343 ld b,e
3344 dec de
3345
3346 b_0x18BF_start:
3347 defb 08bh
3348
3349 b_0x18C0_start:
3350 defw gen.opc.ED2
3351
3352 b_0x18C2_start:
3353 defb 09bh
3354
3355 b_0x18C3_start:
3356 defw gen.opc.ED2
3357
3358 b_0x18C5_start:
3359 defb 083h
3360
3361 b_0x18C6_start:
3362 defw gen.opc.ED2
3363
3364 b_0x18C8_start:
3365 defb 093h
3366
3367 b_0x18C9_start:
3368 defw l18fdh
3369
3370 b_0x18CB_start:
3371 defb 001h
3372
3373 b_0x18CC_start:
3374 defw gen.opc.ED2
3375
3376 b_0x18CE_start:
3377 defb 076h
3378
3379 b_0x18CF_start:
3380 defw l191dh
3381
3382 b_0x18D1_start:
3383 defb 004h
3384
3385 b_0x18D2_start:
3386 defw l192ch
3387
3388 b_0x18D4_start:
3389 defb 074h
3390 A.IN0:
3391 call sub_1e41h
3392 jr nc,l1931h
3393 cp 006h
3394 jr z,l1931h
3395 rlca
3396 rlca
3397 rlca
3398 add a,b
3399 ld b,a
3400 call sub_1ed1h
3401 call sub_1e06h
3402 l18e9h:
3403 call assert_eol
3404 comst
3405 ld (iy+000h),0edh
3406 ld (iy+001h),b
3407 ld (iy+002h),l
3408 comend
3409 ld c,003h
3410 ret
3411 l18fdh:
3412 call sub_1e06h
3413 call sub_1ed1h
3414 call sub_1e41h
3415 jr nc,l1931h
3416 cp 006h
3417 jr z,l1931h
3418 rlca
3419 rlca
3420 rlca
3421 add a,b
3422 ld b,a
3423 jr l18e9h
3424 A.MLT:
3425 call sub_1e2eh
3426 jr nc,l1931h
3427 add a,b
3428 ld b,a
3429 jp gen.opc.ED2
3430 l191dh:
3431 call sub_1e41h
3432 jr nc,l192ah
3433 rlca
3434 rlca
3435 rlca
3436 add a,b
3437 ld b,a
3438 jp gen.opc.ED2
3439 l192ah:
3440 ld b,064h
3441 l192ch:
3442 call sub_1e12h
3443 jr l18e9h
3444 l1931h:
3445 jp ERROR
3446 l1934h:
3447 call sub_1e41h
3448 jp c,l19bfh
3449 call sub_1e68h
3450 jp c,l1a64h
3451 call sub_1e2eh
3452 jp c,l1a93h
3453 call sub_1e50h
3454 jp c,l1af0h
3455 ld a,(de)
3456 cp 049h
3457 jp z,l1b0ch
3458 cp 052h
3459 jp z,l1b14h
3460 cp 028h
3461 jp nz,ERROR
3462 inc de
3463 call sub_1e2eh
3464 jp c,l1b23h
3465 call tst_EXPR
3466 call sub_1ed8h
3467 call sub_1ed1h
3468 call sub_1e2eh
3469 jr c,l19adh
3470 call sub_1e50h
3471 jr nc,l1991h
3472 ld b,022h
3473 l1978h:
3474 call assert_eol
3475 ld a,(pfx.IXY)
3476 l197eh:
3477 comst
3478 ld (iy+000h),a
3479 ld (iy+001h),b
3480 ld (iy+002h),l
3481 ld (iy+003h),h
3482 comend
3483 ld c,004h
3484 ret
3485 l1991h:
3486 ld a,(de)
3487 cp 041h
3488 jp nz,ERROR
3489 inc de
3490 ld b,032h
3491 l199ah:
3492 call assert_eol
3493 comst
3494 ld (iy+000h),b
3495 ld (iy+001h),l
3496 ld (iy+002h),h
3497 comend
3498 ld c,003h
3499 ret
3500 l19adh:
3501 cp 020h
3502 jr z,l19bbh
3503 add a,043h
3504 ld b,a
3505 l19b4h:
3506 call assert_eol
3507 ld a,0edh
3508 jr l197eh
3509 l19bbh:
3510 ld b,022h
3511 jr l199ah
3512 l19bfh:
3513 ld b,a
3514 call sub_1ed1h
3515 call sub_1e41h
3516 jr nc,l19dbh
3517 push af
3518 ld a,b
3519 rlca
3520 rlca
3521 rlca
3522 ld b,a
3523 pop af
3524 add a,b
3525 add a,040h
3526 cp 076h
3527 jp z,ERROR
3528 l19d7h:
3529 ld b,a
3530 jp l1b36h
3531 l19dbh:
3532 call sub_1e68h
3533 jr nc,l1a02h
3534 ld a,b
3535 rlca
3536 rlca
3537 rlca
3538 add a,046h
3539 cp 076h
3540 jp z,ERROR
3541 l19ebh:
3542 ld b,a
3543 call assert_eol
3544 ld a,(pfx.IXY)
3545 comst
3546 ld (iy+000h),a
3547 ld (iy+001h),b
3548 ld (iy+002h),c
3549 comend
3550 ld c,003h
3551 ret
3552 l1a02h:
3553 ld a,(de)
3554 cp 'I'
3555 jr z,l1a15h
3556 cp 'R'
3557 jr nz,l1a21h
3558 ld a,b
3559 cp 007h
3560 jp nz,ERROR
3561 ld b,05fh
3562 jr l1a1dh
3563 l1a15h:
3564 ld a,b
3565 cp 007h
3566 jp nz,ERROR
3567 ld b,057h
3568 l1a1dh:
3569 inc de
3570 jp gen.opc.ED2
3571 l1a21h:
3572 cp '('
3573 jr z,l1a3fh
3574 call sub_1e12h
3575 ld a,b ;1a28 ld r,nn
3576 rlca
3577 rlca
3578 rlca
3579 add a,006h
3580 l1a2eh:
3581 ld b,a
3582 l1a2fh:
3583 call assert_eol
3584 comst
3585 ld (iy+000h),b
3586 ld (iy+001h),l
3587 comend
3588 ld c,002h
3589 ret
3590 l1a3fh:
3591 inc de
3592 ld a,b
3593 cp 007h
3594 jp nz,ERROR
3595 call sub_1e2eh
3596 jr nc,l1a59h
3597 cp 030h
3598 jp nc,ERROR
3599 add a,00ah
3600 ld b,a
3601 call sub_1ed8h
3602 jp l1b36h
3603 l1a59h:
3604 call tst_EXPR
3605 call sub_1ed8h
3606 ld b,03ah
3607 jp l199ah
3608 l1a64h:
3609 call sub_1ed1h
3610 call sub_1e41h
3611 jr nc,l1a76h
3612 cp 006h
3613 jp z,ERROR
3614 add a,070h
3615 jp l19ebh
3616 l1a76h:
3617 call sub_1e12h
3618 call assert_eol
3619 ld a,(pfx.IXY)
3620 comst
3621 ld (iy+000h),a ;1a83 dd/fd
3622 ld (iy+001h),036h
3623 ld (iy+002h),c ;1a8a displacement
3624 ld (iy+003h),l ;1a8d nn
3625 comend
3626 ld c,4
3627 ret
3628 l1a93h:
3629 ld b,a
3630 call sub_1ed1h
3631 ld hl,t_HL.AF
3632 call sub_0a23h
3633 jr c,l1abeh
3634 call sub_1e50h
3635 jr nc,l1ac7h
3636 ld a,b
3637 cp 030h
3638 jr nz,l1b20h
3639 ld b,0f9h
3640 l1aabh:
3641 call assert_eol
3642 ld a,(pfx.IXY)
3643 comst
3644 ld (iy+000h),a
3645 ld (iy+001h),b
3646 comend
3647 ld c,002h
3648 ret
3649 l1abeh:
3650 ld a,b
3651 cp 030h
3652 jr nz,l1b20h
3653 ld b,0f9h
3654 jr l1b36h
3655 l1ac7h:
3656 ld a,(de)
3657 cp 028h
3658 jr nz,l1ae3h
3659 inc de
3660 call tst_EXPR
3661 call sub_1ed8h
3662 ld a,b
3663 cp 020h
3664 jr z,l1adeh
3665 add a,04bh
3666 ld b,a
3667 jp l19b4h
3668 l1adeh:
3669 ld b,02ah
3670 jp l199ah
3671 l1ae3h:
3672 call tst_EXPR
3673 call assert_eol
3674 ld a,001h
3675 add a,b
3676 ld b,a
3677 jp l199ah
3678 l1af0h:
3679 call sub_1ed1h
3680 ld a,(de)
3681 cp 028h
3682 jr nz,l1b04h
3683 inc de
3684 call tst_EXPR
3685 call sub_1ed8h
3686 ld b,02ah
3687 jp l1978h
3688 l1b04h:
3689 call tst_EXPR
3690 ld b,021h
3691 jp l1978h
3692 l1b0ch:
3693 inc de
3694 call sub_1ed1h
3695 ld b,047h
3696 jr l1b1ah
3697 l1b14h:
3698 inc de
3699 call sub_1ed1h
3700 ld b,04fh
3701 l1b1ah:
3702 ld a,(de)
3703 inc de
3704 cp 041h
3705 jr z,gen.opc.ED2
3706 l1b20h:
3707 jp ERROR
3708 l1b23h:
3709 cp 020h
3710 jr nc,l1b20h
3711 add a,002h
3712 ld b,a
3713 call sub_1ed8h
3714 call sub_1ed1h
3715 ld a,(de)
3716 cp 041h
3717 jr nz,l1b20h
3718 inc de
3719 l1b36h:
3720 call assert_eol
3721 comst
3722 ld (iy+000h),b
3723 comend
3724 ld c,001h
3725 ret
3726 gen.opc.ED2:
3727 call assert_eol
3728 comst
3729 ld (iy+000h),0edh
3730 ld (iy+001h),b
3731 comend
3732 ld c,002h
3733 ret
3734 l1b54h:
3735 ld hl,t_HL.AF
3736 call sub_0a23h
3737 jr nc,l1babh
3738 call sub_1ed1h
3739 call sub_1e2eh
3740 jp nc,ERROR
3741 push af
3742 ld a,b
3743 cp 088h
3744 ld b,04ah
3745 jr z,l1b6fh
3746 ld b,042h
3747 l1b6fh:
3748 pop af
3749 add a,b
3750 l1b71h:
3751 ld b,a
3752 jr gen.opc.ED2
3753 l1b74h:
3754 ld hl,t_HL.AF
3755 call sub_0a23h
3756 jr c,l1b9dh
3757 call sub_1e50h
3758 jr nc,l1babh
3759 call sub_1ed1h
3760 ld hl,t_BC.DE.IX.SP
3761 ld a,(pfx.IXY)
3762 cp 0fdh
3763 jr nz,l1b91h
3764 ld hl,t_BC.DE.IY.SP
3765 l1b91h:
3766 call sub_1e2bh
3767 jp nc,ERROR
3768 add a,009h
3769 l1b99h:
3770 ld b,a
3771 jp l1aabh
3772 l1b9dh:
3773 call sub_1ed1h
3774 call sub_1e2eh
3775 jp nc,ERROR
3776 add a,009h
3777 jp l19d7h
3778 l1babh:
3779 ld a,(de)
3780 cp 041h
3781 jr nz,l1bbbh
3782 push de
3783 inc de
3784 call skip_to_nextarg
3785 jr z,l1bbah
3786 pop de
3787 jr l1bbbh
3788 l1bbah:
3789 pop af
3790 l1bbbh:
3791 call sub_1e41h
3792 jr c,l1bceh
3793 call sub_1e68h
3794 jr c,l1bd2h
3795 call sub_1e12h
3796 ld a,b
3797 add a,046h
3798 jp l1a2eh
3799 l1bceh:
3800 add a,b
3801 jp l19d7h
3802 l1bd2h:
3803 ld a,b
3804 add a,006h
3805 jp l19ebh
3806 l1bd8h:
3807 call sub_1e41h
3808 jr c,l1c01h
3809 call sub_1e68h
3810 jp nc,ERROR
3811 ld a,b
3812 add a,006h
3813 ld b,a
3814 l1be7h:
3815 call assert_eol
3816 ld a,(pfx.IXY)
3817 comst
3818 ld (iy+000h),a
3819 ld (iy+001h),0cbh
3820 ld (iy+002h),c
3821 ld (iy+003h),b
3822 comend
3823 ld c,004h
3824 ret
3825 l1c01h:
3826 add a,b
3827 l1c02h:
3828 ld b,a
3829 call assert_eol
3830 comst
3831 ld (iy+000h),0cbh
3832 ld (iy+001h),b
3833 comend
3834 ld c,002h
3835 ret
3836 l1c14h:
3837 call sub_1de6h
3838 call sub_1ed1h
3839 call sub_1e41h
3840 jr c,l1c2fh
3841 call sub_1e68h
3842 jp nc,ERROR
3843 ld a,l
3844 rlca
3845 rlca
3846 rlca
3847 add a,006h
3848 add a,b
3849 ld b,a
3850 jr l1be7h
3851 l1c2fh:
3852 add a,b
3853 ld b,a
3854 ld a,l
3855 rlca
3856 rlca
3857 rlca
3858 add a,b
3859 jr l1c02h
3860 l1c38h:
3861 push de
3862 call sub_1eb8h
3863 jr nc,l1c47h
3864 add a,b
3865 ld b,a
3866 call skip_to_nextarg
3867 jr z,l1c49h
3868 pop de
3869 push de
3870 l1c47h:
3871 ld b,0cdh
3872 l1c49h:
3873 pop af
3874 call tst_EXPR
3875 jp l199ah
3876 l1c50h:
3877 call sub_1eb8h
3878 jr nc,l1c59h
3879 add a,b
3880 ld b,a
3881 jr l1c5bh
3882 l1c59h:
3883 ld b,0c9h
3884 l1c5bh:
3885 jp l1b36h
3886 l1c5eh:
3887 push de
3888 call sub_1eb8h
3889 jr c,l1c71h
3890 l1c64h:
3891 pop de
3892 ld hl,b_0x1C97_start
3893 call sub_0a15h
3894 jr c,l1c7fh
3895 ld b,0c3h
3896 jr l1c79h
3897 l1c71h:
3898 add a,b
3899 ld b,a
3900 call skip_to_nextarg
3901 jr nz,l1c64h
3902 pop af
3903 l1c79h:
3904 call tst_EXPR
3905 jp l199ah
3906 l1c7fh:
3907 call assert_eol
3908 ld a,b
3909 and a
3910 jr nz,l1c8bh
3911 ld b,0e9h
3912 jp l1b36h
3913 l1c8bh:
3914 ld b,0ddh
3915 dec a
3916 jr z,l1c92h
3917 ld b,0fdh
3918 l1c92h:
3919 ld l,0e9h
3920 jp l1a2fh
3921
3922 b_0x1C97_start:
3923 DC '(HL)'
3924 DC '(IX)'
3925 DC '(IY)'
3926 DB 0
3927
3928 l1ca4h:
3929 call skip_to_nextarg
3930 ld b,010h
3931 jr l1cb9h
3932 l1cabh:
3933 call sub_1ebfh
3934 jr c,l1cb4h
3935 ld b,018h
3936 jr l1cb9h
3937 l1cb4h:
3938 add a,b
3939 ld b,a
3940 call sub_1ed1h
3941 l1cb9h:
3942 call sub_1defh
3943 jp l1a2fh
3944 l1cbfh:
3945 call sub_1e12h
3946 ld a,l
3947 cp 003h
3948 jr nc,l1d23h
3949 and a
3950 jr z,l1cd2h
3951 ld b,056h
3952 cp 001h
3953 jr z,l1cd2h
3954 ld b,05eh
3955 l1cd2h:
3956 jp gen.opc.ED2
3957 l1cd5h:
3958 call sub_1e12h
3959 ld a,l
3960 push af
3961 add a,b
3962 ld b,a
3963 pop af
3964 and 0c7h
3965 jr nz,l1d23h
3966 jp l1b36h
3967 l1ce4h:
3968 call sub_1e50h
3969 jr c,l1cf2h
3970 call sub_1e25h
3971 jr nc,l1d23h
3972 add a,b
3973 jp l19d7h
3974 l1cf2h:
3975 ld a,b
3976 add a,020h
3977 jp l1b99h
3978 l1cf8h:
3979 call sub_1e41h
3980 jr nc,l1d23h
3981 cp 006h
3982 jr z,l1d23h
3983 rlca
3984 rlca
3985 rlca
3986 add a,b
3987 ld b,a
3988 cp 078h
3989 jr nz,l1d1ah
3990 call sub_1ed1h
3991 call sub_1d26h
3992 jr c,l1d20h
3993 call sub_1e06h
3994 ld b,0dbh
3995 jp l1a2fh
3996 l1d1ah:
3997 call sub_1ed1h
3998 call sub_1d26h
3999 l1d20h:
4000 jp c,gen.opc.ED2
4001 l1d23h:
4002 jp ERROR
4003 sub_1d26h:
4004 ld hl,t__C_
4005 jp sub_0a23h
4006 l1d2ch:
4007 call sub_1d26h
4008 jr nc,l1d44h
4009 call sub_1ed1h
4010 call sub_1e41h
4011 jr nc,l1d23h
4012 cp 006h
4013 jr z,l1d23h
4014 rlca
4015 rlca
4016 rlca
4017 add a,b
4018 jp l1b71h
4019 l1d44h:
4020 call sub_1e06h
4021 call sub_1ed1h
4022 cp 041h
4023 jr nz,l1d23h
4024 inc de
4025 ld b,0d3h
4026 jp l1a2fh
4027 l1d54h:
4028 ld hl,b_0x1D80_start
4029 call sub_0a15h
4030 jp nc,ERROR
4031 ld c,b
4032 call assert_eol
4033 ld b,000h
4034 ld hl,b_0x1DA1_start
4035 add hl,bc
4036 add hl,bc
4037 ld a,(hl)
4038 comst
4039 ld (iy+000h),a
4040 comend
4041 ld c,001h
4042 inc hl
4043 ld a,(hl)
4044 and a
4045 ret z
4046 comst
4047 ld (iy+001h),a
4048 comend
4049 ld c,002h
4050 ret
4051
4052 b_0x1D80_start:
4053 DC 'AF,AF'''
4054 l1d86h:
4055 DC 'DE,HL'
4056 DC '(SP),HL'
4057 DC '(SP),IX'
4058 DC '(SP),IY'
4059 db 000h
4060
4061 b_0x1DA1_start:
4062 db 008h
4063 db 000h
4064 db 0ebh
4065 db 000h
4066 db 0e3h
4067 db 000h
4068 db 0ddh
4069 db 0e3h
4070 db 0fdh
4071 db 0e3h
4072 l1dabh:
4073 call sub_1e50h
4074 jr c,l1dc6h
4075 call sub_1e2eh
4076 jr c,l1dd2h
4077 call sub_1e41h
4078 jr c,l1ddfh
4079 call sub_1e68h
4080 jp nc,ERROR
4081 ld a,b
4082 add a,030h
4083 jp l19ebh
4084 l1dc6h:
4085 ld a,b
4086 ld b,023h
4087 cp 004h
4088 jr z,l1dcfh
4089 ld b,02bh
4090 l1dcfh:
4091 jp l1aabh
4092 l1dd2h:
4093 push af
4094 ld a,b
4095 ld b,003h
4096 cp 004h
4097 jr z,l1ddch
4098 ld b,00bh
4099 l1ddch:
4100 pop af
4101 jr l1de2h
4102 l1ddfh:
4103 rlca
4104 rlca
4105 rlca
4106 l1de2h:
4107 add a,b
4108 jp l19d7h
4109 sub_1de6h:
4110 call sub_1e12h
4111 ld a,l
4112 cp 008h
4113 jr nc,error1
4114 ret
4115 sub_1defh:
4116 call tst_EXPR
4117 push bc
4118 push iy
4119 pop bc
4120 and a
4121 sbc hl,bc
4122 dec hl
4123 dec hl
4124 pop bc
4125 call sub_1e15h
4126 ld a,h
4127 xor l
4128 bit 7,a
4129 jr nz,error1
4130 ret
4131 sub_1e06h:
4132 ld a,(de)
4133 cp 028h
4134 jr nz,sub_1e12h
4135 inc de
4136 call sub_1e12h
4137 jp sub_1ed8h
4138
4139 sub_1e12h:
4140 call tst_EXPR
4141 sub_1e15h:
4142 ld a,h
4143 and a
4144 ret z
4145 inc a
4146 ret z
4147 jr error1
4148
4149 tst_EXPR:
4150 push bc
4151 call EXPR
4152 pop bc
4153 ret nc
4154 error1:
4155 jp ERROR
4156 sub_1e25h:
4157 push hl
4158 ld hl,t_BC.DE.HL.AF
4159 jr l1e32h
4160 sub_1e2bh:
4161 push hl
4162 jr l1e32h
4163 sub_1e2eh:
4164 push hl
4165 ld hl,t_BC.DE.HL.SP
4166 l1e32h:
4167 push bc
4168 call sub_0a15h
4169 jr nc,l1e3eh
4170 ld a,b
4171 rlca
4172 rlca
4173 rlca
4174 rlca
4175 scf
4176 l1e3eh:
4177 pop bc
4178 pop hl
4179 ret
4180 sub_1e41h:
4181 call SKIPBL
4182 push bc
4183 push hl
4184 ld hl,t_BCDEHL_HL_A
4185 call sub_0a15h
4186 ld a,b
4187 pop hl
4188 pop bc
4189 ret
4190 sub_1e50h:
4191 push hl
4192 push bc
4193 ld hl,t_IX.IY
4194 call sub_0a15h
4195 jr nc,l1e65h
4196 ld a,0ddh
4197 dec b
4198 jr nz,l1e61h
4199 ld a,0fdh
4200 l1e61h:
4201 ld (pfx.IXY),a
4202 scf
4203 l1e65h:
4204 pop bc
4205 pop hl
4206 ret
4207 sub_1e68h:
4208 push hl
4209 push bc
4210 ld a,(de)
4211 cp '('
4212 jr nz,l1eb4h
4213 push de
4214 inc de
4215 ld hl,t_IX.IY
4216 call sub_0a15h
4217 jr nc,l1eb3h
4218 pop af
4219 ld a,0ddh
4220 dec b
4221 jr nz,l1e81h
4222 ld a,0fdh
4223 l1e81h:
4224 ld (pfx.IXY),a
4225 ld a,(de)
4226 cp '+'
4227 jr z,l1e95h
4228 cp ')'
4229 ld hl,0
4230 jr z,l1eadh
4231 cp '-'
4232 jp nz,ERROR
4233 l1e95h:
4234 push af
4235 inc de
4236 call sub_1e12h ;1e97 get displacement
4237 pop af
4238 cp '+'
4239 jr z,l1ea7h
4240 ld b,h
4241 ld c,l
4242 ld hl,0
4243 and a
4244 sbc hl,bc
4245 l1ea7h:
4246 ld a,(de)
4247 cp ')'
4248 jp nz,ERROR
4249 l1eadh:
4250 inc de
4251 pop bc
4252 ld c,l
4253 pop hl
4254 scf
4255 ret
4256 l1eb3h:
4257 pop de
4258 l1eb4h:
4259 pop bc
4260 pop hl
4261 and a
4262 ret
4263 sub_1eb8h:
4264 ld hl,t_tstfl_ZCPS
4265 ld c,007h
4266 jr l1ec4h
4267 sub_1ebfh:
4268 ld hl,t_tstfl_ZC
4269 ld c,003h
4270 l1ec4h:
4271 push bc
4272 call sub_0a15h
4273 ld a,b
4274 pop bc
4275 ret nc
4276 and c
4277 rlca
4278 rlca
4279 rlca
4280 scf
4281 ret
4282 sub_1ed1h:
4283 call skip_to_nextarg
4284 ret z
4285 l1ed5h:
4286 jp ERROR
4287 sub_1ed8h:
4288 ld a,(de)
4289 cp 029h
4290 jr nz,l1ed5h
4291 inc de
4292 ret
4293 CMD.L:
4294 ld hl,CMD.L
4295 ld (CMD_RPT),hl
4296 call EXPR
4297 jr nc,l1eedh
4298 ld hl,(lst.L)
4299 l1eedh:
4300 push hl
4301 pop iy
4302 call skip_to_nextarg
4303 call sub_0aa5h
4304 jr nc,l1f17h
4305 call assert_eol
4306 ld b,010h
4307 l1efdh:
4308 push bc
4309 push iy
4310 pop hl
4311 push hl
4312 call sub_1f3fh
4313 call CRLF
4314 pop iy
4315 ld c,b
4316 ld b,000h
4317 add iy,bc
4318 ld (lst.L),iy
4319 pop bc
4320 djnz l1efdh
4321 ret
4322 l1f17h:
4323 call assert_eol
4324 ld h,b
4325 ld l,c
4326 ld a,b
4327 or c
4328 jr nz,l1f21h
4329 dec hl
4330 l1f21h:
4331 push hl
4332 push iy
4333 pop hl
4334 push hl
4335 call sub_1f3fh
4336 call CRLF
4337 pop iy
4338 ld e,b
4339 ld d,000h
4340 add iy,de
4341 ld (lst.L),iy
4342 pop hl
4343 and a
4344 sbc hl,de
4345 ret z
4346 ret c
4347 jr l1f21h
4348 sub_1f3fh:
4349 call out.hl.@
4350 call z,OUTBL
4351 call OUTBL
4352 sub a
4353 ld (CON.COL),a
4354 call sub_1f77h
4355 and a
4356 ret z
4357 l1f51h:
4358 call OUTBL
4359 ld a,(CON.COL)
4360 cp 010h
4361 jr c,l1f51h
4362 sub_1f5bh:
4363 ld de,(offs.@)
4364 ld a,d
4365 or e
4366 ret z
4367 ld a,'('
4368 call OUTCHAR
4369 ld a,'@'
4370 call OUTCHAR
4371 and a
4372 sbc hl,de
4373 call out.hl
4374 ld a,')'
4375 jp OUTCHAR
4376 sub_1f77h:
4377 sub a
4378 ld (XBE03),a
4379 call sub_1f9eh
4380 jr nc,l1f91h
4381 push bc
4382 call sub_2581h
4383 ex de,hl
4384 call sub_1fdbh
4385 pop bc
4386 ld a,(XBE03)
4387 ld hl,(XBE01)
4388 scf
4389 ret
4390 l1f91h:
4391 ld hl,b_0x1F9B_start
4392 call PSTR
4393 ld b,001h
4394 sub a
4395 ret
4396
4397 b_0x1F9B_start:
4398 DC '???'
4399
4400 sub_1f9eh:
4401 sub a
4402 ld (is.pfx.IXY),a
4403 comst
4404 ld a,(iy+000h)
4405 comend
4406 cp 0edh
4407 jp z,disas_pfx.ED
4408 cp 0ddh
4409 jr z,l1fc5h
4410 cp 0fdh
4411 jr z,l1fc9h
4412 sub_1fb6h:
4413 comst
4414 ld a,(iy+000h)
4415 comend
4416 cp 0cbh
4417 jp z,l2061h
4418 jp l2078h
4419 l1fc5h:
4420 ld a,001h
4421 jr l1fcbh
4422 l1fc9h:
4423 ld a,002h
4424 l1fcbh:
4425 ld (is.pfx.IXY),a
4426 call sub_1fdch
4427 ret nc
4428 push bc
4429 call sub_1fb6h
4430 pop af
4431 add a,b
4432 ld b,a
4433 scf
4434 ret
4435
4436 sub_1fdbh:
4437 jp (hl)
4438
4439 sub_1fdch:
4440 inc iy
4441 ld hl,b_0x2011_start
4442 call sub_20bbh
4443 ld b,002h
4444 ret c
4445 ld hl,l202ch
4446 call sub_20bbh
4447 ld b,001h
4448 ret c
4449 comst
4450 ld a,(iy+000h)
4451 comend
4452 cp 0cbh
4453 jr nz,l200fh
4454 comst
4455 ld a,(iy+002h)
4456 comend
4457 cp 036h
4458 ret z
4459 and 007h
4460 cp 006h
4461 jr nz,l200fh
4462 ld b,002h
4463 scf
4464 ret
4465 l200fh:
4466 and a
4467 ret
4468
4469 b_0x2011_start:
4470 db 034h
4471 db 035h
4472 db 036h
4473 db 046h
4474 db 04eh
4475 db 056h
4476 db 05eh
4477 db 066h
4478 db 06eh
4479 db 070h
4480 db 071h
4481 db 072h
4482 db 073h
4483 db 074h
4484 db 075h
4485 db 076h
4486 db 077h
4487 db 07eh
4488 db 086h
4489 db 08eh
4490 db 096h
4491 db 09eh
4492 db 0a6h
4493 db 0aeh
4494 db 0b6h
4495 db 0beh
4496 db 000h
4497 l202ch:
4498 db 009h
4499 db 019h
4500 db 021h
4501 db 022h
4502 db 023h
4503 db 029h
4504 db 02ah
4505 db 02bh
4506 db 039h
4507 db 0e1h
4508 db 0e3h
4509 db 0e5h
4510 db 0e9h
4511 db 0f9h
4512 db 000h
4513
4514 disas_pfx.ED:
4515 inc iy
4516 ld hl,b_0x2200_start
4517 call sub_209dh
4518 ld b,002h
4519 ret c
4520 ld hl,l2235h
4521 call lookup_opc
4522 ld b,002h
4523 ret c
4524 ld hl,l228bh
4525 call lookup_opc
4526 ld b,003h
4527 ret c
4528 ld hl,l22b4h
4529 call lookup_opc
4530 ld b,004h
4531 ret
4532 l2061h:
4533 push iy
4534 inc iy
4535 ld a,(is.pfx.IXY)
4536 and a
4537 jr z,l206dh
4538 inc iy
4539 l206dh:
4540 ld hl,l22c9h
4541 call lookup_opc
4542 pop iy
4543 ld b,002h
4544 ret
4545 l2078h:
4546 ld hl,b_0x218B_start
4547 call lookup_opc
4548 ld b,002h
4549 ret c
4550 ld hl,b_0x20ED_start
4551 call sub_209dh
4552 ld b,001h
4553 ret c
4554 ld hl,b_0x2108_start
4555 call lookup_opc
4556 ld b,001h
4557 ret c
4558 ld hl,b_0x21D2_start
4559 call lookup_opc
4560 ret nc
4561 ld b,003h
4562 ret
4563
4564 sub_209dh:
4565 ld a,(hl)
4566 cp 0ffh
4567 ret z
4568 comst
4569 cp (iy+000h)
4570 comend
4571 jr z,l20aeh
4572 inc hl
4573 inc hl
4574 jr sub_209dh
4575 l20aeh:
4576 inc hl
4577 ld c,(hl)
4578 ld hl,t_MNEMONICS
4579 ld b,000h
4580 add hl,bc
4581 ld de,l230bh
4582 scf
4583 ret
4584 sub_20bbh:
4585 ld a,(hl)
4586 and a
4587 ret z
4588 inc hl
4589 comst
4590 cp (iy+000h)
4591 comend
4592 jr nz,sub_20bbh
4593 scf
4594 ret
4595
4596 lookup_opc:
4597 comst
4598 ld a,(iy+000h)
4599 comend
4600 and (hl)
4601 inc hl
4602 cp (hl)
4603 jr z,l20dfh
4604 inc hl
4605 inc hl
4606 inc hl
4607 inc hl
4608 ld a,(hl)
4609 and a
4610 jr nz,lookup_opc
4611 ret
4612 l20dfh:
4613 inc hl
4614 ld c,(hl)
4615 inc hl
4616 ld e,(hl)
4617 inc hl
4618 ld d,(hl)
4619 ld hl,t_MNEMONICS
4620 ld b,000h
4621 add hl,bc
4622 scf
4623 ret
4624
4625 b_0x20ED_start: ; 1 byte opcodes (no parameters)
4626 db 076h ;20ed halt
4627 db 039h ;20ee
4628 db 0d9h ;20ef exx
4629 db 036h
4630 db 0f3h ;20f1 di
4631 db 02ch
4632 db 0fbh ;20f3 ei
4633 db 032h
4634 db 000h ;20f5 nop
4635 db 069h
4636 db 007h ;20f7 rlca
4637 db 09eh
4638 db 00fh ;20f9 rrca
4639 db 0adh
4640 db 017h ;20fb rla
4641 db 098h
4642 db 01fh ;20fd rra
4643 db 0a7h
4644 db 027h ;20ff daa
4645 db 026h
4646 db 02fh ;2101 cpl
4647 db 023h
4648 db 037h ;2103 scf
4649 db 0bah
4650 db 03fh ;2105 ccf
4651 db 010h
4652 db 0ffh ;2107 EOT
4653
4654 b_0x2108_start: ; 1 byte opcodes
4655 defb 0c0h ;2108 ld r,r
4656 defb 040h
4657 defb 056h
4658 defw l22fch
4659
4660 defb 0f8h ;210d add a,r
4661 defb 080h
4662 defb 003h
4663 defw l2305h
4664
4665 defb 0f8h ;2112 adc a,r
4666 defb 088h
4667 defb 000h
4668 defw l2305h
4669
4670 defb 0f8h
4671 defb 090h
4672 defb 0c9h
4673 defw l24ebh
4674
4675 defb 0f8h
4676 defb 098h
4677 defb 0b7h
4678 defw l2305h
4679
4680 defb 0f8h
4681 defb 0a0h
4682 defb 006h
4683 defw l24ebh
4684
4685 defb 0f8h
4686 defb 0a8h
4687 defb 0cch
4688 defw l24ebh
4689
4690 defb 0f8h
4691 defb 0b0h
4692 defb 06ch
4693 defw l24ebh
4694
4695 defb 0f8h
4696 defb 0b8h
4697 defb 013h
4698 defw l24ebh
4699
4700 defb 0c7h
4701 defb 0c0h ;2136 ret cc
4702 defb 08bh
4703 defw l2561h
4704
4705 defb 0c7h ;213a rst
4706 defb 0c7h
4707 defb 0b4h
4708 defw l231eh
4709
4710 defb 0ffh ;213f ret
4711 defb 0c9h
4712 defb 08bh
4713 defw l230bh
4714
4715 defb 0cfh ;2144 pop rr
4716 defb 0c1h
4717 defb 081h
4718 defw l2546h
4719
4720 defb 0cfh ;2149 push rr
4721 defb 0c5h
4722 defb 084h
4723 defw l2546h
4724
4725 defb 0ffh ;214e ex (sp),hl
4726 defb 0e3h
4727 defb 034h
4728 defw l232ah
4729
4730 defb 0ffh ;2153 jp (hl)
4731 defb 0e9h
4732 defb 052h
4733 defw l2338h
4734
4735 defb 0ffh ;2158 ex de,hl
4736 defb 0ebh
4737 defb 034h
4738 defw l2345h
4739
4740 defb 0ffh ;215d ld sp,hl
4741 defb 0f9h
4742 defb 056h
4743 defw l234bh
4744
4745 defb 0cfh ;2162 inc rr
4746 defb 003h
4747 defb 041h
4748 defw l254bh
4749
4750 defb 0cfh ;2167 dec rr
4751 defb 00bh
4752 defb 029h
4753 defw l254bh
4754
4755 defb 0c7h ;216c inc r
4756 defb 004h
4757 defb 041h
4758 defw l24dfh
4759
4760 defb 0c7h ;2171 dec r
4761 defb 005h
4762 defb 029h
4763 defw l24dfh
4764
4765 defb 0ffh ;2176 ex af,af'
4766 defb 008h
4767 defb 034h
4768 defw l2357h
4769
4770 defb 0cfh ;217b add hl,rr
4771 defb 009h
4772 defb 003h
4773 defw l235dh
4774
4775 defb 0efh ;2180 ld (rr),a ;rr=bc,de
4776 defb 002h
4777 defb 056h
4778 defw l2366h
4779
4780 defb 0efh ;2185 ld a,(rr) ;rr=bc,de
4781 defb 00ah
4782 defb 056h
4783 defw l236fh
4784
4785 defb 000h ;218a EOT
4786
4787 b_0x218B_start: ; 2 byte opdodes
4788 defb 0c7h ;218b ld r,nn
4789 defb 006h
4790 defb 056h
4791 defw l2384h
4792
4793 defb 0ffh ;2190 add a,nn
4794 defb 0c6h
4795 defb 003h
4796 defw l237fh
4797
4798 defb 0ffh ;2195 adc a,nn
4799 defb 0ceh
4800 defb 000h
4801 defw l237fh
4802
4803 defb 0ffh ;219a sub a,nn
4804 defb 0d6h
4805 defb 0c9h
4806 defw l2397h
4807
4808 defb 0ffh
4809 defb 0deh
4810 defb 0b7h
4811 defw l237fh
4812
4813 defb 0ffh ;21a4 and a,nn
4814 defb 0e6h
4815 defb 006h
4816 defw l2397h
4817
4818 defb 0ffh
4819 defb 0eeh
4820 defb 0cch
4821 defw l2397h
4822
4823 defb 0ffh
4824 defb 0f6h
4825 defb 06ch
4826 defw l2397h
4827
4828 defb 0ffh ;21b3 cp a,nn
4829 defb 0feh
4830 defb 013h
4831 defw l2397h
4832
4833 defb 0ffh ;21b8 djnz
4834 defb 010h
4835 defb 02eh
4836 defw l23b0h
4837
4838 defb 0ffh ;21bd jr
4839 defb 018h
4840 defb 054h
4841 defw l23b0h
4842
4843 defb 0e7h ;21c2 jr,cc
4844 defb 020h
4845 defb 054h
4846 defw l23a1h
4847
4848 defb 0ffh
4849 defb 0d3h ;21c8 out (nn),a
4850 defb 076h
4851 defw l23d5h
4852
4853 defb 0ffh ;21cc in a,(nn)
4854 defb 0dbh
4855 defb 03fh
4856 defw l23c3h
4857
4858 defb 000h ;21d1 EOT
4859
4860 b_0x21D2_start: ; 3 byte opcodes
4861 defb 0c7h
4862 defb 0c2h
4863 defb 052h
4864 defw l23e0h
4865
4866 defb 0c7h
4867 defb 0c4h
4868 defb 00ch
4869 defw l23e0h
4870
4871 defb 0cfh
4872 defb 001h
4873 defb 056h
4874 defw l23fch
4875
4876 defb 0ffh
4877 defb 0c3h
4878 defb 052h
4879 defw l23e6h
4880
4881 defb 0ffh
4882 defb 0cdh
4883 defb 00ch
4884 defw l23e6h
4885
4886 defb 0ffh
4887 defb 022h
4888 defb 056h
4889 defw l2404h
4890
4891 defb 0ffh
4892 defb 02ah
4893 defb 056h
4894 defw l240dh
4895
4896 defb 0ffh
4897 defb 032h
4898 defb 056h
4899 defw l2416h
4900
4901 defb 0ffh
4902 defb 03ah
4903 defb 056h
4904 defw l2421h
4905
4906 defb 000h
4907
4908 b_0x2200_start: ; prefix ED + 1 byte opcode
4909 defb 044h ;2200 neg
4910 defb 066h
4911 defb 045h ;2202 retn
4912 defb 092h
4913 defb 04dh ;2204 reti
4914 defb 08eh
4915 defb 067h ;2206 rrd
4916 defb 0b1h
4917 defb 06fh ;2208 rld
4918 defb 0a2h
4919 defb 0a0h ;220a ldi
4920 defb 05fh
4921 defb 0a1h
4922 defb 01ch
4923 defb 0a2h
4924 defb 04bh
4925 defb 0a3h
4926 defb 07dh
4927 defb 0a8h ;2212 ldd
4928 defb 058h
4929 defb 0a9h
4930 defb 015h
4931 defb 0aah
4932 defb 044h
4933 defb 0abh
4934 defb 079h
4935 defb 0b0h ;221a ldir
4936 defb 062h
4937 defb 0b1h
4938 defb 01fh
4939 defb 0b2h
4940 defb 04eh
4941 defb 0b3h
4942 defb 072h
4943 defb 0b8h ;2222 lddr
4944 defb 05bh
4945 defb 0b9h
4946 defb 018h
4947 defb 0bah
4948 defb 047h
4949 defb 0bbh
4950 defb 06eh
4951 defb 08bh ;222a otdm
4952 defb 0d5h
4953 defb 09bh ;222c otdmr
4954 defb 0d9h
4955 defb 083h ;222e otim
4956 defb 0deh
4957 defb 093h ;2230 otimr
4958 defb 0e2h
4959 defb 076h ;2232 slp
4960 defb 0ebh
4961 defb 0ffh ;2234 EOT
4962
4963 l2235h:
4964 defb 0e7h ;2235 in r,(c) ;r=bcde
4965 defb 040h
4966 defb 03fh
4967 defw l2455h
4968
4969 defb 0f7h ;223a in r,(c) ;r=hl
4970 defb 060h
4971 defb 03fh
4972 defw l2455h
4973
4974 defb 0ffh ;223f in r,(c) ;r=a
4975 defb 078h
4976 defb 03fh
4977 defw l2455h
4978
4979 defb 0e7h
4980 defb 041h
4981 defb 076h
4982 defw l2461h
4983
4984 defb 0f7h
4985 defb 061h
4986 defb 076h
4987 defw l2461h
4988
4989 defb 0ffh ;224e out (c),r ;r=a
4990 defb 079h
4991 defb 076h
4992 defw l2461h
4993
4994 defb 0cfh ;2253 sbc hl,rr
4995 defb 042h
4996 defb 0b7h
4997 defw l246dh
4998
4999 defb 0cfh ;2258 adc hl,rr
5000 defb 04ah
5001 defb 000h
5002 defw l246dh
5003
5004 defb 0ffh ;225d im 0
5005 defb 046h
5006 defb 03dh
5007 defw l2427h
5008
5009 defb 0ffh ;2262 im 1
5010 defb 056h
5011 defb 03dh
5012 defw l242bh
5013
5014 defb 0ffh ;2267 im 2
5015 defb 05eh
5016 defb 03dh
5017 defw l242fh
5018
5019 defb 0ffh ;226c ld i,a
5020 defb 047h
5021 defb 056h
5022 defw l2434h
5023
5024 defb 0ffh
5025 defb 057h
5026 defb 056h
5027 defw l2439h
5028
5029 defb 0ffh
5030 defb 04fh
5031 defb 056h
5032 defw l243eh
5033
5034 defb 0ffh
5035 defb 05fh
5036 defb 056h
5037 defw l2443h
5038
5039 defb 0cfh ;2280 mlt rr
5040 defb 04ch
5041 defb 0d2h
5042 defw l254bh
5043
5044 defb 0c7h ;2285 tst r
5045 defb 004h
5046 defb 0eeh
5047 defw l24dfh
5048
5049 defb 000h
5050
5051 l228bh:
5052 defb 0e7h
5053 defb 000h
5054 defb 0cfh
5055
5056 b_0x228E_start:
5057 defw l230ch
5058
5059 b_0x2290_start:
5060 defb 0f7h
5061 defb 020h
5062 defb 0cfh
5063
5064 b_0x2293_start:
5065 defw l230ch
5066
5067 b_0x2295_start:
5068 defb 0ffh
5069 defb 038h
5070 defb 0cfh
5071
5072 b_0x2298_start:
5073 defw l230ch
5074
5075 b_0x229A_start:
5076 defb 0e7h
5077 defb 001h
5078 defb 0e7h
5079
5080 b_0x229D_start:
5081 defw l2315h
5082
5083 b_0x229F_start:
5084 defb 0f7h
5085 defb 021h
5086 defb 0e7h
5087
5088 b_0x22A2_start:
5089 defw l2315h
5090
5091 b_0x22A4_start:
5092 defb 0ffh
5093 defb 039h
5094 defb 0e7h
5095
5096 b_0x22A7_start:
5097 defw l2315h
5098
5099 b_0x22A9_start:
5100 defb 0ffh
5101 defb 064h
5102 defb 0eeh
5103
5104 b_0x22AC_start:
5105 defw l2397h
5106
5107 b_0x22AE_start:
5108 defb 0ffh
5109 defb 074h
5110 defb 0f1h
5111
5112 b_0x22B1_start:
5113 defw l2397h
5114
5115 b_0x22B3_start:
5116 defb 000h
5117 l22b4h:
5118 defb 0efh
5119 defb 043h
5120 defb 056h
5121
5122 b_0x22B7_start:
5123 defw l2476h
5124
5125 b_0x22B9_start:
5126 defb 0ffh
5127 defb 073h
5128 defb 056h
5129
5130 b_0x22BC_start:
5131 defw l2476h
5132
5133 b_0x22BE_start:
5134 defb 0efh
5135 defb 04bh
5136 defb 056h
5137
5138 b_0x22C1_start:
5139 defw l247fh
5140
5141 b_0x22C3_start:
5142 defb 0ffh
5143 defb 07bh
5144 defb 056h
5145
5146 b_0x22C6_start:
5147 defw l247fh
5148
5149 b_0x22C8_start:
5150 defb 000h
5151 l22c9h:
5152 defb 0f8h
5153 defb 000h
5154 defb 09bh
5155
5156 b_0x22CC_start:
5157 defw l24aeh
5158
5159 b_0x22CE_start:
5160 defb 0f8h
5161 defb 008h
5162 defb 0aah
5163
5164 b_0x22D1_start:
5165 defw l24aeh
5166
5167 b_0x22D3_start:
5168 defb 0f8h
5169 defb 010h
5170 defb 096h
5171
5172 b_0x22D6_start:
5173 defw l24aeh
5174
5175 b_0x22D8_start:
5176 defb 0f8h
5177 defb 018h
5178 defb 0a5h
5179
5180 b_0x22DB_start:
5181 defw l24aeh
5182
5183 b_0x22DD_start:
5184 defb 0f8h
5185 defb 020h
5186 defb 0c0h
5187
5188 b_0x22E0_start:
5189 defw l24aeh
5190
5191 b_0x22E2_start:
5192 defb 0f8h
5193 defb 028h
5194 defb 0c3h
5195
5196 b_0x22E5_start:
5197 defw l24aeh
5198
5199 b_0x22E7_start:
5200 defb 0f8h
5201 defb 038h
5202 defb 0c6h
5203
5204 b_0x22EA_start:
5205 defw l24aeh
5206
5207 b_0x22EC_start:
5208 defb 0c0h
5209 defb 040h
5210 defb 009h
5211
5212 b_0x22EF_start:
5213 defw l2487h
5214
5215 b_0x22F1_start:
5216 defb 0c0h
5217 defb 080h
5218 defb 088h
5219
5220 b_0x22F4_start:
5221 defw l2487h
5222
5223 b_0x22F6_start:
5224 defb 0c0h
5225 defb 0c0h
5226 defb 0bdh
5227
5228 b_0x22F9_start:
5229 defw l2487h
5230
5231 b_0x22FB_start:
5232 defb 000h
5233 l22fch:
5234 call l24dfh
5235 call sub_257ch
5236 jp l24ebh
5237 l2305h:
5238 call sub_2579h
5239 jp l24ebh
5240 l230bh:
5241 ret
5242 l230ch:
5243 call l24dfh
5244 call sub_257ch
5245 jp l23c6h
5246 l2315h:
5247 call l23c6h
5248 call sub_257ch
5249 jp l24dfh
5250 l231eh:
5251 comst
5252 ld a,(iy+000h)
5253 comend
5254 and 038h
5255 jp out.hex
5256 l232ah:
5257 ld hl,b_0x2333_start
5258 call PSTR
5259 jp l253eh
5260
5261 b_0x2333_start:
5262 DC '(SP),'
5263
5264 l2338h:
5265 ld a,'('
5266 call OUTCHAR
5267 call l253eh
5268 ld a,')'
5269 jp OUTCHAR
5270 l2345h:
5271 ld hl,l1d86h
5272 jp PSTR
5273 l234bh:
5274 ld hl,b_0x2354_start
5275 call PSTR
5276 jp l253eh
5277
5278 b_0x2354_start:
5279 DC 'SP,'
5280
5281 l2357h:
5282 ld hl,b_0x1D80_start
5283 jp PSTR
5284 l235dh:
5285 call l253eh
5286 call sub_257ch
5287 jp l254bh
5288 l2366h:
5289 call sub_2372h
5290 call sub_257ch
5291 jp l23dbh
5292 l236fh:
5293 call sub_2579h
5294 sub_2372h:
5295 ld a,'('
5296 call OUTCHAR
5297 call l254bh
5298 ld a,')'
5299 jp OUTCHAR
5300 l237fh:
5301 call sub_2579h
5302 jr l2397h
5303 l2384h:
5304 call l24dfh
5305 call sub_257ch
5306 ld a,(is.pfx.IXY)
5307 and a
5308 comst
5309 ld a,(iy+002h)
5310 comend
5311 jr nz,l239eh
5312 l2397h:
5313 comst
5314 ld a,(iy+001h)
5315 comend
5316 l239eh:
5317 jp out.hex
5318 l23a1h:
5319 comst
5320 ld a,(iy+000h)
5321 comend
5322 and 018h
5323 call sub_2568h
5324 call sub_257ch
5325 l23b0h:
5326 comst
5327 ld c,(iy+001h)
5328 comend
5329 ld a,c
5330 rla
5331 sbc a,a
5332 ld b,a
5333 push iy
5334 pop hl
5335 add hl,bc
5336 inc hl
5337 inc hl
5338 jr l23f0h
5339 l23c3h:
5340 call sub_2579h
5341 l23c6h:
5342 ld a,028h
5343 call OUTCHAR
5344 comst
5345 ld a,(iy+001h)
5346 comend
5347 jp l252bh
5348 l23d5h:
5349 call l23c6h
5350 call sub_257ch
5351 l23dbh:
5352 ld a,041h
5353 jp OUTCHAR
5354 l23e0h:
5355 call l2561h
5356 call sub_257ch
5357 l23e6h:
5358 comst
5359 ld l,(iy+001h)
5360 ld h,(iy+002h)
5361 comend
5362 l23f0h:
5363 ld a,002h
5364 sub_23f2h:
5365 ld (XBE03),a
5366 ld (XBE01),hl
5367 call out.hl
5368 ret
5369 l23fch:
5370 call l254bh
5371 call sub_257ch
5372 jr l23e6h
5373 l2404h:
5374 call sub_24c6h
5375 call sub_257ch
5376 jp l253eh
5377 l240dh:
5378 call l253eh
5379 call sub_257ch
5380 jp sub_24c6h
5381 l2416h:
5382 call sub_24c6h
5383 call sub_257ch
5384 ld a,041h
5385 jp OUTCHAR
5386 l2421h:
5387 call sub_2579h
5388 jp sub_24c6h
5389 l2427h:
5390 ld a,030h
5391 jr l2431h
5392 l242bh:
5393 ld a,031h
5394 jr l2431h
5395 l242fh:
5396 ld a,032h
5397 l2431h:
5398 jp OUTCHAR
5399 l2434h:
5400 ld hl,b_0x2449_start
5401 jr l2446h
5402 l2439h:
5403 ld hl,l244ch
5404 jr l2446h
5405 l243eh:
5406 ld hl,l244fh
5407 jr l2446h
5408 l2443h:
5409 ld hl,l2452h
5410 l2446h:
5411 jp PSTR
5412
5413 b_0x2449_start:
5414 DC 'I,A'
5415 l244ch:
5416 DC 'A,I'
5417 l244fh:
5418 DC 'R,A'
5419 l2452h:
5420 DC 'A,R'
5421
5422 l2455h:
5423 call l24dfh
5424 call sub_257ch
5425 ld hl,t__C_
5426 jp PSTR
5427 l2461h:
5428 ld hl,t__C_
5429 call PSTR
5430 call sub_257ch
5431 jp l24dfh
5432 l246dh:
5433 call l253eh
5434 call sub_257ch
5435 jp l254bh
5436 l2476h:
5437 call sub_24c6h
5438 call sub_257ch
5439 jp l254bh
5440 l247fh:
5441 call l254bh
5442 call sub_257ch
5443 jr sub_24c6h
5444 l2487h:
5445 ld a,(is.pfx.IXY)
5446 and a
5447 jr nz,l2496h
5448 comst
5449 ld a,(iy+001h)
5450 comend
5451 jr l249dh
5452 l2496h:
5453 comst
5454 ld a,(iy+002h)
5455 comend
5456 l249dh:
5457 push af
5458 rra
5459 rra
5460 rra
5461 and 007h
5462 add a,'0'
5463 call OUTCHAR
5464 call sub_257ch
5465 pop af
5466 jr l24f2h
5467 l24aeh:
5468 ld a,(is.pfx.IXY)
5469 and a
5470 jr nz,l24bdh
5471 comst
5472 ld a,(iy+001h)
5473 comend
5474 jr l24c4h
5475 l24bdh:
5476 comst
5477 ld a,(iy+002h)
5478 comend
5479 l24c4h:
5480 jr l24f2h
5481 sub_24c6h:
5482 ld a,'('
5483 call OUTCHAR
5484 comst
5485 ld l,(iy+001h)
5486 ld h,(iy+002h)
5487 comend
5488 ld a,001h
5489 call sub_23f2h
5490 ld a,')'
5491 jp OUTCHAR
5492 l24dfh:
5493 comst
5494 ld a,(iy+000h)
5495 comend
5496 rra
5497 rra
5498 rra
5499 jr l24f2h
5500 l24ebh:
5501 comst
5502 ld a,(iy+000h)
5503 comend
5504 l24f2h:
5505 and 007h
5506 cp 006h
5507 jr nz,l2533h
5508 ld a,(is.pfx.IXY)
5509 and a
5510 ld a,006h
5511 jr z,l2533h
5512 ld hl,b_0x2538_start
5513 ld a,(is.pfx.IXY)
5514 dec a
5515 jr z,l250ch
5516 ld hl,b_0x253B_start
5517 l250ch:
5518 call PSTR
5519 comst
5520 ld a,(iy+001h)
5521 comend
5522 and a
5523 push af
5524 jp m,l2523h
5525 ld a,'+'
5526 call OUTCHAR
5527 pop af
5528 jr l252bh
5529 l2523h:
5530 ld a,'-'
5531 call OUTCHAR
5532 pop af
5533 neg
5534 l252bh:
5535 call out.hex
5536 ld a,')'
5537 jp OUTCHAR
5538 l2533h:
5539 ld hl,t_BCDEHL_HL_A
5540 jr l2572h
5541
5542 b_0x2538_start:
5543 DC '(IX'
5544 b_0x253B_start:
5545 DC '(IY'
5546
5547 l253eh:
5548 ld a,(is.pfx.IXY)
5549 ld hl,t_HL.IX.IY
5550 jr l2572h
5551 l2546h:
5552 ld hl,t_BC.DE.HL.AF
5553 jr l254eh
5554 l254bh:
5555 ld hl,t_BC.DE.HL.SP
5556 l254eh:
5557 comst
5558 ld a,(iy+000h)
5559 comend
5560 rra
5561 rra
5562 rra
5563 rra
5564 and 003h
5565 cp 002h
5566 jr z,l253eh
5567 jr l2572h
5568 l2561h:
5569 comst
5570 ld a,(iy+000h)
5571 comend
5572 sub_2568h:
5573 rra
5574 rra
5575 rra
5576 and 007h
5577 ld hl,t_tstfl_ZCPS
5578 jr l2572h
5579 l2572h:
5580 ld b,a
5581 call sub_0a48h
5582 jp PSTR
5583 sub_2579h:
5584 call l23dbh
5585 sub_257ch:
5586 ld a,','
5587 jp OUTCHAR
5588 sub_2581h:
5589 call PSTR
5590 l2584h:
5591 call OUTBL
5592 inc c
5593 ld a,c
5594 cp 006h
5595 jr nz,l2584h
5596 ret
5597
5598 t_MNEMONICS:
5599 DC 'ADC'
5600 DC 'ADD'
5601 DC 'AND'
5602 DC 'BIT'
5603 DC 'CALL'
5604 DC 'CCF'
5605 DC 'CP'
5606 DC 'CPD'
5607 DC 'CPDR'
5608 DC 'CPI'
5609 DC 'CPIR'
5610 DC 'CPL'
5611 DC 'DAA'
5612 DC 'DEC'
5613 DC 'DI'
5614 DC 'DJNZ'
5615 DC 'EI'
5616 DC 'EX'
5617 DC 'EXX'
5618 DC 'HALT'
5619 DC 'IM'
5620 DC 'IN'
5621 DC 'INC'
5622 DC 'IND'
5623 DC 'INDR'
5624 DC 'INI'
5625 DC 'INIR'
5626 DC 'JP'
5627 DC 'JR'
5628 DC 'LD'
5629 DC 'LDD'
5630 DC 'LDDR'
5631 DC 'LDI'
5632 DC 'LDIR'
5633 DC 'NEG'
5634 DC 'NOP'
5635 DC 'OR'
5636 DC 'OTDR'
5637 DC 'OTIR'
5638 DC 'OUT'
5639 DC 'OUTD'
5640 DC 'OUTI'
5641 DC 'POP'
5642 DC 'PUSH'
5643 DC 'RES'
5644 DC 'RET'
5645 DC 'RETI'
5646 DC 'RETN'
5647 DC 'RL'
5648 DC 'RLA'
5649 DC 'RLC'
5650 DC 'RLCA'
5651 DC 'RLD'
5652 DC 'RR'
5653 DC 'RRA'
5654 DC 'RRC'
5655 DC 'RRCA'
5656 DC 'RRD'
5657 DC 'RST'
5658 DC 'SBC'
5659 DC 'SCF'
5660 DC 'SET'
5661 DC 'SLA'
5662 DC 'SRA'
5663 DC 'SRL'
5664 DC 'SUB'
5665 DC 'XOR'
5666 DC 'IN0'
5667 DC 'MLT'
5668 DC 'OTDM'
5669 DC 'OTDMR'
5670 DC 'OTIM'
5671 DC 'OTIMR'
5672 DC 'OUT0'
5673 DC 'SLP'
5674 DC 'TST'
5675 DC 'TSTIO'
5676 DB 0
5677
5678 t_BCDEHL_HL_A:
5679 DC 'B'
5680 DC 'C'
5681 DC 'D'
5682 DC 'E'
5683 DC 'H'
5684 DC 'L'
5685 DC '(HL)'
5686 DC 'A'
5687 DB 0
5688 t_BC.DE.HL.SP:
5689 DC 'BC'
5690 DC 'DE'
5691 DC 'HL'
5692 DC 'SP'
5693 DB 0
5694 t_BC.DE.HL.AF:
5695 DC 'BC'
5696 DC 'DE'
5697 t_HL.AF:
5698 DC 'HL'
5699 DC 'AF'
5700 DB 0
5701 t_BC.DE.IY.SP:
5702 DC 'BC'
5703 DC 'DE'
5704 DC 'IY'
5705 DC 'SP'
5706 DB 0
5707 t_BC.DE.IX.SP:
5708 DC 'BC'
5709 DC 'DE'
5710 DC 'IX'
5711 DC 'SP'
5712 DB 0
5713 t_HL.IX.IY:
5714 DC 'HL'
5715 t_IX.IY:
5716 DC 'IX'
5717 DC 'IY'
5718 DB 0
5719 t_tstfl_ZC:
5720 DC 'NZ'
5721 DC 'Z'
5722 DC 'NC'
5723 DC 'C'
5724 DC 'NE'
5725 DC 'EQ'
5726 DC 'GE'
5727 DC 'LT'
5728 DB 0
5729 t_tstfl_ZCPS:
5730 DC 'NZ'
5731 DC 'Z'
5732 DC 'NC'
5733 DC 'C'
5734 DC 'PO'
5735 DC 'PE'
5736 DC 'P'
5737 DC 'M'
5738 DC 'NE'
5739 DC 'EQ'
5740 DC 'GE'
5741 DC 'LT'
5742 DC 'NV'
5743 DC 'V'
5744 DB 0
5745 t__C_:
5746 DC '(C)'
5747 DB 0
5748
5749 sub_26e7h:
5750 ld hl,(REG.PC)
5751 ld a,h
5752 or l
5753 jr z,l2715h
5754 ld iy,(REG.PC)
5755 call sub_1f9eh
5756 jp nc,ERROR
5757 ld c,b
5758 ld b,000h
5759 ld hl,(REG.PC)
5760 add hl,bc
5761 call sub_1117h
5762 ld iy,(REG.PC)
5763 ld hl,b_0x2717_start
5764 call lookup_opc
5765 ccf
5766 ret c
5767 ex de,hl
5768 call CALL.HL
5769 call c,sub_1117h
5770 l2715h:
5771 scf
5772 ret
5773
5774 b_0x2717_start:
5775 db 0ffh
5776 db 0ddh
5777 db 000h
5778 dw x278d
5779
5780 db 0ffh
5781 db 0fdh
5782 db 000h
5783 dw x2792
5784
5785 db 0ffh
5786 db 0edh
5787 db 000h
5788 dw x27a2
5789
5790 l2726h:
5791 db 0ffh
5792 db 0cdh
5793 db 000h
5794 dw x275e
5795
5796 db 0ffh
5797 db 0c3h
5798 db 000h
5799 dw x2769
5800
5801 db 0ffh
5802 db 0e9h
5803 db 000h
5804 dw x2788
5805
5806 db 0ffh
5807 db 0c9h
5808 db 000h
5809 dw x27c9
5810
5811 db 0ffh
5812 db 0cfh
5813 db 000h
5814 dw x280e
5815
5816 db 0c7h
5817 db 0c7h
5818 db 000h
5819 dw x27ea
5820
5821 db 0c7h
5822 db 0c4h
5823 db 000h
5824 dw x275e
5825
5826 db 0f7h
5827 db 010h
5828 db 000h
5829 dw x2775
5830
5831 db 0e7h
5832 db 020h
5833 db 000h
5834 dw x2775
5835
5836 db 0c7h
5837 db 0c2h
5838 db 000h
5839 dw x2769
5840
5841 db 0c7h
5842 db 0c0h
5843 db 000h
5844 dw x27b3
5845
5846 db 000h
5847
5848 x275e:
5849 ld a,(XBFE8)
5850 and a
5851 jr nz,x2769
5852 ld a,(TCFLG)
5853 and a
5854 ret nz
5855
5856 x2769:
5857 comst
5858 ld l,(iy+001h)
5859 ld h,(iy+002h)
5860 comend
5861 scf
5862 ret
5863
5864 x2775:
5865 comst
5866 ld c,(iy+001h)
5867 comend
5868 ld a,c
5869 rla
5870 sbc a,a
5871 ld b,a
5872 ld hl,(REG.PC)
5873 add hl,bc
5874 inc hl
5875 inc hl
5876 scf
5877 ret
5878
5879 x2788:
5880 ld hl,(REG.L)
5881 scf
5882 ret
5883
5884 x278d:
5885 ld hl,(reg.ix)
5886 jr l2795h
5887
5888 x2792:
5889 ld hl,(reg.iy)
5890 l2795h:
5891 comst
5892 ld a,(iy+001h)
5893 comend
5894 cp 0e9h
5895 scf
5896 ret z
5897 and a
5898 ret
5899
5900 x27a2:
5901 comst
5902 ld a,(iy+001h)
5903 comend
5904 cp 04dh
5905 jr z,x27c9
5906 cp 045h
5907 jr z,x27c9
5908 and a
5909 ret
5910
5911 x27b3:
5912 comst
5913 ld a,(iy+000h)
5914 comend
5915 ld (XBEDD),a
5916 ld hl,(REG.F)
5917 push hl
5918 pop af
5919 call XBEDD
5920 scf
5921 jr c,x27c9
5922 ret
5923
5924 x27c9:
5925 ld a,(XBFE8)
5926 and a
5927 jr nz,l27dah
5928 ld a,(TCFLG)
5929 and a
5930 jr z,l27dah
5931 call l27dah
5932 pop hl
5933 ret
5934 l27dah:
5935 ld hl,(REG.SP)
5936 comst
5937 ld e,(hl)
5938 inc hl
5939 ld d,(hl)
5940 comend
5941 ex de,hl
5942 call sub_1117h
5943 and a
5944 ret
5945
5946 x27ea:
5947 ld a,(ddtrst)
5948 comst
5949 cp (iy+000h)
5950 comend
5951 ret z
5952 comst
5953 ld a,(iy+000h)
5954 comend
5955 and 038h
5956 ld l,a
5957 ld h,000h
5958 ld a,(XBFE8)
5959 and a
5960 jr nz,l280ch
5961 ld a,(TCFLG)
5962 and a
5963 ret nz
5964 l280ch:
5965 scf
5966 ret
5967
5968 x280e:
5969 and a
5970 ret
5971
5972 CMD.C:
5973 ld hl,CMD.C
5974 ld a,001h
5975 jr l281bh
5976
5977 CMD.T:
5978 xor a
5979 ld hl,CMD.T
5980 l281bh:
5981 ld (CMD_RPT),hl
5982 ld (TCFLG),a
5983 ld a,(de)
5984 sub 'N'
5985 jr nz,l2827h
5986 inc de
5987 l2827h:
5988 ld (TCNFLG),a
5989 ld a,(de)
5990 sub 'J'
5991 jr nz,l2830h
5992 inc de
5993 l2830h:
5994 ld (TRJFLG),a
5995 call sub_289fh
5996 jr z,l283eh
5997 ld hl,1
5998 call get_lastarg_def
5999 l283eh:
6000 ld (TCCSTR),hl
6001 sub a
6002 ld (XA747),a
6003 l2845h:
6004 call sub_26e7h
6005 jr l289ch
6006 l284ah:
6007 call sub_0e68h
6008 ld a,(TRJFLG)
6009 and a
6010 jr nz,l2864h
6011 ld iy,(REG.PC)
6012 call sub_28c1h
6013 jr z,l2864h
6014 ld hl,l2726h
6015 call lookup_opc
6016 jr nc,l2845h
6017 l2864h:
6018 ld a,(XBFEA)
6019 and a
6020 jr z,l2881h
6021 ld de,(TCCSTR)
6022 call EXPR
6023 ld a,h
6024 or l
6025 add a,0ffh
6026 sbc a,a
6027 ld hl,XBFEA
6028 xor (hl)
6029 bit 1,a
6030 jr z,l288ch
6031 l287eh:
6032 jp l102eh
6033 l2881h:
6034 ld hl,(TCCSTR)
6035 dec hl
6036 ld (TCCSTR),hl
6037 ld a,h
6038 or l
6039 jr z,l287eh
6040 l288ch:
6041 call sub_26e7h
6042 jr nc,l287eh
6043 ld a,(TCNFLG)
6044 ld b,a
6045 ld a,(XA747)
6046 or b
6047 ld (XA747),a
6048 l289ch:
6049 jp l1183h
6050
6051 sub_289fh:
6052 call SKIPBL
6053 xor a
6054 ld (XBFEA),a
6055 ld a,(de)
6056 cp 'U'
6057 jr z,l28aeh
6058 cp 'W'
6059 ret nz
6060
6061 l28aeh:
6062 inc de
6063 push af
6064 push de
6065 call EXPR
6066 jp c,ERROR
6067 call assert_eol
6068 pop hl
6069 pop af
6070 ld (XBFEA),a
6071 sub a
6072 ret
6073
6074 sub_28c1h:
6075 comst
6076 ld a,(iy+000h)
6077 ld b,(iy+0001)
6078 comend
6079 cp 0edh
6080 jr z,l28dbh
6081 and 0dfh
6082 cp 0ddh
6083 ret nz
6084 ld a,b
6085 cp 0e9h
6086 ret
6087 l28dbh:
6088 ld a,b
6089 and 0f7h
6090 cp 045h
6091 ret
6092
6093 ?excom:
6094 ex (sp),hl
6095 push af
6096 push bc
6097 push de
6098 ld c,(hl)
6099 ld b,000h
6100 inc hl
6101 ld a,?lcmax
6102 sub c
6103 ld de,?exeit
6104 ldir
6105 ex de,hl
6106 ld (hl),018h
6107 inc hl
6108 ld (hl),a
6109 ex de,hl
6110 pop de
6111 pop bc
6112 pop af
6113 ex (sp),hl
6114 if CPU_Z180
6115 push hl
6116 ld hl,(ubbr)
6117
6118 else
6119 push af
6120 ld a,(ubnk)
6121 endif
6122 if ROMSYS
6123 push af
6124 ld a,(uromen)
6125 endif
6126 jp ?comcod
6127
6128 ;------------------------------------------
6129 ; ddtram
6130 ;------------------------------------------
6131
6132 vartab:
6133 ; dseg
6134 cseg
6135 ddtram:
6136 ;todo:
6137 ; The following 2 params are changeable by user.
6138 ; Should these moved to top ram?
6139 ;
6140 ddtrst: rst DRSTNUM ;rst used by ddtz
6141 ddtei: ei ;ints enabled/disabled while ddtz is running
6142 ret ;
6143 offs.pc:
6144 dw TPA
6145 offs.@:
6146 dw 0
6147 CMD_ERR:
6148 dw 0
6149 CMD_RPT:
6150 dw DDTZML
6151 ci.buf:
6152 db 80
6153 rept 83
6154 db 0
6155 endm
6156 CON.COL:
6157 db 0
6158 XA747:
6159 db 0
6160 bp_tab:
6161 rept BP_CNT
6162 db 0,0
6163 dw 0,0,0
6164 endm
6165 BP_SIZE equ 8
6166 sexp1:
6167 dw sexpbuf
6168 sexp2:
6169 dw sexpbuf
6170 sexpbuf:
6171 rept 128
6172 db 0
6173 endm
6174 sexpbufe:
6175
6176 msg.Y:
6177 dc 'Y0'
6178 reg.Y:
6179 rept 10
6180 dw 0
6181 endm
6182 lst.S:
6183 dw 0
6184 lst.IP:
6185 dw 0
6186 lst.OP:
6187 dw 0
6188 lst.OD:
6189 db 0
6190 lst.Qj:
6191 db 0
6192 lst.D:
6193 dw 0
6194 HILOD:
6195 dw 0
6196 MAXLOD:
6197 dw 0
6198 XB068:
6199 dw 0
6200 lst.A:
6201 dw 0
6202 XB06C:
6203 dw 0
6204 pfx.IXY:
6205 db 000h
6206 is.pfx.IXY:
6207 db 000h
6208 lst.L:
6209 dw 0
6210 XBE01:
6211 dw 0
6212 XBE03:
6213 db 000h
6214 XBEDD:
6215 ret ;ret cc
6216 and a
6217 pop hl
6218 inc hl
6219 jp (hl)
6220 XBFE8:
6221 db 0
6222 TCFLG:
6223 db 0
6224 XBFEA:
6225 db 0
6226 TCCSTR:
6227 dw 0
6228 TCNFLG:
6229 db 0
6230 TRJFLG:
6231 db 0
6232 wstrtflg:
6233 db 1
6234
6235 cseg
6236 vartabe:
6237
6238 ;------------------------------------------
6239
6240 .phase sysram_start+stacksize
6241 $stack:
6242 $stcka equ $ - stacksize
6243
6244 curphse defl $
6245 .dephase
6246 sysramc:
6247 .phase curphse
6248 topcodbeg:
6249
6250 reg.l2: db 0 ; 0fe50h
6251 reg.h2: db 0 ; 0fe51h
6252 reg.e2: db 0 ; 0fe52h
6253 reg.d2: db 0 ; 0fe53h
6254 reg.c2: db 0 ; 0fe54h
6255 reg.b2: db 0 ; 0fe55h
6256 reg.f2: db 0 ; 0fe56h
6257 reg.a2: db 0 ; 0fe57h
6258 db 0
6259 reg.i: db high ivtab
6260 reg.iy: dw 0 ; 0fe5ah
6261 reg.ix: dw 0 ; 0fe5ch
6262 reg.e: db 0 ; 0fe5eh
6263 reg.d: db 0 ; 0fe5fh
6264 reg.c: db 0 ; 0fe60h
6265 reg.b: db 0 ; 0fe61h
6266 if ROMSYS
6267 udcntl: db CWAITIO ; 0fe62h (mem-, io- wait)
6268 uromen: db ROM_DIS ; 0fe63h
6269 endif
6270 if CPU_Z180
6271 ubbr: db 0 ; 0fe64h
6272 ucbar: db USR$CBAR ; 0fe65h
6273 else
6274 db 0 ; 0fe64h
6275 ubnk: db 0 ; 0fe65h
6276 endif
6277 reg.f: db 0 ; 0fe66h
6278 reg.a: db 0 ; 0fe67h
6279 reg.l: db 0 ; 0fe68h
6280 reg.h: db 0 ; 0fe69h
6281 reg.sp: dw TOPRAM ; 0fe6ah
6282
6283 $go:
6284 if ROMSYS
6285 out (000h),a ;064c fe6c
6286 out0 (dcntl),l
6287 pop hl
6288 endif
6289 if CPU_Z180
6290 out0 (cbar),h
6291 out0 (bbr),l
6292 else
6293 ld a,h
6294 call selbnk
6295 endif
6296 pop af
6297 pop hl
6298 ld sp,(reg.sp)
6299 reg.iff:
6300 ei
6301 db 0C3h ;jp TPA ;065f feff ($+1): reg.pc
6302 reg.pc:
6303 dw TPA
6304
6305 bpent:
6306 ld (reg.l),hl ;0662 fe82: bpent:
6307 pop hl
6308 dec hl
6309 ld (reg.pc),hl
6310 ld (reg.sp),sp
6311 ld sp,reg.l
6312 push af
6313 if CPU_Z180
6314 ;;; TODO: cbar on trap?
6315 in0 h,(cbar)
6316 in0 l,(bbr)
6317 ld a,SYS$CBAR
6318 out0 (cbar),a
6319 else
6320 ld a,(@cbnk)
6321 ld h,a
6322 xor a
6323 ld l,a
6324 call selbnk
6325 endif
6326 push hl
6327
6328 if ROMSYS
6329 in0 l,(dcntl)
6330 ld a,CWAITROM+CWAITIO
6331 out0 (dcntl),a
6332 ld a,($crom)
6333 cp c$rom
6334 ld a,ROM_EN
6335 out (000h),a
6336 endif
6337
6338 jp bpddtz
6339
6340 ?comcod:
6341 if ROMSYS
6342 out (000h),a ;0692 feb2
6343 pop af
6344 endif
6345
6346 if CPU_Z180
6347 out0 (cbar),h
6348 out0 (bbr),l
6349 pop hl
6350 else
6351 call selbnk
6352 pop af
6353 endif
6354 ?exeit:
6355 ds ?lcmax+2
6356 push af
6357 if CPU_Z180
6358 ld a,SYS$CBAR
6359 out0 (cbar),a
6360
6361 ;;; TODO: bbr?
6362 else
6363 xor a
6364 call selbnk
6365 endif
6366 if ROMSYS
6367 ld a,ROM_EN
6368 out (000h),a
6369 endif
6370
6371 pop af
6372 ret
6373
6374 topcodend:
6375 curph defl $
6376 .dephase
6377 sysrame:
6378
6379 end