mirror of
https://github.com/byteworksinc/ORCALib.git
synced 2024-06-09 18:29:27 +00:00
scanf: for 'i' or 'd' specifiers, count a leading sign toward the field width.
This commit is contained in:
parent
de9f830c0c
commit
61bfc70b9b
14
stdio.asm
14
stdio.asm
|
@ -4759,7 +4759,7 @@ arg equ 11 argument
|
||||||
lda #1 allow base 8, 10, 16
|
lda #1 allow base 8, 10, 16
|
||||||
sta based
|
sta based
|
||||||
|
|
||||||
bs1 stz read no chars read
|
bs1 stz read no digits read
|
||||||
lda #10 assume base 10
|
lda #10 assume base 10
|
||||||
sta base
|
sta base
|
||||||
stz val initialize the value to 0
|
stz val initialize the value to 0
|
||||||
|
@ -4778,16 +4778,20 @@ ef1 tax {...back to skipping whitespace}
|
||||||
lda __ctype+1,X
|
lda __ctype+1,X
|
||||||
and #_space
|
and #_space
|
||||||
bne lb1
|
bne lb1
|
||||||
inc read
|
|
||||||
txa
|
txa
|
||||||
stz minus assume positive number
|
stz minus assume positive number
|
||||||
cmp #'+' skip leading +
|
cmp #'+' skip leading +
|
||||||
beq sg1
|
beq sg1
|
||||||
cmp #'-' if - then set minus flag
|
cmp #'-' if - then set minus flag
|
||||||
bne sg2
|
bne sg3
|
||||||
inc minus
|
inc minus
|
||||||
sg1 jsl ~getchar
|
sg1 dec ~scanWidth
|
||||||
sg2 ldx based if base 8, 16 are allowed then
|
jeq lb4a
|
||||||
|
bpl sg2
|
||||||
|
stz ~scanWidth
|
||||||
|
sg2 jsl ~getchar
|
||||||
|
sg3 inc read
|
||||||
|
ldx based if base 8, 16 are allowed then
|
||||||
beq lb2
|
beq lb2
|
||||||
cmp #'0' if the digit is '0' then
|
cmp #'0' if the digit is '0' then
|
||||||
bne lb2
|
bne lb2
|
||||||
|
|
Loading…
Reference in New Issue
Block a user