mirror of
https://git.sr.ht/~rabbits/uxn
synced 2024-11-04 21:35:04 +00:00
(life.tal) Make use of System/expansion
This commit is contained in:
parent
d8b83e80b5
commit
4885cbe23b
1 changed files with 19 additions and 27 deletions
|
@ -4,7 +4,7 @@
|
|||
( Any live cell with more than three live neighbours dies, as if by overpopulation. )
|
||||
( Any dead cell with exactly three live neighbours becomes a live cell, as if by reproduction. )
|
||||
|
||||
|00 @System &vector $2 &wst $1 &rst $1 &pad $4 &r $2 &g $2 &b $2
|
||||
|00 @System &vector $2 &expansion $2 &wst $1 &rst $1 &metadata $2 &r $2 &g $2 &b $2 &debug $1 &state $1
|
||||
|10 @Console &vector $2 &read $1 &pad $5 &write $1 &error $1
|
||||
|20 @Screen &vector $2 &width $2 &height $2 &auto $1 &pad $1 &x $2 &y $2 &addr $2 &pixel $1 &sprite $1
|
||||
|30 @Audio0 &vector $2 &position $2 &output $1 &pad $3 &adsr $2 &length $2 &addr $2 &volume $1 &pitch $1
|
||||
|
@ -62,11 +62,11 @@
|
|||
BRK
|
||||
|
||||
@on-control ( -> )
|
||||
( | toggle play )
|
||||
.Controller/key DEI #20 NEQ ?{
|
||||
;on-frame #0000 .Screen/vector DEI2 EQU2k ?{ ROT2 }
|
||||
POP2 POP2 .Screen/vector DEO2 }
|
||||
.Controller/button DEI #08 NEQ ?{ ;bank1 #0400 mclr }
|
||||
.Controller/key DEI
|
||||
( ) DUP #20 NEQ ?{
|
||||
#0000 ;on-frame .Screen/vector DEI2 ORA ?{ SWP2 }
|
||||
POP2 .Screen/vector DEO2 }
|
||||
( ) #1b NEQ ?{ ;mmu/clear1 .System/expansion DEO2 }
|
||||
BRK
|
||||
|
||||
(
|
||||
|
@ -74,7 +74,7 @@
|
|||
|
||||
@<run> ( -- )
|
||||
( | clear buffer )
|
||||
;bank2 #1000 mclr
|
||||
;mmu/clear2 .System/expansion DEO2
|
||||
( | <run> grid )
|
||||
#4000
|
||||
&ver ( -- )
|
||||
|
@ -85,7 +85,7 @@
|
|||
POP2 POPr INC GTHk ?&ver
|
||||
POP2
|
||||
( | move buffer )
|
||||
;bank2 ;bank1 #1000 mcpy
|
||||
;mmu/move21 .System/expansion DEO2
|
||||
( | draw )
|
||||
!<draw-grid>
|
||||
|
||||
|
@ -152,10 +152,12 @@
|
|||
|
||||
@<draw-short> ( short* -- )
|
||||
SWP <draw-byte>
|
||||
( >> )
|
||||
|
||||
@<draw-byte> ( byte color -- )
|
||||
DUP #04 SFT <draw-hex>
|
||||
#0f AND
|
||||
( >> )
|
||||
|
||||
@<draw-hex> ( char color -- )
|
||||
#00 SWP #30 SFT2 ;font-hex ADD2 .Screen/addr DEO2
|
||||
|
@ -169,6 +171,7 @@
|
|||
.Mouse/x DEI2 ,<draw-cursor>/x STR2
|
||||
.Mouse/y DEI2 ,<draw-cursor>/y STR2
|
||||
.Screen/addr DEO2
|
||||
( >> )
|
||||
|
||||
@<draw-cursor> ( color -- )
|
||||
[ LIT2 &x $2 ] .Screen/x DEO2
|
||||
|
@ -186,27 +189,14 @@
|
|||
POP2 POP2 POPr #01 JMP2r
|
||||
&skip POP2 POP2 POPr #00 JMP2r
|
||||
|
||||
(
|
||||
@|stdlib )
|
||||
|
||||
@mclr ( addr* len* -- )
|
||||
OVR2 ADD2 SWP2
|
||||
&loop ( -- )
|
||||
STH2k #00 STH2r STA
|
||||
INC2 GTH2k ?&loop
|
||||
POP2 POP2 JMP2r
|
||||
|
||||
@mcpy ( src* dst* len* -- )
|
||||
SWP2 STH2
|
||||
OVR2 ADD2 SWP2
|
||||
&loop ( -- )
|
||||
LDAk STH2kr STA
|
||||
INC2r INC2 GTH2k ?&loop
|
||||
POP2 POP2 POP2r JMP2r
|
||||
|
||||
(
|
||||
@|assets )
|
||||
|
||||
@mmu ( programs )
|
||||
&clear1 [ 01 1000 0000 =bank3 0000 =bank1 ]
|
||||
&clear2 [ 01 1000 0000 =bank3 0000 =bank2 ]
|
||||
&move21 [ 01 1000 0000 =bank2 0000 =bank1 ]
|
||||
|
||||
@cursor-icn [ 80c0 e0f0 f8e0 1000 ]
|
||||
|
||||
@fill-icn [ ffff ffff ffff ffff ]
|
||||
|
@ -226,5 +216,7 @@
|
|||
|
||||
@bank1 $1000
|
||||
|
||||
@bank2
|
||||
@bank2 $1000
|
||||
|
||||
@bank3 $1000
|
||||
|
||||
|
|
Loading…
Reference in a new issue