mirror of
https://github.com/A2osX/A2osX.git
synced 2024-11-30 23:49:37 +00:00
165 lines
2.1 KiB
Plaintext
165 lines
2.1 KiB
Plaintext
NEW
|
||
AUTO 3,1
|
||
*--------------------------------------
|
||
*
|
||
*
|
||
*
|
||
*--------------------------------------
|
||
X.STRESC >STYA ZPPtr1 In
|
||
>STYA ZPPtr2 Out
|
||
|
||
ldy #0
|
||
|
||
.1 lda (ZPPtr1)
|
||
beq .8
|
||
|
||
jsr X.STRESC.IncPtr1
|
||
|
||
cmp #'\'
|
||
bne .6
|
||
|
||
lda (ZPPtr1)
|
||
beq .7
|
||
|
||
ldx #X.STRESC.EscCharsCnt-1
|
||
|
||
.2 cmp X.STRESC.EscChars,x
|
||
beq .5
|
||
|
||
dex
|
||
bpl .2
|
||
|
||
stz ZPTmpByte
|
||
|
||
jsr X.STRESC.ToUC
|
||
cmp #'X'
|
||
bne .3
|
||
|
||
.20 jsr X.STRESC.IncPtr1
|
||
|
||
lda (ZPPtr1)
|
||
beq .40
|
||
|
||
jsr X.STRESC.IsHex
|
||
bcs .40
|
||
|
||
asl ZPTmpByte
|
||
asl ZPTmpByte
|
||
asl ZPTmpByte
|
||
asl ZPTmpByte
|
||
ora ZPTmpByte
|
||
sta ZPTmpByte
|
||
bra .20
|
||
|
||
.3 jsr X.STRESC.IsOct
|
||
bcs .40
|
||
|
||
jsr X.STRESC.IncPtr1
|
||
|
||
asl ZPTmpByte
|
||
asl ZPTmpByte
|
||
asl ZPTmpByte
|
||
ora ZPTmpByte
|
||
sta ZPTmpByte
|
||
lda (ZPPtr1)
|
||
bne .3
|
||
|
||
.40 lda ZPTmpByte
|
||
bra .6
|
||
|
||
.4 tax
|
||
|
||
lda #'\'
|
||
sta (ZPPtr2),y
|
||
iny
|
||
|
||
txa
|
||
bra .6
|
||
|
||
.5 lda X.STRESC.EscCodes,x
|
||
jsr X.STRESC.IncPtr1
|
||
|
||
.6 sta (ZPPtr2),y
|
||
iny
|
||
bra .1
|
||
|
||
.7 lda #'\'
|
||
sta (ZPPtr2),y
|
||
iny
|
||
lda #0
|
||
|
||
.8 sta (ZPPtr2),y
|
||
|
||
>LDYA ZPPtr2
|
||
|
||
rts
|
||
*--------------------------------------
|
||
X.STRESC.IncPtr1
|
||
inc ZPPtr1
|
||
bne .8
|
||
|
||
inc ZPPtr1+1
|
||
|
||
.8 rts
|
||
*--------------------------------------
|
||
X.STRESC.ToUC cmp #'a'
|
||
bcc .8
|
||
|
||
cmp #'z'+1
|
||
bcs .8
|
||
|
||
eor #$20
|
||
|
||
.8 rts
|
||
*--------------------------------------
|
||
X.STRESC.IsOct cmp #'0'
|
||
bcc .9
|
||
|
||
cmp #'7'+1
|
||
bcs .9
|
||
|
||
and #%00000111
|
||
|
||
clc
|
||
rts
|
||
|
||
.9 sec
|
||
rts
|
||
*--------------------------------------
|
||
X.STRESC.IsHex cmp #'0'
|
||
bcc .9
|
||
|
||
cmp #'9'+1
|
||
bcc .8
|
||
|
||
cmp #'A'
|
||
bcc .9
|
||
|
||
cmp #'Z'+1
|
||
bcc .7
|
||
|
||
cmp #'a'
|
||
bcc .9
|
||
|
||
cmp #'z'+1
|
||
bcc .9
|
||
|
||
* sec
|
||
|
||
sbc #$20
|
||
|
||
.7 sec
|
||
sbc #'A'-10
|
||
|
||
.8 and #$0F
|
||
|
||
clc
|
||
rts
|
||
|
||
.9 sec
|
||
rts
|
||
*--------------------------------------
|
||
MAN
|
||
SAVE usr/src/shared/x.stresc.s
|
||
ASM
|