aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2020-10-02 16:16:04 -0700
committerH. Peter Anvin <hpa@zytor.com>2020-10-02 16:16:04 -0700
commit95f083f66e43ec17c1cf92c7a0116ece0933b01c (patch)
treed18e0db03fa8541da48c60788c9e14e223c7fdf9
parent11a2ed149be7b30ca89eb01113277130746c6ee4 (diff)
downloadabcdisk-master.tar.gz
abcdisk-master.tar.xz
abcdisk-master.zip
bin2abc/bac80r: even simpler and far cleaner way to find CHAINHEADmaster
The CHAIN routine might move between BASIC variants, but the *pointer* to the CHAIN routine happens to be in the same place...
-rw-r--r--asmsrc/bac80r.asm13
-rw-r--r--asmsrc/setup80.inc3
2 files changed, 6 insertions, 10 deletions
diff --git a/asmsrc/bac80r.asm b/asmsrc/bac80r.asm
index 3db24db..5d52dc4 100644
--- a/asmsrc/bac80r.asm
+++ b/asmsrc/bac80r.asm
@@ -32,19 +32,16 @@ _start:
ex de,hl
push bc ; String length
push de ; String address
+ push bc ; Bytes occupied on the stack
ld a,(hl) ; First character in chain string
ldir
- push bc ; Dummy argument (=0)
- ld c,END
+ ld hl,END
cp a,':' ; Bogus name -> END, not CHAIN ""
jr z,gotretn
- ld bc,XCHAINo
- ld a,(bc)
- cp 0CDh ; Old BASIC?
- jr z,gotretn
- ld c,XCHAINn & 0xff ; No, it's new BASIC
+ ld hl,(CHAINPTR) ; Pointer to the CHAIN routine
+ inc hl ; Skip RST 56h -> eval expression
gotretn:
- push bc ; Return address
+ push hl ; Return address
ld de,(BOFA) ; BOFA = start of data
push de ; Save for done
diff --git a/asmsrc/setup80.inc b/asmsrc/setup80.inc
index fa612a9..a997370 100644
--- a/asmsrc/setup80.inc
+++ b/asmsrc/setup80.inc
@@ -3,8 +3,7 @@
defc END=00C9h ; END routine in BASIC ROM
defc RLINEo=0D71h ; Run line in BASIC ROM (11273)
defc RLINEn=0D6Fh ; Run line in BASIC ROM (9913)
- defc XCHAINo=0D40h ; CHAIN to string expression on stack
- defc XCHAINn=0D3Eh
+ defc CHAINPTR=0E64h ; Pointer to CHAIN
defc BOFA=65052
defc EOFA=65054
defc ONERR=65076 ; Target for ON ERROR GOTO