uxn

Varvara Ordinator, written in ANSI C(SDL2)
git clone https://git.eamoncaddigan.net/uxn.git
Log | Files | Refs | README | LICENSE

commit 514b2f7f588e0e738eba92404f6c863bd65771e1
parent 4bac8e9e300948bb291e04d828e74e2f44fe2d85
Author: neauoire <aliceffekt@gmail.com>
Date:   Wed, 12 May 2021 11:58:31 -0700

Minor optimizations to demos

Diffstat:
Mbuild.sh | 2+-
Mprojects/demos/drum-rack.usm | 16++++++++--------
Mprojects/demos/life.usm | 12++++++------
Mprojects/demos/polycat.usm | 39++++++++++++++++++---------------------
Mprojects/demos/theme.usm | 20++++++++++----------
5 files changed, 43 insertions(+), 46 deletions(-)

diff --git a/build.sh b/build.sh @@ -42,7 +42,7 @@ then fi echo "Assembling.." -./bin/uxnasm projects/demos/bifurcan.usm bin/boot.rom +./bin/uxnasm projects/demos/drum-rack.usm bin/boot.rom echo "Running.." if [ "${2}" = '--cli' ]; diff --git a/projects/demos/drum-rack.usm b/projects/demos/drum-rack.usm @@ -56,9 +56,9 @@ |0100 ( -> ) ( theme ) - #4ff2 .System/r DEO2 - #2f8c .System/g DEO2 - #afb6 .System/b DEO2 + #0fe5 .System/r DEO2 + #0fc5 .System/g DEO2 + #0f25 .System/b DEO2 ( vectors ) ;on-control .Controller/vector DEO2 @@ -142,7 +142,7 @@ ( draw mixer ) OVR #04 / ;draw-mixer JSR2 ( incr ) SWP #01 + SWP - DUP2 < ,&draw-pads JCN + LTHk ,&draw-pads JCN POP2 ;draw-octave JSR2 @@ -160,7 +160,7 @@ BRK ( output ) .Audio0/output STHr #10 * + DEI ;draw-monitor JSR2 ( incr ) SWP #01 + SWP - DUP2 < ,&loop JCN + LTHk ,&loop JCN POP2 BRK @@ -359,7 +359,7 @@ RTN .Screen/x DEI2 #0001 ++ .Screen/x DEO2 ( draw ) #02 .Screen/color DEO ( incr ) SWP #01 + SWP - DUP2 < ,&loop JCN + LTHk ,&loop JCN POP2 POP2r @@ -476,7 +476,7 @@ RTN .Screen/x DEI2 #0002 -- .Screen/x DEO2 .Screen/y DEI2 #0002 ++ .Screen/y DEO2 ( incr ) SWP #01 + SWP - DUP2 < ,&loop JCN + LTHk ,&loop JCN POP2 POPr @@ -494,7 +494,7 @@ RTN ( draw ) DUPr STHr .Screen/color DEO ( incr ) .Screen/addr DEI2 #0008 ++ .Screen/addr DEO2 ( incr ) SWP2 #0008 ++ SWP2 - OVR2 OVR2 << ,&loop JCN + LTH2k ,&loop JCN POP2 POP2 POPr diff --git a/projects/demos/life.usm b/projects/demos/life.usm @@ -77,7 +77,7 @@ BRK &clear-loop OVR2 #0000 SWP2 STA2 SWP2 #0002 ++ SWP2 - OVR2 OVR2 !! ,&clear-loop JCN + NEQ2k ,&clear-loop JCN POP2 POP2 ;run-grid JSR2 @@ -88,7 +88,7 @@ BRK OVR2 DUP2 LDA2 SWP2 #2000 -- STA2 SWP2 #0002 ++ SWP2 - OVR2 OVR2 !! ,&copy-loop JCN + NEQ2k ,&copy-loop JCN POP2 POP2 ;draw-grid JSR2 @@ -154,10 +154,10 @@ BRK OVR TOS #0002 ** .anchor/x LDZ2 ++ .Screen/x DEO2 OVR DUPr STHr ,get-cell JSR INCR .Screen/color DEO SWP INCR SWP - DUP2 ! ,&hor JCN + NEQk ,&hor JCN POP2 POPr SWP INCR SWP - DUP2 ! ,&ver JCN + NEQk ,&ver JCN POP2 RTN @@ -214,10 +214,10 @@ RTN ( state ) STH2r ;get-cell JSR2 ,run-cell JSR SWP INCR SWP - DUP2 ! ,&hor JCN + NEQk ,&hor JCN POP2 POPr SWP INCR SWP - DUP2 ! ,&ver JCN + NEQk ,&ver JCN POP2 RTN diff --git a/projects/demos/polycat.usm b/projects/demos/polycat.usm @@ -1,9 +1,6 @@ ( polycat ) %RTN { JMP2r } -%+ { ADD2 } %- { SUB2 } -%* { MUL2 } %/ { DIV2 } -%> { GTH2 } ( devices ) @@ -28,8 +25,8 @@ #0caf .System/b DEO2 ( find center ) - .Screen/width DEI2 #0002 / #0008 - .cat/x STZ2 - .Screen/height DEI2 #0004 / #0003 * #0018 - .cat/y STZ2 + .Screen/width DEI2 #0002 DIV2 #0008 SUB2 .cat/x STZ2 + .Screen/height DEI2 #0004 DIV2 #0003 MUL2 #0018 SUB2 .cat/y STZ2 ( vectors ) ;on-mouse .Mouse/vector DEO2 @@ -44,8 +41,8 @@ BRK ;draw-cursor JSR2 - .Mouse/x DEI2 .cat/x LDZ2 > #20 MUL - .Mouse/y DEI2 .cat/y LDZ2 > #40 MUL + .Mouse/x DEI2 .cat/x LDZ2 GTH2 #20 MUL + .Mouse/y DEI2 .cat/y LDZ2 GTH2 #40 MUL ADD #00 SWP ;draw-eye JSR2 BRK @@ -67,11 +64,11 @@ BRK ( ears ) .cat/y LDZ2 .Screen/y DEO2 - .cat/x LDZ2 DUP2 STH2 #0008 - .Screen/x DEO2 + .cat/x LDZ2 DUP2 STH2 #0008 SUB2 .Screen/x DEO2 ;ears .Screen/addr DEO2 #41 .Screen/color DEO STH2r .Screen/x DEO2 - ;ears #0010 + .Screen/addr DEO2 + ;ears #0010 ADD2 .Screen/addr DEO2 #41 .Screen/color DEO #0000 ,draw-eye JSR @@ -81,24 +78,24 @@ RTN @draw-eye ( quad* -- ) - .cat/y LDZ2 #0008 + .Screen/y DEO2 - .cat/x LDZ2 DUP2 STH2 #0008 - .Screen/x DEO2 - DUP2 ;eye + .Screen/addr DEO2 + .cat/y LDZ2 #0008 ADD2 .Screen/y DEO2 + .cat/x LDZ2 DUP2 STH2 #0008 SUB2 .Screen/x DEO2 + DUP2 ;eye ADD2 .Screen/addr DEO2 ( draw ) #41 .Screen/color DEO STH2r .Screen/x DEO2 - ;eye #0010 + + .Screen/addr DEO2 + ;eye #0010 ADD2 ADD2 .Screen/addr DEO2 ( draw ) #41 .Screen/color DEO RTN @draw-tail ( frame* -- ) - .cat/y LDZ2 #0010 + .Screen/y DEO2 - .cat/x LDZ2 DUP2 STH2 #0008 - .Screen/x DEO2 + .cat/y LDZ2 #0010 ADD2 .Screen/y DEO2 + .cat/x LDZ2 DUP2 STH2 #0008 SUB2 .Screen/x DEO2 ;body .Screen/addr DEO2 ( draw ) #41 .Screen/color DEO STH2r .Screen/x DEO2 - #0010 * ;body #0010 + + .Screen/addr DEO2 + #0010 MUL2 ;body #0010 ADD2 ADD2 .Screen/addr DEO2 ( draw ) #41 .Screen/color DEO RTN @@ -126,17 +123,17 @@ RTN @draw-ground ( -- ) - .cat/y LDZ2 #0018 + .Screen/y DEO2 - .cat/x LDZ2 #0010 - .Screen/x DEO2 + .cat/y LDZ2 #0018 ADD2 .Screen/y DEO2 + .cat/x LDZ2 #0010 SUB2 .Screen/x DEO2 ;ground .Screen/addr DEO2 #00 #10 &loop ( draw ) #21 .Screen/color DEO - ( sety ) .Screen/addr DEI2 #0008 + .Screen/addr DEO2 - ( setx ) .Screen/x DEI2 #0008 + .Screen/x DEO2 + ( sety ) .Screen/addr DEI2 #0008 ADD2 .Screen/addr DEO2 + ( setx ) .Screen/x DEI2 #0008 ADD2 .Screen/x DEO2 ( incr ) SWP #01 ADD SWP - DUP2 LTH ,&loop JCN + LTHk ,&loop JCN POP2 RTN diff --git a/projects/demos/theme.usm b/projects/demos/theme.usm @@ -125,7 +125,7 @@ RTN &draw-hor ( draw ) #01 .Screen/color DEO ( incr ) SWP2 #0002 ADD2 DUP2 .Screen/x DEO2 SWP2 - OVR2 OVR2 LTH2 ,&draw-hor JCN + LTH2k ,&draw-hor JCN POP2 POP2 ( draw ver line ) @@ -134,7 +134,7 @@ RTN &draw-ver ( draw ) #02 .Screen/color DEO ( incr ) SWP2 #0002 ADD2 DUP2 .Screen/y DEO2 SWP2 - OVR2 OVR2 LTH2 ,&draw-ver JCN + LTH2k ,&draw-ver JCN POP2 POP2 ( draw blending modes ) @@ -145,7 +145,7 @@ RTN ( move ) OVR #08 MUL #00 SWP #0010 ADD2 .Screen/x DEO2 ( draw ) OVR .Screen/color DEO ( incr ) SWP #01 ADD SWP - DUP2 LTH ,&draw-pixel1 JCN + LTHk ,&draw-pixel1 JCN POP POP #0018 .Screen/y DEO2 #00 #08 @@ -153,7 +153,7 @@ RTN ( move ) OVR #08 MUL #00 SWP #0010 ADD2 .Screen/x DEO2 ( draw ) OVR #08 ADD .Screen/color DEO ( incr ) SWP #01 ADD SWP - DUP2 LTH ,&draw-pixel2 JCN + LTHk ,&draw-pixel2 JCN POP POP #0020 .Screen/y DEO2 #00 #08 @@ -161,7 +161,7 @@ RTN ( move ) OVR #08 MUL #00 SWP #0010 ADD2 .Screen/x DEO2 ( draw ) OVR #20 ADD .Screen/color DEO ( incr ) SWP #01 ADD SWP - DUP2 LTH ,&draw-icn1 JCN + LTHk ,&draw-icn1 JCN POP POP #0028 .Screen/y DEO2 #00 #08 @@ -169,7 +169,7 @@ RTN ( move ) OVR #08 MUL #00 SWP #0010 ADD2 .Screen/x DEO2 ( draw ) OVR #28 ADD .Screen/color DEO ( incr ) SWP #01 ADD SWP - DUP2 LTH ,&draw-icn2 JCN + LTHk ,&draw-icn2 JCN POP POP #0030 .Screen/y DEO2 #00 #08 @@ -177,7 +177,7 @@ RTN ( move ) OVR #08 MUL #00 SWP #0010 ADD2 .Screen/x DEO2 ( draw ) OVR #40 ADD .Screen/color DEO ( incr ) SWP #01 ADD SWP - DUP2 LTH ,&draw-chr1 JCN + LTHk ,&draw-chr1 JCN POP POP #0038 .Screen/y DEO2 #00 #08 @@ -185,7 +185,7 @@ RTN ( move ) OVR #08 MUL #00 SWP #0010 ADD2 .Screen/x DEO2 ( draw ) OVR #48 ADD .Screen/color DEO ( incr ) SWP #01 ADD SWP - DUP2 LTH ,&draw-chr2 JCN + LTHk ,&draw-chr2 JCN POP POP RTN @@ -293,10 +293,10 @@ RTN ( save ) OVR2 .Screen/x DEO2 ( draw ) .color LDZ .Screen/color DEO ( incr ) SWP2 #0001 ADD2 SWP2 - OVR2 OVR2 LTH2 ,&hor JCN + LTH2k ,&hor JCN POP2 POP2 STH2r STH2r ( incr ) SWP2 #0001 ADD2 SWP2 - OVR2 OVR2 LTH2 ,&ver JCN + LTH2k ,&ver JCN POP2 POP2 POP2 POP2 RTN