2015-11-22 22:30:06 +00:00
|
|
|
|
PR#3
|
2017-03-29 15:48:15 +00:00
|
|
|
|
PREFIX /A2OSX.BUILD
|
2017-03-15 16:44:15 +00:00
|
|
|
|
LOMEM $A00
|
2015-11-22 22:30:06 +00:00
|
|
|
|
INC 1
|
|
|
|
|
AUTO 6
|
2016-10-25 06:58:15 +00:00
|
|
|
|
*/--------------------------------------
|
2017-03-30 16:11:31 +00:00
|
|
|
|
* # SScanF
|
2016-10-25 06:58:15 +00:00
|
|
|
|
* Scan a PStr (in progress)
|
2017-03-30 16:11:31 +00:00
|
|
|
|
* ## In:
|
2016-10-25 06:58:15 +00:00
|
|
|
|
* PUSHW PTR to target buffer
|
2016-10-29 19:58:21 +00:00
|
|
|
|
* PUSHW PSTR pattern (ex: "%d.%d.%d.%d")
|
2016-10-25 06:58:15 +00:00
|
|
|
|
* %d : byte
|
2016-10-29 19:58:21 +00:00
|
|
|
|
* PUSHW PSTR to scan (ex: "192.168.1.5")
|
2017-03-30 16:11:31 +00:00
|
|
|
|
* ## Out:
|
2016-10-25 06:58:15 +00:00
|
|
|
|
*\--------------------------------------
|
2016-10-21 15:03:41 +00:00
|
|
|
|
K.SScanF jsr PullPtr1Ptr2Ptr3
|
2016-10-17 15:47:50 +00:00
|
|
|
|
|
|
|
|
|
ldy #0 Y = PTR in pattern
|
|
|
|
|
|
2017-01-12 17:43:45 +00:00
|
|
|
|
lda (ZPPtr1)
|
2016-10-17 15:47:50 +00:00
|
|
|
|
beq .9
|
|
|
|
|
tax X = COUNT to scan
|
2017-01-12 17:43:45 +00:00
|
|
|
|
inc ZPPtr1
|
2016-10-17 15:47:50 +00:00
|
|
|
|
bne .1
|
2017-01-12 17:43:45 +00:00
|
|
|
|
inc ZPPtr1+1
|
2016-10-17 15:47:50 +00:00
|
|
|
|
|
|
|
|
|
.1 txa End Of String?
|
|
|
|
|
beq .8
|
|
|
|
|
tya
|
2017-01-12 17:43:45 +00:00
|
|
|
|
cmp (ZPPtr2) End of pattern?
|
2016-10-17 15:47:50 +00:00
|
|
|
|
beq .8
|
|
|
|
|
iny
|
2017-01-12 17:43:45 +00:00
|
|
|
|
lda (ZPPtr2),y
|
2016-10-17 15:47:50 +00:00
|
|
|
|
cmp #'%' Escape?
|
|
|
|
|
beq .2
|
2017-01-12 17:43:45 +00:00
|
|
|
|
cmp (ZPPtr1) Same char?
|
2016-10-17 15:47:50 +00:00
|
|
|
|
bne .9
|
|
|
|
|
jsr K.SScanF.IncPtr1
|
|
|
|
|
bne .1
|
|
|
|
|
clc
|
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
|
.2 tya
|
2017-01-12 17:43:45 +00:00
|
|
|
|
cmp (ZPPtr2) unexpected End of pattern after "%" ?
|
2016-10-17 15:47:50 +00:00
|
|
|
|
beq .9
|
|
|
|
|
|
|
|
|
|
iny
|
2017-01-12 17:43:45 +00:00
|
|
|
|
lda (ZPPtr2),y
|
2016-10-17 15:47:50 +00:00
|
|
|
|
cmp #'d' BYTE ?
|
|
|
|
|
bne .3
|
|
|
|
|
|
|
|
|
|
stz ASCBUF
|
2017-01-12 17:43:45 +00:00
|
|
|
|
.20 lda (ZPPtr1)
|
2016-10-17 15:47:50 +00:00
|
|
|
|
jsr K.SScanF.IsDigit
|
|
|
|
|
bcs .21
|
|
|
|
|
phx
|
|
|
|
|
inc ASCBUF
|
|
|
|
|
ldx ASCBUF
|
|
|
|
|
sta ASCBUF,x
|
|
|
|
|
plx
|
|
|
|
|
jsr K.SScanF.IncPtr1
|
|
|
|
|
bne .20 end of string ?
|
|
|
|
|
|
|
|
|
|
.21 jsr DEC2HEX
|
|
|
|
|
lda HEXBUF
|
2017-01-12 17:43:45 +00:00
|
|
|
|
sta (ZPPtr3)
|
|
|
|
|
inc ZPPtr3
|
2016-10-17 15:47:50 +00:00
|
|
|
|
bne .1
|
2017-01-12 17:43:45 +00:00
|
|
|
|
inc ZPPtr3+1
|
2016-10-17 15:47:50 +00:00
|
|
|
|
bra .1
|
|
|
|
|
|
|
|
|
|
.3 cmp #'D' WORD ?
|
|
|
|
|
bne .4
|
|
|
|
|
|
|
|
|
|
bra .1
|
|
|
|
|
|
|
|
|
|
.4 cmp #'s' STRING ?
|
|
|
|
|
bne .9
|
|
|
|
|
|
|
|
|
|
bra .1
|
|
|
|
|
|
|
|
|
|
.8 clc
|
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
|
.9 sec
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2016-12-09 16:36:24 +00:00
|
|
|
|
K.SScanF.IncPtr1
|
|
|
|
|
dex
|
2016-10-17 15:47:50 +00:00
|
|
|
|
beq .1
|
2017-01-12 17:43:45 +00:00
|
|
|
|
inc ZPPtr1
|
2016-10-17 15:47:50 +00:00
|
|
|
|
bne .1
|
2017-01-12 17:43:45 +00:00
|
|
|
|
inc ZPPtr1+1 never Zero
|
2016-10-17 15:47:50 +00:00
|
|
|
|
.1 rts
|
|
|
|
|
*--------------------------------------
|
2016-12-09 16:36:24 +00:00
|
|
|
|
K.SScanF.IsDigit
|
|
|
|
|
cmp #'0'
|
2016-10-17 15:47:50 +00:00
|
|
|
|
bcc .1
|
|
|
|
|
cmp #'9'+1
|
|
|
|
|
bcs .1
|
|
|
|
|
rts
|
|
|
|
|
.1 sec
|
|
|
|
|
rts
|
2016-10-24 15:54:43 +00:00
|
|
|
|
*/--------------------------------------
|
2017-03-30 16:11:31 +00:00
|
|
|
|
* # PPrintFYA/CPrintFYA
|
2016-11-04 18:15:59 +00:00
|
|
|
|
* Prints Pascal/C-Style String
|
2017-03-30 16:11:31 +00:00
|
|
|
|
* ## In:
|
2016-11-03 16:23:16 +00:00
|
|
|
|
* Y,A = PTR to PStr/CStr
|
2016-10-24 15:54:43 +00:00
|
|
|
|
* %a : pull 2 bytes to Print Access right String 'drwxrwxrwx'
|
|
|
|
|
* %b : pull 1 byte to Print BIN
|
|
|
|
|
* %B : pull 2 bytes to Print BIN
|
|
|
|
|
* %d : pull 1 byte unsigned DEC 0..255
|
|
|
|
|
* %D : pull 2 bytes unsigned DEC 0..65535
|
|
|
|
|
* %u : pull 2 bytes PTR to 4 bytes long unsigned DEC 0..4294967295
|
|
|
|
|
* %e : pull 2 bytes PTR to 6 Bytes Real +1.23456789e+12
|
|
|
|
|
* %f : pull 2 bytes PTR to 6 Bytes Real 3.1415
|
|
|
|
|
* %h : pull 1 byte to Print HEX
|
|
|
|
|
* %H : pull 2 bytes to Print HEX
|
|
|
|
|
* %i : pull 1 byte to Print signed DEC -128..127
|
|
|
|
|
* %I : pull 2 bytes to Print signed DEC -32768..32767
|
|
|
|
|
* %L : pull 2 bytes PTR to 4 bytes signed DEC -2147483648..2147483647
|
|
|
|
|
* %n : pull 1 byte to Print low Nibble HEX
|
|
|
|
|
* %N : pull 1 byte to Print high Nibble HEX
|
|
|
|
|
* %s : pull 2 bytes ptr to C-Style String
|
|
|
|
|
* %S : pull 2 bytes ptr to P-Style String
|
2016-11-04 18:15:59 +00:00
|
|
|
|
* \b : Print 'BS' (08)
|
2016-10-28 09:37:57 +00:00
|
|
|
|
* \e : Print 'ESC' ($1B,27)
|
2016-11-04 18:15:59 +00:00
|
|
|
|
* \f : Print 'FF' ($0C,12)
|
2017-02-28 16:58:36 +00:00
|
|
|
|
* \n : Print 'LF' ($0A,10)
|
|
|
|
|
* \r : Print 'CR' ($0D,13)
|
2016-11-04 18:15:59 +00:00
|
|
|
|
* \\\\ : Print \
|
2016-10-28 09:37:57 +00:00
|
|
|
|
* \% : Print %
|
2016-10-24 15:54:43 +00:00
|
|
|
|
* Modifiers for len and padding :
|
2016-10-28 09:37:57 +00:00
|
|
|
|
* %d : '9' '12'
|
|
|
|
|
* %2d : ' 9' '12'
|
|
|
|
|
* %02d : '09' '12'
|
|
|
|
|
* %11s : 'ABCDEFGH '
|
|
|
|
|
* %011s : 'ABCDEFGH000'
|
|
|
|
|
* %2f : '3.14'
|
2017-03-30 16:11:31 +00:00
|
|
|
|
* ## Out:
|
2016-10-28 09:37:57 +00:00
|
|
|
|
* CC : success
|
|
|
|
|
* CS : I/O error from COut
|
2016-10-24 15:54:43 +00:00
|
|
|
|
*\--------------------------------------
|
2016-11-03 16:23:16 +00:00
|
|
|
|
K.PPrintFYA ldx #$01 PSTR
|
|
|
|
|
.HS 2C bit abs
|
|
|
|
|
K.CPrintFYA ldx #$00 CSTR
|
2017-01-12 17:43:45 +00:00
|
|
|
|
>STYA ZPPtr1
|
2016-11-03 16:23:16 +00:00
|
|
|
|
stx CIO.GetCharAtPtr1Y+1
|
2016-10-11 15:30:19 +00:00
|
|
|
|
|
2016-11-03 16:23:16 +00:00
|
|
|
|
ldy #0
|
2016-10-11 15:30:19 +00:00
|
|
|
|
|
2016-11-03 16:23:16 +00:00
|
|
|
|
.1 jsr CIO.GetCharAtPtr1Y
|
2016-10-11 15:30:19 +00:00
|
|
|
|
beq .99
|
|
|
|
|
cmp #'%'
|
|
|
|
|
bne .10
|
|
|
|
|
|
|
|
|
|
stz PADLEN
|
|
|
|
|
lda #' '
|
|
|
|
|
sta PADCHAR
|
|
|
|
|
|
|
|
|
|
.2 ldx #PrintFTBL1.END-PrintFTBL1-1
|
2016-11-03 16:23:16 +00:00
|
|
|
|
jsr CIO.GetCharAtPtr1Y
|
2016-10-11 15:30:19 +00:00
|
|
|
|
beq .99
|
|
|
|
|
|
|
|
|
|
.3 cmp PrintFTBL1,x do we have a %x command?
|
|
|
|
|
beq .8 yes, jmp to it!
|
|
|
|
|
dex
|
|
|
|
|
bpl .3 no valid letter...
|
|
|
|
|
|
|
|
|
|
cmp #'0' ...a 0...mmm... padding char?
|
|
|
|
|
bne .4
|
|
|
|
|
|
|
|
|
|
ldx PADLEN PADLEN is not nul, so this 0 is second digit
|
|
|
|
|
bne .5
|
|
|
|
|
|
|
|
|
|
lda #'0'
|
|
|
|
|
sta PADCHAR no, this is the first 0, so make it PADCHAR
|
|
|
|
|
bra .2
|
|
|
|
|
|
|
|
|
|
.4 bcc .99 less than '0'....error
|
|
|
|
|
cmp #'9'+1
|
|
|
|
|
bcs .99 more than '9' ....error
|
|
|
|
|
|
|
|
|
|
.5 and #$0F we have a digit
|
|
|
|
|
pha save it...
|
|
|
|
|
lda PADLEN starts PADLEN * 10
|
|
|
|
|
asl
|
|
|
|
|
asl A=times 4
|
|
|
|
|
adc PADLEN CC by ASL, A=times 5
|
|
|
|
|
asl times 10
|
|
|
|
|
sta PADLEN
|
|
|
|
|
|
|
|
|
|
pla get back digit
|
|
|
|
|
adc PADLEN
|
|
|
|
|
sta PADLEN
|
|
|
|
|
bra .2 go get next char...
|
|
|
|
|
|
|
|
|
|
.8 phy
|
|
|
|
|
txa
|
|
|
|
|
asl
|
|
|
|
|
tax
|
|
|
|
|
jsr PrintFESC
|
|
|
|
|
ply
|
2016-11-03 16:23:16 +00:00
|
|
|
|
bcc .1
|
2016-10-11 15:30:19 +00:00
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
|
.10 cmp #'\'
|
|
|
|
|
bne .20
|
|
|
|
|
|
|
|
|
|
ldx #PrintFTBL2.END-PrintFTBL2-1
|
2016-11-03 16:23:16 +00:00
|
|
|
|
jsr CIO.GetCharAtPtr1Y
|
2016-10-11 15:30:19 +00:00
|
|
|
|
beq .99
|
|
|
|
|
.12 cmp PrintFTBL2,x
|
|
|
|
|
beq .13
|
|
|
|
|
dex
|
|
|
|
|
bpl .12
|
2016-11-03 16:23:16 +00:00
|
|
|
|
bra .1
|
2016-10-11 15:30:19 +00:00
|
|
|
|
|
|
|
|
|
.13 lda PrintFTBL2.OUT,x
|
|
|
|
|
|
2017-01-12 17:43:45 +00:00
|
|
|
|
.20 jsr K.PutCA
|
2016-11-03 16:23:16 +00:00
|
|
|
|
bcc .1
|
2016-10-11 15:30:19 +00:00
|
|
|
|
.99 rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
PrintFESC jmp (PrintFJMP,x)
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
PrintFTBL1 .AS "abBdDuefhHiILnNsS"
|
|
|
|
|
PrintFTBL1.END
|
2017-02-28 16:58:36 +00:00
|
|
|
|
PrintFTBL2 .AS "befnr\%"
|
2016-10-11 15:30:19 +00:00
|
|
|
|
PrintFTBL2.END
|
2017-02-28 16:58:36 +00:00
|
|
|
|
PrintFTBL2.OUT .HS 08.1B.0C.0A.0D \b\e\f\n\r
|
2016-10-11 15:30:19 +00:00
|
|
|
|
.DA #'\' \\
|
|
|
|
|
.DA #'%' \%
|
2016-10-12 15:46:38 +00:00
|
|
|
|
PrintFJMP .DA PrintF.A
|
|
|
|
|
.DA PrintF.B,PrintF.BB
|
|
|
|
|
.DA PrintF.D,PrintF.DD,PrintF.U
|
|
|
|
|
.DA PrintF.E,PrintF.F
|
|
|
|
|
.DA PrintF.H,PrintF.HH
|
|
|
|
|
.DA PrintF.I,PrintF.II,PrintF.L
|
|
|
|
|
.DA PrintF.N,PrintF.NN
|
|
|
|
|
.DA PrintF.S,PrintF.SS
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
PrintF.A >PULLW HEXBUF
|
2016-10-18 15:56:06 +00:00
|
|
|
|
|
|
|
|
|
lda HEXBUF+1
|
|
|
|
|
lsr
|
|
|
|
|
lsr
|
|
|
|
|
lsr
|
|
|
|
|
lsr
|
|
|
|
|
tax
|
|
|
|
|
lda TYPES,x
|
2017-01-12 17:43:45 +00:00
|
|
|
|
jsr K.PutCA
|
2016-10-28 09:37:57 +00:00
|
|
|
|
bcs .9
|
2016-10-18 15:56:06 +00:00
|
|
|
|
|
|
|
|
|
ldx #0
|
|
|
|
|
|
|
|
|
|
.1 lda #'-'
|
|
|
|
|
lsr HEXBUF
|
|
|
|
|
bcc .2
|
|
|
|
|
lda ACCESS,x
|
|
|
|
|
|
2017-01-12 17:43:45 +00:00
|
|
|
|
.2 jsr K.PutCA
|
2016-10-28 09:37:57 +00:00
|
|
|
|
bcs .9
|
2016-10-18 15:56:06 +00:00
|
|
|
|
|
|
|
|
|
inx
|
|
|
|
|
cpx #8
|
|
|
|
|
bne .1
|
|
|
|
|
|
|
|
|
|
.3 lda #'-'
|
|
|
|
|
lsr HEXBUF+1
|
|
|
|
|
bcc .4
|
|
|
|
|
lda ACCESS,x
|
|
|
|
|
|
2017-01-12 17:43:45 +00:00
|
|
|
|
.4 jmp K.PutCA
|
2016-10-28 09:37:57 +00:00
|
|
|
|
|
|
|
|
|
.9 rts
|
2016-10-12 15:46:38 +00:00
|
|
|
|
*--------------------------------------
|
2016-10-21 15:03:41 +00:00
|
|
|
|
PrintF.BB >PULLA
|
|
|
|
|
pha
|
2016-10-12 15:46:38 +00:00
|
|
|
|
jsr PrintF.B
|
|
|
|
|
pla
|
2016-10-28 09:37:57 +00:00
|
|
|
|
bcc PrintF.B.1
|
|
|
|
|
PrintF.BB.RTS rts
|
2016-10-11 15:30:19 +00:00
|
|
|
|
*--------------------------------------
|
2016-10-12 15:46:38 +00:00
|
|
|
|
PrintF.B >PULLA
|
|
|
|
|
|
|
|
|
|
PrintF.B.1 ldx #8
|
|
|
|
|
|
|
|
|
|
.1 asl
|
|
|
|
|
pha
|
|
|
|
|
lda #'0'
|
|
|
|
|
adc #0 add Carry
|
2017-01-12 17:43:45 +00:00
|
|
|
|
jsr K.PutCA
|
2016-10-12 15:46:38 +00:00
|
|
|
|
pla
|
2016-10-28 09:37:57 +00:00
|
|
|
|
bcs PrintF.BB.RTS
|
2016-10-12 15:46:38 +00:00
|
|
|
|
dex
|
|
|
|
|
bne .1
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
PrintF.D >PULLB HEXBUF
|
|
|
|
|
stz HEXBUF+1
|
2016-10-11 15:30:19 +00:00
|
|
|
|
bra PrintF.DD.1
|
|
|
|
|
|
2016-10-12 15:46:38 +00:00
|
|
|
|
PrintF.DD >PULLW HEXBUF
|
|
|
|
|
PrintF.DD.1 stz HEXBUF+2
|
|
|
|
|
stz HEXBUF+3
|
2016-10-11 15:30:19 +00:00
|
|
|
|
bra PrintF.U.1
|
|
|
|
|
|
2017-01-12 17:43:45 +00:00
|
|
|
|
PrintF.U >PULLW ZPPtr2
|
2016-10-11 15:30:19 +00:00
|
|
|
|
ldy #3
|
|
|
|
|
|
2017-01-12 17:43:45 +00:00
|
|
|
|
.1 lda (ZPPtr2),y
|
2016-10-12 15:46:38 +00:00
|
|
|
|
sta HEXBUF,y
|
2016-10-11 15:30:19 +00:00
|
|
|
|
dey
|
|
|
|
|
bpl .1
|
|
|
|
|
|
2016-10-12 15:46:38 +00:00
|
|
|
|
PrintF.U.1 stz SIGN
|
|
|
|
|
jsr HEX2DEC
|
|
|
|
|
jmp PrintDEC
|
|
|
|
|
*--------------------------------------
|
2017-01-12 17:43:45 +00:00
|
|
|
|
PrintF.E >PULLW ZPPtr2
|
2016-10-12 15:46:38 +00:00
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2017-01-12 17:43:45 +00:00
|
|
|
|
PrintF.F >PULLW ZPPtr2
|
2016-10-12 15:46:38 +00:00
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2016-10-21 15:03:41 +00:00
|
|
|
|
PrintF.HH >PULLA
|
|
|
|
|
pha
|
|
|
|
|
jsr PrintF.H
|
2016-10-12 15:46:38 +00:00
|
|
|
|
pla
|
|
|
|
|
bra PrintF.H.1
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
PrintF.H >PULLA
|
|
|
|
|
PrintF.H.1 pha
|
|
|
|
|
jsr PrintF.NN.1
|
|
|
|
|
pla
|
|
|
|
|
jmp PrintF.N.1
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
PrintF.I >PULLB HEXBUF
|
|
|
|
|
eor #$ff if positive, it becomes neg so branch if....minus!
|
|
|
|
|
clc
|
|
|
|
|
bmi .1
|
|
|
|
|
sec
|
|
|
|
|
inc 2s complement...
|
|
|
|
|
sta HEXBUF
|
2016-10-11 15:30:19 +00:00
|
|
|
|
|
2016-10-12 15:46:38 +00:00
|
|
|
|
|
|
|
|
|
.1 stz HEXBUF+1
|
|
|
|
|
bra PrintF.II.1
|
|
|
|
|
|
|
|
|
|
PrintF.II >PULLW HEXBUF A=HI
|
|
|
|
|
eor #$ff
|
|
|
|
|
clc
|
|
|
|
|
bmi PrintF.II.1
|
|
|
|
|
sec
|
|
|
|
|
tax
|
|
|
|
|
lda HEXBUF
|
|
|
|
|
eor #$ff
|
|
|
|
|
inc 2s complement...
|
|
|
|
|
sta HEXBUF
|
|
|
|
|
bne .1
|
|
|
|
|
inx
|
|
|
|
|
.1 sta HEXBUF
|
|
|
|
|
stx HEXBUF+1
|
2016-10-11 15:30:19 +00:00
|
|
|
|
|
2016-10-12 15:46:38 +00:00
|
|
|
|
PrintF.II.1 stz HEXBUF+2
|
|
|
|
|
stz HEXBUF+3
|
|
|
|
|
bra PrintF.L.1
|
|
|
|
|
|
2017-01-12 17:43:45 +00:00
|
|
|
|
PrintF.L >PULLW ZPPtr2
|
2016-10-12 15:46:38 +00:00
|
|
|
|
ldy #3
|
|
|
|
|
|
2017-01-12 17:43:45 +00:00
|
|
|
|
.1 lda (ZPPtr2),y
|
2016-10-12 15:46:38 +00:00
|
|
|
|
sta HEXBUF,y
|
|
|
|
|
dey
|
|
|
|
|
bpl .1
|
2016-10-11 15:30:19 +00:00
|
|
|
|
|
2016-10-12 15:46:38 +00:00
|
|
|
|
|
|
|
|
|
PrintF.L.1 ror SIGN
|
|
|
|
|
jsr HEX2DEC
|
2017-01-12 17:43:45 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
PRINTDEC lda PADLEN any Len format ?
|
|
|
|
|
beq .1 no
|
|
|
|
|
|
|
|
|
|
lda #10
|
|
|
|
|
sec yes, Print only digits starting at pos 10-padlen
|
|
|
|
|
sbc PADLEN
|
|
|
|
|
|
|
|
|
|
.1 tax x=0 if no padlen, or x=10-padlen
|
|
|
|
|
|
|
|
|
|
.2 lda ASCBUF,x
|
|
|
|
|
cmp #'0' a zero?
|
|
|
|
|
beq .3
|
|
|
|
|
|
|
|
|
|
inc PADLEN found a non zero, Print all digits, even if 0, next time
|
|
|
|
|
ldy #'0'
|
|
|
|
|
sty PADCHAR
|
|
|
|
|
bra .4
|
|
|
|
|
|
|
|
|
|
.3 cpx #9 last digit ?
|
|
|
|
|
beq .4 Print always
|
|
|
|
|
|
|
|
|
|
ldy PADLEN no pad to fill, do not Print 0
|
|
|
|
|
beq .6
|
|
|
|
|
|
|
|
|
|
lda PADCHAR fill with PADCHAR
|
|
|
|
|
|
|
|
|
|
.4 bit SIGN a sign to print before digits ?
|
|
|
|
|
bpl .5
|
|
|
|
|
pha yes, save whatever we have to print....
|
|
|
|
|
lda #'-'
|
|
|
|
|
jsr K.PutCA
|
|
|
|
|
stz SIGN reset flag for next char...
|
|
|
|
|
pla
|
|
|
|
|
|
|
|
|
|
.5 jsr K.PutCA
|
|
|
|
|
bcs .9
|
|
|
|
|
|
|
|
|
|
.6 inx
|
|
|
|
|
cpx #10
|
|
|
|
|
bne .2
|
|
|
|
|
|
|
|
|
|
clc
|
|
|
|
|
.9 rts
|
2016-10-12 15:46:38 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
PrintF.N >PULLA
|
|
|
|
|
PrintF.N.1 and #$0F
|
|
|
|
|
bra PrintF.NN.2
|
2016-10-11 15:30:19 +00:00
|
|
|
|
|
2016-10-12 15:46:38 +00:00
|
|
|
|
PrintF.NN >PULLA
|
|
|
|
|
PrintF.NN.1 lsr
|
|
|
|
|
lsr
|
|
|
|
|
lsr
|
|
|
|
|
lsr
|
|
|
|
|
|
|
|
|
|
PrintF.NN.2 ora #$30
|
|
|
|
|
cmp #$3A
|
|
|
|
|
bcc .1
|
|
|
|
|
adc #6
|
2017-01-12 17:43:45 +00:00
|
|
|
|
.1 jmp K.PutCA
|
2015-11-22 22:30:06 +00:00
|
|
|
|
*--------------------------------------
|
2017-01-12 17:43:45 +00:00
|
|
|
|
PrintF.S ldy #$ff CSTR
|
|
|
|
|
.HS 2C bit abs
|
|
|
|
|
PrintF.SS ldy #$00 PSTR
|
2016-10-12 15:46:38 +00:00
|
|
|
|
|
2017-01-12 17:43:45 +00:00
|
|
|
|
>PULLW ZPPtr2
|
|
|
|
|
|
|
|
|
|
lda (ZPPtr2) if CSTR:last char=0, if PSTR:len=0
|
2016-10-12 15:46:38 +00:00
|
|
|
|
beq .8
|
2015-11-22 22:30:06 +00:00
|
|
|
|
|
2017-01-12 17:43:45 +00:00
|
|
|
|
sty .1+1
|
|
|
|
|
|
|
|
|
|
.1 lda #$ff Self Modified
|
|
|
|
|
bne .11 CSTR
|
2015-11-22 22:30:06 +00:00
|
|
|
|
|
2017-01-12 17:43:45 +00:00
|
|
|
|
tya PSTR
|
|
|
|
|
cmp (ZPPtr2) len check
|
|
|
|
|
beq .2
|
2016-10-12 15:46:38 +00:00
|
|
|
|
|
2017-01-12 17:43:45 +00:00
|
|
|
|
.11 iny
|
2016-10-12 15:46:38 +00:00
|
|
|
|
|
2017-01-12 17:43:45 +00:00
|
|
|
|
lda (ZPPtr2),y
|
|
|
|
|
beq .2
|
|
|
|
|
|
|
|
|
|
jsr K.PutCA
|
2016-10-28 09:37:57 +00:00
|
|
|
|
bcs .9
|
2017-01-12 17:43:45 +00:00
|
|
|
|
|
2016-10-12 15:46:38 +00:00
|
|
|
|
lda PADLEN
|
2017-01-12 17:43:45 +00:00
|
|
|
|
beq .1
|
2015-11-22 22:30:06 +00:00
|
|
|
|
|
2016-10-12 15:46:38 +00:00
|
|
|
|
cpy PADLEN
|
|
|
|
|
bne .1
|
2017-01-25 21:46:40 +00:00
|
|
|
|
clc
|
2017-01-12 17:43:45 +00:00
|
|
|
|
rts
|
2016-10-12 15:46:38 +00:00
|
|
|
|
|
2017-01-12 17:43:45 +00:00
|
|
|
|
.2 lda PADLEN
|
2016-10-12 15:46:38 +00:00
|
|
|
|
beq .8
|
|
|
|
|
|
|
|
|
|
.3 lda PADCHAR
|
2017-01-12 17:43:45 +00:00
|
|
|
|
jsr K.PutCA
|
2016-10-28 09:37:57 +00:00
|
|
|
|
bcs .9
|
2016-10-12 15:46:38 +00:00
|
|
|
|
iny
|
|
|
|
|
cpy PADLEN
|
|
|
|
|
bne .3
|
2015-11-22 22:30:06 +00:00
|
|
|
|
|
2016-10-28 09:37:57 +00:00
|
|
|
|
.8 clc
|
|
|
|
|
.9 rts
|
2015-11-22 22:30:06 +00:00
|
|
|
|
*--------------------------------------
|
2016-11-03 16:23:16 +00:00
|
|
|
|
CIO.GetCharAtPtr1Y
|
|
|
|
|
lda #$ff Self Modified PSTR/CSTR
|
|
|
|
|
bne .1
|
|
|
|
|
|
2017-01-12 17:43:45 +00:00
|
|
|
|
lda (ZPPtr1),y CSTR
|
2016-11-03 16:23:16 +00:00
|
|
|
|
beq .9
|
|
|
|
|
iny advance to next char...
|
2016-11-04 18:15:59 +00:00
|
|
|
|
bne .9
|
2017-01-12 17:43:45 +00:00
|
|
|
|
inc ZPPtr1+1 Allow >256 CStrings
|
2016-11-03 16:23:16 +00:00
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.1 tya PSTR
|
2017-01-12 17:43:45 +00:00
|
|
|
|
cmp (ZPPtr1)
|
2016-11-03 16:23:16 +00:00
|
|
|
|
beq .9
|
|
|
|
|
iny
|
2017-01-12 17:43:45 +00:00
|
|
|
|
lda (ZPPtr1),y NZ
|
2016-11-03 16:23:16 +00:00
|
|
|
|
|
|
|
|
|
.9 clc no error, but end of string
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2016-12-09 16:36:24 +00:00
|
|
|
|
TYPES .AS "-dbclssp"
|
2016-10-18 15:56:06 +00:00
|
|
|
|
ACCESS .AS "rwxrwxrwx"
|
2016-10-12 15:46:38 +00:00
|
|
|
|
SIGN .BS 1
|
|
|
|
|
PADLEN .BS 1
|
|
|
|
|
PADCHAR .BS 1
|
|
|
|
|
*--------------------------------------
|
2015-11-22 22:30:06 +00:00
|
|
|
|
MAN
|
2017-03-29 15:48:15 +00:00
|
|
|
|
SAVE /A2OSX.SRC/SYS/KERNEL.S.CIO
|
|
|
|
|
LOAD /A2OSX.SRC/SYS/KERNEL.S
|
2015-11-22 22:30:06 +00:00
|
|
|
|
ASM
|