2015-03-14 21:48:35 +00:00
|
|
|
|
PR#3
|
2015-06-03 18:30:57 +00:00
|
|
|
|
PREFIX /A2OSX.SRC
|
2017-03-15 16:44:15 +00:00
|
|
|
|
LOMEM $A00
|
2015-03-14 21:48:35 +00:00
|
|
|
|
INC 1
|
|
|
|
|
AUTO 6
|
2016-10-24 15:54:43 +00:00
|
|
|
|
*/--------------------------------------
|
|
|
|
|
* #NewPStrYA
|
|
|
|
|
* Create a new copy of PSTR
|
2016-10-22 09:06:51 +00:00
|
|
|
|
* ##In:
|
2016-10-24 15:54:43 +00:00
|
|
|
|
* Y,A = PTR to buffer
|
2016-10-22 09:06:51 +00:00
|
|
|
|
* ##Out:
|
|
|
|
|
* CC : success
|
2016-10-24 15:54:43 +00:00
|
|
|
|
* Y,A = PTR to String
|
2016-10-29 19:58:21 +00:00
|
|
|
|
* X = hMem (PSTR)
|
2016-10-22 09:06:51 +00:00
|
|
|
|
* CS : error
|
2016-10-24 15:54:43 +00:00
|
|
|
|
* A = SYS error code
|
|
|
|
|
*\--------------------------------------
|
2017-01-12 17:43:45 +00:00
|
|
|
|
K.NewPStrYA >STYA ZPPtr2
|
|
|
|
|
lda (ZPPtr2)
|
2015-03-14 21:48:35 +00:00
|
|
|
|
inc
|
|
|
|
|
tay
|
|
|
|
|
lda #0 Y,A = len of new string
|
|
|
|
|
>PUSHYA
|
2016-08-17 06:25:58 +00:00
|
|
|
|
>PUSHBI 0 0 = no option
|
2016-09-21 15:20:37 +00:00
|
|
|
|
jsr K.GetMem
|
2015-03-14 21:48:35 +00:00
|
|
|
|
bcs .9
|
2016-08-17 06:25:58 +00:00
|
|
|
|
|
2017-01-12 17:43:45 +00:00
|
|
|
|
>STYA ZPPtr1
|
2016-08-17 06:25:58 +00:00
|
|
|
|
|
2016-10-21 15:03:41 +00:00
|
|
|
|
jsr K.PStrCpyPtr2Ptr1
|
2016-08-17 06:25:58 +00:00
|
|
|
|
|
2017-01-12 17:43:45 +00:00
|
|
|
|
>LDYA ZPPtr1
|
2016-08-17 06:25:58 +00:00
|
|
|
|
|
|
|
|
|
clc
|
2016-10-03 15:59:36 +00:00
|
|
|
|
.9 rts
|
2016-10-29 19:58:21 +00:00
|
|
|
|
*/--------------------------------------
|
2016-10-24 15:54:43 +00:00
|
|
|
|
* #PStrCpy
|
|
|
|
|
* Copy string
|
2016-10-22 09:06:51 +00:00
|
|
|
|
* ##In:
|
2016-10-29 19:58:21 +00:00
|
|
|
|
* PUSHW = Ptr to SRC (PSTR)
|
|
|
|
|
* PUSHW = Ptr to DST (PSTR)
|
2016-10-22 09:06:51 +00:00
|
|
|
|
* ##Out:
|
2016-10-29 19:58:21 +00:00
|
|
|
|
* DST = SRC (PSTR)
|
|
|
|
|
*\--------------------------------------
|
2016-10-21 15:03:41 +00:00
|
|
|
|
K.PStrCpy jsr PullPtr1Ptr2
|
|
|
|
|
|
|
|
|
|
K.PStrCpyPtr2Ptr1
|
2017-01-12 17:43:45 +00:00
|
|
|
|
lda (ZPPtr2)
|
|
|
|
|
sta (ZPPtr1)
|
2015-03-14 21:48:35 +00:00
|
|
|
|
tay
|
|
|
|
|
beq .2
|
2016-08-17 06:25:58 +00:00
|
|
|
|
|
2017-01-12 17:43:45 +00:00
|
|
|
|
.1 lda (ZPPtr2),y
|
|
|
|
|
sta (ZPPtr1),y
|
2015-03-14 21:48:35 +00:00
|
|
|
|
dey
|
|
|
|
|
bne .1
|
2016-08-17 06:25:58 +00:00
|
|
|
|
|
|
|
|
|
.2 clc
|
2015-03-14 21:48:35 +00:00
|
|
|
|
rts
|
2016-10-29 19:58:21 +00:00
|
|
|
|
*/--------------------------------------
|
2016-10-24 15:54:43 +00:00
|
|
|
|
* #PStrCat
|
|
|
|
|
* Append SRC to DST
|
2016-10-22 09:06:51 +00:00
|
|
|
|
* ##In:
|
2016-10-29 19:58:21 +00:00
|
|
|
|
* PUSHW = Ptr to SRC (PSTR)
|
|
|
|
|
* PUSHW = Ptr to DST (PSTR)
|
2016-10-22 09:06:51 +00:00
|
|
|
|
* ##Out:
|
2016-10-29 19:58:21 +00:00
|
|
|
|
* DST = DST+SRC (PSTR)
|
|
|
|
|
*\--------------------------------------
|
2016-10-21 15:03:41 +00:00
|
|
|
|
K.PStrCat jsr PullPtr1Ptr2
|
2016-08-17 06:25:58 +00:00
|
|
|
|
|
2017-01-12 17:43:45 +00:00
|
|
|
|
lda (ZPPtr2)
|
2015-03-14 21:48:35 +00:00
|
|
|
|
tax
|
2016-08-17 06:25:58 +00:00
|
|
|
|
|
2017-01-12 17:43:45 +00:00
|
|
|
|
lda (ZPPtr1)
|
2016-08-17 06:25:58 +00:00
|
|
|
|
tay
|
|
|
|
|
|
|
|
|
|
.1 cpy #255
|
|
|
|
|
beq .8
|
|
|
|
|
|
|
|
|
|
iny
|
|
|
|
|
|
2017-01-12 17:43:45 +00:00
|
|
|
|
inc ZPPtr2
|
2016-08-17 06:25:58 +00:00
|
|
|
|
bne .2
|
2017-02-26 09:52:35 +00:00
|
|
|
|
inc ZPPtr2+1
|
2016-08-17 06:25:58 +00:00
|
|
|
|
|
2017-01-12 17:43:45 +00:00
|
|
|
|
.2 lda (ZPPtr2)
|
|
|
|
|
sta (ZPPtr1),y
|
2015-03-14 21:48:35 +00:00
|
|
|
|
dex
|
2016-08-17 06:25:58 +00:00
|
|
|
|
bne .1
|
|
|
|
|
|
|
|
|
|
.8 tya
|
2017-01-12 17:43:45 +00:00
|
|
|
|
sta (ZPPtr1)
|
2015-03-14 21:48:35 +00:00
|
|
|
|
clc
|
|
|
|
|
rts
|
2016-10-22 09:06:51 +00:00
|
|
|
|
*/--------------------------------------
|
2016-10-24 15:54:43 +00:00
|
|
|
|
* #PStrMatch
|
|
|
|
|
* Compare a String against pattern
|
2016-10-22 09:06:51 +00:00
|
|
|
|
* ##In:
|
|
|
|
|
* PUSHW = PTR to Pattern (e.g. '*test?.txt')
|
|
|
|
|
* PUSHW = PTR to Src String
|
|
|
|
|
* ##Out:
|
|
|
|
|
* CC : match
|
2016-10-24 15:54:43 +00:00
|
|
|
|
* CS : no match
|
2016-10-22 09:06:51 +00:00
|
|
|
|
*\--------------------------------------
|
2016-10-21 15:03:41 +00:00
|
|
|
|
K.PStrMatch jsr PullPtr1Ptr2
|
|
|
|
|
|
2017-01-12 17:43:45 +00:00
|
|
|
|
lda (ZPPtr2) Keep Pattern Length in X
|
2015-03-14 21:48:35 +00:00
|
|
|
|
tax
|
|
|
|
|
beq .8 Match always if empty
|
|
|
|
|
ldy #0
|
|
|
|
|
|
2017-01-12 17:43:45 +00:00
|
|
|
|
.1 inc ZPPtr2 Make PTR1 advance to next char
|
2015-03-14 21:48:35 +00:00
|
|
|
|
bne .2
|
2017-01-12 17:43:45 +00:00
|
|
|
|
inc ZPPtr2+1
|
2015-03-14 21:48:35 +00:00
|
|
|
|
|
2017-01-12 17:43:45 +00:00
|
|
|
|
.2 lda (ZPPtr2) get pattern char
|
2015-03-14 21:48:35 +00:00
|
|
|
|
cmp #'*'
|
|
|
|
|
beq .5
|
|
|
|
|
|
|
|
|
|
.3 tya we must match ? or regular char
|
2017-01-12 17:43:45 +00:00
|
|
|
|
cmp (ZPPtr1) check if at end of string
|
2015-03-14 21:48:35 +00:00
|
|
|
|
beq .9 yes, no char left, exit with error
|
|
|
|
|
|
|
|
|
|
iny advance to next char to compare
|
|
|
|
|
|
2017-01-12 17:43:45 +00:00
|
|
|
|
lda (ZPPtr2) get back pattern char
|
2015-03-14 21:48:35 +00:00
|
|
|
|
cmp #'?'
|
|
|
|
|
beq .4 no need to compare, any char will match
|
2017-01-12 17:43:45 +00:00
|
|
|
|
cmp (ZPPtr1),y Regular Char, compare with string at Y
|
2015-03-14 21:48:35 +00:00
|
|
|
|
bne .9 no match, exit
|
|
|
|
|
|
|
|
|
|
.4 dex char matched, check if end of pattern
|
|
|
|
|
bne .1 continue if remaining char in pattern
|
|
|
|
|
|
|
|
|
|
tya end of pattern, but end of string ?
|
2017-01-12 17:43:45 +00:00
|
|
|
|
cmp (ZPPtr1) end of string ?
|
2015-03-14 21:48:35 +00:00
|
|
|
|
beq .8 yes, string matched entirely
|
|
|
|
|
bra .9 no, remaining char in string, no match
|
|
|
|
|
|
|
|
|
|
.5 dex we have '*', last char of pattern ?
|
|
|
|
|
beq .8 yes, match everything, including empty string
|
|
|
|
|
|
2017-01-12 17:43:45 +00:00
|
|
|
|
inc ZPPtr2 Make PTR1 advance to next char
|
2015-03-14 21:48:35 +00:00
|
|
|
|
bne .6
|
2017-01-12 17:43:45 +00:00
|
|
|
|
inc ZPPtr2+1
|
2015-03-14 21:48:35 +00:00
|
|
|
|
|
2017-01-12 17:43:45 +00:00
|
|
|
|
.6 lda (ZPPtr2) get next char of pattern
|
2015-03-14 21:48:35 +00:00
|
|
|
|
cmp #'*' another '*' ?
|
|
|
|
|
beq .5 yes, '**' = '*', go next char
|
|
|
|
|
cmp #'?' '*?' ??? we must match a least one char
|
|
|
|
|
beq .3
|
|
|
|
|
|
|
|
|
|
.7 tya we need at least one remaining char in string,
|
2017-01-12 17:43:45 +00:00
|
|
|
|
cmp (ZPPtr1) check if at end of string
|
2015-03-14 21:48:35 +00:00
|
|
|
|
beq .9 no chance to match ? or regular char
|
|
|
|
|
|
|
|
|
|
iny
|
2017-01-12 17:43:45 +00:00
|
|
|
|
lda (ZPPtr2) get again char in pattern
|
|
|
|
|
cmp (ZPPtr1),y compare with char in string
|
2015-03-14 21:48:35 +00:00
|
|
|
|
bne .7 not equal to next non wildcard in pattern
|
|
|
|
|
|
|
|
|
|
bra .4 go check remaining char in pattern...
|
|
|
|
|
|
|
|
|
|
.8 clc
|
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
|
.9 sec
|
|
|
|
|
rts
|
2016-10-22 09:06:51 +00:00
|
|
|
|
*/--------------------------------------
|
2016-10-24 15:54:43 +00:00
|
|
|
|
* #PStrUprYA/PStrLwrYA
|
|
|
|
|
* Convert string to UPPERCASE/lowercase
|
2016-10-22 09:06:51 +00:00
|
|
|
|
* ##In:
|
2016-10-29 19:58:21 +00:00
|
|
|
|
* Y,A = PTR to String (PSTR)
|
2016-10-22 09:06:51 +00:00
|
|
|
|
* ##Out:
|
2016-09-20 06:17:20 +00:00
|
|
|
|
* Uppercased/lowercased String in Buffer
|
2016-10-22 09:06:51 +00:00
|
|
|
|
*\--------------------------------------
|
2016-09-21 15:20:37 +00:00
|
|
|
|
K.PStrUprYA ldx #0
|
2016-09-20 06:17:20 +00:00
|
|
|
|
.HS 2C bit abs
|
2016-09-21 15:20:37 +00:00
|
|
|
|
K.PStrLwrYA ldx #2
|
2017-01-12 17:43:45 +00:00
|
|
|
|
>STYA ZPPtr1
|
2016-09-28 15:34:15 +00:00
|
|
|
|
|
|
|
|
|
pha save Y,A to restore them at exit
|
|
|
|
|
phy
|
|
|
|
|
|
2017-01-12 17:43:45 +00:00
|
|
|
|
lda (ZPPtr1)
|
2016-09-20 06:17:20 +00:00
|
|
|
|
tay
|
|
|
|
|
|
2017-01-12 17:43:45 +00:00
|
|
|
|
.1 lda (ZPPtr1),y
|
2016-09-21 15:20:37 +00:00
|
|
|
|
cmp K.PStrUprLwr,x
|
2016-09-20 06:17:20 +00:00
|
|
|
|
bcc .2
|
2016-09-21 15:20:37 +00:00
|
|
|
|
cmp K.PStrUprLwr+1,x
|
2016-09-20 06:17:20 +00:00
|
|
|
|
bcs .2
|
|
|
|
|
eor #$20
|
2017-01-12 17:43:45 +00:00
|
|
|
|
sta (ZPPtr1),y
|
2016-09-20 06:17:20 +00:00
|
|
|
|
.2 dey
|
|
|
|
|
bne .1
|
|
|
|
|
|
2016-09-28 15:34:15 +00:00
|
|
|
|
ply
|
|
|
|
|
pla
|
2016-09-20 06:17:20 +00:00
|
|
|
|
clc
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2016-09-21 15:20:37 +00:00
|
|
|
|
K.PStrUprLwr .AS "azAZ"
|
2016-10-22 09:06:51 +00:00
|
|
|
|
*/--------------------------------------
|
2016-10-24 15:54:43 +00:00
|
|
|
|
* #PStrFTime
|
2016-10-22 09:06:51 +00:00
|
|
|
|
* Convert S.TIME struct to PSTR
|
2016-10-24 15:54:43 +00:00
|
|
|
|
* ##In:
|
2016-10-22 09:06:51 +00:00
|
|
|
|
* PUSHW = Dst PTR To PSTR Buf
|
|
|
|
|
* PUSHW = Src PTR To Format String
|
2016-10-24 15:54:43 +00:00
|
|
|
|
* %a : Abbreviated weekday name : Thu
|
|
|
|
|
* %A : Full weekday name : Thursday
|
|
|
|
|
* %b : Abbreviated month name : Aug
|
|
|
|
|
* %B : Full month name : August
|
|
|
|
|
* %d : Day of the month, zero-padded (01-31)
|
|
|
|
|
* %H : Hour in 24h format (00-23) 14
|
|
|
|
|
* %I : Hour in 12h format (01-12) 02
|
|
|
|
|
* %m : Month as a decimal number (01-12) 08
|
|
|
|
|
* %M : Minute (00-59) 55
|
|
|
|
|
* %p : AM or PM designation PM
|
|
|
|
|
* %S : Second (00-61) 02
|
|
|
|
|
* %w : Weekday as a decimal number with Sunday as 0 (0-6)
|
|
|
|
|
* %y : Year, last two digits (00-99)
|
|
|
|
|
* %Y : Year four digits 2001
|
2016-10-22 09:06:51 +00:00
|
|
|
|
* PUSHW = Src PTR To S.Time
|
2016-10-24 15:54:43 +00:00
|
|
|
|
* ##Out:
|
2016-10-22 09:06:51 +00:00
|
|
|
|
* none. always succeed.
|
|
|
|
|
*\--------------------------------------
|
2016-10-21 15:03:41 +00:00
|
|
|
|
K.PStrFTime jsr PullPtr1Ptr2Ptr3
|
2016-09-28 15:34:15 +00:00
|
|
|
|
|
|
|
|
|
lda #0
|
2017-01-12 17:43:45 +00:00
|
|
|
|
sta (ZPPtr3) Reset target PSTR length
|
2016-09-28 15:34:15 +00:00
|
|
|
|
|
|
|
|
|
tay
|
|
|
|
|
|
|
|
|
|
.1 iny
|
2017-01-12 17:43:45 +00:00
|
|
|
|
lda (ZPPtr2),y
|
2016-09-28 15:34:15 +00:00
|
|
|
|
cmp #'%'
|
|
|
|
|
beq .2
|
|
|
|
|
|
|
|
|
|
phy
|
|
|
|
|
jsr K.PStrFTime.addChar
|
|
|
|
|
ply
|
|
|
|
|
.10 tya
|
2017-01-12 17:43:45 +00:00
|
|
|
|
cmp (ZPPtr2)
|
2016-09-28 15:34:15 +00:00
|
|
|
|
bne .1
|
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
|
.2 tya
|
2017-01-12 17:43:45 +00:00
|
|
|
|
cmp (ZPPtr2)
|
2016-09-28 15:34:15 +00:00
|
|
|
|
beq .8
|
|
|
|
|
|
|
|
|
|
iny
|
|
|
|
|
ldx #K.PStrFTime.JMPL-K.PStrFTime.Tbl-1
|
|
|
|
|
|
2017-01-12 17:43:45 +00:00
|
|
|
|
.3 lda (ZPPtr2),y
|
2016-09-28 15:34:15 +00:00
|
|
|
|
cmp K.PStrFTime.Tbl,x
|
|
|
|
|
beq .4
|
|
|
|
|
dex
|
|
|
|
|
bpl .3
|
|
|
|
|
beq .10
|
|
|
|
|
|
|
|
|
|
.4 lda K.PStrFTime.JMPL,x
|
|
|
|
|
sta .5+1
|
|
|
|
|
lda K.PStrFTime.JMPH,x
|
|
|
|
|
sta .5+2
|
|
|
|
|
phy
|
|
|
|
|
.5 jsr $ffff
|
|
|
|
|
ply
|
|
|
|
|
bra .10
|
|
|
|
|
|
|
|
|
|
.8 rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
K.PStrFTime.TBL .AS "aAbBdHImMpSwyY"
|
|
|
|
|
K.PStrFTime.JMPL .DA #K.PStrFTime.A
|
|
|
|
|
.DA #K.PStrFTime.AA
|
|
|
|
|
.DA #K.PStrFTime.B
|
|
|
|
|
.DA #K.PStrFTime.BB
|
|
|
|
|
.DA #K.PStrFTime.D
|
|
|
|
|
.DA #K.PStrFTime.HH
|
|
|
|
|
.DA #K.PStrFTime.II
|
|
|
|
|
.DA #K.PStrFTime.M
|
|
|
|
|
.DA #K.PStrFTime.MM
|
|
|
|
|
.DA #K.PStrFTime.P
|
|
|
|
|
.DA #K.PStrFTime.SS
|
|
|
|
|
.DA #K.PStrFTime.W
|
|
|
|
|
.DA #K.PStrFTime.Y
|
|
|
|
|
.DA #K.PStrFTime.YY
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
K.PStrFTime.JMPH .DA /K.PStrFTime.A
|
|
|
|
|
.DA /K.PStrFTime.AA
|
|
|
|
|
.DA /K.PStrFTime.B
|
|
|
|
|
.DA /K.PStrFTime.BB
|
|
|
|
|
.DA /K.PStrFTime.D
|
|
|
|
|
.DA /K.PStrFTime.HH
|
|
|
|
|
.DA /K.PStrFTime.II
|
|
|
|
|
.DA /K.PStrFTime.M
|
|
|
|
|
.DA /K.PStrFTime.MM
|
|
|
|
|
.DA /K.PStrFTime.P
|
|
|
|
|
.DA /K.PStrFTime.SS
|
|
|
|
|
.DA /K.PStrFTime.W
|
|
|
|
|
.DA /K.PStrFTime.Y
|
|
|
|
|
.DA /K.PStrFTime.YY
|
|
|
|
|
*--------------------------------------
|
2016-10-14 15:39:49 +00:00
|
|
|
|
K.PStrFTime.A ldx #3 Short day of week, 3 chars...
|
2016-09-28 15:34:15 +00:00
|
|
|
|
.HS 2C Bit abs
|
|
|
|
|
|
2016-10-14 15:39:49 +00:00
|
|
|
|
K.PStrFTime.AA ldx #15 full DoW
|
2016-09-28 15:34:15 +00:00
|
|
|
|
>LDYAI K.PStrFTime.DAY
|
2017-01-12 17:43:45 +00:00
|
|
|
|
>STYA ZPPtr4
|
2016-09-28 15:34:15 +00:00
|
|
|
|
ldy #S.Time.WDAY
|
|
|
|
|
bra K.PStrFTime.STR
|
|
|
|
|
|
2016-10-14 15:39:49 +00:00
|
|
|
|
K.PStrFTime.B ldx #3 Short Month, 3 chars....
|
2016-09-28 15:34:15 +00:00
|
|
|
|
.HS 2C Bit abs
|
|
|
|
|
|
2016-10-14 15:39:49 +00:00
|
|
|
|
K.PStrFTime.BB ldx #15 full Month....
|
2016-09-28 15:34:15 +00:00
|
|
|
|
>LDYAI K.PStrFTime.MON
|
2017-01-12 17:43:45 +00:00
|
|
|
|
>STYA ZPPtr4
|
2016-09-28 15:34:15 +00:00
|
|
|
|
ldy #S.Time.MONTH
|
|
|
|
|
|
2017-01-12 17:43:45 +00:00
|
|
|
|
K.PStrFTime.STR lda (ZPPtr1),y get required S.Time field value
|
2016-09-28 15:34:15 +00:00
|
|
|
|
tay
|
2016-10-14 15:39:49 +00:00
|
|
|
|
beq .9 Illegal value
|
2016-09-28 15:34:15 +00:00
|
|
|
|
|
|
|
|
|
.1 dey range 0..x
|
|
|
|
|
beq .2
|
2017-01-12 17:43:45 +00:00
|
|
|
|
lda (ZPPtr4)
|
2016-09-28 15:34:15 +00:00
|
|
|
|
sec
|
2017-01-12 17:43:45 +00:00
|
|
|
|
adc ZPPtr4
|
|
|
|
|
sta ZPPtr4
|
2016-09-28 15:34:15 +00:00
|
|
|
|
bcc .1
|
2017-01-12 17:43:45 +00:00
|
|
|
|
inc ZPPtr4+1
|
2016-09-28 15:34:15 +00:00
|
|
|
|
bra .1
|
|
|
|
|
|
|
|
|
|
.2 ldy #0
|
|
|
|
|
|
|
|
|
|
.3 iny
|
2017-01-12 17:43:45 +00:00
|
|
|
|
lda (ZPPtr4),y
|
2016-09-28 15:34:15 +00:00
|
|
|
|
phy
|
|
|
|
|
jsr K.PStrFTime.addChar
|
|
|
|
|
pla
|
2017-01-12 17:43:45 +00:00
|
|
|
|
cmp (ZPPtr4)
|
2016-09-28 15:34:15 +00:00
|
|
|
|
beq .8
|
|
|
|
|
|
|
|
|
|
tay
|
|
|
|
|
dex
|
|
|
|
|
bne .3
|
2016-10-14 15:39:49 +00:00
|
|
|
|
.8 rts
|
2016-09-28 15:34:15 +00:00
|
|
|
|
|
2016-10-17 15:47:50 +00:00
|
|
|
|
.9 ldx #3
|
|
|
|
|
lda #'?'
|
|
|
|
|
.99 jsr K.PStrFTime.addChar
|
|
|
|
|
dex
|
|
|
|
|
bne .99
|
|
|
|
|
rts
|
2016-09-28 15:34:15 +00:00
|
|
|
|
|
|
|
|
|
K.PStrFTime.D ldy #S.Time.DAY
|
|
|
|
|
bra K.PStrFTime.addDecPtr1Y
|
|
|
|
|
K.PStrFTime.HH ldy #S.Time.HOUR
|
|
|
|
|
bra K.PStrFTime.addDecPtr1Y
|
|
|
|
|
K.PStrFTime.II ldy #S.Time.HOUR
|
2017-01-12 17:43:45 +00:00
|
|
|
|
lda (ZPPtr1),y
|
2016-09-28 15:34:15 +00:00
|
|
|
|
cmp #12
|
|
|
|
|
bcc .1
|
|
|
|
|
sbc #12
|
|
|
|
|
.1 bra K.PStrFTime.addDecA
|
|
|
|
|
K.PStrFTime.M ldy #S.Time.MONTH
|
|
|
|
|
bra K.PStrFTime.addDecPtr1Y
|
|
|
|
|
K.PStrFTime.MM ldy #S.Time.MINUTE
|
|
|
|
|
bra K.PStrFTime.addDecPtr1Y
|
|
|
|
|
K.PStrFTime.P ldy #S.Time.HOUR
|
2017-01-12 17:43:45 +00:00
|
|
|
|
lda (ZPPtr1),y
|
2016-09-28 15:34:15 +00:00
|
|
|
|
cmp #12
|
|
|
|
|
bcc .1
|
|
|
|
|
lda #'p'
|
|
|
|
|
.HS 2C bit abs
|
|
|
|
|
.1 lda #'a'
|
|
|
|
|
jsr K.PStrFTime.addChar
|
|
|
|
|
lda #'m'
|
|
|
|
|
bra K.PStrFTime.addChar
|
|
|
|
|
K.PStrFTime.SS ldy #S.Time.SECOND
|
|
|
|
|
bra K.PStrFTime.addDecPtr1Y
|
|
|
|
|
K.PStrFTime.W ldy #S.Time.WDAY
|
|
|
|
|
bra K.PStrFTime.addDecPtr1Y
|
|
|
|
|
K.PStrFTime.YY ldy #S.Time.CENTURY
|
|
|
|
|
jsr K.PStrFTime.addDecPtr1Y
|
|
|
|
|
K.PStrFTime.Y ldy #S.Time.YEAR
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
K.PStrFTime.addDecPtr1Y
|
2017-01-12 17:43:45 +00:00
|
|
|
|
lda (ZPPtr1),y
|
2016-09-28 15:34:15 +00:00
|
|
|
|
K.PStrFTime.addDecA
|
|
|
|
|
sta K.PStrFTime.BIN
|
|
|
|
|
stz K.PStrFTime.DEC
|
2016-10-14 15:39:49 +00:00
|
|
|
|
|
2016-09-28 15:34:15 +00:00
|
|
|
|
sed
|
|
|
|
|
ldx #8
|
|
|
|
|
|
|
|
|
|
.1 asl K.PStrFTime.BIN
|
|
|
|
|
|
|
|
|
|
lda K.PStrFTime.DEC
|
|
|
|
|
adc K.PStrFTime.DEC
|
|
|
|
|
sta K.PStrFTime.DEC
|
|
|
|
|
|
|
|
|
|
dex
|
|
|
|
|
bne .1
|
2016-10-14 15:39:49 +00:00
|
|
|
|
|
2016-09-28 15:34:15 +00:00
|
|
|
|
cld
|
|
|
|
|
|
|
|
|
|
* lda K.PStrFTime.DEC already in A
|
2016-10-14 15:39:49 +00:00
|
|
|
|
pha
|
2016-09-28 15:34:15 +00:00
|
|
|
|
lsr
|
|
|
|
|
lsr
|
|
|
|
|
lsr
|
|
|
|
|
lsr
|
|
|
|
|
ora #$30
|
|
|
|
|
jsr K.PStrFTime.addChar
|
2016-10-14 15:39:49 +00:00
|
|
|
|
pla
|
2016-09-28 15:34:15 +00:00
|
|
|
|
and #$0f
|
|
|
|
|
ora #$30
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
K.PStrFTime.addChar
|
|
|
|
|
pha
|
2017-01-12 17:43:45 +00:00
|
|
|
|
lda (ZPPtr3)
|
2016-09-28 15:34:15 +00:00
|
|
|
|
inc
|
2017-01-12 17:43:45 +00:00
|
|
|
|
sta (ZPPtr3)
|
2016-09-28 15:34:15 +00:00
|
|
|
|
tay
|
|
|
|
|
pla
|
2017-01-12 17:43:45 +00:00
|
|
|
|
sta (ZPPtr3),y
|
2016-09-28 15:34:15 +00:00
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2016-10-24 15:54:43 +00:00
|
|
|
|
K.PStrFTime.DAY >PSTR "Monday"
|
|
|
|
|
>PSTR "Tuesday"
|
|
|
|
|
>PSTR "Wednesday"
|
|
|
|
|
>PSTR "Thursday"
|
|
|
|
|
>PSTR "Friday"
|
|
|
|
|
>PSTR "Saturday"
|
|
|
|
|
>PSTR "Sunday"
|
2016-09-28 15:34:15 +00:00
|
|
|
|
*--------------------------------------
|
2016-10-24 15:54:43 +00:00
|
|
|
|
K.PStrFTime.MON >PSTR "January"
|
|
|
|
|
>PSTR "February"
|
|
|
|
|
>PSTR "March"
|
|
|
|
|
>PSTR "April"
|
|
|
|
|
>PSTR "May"
|
|
|
|
|
>PSTR "June"
|
|
|
|
|
>PSTR "July"
|
|
|
|
|
>PSTR "August"
|
|
|
|
|
>PSTR "September"
|
|
|
|
|
>PSTR "October"
|
|
|
|
|
>PSTR "November"
|
|
|
|
|
>PSTR "December"
|
2016-09-28 15:34:15 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
K.PStrFTime.BIN .BS 1
|
|
|
|
|
K.PStrFTime.DEC .BS 1 always < 100
|
2016-10-22 09:06:51 +00:00
|
|
|
|
*/--------------------------------------
|
2016-10-24 15:54:43 +00:00
|
|
|
|
* #PStr2StrArrayYA
|
|
|
|
|
* Convert a PSTR (e.g. : command Line) to a Array of PSTRs (Args[])
|
|
|
|
|
* ##In:
|
2016-10-22 09:06:51 +00:00
|
|
|
|
* Y,A = PTR to String
|
2016-10-24 15:54:43 +00:00
|
|
|
|
* ##Out:
|
2016-10-22 09:06:51 +00:00
|
|
|
|
* CC : success
|
2016-10-24 15:54:43 +00:00
|
|
|
|
* Y,A = PTR to StrArray
|
|
|
|
|
* X = hMem
|
2016-10-22 09:06:51 +00:00
|
|
|
|
* CS : error
|
2016-10-24 15:54:43 +00:00
|
|
|
|
* A = SYS error code
|
2016-10-22 09:06:51 +00:00
|
|
|
|
*\--------------------------------------
|
2016-09-21 15:20:37 +00:00
|
|
|
|
K.PStr2StrArrayYA
|
2017-01-12 17:43:45 +00:00
|
|
|
|
>STYA ZPPtr1
|
|
|
|
|
lda (ZPPtr1) Get mem size STRLEN+1
|
2016-08-17 06:25:58 +00:00
|
|
|
|
ldx #0
|
|
|
|
|
inc
|
|
|
|
|
bne .1
|
|
|
|
|
inx
|
2016-06-07 06:10:18 +00:00
|
|
|
|
|
2016-08-17 06:25:58 +00:00
|
|
|
|
.1 >PUSHAX
|
|
|
|
|
>PUSHBI 0
|
2016-09-21 15:20:37 +00:00
|
|
|
|
jsr K.GetMem
|
2016-08-17 06:25:58 +00:00
|
|
|
|
bcs .9
|
|
|
|
|
phx save hMem
|
|
|
|
|
phy save PTR.LO
|
|
|
|
|
pha save PTR.HI
|
2017-01-12 17:43:45 +00:00
|
|
|
|
>STYA ZPPtr2
|
2016-08-17 06:25:58 +00:00
|
|
|
|
|
2017-01-12 17:43:45 +00:00
|
|
|
|
lda (ZPPtr1)
|
2016-08-17 06:25:58 +00:00
|
|
|
|
tax count in src string
|
|
|
|
|
beq .8
|
|
|
|
|
|
|
|
|
|
ldy #0 reset index in dst token
|
|
|
|
|
|
2017-01-12 17:43:45 +00:00
|
|
|
|
.3 inc ZPPtr1 get...
|
2016-08-17 06:25:58 +00:00
|
|
|
|
bne .4
|
2017-01-12 17:43:45 +00:00
|
|
|
|
inc ZPPtr1+1
|
|
|
|
|
.4 lda (ZPPtr1) ...next char
|
2016-08-17 06:25:58 +00:00
|
|
|
|
|
|
|
|
|
cmp #' ' found a space ?
|
|
|
|
|
bne .6
|
|
|
|
|
|
|
|
|
|
tya in a token ?
|
|
|
|
|
beq .7 no, skip & go to next char
|
|
|
|
|
|
2017-01-12 17:43:45 +00:00
|
|
|
|
sta (ZPPtr2) yes, set this token len
|
2015-03-14 21:48:35 +00:00
|
|
|
|
sec
|
2017-01-12 17:43:45 +00:00
|
|
|
|
adc ZPPtr2 advance to next token
|
|
|
|
|
sta ZPPtr2
|
2016-08-17 06:25:58 +00:00
|
|
|
|
bcc .5
|
2017-01-12 17:43:45 +00:00
|
|
|
|
inc ZPPtr2+1
|
2016-08-17 06:25:58 +00:00
|
|
|
|
|
|
|
|
|
.5 ldy #0 reset index in dst token
|
|
|
|
|
bra .7
|
|
|
|
|
|
|
|
|
|
.6 iny add char to token
|
2017-01-12 17:43:45 +00:00
|
|
|
|
sta (ZPPtr2),y
|
2016-08-17 06:25:58 +00:00
|
|
|
|
|
|
|
|
|
.7 dex end of src string?
|
|
|
|
|
bne .3 no...next char...
|
|
|
|
|
|
|
|
|
|
tya yes, are we in a token ?
|
|
|
|
|
beq .8
|
|
|
|
|
|
2017-01-12 17:43:45 +00:00
|
|
|
|
sta (ZPPtr2) yes, set last token len
|
2015-03-14 21:48:35 +00:00
|
|
|
|
sec
|
2017-01-12 17:43:45 +00:00
|
|
|
|
adc ZPPtr2 advance to next token
|
|
|
|
|
sta ZPPtr2
|
2016-08-17 06:25:58 +00:00
|
|
|
|
bcc .8
|
2017-01-12 17:43:45 +00:00
|
|
|
|
inc ZPPtr2+1
|
2016-06-07 06:10:18 +00:00
|
|
|
|
|
2016-08-17 06:25:58 +00:00
|
|
|
|
.8 lda #0
|
2017-01-12 17:43:45 +00:00
|
|
|
|
sta (ZPPtr2) set Array Ending 0
|
2016-06-07 06:10:18 +00:00
|
|
|
|
|
2016-08-17 06:25:58 +00:00
|
|
|
|
pla get back PTR.HI
|
|
|
|
|
ply get back PTR.LO
|
|
|
|
|
plx get back hMem
|
2016-05-01 21:13:54 +00:00
|
|
|
|
clc
|
2016-08-17 06:25:58 +00:00
|
|
|
|
.9 rts
|
2016-05-01 21:13:54 +00:00
|
|
|
|
*--------------------------------------
|
2015-03-14 21:48:35 +00:00
|
|
|
|
MAN
|
|
|
|
|
SAVE SYS/KERNEL.S.STR
|
|
|
|
|
LOAD SYS/KERNEL.S
|
|
|
|
|
ASM
|