113 lines
5.5 KiB
Tal
113 lines
5.5 KiB
Tal
( a blank file )
|
|
|
|
%+ { ADD } %- { SUB } %/ { DIV }
|
|
%< { LTH } %> { GTH } %= { EQU } %! { NEQ }
|
|
%++ { ADD2 } %-- { SUB2 } %// { DIV2 }
|
|
%<< { LTH2 } %>> { GTH2 } %== { EQU2 } %!! { NEQ2 }
|
|
|
|
%DEBUG { ;print-hex JSR2 #0a .Console/write DEO }
|
|
%DEBUG2 { SWP ;print-hex JSR2 ;print-hex JSR2 #0a .Console/write DEO }
|
|
|
|
%MOD { DIVk MUL SUB }
|
|
%MOD2 { DIV2k MUL2 SUB2 }
|
|
|
|
%RTN { JMP2r }
|
|
|
|
( devices )
|
|
|
|
|00 @System [ &vector $2 &wst $1 &rst $1 &pad $4 &r $2 &g $2 &b $2 &debug $1 &halt $1 ]
|
|
|10 @Console [ &vector $2 &read $1 &pad $5 &write $1 &error $1 ]
|
|
|20 @Screen [ &vector $2 &width $2 &height $2 &pad $2 &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 ]
|
|
|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 ]
|
|
|90 @Mouse [ &vector $2 &x $2 &y $2 &state $1 &wheel $1 ]
|
|
|a0 @File [ &vector $2 &success $2 &stat $2 &delete $1 &append $1 &name $2 &length $2 &read $2 &write $2 ]
|
|
|b0 @DateTime [ &year $2 &month $1 &day $1 &hour $1 &minute $1 &second $1 &dotw $1 &doty $2 &isdst $1 ]
|
|
|
|
( variables )
|
|
|
|
|0000
|
|
|
|
@scrollpos $2
|
|
@loop $2
|
|
|
|
( program )
|
|
|
|
|0100 ( -> )
|
|
#0f00 .System/r DEO2
|
|
#00f0 .System/g DEO2
|
|
#000f .System/b DEO2
|
|
.Screen/height DEI2 #0002 DIV2 .Screen/y DEO2
|
|
.Screen/width DEI2 .scrollpos STZ2
|
|
;redraw/run .Screen/vector DEO2
|
|
BRK
|
|
|
|
@redraw ( -> )
|
|
&charpos $2
|
|
&run
|
|
;font .Screen/addr DEO2
|
|
#00 .Screen/sprite DEO ( clear up remnants of last one )
|
|
#0000 ,&charpos STR2
|
|
#0000 STH2
|
|
&loop
|
|
STH2rk ;text ADD2 LDA #00 EQU ,&end JCN
|
|
( draw new )
|
|
;font #0008 ;text STH2rk ADD2 LDA #20 SUB #00 SWP MUL2 ADD2 .Screen/addr DEO2
|
|
,&charpos LDR2 .scrollpos LDZ2 ADD2 .Screen/x DEO2
|
|
STH2rk
|
|
.scrollpos LDZ2
|
|
#0008 DIV2 ADD2
|
|
#0010 MOD2
|
|
.Screen/height DEI2 #0002 DIV2 ADD2
|
|
.Screen/y DEO2 ( do wave motion )
|
|
STH2rk SWP POP ( get low byte of counter )
|
|
#03 MOD #01 ADD .Screen/sprite DEO
|
|
STH2r #0001 ADD2 STH2 ( increment counter )
|
|
,&charpos LDR2 #0008 ADD2 ,&charpos STR2 ( increment character position )
|
|
,&loop JMP
|
|
&end
|
|
.scrollpos LDZ2 #0000 STH2r #0008 MUL2 SUB2 EQU2 ,&resetscroll JCN
|
|
.scrollpos LDZ2 #0002 SUB2 .scrollpos STZ2 ( scroll forward )
|
|
BRK
|
|
&resetscroll
|
|
.Screen/width DEI2 .scrollpos STZ2
|
|
BRK
|
|
|
|
@print-hex ( value -- )
|
|
|
|
STHk #04 SFT ,&parse JSR .Console/write DEO
|
|
STHr #0f AND ,&parse JSR .Console/write DEO
|
|
RTN
|
|
&parse ( value -- char )
|
|
DUP #09 GTH ,&above JCN #30 ADD RTN &above #09 SUB #60 ADD RTN
|
|
|
|
@big-sprite ( color -- )
|
|
STH
|
|
RTN
|
|
|
|
@text 'h 'e 'l 'l 'o 20 'v 'a 'r 'v 'a 'r 'a '! 00
|
|
|
|
@sin-pcm
|
|
8083 8689 8c8f 9295 989b 9ea1 a4a7 aaad
|
|
b0b3 b6b9 bbbe c1c3 c6c9 cbce d0d2 d5d7
|
|
d9db dee0 e2e4 e6e7 e9eb ecee f0f1 f2f4
|
|
f5f6 f7f8 f9fa fbfb fcfd fdfe fefe fefe
|
|
fffe fefe fefe fdfd fcfb fbfa f9f8 f7f6
|
|
f5f4 f2f1 f0ee eceb e9e7 e6e4 e2e0 dedb
|
|
d9d7 d5d2 d0ce cbc9 c6c3 c1be bbb9 b6b3
|
|
b0ad aaa7 a4a1 9e9b 9895 928f 8c89 8683
|
|
807d 7a77 7471 6e6b 6865 625f 5c59 5653
|
|
504d 4a47 4542 3f3d 3a37 3532 302e 2b29
|
|
2725 2220 1e1c 1a19 1715 1412 100f 0e0c
|
|
0b0a 0908 0706 0505 0403 0302 0202 0202
|
|
0102 0202 0202 0303 0405 0506 0708 090a
|
|
0b0c 0e0f 1012 1415 1719 1a1c 1e20 2225
|
|
2729 2b2e 3032 3537 3a3d 3f42 4547 4a4d
|
|
5053 5659 5c5f 6265 686b 6e71 7477 7a7d
|
|
|
|
@font ( bbcmicro1 )
|
|
0000 0000 0000 0000 1818 1818 1800 1800
|
|
6c6c 6c00 0000 0000 3636 7f36 7f36 3600
|
|
0c3f 683e 0b7e 1800 6066 0c18 3066 0600
|
|
386c 6c38 6d66 3b00 0c18 3000 0000 0000
|
|
0c18 3030 3018 0c00 3018 0c0c 0c18 3000
|
|
0018 7e3c 7e18 0000 0018 187e 1818 0000
|
|
0000 0000 0018 1830 0000 007e 0000 0000
|
|
0000 0000 0018 1800 0006 0c18 3060 0000
|
|
3c66 6e7e 7666 3c00 1838 1818 1818 7e00
|
|
3c66 060c 1830 7e00 3c66 061c 0666 3c00
|
|
0c1c 3c6c 7e0c 0c00 7e60 7c06 0666 3c00
|
|
1c30 607c 6666 3c00 7e06 0c18 3030 3000
|
|
3c66 663c 6666 3c00 3c66 663e 060c 3800
|
|
0000 1818 0018 1800 0000 1818 0018 1830
|
|
0c18 3060 3018 0c00 0000 7e00 7e00 0000
|
|
3018 0c06 0c18 3000 3c66 0c18 1800 1800
|
|
3c66 6e6a 6e60 3c00 3c66 667e 6666 6600
|
|
7c66 667c 6666 7c00 3c66 6060 6066 3c00
|
|
786c 6666 666c 7800 7e60 607c 6060 7e00
|
|
7e60 607c 6060 6000 3c66 606e 6666 3c00
|
|
6666 667e 6666 6600 7e18 1818 1818 7e00
|
|
3e0c 0c0c 0c6c 3800 666c 7870 786c 6600
|
|
6060 6060 6060 7e00 6377 7f6b 6b63 6300
|
|
6666 767e 6e66 6600 3c66 6666 6666 3c00
|
|
7c66 667c 6060 6000 3c66 6666 6a6c 3600
|
|
7c66 667c 6c66 6600 3c66 603c 0666 3c00
|
|
7e18 1818 1818 1800 6666 6666 6666 3c00
|
|
6666 6666 663c 1800 6363 6b6b 7f77 6300
|
|
6666 3c18 3c66 6600 6666 663c 1818 1800
|
|
7e06 0c18 3060 7e00 7c60 6060 6060 7c00
|
|
0060 3018 0c06 0000 3e06 0606 0606 3e00
|
|
183c 6642 0000 0000 0000 0000 0000 00ff
|
|
1c36 307c 3030 7e00 0000 3c06 3e66 3e00
|
|
6060 7c66 6666 7c00 0000 3c66 6066 3c00
|
|
0606 3e66 6666 3e00 0000 3c66 7e60 3c00
|
|
1c30 307c 3030 3000 0000 3e66 663e 063c
|
|
6060 7c66 6666 6600 1800 3818 1818 3c00
|
|
1800 3818 1818 1870 6060 666c 786c 6600
|
|
3818 1818 1818 3c00 0000 367f 6b6b 6300
|
|
0000 7c66 6666 6600 0000 3c66 6666 3c00
|
|
0000 7c66 667c 6060 0000 3e66 663e 0607
|
|
0000 6c76 6060 6000 0000 3e60 3c06 7c00
|
|
3030 7c30 3030 1c00 0000 6666 6666 3e00
|
|
0000 6666 663c 1800 0000 636b 6b7f 3600
|
|
0000 663c 183c 6600 0000 6666 663e 063c
|
|
0000 7e0c 1830 7e00 0c18 1870 1818 0c00
|
|
1818 1800 1818 1800 3018 180e 1818 3000
|
|
316b 4600 0000 0000 ffff ffff ffff ffff
|