uxn

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

commit 4abb47e6e10b679057d30a7bcade58d54b56e525
parent cd01d69b8a309429075271781f90d0db21f78019
Author: Andrew Alderwick <andrew@alderwick.co.uk>
Date:   Thu, 10 Nov 2022 22:49:53 +0000

Remove all symbol macros from projects.

Diffstat:
Mprojects/examples/demos/mandelbrot.tal | 3---
Mprojects/examples/demos/snake.tal | 38+++++++++++++++++---------------------
Mprojects/examples/old/dungeon.tal | 33++++++++++++++-------------------
Mprojects/examples/old/rule110.tal | 25++++++++++---------------
4 files changed, 41 insertions(+), 58 deletions(-)

diff --git a/projects/examples/demos/mandelbrot.tal b/projects/examples/demos/mandelbrot.tal @@ -1,8 +1,5 @@ ( mandelbrot ) -%+ { ADD } %- { SUB } %* { MUL } %/ { DIV } -%< { LTH } %> { GTH } %= { EQU } %! { NEQ } - %GTS2 { #8000 ADD2 SWP2 #8000 ADD2 LTH2 } %AUTO-X { #01 .Screen/auto DEO } %NEXT-LINE { #0000 .Screen/x DEO2 .Screen/y DEI2k INC2 ROT DEO2 } diff --git a/projects/examples/demos/snake.tal b/projects/examples/demos/snake.tal @@ -1,9 +1,5 @@ ( uxnasm projects/examples/demos/snake.tal bin/snake.rom && uxnemu bin/snake.rom ) -%+ { ADD } %/ { DIV } -%< { LTH } %> { GTH } %! { NEQ } -%++ { ADD2 } %// { DIV2 } -%<< { LTH2 } %>> { GTH2 } %!! { NEQ2 } %2/ { #01 SFT } %2* { #10 SFT } %8// { #03 SFT2 } %8** { #30 SFT2 } %MOD { DIVk MUL SUB } @@ -69,7 +65,7 @@ BRK ( clear ) #00 ;draw-snake JSR2 ( update ) ;move JSR2 - ( draw ) #02 .snake/dead LDZ + ;draw-snake JSR2 + ( draw ) #02 .snake/dead LDZ ADD ;draw-snake JSR2 #83 ;draw-apple JSR2 ( score ) .snake/length LDZ #41 ;draw-score JSR2 ( reset ) #00 .arena/timer STZ @@ -79,7 +75,7 @@ BRK @on-button ( -> ) .Controller/button DEI - DUP #08 ! ,&no-escape JCN + DUP #08 NEQ ,&no-escape JCN ;reset JSR2 &no-escape #04 SFT DUP #00 EQU ,&skip JCN @@ -111,8 +107,8 @@ RTN .snake/x LDZ2 STH2 .snake/length LDZ #00 &loop - ( pop ) DUP 2* .snake/tail + LDZ2 STH2 SWP2r - ( push ) DUP 2* .snake/tail + STH2r ROT STZ2 + ( pop ) DUP 2* .snake/tail ADD LDZ2 STH2 SWP2r + ( push ) DUP 2* .snake/tail ADD STH2r ROT STZ2 INC GTHk ,&loop JCN POP2 POP2r @@ -120,22 +116,22 @@ RTN .snake/dead LDZ #00 EQU JMP RTN .snake/direction LDZ - DUP #01 ! ,&no-up JCN + DUP #01 NEQ ,&no-up JCN .snake/y LDZ #01 SUB .arena/h LDZ MAX .snake/y STZ &no-up - DUP #02 ! ,&no-down JCN + DUP #02 NEQ ,&no-down JCN .snake/y LDZ INC .arena/h LDZ MOD .snake/y STZ &no-down - DUP #04 ! ,&no-left JCN + DUP #04 NEQ ,&no-left JCN .snake/x LDZ #01 SUB .arena/w LDZ MAX .snake/x STZ &no-left - DUP #08 ! ,&no-right JCN + DUP #08 NEQ ,&no-right JCN .snake/x LDZ INC .arena/w LDZ MOD .snake/x STZ @@ -152,7 +148,7 @@ RTN .snake/length LDZ #01 &loop-body - ( pop ) DUP 2* .snake/tail + LDZ2 + ( pop ) DUP 2* .snake/tail ADD LDZ2 .snake/x LDZ2 NEQ2 ,&no-collision-body JCN #01 .snake/dead STZ #03 ;draw-snake JSR2 @@ -164,9 +160,9 @@ RTN @add-apple ( -- ) - .DateTime/hour DEI2 .DateTime/minute DEI2 MUL2 #1234 MUL2 + + .DateTime/hour DEI2 .DateTime/minute DEI2 MUL2 #1234 MUL2 ADD .arena/w LDZ MOD .apple/x STZ - .DateTime/hour DEI2 .DateTime/minute DEI2 MUL2 #abcd MUL2 + + .DateTime/hour DEI2 .DateTime/minute DEI2 MUL2 #abcd MUL2 ADD .arena/h LDZ MOD .apple/y STZ RTN @@ -178,8 +174,8 @@ RTN ;snake-icns .Screen/addr DEO2 .snake/length LDZ #00 &loop - DUP 2* .snake/tail + LDZ TOS 8** .Screen/x DEO2 - DUP 2* .snake/tail + INC LDZ TOS 8** .Screen/y DEO2 + DUP 2* .snake/tail ADD LDZ TOS 8** .Screen/x DEO2 + DUP 2* .snake/tail ADD INC LDZ TOS 8** .Screen/y DEO2 STHkr .Screen/sprite DEO INC GTHk ,&loop JCN POP2 @@ -205,11 +201,11 @@ RTN STH #0010 .Screen/x DEO2 #0010 .Screen/y DEO2 - DUP #04 SFT TOS 8** ;font-hex ++ .Screen/addr DEO2 - .Screen/x DEI2 #0008 ++ .Screen/x DEO2 + DUP #04 SFT TOS 8** ;font-hex ADD2 .Screen/addr DEO2 + .Screen/x DEI2 #0008 ADD2 .Screen/x DEO2 ( draw ) STHkr .Screen/sprite DEO - #0f AND TOS 8** ;font-hex ++ .Screen/addr DEO2 - .Screen/x DEI2 #0008 ++ .Screen/x DEO2 + #0f AND TOS 8** ;font-hex ADD2 .Screen/addr DEO2 + .Screen/x DEI2 #0008 ADD2 .Screen/x DEO2 ( draw ) STHr .Screen/sprite DEO RTN diff --git a/projects/examples/old/dungeon.tal b/projects/examples/old/dungeon.tal @@ -1,10 +1,5 @@ ( art by @ritualdust ) -%+ { ADD } %/ { DIV } -%< { LTH } %> { GTH } %! { NEQ } -%++ { ADD2 } %-- { SUB2 } %// { DIV2 } -%<< { LTH2 } %>> { GTH2 } %!! { NEQ2 } - %8** { #30 SFT2 } %10** { #40 SFT2 } @@ -64,28 +59,28 @@ BRK @on-button ( -> ) .Controller/button DEI - DUP #00 ! ,&no-null JCN + DUP #00 NEQ ,&no-null JCN POP BRK &no-null - DUP #10 ! ,&no-up JCN + DUP #10 NEQ ,&no-up JCN #00 .player/d STZ #00 ;draw-mouse JSR2 .player/y LDZk DEC SWP STZ MOUSE ;draw-mouse JSR2 &no-up - DUP #20 ! ,&no-down JCN + DUP #20 NEQ ,&no-down JCN #01 .player/d STZ #00 ;draw-mouse JSR2 .player/y LDZk INC SWP STZ MOUSE ;draw-mouse JSR2 &no-down - DUP #40 ! ,&no-left JCN + DUP #40 NEQ ,&no-left JCN #02 .player/d STZ #00 ;draw-mouse JSR2 .player/x LDZk DEC SWP STZ MOUSE ;draw-mouse JSR2 &no-left - DUP #80 ! ,&no-right JCN + DUP #80 NEQ ,&no-right JCN #03 .player/d STZ #00 ;draw-mouse JSR2 .player/x LDZk INC SWP STZ @@ -103,10 +98,10 @@ BRK @draw-mouse ( color -- ) - ;spritesheet #29 .player/d LDZ + TOS DUP2 DEBUG2 10** ++ .Screen/addr DEO2 - .player/x LDZ TOS 8** .room/x LDZ2 ++ .Screen/x DEO2 - .player/y LDZ TOS 8** .room/y LDZ2 ++ .Screen/y DEO2 - #40 + .Screen/sprite DEO + ;spritesheet #29 .player/d LDZ ADD TOS DUP2 DEBUG2 10** ADD2 .Screen/addr DEO2 + .player/x LDZ TOS 8** .room/x LDZ2 ADD2 .Screen/x DEO2 + .player/y LDZ TOS 8** .room/y LDZ2 ADD2 .Screen/y DEO2 + #40 ADD .Screen/sprite DEO RTN @@ -115,13 +110,13 @@ RTN STH2 #1000 &ver - DUP TOS 8** .room/y LDZ2 ++ .Screen/y DEO2 + DUP TOS 8** .room/y LDZ2 ADD2 .Screen/y DEO2 #1000 &hor - DUP TOS 8** .room/x LDZ2 ++ .Screen/x DEO2 - ( get id ) STH2 DUP STH2r ROT OVR SWP #40 SFT + TOS - ( tile ) DUP2 STH2kr ++ LDA TOS 10** ;spritesheet ++ .Screen/addr DEO2 - ( color ) STH2kr #0100 ++ ++ LDA .Screen/sprite DEO + DUP TOS 8** .room/x LDZ2 ADD2 .Screen/x DEO2 + ( get id ) STH2 DUP STH2r ROT OVR SWP #40 SFT ADD TOS + ( tile ) DUP2 STH2kr ADD2 LDA TOS 10** ;spritesheet ADD2 .Screen/addr DEO2 + ( color ) STH2kr #0100 ADD2 ADD2 LDA .Screen/sprite DEO INC GTHk ,&hor JCN POP2 INC GTHk ,&ver JCN diff --git a/projects/examples/old/rule110.tal b/projects/examples/old/rule110.tal @@ -2,11 +2,6 @@ ( uxnasm rule110.tal rule110.rom && uxnemu rule110.rom ) -%+ { ADD } %* { MUL } %/ { DIV } -%< { LTH } %> { GTH } %! { NEQ } -%++ { ADD2 } %** { MUL2 } %// { DIV2 } -%<< { LTH2 } %>> { GTH2 } %!! { NEQ2 } - %2* { #10 SFT } %2/ { #01 SFT } %2** { #10 SFT2 } %2// { #01 SFT2 } %4* { #20 SFT } %4/ { #02 SFT } %4** { #20 SFT2 } %4// { #02 SFT2 } %8* { #30 SFT } %8/ { #03 SFT } %8** { #30 SFT2 } %8// { #03 SFT2 } @@ -18,8 +13,8 @@ %8MOD { #07 AND } %8MOD2 { #0007 AND2 } %10MOD { #0f AND } %10MOD2 { #000f AND2 } -%ROL2 { DUP2 #0f SFT2 SWP2 #10 SFT2 ++ } -%ROR2 { DUP2 #f0 SFT2 SWP2 #01 SFT2 ++ } +%ROL2 { DUP2 #0f SFT2 SWP2 #10 SFT2 ADD2 } +%ROR2 { DUP2 #f0 SFT2 SWP2 #01 SFT2 ADD2 } %DEBUG { ;print-hex/byte JSR2 #0a18 DEO } %DEBUG2 { ;print-hex JSR2 #0a18 DEO } @@ -79,8 +74,8 @@ RTN ( shift ) INCk #10 SWP SUB ( get address ) STHkr 2* LDZ2 ( bit ) ROT SFT2 #0001 AND2 - ( get sprite ) 8** ;cell-icns ++ .Screen/addr DEO2 - #01 STHkr #00 EQU + .Screen/sprite DEO + ( get sprite ) 8** ;cell-icns ADD2 .Screen/addr DEO2 + #01 STHkr #00 EQU ADD .Screen/sprite DEO INC GTHk ,&loop JCN POP2 POPr @@ -93,10 +88,10 @@ RTN ROL2 STH2 #1000 &loop - ( get 3-bits ) STH2kr #e000 AND2 #0d SFT2 ;rule ++ LDA STH + ( get 3-bits ) STH2kr #e000 AND2 #0d SFT2 ;rule ADD2 LDA STH ( get result ) DUP #40 SFT #00 STHr ROT SFT2 ( reset ) ROR2 ROR2 ROR2 - ( save ) ,&res LDR2 ++ ,&res STR2 + ( save ) ,&res LDR2 ADD2 ,&res STR2 STH2r ROR2 STH2 INC GTHk ,&loop JCN POP2 @@ -123,10 +118,10 @@ RTN .Mouse/y DEI2 DUP2 ,&y STR2 .Screen/y DEO2 ( colorize on state ) - #43 [ .Mouse/state DEI #00 ! ] SUB .Screen/sprite DEO + #43 [ .Mouse/state DEI #00 NEQ ] SUB .Screen/sprite DEO ( on click ) - .Mouse/state DEI #00 ! JMP BRK + .Mouse/state DEI #00 NEQ JMP BRK ( toggle bit ) .input LDZ2k @@ -145,8 +140,8 @@ BRK STHk #04 SFT ,&parse JSR #18 DEO STHr #0f AND ,&parse JSR #18 DEO RTN - &parse ( byte -- char ) DUP #09 GTH ,&above JCN #30 + RTN - &above #57 + RTN + &parse ( byte -- char ) DUP #09 GTH ,&above JCN #30 ADD RTN + &above #57 ADD RTN RTN