(neralie) Use screen redraw port

This commit is contained in:
Devine Lu Linvega 2024-06-14 10:03:00 -08:00
parent ffcc5eaed1
commit a299cca6dc
1 changed files with 48 additions and 46 deletions

View File

@ -12,8 +12,7 @@
@lines &addr $1
@neralie &n0123 $2 &n4 $1 &n5 $1 &n6 $1 &n7 $1 &n8 $1 &n9 $1 &color $1 &x $2 &y $2 &w $2 &h $2
@mul &ahi $1 &alo $1 &bhi $1 &blo $1
@frame
&x1 $2 &x2 $2 &y1 $2 &y2 $2
@frame &x1 $2 &x2 $2 &y1 $2 &y2 $2
( program )
@ -25,17 +24,15 @@
#0fb2 .System/b DEO2
( | vectors )
;on-screen .Screen/vector DEO2
#01 .fps/current STZ
[ LIT2 01 -fps/current ] STZ
( | set size )
#0018 ( padding )
DUP2 .frame/x1 STZ2
DUP2 .frame/y1 STZ2
DUP2 .Screen/width DEI2 SWP2 SUB2 #0001 SUB2 .frame/x2 STZ2
.Screen/height DEI2 SWP2 SUB2 .frame/y2 STZ2
#01 .neralie/color STZ
( | draw frame )
[ LIT2 41 -neralie/color ] STZ
.frame/x1 LDZ2 .frame/x2 LDZ2
OVR2 OVR2 .frame/y1 LDZ2 h
.frame/y2 LDZ2 h
@ -44,20 +41,29 @@
.frame/x2 LDZ2 v
@on-screen ( -> )
( | update fps )
update-fps
#00 .neralie/color STZ
<draw-clock>
neralie-calc
#01 .neralie/color STZ
( | clear )
#0000 DUP2 .Screen/x DEO2
.Screen/y DEO2
[ LIT2 80 -Screen/pixel ] DEO
( | draw )
update-time
[ LIT2 01 -neralie/color ] STZ
<draw-date>
<draw-clock>
BRK
@neralie-calc ( -- )
@update-fps ( -- )
.fps/next LDZ INC .fps/next STZ
.DateTime/second DEI .fps/second LDZ NEQ ?{ JMP2r }
.DateTime/second DEI .fps/second STZ
.fps/next LDZ .fps/current STZ
[ LIT2 00 -fps/next ] STZ
JMP2r
@update-time ( -- )
( | add up fractions of a pulse, store tenths in n6 )
( ) #0120 #00 .DateTime/hour DEI MUL2
@ -131,22 +137,22 @@ JMP2r
;neralie/n4 NIP .neralie/n0123 LDZ2
DUP2 ;&h JSR2
DUP2 /h
;&next JSR2 #0008 .Screen/x DEO2 .neralie/y LDZ2 #0003 SUB2 .Screen/y DEO2 <draw-digit>
/next #0008 .Screen/x DEO2 .neralie/y LDZ2 #0003 SUB2 .Screen/y DEO2 <draw-digit>
DUP2 ;&v JSR2
DUP2 /v
#04 ;v/spacing STA
.frame/y1 LDZ2 #0003 SUB2 .neralie/y LDZ2 .neralie/x LDZ2 v
#01 ;v/spacing STA
,&next JSR #0008 .Screen/y DEO2 .neralie/x LDZ2 #0003 SUB2 .Screen/x DEO2 <draw-digit>
DUP2 ,&h JSR
,&next JSR .Screen/width DEI2 #0010 SUB2 .Screen/x DEO2 .neralie/y LDZ2 #0003 SUB2 .Screen/y DEO2 <draw-digit>
DUP2 ,&v JSR
,&next JSR POP2
DUP2 ,&h JSR
,&next JSR POP2
DUP2 ,&v JSR
/next #0008 .Screen/y DEO2 .neralie/x LDZ2 #0003 SUB2 .Screen/x DEO2 <draw-digit>
DUP2 /h
/next .Screen/width DEI2 #0010 SUB2 .Screen/x DEO2 .neralie/y LDZ2 #0003 SUB2 .Screen/y DEO2 <draw-digit>
DUP2 /v
/next POP2
DUP2 /h
/next POP2
DUP2 /v
POP2 POP
JMP2r
@ -158,20 +164,20 @@ JMP2r
JMP2r
&h ( number* -- )
,scale JSR
scale
.neralie/h LDZ2 mul2hi
ORAk #02 JCN POP2 JMP2r
ORAk ?{ POP2 JMP2r }
DUP2 .neralie/y LDZ2 ADD2 .neralie/y STZ2
.neralie/h LDZ2 SWP2 SUB2 .neralie/h STZ2
.neralie/x LDZ2 DUP2 .neralie/w LDZ2 ADD2 .neralie/y LDZ2 ,h JMP
.neralie/x LDZ2 DUP2 .neralie/w LDZ2 ADD2 .neralie/y LDZ2 !h
&v ( number* -- )
,scale JSR
scale
.neralie/w LDZ2 mul2hi
ORAk #02 JCN POP2 JMP2r
ORAk ?{ POP2 JMP2r }
DUP2 .neralie/x LDZ2 ADD2 .neralie/x STZ2
.neralie/w LDZ2 SWP2 SUB2 .neralie/w STZ2
.neralie/y LDZ2 DUP2 .neralie/h LDZ2 ADD2 .neralie/x LDZ2 ,v JMP
.neralie/y LDZ2 DUP2 .neralie/h LDZ2 ADD2 .neralie/x LDZ2 !v
@scale ( 0..10000* -- 0..65535* )
DUP2 #8db8 mul2hi
@ -181,35 +187,28 @@ JMP2r
@h ( x1* x2* y* -- )
.Screen/y DEO2
.Screen/x .lines/addr STZ
,v/draw-line JMP
!v/draw-line
@v ( y1* y2* x* -- )
.Screen/x DEO2
.Screen/y .lines/addr STZ
&draw-line ( v1* v2* -- )
LTH2k #01 JCN SWP2
LTH2k ?{ SWP2 }
STH2
&loop
LIT2 [ 00 ] &spacing [ 01 ] ADD2
DUP2 DUP2r STH2r LTH2 ,&keep-going JCN
DUP2 DUP2r STH2r LTH2 ?&keep-going
POP2 POP2r
JMP2r
&keep-going
DUP2 .lines/addr LDZ DEO2
.neralie/color LDZ .Screen/pixel DEO
,&loop JMP
!&loop
@update-fps ( -- )
.fps/next LDZ INC .fps/next STZ
.DateTime/second DEI .fps/second LDZ NEQ JMP JMP2r
.DateTime/second DEI .fps/second STZ
.fps/next LDZ .fps/current STZ
#00 .fps/next STZ
JMP2r
@modf ( dividend* divisor* SUB2 remainder* quotient* )
DIV2k STH2k MUL2 SUB2 STH2r JMP2r
@ -221,20 +220,23 @@ JMP2r
#00
#00 .mul/alo LDZ #00 .mul/blo LDZ MUL2
POP
#00 .mul/ahi LDZ #00 .mul/blo LDZ MUL2 ,&adc JSR
#00 .mul/alo LDZ #00 .mul/bhi LDZ MUL2 ,&adc JSR
#00 .mul/ahi LDZ #00 .mul/blo LDZ MUL2 /adc
#00 .mul/alo LDZ #00 .mul/bhi LDZ MUL2 /adc
POP
#00 .mul/ahi LDZ #00 .mul/bhi LDZ MUL2 ADD2
JMP2r
&adc ( 31..24 a* b* -- 31..24 sum* )
OVR2 ADD2 SWP2 OVR2
GTH2 ,&carry JCN
GTH2 ?&carry
JMP2r
&carry
ROT INC ROT ROT
JMP2r
(
@|assets )
@font-numbers [
7cc6 ced6 e6c6 7c00 1838 1818 1818 7e00 3c66 063c 6066 7e00
3c66 061c 0666 3c00 1c3c 6ccc fe0c 1e00 7e62 607c 0666 3c00