.phase TPA\r
\r
jp start\r
+ ds 3\r
\r
ldr_end:\r
ldr_size equ $ - TPA\r
\r
; ddtz specific definitions\r
\r
-STACK_SIZE equ 64 ;ddtz internal stack\r
+STACK_SIZE equ 80 ;ddtz internal stack\r
CONBUF_SIZE equ 80 ;Size of console input buffer\r
EXPR_BUF_SIZE equ 128 ;expressen buffer for conditional breakpoints\r
BP_CNT equ 12 ;Number of breakpoints\r
BP_SIZE equ 8 ;Size of a breakpoint record\r
-YREG_CNT equ 10 ;Number of Y registers (0..9)\r
\r
;-------------------------------------------------------------------------------\r
\r
jp ddtz_bdos\r
l0003h:\r
rst 30h\r
-sub_0004h:\r
+di_or_ei:\r
nop\r
ret\r
ddtz_bdos:\r
current_cseg defl $ - current_cseg\r
.phase current_phase + current_cseg\r
signon:\r
- db 'Symbolic DDTZ/180'\r
+ db 'DDTZ/180'\r
db ' - Version '\r
maclib version.inc\r
defvers\r
var.$: dw 0000h\r
var.@: dw 0\r
\r
-error_func:dw l0146h\r
cmd_rpt:dw mainloop\r
\r
+;-------------------------------------------------------------------------------\r
+\r
conbuf:\r
db CONBUF_SIZE\r
\r
ld a,0fbh\r
l0093h:\r
ld (reg.iff),a\r
- call sub_0004h\r
+ call di_or_ei\r
ld hl,ddtz_base\r
ld l,000h\r
ld (reg_sp),hl\r
- call cpy_fcb2\r
ld a,(dfcb1+1)\r
cp ' '\r
ld hl,0\r
\r
ds CONBUF_SIZE + 3 - ($ - conbuf)\r
\r
+;-------------------------------------------------------------------------------\r
+\r
CMDTAB:\r
dw cmd_@ ;examine/substitute the displacement register @\r
- dw cmd_A ;Assemble\r
+ dw ERROR ;cmd_A ;Assemble\r
dw cmd_B ;Breakpoints display/set/clear\r
dw cmd_C ;trace over Calls\r
dw cmd_D ;Display memory in hex and ascii\r
dw cmd_O ;Output a byte to port\r
dw ERROR ;\r
dw cmd_Q ;Qery memory for byte string\r
- dw cmd_R ;Read binary or hex file and/or symbol file\r
+ dw cmd_R ;Read binary or hex file\r
dw cmd_S ;Substitute memory\r
dw cmd_T ;Trace\r
dw ERROR ;\r
dw cmd_V ;Verify (compare) two memory areas\r
dw cmd_W ;Write a file to disk\r
dw cmd_X ;eXamine [and substitute] registers\r
- dw cmd_Y ;examine [and substitute] Y variables\r
+ dw ERROR ;cmd_Y ;examine [and substitute] Y variables\r
dw cmd_Z ;Zap (fill) memory with a byte string\r
\r
+ERROR:\r
+p_msg_error:\r
+ call pstr_inl\r
+ dc '?',CR,LF\r
+ ;fall thru\r
mainloop:\r
ld sp,stack\r
- ld hl,l0146h\r
- ld (error_func),hl\r
ld hl,(reg.pc)\r
ld (var.$),hl\r
call bp_clr_temporary\r
inc hl\r
ld h,(hl)\r
ld l,a\r
- jr exe_hl\r
\r
-ERROR:\r
- ld hl,(error_func)\r
exe_hl:\r
call CALL_HL\r
jr mainloop\r
\r
-l0146h:\r
- call pstr_inl\r
- dc '?'\r
- ;fall thru\r
+;-------------------------------------------------------------------------------\r
+\r
crlf:\r
call pstr_inl\r
- db CR,LF+80h\r
+ dc CR,LF\r
call inchar\r
ld a,0\r
ld (con_col),a\r
out_hl_dec_neg:\r
push hl\r
call sub_01d9h\r
- defb 03eh\r
+ defb 03eh ;ld a,.. swallow push hl\r
out.hl.dec:\r
push hl\r
ld b,006h\r
pop af\r
\r
out_dgt:\r
- and 0fh\r
- cp 10\r
- jr c,l0229h\r
- add a,007h\r
-l0229h:\r
- add a,'0'\r
+ or 0f0h\r
+ daa\r
+ add a,0a0h\r
+ adc a,040h\r
jr outchar\r
\r
out.bin.w:\r
out.bin.b:\r
ld b,8\r
l01c9h:\r
- add a,a\r
- push af\r
- ld a,00\r
- adc a,a\r
- call out_dgt\r
+ rlca\r
+ push af\r
+ ld a,'0'/2\r
+ adc a,a\r
+ call outchar\r
pop af\r
djnz l01c9h\r
ld a,'"'\r
ld a,' '\r
jr outchar\r
\r
-p_char_lparen:\r
- ld a,'('\r
- jr outchar\r
-\r
outquote:\r
ld a,''''\r
outchar:\r
ex (sp),hl\r
ret\r
\r
-p_align_@_sym:\r
- push de\r
- ld de,(var.@)\r
- ld a,d\r
- or e\r
- pop de\r
- ld a,(symlen_max)\r
- jr z,$+4\r
- add a,6\r
- add a,c\r
- ld c,a\r
p_goto_col:\r
ld a,(con_col)\r
cp c\r
call outbl\r
jr p_goto_col\r
\r
-\r
+;-------------------------------------------------------------------------------\r
\r
inchar:\r
+ push ix\r
push hl\r
push de\r
push bc\r
pop bc\r
pop de\r
pop hl\r
+ pop ix\r
ret\r
\r
get_line:\r
ld c,BDOS_CBUF\r
call ddtz_bdos\r
call crlf\r
- ld de,conbuf+1\r
- ld a,(de)\r
- ld b,a\r
- ld c,0\r
- inc b\r
-l0162h:\r
- inc de\r
- dec b\r
- jr z,l0194h\r
- ld a,(de)\r
- bit 0,c\r
- call z,toupper\r
- ld (de),a\r
- cp ''''\r
- jr nz,l0162h\r
- push de\r
- dec de\r
- ld a,(de)\r
- cp ''''\r
- jr z,l0190h\r
- dec de\r
- ld a,(de)\r
- cp '^'\r
- jr z,l0184h\r
- dec de\r
- ld a,(de)\r
- cp '^'\r
- jr nz,l0190h\r
-l0184h:\r
- inc de\r
- push bc\r
- call sub_0303h\r
- pop bc\r
- dec de\r
- ld a,(de)\r
- cp ''''\r
- jr z,l0191h\r
-l0190h:\r
- inc c\r
-l0191h:\r
- pop de\r
- jr l0162h\r
-l0194h:\r
- xor a\r
- ld (de),a\r
- ld de,conbuf+2\r
+ ld hl,conbuf+1\r
+ ld e,(hl)\r
+ xor a\r
+ ld d,a\r
+ inc hl\r
+ ex de,hl\r
+ add hl,de\r
+ ld (hl),a\r
pop hl\r
ret\r
\r
+;-------------------------------------------------------------------------------\r
+\r
+get_char_upper:\r
+ ld a,(de)\r
toupper:\r
cp 'a'\r
ret c\r
cp 'z'+1\r
- ret nc\r
+ ccf\r
+ ret c\r
and 05fh\r
ret\r
\r
+;-------------------------------------------------------------------------------\r
+\r
skipbl0:\r
inc de\r
skipbl:\r
- ld a,(de)\r
+ call get_char_upper\r
call test_whitespace\r
jr z,skipbl0\r
or a\r
to_error:\r
jp ERROR\r
\r
+;-------------------------------------------------------------------------------\r
+\r
chk_stack:\r
push hl\r
push de\r
ld hl,0\r
add hl,sp\r
- ld de,stack-40\r
+ ld de,stack-(STACK_SIZE-28)\r
call cp_hl_de\r
pop de\r
pop hl\r
jr c,to_error\r
ret\r
\r
+;-------------------------------------------------------------------------------\r
+\r
add_hl_a:\r
add a,l\r
ld l,a\r
sbc hl,de\r
add hl,de\r
ret\r
-\r
-sub_hl_a1:\r
- dec hl\r
-sub_hl_a:\r
- push bc\r
- ld c,a\r
- ld b,0\r
- or a\r
- sbc hl,bc\r
- pop bc\r
- ret\r
-\r
-sym_getname:\r
- push de\r
- push hl\r
- ld hl,ddtz_base+2\r
-sgn_l:\r
- ld d,(hl)\r
- dec hl\r
- ld e,(hl)\r
- dec hl\r
- ld a,(hl)\r
- cp 0c3h\r
- jr z,sgn_e\r
-\r
- ex (sp),hl\r
- call cp_hl_de\r
- jr z,sgn_e\r
- ex (sp),hl\r
- call sub_hl_a1\r
- jr sgn_l\r
-sgn_e:\r
- sub 0c3h\r
- pop hl\r
- pop de\r
- ret\r
-\r
-p_symstr:\r
- push bc\r
- ld b,(hl)\r
-pss_l:\r
- dec hl\r
- ld a,(hl)\r
- call outchar\r
- djnz pss_l\r
- dec hl\r
- pop bc\r
- ret\r
-\r
-p_symbol:\r
- if 0\r
- ld a,(dash_flag)\r
- or a\r
- ret nz\r
- endif\r
- push hl\r
- call sym_getname\r
- call nz,p_symstr\r
- pop hl\r
- ret\r
-\r
-p_label:\r
- if 0\r
- ld a,(dash_flag)\r
- or a\r
- ret nz\r
- endif\r
- push hl\r
- call sym_getname\r
- jr z,pl_e\r
- call p_symstr\r
- call pstr_inl\r
- dc ':'\r
- call crlf\r
-pl_e:\r
- pop hl\r
- ret\r
+;-------------------------------------------------------------------------------\r
\r
lookupch:\r
ld b,0\r
ld a,(hl)\r
and a\r
ret z\r
- ld a,(de)\r
+ call get_char_upper\r
cp (hl)\r
jr z,l0300h\r
inc hl\r
ret\r
\r
sub_0303h:\r
- ld hl,b_0cc3_start\r
+ ld hl,t_reg_names\r
ld b,07fh\r
jr l030ch\r
\r
sub_0318h:\r
push bc\r
res 7,b\r
- defb 03eh\r
+ defb 03eh ;ld a,nn\r
sub_031ch:\r
push bc\r
push de\r
l031eh:\r
- ld a,(de)\r
+ call get_char_upper\r
xor (hl)\r
and 07fh\r
jr nz,l0336h\r
jr l0366h\r
\r
b_037c_start:\r
- defb 0e6h\r
+ defb 0e6h ;and a,.. clear carry\r
get_arg_range:\r
scf\r
ex af,af'\r
jr c,error0\r
ex af,af'\r
pop hl\r
- defb 03eh\r
+ defb 03eh ;ld a,.. swallow pop af\r
l038ch:\r
pop af\r
call get_range\r
scf\r
ret\r
\r
+;-------------------------------------------------------------------------------\r
+\r
expr:\r
call skipbl\r
expr1:\r
pop de\r
ret\r
\r
+;-------------------------------------------------------------------------------\r
+\r
do_op_eq:\r
jr z,l03edh\r
jr l03ech\r
; de: r (x%y)\r
\r
div_hl_de:\r
- push bc\r
- ex de,hl\r
- ld b,h\r
- ld c,l\r
- ld hl,0\r
- ld a,16\r
+ push bc\r
+ ex de,hl ;de: x\r
+ ld b,h ;bc: y\r
+ ld c,l\r
+ ld hl,0 ;hl: r\r
+ ld a,16\r
\r
; de: x (x shifted out, q shifted in)\r
; bc: y\r
; hl: r (initially 0)\r
\r
-l047eh:\r
- push af\r
- add hl,hl\r
- ex de,hl\r
- xor a\r
- add hl,hl\r
- ex de,hl\r
- adc a,l\r
- sub c\r
- ld l,a\r
- ld a,h\r
- sbc a,b\r
- ld h,a\r
- inc de\r
- jr nc,l048fh\r
- add hl,bc\r
- dec de\r
-l048fh:\r
- pop af\r
- dec a\r
- jr nz,l047eh\r
- ex de,hl\r
- pop bc\r
+div_lp:\r
+ ex de,hl\r
+ add hl,hl ;x <<= 1\r
+ ex de,hl\r
+ adc hl,hl ;r <<= 1\r
+ inc de\r
+ or a\r
+ sbc hl,bc\r
+ jr nc,div_norestore\r
+ dec de\r
+ add hl,bc\r
+div_norestore:\r
+ dec a\r
+ jr nz,div_lp\r
+ ex de,hl\r
+ pop bc\r
ret\r
\r
doop_and:\r
dw doop_xor\r
dw 0\r
\r
+;-------------------------------------------------------------------------------\r
+\r
fact_factor:\r
call do_factor\r
ret nc\r
ld hl,(var.$)\r
cp '$'\r
ret z\r
+ ld hl,ddtz_base\r
+ cp 'Z'\r
+ ret z\r
cp '-'\r
jr z,fact_factneg\r
cp '~'\r
jr z,fact_factor\r
cp '^'\r
jr z,fact_reg.CPU\r
- cp 'Y'\r
- jr z,fact_reg.Y\r
cp '('\r
jr z,fact_mem\r
cp '['\r
jr z,expr_brckt\r
cp ''''\r
jr z,fact_factstring\r
- cp '.'\r
- jr z,fact_symbol\r
dec de\r
scf\r
ret\r
\r
-fact_reg.Y:\r
- call get.decdigit\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
- ld a,(hl)\r
- inc hl\r
- ld h,(hl)\r
- ld l,a\r
- and a\r
- ret\r
+;-------------------------------------------------------------------------------\r
\r
fact_factstring:\r
ld hl,0\r
error1:\r
jp ERROR\r
\r
-fact_symbol:\r
- push bc\r
- ld hl,ddtz_base ;symtbl start\r
-\r
-fs_nxtsym:\r
- ld a,(hl) ;symlen\r
- cp 0c3h\r
- jr z,error1\r
- ld b,a ;symlen\r
- inc b\r
- push hl ;symtbl ptr\r
- push de ;inpsym ptr\r
-fs_2:\r
- ld a,(de)\r
- djnz fs_3\r
- call test_sym_char\r
- jr z,fs_cont\r
- pop hl ;inpsym ptr (discard)\r
- pop hl ;symtbl ptr\r
- inc hl\r
- ld a,(hl) ;symval h\r
- inc hl\r
- ld h,(hl) ;symval l\r
- ld l,a\r
- or a ;clear carry\r
- pop bc\r
- ret\r
-fs_3:\r
- inc de\r
- dec hl\r
- cp (hl)\r
- jr z,fs_2\r
-fs_cont: ;start over\r
- pop de ;inpsym ptr\r
- pop hl ;symtbl ptr\r
- ld a,(hl)\r
- add a,3\r
- call sub_hl_a\r
- jr fs_nxtsym\r
+;-------------------------------------------------------------------------------\r
\r
get.number:\r
call get.hexdigit\r
jr next_bindigit\r
l05e4h:\r
cp '"'\r
- jp nz,ERROR\r
+ jr nz,error11\r
call get.bindigit\r
jr nc,l05dbh\r
or a\r
decnum_done:\r
cp '.'\r
ret z\r
+error11:\r
jp ERROR\r
\r
sub_060ch:\r
- ld a,(de)\r
- cp '['\r
+ call get_char_upper\r
+ cp 'Z'+1\r
jr l0614h\r
\r
get.hexdigit:\r
ld a,(de)\r
hex_digit:\r
+ call toupper\r
cp 'F'+1\r
l0614h:\r
ccf\r
ret\r
\r
get.decdigit:\r
- ld a,(de)\r
+ call get_char_upper\r
l061eh:\r
cp '9'+1\r
jr l0625h\r
\r
get.bindigit:\r
- ld a,(de)\r
+ call get_char_upper\r
cp '1'+1\r
l0625h:\r
ccf\r
sub '0'\r
ret\r
\r
+;-------------------------------------------------------------------------------\r
+\r
p_cpustat0:\r
call assert_eol\r
p_cpustat:\r
jp outbl\r
\r
p_flags:\r
- ld b,a\r
- ld a,'S'\r
- call sub_06aah\r
- ld a,'Z'\r
- call sub_06aah\r
- rl b\r
- ld a,'H'\r
- call sub_06aah\r
- rl b\r
- ld a,'V'\r
- call sub_06aah\r
- ld a,'N'\r
- call sub_06aah\r
- ld a,'C'\r
-sub_06aah:\r
- rl b\r
- jp c,outchar\r
- jp outbl\r
+ push hl\r
+ ld hl,t_flag_names+7\r
+ ld c,a\r
+ ld b,8\r
+fl_loop:\r
+ ld a,' '\r
+ cp (hl)\r
+ ld a,c\r
+ rlca\r
+ ld c,a\r
+ jr z,fl_skip\r
+ ld a,(hl)\r
+ call c,outchar\r
+ call nc,outbl\r
+fl_skip:\r
+ dec hl\r
+ djnz fl_loop\r
+ pop hl\r
+ ret\r
\r
p_regs:\r
push de\r
db 000h\r
db 000h\r
\r
+;-------------------------------------------------------------------------------\r
+; > G [startaddr] [;breakp..]\r
+; Go [to start] [with temporary breakpoints]\r
+\r
cmd_G:\r
sub a\r
ld (trace_call_flag),a\r
- ld (l0941h),a\r
+ ld (bp_p_cpu_flag),a\r
call expr\r
jr c,l0740h\r
ld (reg.pc),hl\r
l0740h:\r
call skipbl\r
- jp z,user_go\r
+ jr z,user_go0\r
cp ';'\r
jp nz,ERROR\r
inc de\r
ld a,002h\r
call bp_enter\r
+user_go0:\r
jp user_go\r
\r
+;-------------------------------------------------------------------------------\r
+\r
+bpl_init:\r
+ ld b,BP_CNT\r
+ ld ix,bp_tab\r
+ ex (sp),hl\r
+ ld (pbl_loop_adr),hl\r
+ ex (sp),hl\r
+ ret\r
+\r
+bpl_next:\r
+ ld de,BP_SIZE\r
+ push af\r
+ add ix,de\r
+ pop af\r
+ dec b\r
+ ret z\r
+\r
+ ex (sp),hl\r
+ ld hl,(pbl_loop_adr)\r
+ ex (sp),hl\r
+ ret\r
+\r
bp_clr_temporary:\r
- ld b,BP_CNT\r
- ld ix,bp_tab\r
-l075ah:\r
+ call bpl_init\r
+\r
ld a,(ix+000h)\r
and 0f1h\r
ld (ix+000h),a\r
call bp_clr_condition\r
- ld de,BP_SIZE\r
- add ix,de\r
- djnz l075ah\r
+\r
+ call bpl_next\r
ret\r
\r
+;-------------------------------------------------------------------------------\r
+; > B\r
+; display all breakpoints\r
+; > B breakp [breakp..]\r
+; set breakpoints\r
+; > BX\r
+; clear all breakpoints\r
+; > BX address [address..]\r
+; clear breakpoints\r
+;\r
+; where breakp is:\r
+; [R] expression [I condition]\r
+\r
cmd_B:\r
call skipbl\r
jr z,bp_print\r
dec de\r
ld a,001h\r
jp bp_enter\r
+\r
bp_clr0:\r
call skipbl\r
jr z,bp_clr_all\r
bp_clr_all:\r
scf\r
bp_clr:\r
- ld b,BP_CNT\r
- ld ix,bp_tab\r
-l0799h:\r
+ call bpl_init\r
+\r
push af\r
jr c,l07a7h\r
ld e,(ix+002h)\r
ld (ix+000h),000h\r
call bp_clr_condition\r
l07aeh:\r
- ld de,BP_SIZE\r
- add ix,de\r
pop af\r
- djnz l0799h\r
+ call bpl_next\r
ret\r
\r
bp_print:\r
- ld b,BP_CNT\r
- ld ix,bp_tab\r
-bp_pr_l:\r
+ call bpl_init\r
+\r
bit 0,(ix+000h)\r
jr z,bp_pr_cont\r
ld a,'R'\r
ld l,(ix+002h)\r
ld h,(ix+003h)\r
call out.hl.@\r
- call outbl\r
- call p_symbol\r
- ld c,9\r
- call p_align_@_sym\r
call pstr_inl\r
- dc ':'\r
+ dc ' :'\r
ld l,(ix+004h)\r
ld h,(ix+005h)\r
call out_hl\r
l0805h:\r
call crlf\r
bp_pr_cont:\r
- ld de,BP_SIZE\r
- add ix,de\r
- djnz bp_pr_l\r
+ call bpl_next\r
ret\r
\r
+;-------------------------------------------------------------------------------\r
; Add break points to list\r
; A = 1 Permanent (B command)\r
; A = 2 Temporary (G command)\r
bp_e_1:\r
push bc\r
call expr\r
- jp c,ERROR\r
+ jr c,error12\r
pop bc\r
bit 0,b\r
push bc\r
jr bp_enter\r
\r
bp_get_freeslot:\r
- ld b,BP_CNT\r
- ld ix,bp_tab\r
-bp_gf_l:\r
+ call bpl_init\r
+\r
ld a,(ix+000h)\r
and 00fh\r
ret z\r
- push bc\r
- ld bc,BP_SIZE\r
- add ix,bc\r
- pop bc\r
- djnz bp_gf_l\r
+\r
+ call bpl_next\r
+error12\r
jp ERROR\r
\r
bp_get_count:\r
ret nz\r
inc de\r
call expr\r
- jp c,ERROR\r
+ jr c,error12\r
ret\r
\r
bp_get_condition:\r
call skipbl\r
push de\r
call expr\r
- jp c,ERROR\r
+ jr c,error12\r
ex de,hl\r
pop de\r
push de\r
add hl,bc\r
ld de,expr_bufe\r
call cp_hl_de\r
- jp nc,ERROR\r
- pop hl\r
- ld (expr_p2),hl\r
- pop de\r
- ex de,hl\r
+ jr nc,error12\r
+ pop de\r
+ pop hl\r
+ push de\r
ldir\r
- xor a\r
- ld (de),a\r
- inc de\r
ex de,hl\r
+ ld (hl),c ; trailing 0\r
+ inc hl\r
ld (expr_p1),hl\r
- ld hl,(expr_p2)\r
+ pop hl\r
ret\r
\r
+;-------------------------------------------------------------------------------\r
+; Breakpoint handling routine.\r
+\r
bpddtz:\r
ld (reg.l),hl\r
pop hl\r
push ix\r
push iy\r
ld a,i\r
- call sub_0004h\r
+ call di_or_ei\r
ld h,a\r
ld l,000h\r
push hl\r
- ld a,0f3h\r
+ ld a,0f3h ; EI\r
jp po,l08dfh\r
- ld a,0fbh\r
+ ld a,0fbh ; DI\r
l08dfh:\r
ld (reg.iff),a\r
ex af,af'\r
push bc\r
push de\r
push hl\r
- call sub_097ah\r
+ call bp_restore_mem\r
ld a,(b_21e2_start)\r
dec a\r
jr z,l090bh\r
- call inchar\r
- jr c,l0902h\r
+ call inchar ;Keyboard hit?\r
+ jr c,do_break ;yes\r
call sub_0913h\r
and a\r
jp z,user_go\r
and 083h\r
jp z,l2151h\r
-l0902h:\r
+do_break:\r
call bp_clr_temporary\r
call p_cpustat\r
jp mainloop\r
ld a,080h\r
ex af,af'\r
sub a\r
- ld (l0941h),a\r
- ld b,BP_CNT\r
- ld ix,bp_tab\r
-l0920h:\r
+ ld (bp_p_cpu_flag),a\r
+ call bpl_init\r
+\r
ld a,(ix+000h)\r
and 007h\r
jr z,l0938h\r
call z,sub_0942h\r
pop bc\r
l0938h:\r
- ld de,BP_SIZE\r
- add ix,de\r
- djnz l0920h\r
+\r
+ call bpl_next\r
ex af,af'\r
ret\r
\r
bit 4,(ix+000h)\r
ret z\r
ld a,001h\r
- ld (l0941h),a\r
+ ld (bp_p_cpu_flag),a\r
ret\r
l0974h:\r
ex af,af'\r
ex af,af'\r
ret\r
\r
-sub_097ah:\r
- ld b,BP_CNT\r
- ld ix,bp_tab\r
-l0980h:\r
+bp_restore_mem:\r
+ call bpl_init\r
+\r
bit 5,(ix+000h)\r
res 5,(ix+000h)\r
jr z,l099ah\r
ld (hl),a\r
l099ah:\r
res 3,(ix+000h)\r
- ld de,BP_SIZE\r
- add ix,de\r
- djnz l0980h\r
+\r
+ call bpl_next\r
ret\r
\r
-sub_09a6h:\r
- ld b,BP_CNT\r
- ld ix,bp_tab\r
-l09ach:\r
+bp_tst_@pc:\r
+ call bpl_init\r
+\r
ld a,(ix+000h)\r
and 003h\r
- jr z,l09c0h\r
+ jr z,bp_tst_e\r
ld e,(ix+002h)\r
ld d,(ix+003h)\r
ld hl,(reg.pc)\r
call cp_hl_de\r
ret z\r
-l09c0h:\r
- ld de,BP_SIZE\r
- add ix,de\r
- djnz l09ach\r
+bp_tst_e:\r
+ call bpl_next\r
sub a\r
inc a\r
ret\r
\r
-sub_09cah:\r
+bp_trace_enter:\r
call bp_get_freeslot\r
ld (ix+004h),001h\r
ld (ix+005h),000h\r
ld a,(b_21e2_start)\r
and a\r
ld a,008h\r
- jr nz,l09edh\r
- ld a,004h\r
-l09edh:\r
+ jr nz,bp_t_e\r
+ rra\r
+bp_t_e:\r
ld (ix+000h),a\r
ret\r
\r
-sub_09f1h:\r
- ld b,BP_CNT\r
- ld ix,bp_tab\r
-l09f7h:\r
+bp_set_to_mem:\r
+ call bpl_init\r
+\r
ld a,(ix+000h)\r
and c\r
jr z,l0a1dh\r
inc hl\r
ld (hl),d\r
l0a1dh:\r
- ld de,BP_SIZE\r
- add ix,de\r
- djnz l09f7h\r
+\r
+ call bpl_next\r
ret\r
\r
+;-------------------------------------------------------------------------------\r
+\r
user_go:\r
sub a\r
ld (b_21e2_start),a\r
- ld a,(l0941h)\r
+ ld a,(bp_p_cpu_flag)\r
and a\r
call nz,p_cpustat\r
- call sub_09a6h\r
+ call bp_tst_@pc\r
ld c,007h\r
jr nz,l0a41h\r
ld a,001h\r
ld (b_21e2_start),a\r
- call sub_1ffeh\r
+ call tc_set_bp\r
ld c,008h\r
l0a41h:\r
- call sub_09f1h\r
+ call bp_set_to_mem\r
ld sp,reg.l2\r
pop hl\r
pop de\r
ld sp,(reg_sp)\r
jp reg.iff\r
\r
+;-------------------------------------------------------------------------------\r
+\r
bp_clr_condition:\r
ld a,(ix+000h)\r
and 003h\r
ld (iy+007h),d\r
ret\r
\r
-cmd_Y:\r
- call get.decdigit\r
- jr c,l0bc3h\r
- inc de\r
- push af\r
- call assert_eol\r
- pop af\r
- call sub_0bdch\r
- jp l0c15h\r
-l0bc3h:\r
- call assert_eol\r
- xor a\r
-l0bc7h:\r
- push af\r
- call sub_0bdch\r
- call outbl\r
- pop af\r
- push af\r
- call get_y_val\r
- call p_symbol\r
- pop af\r
- inc a\r
- push af\r
- rra\r
- push af\r
- ld c,11\r
- call c,p_align_@_sym\r
- pop af\r
- call nc,crlf\r
- pop af\r
- cp YREG_CNT\r
- jr c,l0bc7h\r
- ret\r
+;-------------------------------------------------------------------------------\r
+; > Y\r
+; examine all Y variables\r
+; > Y[0..9]\r
+; examine (and substitute) an Y variable\r
+\r
+\r
+;-------------------------------------------------------------------------------\r
+; > X\r
+; eXamine (display) all cpu registers and\r
+; the instruction at the current program counter\r
+; > X register\r
+; eXamine (and substitute) a register\r
\r
-sub_0bdch:\r
- ld c,a\r
- ld b,0\r
- add a,'0'+080h\r
- ld de,msg_Y+1\r
- ld (de),a\r
- dec de\r
- ld hl,reg_Y\r
- add hl,bc\r
- add hl,bc\r
- ex de,hl\r
- ld c,003h\r
- jp l0c33h\r
\r
cmd_X:\r
call skipbl\r
cp 01dh\r
jp z,ERROR\r
ex de,hl\r
- ld hl,b_0cc3_start\r
+ ld hl,t_reg_names\r
call sel_dc_string\r
l0c12h:\r
call l0c33h\r
\r
sub_0c6ah:\r
push af\r
- ld b,000h\r
call outbl\r
call assert_eol\r
call get_line\r
pop af\r
ex af,af'\r
+ ld b,0\r
l0c76h:\r
call skipbl\r
ld a,b\r
ret z\r
push bc\r
- ld hl,b_0ca4_start\r
+ ld hl,t_flag_names\r
call lookupch\r
jp nc,ERROR\r
- ld a,b\r
- cp 008h\r
- jr z,l0c97h\r
- pop bc\r
- rlca\r
- rlca\r
- rlca\r
- add a,0c0h\r
- ld (l0c94h),a\r
- defb 0cbh\r
-l0c94h:\r
- defb 0c0h\r
+ inc b\r
+ xor a\r
+ scf\r
+nxt_f:\r
+ rla\r
+ djnz nxt_f\r
+ pop bc\r
+ jr c,l0c97h\r
+ or b\r
+ ld b,a\r
jr l0c76h\r
+\r
l0c97h:\r
ex af,af'\r
jp nc,ERROR\r
ex af,af'\r
ld a,0fbh\r
ld (reg.iff),a\r
- pop bc\r
jr l0c76h\r
\r
-b_0ca4_start:\r
+t_flag_names:\r
db 'CNV H ZSE',0\r
\r
sub_0caeh:\r
scf\r
ret\r
\r
-b_0cc3_start:\r
+t_reg_names:\r
DC 'BC'''\r
DC 'DE'''\r
DC 'HL'''\r
db 000h\r
dw reg.f\r
\r
+;-------------------------------------------------------------------------------\r
+; > S [startaddr]\r
+; Substitute memory\r
+\r
cmd_S:\r
ld hl,(last_S)\r
call get_lastarg_def\r
inc de\r
cp '.'\r
jr nz,cmds_dash\r
- ld a,(de)\r
+ call get_char_upper\r
or a\r
jr nz,l0d8ah\r
ret\r
jp z,assert_eol\r
cp '-'\r
jr nz,l0d8ah\r
- ld a,(de)\r
+ call get_char_upper\r
or a\r
dec hl\r
jr z,l0d60h\r
call sub_0ef8h\r
jr l0d60h\r
\r
+;-------------------------------------------------------------------------------\r
+; > @\r
+; examine (substitute) displacement register @\r
+\r
cmd_@:\r
call assert_eol\r
ld hl,msg_@\r
msg_@:\r
dc '@'\r
\r
+;-------------------------------------------------------------------------------\r
+; >>I [port]\r
+; Input a byte from port\r
+\r
cmd_I:\r
ld hl,cmd_I\r
ld (cmd_rpt),hl\r
call out.bin.b\r
jp crlf\r
\r
+;-------------------------------------------------------------------------------\r
+; >>O [byte] [port]\r
+; Output a byte to a port\r
+\r
cmd_O:\r
ld hl,cmd_O\r
ld (cmd_rpt),hl\r
out (c),a\r
ret\r
\r
+;-------------------------------------------------------------------------------\r
+; > Vstartaddr endaddr targetaddr\r
+; Verify (compare) two memory areas\r
+\r
cmd_V:\r
call sub_034eh\r
l0dedh:\r
jr nz,l0dedh\r
ret\r
\r
+;-------------------------------------------------------------------------------\r
+; > M[V] startaddr endaddr destaddr\r
+; Move memory [and verify]\r
+\r
cmd_M:\r
- ld a,(de)\r
+ call get_char_upper\r
cp 'V'\r
jr nz,l0e1fh\r
inc de\r
jr z,l0dedh\r
ret\r
\r
-cmd_H:\r
- ld a,(de)\r
- cp 'S'\r
- jr z,p_sym_list\r
+;-------------------------------------------------------------------------------\r
+; > H\r
+; display Highest load address of last filed loaded, Maximum "High"\r
+; off all loaded files, and Top address of available memory\r
+; > H expression\r
+; evaluate expression and display result in hex, decimal and other formats\r
+; > H expression expression\r
+; display sum und difference of expressions\r
\r
+cmd_H:\r
call expr\r
jp c,p_max_high0\r
call next_arg\r
call out_hl_dec_neg\r
call outbl4\r
call out.bin.w\r
- call outbl\r
+ call outbl2\r
ld a,l\r
call out.ascii\r
- call outbl2\r
- call p_symbol\r
jp crlf\r
\r
-p_sym_list:\r
- inc de\r
- call assert_eol\r
- ld a,(symlen_max)\r
- add a,7\r
- ld b,a\r
- ld c,0\r
- ld hl,ddtz_base+2\r
-psym_nxtsym:\r
- ld d,(hl)\r
- dec hl\r
- ld e,(hl)\r
- dec hl\r
- ld a,(hl)\r
- cp 0c3h\r
- jr z,psym_e\r
-\r
- call p_goto_col\r
- ex de,hl\r
- call out_hl\r
- call outbl\r
- ex de,hl\r
- call p_symstr\r
-\r
- ld a,c\r
- add b\r
- ld c,a\r
- ld a,80 ;screen width\r
- sub b\r
- cp c\r
- jr nc,psym_nxtsym\r
-\r
- call crlf\r
- ld c,0\r
- jr psym_nxtsym\r
-\r
-psym_e:\r
- ld a,c\r
- or a\r
- ret z\r
- jp crlf\r
-\r
+;-------------------------------------------------------------------------------\r
+; > Q[J] startaddr endaddr bytes\r
+; Query memory for a byte string [Justified]\r
\r
cmd_Q:\r
- ld a,(de)\r
+ call get_char_upper\r
sub 'J'\r
ld (cmd_Q_jopt),a\r
jr nz,l0e8dh\r
pop bc\r
ret\r
\r
+;-------------------------------------------------------------------------------\r
+; > Z startaddr endaddr bytes\r
+; Zap (fill) memory with a byte string\r
+\r
cmd_Z:\r
call get_arg_range\r
push bc\r
ld (last_S),hl\r
ret\r
\r
+;-------------------------------------------------------------------------------\r
+; >>D [startaddr] [endaddr]\r
+; Display memory in hex and ASCII\r
+\r
cmd_D:\r
ld hl,cmd_D\r
ld (cmd_rpt),hl\r
ld a,'.'\r
ret\r
\r
+;-------------------------------------------------------------------------------\r
+; > Fcommandline\r
+; specifiy filenames and command line\r
+\r
cmd_F:\r
push de\r
ld hl,DMA_BUF+1\r
ld (hl),' '\r
inc hl\r
l0fb6h:\r
- ld a,(de)\r
+ call get_char_upper\r
ld (hl),a\r
inc hl\r
inc de\r
ld de,dfcb1\r
call parse_filename\r
ld de,dfcb2\r
- call parse_filename\r
;fall thru\r
\r
-cpy_fcb2:\r
- ld hl,dfcb2\r
- ld de,fcbsym\r
- ld bc,16\r
- ldir\r
- ret\r
-\r
parse_filename:\r
call sub_102ch\r
push de\r
cp '.'\r
ret z\r
ld c,'?'\r
+ call toupper\r
cp '*'\r
ret\r
\r
cp ','\r
ret\r
\r
+;-------------------------------------------------------------------------------\r
+\r
setup_fcb:\r
push de\r
ld hl,12\r
pop de\r
ret\r
\r
+;-------------------------------------------------------------------------------\r
+\r
file_open:\r
ld (cur_fcb),de\r
call setup_fcb\r
error2:\r
jp ERROR\r
\r
-read_hexbyte:\r
- call read_byte\r
-read_hexbyte0:\r
- push bc\r
- call hex_digit_v\r
- rlca\r
- rlca\r
- rlca\r
- rlca\r
- ld c,a\r
- call read_byte\r
- call hex_digit_v\r
- or c\r
- pop bc\r
- ret\r
+;-------------------------------------------------------------------------------\r
+; > R [displacement]\r
+; Read a binary or hex file [add displacement]\r
\r
cmd_R:\r
ld hl,0\r
call get_lastarg_def\r
read_file:\r
- ld de,dfcb1+1\r
- ld a,(de)\r
- cp '?'\r
- jr z,read_symfile\r
- dec de\r
+ ld de,dfcb1\r
push hl\r
ld hl,0\r
ld (high_load),hl\r
call read_sector\r
jr nz,read_file_nxt\r
pop hl\r
- jr read_symfile\r
+ jp p_max_high\r
\r
read_file_nxt:\r
ld de,DMA_BUF\r
call read_hexchar ; CHKSUM\r
ld a,c\r
and a\r
- jr nz,error3\r
+ jp nz,ERROR\r
jr l10aeh\r
rdhex_done:\r
pop hl\r
- jr read_symfile\r
-\r
-read_symfile:\r
- ld de,fcbsym+1\r
- ld a,(de)\r
- cp ' '\r
- jp z,p_max_high\r
-\r
- push hl ; offset\r
- call pstr_inl\r
- db 'SYMBOLS',CR,LF+80h\r
-\r
- dec de\r
- call file_open\r
-rs_1:\r
- call read_byte\r
-rs_2:\r
- pop de ; offset\r
- cp 1ah\r
- jp z,p_max_high\r
- push de ; offset\r
- cp '!'\r
- jr c,rs_1\r
- call read_hexbyte0 ; symval H\r
- ld h,a\r
- call read_hexbyte ; symval L\r
- ld l,a\r
- add hl,de\r
- call read_byte\r
- cp ' '\r
- jr z,rs_4\r
-rs_3: call read_byte\r
- cp ' '\r
- jr nc,rs_3\r
- jr rs_2\r
-\r
-rs_4:\r
- push hl ; symval\r
- ld hl,(BDOS+1) ;\r
- ld b,0 ; setup symlen\r
-rs_5:\r
- dec hl ;\r
- call read_byte ; next char of symbol name\r
- call test_sym_char ; valid char?\r
- jr nz,rs_6\r
- ld (hl),a ;\r
- inc b ; symlen++\r
- ld a,b ;\r
- cp 10h+1 ;\r
- jr c,rs_5 ;\r
-error3:\r
- jp ERROR ;\r
-\r
-rs_6:\r
- call test_symterm_ch\r
- jr nz,error3\r
-\r
- push bc ; symlen\r
- ex de,hl ;\r
- ld hl,(BDOS+1) ;\r
- inc hl ;\r
- ld c,(hl) ;\r
- inc hl ;\r
- ld b,(hl) ;\r
- ex de,hl\r
- ld (hl),b ;\r
- dec hl ;\r
- ld (hl),c ;\r
- dec hl ;\r
- ld (hl),0c3h ;\r
-\r
- ld de,(max_load) ;\r
- call cp_hl_de ;\r
- jr c,error3 ;\r
- ld de,(reg_sp) ;\r
- call cp_hl_de ;\r
- jr nc,rs_61 ;\r
- ld (reg_sp),hl ;\r
-rs_61:\r
- ld de,(BDOS+1) ;\r
- ld (BDOS+1),hl ;\r
- ex de,hl ;\r
- pop af ; symlen\r
- ld (hl),a ;\r
- inc hl ;\r
- pop de ; symval\r
- ld (hl),e ;\r
- inc hl ;\r
- ld (hl),d ;\r
- ld hl,symlen_max ;\r
- cp (hl) ; new max?\r
- jr c,$+3 ;\r
- ld (hl),a ;\r
- jp rs_1 ;\r
-\r
-\r
-; test for valid character for symbols\r
-; return z if valid\r
-\r
-test_sym_char:\r
- cp '$'\r
- ret z\r
- cp '%'\r
- ret z\r
- cp '.'\r
- ret z\r
- cp '_'\r
- ret z\r
- call test_alphanum\r
- ret c ; cy == 1 --> z == 0\r
- cp a ; return z\r
- ret\r
-\r
+ jp p_max_high\r
\r
-; check if char is in [0..9,?,@,A..Z,a..z]\r
-; return cy if invalid\r
-; return nc if valid alfanumeric char\r
-\r
-test_alphanum:\r
- cp 'z'+1\r
- ccf\r
- ret c\r
- cp 'a'\r
- ret nc\r
- cp 'Z'+1\r
- ccf\r
- ret c\r
- cp '?'\r
- ret nc\r
-test_numeral:\r
- cp '9'+1\r
- ccf\r
- ret c\r
- cp '0'\r
- ret\r
-\r
-test_symterm_ch:\r
- cp CR\r
- ret z\r
- cp LF\r
- ret z\r
test_whitespace:\r
cp ' '\r
ret z\r
cp TAB\r
ret\r
\r
+;-------------------------------------------------------------------------------\r
+\r
p_max_high0:\r
call assert_eol\r
p_max_high:\r
call out_hl\r
jp crlf\r
\r
+;-------------------------------------------------------------------------------\r
+; > Wstartaddr endaddr\r
+; Write a file to disk\r
+\r
cmd_W:\r
call get_arg_range\r
call assert_eol\r
cp ' '\r
jr z,error4\r
ld de,dfcb1\r
- call setup_fcb\r
- push de\r
- ld c,BDOS_DELETE\r
- call ddtz_bdos\r
- pop de\r
- ld c,BDOS_CREATE\r
- call ddtz_bdos\r
- inc a\r
- jr z,error4\r
- pop bc\r
- pop hl\r
-l11cch:\r
- ld a,b\r
- or c\r
- jr z,close_file\r
- push bc\r
- ld de,080h ; DMA_BUF\r
- ld b,d\r
- ld c,e\r
- ldir\r
- call write_sector\r
- ex (sp),hl\r
- ld bc,0ff80h\r
- add hl,bc\r
- ex (sp),hl\r
- pop bc\r
- jr l11cch\r
-\r
-write_sector:\r
- push hl\r
- ld de,dfcb1\r
- ld c,BDOS_WRITE\r
- call ddtz_bdos\r
- pop hl\r
- and a\r
- ret z\r
- call close_file\r
-error4:\r
- jp ERROR\r
-\r
-close_file:\r
- ld de,dfcb1\r
- ld c,BDOS_CLOSE\r
- jp ddtz_bdos\r
-\r
-cmd_A:\r
- ld hl,(last_A)\r
- call get_lastarg_def\r
- ld (last_A),hl\r
- ld (cmd_A_prev),hl\r
- ld hl,cmda_restart\r
- ld (error_func),hl\r
- ld (l1262h),sp\r
-cmda_loop:\r
- ld hl,(last_A)\r
- ld (var.$),hl\r
- push hl\r
- call p_disas_line\r
- ld c,19\r
- call p_align_@_sym\r
- ld c,b\r
- push bc\r
- call get_line\r
- pop bc\r
- pop hl\r
- call skipbl\r
- cp '.'\r
- ret z\r
- cp '-'\r
- jr nz,l124bh\r
- ld hl,(cmd_A_prev)\r
- jr cmda_lpend\r
-l124bh:\r
- push hl\r
- pop iy\r
- push hl\r
- and a\r
- call nz,asemble_line\r
- ld b,0\r
- pop hl\r
- ld (cmd_A_prev),hl\r
- add hl,bc\r
-cmda_lpend:\r
- ld (last_A),hl\r
- jr cmda_loop\r
-\r
-cmda_restart:\r
- call l0146h\r
- ld sp,(l1262h)\r
- jr cmda_loop\r
-\r
-asemble_line:\r
- call skipbl\r
- ld hl,t_MNEMONICS\r
- call sub_030ah\r
- jp nc,ERROR\r
- call skipbl\r
- push de\r
- ld a,b\r
- add a,b\r
- add a,b\r
- ld hl,b_1289_start\r
- call add_hl_a\r
- ld e,(hl)\r
- inc hl\r
- ld d,(hl)\r
- inc hl\r
- ld b,(hl)\r
- ex de,hl\r
- pop de\r
-\r
-CALL_HL:\r
- jp (hl)\r
-\r
-b_1289_start:\r
- dw as.ADC_SBC ;ADC\r
- db 088h ;\r
- dw as.ADD ;ADD\r
- db 080h ;\r
- dw as.AND_CP_OR_SUB_XOR ;AND\r
- db 0a0h ;\r
- dw as.BITOP ;BIT\r
- db 040h ;\r
- dw as.CALL ;CALL\r
- db 0c4h ;\r
- dw as.opc.noarg ;CCF\r
- db 03fh ;\r
- dw as.AND_CP_OR_SUB_XOR ;CP\r
- db 0b8h ;\r
- dw gen.opc.ED2 ;CPD\r
- db 0a9h ;\r
- dw gen.opc.ED2 ;CPDR\r
- db 0b9h ;\r
- dw gen.opc.ED2 ;CPI\r
- db 0a1h ;\r
- dw gen.opc.ED2 ;CPIR\r
- db 0b1h ;\r
- dw as.opc.noarg ;CPL\r
- db 02fh ;\r
- dw as.opc.noarg ;DAA\r
- db 027h ;\r
- dw as.DEC_INC ;DEC\r
- db 005h ;\r
- dw as.opc.noarg ;DI\r
- db 0f3h ;\r
- dw as.DJNZ ;DJNZ\r
- db 010h ;\r
- dw as.opc.noarg ;EI\r
- db 0fbh ;\r
- dw as.EX ;EX\r
- db 0e3h ;\r
- dw as.opc.noarg ;EXX\r
- db 0d9h ;\r
- dw as.opc.noarg ;HALT\r
- db 076h ;\r
- dw as.IM ;IM\r
- db 046h ;\r
- dw as.IN ;IN\r
- db 040h ;\r
- dw as.DEC_INC ;INC\r
- db 004h ;\r
- dw gen.opc.ED2 ;IND\r
- db 0aah ;\r
- dw gen.opc.ED2 ;INDR\r
- db 0bah ;\r
- dw gen.opc.ED2 ;INI\r
- db 0a2h ;\r
- dw gen.opc.ED2 ;INIR\r
- db 0b2h ;\r
- dw as.JP ;JP\r
- db 0c2h ;\r
- dw as.JR ;JR\r
- db 020h ;\r
- dw as.LD ;LD\r
- db 040h ;\r
- dw gen.opc.ED2 ;LDD\r
- db 0a8h ;\r
- dw gen.opc.ED2 ;LDDR\r
- db 0b8h ;\r
- dw gen.opc.ED2 ;LDI\r
- db 0a0h ;\r
- dw gen.opc.ED2 ;LDIR\r
- db 0b0h ;\r
- dw gen.opc.ED2 ;NEG\r
- db 044h ;\r
- dw as.opc.noarg ;NOP\r
- db 000h ;\r
- dw as.AND_CP_OR_SUB_XOR ;OR\r
- db 0b0h ;\r
- dw gen.opc.ED2 ;OTDR\r
- db 0bbh ;\r
- dw gen.opc.ED2 ;OTIR\r
- db 0b3h ;\r
- dw as.OUT ;OUT\r
- db 041h ;\r
- dw gen.opc.ED2 ;OUTD\r
- db 0abh ;\r
- dw gen.opc.ED2 ;OUTI\r
- db 0a3h ;\r
- dw as.POP_PUSH ;POP\r
- db 0c1h ;\r
- dw as.POP_PUSH ;PUSH\r
- db 0c5h ;\r
- dw as.BITOP ;RES\r
- db 080h ;\r
- dw as.RET ;RET\r
- db 0c0h ;\r
- dw gen.opc.ED2 ;RETI\r
- db 04dh ;\r
- dw gen.opc.ED2 ;RETN\r
- db 045h ;\r
- dw as.SHIFTOP ;RL\r
- db 010h ;\r
- dw as.opc.noarg ;RLA\r
- db 017h ;\r
- dw as.SHIFTOP ;RLC\r
- db 000h ;\r
- dw as.opc.noarg ;RLCA\r
- db 007h ;\r
- dw gen.opc.ED2 ;RLD\r
- db 06fh ;\r
- dw as.SHIFTOP ;RR\r
- db 018h ;\r
- dw as.opc.noarg ;RRA\r
- db 01fh ;\r
- dw as.SHIFTOP ;RRC\r
- db 008h ;\r
- dw as.opc.noarg ;RRCA\r
- db 00fh ;\r
- dw gen.opc.ED2 ;RRD\r
- db 067h ;\r
- dw as.RST ;RST\r
- db 0c7h ;\r
- dw as.ADC_SBC ;SBC\r
- db 098h ;\r
- dw as.opc.noarg ;SCF\r
- db 037h ;\r
- dw as.BITOP ;SET\r
- db 0c0h ;\r
- dw as.SHIFTOP ;SLA\r
- db 020h ;\r
- dw as.SHIFTOP ;SRA\r
- db 028h ;\r
- dw as.SHIFTOP ;SRL\r
- db 038h ;\r
- dw as.AND_CP_OR_SUB_XOR ;SUB\r
- db 090h ;\r
- dw as.AND_CP_OR_SUB_XOR ;XOR\r
- db 0a8h ;\r
-\r
- dw as.IN0 ;IN0\r
- db 000h ;\r
- dw as.MLT ;MLT\r
- db 04ch ;\r
- dw gen.opc.ED2 ;OTDM\r
- db 08bh ;\r
- dw gen.opc.ED2 ;OTDMR\r
- db 09bh ;\r
- dw gen.opc.ED2 ;OTIM\r
- db 083h ;\r
- dw gen.opc.ED2 ;OTIMR\r
- db 093h ;\r
- dw as.OUTO ;OUT0\r
- db 001h ;\r
- dw gen.opc.ED2 ;SLP\r
- db 076h ;\r
- dw as.TST ;TST\r
- db 004h ;\r
- dw as.TSTIO ;TSTIO\r
- db 074h ;\r
-\r
-as.TST:\r
- call arg.r_HL_A ;\r
- jr nc,as.tst_0\r
- rlca\r
- rlca\r
- rlca\r
- add a,b\r
- ld b,a\r
- jp gen.opc.ED2\r
-as.tst_0:\r
- ld b,064h\r
-as.TSTIO:\r
- call arg.imm_8bit ;\r
- jr as.store_io0\r
-\r
-as.IN0:\r
- call arg.r_HL_A ;\r
- jr nc,error5\r
- cp 006h\r
- jr z,error5\r
- rlca\r
- rlca\r
- rlca\r
- add a,b\r
- ld b,a\r
- call assert_comma ;\r
- call arg.addr_8bit ;\r
- jr as.store_io0\r
-\r
-as.OUTO:\r
- call arg.addr_8bit ;\r
- call assert_comma ;\r
- call arg.r_HL_A ;\r
- jr nc,error5\r
- cp 006h\r
- jr z,error5\r
- rlca\r
- rlca\r
- rlca\r
- add a,b\r
- ld b,a\r
-\r
-as.store_io0:\r
- call assert_eol\r
- ld (iy+000h),0edh\r
- ld (iy+001h),b\r
- ld (iy+002h),l\r
- ld c,003h\r
- ret\r
-\r
-as.MLT:\r
- call arg.ww ;\r
- jr nc,error5\r
- add a,b\r
- ld b,a\r
- jp gen.opc.ED2\r
-\r
-error5:\r
- jp ERROR\r
-\r
-as.LD:\r
- call arg.r_HL_A\r
- jr c,l13d4h\r
- call arg.IDX_displcmnt\r
- jp c,l1471h\r
- call arg.ww\r
- jp c,l149ch\r
- call arg.IX_IY\r
- jp c,l14f5h\r
- ld a,(de)\r
- cp 'I'\r
- jp z,l1511h\r
- cp 'R'\r
- jp z,l1519h\r
- cp '('\r
- jp nz,ERROR\r
- inc de\r
- call arg.ww\r
- jp c,l1528h\r
- call test_expr\r
- call test_paren_close\r
- call assert_comma\r
- call arg.ww\r
- jr c,l13c2h\r
- call arg.IX_IY\r
- jr nc,l13aah\r
- ld b,022h\r
-l1395h:\r
- call assert_eol\r
- ld a,(prefix_ixiy)\r
-l139bh:\r
- ld (iy+000h),a\r
- ld (iy+001h),b\r
- ld (iy+002h),l\r
- ld (iy+003h),h\r
- ld c,004h\r
- ret\r
-l13aah:\r
- ld a,(de)\r
- cp 'A'\r
- jp nz,ERROR\r
- inc de\r
- ld b,032h\r
-as.store_3:\r
- call assert_eol\r
- ld (iy+000h),b\r
- ld (iy+001h),l\r
- ld (iy+002h),h\r
- ld c,003h\r
- ret\r
-l13c2h:\r
- cp 020h\r
- jr z,l13d0h\r
- add a,043h\r
- ld b,a\r
-l13c9h:\r
- call assert_eol\r
- ld a,0edh\r
- jr l139bh\r
-l13d0h:\r
- ld b,022h\r
- jr as.store_3\r
-l13d4h:\r
- ld b,a\r
- call assert_comma\r
- call arg.r_HL_A\r
- jr nc,l13f0h\r
- push af\r
- ld a,b\r
- rlca\r
- rlca\r
- rlca\r
- ld b,a\r
- pop af\r
- add a,b\r
- add a,040h\r
- cp 076h\r
- jp z,ERROR\r
-l13ech:\r
- ld b,a\r
- jp as.opc.noarg\r
-l13f0h:\r
- call arg.IDX_displcmnt\r
- jr nc,l1413h\r
- ld a,b\r
- rlca\r
- rlca\r
- rlca\r
- add a,046h\r
- cp 076h\r
- jp z,ERROR\r
-\r
-l1400h:\r
- ld b,a\r
- call assert_eol\r
- ld (iy+001h),b\r
- ld (iy+002h),c\r
- ld a,(prefix_ixiy)\r
- ld (iy+000h),a\r
- ld c,003h\r
- ret\r
-l1413h:\r
- ld a,(de)\r
- cp 'I'\r
- jr z,l1426h\r
- cp 'R'\r
- jr nz,l1432h\r
- ld a,b\r
- cp 007h\r
- jp nz,ERROR\r
- ld b,05fh\r
- jr l142eh\r
-l1426h:\r
- ld a,b\r
- cp 007h\r
- jp nz,ERROR\r
- ld b,057h\r
-l142eh:\r
- inc de\r
- jp gen.opc.ED2\r
-l1432h:\r
- cp '('\r
- jr z,l144ch\r
- call arg.imm_8bit\r
- ld a,b\r
- rlca\r
- rlca\r
- rlca\r
- add a,006h\r
-l143fh:\r
- ld b,a\r
-as.store_2:\r
- call assert_eol\r
- ld (iy+000h),b\r
- ld (iy+001h),l\r
- ld c,002h\r
- ret\r
-l144ch:\r
- inc de\r
- ld a,b\r
- cp 007h\r
- jp nz,ERROR\r
- call arg.ww\r
- jr nc,l1466h\r
- cp 030h\r
- jp nc,ERROR\r
- add a,00ah\r
- ld b,a\r
- call test_paren_close\r
- jp as.opc.noarg\r
-l1466h:\r
- call test_expr\r
- call test_paren_close\r
- ld b,03ah\r
- jp as.store_3\r
-\r
-l1471h:\r
- call assert_comma\r
- call arg.r_HL_A\r
- jr nc,l1483h\r
- cp 006h\r
- jp z,ERROR\r
- add a,070h\r
- jp l1400h\r
-\r
-l1483h:\r
- call arg.imm_8bit\r
- call assert_eol\r
- ld a,(prefix_ixiy)\r
- ld (iy+000h),a\r
- ld (iy+001h),036h\r
- ld (iy+002h),c\r
- ld (iy+003h),l\r
- ld c,004h\r
- ret\r
-l149ch:\r
- ld b,a\r
- call assert_comma\r
- ld hl,t_HL.AF\r
- call sub_0318h\r
- jr c,l14c3h\r
- call arg.IX_IY\r
- jr nc,l14cch\r
- ld a,b\r
- cp 030h\r
- jr nz,error6\r
- ld b,0f9h\r
-l14b4h:\r
- call assert_eol\r
- ld a,(prefix_ixiy)\r
- ld (iy+000h),a\r
- ld (iy+001h),b\r
- ld c,002h\r
- ret\r
-l14c3h:\r
- ld a,b\r
- cp 030h\r
- jr nz,error6\r
- ld b,0f9h\r
- jr as.opc.noarg ;14ca\r
-l14cch:\r
- ld a,(de)\r
- cp '('\r
- jr nz,l14e8h\r
- inc de\r
- call test_expr\r
- call test_paren_close\r
- ld a,b\r
- cp 020h\r
- jr z,l14e3h\r
- add a,04bh\r
- ld b,a\r
- jp l13c9h\r
-l14e3h:\r
- ld b,02ah\r
- jp as.store_3\r
-l14e8h:\r
- call test_expr\r
- call assert_eol\r
- ld a,001h\r
- add a,b\r
- ld b,a\r
- jp as.store_3\r
-l14f5h:\r
- call assert_comma\r
- ld a,(de)\r
- cp '('\r
- jr nz,l1509h\r
- inc de\r
- call test_expr\r
- call test_paren_close\r
- ld b,02ah\r
- jp l1395h\r
-l1509h:\r
- call test_expr\r
- ld b,021h\r
- jp l1395h\r
-l1511h:\r
- inc de\r
- call assert_comma\r
- ld b,047h\r
- jr l151fh\r
-l1519h:\r
- inc de\r
- call assert_comma\r
- ld b,04fh\r
-l151fh:\r
- ld a,(de)\r
- inc de\r
- cp 'A'\r
- jr z,gen.opc.ED2\r
-error6:\r
- jp ERROR\r
-\r
-l1528h:\r
- cp 020h\r
- jr nc,error6\r
- add a,002h\r
- ld b,a\r
- call test_paren_close\r
- call assert_comma\r
- ld a,(de)\r
- cp 'A'\r
- jr nz,error6\r
- inc de\r
-as.opc.noarg:\r
- call assert_eol\r
- ld (iy+000h),b\r
- ld c,001h\r
- ret\r
-\r
-gen.opc.ED2:\r
- call assert_eol\r
- ld (iy+000h),0edh\r
- ld (iy+001h),b\r
- ld c,002h\r
- ret\r
-\r
-as.ADC_SBC:\r
- ld hl,t_HL.AF\r
- call sub_0318h\r
- jr nc,as.AND_CP_OR_SUB_XOR\r
- call assert_comma\r
- call arg.ww\r
- jp nc,ERROR\r
- push af\r
- ld a,b\r
- cp 088h\r
- ld b,04ah\r
- jr z,l156ch\r
- ld b,042h\r
-l156ch:\r
- pop af\r
- add a,b\r
-l156eh:\r
- ld b,a\r
- jr gen.opc.ED2\r
-as.ADD:\r
- ld hl,t_HL.AF\r
- call sub_0318h\r
- jr c,l159ah\r
- call arg.IX_IY\r
- jr nc,as.AND_CP_OR_SUB_XOR\r
- call assert_comma\r
- ld hl,t_BC.DE.IX.SP\r
- ld a,(prefix_ixiy)\r
- cp 0fdh\r
- jr nz,l158eh\r
- ld hl,t_BC.DE.IY.SP\r
-l158eh:\r
- call arg.reg_16bit\r
- jp nc,ERROR\r
- add a,009h\r
-l1596h:\r
- ld b,a\r
- jp l14b4h\r
-l159ah:\r
- call assert_comma\r
- call arg.ww\r
- jp nc,ERROR\r
- add a,009h\r
- jp l13ech\r
-as.AND_CP_OR_SUB_XOR:\r
- ld a,(de)\r
- cp 'A'\r
- jr nz,l15b8h\r
- push de\r
- inc de\r
- call next_arg\r
- jr z,l15b7h\r
- pop de\r
- jr l15b8h\r
-l15b7h:\r
- pop af\r
-l15b8h:\r
- call arg.r_HL_A\r
- jr c,l15cbh\r
- call arg.IDX_displcmnt\r
- jr c,l15cfh\r
- call arg.imm_8bit\r
- ld a,b\r
- add a,046h\r
- jp l143fh\r
-l15cbh:\r
- add a,b\r
- jp l13ech\r
-l15cfh:\r
- ld a,b\r
- add a,006h\r
- jp l1400h\r
-\r
-as.SHIFTOP:\r
- call arg.r_HL_A\r
- jr c,l15fah\r
- call arg.IDX_displcmnt\r
- jp nc,ERROR\r
- ld a,b\r
- add a,006h\r
- ld b,a\r
-l15e4h:\r
- call assert_eol\r
- ld a,(prefix_ixiy)\r
- ld (iy+000h),a\r
- ld (iy+001h),0cbh\r
- ld (iy+002h),c\r
- ld (iy+003h),b\r
- ld c,004h\r
- ret\r
-\r
-l15fah:\r
- add a,b\r
-l15fbh:\r
- ld b,a\r
- call assert_eol\r
- ld (iy+001h),b\r
- ld (iy+000h),0cbh\r
- ld c,002h\r
- ret\r
-\r
-as.BITOP:\r
- call arg.bit\r
- call assert_comma\r
- call arg.r_HL_A\r
- jr c,l1624h\r
- call arg.IDX_displcmnt\r
- jp nc,ERROR\r
- ld a,l\r
- rlca\r
- rlca\r
- rlca\r
- add a,006h\r
- add a,b\r
- ld b,a\r
- jr l15e4h\r
-l1624h:\r
- add a,b\r
- ld b,a\r
- ld a,l\r
- rlca\r
- rlca\r
- rlca\r
- add a,b\r
- jr l15fbh\r
-\r
-as.CALL:\r
- push de\r
- call arg.cc_ZCPS\r
- jr nc,l163ch\r
- add a,b\r
- ld b,a\r
- call next_arg\r
- jr z,l163eh\r
- pop de\r
- push de\r
-l163ch:\r
- ld b,0cdh\r
-l163eh:\r
- pop af\r
- call test_expr\r
- jp as.store_3\r
-\r
-as.RET:\r
- call arg.cc_ZCPS\r
- jr nc,l164eh\r
- add a,b\r
- ld b,a\r
- jr l1650h\r
-l164eh:\r
- ld b,0c9h\r
-l1650h:\r
- jp as.opc.noarg\r
-\r
-as.JP:\r
- push de\r
- call arg.cc_ZCPS\r
- jr c,l1666h\r
-l1659h:\r
- pop de\r
- ld hl,l168ch\r
- call sub_030ah\r
- jr c,l1674h\r
- ld b,0c3h\r
- jr l166eh\r
-\r
-l1666h:\r
- add a,b\r
- ld b,a\r
- call next_arg\r
- jr nz,l1659h\r
- pop af\r
-l166eh:\r
- call test_expr\r
- jp as.store_3\r
-l1674h:\r
- call assert_eol\r
- ld a,b\r
- and a\r
- jr nz,l1680h\r
- ld b,0e9h\r
- jp as.opc.noarg\r
-l1680h:\r
- ld b,0ddh\r
- dec a\r
- jr z,l1687h\r
- ld b,0fdh\r
-l1687h:\r
- ld l,0e9h\r
- jp as.store_2\r
-\r
-l168ch:\r
- DC '(HL)'\r
- DC '(IX)'\r
- DC '(IY)'\r
- DB 0\r
-\r
-as.DJNZ:\r
- call next_arg\r
- ld b,010h\r
- jr l16aeh\r
-as.JR:\r
- call arg.cc_ZC\r
- jr c,l16a9h\r
- ld b,018h\r
- jr l16aeh\r
-l16a9h:\r
- add a,b\r
- ld b,a\r
- call assert_comma\r
-l16aeh:\r
- call arg.j_displ\r
- jp as.store_2\r
-\r
-as.IM:\r
- call arg.imm_8bit\r
- ld a,l\r
- cp 003h\r
- jr nc,error7\r
- and a\r
- jr z,l16c7h\r
- ld b,056h\r
- cp 001h\r
- jr z,l16c7h\r
- ld b,05eh\r
-l16c7h:\r
- jp gen.opc.ED2\r
-\r
-as.RST:\r
- call arg.imm_8bit\r
- ld a,l\r
- push af\r
- add a,b\r
- ld b,a\r
- pop af\r
- and 0c7h\r
- jr nz,error7\r
- jp as.opc.noarg\r
-\r
-as.POP_PUSH:\r
- call arg.IX_IY\r
- jr c,l16e7h\r
- call arg.zz\r
- jr nc,error7\r
- add a,b\r
- jp l13ech\r
-l16e7h:\r
- ld a,b\r
- add a,020h\r
- jp l1596h\r
-\r
-as.IN:\r
- call arg.r_HL_A\r
- jr nc,error7\r
- cp 006h\r
- jr z,error7\r
- rlca\r
- rlca\r
- rlca\r
- add a,b\r
- ld b,a\r
- cp 078h\r
- jr nz,l170fh\r
- call assert_comma\r
- call sub_171bh\r
- jr c,l1715h\r
- call arg.addr_8bit\r
- ld b,0dbh\r
- jp as.store_2\r
-l170fh:\r
- call assert_comma\r
- call sub_171bh\r
-l1715h:\r
- jp c,gen.opc.ED2\r
-error7:\r
- jp ERROR\r
-\r
-sub_171bh:\r
- ld hl,t__C_\r
- jp sub_0318h\r
-\r
-as.OUT:\r
- call sub_171bh\r
- jr nc,l1739h\r
- call assert_comma\r
- call arg.r_HL_A\r
- jr nc,error7\r
- cp 006h\r
- jr z,error7\r
- rlca\r
- rlca\r
- rlca\r
- add a,b\r
- jp l156eh\r
-\r
-l1739h:\r
- call arg.addr_8bit\r
- call assert_comma\r
- cp 'A'\r
- jr nz,error7\r
- inc de\r
- ld b,0d3h\r
- jp as.store_2\r
-\r
-as.EX:\r
- ld hl,b_176d_start\r
- call sub_030ah\r
- jp nc,ERROR\r
- ld c,b\r
- call assert_eol\r
- ld b,000h\r
- ld hl,l178eh\r
- add hl,bc\r
- add hl,bc\r
- ld a,(hl)\r
- ld (iy+000h),a\r
- ld c,001h\r
- inc hl\r
- ld a,(hl)\r
- and a\r
- ret z\r
- ld (iy+001h),a\r
- ld c,002h\r
- ret\r
-\r
-b_176d_start:\r
- DC 'AF,AF'''\r
-l1773h:\r
- DC 'DE,HL'\r
- DC '(SP),HL'\r
- DC '(SP),IX'\r
- DC '(SP),IY'\r
- db 0\r
-l178eh:\r
- db 008h,000h\r
- db 0ebh,000h\r
- db 0e3h,000h\r
- db 0ddh,0e3h\r
- db 0fdh,0e3h\r
-\r
-as.DEC_INC:\r
- call arg.IX_IY\r
- jr c,l17b3h\r
- call arg.ww\r
- jr c,l17bfh\r
- call arg.r_HL_A\r
- jr c,l17cch\r
- call arg.IDX_displcmnt\r
- jp nc,ERROR\r
- ld a,b\r
- add a,030h\r
- jp l1400h\r
-l17b3h:\r
- ld a,b\r
- ld b,023h\r
- cp 004h\r
- jr z,l17bch\r
- ld b,02bh\r
-l17bch:\r
- jp l14b4h\r
-l17bfh:\r
- push af\r
- ld a,b\r
- ld b,003h\r
- cp 004h\r
- jr z,l17c9h\r
- ld b,00bh\r
-l17c9h:\r
- pop af\r
- jr l17cfh\r
-l17cch:\r
- rlca\r
- rlca\r
- rlca\r
-l17cfh:\r
- add a,b\r
- jp l13ech\r
-\r
-arg.bit:\r
- call arg.imm_8bit\r
- ld a,l\r
- cp 008h\r
- jr nc,error8\r
- ret\r
-\r
-arg.j_displ:\r
- call test_expr\r
- push bc\r
- push iy\r
- pop bc\r
- and a\r
- sbc hl,bc\r
- dec hl\r
- dec hl\r
- pop bc\r
- call sub_1802h\r
- ld a,h\r
- xor l\r
- bit 7,a\r
- jr nz,error8\r
- ret\r
-\r
-arg.addr_8bit:\r
- ld a,(de)\r
- cp '('\r
- jr nz,arg.imm_8bit\r
- inc de\r
- call arg.imm_8bit\r
- jp test_paren_close\r
-\r
-arg.imm_8bit:\r
- call test_expr\r
-sub_1802h:\r
- ld a,h\r
- and a\r
- ret z\r
- inc a\r
- ret z\r
- jr error8\r
-\r
-test_expr:\r
- push bc\r
- call expr\r
- pop bc\r
- ret nc\r
-error8:\r
- jp ERROR\r
-\r
-arg.zz:\r
- push hl\r
- ld hl,t_BC.DE.HL.AF\r
- jr l181fh\r
-\r
-arg.reg_16bit:\r
- push hl\r
- jr l181fh\r
-\r
-arg.ww:\r
- push hl\r
- ld hl,t_BC.DE.HL.SP\r
-l181fh:\r
- push bc\r
- call sub_030ah\r
- jr nc,l182bh\r
- ld a,b\r
- rlca\r
- rlca\r
- rlca\r
- rlca\r
- scf\r
-l182bh:\r
- pop bc\r
- pop hl\r
- ret\r
-\r
-arg.r_HL_A:\r
- call skipbl\r
- push bc\r
- push hl\r
- ld hl,t_BCDEHL_HL_A\r
- call sub_030ah\r
- ld a,b\r
- pop hl\r
- pop bc\r
- ret\r
-\r
-arg.IX_IY:\r
- push hl\r
- push bc\r
- ld hl,t_IX.IY\r
- call sub_030ah\r
- jr nc,l1852h\r
- ld a,0ddh\r
- dec b\r
- jr nz,l184eh\r
- ld a,0fdh\r
-l184eh:\r
- ld (prefix_ixiy),a\r
- scf\r
-l1852h:\r
- pop bc\r
- pop hl\r
- ret\r
-\r
-arg.IDX_displcmnt:\r
- push hl\r
- push bc\r
- ld a,(de)\r
- cp '('\r
- jr nz,l18a1h\r
+ call setup_fcb\r
push de\r
- inc de\r
- ld hl,t_IX.IY\r
- call sub_030ah\r
- jr nc,l18a0h\r
- pop af\r
- ld a,0ddh\r
- dec b\r
- jr nz,l186eh\r
- ld a,0fdh\r
-l186eh:\r
- ld (prefix_ixiy),a\r
- ld a,(de)\r
- cp '+'\r
- jr z,l1882h\r
- cp ')'\r
- ld hl,0\r
- jr z,l189ah\r
- cp '-'\r
- jp nz,ERROR\r
-l1882h:\r
- push af\r
- inc de\r
- call arg.imm_8bit\r
- pop af\r
- cp '+'\r
- jr z,l1894h\r
- ld b,h\r
- ld c,l\r
- ld hl,0\r
- and a\r
- sbc hl,bc\r
-l1894h:\r
- ld a,(de)\r
- cp ')'\r
- jp nz,ERROR\r
-l189ah:\r
- inc de\r
- pop bc\r
- ld c,l\r
- pop hl\r
- scf\r
- ret\r
-l18a0h:\r
+ ld c,BDOS_DELETE\r
+ call ddtz_bdos\r
pop de\r
-l18a1h:\r
+ ld c,BDOS_CREATE\r
+ call ddtz_bdos\r
+ inc a\r
+ jr z,error4\r
pop bc\r
pop hl\r
- and a\r
- ret\r
-\r
-arg.cc_ZCPS:\r
- ld hl,t_tstfl_ZCPS\r
- ld c,007h\r
- jr l18b1h\r
-\r
-arg.cc_ZC:\r
- ld hl,t_tstfl_ZC\r
- ld c,003h\r
-l18b1h:\r
- push bc\r
- call sub_030ah\r
+l11cch:\r
ld a,b\r
+ or c\r
+ jr z,close_file\r
+ push bc\r
+ ld de,080h ; DMA_BUF\r
+ ld b,d\r
+ ld c,e\r
+ ldir\r
+ call write_sector\r
+ ex (sp),hl\r
+ ld bc,0ff80h\r
+ add hl,bc\r
+ ex (sp),hl\r
pop bc\r
- ret nc\r
- and c\r
- rlca\r
- rlca\r
- rlca\r
- scf\r
- ret\r
+ jr l11cch\r
\r
-assert_comma:\r
- call next_arg\r
+write_sector:\r
+ push hl\r
+ ld de,dfcb1\r
+ ld c,BDOS_WRITE\r
+ call ddtz_bdos\r
+ pop hl\r
+ and a\r
ret z\r
-l18c2h:\r
+ call close_file\r
+error4:\r
jp ERROR\r
\r
-test_paren_close:\r
- ld a,(de)\r
- cp ')'\r
- jr nz,l18c2h\r
- inc de\r
- ret\r
+close_file:\r
+ ld de,dfcb1\r
+ ld c,BDOS_CLOSE\r
+ jp ddtz_bdos\r
+\r
+;-------------------------------------------------------------------------------\r
+; > A [startaddr]\r
+; Assemble Zilog Z180 mnemonics\r
+\r
+;cmd_A:\r
+\r
+\r
+CALL_HL:\r
+ jp (hl)\r
+\r
+;-------------------------------------------------------------------------------\r
+\r
+\r
+\r
+\r
+b_176d_start:\r
+ DC 'AF,AF'''\r
+l1773h:\r
+ DC 'DE,HL'\r
+ DC '(SP),HL'\r
+ DC '(SP),IX'\r
+ DC '(SP),IY'\r
+ db 0\r
+\r
+;-------------------------------------------------------------------------------\r
+; >>L [startaddr] [endaddr]\r
+; List disassembled code\r
\r
cmd_L:\r
ld hl,cmd_L\r
jr c,l190fh\r
ret\r
\r
+;-------------------------------------------------------------------------------\r
+\r
cmdl_p_line:\r
push hl\r
call p_disas_line\r
ret\r
\r
p_disas_line:\r
- call p_label\r
call outbl2\r
call out.hl.@\r
call z,outbl\r
\r
ld c,15\r
call p_goto_col\r
- call p_offset\r
- call outbl\r
- jp p_symbol\r
+ ; fall thru\r
+;-------------------------------------------------------------------------------\r
\r
p_offset:\r
ld de,(var.@)\r
add hl,de\r
jp out_rparen\r
\r
+;-------------------------------------------------------------------------------\r
+\r
p_disas_instr:\r
sub a\r
ld (disas_argtype),a\r
scf\r
ret\r
\r
+;-------------------------------------------------------------------------------\r
+\r
disas_pfx.DDFD:\r
inc iy\r
ld hl,b_19ef_start\r
and a\r
ret\r
\r
+;-------------------------------------------------------------------------------\r
; DD/FD 3 byte (ix+d)/(iy+d)\r
b_19ef_start:\r
db 034h\r
db 0f9h\r
db 0\r
\r
+;-------------------------------------------------------------------------------\r
+\r
disas_pfx.ED:\r
inc iy\r
ld hl,b_1bc9_start\r
ld b,4\r
ret\r
\r
+;-------------------------------------------------------------------------------\r
+\r
disas_pfx.CB:\r
push iy\r
inc 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,3\r
ret\r
\r
+;-------------------------------------------------------------------------------\r
+\r
sub_1a72h:\r
ld a,(hl)\r
cp 0ffh\r
scf\r
ret\r
\r
+;-------------------------------------------------------------------------------\r
; 1 byte opcodes (no parameters)\r
; Format: db opcode, t_MNEMONICS-index\r
b_1ab6_start:\r
dw p_arg_bitop\r
db 0\r
\r
+;-------------------------------------------------------------------------------\r
+\r
p_arg_r_r:\r
call p_arg_r\r
call p_char_comma\r
sub_1ce8h:\r
call p_char_lparen\r
call p_arg_ww\r
-out_rparen:\r
- jp p_char_rparen\r
+ jr out_rparen\r
\r
l1cf5h:\r
call p_A_comma\r
sub_1d2ch:\r
call p_char_lparen\r
ld a,(iy+001h)\r
- jp l1e6bh\r
+p_arg_nn_rp:\r
+ call out_hex\r
+out_rparen:\r
+ jr p_char_rparen\r
+\r
l1d37h:\r
call sub_1d2ch\r
jr p_char_comma_A\r
call p_arg_addr\r
p_char_comma_A:\r
call p_char_comma\r
+ jr p_char_A\r
+\r
+p_A_comma:\r
+ call p_char_A\r
+p_char_comma:\r
+ ld a,','\r
+ db 021h\r
p_char_A:\r
ld a,'A'\r
- jr outchar1\r
-p_arg_a_addr:\r
- call p_A_comma\r
- jp p_arg_addr\r
+ db 021h\r
l1d85h:\r
ld a,'0'\r
- jr outchar1\r
+ db 021h\r
l1d89h:\r
ld a,'1'\r
- jr outchar1\r
+ db 021h\r
l1d8dh:\r
ld a,'2'\r
- jr outchar1\r
-\r
-p_A_comma:\r
- call p_char_A\r
-p_char_comma:\r
- ld a,','\r
-outchar1:\r
+ db 021h\r
+p_char_rparen:\r
+ ld a,')'\r
+ db 021h\r
+p_char_lparen:\r
+ ld a,'('\r
jp outchar\r
\r
l1d92h:\r
call p_char_comma\r
jr p_arg_addr\r
\r
+p_arg_a_addr:\r
+ call p_A_comma\r
+p_arg_addr:\r
+ call p_char_lparen\r
+ ld l,(iy+001h)\r
+ ld h,(iy+002h)\r
+ ld a,001h\r
+ call sub_1d50h\r
+ jr p_char_rparen\r
+\r
p_arg_bitop:\r
ld a,(isprefix_ixiy)\r
and a\r
l1e11h:\r
jr p_arg_r0\r
\r
-p_arg_addr:\r
- call p_char_lparen\r
- ld l,(iy+001h)\r
- ld h,(iy+002h)\r
- ld a,001h\r
- call sub_1d50h\r
-\r
-p_char_rparen:\r
- ld a,')'\r
- jp outchar\r
-\r
p_arg_r:\r
ld a,(iy+000h)\r
rra\r
l1e4dh:\r
call pstr\r
ld a,(iy+001h)\r
- and a\r
- jp m,l1e61h\r
- call pstr_inl\r
- dc '+'\r
- ld a,(iy+001h)\r
- jr l1e6bh\r
-l1e61h:\r
- call pstr_inl\r
- dc '-'\r
- ld a,(iy+001h)\r
+ push af\r
+ rlca\r
+ ld a,'+'\r
+ jr nc,l1e61h\r
+ pop af\r
neg\r
-l1e6bh:\r
- call out_hex\r
- jr p_char_rparen\r
+ push af\r
+ ld a,'-'\r
+l1e61h:\r
+ call outchar\r
+ pop af\r
+ jp p_arg_nn_rp\r
\r
p_arg_r1:\r
ld hl,t_BCDEHL_HL_A\r
call sel_dc_string\r
jp pstr\r
\r
+;-------------------------------------------------------------------------------\r
+\r
t_MNEMONICS:\r
DC 'ADC'\r
DC 'ADD'\r
t_BC.DE.HL.AF:\r
DC 'BC'\r
DC 'DE'\r
-t_HL.AF:\r
+\r
DC 'HL'\r
DC 'AF'\r
DB 0\r
-t_BC.DE.IY.SP:\r
- DC 'BC'\r
- DC 'DE'\r
- DC 'IY'\r
- DC 'SP'\r
- DB 0\r
-t_BC.DE.IX.SP:\r
- DC 'BC'\r
- DC 'DE'\r
- DC 'IX'\r
- DC 'SP'\r
- DB 0\r
t_HL.IX.IY:\r
DC 'HL'\r
-t_IX.IY:\r
+\r
DC 'IX'\r
DC 'IY'\r
DB 0\r
-t_tstfl_ZC:\r
- DC 'NZ'\r
- DC 'Z'\r
- DC 'NC'\r
- DC 'C'\r
- DC 'NE'\r
- DC 'EQ'\r
- DC 'GE'\r
- DC 'LT'\r
- DB 0\r
t_tstfl_ZCPS:\r
DC 'NZ'\r
DC 'Z'\r
DC '(C)'\r
DB 0\r
\r
-sub_1ffeh:\r
+;-------------------------------------------------------------------------------\r
+\r
+tc_set_bp:\r
ld hl,(reg.pc)\r
ld a,h\r
or l\r
ld b,0\r
ld hl,(reg.pc)\r
add hl,bc\r
- call sub_09cah\r
+ call bp_trace_enter\r
ld iy,(reg.pc)\r
ld hl,b_2039_start\r
call lookup_opc\r
ex de,hl\r
l2031h:\r
call CALL_HL\r
- call c,sub_09cah\r
+ call c,bp_trace_enter\r
l2037h:\r
scf\r
ret\r
\r
+;-------------------------------------------------------------------------------\r
+\r
b_2039_start:\r
db 0ffh,0ddh,000h ;Prefix DD\r
dw l20a7h\r
dw l20dch\r
db 0ffh,0cfh,000h ;rst 8\r
dw l2115h\r
- db 0c7h,0c7h,000h ;\r
+ db 0c7h,0c7h,000h ;rst n\r
dw l20f9h\r
- db 0c7h,0c4h,000h ;\r
+ db 0c7h,0c4h,000h ;call cc,mn\r
dw l2080h\r
- db 0f7h,010h,000h ;\r
+ db 0f7h,010h,000h ;djnz d; jr d\r
dw l2093h\r
- db 0e7h,020h,000h ;\r
+ db 0e7h,020h,000h ;jr cc,d\r
dw l2093h\r
- db 0c7h,0c2h,000h ;\r
+ db 0c7h,0c2h,000h ;jp cc,mn\r
dw l208bh\r
- db 0c7h,0c0h,000h ;\r
+ db 0c7h,0c0h,000h ;ret cc\r
dw l20c5h\r
db 0\r
\r
+;-------------------------------------------------------------------------------\r
+; call mn call cc,mn\r
l2080h:\r
ld a,(b_21e2_start)\r
and a\r
ld a,(trace_call_flag)\r
and a\r
ret nz\r
+\r
+; jp mn jp cc,mn\r
l208bh:\r
ld l,(iy+001h)\r
ld h,(iy+002h)\r
scf\r
ret\r
+\r
l2093h:\r
ld c,(iy+001h)\r
ld a,c\r
inc hl\r
scf\r
ret\r
+\r
+; jp (hl)\r
l20a2h:\r
ld hl,(reg.l)\r
scf\r
ret\r
+\r
+; Prefix DD\r
l20a7h:\r
ld hl,(reg.ix)\r
jr l20afh\r
+; Prefix FD\r
l20ach:\r
ld hl,(reg.iy)\r
l20afh:\r
ld a,(iy+001h)\r
- cp 0e9h\r
+ cp 0e9h ; jp (ix); jp (iy)\r
scf\r
ret z\r
and a\r
ret\r
+\r
+; Prefix ED\r
l20b8h:\r
ld a,(iy+001h)\r
- cp 04dh\r
+ cp 04dh ; reti\r
jr z,l20dch\r
- cp 045h\r
+ cp 045h ; retn\r
jr z,l20dch\r
and a\r
ret\r
inc hl\r
ld d,(hl)\r
ex de,hl\r
- call sub_09cah\r
+ call bp_trace_enter\r
+l2115h:\r
and a\r
ret\r
\r
l2113h:\r
scf\r
ret\r
-l2115h:\r
- and a\r
- ret\r
+\r
+;-------------------------------------------------------------------------------\r
+; >>C[N][J] [steps]\r
+; >>C[N][J] W expression\r
+; >>C[N][J] U expression\r
+; trace over Calls [No list] [Jumps only] /.While./.Until.\r
+\r
cmd_C:\r
ld hl,cmd_C\r
ld a,1\r
- jr l2122h\r
+ jr cmd_tc\r
+\r
+;-------------------------------------------------------------------------------\r
+; >>T[N][J] [steps]\r
+; >>T[N][J] W expression\r
+; >>T[N][J] U expression\r
+; Trace [no List] [Jumps only] / .While. / .Until.\r
+\r
cmd_T:\r
xor a\r
ld hl,cmd_T\r
-l2122h:\r
+cmd_tc:\r
ld (cmd_rpt),hl\r
ld (trace_call_flag),a\r
- ld a,(de)\r
+ call get_char_upper\r
sub 'N'\r
- jr nz,l212eh\r
+ jr nz,tc_non\r
inc de\r
-l212eh:\r
+tc_non:\r
ld (trace_N_flag),a\r
- ld a,(de)\r
+ call get_char_upper\r
sub 'J'\r
- jr nz,l2137h\r
+ jr nz,tc_noj\r
inc de\r
-l2137h:\r
+tc_noj:\r
ld (trace_J_flag),a\r
- call sub_21a6h\r
- jr z,l2145h\r
- ld hl,1\r
+ call tc_chk_u_or_w\r
+ jr z,tc_save_uw_expr_ptr\r
+ ld hl,1 ;default: 1 step\r
call get_lastarg_def\r
-l2145h:\r
- ld (trace_count),hl\r
+tc_save_uw_expr_ptr:\r
+ ld (trace_cnt_or_ptr),hl\r
sub a\r
- ld (l0941h),a\r
+ ld (bp_p_cpu_flag),a\r
l214ch:\r
- call sub_1ffeh\r
- jr l21a3h\r
+ call tc_set_bp\r
+ jr user_go1\r
\r
l2151h:\r
call bp_clr_temporary\r
call lookup_opc\r
jr nc,l214ch\r
l216bh:\r
- ld a,(trace_UW_flag)\r
+ ld a,(trace_UW_flag) ;0 or 'U' or 'W'\r
and a\r
- jr z,l2188h\r
- ld de,(trace_count)\r
+ jr z,tc_cnt ;flag is 0, check for step count.\r
+ ld de,(trace_cnt_or_ptr)\r
call expr\r
ld a,h\r
or l\r
add a,0ffh\r
sbc a,a\r
- ld hl,trace_UW_flag\r
+ ld hl,trace_UW_flag ;'U' or 'W'\r
xor (hl)\r
- bit 1,a\r
+ bit 1,a ;'U' = 55H, 'W' = 57H\r
jr z,l2193h\r
-l2185h:\r
- jp l0902h\r
-l2188h:\r
- ld hl,(trace_count)\r
+do_break0: ;print registers and go to main loop\r
+ jp do_break\r
+\r
+tc_cnt:\r
+ ld hl,(trace_cnt_or_ptr)\r
dec hl\r
- ld (trace_count),hl\r
+ ld (trace_cnt_or_ptr),hl\r
ld a,h\r
or l\r
- jr z,l2185h\r
+ jr z,do_break0\r
l2193h:\r
- call sub_1ffeh\r
- jr nc,l2185h\r
+ call tc_set_bp\r
+ jr nc,do_break0\r
ld a,(trace_N_flag)\r
ld b,a\r
- ld a,(l0941h)\r
+ ld a,(bp_p_cpu_flag)\r
or b\r
- ld (l0941h),a\r
-l21a3h:\r
+ ld (bp_p_cpu_flag),a\r
+user_go1:\r
jp user_go\r
\r
-sub_21a6h:\r
+tc_chk_u_or_w:\r
call skipbl\r
xor a\r
ld (trace_UW_flag),a\r
- ld a,(de)\r
+ call get_char_upper\r
cp 'U'\r
jr z,l21b5h\r
cp 'W'\r
cp 045h\r
ret\r
\r
+;-------------------------------------------------------------------------------\r
+\r
+con_col:\r
+ db 0\r
+\r
+;-------------------------------------------------------------------------------\r
+\r
b_21e2_start:\r
db 0\r
trace_call_flag:\r
db 0 ;1=call, 0=trace\r
trace_UW_flag:\r
db 0 ;0 or 'U' or 'W'\r
-trace_count:\r
+trace_cnt_or_ptr:\r
dw 0\r
trace_N_flag:\r
db 0 ;0 if 'N'\r
trace_J_flag:\r
db 0 ;0 if 'J'\r
\r
-;-------------------------------------------------------------------------------\r
-\r
-con_col:\r
- db 0\r
-\r
-l0941h:\r
+bp_p_cpu_flag:\r
db 0\r
\r
bp_tab:\r
\r
expr_p1:\r
dw expr_buf\r
-expr_p2:\r
- dw expr_buf\r
\r
expr_buf:\r
current_cseg defl $ - current_cseg\r
ds EXPR_BUF_SIZE - ($ - expr_buf)\r
expr_bufe:\r
\r
-msg_Y:\r
- dc 'Yn'\r
-reg_Y:\r
- rept YREG_CNT\r
- dw 0\r
- endm\r
+;-------------------------------------------------------------------------------\r
\r
last_S:\r
dw TPA\r
max_load:\r
dw TPA\r
\r
-l1262h:\r
- dw 0\r
-last_A:\r
- dw TPA\r
-cmd_A_prev:\r
- dw TPA\r
-\r
-prefix_ixiy:\r
- db 0\r
-\r
isprefix_ixiy:\r
db 0\r
last_L:\r
disas_argtype:\r
db 0\r
\r
-symlen_max: ;max length of symbols read so far\r
- db 0\r
+pbl_loop_adr:\r
+ dw 0\r
+\r
cur_fcb:\r
dw 0\r
-fcbsym:\r
- ds 33\r
\r
ddtz_size equ $-ddtz_base\r
ddtz_end:\r