uxn

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

commit 79e085088a67e4ed21288e9715feeaf5df680317
parent f348d246068119cf60e2166b804657f90e0ca690
Author: Devine Lu Linvega <aliceffekt@gmail.com>
Date:   Sun, 14 Aug 2022 12:17:44 -0700

Optimized a few examples

Diffstat:
Mprojects/examples/demos/amiga.tal | 41+++++++++++++++++------------------------
Mprojects/examples/demos/bifurcan.tal | 3---
Mprojects/examples/demos/bunnymark.tal | 4++--
Mprojects/examples/demos/life.tal | 20++++++++++----------
Mprojects/examples/demos/polycat.tal | 4++--
5 files changed, 31 insertions(+), 41 deletions(-)

diff --git a/projects/examples/demos/amiga.tal b/projects/examples/demos/amiga.tal @@ -44,30 +44,6 @@ BRK BRK -@clear-ball ( -- ) - - .ball/x LDZ2 .Screen/x DEO2 - .ball/y LDZ2 .Screen/y DEO2 - #76 .Screen/auto DEO - #0800 - &loop-bg - #40 .Screen/sprite DEO - INC GTHk ,&loop-bg JCN - POP2 - -JMP2r - -@move-ball ( -- ) - - ,clear-ball JSR - .ball/vx LDZ2k STH2k ROT STZ2 - .ball/x LDZ2k STH2r ADD2 ,check-flip-vx JSR ROT STZ2 - .ball/vy LDZ2k INC2 STH2k ROT STZ2 - .ball/y LDZ2k STH2r ADD2 ,check-flip-vy JSR ROT STZ2 - ,draw-ball JSR - -JMP2r - @check-flip-vx ( x -- x ) ( left ) DUP2 #0010 LTH2 ,&flip JCN @@ -85,6 +61,23 @@ JMP2r JMP2r +@move-ball ( -- ) + + ( clear ) + .ball/x LDZ2 .Screen/x DEO2 + .ball/y LDZ2 .Screen/y DEO2 + #76 .Screen/auto DEO + #0800 + &loop-bg + #40 .Screen/sprite DEO + INC GTHk ,&loop-bg JCN + POP2 + + .ball/vx LDZ2k STH2k ROT STZ2 + .ball/x LDZ2k STH2r ADD2 ,check-flip-vx JSR ROT STZ2 + .ball/vy LDZ2k INC2 STH2k ROT STZ2 + .ball/y LDZ2k STH2r ADD2 ,check-flip-vy JSR ROT STZ2 + @draw-ball ( -- ) ( shadow ) diff --git a/projects/examples/demos/bifurcan.tal b/projects/examples/demos/bifurcan.tal @@ -90,9 +90,6 @@ JMP2r [ .center/x LDZ2 #0008 ADD2 ] [ .center/y LDZ2 #0018 ADD2 ] .DateTime/second DEI #0a ;mod JSR2 - ;draw-number JSR2 - -JMP2r @draw-number ( x* y* n -- ) diff --git a/projects/examples/demos/bunnymark.tal b/projects/examples/demos/bunnymark.tal @@ -110,9 +110,9 @@ BRK ( top ) [ LDA2k ] #05 SFT2 .Screen/x DEO2 [ INC2 INC2 LDA2 ] #05 SFT2 .Screen/y DEO2 - #85 ,draw-sprite JSR + #85 ,draw-sprite ( .. ) -JMP2r +JMP @draw-sprite ( color -- ) diff --git a/projects/examples/demos/life.tal b/projects/examples/demos/life.tal @@ -31,11 +31,11 @@ ;on-mouse .Mouse/vector DEO2 ;on-control .Controller/vector DEO2 ( glider ) - #07 #03 ;set-cell JSR2 - #07 #04 ;set-cell JSR2 - #05 #04 ;set-cell JSR2 - #07 #05 ;set-cell JSR2 - #06 #05 ;set-cell JSR2 + #0703 ;set-cell JSR2 + #0704 ;set-cell JSR2 + #0504 ;set-cell JSR2 + #0705 ;set-cell JSR2 + #0605 ;set-cell JSR2 ( center ) .Screen/width DEI2 #01 SFT2 #0040 SUB2 DUP2 .anchor/x STZ2 @@ -118,9 +118,9 @@ BRK ( move buffer ) ;bank2 ;bank1 #1000 ;mcpy JSR2 ( draw ) - ;draw-grid JSR2 + ;draw-grid ( .. ) -JMP2r +JMP2 @run-cell ( x y -- ) @@ -130,13 +130,13 @@ JMP2r #00 EQU ,&dead JCN DUP #02 LTH ,&dies JCN DUP #03 GTH ,&dies JCN - POP ;&save JSR2 JMP2r + POP ;&save JMP2 &dies POP POP2 JMP2r &dead DUP #03 EQU ,&birth JCN POP POP2 JMP2r - &birth POP ;&save JSR2 + &birth POP ;&save ( .. ) -JMP2r +JMP2 &save ( x y -- ) STH2 #01 STH2r ,get-index JSR [ #1000 ADD2 ] STA .world/count LDZ2 INC2 .world/count STZ2 diff --git a/projects/examples/demos/polycat.tal b/projects/examples/demos/polycat.tal @@ -54,9 +54,9 @@ BRK #81 .Screen/sprite DEO ( eye/tail ) #00 ,draw-eye JSR - #00 ;draw-tail JSR2 + #00 ;draw-tail ( .. ) -JMP2r +JMP2 @on-mouse ( -> )