~aleteoryx/uxn

ref: f9b262c1a028d63292b83fdfab534d8176294fad uxn/arvelie.tal -rw-r--r-- 800 bytes
f9b262c1 — glenda arvelie.tal 8 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|10 @Console &vector $2 &read $1 &pad $5 &write $1 &error $1
|c0 @DateTime &year $2 &month $1 &day $1 &hour $1 &minute $1 &second $1 &dotw $1 &doty $2 &isdst $1

|00
@NumLen $1 @NumBuf $5

%start-year ( -- year* ) { #07e9 } ( y2025 )

%mod ( a b -- a%b ) { DIVk MUL SUB }

|100
@on-reset ( -> )
	.DateTime/year DEI2 start-year SUB2 NIP print2 ( print year )
	.DateTime/doty DEI2 #0e DIVk DUP print-month ( print month )
	MUL SUB print2 ( complete the modulo, print day )
	BRK

@print2 ( num -- )
	#64 mod ( lock to 0..99 )
	#0a DIVk DUP #30 ADD .Console/write DEO ( print first digit )
	MUL SUB #30 ADD .Console/write DEO ( print second digit )
	JMP2r

@print-month ( month -- )
	INC #1b mod ( map 26 in to 0, clamp to 0..26 )
	DUP ?{ #15 SUB } ( convert 0 to + )
	#40 ADD .Console/write DEO
	JMP2r