From 7a1a6e50d42edc3280f2e9b2439828cdf48b8da8 Mon Sep 17 00:00:00 2001 From: Devine Lu Linvega Date: Thu, 25 May 2023 12:11:06 -0700 Subject: [PATCH] Housekeeping --- cli/arvelie/arvelie.tal | 63 +++++++++++++++++++++++------------------ 1 file changed, 36 insertions(+), 27 deletions(-) diff --git a/cli/arvelie/arvelie.tal b/cli/arvelie/arvelie.tal index 2fe4e30..db4f3e3 100644 --- a/cli/arvelie/arvelie.tal +++ b/cli/arvelie/arvelie.tal @@ -9,11 +9,14 @@ .Console/type DEI ?on-params ( today ) - .DateTime/doty DEI2 .DateTime/year DEI2 print-arvelie #0a18 DEO + .DateTime/doty DEI2 .DateTime/year DEI2 emit-arv #0a18 DEO #800f DEO BRK +( +@|vectors ) + @on-params ( -> ) ;on-console .Console/vector DEO2 @@ -36,6 +39,9 @@ BRK BRK +( +@|core ) + @parse ( ztr -- ) DUP zlen #05 EQU ?&on-arvgre @@ -52,7 +58,7 @@ JMP2r ( month ) INCk INC LDZk LIT "A SUB #00 SWP #000e MUL2 STH2 ( date ) INC LDZ2 bytedec STH2r ADD2 INC2 ( year ) ROT LDZ2 bytedec #07d6 ADD2 - print-greg + emit-gre #010f DEO JMP2r @@ -67,11 +73,38 @@ JMP2r STHkr LDZ2 bytedec INCr INCr INCr ( day ) STHr LDZ2 bytedec #0001 SUB2 - doty SWP2 print-arvelie #0a18 DEO + doty SWP2 emit-arv #0a18 DEO #010f DEO JMP2r +@emit-gre ( doty* year* -- ) + + pdec #2018 DEO + pdec #0a18 DEO + +JMP2r + +@emit-arv ( doty* year* -- ) + + #07d6 SUB2 NIP + ( digit1 ) DUP #0a DIV emit-num + ( digit2 ) #0a [ DIVk MUL SUB ] emit-num + ( month ) DUP2 #000e DIV2 NIP #11 ADD emit-num + ( digit3 ) #000e [ DIV2k MUL2 SUB2 ] DUP2 #000a DIV2 NIP emit-num + ( digit4 ) #000a [ DIV2k MUL2 SUB2 ] NIP + +( >> ) + +@emit-num ( num -- ) + + #30 ADD #18 DEO + +JMP2r + +( +@|utils ) + @doty ( year* month* day* -- doty* ) ROT2 ,&y STR2 @@ -111,30 +144,6 @@ JMP2r POP2 #01 JMP2r -@print-greg ( doty* year* -- ) - - pdec #2018 DEO - pdec #0a18 DEO - -JMP2r - -@print-arvelie ( doty* year* -- ) - - #07d6 SUB2 NIP - ( digit1 ) DUP #0a DIV emit-num - ( digit2 ) #0a [ DIVk MUL SUB ] emit-num - ( month ) DUP2 #000e DIV2 NIP #11 ADD emit-num - ( digit3 ) #000e [ DIV2k MUL2 SUB2 ] DUP2 #000a DIV2 NIP emit-num - ( digit4 ) #000a [ DIV2k MUL2 SUB2 ] NIP - -( >> ) - -@emit-num ( num -- ) - - #30 ADD #18 DEO - -JMP2r - @bytedec ( byte -- dec* ) LIT "0 SUB SWP LIT "0 SUB #0a MUL ADD #00 SWP