get draw-h-line working
This commit is contained in:
parent
d44f6ede1d
commit
d4999d2dec
2 changed files with 57 additions and 34 deletions
|
@ -9,48 +9,37 @@
|
||||||
(to run gui: `./run_ui.sh one_line_canvas.tal`)
|
(to run gui: `./run_ui.sh one_line_canvas.tal`)
|
||||||
(to run debugger: `../uxn/bin/uxnasm one_line_canvas.tal one_line_canvas.rom && ../uxn/bin/uxnemu ../beetbug.rom ./one_line_canvas.rom`)
|
(to run debugger: `../uxn/bin/uxnasm one_line_canvas.tal one_line_canvas.rom && ../uxn/bin/uxnemu ../beetbug.rom ./one_line_canvas.rom`)
|
||||||
%dbug { #01 .System/debug DEO }
|
%dbug { #01 .System/debug DEO }
|
||||||
|
%PX { #01 .Screen/pixel DEO }
|
||||||
|
|
||||||
|0100
|
|0100
|
||||||
@on-reset
|
@on-reset
|
||||||
setup-gui
|
setup-gui
|
||||||
draw-canvas-bounds
|
#58 #58 #1f draw-h-line
|
||||||
|
#58 #58 #1f #02 MUL draw-h-line
|
||||||
BRK
|
BRK
|
||||||
|
|
||||||
@draw-line
|
@draw-h-line ( l x y )
|
||||||
(change x,y to top left of canvas)
|
#00 ( l x y 00 )
|
||||||
LIT2 00 -canvas-width .Screen/x DEO2
|
SWP .Screen/y DEO2 ( l x )
|
||||||
LIT2 00 -canvas-height .Screen/y DEO2
|
( store vars )
|
||||||
|
!{ &x $1 &l $1 }
|
||||||
&x $1
|
,/x STR ,/l STR
|
||||||
(set x to 88)
|
|
||||||
#58 ,&x STR
|
|
||||||
(#00 ,&i STR)
|
|
||||||
|
|
||||||
&loop
|
&loop
|
||||||
#00 LIT &x $1 .Screen/x DEO2
|
( set x )
|
||||||
LIT &x $1
|
,/x LDR DUP ( x x )
|
||||||
INC
|
#00 SWP ( x 00 x)
|
||||||
,&x STRk
|
.Screen/x DEO2 ( x )
|
||||||
|
( draw pixel )
|
||||||
EQUk ?&loop
|
PX
|
||||||
|
( incrment x )
|
||||||
|
INC ( x+1 )
|
||||||
|
,/x STR ( )
|
||||||
|
( decrement l )
|
||||||
|
,/l LDR #01 ( l 01 )
|
||||||
|
SUB ( l-1 )
|
||||||
(
|
,/l STRk POP ( l )
|
||||||
,&top-left-x STR
|
#00 NEQ ?&loop
|
||||||
dbug
|
|
||||||
&loop
|
|
||||||
LIT -width
|
|
||||||
(00 58)
|
|
||||||
ADDk (00 58 58)
|
|
||||||
#00 .Screen/x DEO2 (0058 00B0)
|
|
||||||
#01 .Screen/pixel DEO
|
|
||||||
INC2 (0059 00B0)
|
|
||||||
EQUk ?&loop
|
|
||||||
POP2 POP2)
|
|
||||||
JMP2r
|
JMP2r
|
||||||
|
|
||||||
@setup-gui ( -- )
|
@setup-gui ( -- )
|
||||||
|
|
|
@ -0,0 +1,34 @@
|
||||||
|
|00 @System &vector $2 &expansion $2 &wst $1 &rst $1 &metadata $2 &r $2 &g $2 &b $2 &debug $1 &state $1
|
||||||
|
|10 @Console &vector $2 &read $1 &pad $4 &type $1 &write $1 &error $1
|
||||||
|
|
||||||
|
|
||||||
|
|0100
|
||||||
|
@on-reset
|
||||||
|
#02 #04 SUB
|
||||||
|
( mem-test )
|
||||||
|
BRK
|
||||||
|
|
||||||
|
@mem-test ( a b c -- x)
|
||||||
|
!{
|
||||||
|
&a $1
|
||||||
|
&b $1
|
||||||
|
&c $1
|
||||||
|
}
|
||||||
|
,/a STR
|
||||||
|
,/b STR
|
||||||
|
,/c STR
|
||||||
|
|
||||||
|
,/a LDR
|
||||||
|
,/b LDR
|
||||||
|
ADD
|
||||||
|
,/c LDR
|
||||||
|
ADD ( 06 )
|
||||||
|
|
||||||
|
STH
|
||||||
|
#00 STH
|
||||||
|
SWP2r
|
||||||
|
JMP2r
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
( !{ &a $1 } )
|
Loading…
Add table
Add a link
Reference in a new issue