zasm: fix include EOF detection

That was an interesting bug. It didn't cause a problem in emulation, but
in an RC2014 on an SD card, an include that didn't end with two newlines
would cause an infinite loop.
This commit is contained in:
Virgil Dupras 2019-06-15 15:50:27 -04:00
parent 92a04f4627
commit 4327153ffd
2 changed files with 4 additions and 4 deletions

View File

@ -80,8 +80,9 @@ ioGetC:
; We're in "include mode", read from FS
ld ix, IO_INCLUDE_BLK
call _blkGetC
jr nz, .includeEOF
cp 0x0a ; newline
jr nz, .notNewline
ret nz ; not newline? nothing to do
; We have newline. Increase lineno and return (the rest of the
; processing below isn't needed.
push hl
@ -90,9 +91,7 @@ ioGetC:
pop hl
ret
.notNewline:
or a ; cp 0
ret nz ; not zero, all good
.includeEOF:
; We reached EOF. What we do depends on whether we're in Local Pass
; mode. Yes, I know, a bit hackish. Normally, we *should* be
; transparently getting of include mode and avoid meddling with global

View File

@ -484,6 +484,7 @@ fsGetC:
push hl
call fsPlaceH
call fsblkGetC
cp a ; ensure Z
pop hl
ret