mirror of
https://git.sr.ht/~rabbits/uxn
synced 2024-12-17 22:10:14 +00:00
Experimenting with macros
This commit is contained in:
parent
cda9b0bce8
commit
68a253e67e
2 changed files with 21 additions and 14 deletions
|
@ -32,9 +32,6 @@ contexts:
|
||||||
- match: '\&(\S+)\s?'
|
- match: '\&(\S+)\s?'
|
||||||
scope: entity.name.type
|
scope: entity.name.type
|
||||||
pop: true
|
pop: true
|
||||||
- match: '\=(\S+)\s?'
|
|
||||||
scope: entity.name.type
|
|
||||||
pop: true
|
|
||||||
|
|
||||||
# Pushing to stack
|
# Pushing to stack
|
||||||
|
|
||||||
|
@ -53,6 +50,13 @@ contexts:
|
||||||
scope: keyword.control
|
scope: keyword.control
|
||||||
pop: true
|
pop: true
|
||||||
|
|
||||||
|
- match: '\[\s?'
|
||||||
|
scope: comment
|
||||||
|
pop: true
|
||||||
|
- match: '\]\s?'
|
||||||
|
scope: comment
|
||||||
|
pop: true
|
||||||
|
|
||||||
|
|
||||||
# Blocks
|
# Blocks
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,9 @@
|
||||||
%++ { #0001 ADD2 } %-- { #0001 SUB2 }
|
%++ { #0001 ADD2 } %-- { #0001 SUB2 }
|
||||||
%2/ { #0002 DIV2 }
|
%2/ { #0002 DIV2 }
|
||||||
|
|
||||||
|
%=>SC/ADDR { .Screen/addr IOW2 }
|
||||||
|
%->SC/COLR { .Screen/color IOW }
|
||||||
|
|
||||||
( variables )
|
( variables )
|
||||||
|
|
||||||
@slime $1
|
@slime $1
|
||||||
|
@ -27,8 +30,8 @@
|
||||||
( set origin )
|
( set origin )
|
||||||
.Screen/width IOR2 2/ .Screen/x IOW2
|
.Screen/width IOR2 2/ .Screen/x IOW2
|
||||||
.Screen/height IOR2 2/ .Screen/y IOW2
|
.Screen/height IOR2 2/ .Screen/y IOW2
|
||||||
;default_icn .Screen/addr IOW2
|
;default_icn =>SC/ADDR
|
||||||
#31 .Screen/color IOW
|
#31 ->SC/COLR
|
||||||
#2a .slime POK
|
#2a .slime POK
|
||||||
|
|
||||||
BRK
|
BRK
|
||||||
|
@ -36,7 +39,7 @@ BRK
|
||||||
@on-frame
|
@on-frame
|
||||||
|
|
||||||
#2a .slime POK
|
#2a .slime POK
|
||||||
;default_icn .Screen/addr IOW2
|
;default_icn =>SC/ADDR
|
||||||
|
|
||||||
( hold ctrl key to change slime color )
|
( hold ctrl key to change slime color )
|
||||||
.Controller/button IOR #0f AND
|
.Controller/button IOR #0f AND
|
||||||
|
@ -44,34 +47,34 @@ BRK
|
||||||
DUP #02 NEQ ,&no-alt JNZ #2f .slime POK &no-alt
|
DUP #02 NEQ ,&no-alt JNZ #2f .slime POK &no-alt
|
||||||
POP
|
POP
|
||||||
|
|
||||||
( clear ) #30 .Screen/color IOW
|
( clear ) #30 ->SC/COLR
|
||||||
|
|
||||||
( detect movement )
|
( detect movement )
|
||||||
.Controller/button IOR #f0 AND
|
.Controller/button IOR #f0 AND
|
||||||
DUP #04 SFT #01 AND #01 NEQ ,&no-up JNZ
|
DUP #04 SFT #01 AND #01 NEQ ,&no-up JNZ
|
||||||
( move )
|
( move )
|
||||||
.Screen/y IOR2 -- .Screen/y IOW2
|
.Screen/y IOR2 -- .Screen/y IOW2
|
||||||
;up_icn .Screen/addr IOW2 &no-up
|
;up_icn =>SC/ADDR &no-up
|
||||||
DUP #05 SFT #01 AND #01 NEQ ,&no-down JNZ
|
DUP #05 SFT #01 AND #01 NEQ ,&no-down JNZ
|
||||||
( move )
|
( move )
|
||||||
.Screen/y IOR2 ++ .Screen/y IOW2
|
.Screen/y IOR2 ++ .Screen/y IOW2
|
||||||
;down_icn .Screen/addr IOW2 &no-down
|
;down_icn =>SC/ADDR &no-down
|
||||||
DUP #06 SFT #01 AND #01 NEQ ,&no-left JNZ
|
DUP #06 SFT #01 AND #01 NEQ ,&no-left JNZ
|
||||||
( move )
|
( move )
|
||||||
.Screen/x IOR2 -- .Screen/x IOW2
|
.Screen/x IOR2 -- .Screen/x IOW2
|
||||||
;left_icn .Screen/addr IOW2 &no-left
|
;left_icn =>SC/ADDR &no-left
|
||||||
DUP #07 SFT #01 AND #01 NEQ ,&no-right JNZ
|
DUP #07 SFT #01 AND #01 NEQ ,&no-right JNZ
|
||||||
( move )
|
( move )
|
||||||
.Screen/x IOR2 ++ .Screen/x IOW2
|
.Screen/x IOR2 ++ .Screen/x IOW2
|
||||||
;right_icn .Screen/addr IOW2 &no-right
|
;right_icn =>SC/ADDR &no-right
|
||||||
POP
|
POP
|
||||||
|
|
||||||
( draw face )
|
( draw face )
|
||||||
#31 .Screen/color IOW
|
#31 ->SC/COLR
|
||||||
|
|
||||||
( draw slime )
|
( draw slime )
|
||||||
;slime_icn .Screen/addr IOW2
|
;slime_icn =>SC/ADDR
|
||||||
.slime PEK .Screen/color IOW
|
.slime PEK ->SC/COLR
|
||||||
|
|
||||||
BRK
|
BRK
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue