zasm: fix include line no in error reports

Weren't properly saved during local pass back and forth.
This commit is contained in:
Virgil Dupras 2019-06-14 20:26:39 -04:00
parent c613f7b0ee
commit 93981e00eb

View File

@ -104,6 +104,8 @@ ioGetC:
ret z ; local pass? return EOF ret z ; local pass? return EOF
; regular pass (first or second)? transparently get off include mode. ; regular pass (first or second)? transparently get off include mode.
ld (IO_IN_INCLUDE), a ; A already 0 ld (IO_IN_INCLUDE), a ; A already 0
ld (IO_INC_LINENO), a
ld (IO_INC_LINENO+1), a
; continue on to "normal" reading. We don't want to return our zero ; continue on to "normal" reading. We don't want to return our zero
.normalmode: .normalmode:
; normal mode, read from IN stream ; normal mode, read from IN stream
@ -155,6 +157,10 @@ ioPutC:
ioSavePos: ioSavePos:
ld hl, (IO_LINENO) ld hl, (IO_LINENO)
call ioInInclude
jr z, .skip
ld hl, (IO_INC_LINENO)
.skip:
ld (IO_SAVED_LINENO), hl ld (IO_SAVED_LINENO), hl
call _ioTell call _ioTell
ld (IO_SAVED_POS), hl ld (IO_SAVED_POS), hl
@ -162,7 +168,13 @@ ioSavePos:
ioRecallPos: ioRecallPos:
ld hl, (IO_SAVED_LINENO) ld hl, (IO_SAVED_LINENO)
call ioInInclude
jr nz, .include
ld (IO_LINENO), hl ld (IO_LINENO), hl
jr .recallpos
.include:
ld (IO_INC_LINENO), hl
.recallpos:
ld hl, (IO_SAVED_POS) ld hl, (IO_SAVED_POS)
jr _ioSeek jr _ioSeek
@ -202,6 +214,7 @@ _ioTell:
jp _blkTell ; returns jp _blkTell ; returns
; Sets Z according to whether we're inside an include ; Sets Z according to whether we're inside an include
; Z is set when we're *not* in includes. A bit weird, I know...
ioInInclude: ioInInclude:
ld a, (IO_IN_INCLUDE) ld a, (IO_IN_INCLUDE)
or a ; cp 0 or a ; cp 0