zasm: allow single quote to contain whitespace
This commit is contained in:
parent
40d5530666
commit
21c49d80cf
@ -92,10 +92,12 @@ readWord:
|
|||||||
ld hl, scratchpad
|
ld hl, scratchpad
|
||||||
ld b, SCRATCHPAD_SIZE-1
|
ld b, SCRATCHPAD_SIZE-1
|
||||||
; A contains the first letter to read
|
; A contains the first letter to read
|
||||||
; Let's first check if we open with a quote. If we do, let's have the
|
; Are we opening a double quote?
|
||||||
; special quote treatment.
|
|
||||||
cp '"'
|
cp '"'
|
||||||
jr z, .insideQuote
|
jr z, .insideQuote
|
||||||
|
; Are we opening a single quote?
|
||||||
|
cp 0x27 ; '
|
||||||
|
jr z, .singleQuote
|
||||||
.loop2:
|
.loop2:
|
||||||
ld (hl), a
|
ld (hl), a
|
||||||
inc hl
|
inc hl
|
||||||
@ -134,6 +136,21 @@ readWord:
|
|||||||
djnz .insideQuote
|
djnz .insideQuote
|
||||||
; out of space. error.
|
; out of space. error.
|
||||||
jr .error
|
jr .error
|
||||||
|
.singleQuote:
|
||||||
|
; single quote is more straightforward: we have 3 chars and we put them
|
||||||
|
; right in scratchpad
|
||||||
|
ld (hl), a
|
||||||
|
call ioGetC
|
||||||
|
or a
|
||||||
|
jr z, .error
|
||||||
|
inc hl
|
||||||
|
ld (hl), a
|
||||||
|
call ioGetC
|
||||||
|
cp 0x27 ; '
|
||||||
|
jr nz, .error
|
||||||
|
inc hl
|
||||||
|
ld (hl), a
|
||||||
|
jr .loop2
|
||||||
|
|
||||||
; Reads the next char in I/O. If it's a comma, Set Z and return. If it's not,
|
; Reads the next char in I/O. If it's a comma, Set Z and return. If it's not,
|
||||||
; Put the read char back in I/O and unset Z.
|
; Put the read char back in I/O and unset Z.
|
||||||
|
@ -5,5 +5,6 @@ ld a, 0x42
|
|||||||
ld hl, 0x4234
|
ld hl, 0x4234
|
||||||
ld hl, (0x4234)
|
ld hl, (0x4234)
|
||||||
ld a, 'X'
|
ld a, 'X'
|
||||||
|
ld a, ' '
|
||||||
ld a, 'a' ; don't upcase!
|
ld a, 'a' ; don't upcase!
|
||||||
.db "bonjour allo", 0
|
.db "bonjour allo", 0
|
||||||
|
Loading…
Reference in New Issue
Block a user