mirror of
https://git.sr.ht/~rabbits/uxn
synced 2024-12-02 02:27:25 +00:00
86 lines
1.3 KiB
Tal
86 lines
1.3 KiB
Tal
|
|c0 @DateTime &year $2 &month $1 &day $1 &hour $1 &minute $1 &second $1 &dotw $1 &doty $2 &isdst $1
|
||
|
|
||
|
|0100
|
||
|
|
||
|
( date )
|
||
|
;dict/date pstr
|
||
|
[ LIT2 00 -DateTime/dotw ] DEI #20 SFT ;week-txt ADD2 pstr
|
||
|
[ LIT2 20 ", ] #18 DEO #18 DEO
|
||
|
[ LIT2 00 -DateTime/month ] DEI #20 SFT ;month-txt ADD2 pstr
|
||
|
#2018 DEO
|
||
|
[ LIT2 00 -DateTime/day ] DEI pdec
|
||
|
[ LIT2 20 ", ] #18 DEO #18 DEO
|
||
|
.DateTime/year DEI2 pdec
|
||
|
#0a18 DEO
|
||
|
|
||
|
( time )
|
||
|
;dict/time pstr
|
||
|
[ LIT2 00 -DateTime/hour ] DEI pdec-pad
|
||
|
LIT ": #18 DEO
|
||
|
[ LIT2 00 -DateTime/minute ] DEI pdec-pad
|
||
|
LIT ": #18 DEO
|
||
|
[ LIT2 00 -DateTime/second ] DEI pdec-pad
|
||
|
#0a18 DEO
|
||
|
|
||
|
#800f DEO
|
||
|
|
||
|
BRK
|
||
|
|
||
|
@pstr ( str* -- )
|
||
|
|
||
|
LDAk ?&w POP2 JMP2r
|
||
|
&w
|
||
|
LDAk #18 DEO
|
||
|
INC2 LDAk ?&w
|
||
|
POP2
|
||
|
|
||
|
JMP2r
|
||
|
|
||
|
@pdec-pad ( byte -- )
|
||
|
|
||
|
#0a DIVk emit
|
||
|
DIVk MUL SUB emit
|
||
|
|
||
|
JMP2r
|
||
|
|
||
|
@pdec ( short* -- )
|
||
|
|
||
|
#00 ,&z STR
|
||
|
#2710 pdec/parse
|
||
|
#03e8 pdec/parse
|
||
|
#0064 pdec/parse
|
||
|
#000a pdec/parse
|
||
|
NIP emit
|
||
|
|
||
|
JMP2r
|
||
|
|
||
|
&parse ( short* den* -- short* )
|
||
|
|
||
|
DIV2k DUPk [ LIT &z $1 ] EQU ?&skip
|
||
|
DUP emit #ff ,&z STR
|
||
|
&skip POP MUL2 SUB2
|
||
|
|
||
|
JMP2r
|
||
|
|
||
|
@emit ( num -- )
|
||
|
|
||
|
LIT "0 ADD #18 DEO
|
||
|
|
||
|
JMP2r
|
||
|
|
||
|
(
|
||
|
@|assets )
|
||
|
|
||
|
@week-txt [
|
||
|
"Sun $1 "Mon $1 "Tue $1 "Wed $1 "Thu $1 "Fri $1
|
||
|
"Sat $1 ]
|
||
|
|
||
|
@month-txt [
|
||
|
"Jan $1 "Feb $1 "Mar $1 "Apr $1 "May $1 "Jun $1
|
||
|
"Jul $1 "Aug $1 "Sep $1 "Oct $1 "Nov $1 "Dec $1 ]
|
||
|
|
||
|
@dict
|
||
|
&date "The 20 "date 20 "is: 20 $1
|
||
|
&time "The 20 "time 20 "is: 20 $1
|
||
|
|