Implement support for 'hh' length modifier in *scanf.
Also support '%ln', although the length that can be reported is still limited to 64k.
This commit is contained in:
parent
5ee6e87f44
commit
a11660f597
37
stdio.asm
37
stdio.asm
|
@ -4732,8 +4732,12 @@ lb4b lda ~suppress if input is not suppressed then
|
||||||
beq lb4c
|
beq lb4c
|
||||||
sub4 #0,val,val negate the value
|
sub4 #0,val,val negate the value
|
||||||
lb4c lda val save the value
|
lb4c lda val save the value
|
||||||
sta [arg]
|
ldx ~size
|
||||||
dec ~size
|
bpl lb4d
|
||||||
|
sep #$20
|
||||||
|
lb4d sta [arg]
|
||||||
|
rep #$20
|
||||||
|
dex
|
||||||
bmi lb6
|
bmi lb6
|
||||||
ldy #2
|
ldy #2
|
||||||
lda val+2
|
lda val+2
|
||||||
|
@ -4883,8 +4887,17 @@ arg equ 11 argument
|
||||||
ldx ~suppress if output is not suppressed then
|
ldx ~suppress if output is not suppressed then
|
||||||
bne lb1
|
bne lb1
|
||||||
lda ~scanCount save the count
|
lda ~scanCount save the count
|
||||||
sta [arg]
|
ldx ~size
|
||||||
dec ~assignments fix assignment count
|
bpl lb0
|
||||||
|
sep #$20
|
||||||
|
lb0 sta [arg]
|
||||||
|
rep #$20
|
||||||
|
dex
|
||||||
|
bmi lb0a
|
||||||
|
lda #0
|
||||||
|
ldy #2
|
||||||
|
sta [arg],y
|
||||||
|
lb0a dec ~assignments fix assignment count
|
||||||
lb1 ldy #2 remove the parameter from the stack
|
lb1 ldy #2 remove the parameter from the stack
|
||||||
jsr ~RemoveWord
|
jsr ~RemoveWord
|
||||||
rts
|
rts
|
||||||
|
@ -5117,8 +5130,12 @@ lb4a lda read if no chars read then
|
||||||
lb4b lda ~suppress if input is not suppressed then
|
lb4b lda ~suppress if input is not suppressed then
|
||||||
bne lb7
|
bne lb7
|
||||||
lda val save the value
|
lda val save the value
|
||||||
sta [arg]
|
ldx ~size
|
||||||
dec ~size
|
bpl lb4c
|
||||||
|
sep #$20
|
||||||
|
lb4c sta [arg]
|
||||||
|
rep #$20
|
||||||
|
dex
|
||||||
bmi lb6
|
bmi lb6
|
||||||
ldy #2
|
ldy #2
|
||||||
lda val+2
|
lda val+2
|
||||||
|
@ -5346,6 +5363,12 @@ fm2a inc ~size long specifier
|
||||||
bra fm4
|
bra fm4
|
||||||
fm3 cmp #'h' else if it is an 'h' then
|
fm3 cmp #'h' else if it is an 'h' then
|
||||||
bne fm5
|
bne fm5
|
||||||
|
inc4 format check for 'hh'
|
||||||
|
lda [format]
|
||||||
|
and #$00FF
|
||||||
|
cmp #'h'
|
||||||
|
bne fm4
|
||||||
|
dec ~size
|
||||||
fm4 inc4 format ignore the character
|
fm4 inc4 format ignore the character
|
||||||
|
|
||||||
fm5 lda [format] find the proper format character
|
fm5 lda [format] find the proper format character
|
||||||
|
@ -5455,7 +5478,7 @@ ch ds 2 temp storage
|
||||||
~scanCount ds 2 # of characters scanned
|
~scanCount ds 2 # of characters scanned
|
||||||
~scanError ds 2 set to 1 by scaners if an error occurs
|
~scanError ds 2 set to 1 by scaners if an error occurs
|
||||||
~scanWidth ds 2 max # characters to scan
|
~scanWidth ds 2 max # characters to scan
|
||||||
~size ds 2 size specifier; -1 -> short, 1 -> long,
|
~size ds 2 size specifier; -1 -> char, 1 -> long,
|
||||||
! 0 -> default
|
! 0 -> default
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue