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
-SYMCASE_SENS equ 0 ;Symbols are case sensitive\r
-SYMCASE_CONV equ 1 ;Convert case when symbols are loaded\r
-SYMCASE_LOWER equ 2 ;Convert to lower case if set, else to upper case\r
\r
;-------------------------------------------------------------------------------\r
\r
ret\r
ddtz_bdos:\r
jp 0\r
-screen_width:\r
- db 80\r
-\r
-symattrib:\r
- db 0\r
-\r
\r
current_cseg defl $ - current_cseg\r
.phase current_phase + current_cseg\r
var.$: dw 0000h\r
var.@: dw 0\r
\r
-error_func:dw p_msg_error\r
cmd_rpt:dw mainloop\r
\r
;-------------------------------------------------------------------------------\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,p_msg_error\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
;-------------------------------------------------------------------------------\r
\r
-p_msg_error:\r
- call pstr_inl\r
- dc '?'\r
- ;fall thru\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
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_cur)\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
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
-;-------------------------------------------------------------------------------\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
\r
lookupch:\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
;-------------------------------------------------------------------------------\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
fact_factstring:\r
ld hl,0\r
l054bh:\r
error1:\r
jp ERROR\r
\r
-fact_symbol:\r
- push bc\r
- ld hl,ddtz_base ;symtbl start\r
- ld a,(symattrib)\r
- ld c,07fh\r
- rra\r
- jr c,fs_nxtsym\r
- res 5,c\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_nxtchar:\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
- inc de\r
- cp a,':'\r
- jr z,fs_cont_1\r
- dec de\r
-\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
-\r
-fs_3:\r
- inc de\r
- dec hl\r
- xor (hl)\r
- and c\r
- jr z,fs_nxtchar\r
-fs_cont: ;start over\r
- pop de ;inpsym ptr\r
-fs_cont_1:\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
\r
get.number:\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
; > Y[0..9]\r
; examine (and substitute) an Y variable\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
-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
;-------------------------------------------------------------------------------\r
; > X\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
-; > HS\r
-; display symbol list\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 get_char_upper\r
- cp 'S'\r
- jr z,p_sym_list\r
-\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_cur)\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,(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
;-------------------------------------------------------------------------------\r
; > Q[J] startaddr endaddr bytes\r
; Query memory for a byte string [Justified]\r
pop hl\r
jp p_max_high\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
-\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'\r
- ret z\r
- ccf\r
- ret c\r
- cp 'a'\r
- ret nc\r
- cp 'Z'\r
- ret z\r
- ccf\r
- ret c\r
- cp '?'\r
- ret nc\r
-test_numeral:\r
- cp '9'\r
- ret z\r
- ccf\r
- ret c\r
- cp '0'\r
- ret\r
-\r
test_whitespace:\r
cp ' '\r
ret z\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
-\r
+ ; fall thru\r
;-------------------------------------------------------------------------------\r
\r
p_offset:\r
\r
;-------------------------------------------------------------------------------\r
\r
-msg_Y:\r
- dc 'Yn'\r
-reg_Y:\r
- rept YREG_CNT\r
- dw 0\r
- endm\r
-\r
last_S:\r
dw TPA\r
\r
pbl_loop_adr:\r
dw 0\r
\r
-symlen_cur: ;max length of symbols read so far\r
- db 0\r
cur_fcb:\r
dw 0\r
\r