summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2013-10-26 11:53:02 (GMT)
committerH. Peter Anvin <hpa@zytor.com>2013-10-26 11:55:11 (GMT)
commit6bb199c678a62b763e5eb695c2cc4fcacefc1b35 (patch)
tree1cbc8a35e23fd5c1efe16959bcfc4b72ad3cd075
parenta771c934a770483ed46f6b0b3daea2d4e13353d7 (diff)
downloadabc80sim-6bb199c678a62b763e5eb695c2cc4fcacefc1b35.zip
abc80sim-6bb199c678a62b763e5eb695c2cc4fcacefc1b35.tar.gz
abc80sim-6bb199c678a62b763e5eb695c2cc4fcacefc1b35.tar.bz2
abc80sim-6bb199c678a62b763e5eb695c2cc4fcacefc1b35.tar.xz
printrom: fix handling of file not found
The BASIC interpreter seems to assume that on file not found we will return with C=1, A=0 and DE preserved, so behave that way. It begs the question if we also need to preserve BC and HL across the various calls. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
-rw-r--r--printrom.asm5
-rw-r--r--printrom.binbin722 -> 728 bytes
2 files changed, 5 insertions, 0 deletions
diff --git a/printrom.asm b/printrom.asm
index a02ec84..1fa9c11 100644
--- a/printrom.asm
+++ b/printrom.asm
@@ -108,8 +108,11 @@ done_err:
pop af
and a
ret p
+ cp 128+21 ; ERR 21 = file not found
+ jr z,eof
cp 128+34 ; ERR 34 = end of file
jr nz,not_eof
+eof:
xor a ; ... end of file is signalled by A=0
not_eof:
scf
@@ -159,6 +162,7 @@ prb_prepare:
ld (ix+14),1
ld c,0xA3
prx_open:
+ push de
push bc
ex de,hl ; HL <- filename
ld (ix+6),0
@@ -176,6 +180,7 @@ prx_open:
call recv_reply
and a
pop bc
+ pop de
jr nz,done_err2
bit 0,c ; PRB:?
jr z,done_err2
diff --git a/printrom.bin b/printrom.bin
index 9a972d8..fbde8fb 100644
--- a/printrom.bin
+++ b/printrom.bin
Binary files differ