Colour pinstripe/Display: Difference between revisions

Improve Uxntal version with suggestions from #uxn IRC channel
(→‎Uxntal: Added image output.)
(Improve Uxntal version with suggestions from #uxn IRC channel)
 
(One intermediate revision by the same user not shown)
Line 2,181:
 
=={{header|Uxntal}}==
<syntaxhighlight lang="uxntal">( uxnasm color-pinstripe.tal color-pinstripe.rom && uxnemu color-pinstripe.rom )
 
|00 @System &vector $2 &expansion $2 &wst $1 &rst $1 &metadata $2 &r $2 &g $2 &b $2 &debug $1 &state $1
|20 @Screen &vector $2 &width $2 &height $2 &auto $1 &pad $1 &x $2 &y $2 &addr $2 &pixel $1 &sprite $1
 
|0100 @reset
( set theme )
#0f00 .System/r DEO2
Line 2,193:
 
( store screen width )
.Screen/width DEI2 ,&draw-layer/width STR2
( store a quarter of the screen height )
( set initial position )
#0000 .Screen/yheight DEI2 #02 SFT2 ,&quarter-height DEO2STR2
 
( draw stripesthe four stripe layers )
#000000
&loop ( -- )
&loop
DUP2( .Screen/xupdate DEO2y coordinate )
#00 OVR [ LIT2 &quarter-height $2 ] MUL2 .Screen/y DEO2
( draw a layer )
INCk draw-layer
( do it four times )
INC DUP #04 LTH ?&loop
POP BRK
 
@draw-layer ( step -: )
( extend step to short, create counter )
#00 SWP #0000
&loop ( -- )
( update x coordinate )
MUL2k .Screen/x DEO2
( fill a region )
DUP #03 AND #80 ORA .Screen/pixel DEO
INC2( DUP2loop [until LIT2the &widthend $2of ]the NEQ2screen ?&loop)
INC2 MUL2k [ LIT2 &width $2 ] LTH2 ?&loop
BRK POP2 POP2 JMP2r</syntaxhighlight>
[[File:Color-pinstripe.png|alt=Color pinstripe implemented in Uxntal.|none|thumb|Color pinstripe implemented in Uxntal.]]
[[File:Colour pinstripe-Display in Uxntal.png|thumb|none|alt=Uxntal implementation of Colour pinstripe/display in an emulator.|Running in an emulator.]]
 
=={{header|Visual Basic .NET}}==
57

edits