mirror of
https://git.sr.ht/~rabbits/uxn
synced 2024-12-18 06:20:18 +00:00
78 lines
1.4 KiB
Tal
78 lines
1.4 KiB
Tal
( Dev/File )
|
|
|
|
%8+ { #0008 ADD2 }
|
|
%MEMORY { #1000 }
|
|
|
|
( devices )
|
|
|
|
|00 @System [ &vector $2 &pad $6 &r $2 &g $2 &b $2 ]
|
|
|10 @Console [ &pad $8 &write $1 ]
|
|
|20 @Screen [ &vector $2 &width $2 &height $2 &pad $2 &x $2 &y $2 &addr $2 &pixel $1 &sprite $1 ]
|
|
|a0 @File [ &vector $2 &success $2 &offset $2 &pad $2 &name $2 &length $2 &load $2 &save $2 ]
|
|
|
|
( variables )
|
|
|
|
|0000
|
|
|
|
( init )
|
|
|
|
|0100 ( -> )
|
|
|
|
( theme )
|
|
#0efc .System/r DEO2
|
|
#03cc .System/g DEO2
|
|
#03ac .System/b DEO2
|
|
|
|
( load file )
|
|
#1000 .File/length DEO2
|
|
;srcpath .File/name DEO2
|
|
MEMORY .File/load DEO2
|
|
|
|
.File/success DEI2 ORA ;on-success JCN2
|
|
|
|
;failedtxt ;print-string JSR2
|
|
|
|
BRK
|
|
|
|
@on-success ( -> )
|
|
|
|
;successtxt ;print-string JSR2
|
|
|
|
( draw image )
|
|
MEMORY .Screen/addr DEO2
|
|
#0000 #0080
|
|
&ver
|
|
( save ) OVR2 .Screen/y DEO2
|
|
#0000 #0080
|
|
&hor
|
|
( save ) OVR2 .Screen/x DEO2
|
|
( draw ) #81 .Screen/sprite DEO
|
|
( incr ) .Screen/addr DEI2 #0010 ADD2 .Screen/addr DEO2
|
|
( incr ) SWP2 8+ SWP2
|
|
LTH2k ,&hor JCN
|
|
POP2 POP2
|
|
( incr ) SWP2 8+ SWP2
|
|
LTH2k ,&ver JCN
|
|
POP2 POP2
|
|
|
|
( save file )
|
|
#1000 .File/length DEO2
|
|
;dstpath .File/name DEO2
|
|
MEMORY .File/save DEO2
|
|
|
|
BRK
|
|
|
|
@print-string ( ptr* -- )
|
|
LDAk DUP ,&keep-going JCN
|
|
POP POP2 JMP2r
|
|
|
|
&keep-going
|
|
.Console/write DEO
|
|
#0001 ADD2
|
|
,print-string JMP
|
|
|
|
@successtxt "Success! 09 $1
|
|
@failedtxt "Failed. 09 $1
|
|
|
|
@srcpath "projects/pictures/ako10x10.chr $1
|
|
@dstpath "bin/image-copy.chr $1
|