summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLeo C2016-08-20 21:55:47 +0200
committerLeo C2016-08-20 21:55:47 +0200
commit1d3941c8ac130b6dcf7951cb13c0b8c8e46a8e11 (patch)
treee0ccc5e3bb257dd03ae51dffcadf0e3fa9298421
parentc486c4dadb569dcb1c92c7778bde875363a09f12 (diff)
downloadddt180-1d3941c8ac130b6dcf7951cb13c0b8c8e46a8e11.zip
Optionally convert Symbols to upper or lower case when loading.
-rw-r--r--ddt180.z8054
1 files changed, 40 insertions, 14 deletions
diff --git a/ddt180.z80 b/ddt180.z80
index 2959558..8e3ad31 100644
--- a/ddt180.z80
+++ b/ddt180.z80
@@ -14,6 +14,7 @@ TPA equ 0100h
.phase TPA
jp start
+ ds 3
ldr_end:
ldr_size equ $ - TPA
@@ -64,11 +65,12 @@ BP_CNT equ 12 ;Number of breakpoints
BP_SIZE equ 8 ;Size of a breakpoint record
YREG_CNT equ 10 ;Number of Y registers (0..9)
-SYMCASE_SENS equ 1 ;Symbols are case sensitive
-SYMCASE_CONV equ 2 ;Convert case when symbols are loaded
-SYMCASE_LOWER equ 4 ;Convert to lower case if set, else to upper case
+SYMCASE_SENS equ 0 ;Symbols are case sensitive
+SYMCASE_CONV equ 1 ;Convert case when symbols are loaded
+SYMCASE_LOWER equ 2 ;Convert to lower case if set, else to upper case
;-------------------------------------------------------------------------------
+
ddtz_base:
jp ddtz_bdos
l0003h:
@@ -461,6 +463,7 @@ p_goto_col:
inchar:
+ push ix
push hl
push de
push bc
@@ -475,6 +478,7 @@ l0284h:
pop bc
pop de
pop hl
+ pop ix
ret
get_line:
@@ -500,10 +504,20 @@ toupper:
cp 'a'
ret c
cp 'z'+1
- ret nc
+ ccf
+ ret c
and 05fh
ret
+tolower:
+ cp 'A'
+ ret c
+ cp 'Z'+1
+ ccf
+ ret c
+ or 020h
+ ret
+
skipbl0:
inc de
skipbl:
@@ -1088,6 +1102,9 @@ do_factor:
ld hl,(var.$)
cp '$'
ret z
+ ld hl,ddtz_base
+ cp 'Z'
+ ret z
cp '-'
jr z,fact_factneg
cp '~'
@@ -1879,12 +1896,12 @@ sub_09cah:
and a
ld a,008h
jr nz,l09edh
- ld a,004h
+ rra
l09edh:
ld (ix+000h),a
ret
-sub_09f1h:
+bp_set_to_mem:
ld b,BP_CNT
ld ix,bp_tab
l09f7h:
@@ -1927,7 +1944,7 @@ user_go:
call sub_1ffeh
ld c,008h
l0a41h:
- call sub_09f1h
+ call bp_set_to_mem
ld sp,reg.l2
pop hl
pop de
@@ -3073,8 +3090,10 @@ read_symfile:
call pstr_inl
db 'SYMBOLS',CR,LF+80h
- dec de
- call file_open
+ dec de
+ call file_open
+ ld a,(symattrib)
+ ld c,a
rs_1:
call read_byte
rs_2:
@@ -3106,11 +3125,17 @@ rs_5:
call read_byte ; next char of symbol name
call test_sym_char ; valid char?
jr nz,rs_6
+ bit SYMCASE_CONV,c
+ jr z,rs_51
+ call toupper
+ bit SYMCASE_LOWER,c
+ call nz,tolower
+rs_51:
ld (hl),a ;
inc b ; symlen++
- ld a,b ;
- cp 10h+1 ;
- jr c,rs_5 ;
+ ld a,(symlen_max) ;
+ cp b ;
+ jr nc,rs_5 ;
error3:
jp ERROR ;
@@ -3143,13 +3168,14 @@ rs_61:
ld de,(BDOS+1) ;
ld (BDOS+1),hl ;
ex de,hl ;
- pop af ; symlen
- ld (hl),a ;
+ pop bc ; symlen
+ ld (hl),b ;
inc hl ;
pop de ; symval
ld (hl),e ;
inc hl ;
ld (hl),d ;
+ ld a,b ;
ld hl,symlen_cur ;
cp (hl) ; new max?
jr c,$+3 ;