jr c,ERROR\r
cp 'Z'+1-'@'\r
jr nc,ERROR\r
- add a,a\r
ld hl,CMDTAB\r
- call add_hl_a\r
+ call add_hl_a2\r
ld a,(hl)\r
inc hl\r
ld h,(hl)\r
crlf:\r
call pstr_inl\r
dc CR,LF\r
- call inchar\r
- ld a,0\r
+ xor a\r
ld (con_col),a\r
+ call inchar\r
jr c,mainloop\r
ret\r
\r
sub_01d9h:\r
call pstr_inl\r
dc '-'\r
- dec hl\r
- jp cpl.hl\r
+ jp neg.hl\r
\r
out_hl_dec_neg:\r
push hl\r
l01c9h:\r
rlca\r
push af\r
- ld a,'0'/2\r
- adc a,a\r
- call outchar\r
+ and 1\r
+ call out_dgt\r
pop af\r
djnz l01c9h\r
ld a,'"'\r
cp ' '\r
push af\r
call nc,outbl\r
- call outquote\r
+ call pstr_inl\r
+ dc ''''\r
pop af\r
jr nc,l0242h\r
sub 0c0h\r
call outchar\r
cp ''''\r
call z,outchar\r
- call outquote\r
+ call pstr_inl\r
+ dc ''''\r
sla c\r
pop bc\r
ret nc\r
call outbl\r
outbl:\r
ld a,' '\r
- jr outchar\r
-\r
-outquote:\r
- ld a,''''\r
outchar:\r
push ix\r
push iy\r
pop ix\r
ret\r
\r
-pstr:\r
- ld a,(hl)\r
- inc hl\r
- and a\r
- ret z\r
- call outchar\r
- ret m\r
- jr pstr\r
-\r
-pstr_inl:\r
- ex (sp),hl\r
- call pstr\r
- ex (sp),hl\r
- ret\r
-\r
p_align_@_sym:\r
push de\r
ld de,(var.@)\r
\r
;-------------------------------------------------------------------------------\r
\r
+add_hl_a2:\r
+ add a,a\r
add_hl_a:\r
add a,l\r
ld l,a\r
pop bc\r
ret\r
l0336h:\r
- call sub_0345h\r
+ call str_sel_next\r
l0339h:\r
pop de\r
and a\r
pop bc\r
ret\r
\r
-sel_dc_string:\r
+str_sel:\r
inc b\r
-l033eh:\r
- dec b\r
- ret z\r
- call sub_0345h\r
- jr l033eh\r
+ jr str_sel2\r
+str_sel1:\r
+ call str_sel_next\r
+str_sel2:\r
+ djnz str_sel1\r
+ ret\r
\r
-sub_0345h:\r
+str_sel_next:\r
ld a,(hl)\r
and a\r
ret z\r
ret m\r
jr l0348h\r
\r
-sub_034eh:\r
+get_arg_range_target:\r
call get_arg_range\r
push hl\r
push bc\r
call next_arg\r
- call sub_0363h\r
+ call get_arg_final\r
ex de,hl\r
pop bc\r
pop hl\r
jr c,error0\r
ret\r
\r
-sub_0363h:\r
+get_arg_final:\r
call sub_035dh\r
l0366h:\r
jp assert_eol\r
l0411h:\r
ld hl,tab_func_eqlege\r
ld a,b\r
- add a,a\r
- call add_hl_a\r
+ call add_hl_a2\r
ld c,(hl)\r
inc hl\r
ld b,(hl)\r
call lookupch\r
ld a,b\r
ld hl,tblf_opa\r
- add a,a\r
- call add_hl_a\r
+ call add_hl_a2\r
ld c,(hl)\r
inc hl\r
ld b,(hl)\r
jr c,error1\r
inc de\r
get_y_val:\r
- add a,a\r
ld hl,reg_Y\r
- call add_hl_a\r
+ call add_hl_a2\r
ld a,(hl)\r
inc hl\r
ld h,(hl)\r
inc hl\r
ld h,(hl)\r
ld l,a\r
- and a\r
+ xor a ;clr cy, a=0\r
bit 0,c\r
ret nz\r
- ld h,000h\r
+ ld h,a\r
ret\r
\r
+fact_factinv:\r
+ call fact_factor\r
+ jr cpl.hl\r
+\r
fact_factneg:\r
call fact_factor\r
+neg.hl:\r
dec hl\r
cpl.hl:\r
ld a,h\r
ld l,a\r
ret\r
\r
-fact_factinv:\r
- call fact_factor\r
- jr cpl.hl\r
-\r
fact_mem:\r
call expr1\r
jr c,error1\r
call p_flags\r
ld a,(reg.iff)\r
cp 0f3h\r
- jp z,outbl\r
+ jr z,outbl_1\r
ld a,'E'\r
jp outchar\r
p_f2:\r
ld a,(reg.f2)\r
call p_flags\r
- jp outbl\r
+ jr outbl_1\r
\r
p_flags:\r
push hl\r
ld a,(de)\r
call out_hex\r
l06e2h:\r
- call outbl\r
pop de\r
pop hl\r
- ret\r
+outbl_1:\r
+ jp outbl\r
\r
b_06e9_start:\r
DC 'A '\r
add hl,bc\r
ex de,hl\r
ld c,003h\r
- jp l0c33h\r
+ jr l0c33h\r
\r
;-------------------------------------------------------------------------------\r
; > X\r
jp z,ERROR\r
ex de,hl\r
ld hl,t_reg_names\r
- call sel_dc_string\r
+ call str_sel\r
l0c12h:\r
call l0c33h\r
l0c15h:\r
call get_line\r
call skipbl\r
jr z,l0c30h\r
- call sub_0363h\r
+ call get_arg_final\r
ex de,hl\r
pop bc\r
pop hl\r
; Verify (compare) two memory areas\r
\r
cmd_V:\r
- call sub_034eh\r
+ call get_arg_range_target\r
l0dedh:\r
push bc\r
ld a,(de)\r
call crlf\r
l0e10h:\r
pop bc\r
- inc hl\r
inc de\r
- dec bc\r
- ld a,b\r
- or c\r
- jr nz,l0dedh\r
+ cpi\r
+ jp pe,l0dedh\r
ret\r
\r
;-------------------------------------------------------------------------------\r
inc de\r
l0e1fh:\r
push af\r
- call sub_034eh\r
+ call get_arg_range_target\r
push hl\r
push de\r
push bc\r
ret nz\r
jp ERROR\r
\r
-sub_0ef7h:\r
+sub_0ef7h: ;from cmd_Q, cmd_Z\r
db 0e6h ; and 037h (clear carry)\r
-sub_0ef8h:\r
+sub_0ef8h: ;from cmd_S\r
scf\r
l0ef9h:\r
push af\r
l1395h:\r
call assert_eol\r
ld a,(prefix_ixiy)\r
-l139bh:\r
+as_store_4:\r
ld (iy+000h),a\r
ld (iy+001h),b\r
ld (iy+002h),l\r
inc de\r
ld b,032h\r
\r
-as.store_3:\r
+as_store_3:\r
call assert_eol\r
ld (iy+000h),b\r
ld (iy+001h),l\r
l13c9h:\r
call assert_eol\r
ld a,0edh\r
- jr l139bh\r
+ jr as_store_4\r
l13d0h:\r
ld b,022h\r
- jr as.store_3\r
+ jr as_store_3\r
\r
l13d4h:\r
ld b,a\r
add a,006h\r
l143fh:\r
ld b,a\r
-as.store_2:\r
+as_store_2:\r
call assert_eol\r
ld (iy+000h),b\r
ld (iy+001h),l\r
call test_expr\r
call test_paren_close\r
ld b,03ah\r
- jp as.store_3\r
+ jp as_store_3\r
\r
l1471h:\r
call assert_comma\r
\r
l14e3h:\r
ld b,02ah\r
- jp as.store_3\r
+ jp as_store_3\r
\r
l14e8h:\r
call test_expr\r
ld a,001h\r
add a,b\r
ld b,a\r
- jp as.store_3\r
+ jp as_store_3\r
l14f5h:\r
call assert_comma\r
call get_char_upper\r
l163eh:\r
pop af\r
call test_expr\r
- jp as.store_3\r
+ jp as_store_3\r
\r
as.RET:\r
call arg.cc_ZCPS\r
pop af\r
l166eh:\r
call test_expr\r
- jp as.store_3\r
+ jp as_store_3\r
l1674h:\r
call assert_eol\r
ld a,b\r
ld b,0fdh\r
l1687h:\r
ld l,0e9h\r
- jp as.store_2\r
+ jp as_store_2\r
\r
l168ch:\r
DC '(HL)'\r
call assert_comma\r
l16aeh:\r
call arg.j_displ\r
- jp as.store_2\r
+ jp as_store_2\r
\r
as.IM:\r
call arg.imm_8bit\r
jr c,l1715h\r
call arg.addr_8bit\r
ld b,0dbh\r
- jp as.store_2\r
+ jp as_store_2\r
l170fh:\r
call assert_comma\r
call sub_171bh\r
jr nz,error7\r
inc de\r
ld b,0d3h\r
- jp as.store_2\r
+ jp as_store_2\r
\r
as.EX:\r
ld hl,b_176d_start\r
\r
arg.zz:\r
push hl\r
- ld hl,t_BC.DE.HL.AF\r
+ ld hl,t_arg_rp2\r
jr l181fh\r
\r
arg.reg_16bit:\r
\r
arg.ww:\r
push hl\r
- ld hl,t_BC.DE.HL.SP\r
+ ld hl,t_arg_rp\r
l181fh:\r
push bc\r
call sub_030ah\r
call skipbl\r
push bc\r
push hl\r
- ld hl,t_BCDEHL_HL_A\r
+ ld hl,t_arg_r\r
call sub_030ah\r
ld a,b\r
pop hl\r
jr l18b1h\r
\r
arg.cc_ZC:\r
- ld hl,t_tstfl_ZC\r
+ ld hl,t_arg_cc\r
ld c,003h\r
l18b1h:\r
push bc\r
ld a,(con_col)\r
add a,5\r
ld c,a\r
- call pstr\r
+ call pstr ;print mnemonic\r
call p_goto_col\r
ex de,hl\r
- call call_hl\r
+ call call_hl ;print arguments\r
pop bc\r
ld a,(disas_argtype)\r
ld hl,(disas_arg_16)\r
\r
;-------------------------------------------------------------------------------\r
\r
+disas_nopfx:\r
+ ld hl,b_1b54_start ;2 byte opcodes\r
+ call lookup_op\r
+ ld b,2\r
+ ret c\r
+ ld hl,b_1ab6_start ;1 byte opcodes (no parameters)\r
+ call sub_1a72h\r
+ ld b,1\r
+ ret c\r
+ ld hl,b_1ad1_start ;1 byte opcodes\r
+ call lookup_op\r
+ ld b,1\r
+ ret c\r
+ ld hl,b_1b9b_start ;3 byte opcodes\r
+ call lookup_op\r
+ ret nc\r
+ ld b,3\r
+ ret\r
+\r
+;-------------------------------------------------------------------------------\r
+\r
+disas_pfx.ED:\r
+ inc iy\r
+ ld hl,b_1bc9_start ;1 byte opcode, no arguments\r
+ call sub_1a72h\r
+ ld b,2\r
+ ret c\r
+ ld hl,b_1bf4_start\r
+ call lookup_op\r
+ ld b,2\r
+ ret c\r
+\r
+ ld hl,l228bh\r
+ call lookup_op\r
+ ld b,3\r
+ ret c\r
+ ld hl,b_1c40_start\r
+ call lookup_op\r
+ ld b,4\r
+ ret\r
+\r
+;-------------------------------------------------------------------------------\r
+\r
+disas_pfx.CB:\r
+ push iy\r
+ inc iy\r
+ ld a,(isprefix_ixiy)\r
+ and a\r
+ jr z,l1a42h\r
+ inc iy\r
+l1a42h:\r
+ ld hl,b_1c55_start\r
+ call lookup_op\r
+ pop iy\r
+ ld b,2\r
+ ret\r
+\r
+;-------------------------------------------------------------------------------\r
+\r
disas_pfx.DDFD:\r
inc iy\r
ld hl,b_19ef_start\r
\r
;-------------------------------------------------------------------------------\r
\r
-disas_pfx.ED:\r
- inc iy\r
- ld hl,b_1bc9_start\r
- call sub_1a72h\r
- ld b,2\r
- ret c\r
- ld hl,b_1bf4_start\r
- call lookup_opc\r
- ld b,2\r
- ret c\r
-\r
- ld hl,l228bh\r
- call lookup_opc\r
- ld b,3\r
- ret c\r
- ld hl,b_1c40_start\r
- call lookup_opc\r
- ld b,4\r
- ret\r
-\r
-;-------------------------------------------------------------------------------\r
-\r
-disas_pfx.CB:\r
- push iy\r
- inc iy\r
- ld a,(isprefix_ixiy)\r
- and a\r
- jr z,l1a42h\r
- inc iy\r
-l1a42h:\r
- ld hl,b_1c55_start\r
- call lookup_opc\r
- pop iy\r
- ld b,2\r
- ret\r
-\r
-;-------------------------------------------------------------------------------\r
-\r
-disas_nopfx:\r
- ld hl,b_1b54_start\r
- call lookup_opc\r
- ld b,2\r
- ret c\r
- ld hl,b_1ab6_start\r
- call sub_1a72h\r
- ld b,1\r
- ret c\r
- ld hl,b_1ad1_start\r
- call lookup_opc\r
- ld b,1\r
- ret c\r
- ld hl,b_1b9b_start\r
- call lookup_opc\r
- ret nc\r
- ld b,3\r
- ret\r
-\r
-;-------------------------------------------------------------------------------\r
-\r
sub_1a72h:\r
ld a,(hl)\r
cp 0ffh\r
scf\r
ret\r
\r
-lookup_opc:\r
+lookup_op:\r
ld a,(iy+000h)\r
and (hl)\r
inc hl\r
inc hl\r
ld a,(hl)\r
and a\r
- jr nz,lookup_opc\r
+ jr nz,lookup_op\r
ret\r
\r
l1aa8h:\r
dw l1ce5h\r
db 0\r
\r
-; 2 byte opdodes\r
+; 2 byte opcodes\r
b_1b54_start:\r
db 0c7h,006h,056h ;ld r,nn\r
dw l1cfah\r
jp p_arg_nn_rp\r
\r
p_arg_r1:\r
- ld hl,t_BCDEHL_HL_A\r
+ ld hl,t_arg_r\r
jr p_arg\r
\r
b_1e78_start:\r
ld hl,t_HL.IX.IY\r
jr p_arg\r
p_arg_zz:\r
- ld hl,t_BC.DE.HL.AF\r
+ ld hl,t_arg_rp2\r
jr l1e8eh\r
p_arg_ww:\r
- ld hl,t_BC.DE.HL.SP\r
+ ld hl,t_arg_rp\r
l1e8eh:\r
ld a,(iy+000h)\r
rra\r
ld hl,t_tstfl_ZCPS\r
p_arg:\r
ld b,a\r
- call sel_dc_string\r
- jp pstr\r
+ ;fall thru\r
+pstr_sel:\r
+ call str_sel\r
+ ;fall thru\r
+pstr:\r
+ ld a,(hl)\r
+ inc hl\r
+ and a\r
+ ret z\r
+ call outchar\r
+ ret m\r
+ jr pstr\r
+\r
+pstr_inl:\r
+ ex (sp),hl\r
+ call pstr\r
+ ex (sp),hl\r
+ ret\r
\r
;-------------------------------------------------------------------------------\r
\r
DC 'TSTIO'\r
DB 0\r
\r
-t_BCDEHL_HL_A:\r
+t_arg_r:\r
DC 'B'\r
DC 'C'\r
DC 'D'\r
DC '(HL)'\r
DC 'A'\r
DB 0\r
-t_BC.DE.HL.SP:\r
+t_arg_rp:\r
DC 'BC'\r
DC 'DE'\r
DC 'HL'\r
DC 'SP'\r
DB 0\r
-t_BC.DE.HL.AF:\r
+t_arg_rp2:\r
DC 'BC'\r
DC 'DE'\r
t_HL.AF:\r
DC 'IX'\r
DC 'IY'\r
DB 0\r
-t_tstfl_ZC:\r
+t_arg_cc:\r
DC 'NZ'\r
DC 'Z'\r
DC 'NC'\r
ld de,BDOS\r
and a\r
sbc hl,de\r
- ld hl,l20edh\r
+ ld hl,l20edh ;set break after BDOS call\r
jr z,l2031h\r
ld iy,(reg.pc)\r
call disas_get_instrlen\r
call bp_trace_enter\r
ld iy,(reg.pc)\r
ld hl,b_2039_start\r
- call lookup_opc\r
+ call lookup_op\r
ccf\r
ret c\r
ex de,hl\r
pop hl\r
ret\r
l20edh:\r
- ld hl,(reg_sp)\r
+ ld hl,(reg_sp) ;break on return address\r
ld e,(hl)\r
inc hl\r
ld d,(hl)\r
call sub_21c8h\r
jr z,l216bh\r
ld hl,b_2048_start\r
- call lookup_opc\r
+ call lookup_op\r
jr nc,l214ch\r
l216bh:\r
ld a,(trace_UW_flag) ;0 or 'U' or 'W'\r