mirror of
https://github.com/A2osX/A2osX.git
synced 2024-08-15 04:29:35 +00:00
64 lines
1004 B
Plaintext
64 lines
1004 B
Plaintext
PR#3
|
||
PREFIX /A2OSX.BUILD
|
||
LOMEM $A00
|
||
INC 1
|
||
AUTO 6
|
||
*/--------------------------------------
|
||
* # AToI
|
||
* Convert String to 32 bit int
|
||
* ## In:
|
||
* PUSHW PTR to target buffer DWORD
|
||
* PUSHW Source String (PSTR)
|
||
* ## Out:
|
||
*\--------------------------------------
|
||
K.AToI jsr PullPtr1Ptr2 PSTR in Ptr1,buffer in Ptr2
|
||
|
||
stz ASCBUF
|
||
|
||
ldx #0
|
||
|
||
lda (ZPPtr1)
|
||
beq .2
|
||
|
||
ldy #0
|
||
|
||
.1 iny
|
||
lda (ZPPtr1),y
|
||
|
||
cmp #'0'
|
||
bcc .2
|
||
cmp #'9'+1
|
||
bcs .2
|
||
|
||
inx
|
||
sta ASCBUF,x
|
||
cpx #10
|
||
beq .2
|
||
tya
|
||
cmp (ZPPtr1)
|
||
bne .1
|
||
|
||
.2 stx ASCBUF
|
||
jsr DEC2HEX
|
||
|
||
ldy #3
|
||
|
||
.3 lda HEXBUF,y
|
||
sta (ZPPtr2),y
|
||
dey
|
||
bpl .3
|
||
|
||
clc
|
||
rts
|
||
*--------------------------------------
|
||
TYPES .AS "-dbclssp"
|
||
ACCESS .AS "rwxrwxrwx"
|
||
SIGN .BS 1
|
||
PADLEN .BS 1
|
||
PADCHAR .BS 1
|
||
*--------------------------------------
|
||
MAN
|
||
SAVE /A2OSX.SRC/SYS/KERNEL.S.STDLIB
|
||
LOAD /A2OSX.SRC/SYS/KERNEL.S
|
||
ASM
|