(hilbert) Housekeeping

This commit is contained in:
Devine Lu Linvega 2024-01-21 08:39:29 -08:00
parent 8212ca5edb
commit 2560216ed0
1 changed files with 29 additions and 40 deletions

View File

@ -3,63 +3,52 @@
|0100
@on-reset ( -> )
( | theme )
#6f0b .System/r DEO2
#7f0a .System/g DEO2
#8e0a .System/b DEO2
( screen size )
( | screen size )
#00c0
DUP2 .Screen/width DEO2
.Screen/height DEO2
( vector )
( ) DUP2 .Screen/width DEO2
( ) .Screen/height DEO2
( | vector )
;on-frame .Screen/vector DEO2
BRK
BRK
@on-frame ( -> )
[ LIT2 &f $2 ] INC2k ,&f STR2
INC2k d2xy ROT2 d2xy #01 <draw-line>
BRK
[ LIT2 &f $2 ] STH2k INC2 DUP2 ,&f STR2
d2xy STH2r d2xy #01 <draw-line>
BRK
@d2xy ( d* -- x* y* )
,&t STR2
#0000
DUP2 ,&x STR2
,&y STR2
#2001
&l
#00 OVR STH2
[ LIT2 &t $2 ]
DUP2 DUP2 #01 SFT2 #0001 AND2 DUP2 ,&rx STR2
EOR2 #0001 AND2 ,&ry STR2
#02 SFT2 ,&t STR2
[ LIT2 &x $2 ] [ LIT2 &y $2 ] [ LIT2 &rx $2 ] [ LIT2 &ry $2 ]
STH2kr rot
STH2kr ,&ry LDR2 MUL2 ADD2 ,&y STR2
STH2r ,&rx LDR2 MUL2 ADD2 ,&x STR2
DUP ADD GTHk ?&l
( ) DUP2 ,&x STR2
( ) ,&y STR2
#2001 &l #00 OVR STH2
[ LIT2 &t $2 ]
( ) DUP2 DUP2 #01 SFT2 #0001 AND2 DUP2 ,&rx STR2
( ) EOR2 #0001 AND2 ,&ry STR2
( ) #02 SFT2 ,&t STR2
[ LIT2 &x $2 ] [ LIT2 &y $2 ] [ LIT2 &rx $2 ] [ LIT2 &ry $2 ]
( ) STH2kr rot
( ) STH2kr ,&ry LDR2 MUL2 ADD2 ,&y STR2
( ) STH2r ,&rx LDR2 MUL2 ADD2 ,&x STR2
DUP ADD GTHk ?&l
POP2
,&x LDR2 #20 SFT2 #0020 ADD2
,&y LDR2 #20 SFT2 #0020 ADD2
JMP2r
( ) ,&x LDR2 #20 SFT2 #0020 ADD2
( ) ,&y LDR2 #20 SFT2 #0020 ADD2 JMP2r
@rot ( x* y* rx* ry* n* -- x* y* )
#0001 SUB2 STH2
SWP2 ,&rx STR2
ORA ?&skipy
[ LIT2 &rx $2 ] #0001 NEQ2 ?&skipx
ORA ?{
[ LIT2 &rx $2 ] #0001 NEQ2 ?{
( rx-n-1 ) SWP2 STH2kr SWP2 SUB2
( ry-n-1 ) SWP2 STH2kr SWP2 SUB2
&skipx
( swap ) SWP2
&skipy
POP2r
JMP2r
( ry-n-1 ) SWP2 STH2kr SWP2 SUB2 }
( swap ) SWP2 }
POP2r JMP2r
@<draw-line> ( x1* y1* x2* y2* color -- )
,&color STR