mirror of
https://github.com/byteworksinc/ORCALib.git
synced 2026-10-22 07:02:20 +00:00
strto(u)l(l): Support 0B/0b prefixes for binary (C23).
These are supported both with base=0 (where they indicate the number is in binary) and with base=2 (where the prefix is optional and does not change the base).
This commit is contained in:
1 parent
832bb39fb6
commit
fc4e5d8838
1 file changed
+38
-8
+38
-8
@@ -1279,16 +1279,31 @@ db1c lda base if the base is zero then
|
||||
lda [str],Y
|
||||
and #$00DF
|
||||
cmp #'X'
|
||||
bne cn1
|
||||
bne db1d
|
||||
asl base base 16
|
||||
bra db3 else
|
||||
db1d dc i1'$A2' ldx #~C23orLater(soft reference)
|
||||
dc s2'~C23ORLATER'
|
||||
beq cn1 if in C23 or later mode
|
||||
cmp #'B' if second char is 'B' or 'b' then
|
||||
bne cn1
|
||||
lda #2 base 2
|
||||
sta base
|
||||
bra db3
|
||||
db2 cmp #16 if the base is 16 then
|
||||
bne db2a
|
||||
lda #'X0' if first two chars are 0x or 0X then
|
||||
bra db2b skip them
|
||||
db2a cmp #2 else if the base is 2 then
|
||||
bne db4
|
||||
lda [str] if the first two chars are 0x or 0X then
|
||||
dc i1'$A2' ldx #~C23orLater(soft reference)
|
||||
dc s2'~C23ORLATER'
|
||||
beq cn1 if in C23 or later mode
|
||||
lda #'B0' if first two chars are 0b or 0B then
|
||||
db2b eor [str]
|
||||
and #$DFFF
|
||||
cmp #'X0'
|
||||
bne cn1
|
||||
db3 add4 str,#2 skip them
|
||||
db3 add4 str,#2 skip them
|
||||
dec foundOne
|
||||
bra cn1
|
||||
db4 cmp #37 check for invalid base value
|
||||
@@ -1629,16 +1644,31 @@ db1c lda base if the base is zero then
|
||||
lda [str],Y
|
||||
and #$00DF
|
||||
cmp #'X'
|
||||
bne cn1
|
||||
bne db1d
|
||||
asl base base 16
|
||||
bra db3 else
|
||||
db1d dc i1'$A2' ldx #~C23orLater(soft reference)
|
||||
dc s2'~C23ORLATER'
|
||||
beq cn1 if in C23 or later mode
|
||||
cmp #'B' if second char is 'B' or 'b' then
|
||||
bne cn1
|
||||
lda #2 base 2
|
||||
sta base
|
||||
bra db3
|
||||
db2 cmp #16 if the base is 16 then
|
||||
bne db2a
|
||||
lda #'X0' if first two chars are 0x or 0X then
|
||||
bra db2b skip them
|
||||
db2a cmp #2 else if the base is 2 then
|
||||
bne db4
|
||||
lda [str] if the first two chars are 0x or 0X then
|
||||
dc i1'$A2' ldx #~C23orLater(soft reference)
|
||||
dc s2'~C23ORLATER'
|
||||
beq cn1 if in C23 or later mode
|
||||
lda #'B0' if first two chars are 0b or 0B then
|
||||
db2b eor [str]
|
||||
and #$DFFF
|
||||
cmp #'X0'
|
||||
bne cn1
|
||||
db3 add4 str,#2 skip them
|
||||
db3 add4 str,#2 skip them
|
||||
dec foundOne
|
||||
bra cn1
|
||||
db4 cmp #37 check for invalid base value
|
||||
|
||||
Reference in new issue
Block a user