~aleteoryx/uxn

ref: 9bf779263417a2a9da033d4c2dd95c42507f4a0e uxn/arvelie.tal -rw-r--r-- 773 bytes
9bf77926 — glenda repl(?) done 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
|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

%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