0
0
Fork 0
mirror of https://git.sr.ht/~rabbits/uxn synced 2024-10-31 19:42:39 +00:00
uxn/projects/examples/blank.tal

81 lines
2.8 KiB
Tal
Raw Normal View History

2021-03-30 16:28:11 +00:00
( a blank file )
2021-12-11 22:28:10 +00:00
%+ { ADD } %- { SUB } %* { MUL } %/ { DIV }
%< { LTH } %> { GTH } %= { EQU } %! { NEQ }
%++ { ADD2 } %-- { SUB2 } %** { MUL2 } %// { DIV2 }
%<< { LTH2 } %>> { GTH2 } %== { EQU2 } %!! { 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 }
%10* { #40 SFT } %10/ { #04 SFT } %10** { #40 SFT2 } %10// { #04 SFT2 }
%20* { #50 SFT } %20/ { #05 SFT } %20** { #50 SFT2 } %20// { #05 SFT2 }
%2MOD { #01 AND } %2MOD2 { #0001 AND2 }
%4MOD { #03 AND } %4MOD2 { #0003 AND2 }
%8MOD { #07 AND } %8MOD2 { #0007 AND2 }
%10MOD { #0f AND } %10MOD2 { #000f AND2 }
%HALT { #010f DEO }
%EMIT { #18 DEO }
%DEBUG { ;print/byte JSR2 #0a EMIT }
%DEBUG2 { ;print/short JSR2 #0a EMIT }
2021-12-11 22:28:10 +00:00
%RTN { JMP2r }
2021-05-06 03:16:27 +00:00
2021-03-30 16:28:11 +00:00
( devices )
2022-01-05 17:27:01 +00:00
|00 @System &vector $2 &wst $1 &rst $1 &eaddr $2 &ecode $1 &pad $1 &r $2 &g $2 &b $2 &debug $1 &halt $1
2021-12-28 18:45:34 +00:00
|10 @Console &vector $2 &read $1 &pad $5 &write $1 &error $1
2022-01-05 17:27:01 +00:00
|20 @Screen &vector $2 &width $2 &height $2 &auto $1 &pad $1 &x $2 &y $2 &addr $2 &pixel $1 &sprite $1
2021-12-28 19:21:56 +00:00
|30 @Audio0 &vector $2 &position $2 &output $1 &pad $3 &adsr $2 &length $2 &addr $2 &volume $1 &pitch $1
|40 @Audio1 &vector $2 &position $2 &output $1 &pad $3 &adsr $2 &length $2 &addr $2 &volume $1 &pitch $1
|50 @Audio2 &vector $2 &position $2 &output $1 &pad $3 &adsr $2 &length $2 &addr $2 &volume $1 &pitch $1
|60 @Audio3 &vector $2 &position $2 &output $1 &pad $3 &adsr $2 &length $2 &addr $2 &volume $1 &pitch $1
|80 @Controller &vector $2 &button $1 &key $1 &func $1
2021-12-28 19:21:56 +00:00
|90 @Mouse &vector $2 &x $2 &y $2 &state $1 &pad $3 &scrollx $2 &scrolly $2
|a0 @File0 &vector $2 &success $2 &stat $2 &delete $1 &append $1 &name $2 &length $2 &read $2 &write $2
|b0 @File1 &vector $2 &success $2 &stat $2 &delete $1 &append $1 &name $2 &length $2 &read $2 &write $2
|c0 @DateTime &year $2 &month $1 &day $1 &hour $1 &minute $1 &second $1 &dotw $1 &doty $2 &isdst $1
2021-04-21 20:13:39 +00:00
( variables )
|0000
( program )
|0100 ( -> )
2021-03-30 16:28:11 +00:00
2021-07-04 03:24:36 +00:00
( theme )
#0fe5 .System/r DEO2
#0fc5 .System/g DEO2
#0f25 .System/b DEO2
2021-12-11 22:28:10 +00:00
BRK
2021-07-04 03:24:36 +00:00
@print ( short* -- )
&short ( short* -- ) SWP ,&byte JSR
&byte ( byte -- ) DUP #04 SFT ,&char JSR
&char ( char -- ) #0f AND DUP #09 GTH #27 MUL ADD #30 ADD EMIT
2021-07-04 03:24:36 +00:00
2021-12-11 22:28:10 +00:00
RTN
2021-07-04 03:24:36 +00:00
2021-12-11 22:28:10 +00:00
@print-dec ( value* -- )
2021-07-04 03:24:36 +00:00
2021-12-11 22:28:10 +00:00
#2710 DIV2k DUP #30 ADD #18 DEO MUL2 SUB2
#03e8 DIV2k DUP #30 ADD #18 DEO MUL2 SUB2
#0064 DIV2k DUP #30 ADD #18 DEO MUL2 SUB2
#000a DIV2k DUP #30 ADD #18 DEO MUL2 SUB2
#30 ADD #18 DEO POP
2021-07-04 03:24:36 +00:00
RTN
2021-12-11 22:28:10 +00:00
@print-str ( string* -- )
#0001 --
2021-12-11 22:28:10 +00:00
&while
INC2 LDAk DUP #18 DEO ,&while JCN
POP2
2021-04-23 02:57:47 +00:00
2021-07-04 03:24:36 +00:00
RTN