summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLeo C2016-08-12 10:26:54 +0200
committerLeo C2016-08-12 10:26:54 +0200
commit3a4deef923e7cdf53a61035bb58575f8da8045b0 (patch)
tree2c357b47c5f1ed746484dbff7c30c48c1806a6cb
parent01cb8973f5fbba05d990523d4fb0aaf3e269c01a (diff)
downloadddt180-3a4deef923e7cdf53a61035bb58575f8da8045b0.zip
Allow symbols in expressions. Print symbol in H command.
-rw-r--r--ddt180.z8090
1 files changed, 84 insertions, 6 deletions
diff --git a/ddt180.z80 b/ddt180.z80
index 1eebd02..862dbc2 100644
--- a/ddt180.z80
+++ b/ddt180.z80
@@ -1029,16 +1029,18 @@ do_factor:
cp '('
jr z,fact_mem
cp '['
- jp z,expr_brckt
+ jr z,expr_brckt
cp ''''
jr z,fact_factstring
+ cp '.'
+ jr z,fact_symbol
dec de
scf
ret
fact_reg.Y:
call get.decdigit
- jp c,ERROR
+ jr c,error4
inc de
add a,a
ld hl,reg_Y
@@ -1134,6 +1136,66 @@ expr_brckt:
error4:
jp ERROR
+fact_symbol:
+ push bc
+ ld hl,ddtz_base
+
+fs_nxtsym:
+ ld a,(hl) ;symlen
+ cp 0c3h
+ jr z,error4
+ ld b,a
+ inc b
+ push hl
+ push de
+fs_2:
+ ld a,(de)
+ call test_termchar
+ jr z,fs_endstr
+ dec b
+ jr z,fs_cont
+ inc de
+ dec hl
+ cp (hl)
+ jr z,fs_2
+fs_cont:
+ pop de
+ pop hl
+ ld a,(hl)
+ add a,3
+ call sub_hl_a
+ jr fs_nxtsym
+
+fs_endstr:
+ dec b
+ jr nz,fs_cont
+ pop hl
+ pop hl
+ inc hl
+ ld a,(hl)
+ inc hl
+ ld h,(hl)
+ ld l,a
+ or a
+ pop bc
+ ret
+
+t_trmchrs:
+ db ' !#&()*+,-/:;<=>[\]{|}',0
+t_trmchrs_len equ $ - t_trmchrs
+
+test_termchar:
+ push hl
+ push bc
+ ld hl,t_trmchrs
+ ld bc,t_trmchrs_len
+ cpir
+ pop bc
+ pop hl
+ ret
+
+
+
get.number:
call get.hexdigit
ret c
@@ -2318,9 +2380,11 @@ l0e5eh:
call out_hl_dec_neg
call outbl4
call out.bin.w
- call outbl2
+ call outbl
ld a,l
call out.ascii
+ call outbl
+ call p_symbol
jp crlf
p_symbols:
@@ -2335,8 +2399,8 @@ psym_l:
ld b,(hl)
dec hl
ld a,b
- cp 10h
- ret nc
+ cp 0c3h
+ ret z
ex de,hl
call out_hl
@@ -2350,6 +2414,17 @@ psymch_l:
call crlf
jr psym_l
+
+p_symbol:
+ if 0
+ ld a,(dash_flag)
+ or a
+ ret nz
+ endif
+ call sym_getname
+ ret z
+ ld a,'.'
+ call outchar
p_symstr:
ld b,(hl)
pss_l:
@@ -2359,7 +2434,6 @@ pss_l:
djnz pss_l
ret
-
p_label:
if 0
ld a,(dash_flag)
@@ -3072,6 +3146,10 @@ p_max_high:
DC ' Max = '
ld hl,(max_load)
call out_hl
+ call pstr_inl
+ DC ' Top = '
+ ld hl,(BDOS+1)
+ call out_hl
jp crlf
cmd_W: