From 2d914eb7d607546546a41af99ded751e8e416dfb Mon Sep 17 00:00:00 2001 From: Leo C Date: Sun, 14 Aug 2016 14:42:52 +0200 Subject: [PATCH] Command R: add offset to symbol values. --- ddt180.z80 | 102 +++++++++++++++++++++++++++++++---------------------- 1 file changed, 59 insertions(+), 43 deletions(-) diff --git a/ddt180.z80 b/ddt180.z80 index 11f42e9..9dae620 100644 --- a/ddt180.z80 +++ b/ddt180.z80 @@ -597,6 +597,7 @@ pss_l: ld a,(hl) call outchar djnz pss_l + dec hl pop bc ret @@ -2497,43 +2498,51 @@ p_symbols: inc de call assert_eol ld a,(symlen_max) - add a,8 + add a,7 ld b,a - ld a,80 ;screen width - ld c,-1 -psym_1: - inc c - sub a,b - jr nc,psym_1 - + ld c,0 ld hl,ddtz_base+2 -psym_nxtline: - ld b,c -psym_nxtcol: +psym_nxtsym: ld d,(hl) dec hl ld e,(hl) dec hl ld a,(hl) - call sub_hl_a1 cp 0c3h jr z,psym_e ex de,hl call out_hl call outbl - ld a,3 - call p_sym_space ex de,hl - djnz psym_nxtcol + call p_symstr + + ld a,c + add b + ld c,a + ld a,80 ;screen width + sub b + cp c + jr c,psym_nxtline +psym_fillcol: + call outbl + ld a,(con_col) + cp c + jr c,psym_fillcol + jr psym_nxtsym + +psym_nxtline: + ld c,0 call crlf - jr psym_nxtline + jr psym_nxtsym + psym_e: - ld a,b - cp c + ld a,c + or a ret z jp crlf + cmd_Q: ld a,(de) sub 'J' @@ -2913,6 +2922,7 @@ read_byte: cp 080h jr nz,l1111h call read_sector + ld a,01ah ret z sub a l1111h: @@ -2934,9 +2944,9 @@ read_sector: ld de,(cur_fcb) ld c,BDOS_READ call ddtz_bdos - dec a + sub a,1 jr z,l1132h - jp p,ERROR + jr nc,error8 l1132h: pop bc pop de @@ -2948,10 +2958,10 @@ cmdR_storebyte: push de ld de,TPA call cp_hl_de - jp c,ERROR + jr c,error8 ld de,(BDOS+1) call cp_hl_de - jp nc,ERROR + jr nc,error8 ld de,(high_load) call cp_hl_de jr c,l1157h @@ -3039,12 +3049,15 @@ read_file: pop hl jr z,read_hexfile ld de,TPA - add hl,de push hl + add hl,de l108eh: call read_sector + jr nz,read_file_nxt pop hl - jr z,read_symfile + jr read_symfile + +read_file_nxt: ld de,DMA_BUF ld b,080h l109ah: @@ -3053,29 +3066,28 @@ l109ah: inc de inc hl djnz l109ah - push hl jr l108eh read_hexfile: push hl l10aeh: - call read_byte + call read_byte ; RECORD MARK jr z,rdhex_done cp ':' jr nz,l10aeh ld c,0 - call read_hexchar + call read_hexchar ; RECLEN ld b,a - call read_hexchar + call read_hexchar ; LOAD ADDR H ld h,a - call read_hexchar + call read_hexchar ; LOAD ADDR L ld l,a ld a,b and a jr z,rdhex_done - call read_hexchar + call read_hexchar ; RECTYP l10cch: - call read_hexchar + call read_hexchar ; DATA pop de push de push hl @@ -3084,7 +3096,7 @@ l10cch: pop hl inc hl djnz l10cch - call read_hexchar + call read_hexchar ; CHKSUM ld a,c and a jr nz,error9 @@ -3099,6 +3111,7 @@ read_symfile: cp ' ' jp z,p_max_high + push hl ; offset call pstr_inl db 'SYMBOLS',CR,LF+80h @@ -3107,15 +3120,18 @@ read_symfile: rs_1: call read_byte rs_2: + pop de ; offset cp 1ah jp z,p_max_high + push de ; offset cp '!' jr c,rs_1 - call read_hexbyte0 - ld d,a - call read_hexbyte ; symval - ld e,a - push de ; symval + call read_hexbyte0 ; symval H + ld h,a + call read_hexbyte ; symval L + ld l,a + add hl,de + push hl ; symval call read_byte cp ' ' jr z,rs_4 @@ -3124,17 +3140,17 @@ rs_3: call read_byte cp ' ' jr c,rs_2 jr rs_3 -; + rs_4: ld hl,(BDOS+1) ; ld e,0 ; setup symlen rs_5: dec hl ; - call read_byte ; - cp TAB ; + call read_byte ; next char of symbol name + cp TAB ; symbol term? jr z,rs_6 ; cp CR ; jr z,rs_6 ; - cp '!' ; - jr c,error9 ; + cp '!' ; TODO: check for valid symbol char instead + jr c,error9 ; ld (hl),a ; inc e ; symlen++ ld a,e ; @@ -3142,7 +3158,7 @@ rs_5: dec hl ; jr c,rs_5 ; error9: jp ERROR ; -; + rs_6: push de ; symlen push hl ; ex de,hl ; -- 2.39.2