mirror of https://git.sr.ht/~rabbits/uxn
9 changed files with 151 additions and 1573 deletions
@ -1,731 +0,0 @@
|
||||
( drum rack ) |
||||
|
||||
%+ { ADD } %- { SUB } %* { MUL } %/ { DIV } |
||||
%< { LTH } %> { GTH } %= { EQU } %! { NEQ } |
||||
%++ { ADD2 } %-- { SUB2 } %** { MUL2 } %// { DIV2 } |
||||
%<< { LTH2 } %>> { GTH2 } %== { EQU2 } %!! { NEQ2 } |
||||
|
||||
%2** { #10 SFT2 } %2// { #01 SFT2 } |
||||
%4** { #20 SFT2 } %4// { #02 SFT2 } |
||||
%8** { #30 SFT2 } %8// { #03 SFT2 } |
||||
%10** { #40 SFT2 } |
||||
|
||||
%TOB { NIP } %TOS { #00 SWP } |
||||
%RTN { JMP2r } |
||||
%MOD { DUP2 / * - } |
||||
%LTS2 { #8000 ++ SWP2 #8000 ++ >> } %GTS2 { #8000 ++ SWP2 #8000 ++ << } |
||||
|
||||
%PAD-WIDTH { #0030 } |
||||
%PAD-HEIGHT { #0020 } |
||||
|
||||
( devices ) |
||||
|
||||
|00 @System [ &vector $2 &pad $6 &r $2 &g $2 &b $2 ] |
||||
|10 @Console [ &vector $2 &read $1 &pad $5 &write $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 ] |
||||
|70 @Midi [ &vector $2 &channel $1 ¬e $1 &velocity $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 ] |
||||
|
||||
( variables ) |
||||
|
||||
|0000 |
||||
|
||||
@center [ &x $2 &y $2 ] |
||||
@pointer [ &x $2 &y $2 ] |
||||
@piano [ &last $1 &octave $1 ] |
||||
@pads [ &last $1 ] |
||||
@frame [ &x1 $2 &y1 $2 &x2 $2 &y2 $2 ] |
||||
@pad-view [ &x1 $2 &y1 $2 &x2 $2 &y2 $2 ] |
||||
@mix-view [ &x1 $2 &y1 $2 &x2 $2 &y2 $2 ] |
||||
@oct-view [ &x1 $2 &y1 $2 &x2 $2 &y2 $2 ] |
||||
@wav-view [ &x1 $2 &y1 $2 &x2 $2 &y2 $2 ] |
||||
|
||||
( TODO: remove ) |
||||
@color $1 |
||||
@rect [ &x1 $2 &y1 $2 &x2 $2 &y2 $2 ] |
||||
|
||||
@modes [ $1 $1 $1 $1 ] ( single/repeat ) |
||||
|
||||
( program ) |
||||
|
||||
|0100 ( -> ) |
||||
|
||||
( theme ) |
||||
#0fe5 .System/r DEO2 |
||||
#0fc5 .System/g DEO2 |
||||
#0f25 .System/b DEO2 |
||||
|
||||
( vectors ) |
||||
;on-control .Controller/vector DEO2 |
||||
;on-mouse .Mouse/vector DEO2 |
||||
;on-frame .Screen/vector DEO2 |
||||
;on-message .Console/vector DEO2 |
||||
|
||||
( channel defaults ) |
||||
#dd .Audio0/volume DEO |
||||
#0118 .Audio0/adsr DEO2 |
||||
#0200 .Audio0/length DEO2 |
||||
#ce .Audio1/volume DEO |
||||
#0334 .Audio1/adsr DEO2 |
||||
#0800 .Audio1/length DEO2 |
||||
#ec .Audio2/volume DEO |
||||
#0414 .Audio2/adsr DEO2 |
||||
#0800 .Audio2/length DEO2 |
||||
#ee .Audio3/volume DEO |
||||
#022c .Audio3/adsr DEO2 |
||||
#1000 .Audio3/length DEO2 |
||||
|
||||
( defaults ) |
||||
#01 .modes STZ |
||||
#01 .piano/octave STZ |
||||
|
||||
( find center ) |
||||
.Screen/width DEI2 2// .center/x STZ2 |
||||
.Screen/height DEI2 2// .center/y STZ2 |
||||
|
||||
( place frame ) |
||||
.center/x LDZ2 PAD-WIDTH #0003 ** -- #0010 -- .frame/x1 STZ2 |
||||
.center/y LDZ2 #0050 -- .frame/y1 STZ2 |
||||
.center/x LDZ2 PAD-WIDTH #0003 ** ++ #0010 ++ .frame/x2 STZ2 |
||||
.frame/y1 LDZ2 PAD-HEIGHT 4** ++ #0028 ++ .frame/y2 STZ2 |
||||
|
||||
( place pad-view ) |
||||
.frame/x1 LDZ2 .pad-view/x1 STZ2 |
||||
.frame/y1 LDZ2 .pad-view/y1 STZ2 |
||||
.pad-view/x1 LDZ2 #0004 PAD-WIDTH ** ++ .pad-view/x2 STZ2 |
||||
.pad-view/y1 LDZ2 #0004 PAD-HEIGHT ** ++ .pad-view/y2 STZ2 |
||||
|
||||
( place mix-view ) |
||||
.pad-view/x2 LDZ2 #0006 ++ .mix-view/x1 STZ2 |
||||
.pad-view/y1 LDZ2 .mix-view/y1 STZ2 |
||||
.mix-view/x1 LDZ2 #007a ++ .mix-view/x2 STZ2 |
||||
.pad-view/y2 LDZ2 .mix-view/y2 STZ2 |
||||
|
||||
( place oct-view ) |
||||
.frame/x1 LDZ2 .oct-view/x1 STZ2 |
||||
.mix-view/y2 LDZ2 #0004 ++ .oct-view/y1 STZ2 |
||||
.oct-view/x1 LDZ2 #0050 ++ .oct-view/x2 STZ2 |
||||
.oct-view/y1 LDZ2 #0018 ++ .oct-view/y2 STZ2 |
||||
|
||||
( place wav-view ) |
||||
.oct-view/x2 LDZ2 .wav-view/x1 STZ2 |
||||
.mix-view/y2 LDZ2 #0004 ++ .wav-view/y1 STZ2 |
||||
.frame/x2 LDZ2 .wav-view/x2 STZ2 |
||||
.wav-view/y1 LDZ2 #0020 ++ .wav-view/y2 STZ2 |
||||
|
||||
( draw outlines ) |
||||
.mix-view/x1 LDZ2 #0004 -- |
||||
.mix-view/y1 LDZ2 #0000 -- |
||||
.mix-view/x2 LDZ2 #0002 -- |
||||
.mix-view/y2 LDZ2 #0002 -- |
||||
#01 ;line-rect JSR2 |
||||
.wav-view/x1 LDZ2 #0000 -- |
||||
.wav-view/y1 LDZ2 #0002 -- |
||||
.wav-view/x2 LDZ2 #0002 -- |
||||
.wav-view/y2 LDZ2 #0002 ++ |
||||
#01 ;line-rect JSR2 |
||||
|
||||
( initial draw ) |
||||
#00 #10 |
||||
&draw-pads |
||||
( load sample ) |
||||
OVR TOS #0019 ** ;pad-path ++ .File/name DEO2 |
||||
OVR #04 / #40 SFT .Audio0/length + DEI2 .File/length DEO2 |
||||
OVR TOS 2** ;pad-addr ++ LDA2 .File/read DEO2 |
||||
( draw pad ) |
||||
OVR #01 ;draw-pad JSR2 |
||||
( draw mixer ) |
||||
OVR #04 / ;draw-mixer JSR2 |
||||
( incr ) SWP INC SWP |
||||
LTHk ,&draw-pads JCN |
||||
POP2 |
||||
|
||||
;draw-octave JSR2 |
||||
|
||||
BRK |
||||
|
||||
@on-message ( -> ) |
||||
|
||||
.Console/read DEI #0f AND ;play-pad JSR2 |
||||
|
||||
BRK |
||||
|
||||
@on-frame ( -> ) |
||||
|
||||
( update VU monitors ) |
||||
#00 #04 |
||||
&loop |
||||
OVR STH |
||||
( x ) .mix-view/x1 LDZ2 #0074 ++ |
||||
( y ) .mix-view/y1 LDZ2 PAD-HEIGHT STHkr TOS ** ++ #0002 ++ |
||||
( output ) .Audio0/output STHr #40 SFT + DEI |
||||
;draw-monitor JSR2 |
||||
( incr ) SWP INC SWP |
||||
LTHk ,&loop JCN |
||||
POP2 |
||||
|
||||
BRK |
||||
|
||||
@on-mouse ( -> ) |
||||
|
||||
;draw-cursor JSR2 |
||||
|
||||
.Mouse/state DEI #00 ! #01 JCN [ BRK ] |
||||
|
||||
.Mouse/x DEI2 DUP2 .pad-view/x1 LDZ2 >> ROT ROT .pad-view/x2 LDZ2 INC2 << #0101 == |
||||
.Mouse/y DEI2 DUP2 .pad-view/y1 LDZ2 >> ROT ROT .pad-view/y2 LDZ2 << #0101 == |
||||
#0101 == ;on-touch-pad JCN2 |
||||
|
||||
.Mouse/x DEI2 DUP2 .mix-view/x1 LDZ2 >> ROT ROT .mix-view/x2 LDZ2 INC2 << #0101 == |
||||
.Mouse/y DEI2 DUP2 .mix-view/y1 LDZ2 >> ROT ROT .mix-view/y2 LDZ2 << #0101 == |
||||
#0101 == ;on-touch-mix JCN2 |
||||
|
||||
.Mouse/x DEI2 DUP2 .oct-view/x1 LDZ2 >> ROT ROT .oct-view/x2 LDZ2 INC2 << #0101 == |
||||
.Mouse/y DEI2 DUP2 .oct-view/y1 LDZ2 >> ROT ROT .oct-view/y2 LDZ2 << #0101 == |
||||
#0101 == ;on-touch-oct JCN2 |
||||
|
||||
BRK |
||||
|
||||
@on-control ( -> ) |
||||
|
||||
.Controller/key DEI #00 ! #01 JCN [ BRK ] |
||||
|
||||
.Controller/key DEI |
||||
DUP #31 ! ,&no-0 JCN #00 ;play-pad JSR2 &no-0 |
||||
DUP #32 ! ,&no-1 JCN #01 ;play-pad JSR2 &no-1 |
||||
DUP #33 ! ,&no-2 JCN #02 ;play-pad JSR2 &no-2 |
||||
DUP #34 ! ,&no-3 JCN #03 ;play-pad JSR2 &no-3 |
||||
DUP #71 ! ,&no-4 JCN #04 ;play-pad JSR2 &no-4 |
||||
DUP #77 ! ,&no-5 JCN #05 ;play-pad JSR2 &no-5 |
||||
DUP #65 ! ,&no-6 JCN #06 ;play-pad JSR2 &no-6 |
||||
DUP #72 ! ,&no-7 JCN #07 ;play-pad JSR2 &no-7 |
||||
DUP #61 ! ,&no-8 JCN #08 ;play-pad JSR2 &no-8 |
||||
DUP #73 ! ,&no-9 JCN #09 ;play-pad JSR2 &no-9 |
||||
DUP #64 ! ,&no-a JCN #0a ;play-pad JSR2 &no-a |
||||
DUP #66 ! ,&no-b JCN #0b ;play-pad JSR2 &no-b |
||||
DUP #7a ! ,&no-c JCN #0c ;play-pad JSR2 &no-c |
||||
DUP #78 ! ,&no-d JCN #0d ;play-pad JSR2 &no-d |
||||
DUP #63 ! ,&no-e JCN #0e ;play-pad JSR2 &no-e |
||||
DUP #76 ! ,&no-f JCN #0f ;play-pad JSR2 &no-f |
||||
POP |
||||
|
||||
BRK |
||||
|
||||
@on-touch-pad ( -> ) |
||||
|
||||
( x ) .Mouse/x DEI2 .pad-view/x1 LDZ2 -- PAD-WIDTH // TOB |
||||
( y ) .Mouse/y DEI2 .pad-view/y1 LDZ2 -- PAD-HEIGHT // TOB #20 SFT + |
||||
|
||||
DUP SWP ;play-pad JSR2 |
||||
|
||||
;draw-waveform JSR2 |
||||
|
||||
( release ) #00 .Mouse/state DEO |
||||
|
||||
BRK |
||||
|
||||
@on-touch-mix ( -> ) |
||||
|
||||
( channel ) .Mouse/y DEI2 .mix-view/y1 LDZ2 -- PAD-HEIGHT // TOB STH |
||||
( knob ) .Mouse/x DEI2 .mix-view/x1 LDZ2 -- #0010 // TOB |
||||
( adsr ) |
||||
DUP #00 ! ,&no-a JCN |
||||
.Audio0/adsr [ STHkr #40 SFT + ] DEI |
||||
#10 .Mouse/state DEI #10 = #e0 * + + |
||||
.Audio0/adsr [ STHkr #40 SFT + ] DEO &no-a |
||||
DUP #01 ! ,&no-d JCN |
||||
.Audio0/adsr [ STHkr #40 SFT + ] DEI |
||||
DUP #f0 AND STH #01 .Mouse/state DEI #10 = #0e * + + #0f AND STHr + |
||||
.Audio0/adsr [ STHkr #40 SFT + ] DEO &no-d |
||||
DUP #02 ! ,&no-s JCN |
||||
.Audio0/adsr [ STHkr #40 SFT + ] INC DEI |
||||
#10 .Mouse/state DEI #10 = #e0 * + + |
||||
.Audio0/adsr [ STHkr #40 SFT + ] INC DEO &no-s |
||||
DUP #03 ! ,&no-r JCN |
||||
.Audio0/adsr [ STHkr #40 SFT + ] INC DEI |
||||
DUP #f0 AND STH #01 .Mouse/state DEI #10 = #0e * + + #0f AND STHr + |
||||
.Audio0/adsr [ STHkr #40 SFT + ] INC DEO &no-r |
||||
( modes ) |
||||
DUP #04 ! ,&no-repeat JCN |
||||
.modes [ STHkr + ] LDZ |
||||
#00 = |
||||
.modes [ STHkr + ] STZ &no-repeat |
||||
( volume ) |
||||
DUP #05 ! ,&no-left JCN |
||||
.Audio0/volume [ STHkr #40 SFT + ] DEI |
||||
#10 .Mouse/state DEI #10 = #e0 * + + |
||||
.Audio0/volume [ STHkr #40 SFT + ] DEO &no-left |
||||
DUP #06 ! ,&no-right JCN |
||||
.Audio0/volume [ STHkr #40 SFT + ] DEI |
||||
DUP #f0 AND STH #01 .Mouse/state DEI #10 = #0e * + + #0f AND STHr + |
||||
.Audio0/volume [ STHkr #40 SFT + ] DEO &no-right |
||||
POP |
||||
|
||||
( release ) #00 .Mouse/state DEO |
||||
|
||||
STHkr ;draw-mixer JSR2 |
||||
|
||||
POPr |
||||
|
||||
BRK |
||||
|
||||
@on-touch-oct ( -> ) |
||||
|
||||
.Mouse/x DEI2 .oct-view/x1 LDZ2 -- 8// TOB #08 ! ,&no-mod JCN |
||||
.Mouse/y DEI2 .oct-view/y1 LDZ2 -- 8// TOB |
||||
DUP #00 ! ,&no-incr JCN |
||||
.piano/octave LDZ INC .piano/octave STZ &no-incr |
||||
DUP #02 ! ,&no-decr JCN |
||||
.piano/octave LDZ #01 - .piano/octave STZ &no-decr |
||||
POP |
||||
( release ) #00 .Mouse/state DEO |
||||
;draw-octave JSR2 |
||||
BRK |
||||
&no-mod |
||||
|
||||
.Mouse/x DEI2 .oct-view/x1 LDZ2 -- 8// TOB #06 GTH ,&no-key JCN |
||||
.Mouse/x DEI2 .oct-view/x1 LDZ2 -- 8// |
||||
( set pitch of pad ) |
||||
DUP2 ;notes ++ LDA .pads/last LDZ SWP .piano/octave LDZ #02 - #0c * + |
||||
( save ) SWP TOS ;pad-pitch ++ STA |
||||
( record last note ) |
||||
TOB .piano/last STZ |
||||
.pads/last LDZ ;play-pad JSR2 |
||||
( release ) #00 .Mouse/state DEO |
||||
;draw-octave JSR2 |
||||
&no-key |
||||
|
||||
BRK |
||||
|
||||
@play-pad ( pad -- ) |
||||
|
||||
( unselect last ) |
||||
.pads/last LDZ #01 ;draw-pad JSR2 |
||||
DUP .pads/last STZ |
||||
( highlight ) |
||||
DUP #02 ;draw-pad JSR2 |
||||
( addr ) |
||||
DUP TOS 2** ;pad-addr ++ LDA2 STH2 |
||||
DUP #04 / #40 SFT .Audio0/addr + STH2r ROT DEO2 |
||||
( pitch ) |
||||
DUP TOS ;pad-pitch ++ LDA STH |
||||
DUP #04 / .modes + LDZ #00 = #70 SFT STH ADDr |
||||
DUP #04 / #40 SFT .Audio0/pitch + STHr SWP DEO |
||||
#04 / ;draw-mixer JSR2 |
||||
|
||||
RTN |
||||
|
||||
@draw-waveform ( pad -- ) |
||||
|
||||
( stash address ) |
||||
DUP ADD #00 SWP ;pad-addr ++ LDA2 STH2 |
||||
|
||||
( clear ) |
||||
.wav-view/x1 LDZ2 #0002 ++ |
||||
.wav-view/y1 LDZ2 |
||||
.wav-view/x2 LDZ2 #0002 -- |
||||
.wav-view/y2 LDZ2 |
||||
#00 ;fill-rect JSR2 |
||||
|
||||
.wav-view/x1 LDZ2 #0002 ++ .Screen/x DEO2 |
||||
|
||||
( waveform ) |
||||
#00 #e8 |
||||
&loop |
||||
( dotted line ) |
||||
OVR #01 AND ,&no-dot JCN |
||||
.wav-view/y1 LDZ2 #0010 ++ .Screen/y DEO2 |
||||
#01 .Screen/pixel DEO |
||||
&no-dot |
||||
OVR TOS 10** [ DUP2r STH2r ] ++ LDA |
||||
#02 / |
||||
TOS 4// .wav-view/y1 LDZ2 ++ .Screen/y DEO2 |
||||
.Screen/x DEI2 INC2 .Screen/x DEO2 |
||||
( draw ) #02 .Screen/pixel DEO |
||||
( incr ) SWP INC SWP |
||||
LTHk ,&loop JCN |
||||
POP2 |
||||
POP2r |
||||
|
||||
RTN |
||||
|
||||
@draw-mixer ( mixer -- ) |
||||
|
||||
STHk #00 SWP PAD-HEIGHT ** .mix-view/y1 LDZ2 ++ #0003 ++ |
||||
|
||||
( adsr ) |
||||
DUP2 .mix-view/x1 LDZ2 SWP2 |
||||
.Audio0/adsr [ STHkr #40 SFT + ] DEI #04 SFT ;draw-knob JSR2 |
||||
DUP2 .mix-view/x1 LDZ2 #0010 ++ SWP2 |
||||
.Audio0/adsr [ STHkr #40 SFT + ] DEI #0f AND ;draw-knob JSR2 |
||||
DUP2 .mix-view/x1 LDZ2 #0020 ++ SWP2 |
||||
.Audio0/adsr [ STHkr #40 SFT + ] INC DEI #04 SFT ;draw-knob JSR2 |
||||
DUP2 .mix-view/x1 LDZ2 #0030 ++ SWP2 |
||||
.Audio0/adsr [ STHkr #40 SFT + ] INC DEI #0f AND ;draw-knob JSR2 |
||||
( once/repeat ) |
||||
DUP2 .mix-view/x1 LDZ2 #0040 ++ SWP2 |
||||
.modes [ STHkr + ] LDZ ;draw-switch JSR2 |
||||
( volume ) |
||||
DUP2 .mix-view/x1 LDZ2 #0050 ++ SWP2 |
||||
.Audio0/volume [ STHkr #40 SFT + ] DEI #04 SFT ;draw-knob JSR2 |
||||
DUP2 .mix-view/x1 LDZ2 #0060 ++ SWP2 |
||||
.Audio0/volume [ STHkr #40 SFT + ] DEI #0f AND ;draw-knob JSR2 |
||||
POP2 |
||||
POPr |
||||
|
||||
RTN |
||||
|
||||
@draw-pad ( pad color -- ) |
||||
|
||||
STH STH |
||||
|
||||
STHkr |
||||
|
||||
DUP #04 / SWP #03 AND TOS PAD-WIDTH ** ( center ) .pad-view/x1 LDZ2 ++ |
||||
ROT TOS PAD-HEIGHT ** ( center ) .pad-view/y1 LDZ2 ++ |
||||
|
||||
( draw outline ) |
||||
OVR2 OVR2 |
||||
OVR2 PAD-WIDTH #0002 -- ++ |
||||
OVR2 PAD-HEIGHT #0002 -- ++ |
||||
OVRr STHr ;line-rect JSR2 |
||||
|
||||
( draw name ) |
||||
OVR2 #0002 ++ |
||||
OVR2 #0002 ++ |
||||
;pad-name STHkr TOS #0005 ** ++ |
||||
#00 OVRr STHr + |
||||
;draw-label JSR2 |
||||
|
||||
( draw note ) |
||||
OVR2 #0003 ++ .Screen/x DEO2 |
||||
DUP2 #0014 ++ .Screen/y DEO2 |
||||
( get pitch ) STHkr TOS ;pad-pitch ++ LDA |
||||
#0c / TOS 8** ;font-hex ++ .Screen/addr DEO2 |
||||
#01 .Screen/sprite DEO |
||||
|
||||
( draw octave ) |
||||
OVR2 #000b ++ .Screen/x DEO2 |
||||
DUP2 #0014 ++ .Screen/y DEO2 |
||||
( get pitch ) STHkr TOS ;pad-pitch ++ LDA |
||||
#0c MOD TOS 8** ;font-notes ++ .Screen/addr DEO2 |
||||
#01 .Screen/sprite DEO |
||||
|
||||
POP2 POP2 |
||||
|
||||
POPr POPr |
||||
|
||||
RTN |
||||
|
||||
@draw-octave ( -- ) |
||||
|
||||
.oct-view/x1 LDZ2 .oct-view/y1 LDZ2 |
||||
|
||||
OVR2 OVR2 ;keys-left-icns #01 .piano/last LDZ #00 = + ;draw-key JSR2 |
||||
OVR2 #0008 ++ OVR2 ;keys-middle-icns #01 .piano/last LDZ #01 = + ;draw-key JSR2 |
||||
OVR2 #0010 ++ OVR2 ;keys-right-icns #01 .piano/last LDZ #02 = + ;draw-key JSR2 |
||||
OVR2 #0018 ++ OVR2 ;keys-left-icns #01 .piano/last LDZ #03 = + ;draw-key JSR2 |
||||
OVR2 #0020 ++ OVR2 ;keys-middle-icns #01 .piano/last LDZ #04 = + ;draw-key JSR2 |
||||
OVR2 #0028 ++ OVR2 ;keys-middle-icns #01 .piano/last LDZ #05 = + ;draw-key JSR2 |
||||
SWP2 #0030 ++ SWP2 ;keys-right-icns #01 .piano/last LDZ #06 = + ;draw-key JSR2 |
||||
|
||||
.oct-view/x1 LDZ2 #0040 ++ .Screen/x DEO2 |
||||
|
||||
;arrow-icns .Screen/addr DEO2 |
||||
.oct-view/y1 LDZ2 .Screen/y DEO2 |
||||
#01 .Screen/sprite DEO |
||||
|
||||
;arrow-icns #0008 ++ .Screen/addr DEO2 |
||||
.oct-view/y1 LDZ2 #0010 ++ .Screen/y DEO2 |
||||
#01 .Screen/sprite DEO |
||||
|
||||
;font-hex .piano/octave LDZ #03 + #00 SWP 8** ++ .Screen/addr DEO2 |
||||
.oct-view/y1 LDZ2 #0008 ++ .Screen/y DEO2 |
||||
#03 .Screen/sprite DEO |
||||
|
||||
RTN |
||||
|
||||
@draw-monitor ( x* y* stereo -- ) |
||||
|
||||
STH |
||||
|
||||
.Screen/y DEO2 |
||||
.Screen/x DEO2 |
||||
|
||||
#00 #0f |
||||
&loop |
||||
OVR #10 SWP - STHkr #0f AND < INC .Screen/pixel DEO |
||||
.Screen/x DEI2 #0002 ++ .Screen/x DEO2 |
||||
OVR #10 SWP - STHkr #04 SFT < INC .Screen/pixel DEO |
||||
.Screen/x DEI2 #0002 -- .Screen/x DEO2 |
||||
.Screen/y DEI2 #0002 ++ .Screen/y DEO2 |
||||
( incr ) SWP INC SWP |
||||
LTHk ,&loop JCN |
||||
POP2 |
||||
|
||||
POPr |
||||
|
||||
RTN |
||||
|
||||
@draw-key ( x* y* addr* color -- ) |
||||
|
||||
STH |
||||
.Screen/addr DEO2 |
||||
SWP2 .Screen/x DEO2 |
||||
DUP2 #0018 ++ |
||||
&loop |
||||
( move ) OVR2 .Screen/y DEO2 |
||||
( draw ) STHkr .Screen/sprite DEO |
||||
( incr ) .Screen/addr DEI2 #0008 ++ .Screen/addr DEO2 |
||||
( incr ) SWP2 #0008 ++ SWP2 |
||||
LTH2k ,&loop JCN |
||||
POP2 POP2 |
||||
POPr |
||||
|
||||
RTN |
||||
|
||||
@draw-cursor ( -- ) |
||||
|
||||
( clear last cursor ) |
||||
;cursor-icn .Screen/addr DEO2 |
||||
.pointer/x LDZ2 .Screen/x DEO2 |
||||
.pointer/y LDZ2 .Screen/y DEO2 |
||||
#40 .Screen/sprite DEO |
||||
( record pointer positions ) |
||||
.Mouse/x DEI2 DUP2 .pointer/x STZ2 .Screen/x DEO2 |
||||
.Mouse/y DEI2 DUP2 .pointer/y STZ2 .Screen/y DEO2 |
||||
( colorize on state ) |
||||
#43 [ .Mouse/state DEI #00 ! ] - .Screen/sprite DEO |
||||
|
||||
RTN |
||||
|
||||
@draw-knob ( x* y* value -- ) |
||||
|
||||
( load ) STH .Screen/y DEO2 .Screen/x DEO2 |
||||
;knob-icns .Screen/addr DEO2 |
||||
( draw ) #01 .Screen/sprite DEO |
||||
.Screen/x DEI2 #0008 ++ .Screen/x DEO2 |
||||
;knob-icns #0008 ++ .Screen/addr DEO2 |
||||
( draw ) #01 .Screen/sprite DEO |
||||
.Screen/y DEI2 #0008 ++ .Screen/y DEO2 |
||||
;knob-icns #0018 ++ .Screen/addr DEO2 |
||||
( draw ) #01 .Screen/sprite DEO |
||||
.Screen/x DEI2 #0008 -- .Screen/x DEO2 |
||||
;knob-icns #0010 ++ .Screen/addr DEO2 |
||||
( draw ) #01 .Screen/sprite DEO |
||||
.Screen/x DEI2 #0004 ++ .Screen/x DEO2 |
||||
.Screen/y DEI2 #0008 ++ .Screen/y DEO2 |
||||
;font-hex #00 STHkr #30 SFT ++ .Screen/addr DEO2 |
||||
( draw ) #01 .Screen/sprite DEO |
||||
.Screen/x DEI2 #0004 -- #00 #00 STHkr ;knob-offsetx ++ LDA ++ .Screen/x DEO2 |
||||
.Screen/y DEI2 #0010 -- #00 #00 STHr ;knob-offsety ++ LDA ++ .Screen/y DEO2 |
||||
;knob-icns #0020 ++ .Screen/addr DEO2 |
||||
( draw ) #05 .Screen/sprite DEO |
||||
|
||||
RTN |
||||
|
||||
@draw-switch ( x* y* value -- ) |
||||
|
||||
STH .Screen/y DEO2 .Screen/x DEO2 |
||||
STHkr #50 SFT #00 SWP ;switch-icns ++ |
||||
DUP2 .Screen/addr DEO2 |
||||
( draw ) #01 STHkr + .Screen/sprite DEO |
||||
.Screen/x DEI2 #0008 ++ .Screen/x DEO2 |
||||
DUP2 #0008 ++ .Screen/addr DEO2 |
||||
( draw ) #01 STHkr + .Screen/sprite DEO |
||||
.Screen/y DEI2 #0008 ++ .Screen/y DEO2 |
||||
.Screen/x DEI2 #0008 -- .Screen/x DEO2 |
||||
DUP2 #0010 ++ .Screen/addr DEO2 |
||||
( draw ) #01 STHkr + .Screen/sprite DEO |
||||
.Screen/x DEI2 #0008 ++ .Screen/x DEO2 |
||||
#0018 ++ .Screen/addr DEO2 |
||||
( draw ) #01 STHr + .Screen/sprite DEO |
||||
|
||||
RTN |
||||
|
||||
@line-rect ( x1* y1* x2* y2* color -- ) |
||||
|
||||
STH |
||||
DUP2 ,&ver-y2 STR2 ,&hor-y2 STR2 |
||||
DUP2 ,&ver-x2 STR2 ,&hor-x2 STR2 |
||||
DUP2 ,&ver-y1 STR2 ,&hor-y1 STR2 |
||||
DUP2 ,&ver-x1 STR2 ,&hor-x1 STR2 |
||||
( horizontal ) |
||||
[ LIT2 &hor-x2 $2 ] INC2 [ LIT2 &hor-x1 $2 ] |
||||
&hor |
||||
DUP2 .Screen/x DEO2 |
||||
[ LIT2 &hor-y1 $2 ] .Screen/y DEO2 STHkr .Screen/pixel DEOk |
||||
[ LIT2 &hor-y2 $2 ] .Screen/y DEO2 DEO |
||||
INC2 GTH2k ,&hor JCN |
||||
POP2 POP2 |
||||
( vertical ) |
||||
[ LIT2 &ver-y2 $2 ] [ LIT2 &ver-y1 $2 ] |
||||
&ver |
||||
DUP2 .Screen/y DEO2 |
||||
[ LIT2 &ver-x1 $2 ] .Screen/x DEO2 STHkr .Screen/pixel DEOk |
||||
[ LIT2 &ver-x2 $2 ] .Screen/x DEO2 DEO |
||||
INC2 GTH2k ,&ver JCN |
||||
POP2 POP2 |
||||
POPr |
||||
|
||||
RTN |
||||
|
||||
@draw-label ( x* y* addr* color -- ) |
||||
|
||||
( load ) STH STH2 .Screen/y DEO2 .Screen/x DEO2 |
||||
STH2r |
||||
&loop |
||||
LDAk #00 SWP #0030 -- 8** ;font-num-uc ++ .Screen/addr DEO2 |
||||
( draw ) STHkr .Screen/sprite DEO |
||||
( incr ) INC2 |
||||
( incr ) .Screen/x DEI2 #0008 ++ .Screen/x DEO2 |
||||
LDAk #00 ! ,&loop JCN |
||||
POP2 |
||||
POPr |
||||
|
||||
RTN |
||||
|
||||
@fill-rect ( x1* y1* x2* y2* color -- ) |
||||
|
||||
.color STZ |
||||
( x1 x2 y1 y2 ) ROT2 SWP2 |
||||
&ver |
||||
( save ) OVR2 .Screen/y DEO2 |
||||
STH2 STH2 OVR2 OVR2 |
||||
&hor |
||||
( save ) OVR2 .Screen/x DEO2 |
||||
( draw ) .color LDZ .Screen/pixel DEO |
||||
( incr ) SWP2 INC2 SWP2 |
||||
OVR2 OVR2 LTS2 ,&hor JCN |
||||
POP2 POP2 STH2r STH2r |
||||
( incr ) SWP2 INC2 SWP2 |
||||
OVR2 OVR2 LTS2 ,&ver JCN |
||||
POP2 POP2 POP2 POP2 |
||||
|
||||
RTN |
||||
|
||||
@pad-name [ |
||||
"PAD1 $1 "SYN1 $1 "SYN2 $1 "CYM1 $1 ( short ) |
||||
"HHAT $1 "OHAT $1 "CHAT $1 "RIDE $1 |
||||
"SID1 $1 "SNR1 $1 "SNR2 $1 "SID2 $1 ( long ) |
||||
"BDR1 $1 "KCK1 $1 "KCK2 $1 "SUB1 $1 ] |
||||
|
||||
@pad-addr [ |
||||
6000 6400 6800 6c00 |
||||
7000 7800 8000 8800 |
||||
9000 9800 a000 a800 |
||||
b000 c000 d000 e000 $2 ] |
||||
|
||||
@pad-pitch [ |
||||
30 30 30 30 |
||||
30 30 30 30 |
||||
30 30 30 30 |
||||
30 30 30 30 ] |
||||
|
||||
@pad-path [ |
||||
"projects/sounds/pad1.pcm $1 "projects/sounds/syn1.pcm $1 "projects/sounds/syn2.pcm $1 "projects/sounds/pad2.pcm $1 |
||||
"projects/sounds/hhat.pcm $1 "projects/sounds/ohat.pcm $1 "projects/sounds/chat.pcm $1 "projects/sounds/ride.pcm $1 |
||||
"projects/sounds/sid1.pcm $1 "projects/sounds/snr1.pcm $1 "projects/sounds/snr2.pcm $1 "projects/sounds/sid2.pcm $1 |
||||
"projects/sounds/bdr1.pcm $1 "projects/sounds/kck1.pcm $1 "projects/sounds/kck2.pcm $1 "projects/sounds/sub1.pcm $1 ] |
||||
|
||||
@notes [ |
||||
3c 3e 40 41 43 45 47 |
||||
48 4a 4c 4d 4f 51 53 ] |
||||
|
||||
@cursor-icn [ |
||||
80c0 e0f0 f8e0 1000 ] |
||||
|
||||
@keys-left-icns [ |
||||
7c7c 7c7c 7c7c 7c7c |
||||
7c7c 7c7c 7c7c 7e7f |
||||
7f7f 7f7f 7f7f 3e00 ] |
||||
|
||||
@keys-middle-icns [ |
||||
1c1c 1c1c 1c1c 1c1c |
||||
1c1c 1c1c 1c1c 3e7f |
||||
7f7f 7f7f 7f7f 3e00 ] |
||||
|
||||
@keys-right-icns [ |
||||
1f1f 1f1f 1f1f 1f1f |
||||
1f1f 1f1f 1f1f 3f7f |
||||
7f7f 7f7f 7f7f 3e00 ] |
||||
|
||||
@arrow-icns [ |
||||
0010 387c fe10 1000 |
||||
0010 1010 fe7c 3810 ] |
||||
|
||||
@switch-icns [ |
||||
001f 2040 4040 4040 |
||||
00f8 0402 0202 0202 |
||||
404f 5f5f 4f20 1f00 |
||||
02f2 fafa f204 f800 |
||||
001f 204f 5f5f 4f40 |
||||
00f8 04f2 fafa f202 |
||||
4040 4040 4020 1f00 |
||||
0202 0202 0204 f800 ] |
||||
|
||||
@knob-icns [ |
||||
0003 0c10 2020 4040 |
||||
00c0 3008 0404 0202 |
||||
4040 2020 100c 0300 |
||||
0202 0404 0830 c000 |
||||
0000 183c 3c18 0000 ] |
||||
|
||||
@knob-offsetx [ |
||||
01 00 00 00 00 01 02 03 |
||||
05 06 07 08 08 08 08 07 ] |
||||
|
||||
@knob-offsety [ |
||||
07 06 05 03 02 01 00 00 |
||||
00 00 01 02 03 05 06 07 ] |
||||
|
||||
@font-notes [ |
||||
003e 4140 4040 413e 40ae 4100 4040 413e |
||||
007e 4141 4141 417e 40ae 4101 4141 417e |
||||
003e 4140 7c40 413e 003f 4040 7e40 4040 |
||||
40af 4000 7e40 4040 003e 4140 5f41 413e |
||||
40ae 4100 5f41 413e 003e 4141 7f41 4141 |
||||
40ae 4101 7f41 4141 007e 4141 7e41 417e |
||||
] |
||||
|
||||
@font-hex ( 0-F ) |
||||
[ |
||||
007c 8282 8282 827c 0030 1010 1010 1010 |
||||
007c 8202 7c80 80fe 007c 8202 1c02 827c |
||||
000c 1424 4484 fe04 00fe 8080 7c02 827c |
||||
007c 8280 fc82 827c 007c 8202 1e02 0202 |
||||
007c 8282 7c82 827c 007c 8282 7e02 827c |
||||
007c 8202 7e82 827e 00fc 8282 fc82 82fc |
||||
007c 8280 8080 827c 00fc 8282 8282 82fc |
||||
007c 8280 f080 827c 007c 8280 f080 8080 |
||||
] |
||||
|
||||
@font-num-uc [ |
||||
003e 4141 4141 413e 0018 0808 0808 081c |
||||
003e 4101 3e40 407f 003e 4101 1f01 413e |
||||
0011 2141 7f01 0101 007f 4040 7e01 413e |
||||
003e 4140 7e41 413e 003e 4101 0102 0408 |
||||
003e 4141 3e41 413e 003e 4141 3f01 0102 |
||||
0000 0800 0000 0800 0000 0800 0000 0800 |
||||
0000 0800 0000 0810 0000 0408 1008 0400 |
||||
0000 001c 001c 0000 0000 1008 0408 1000 |
||||
0000 0000 0000 0000 003e 4101 3f41 413f |
||||
007e 4141 7e41 417e 003e 4140 4040 413e |
||||
007e 4141 4141 417e 007f 4040 7e40 407f |
||||
007f 4040 7e40 4040 003e 4140 5e41 413e |
||||
0041 4141 7f41 4141 0008 0808 0808 0808 |
||||
007f 0101 0101 413e 0041 4244 7844 4241 |
||||
0040 4040 4040 403f 0076 4949 4949 4949 |
||||
005e 6141 4141 4141 003e 4141 4141 413e |
||||
007e 4141 7e40 4040 003e 4141 4145 423d |
||||
007e 4141 7e41 4141 003e 4140 3e01 413e |
||||
007f 0808 0808 0808 0041 4141 4141 433d |
||||
0041 4141 4122 1408 0049 4949 4949 4976 |
||||
0041 2214 0814 2241 0041 4141 3f01 413e |
||||
007f 0101 3e40 407f ] |
||||
@ -1,74 +1,73 @@
|
||||
( devices ) |
||||
( Move: |
||||
Use controller arrows, leave a slime. ) |
||||
|
||||
|0000 @System &vector $2 &pad $6 &r $2 &g $2 &b $2 |
||||
|0020 @Screen &vector $2 &width $2 &height $2 &pad $2 &x $2 &y $2 &addr $2 &pixel $1 &sprite $1 |
||||
|0080 @Controller &vector $2 &button $1 &key $1 |
||||
|00 @System &vector $2 &pad $6 &r $2 &g $2 &b $2 |
||||
|20 @Screen &vector $2 &width $2 &height $2 &auto $1 &pad $1 &x $2 &y $2 &addr $2 &pixel $1 &sprite $1 |
||||
|80 @Controller &vector $2 &button $1 &key $1 |
||||
|
||||
|0000 |
||||
|
||||
@slime $1 |
||||
@hello &x $2 &y $2 |
||||
|
||||
|0100 ( -> ) @program |
||||
|0100 ( -> ) |
||||
|
||||
( theme ) |
||||
#0daf .System/r DEO2 |
||||
#02ff .System/g DEO2 |
||||
#035f .System/b DEO2 |
||||
#c0f4 .System/r DEO2 |
||||
#c0fc .System/g DEO2 |
||||
#c0f7 .System/b DEO2 |
||||
( vectors ) |
||||
;on-frame .Screen/vector DEO2 |
||||
( set origin ) |
||||
.Screen/width DEI2 #01 SFT2 .Screen/x DEO2 |
||||
.Screen/height DEI2 #01 SFT2 .Screen/y DEO2 |
||||
.Screen/width DEI2 #01 SFT2 .hello/x STZ2 |
||||
.Screen/height DEI2 #01 SFT2 .hello/y STZ2 |
||||
( drawing mode ) |
||||
#16 .Screen/auto DEO |
||||
( defaults ) |
||||
;default-icn .Screen/addr DEO2 |
||||
#41 .Screen/sprite DEO |
||||
#0a .slime STZ |
||||
#00 ;on-frame/draw JMP2 |
||||
|
||||
BRK |
||||
|
||||
@on-frame ( -> ) |
||||
|
||||
#0a .slime STZ |
||||
;default-icn .Screen/addr DEO2 |
||||
( hold ctrl key to change slime color ) |
||||
.Controller/button DEI #0f AND |
||||
DUP #01 NEQ ,&no-ctrl JCN #05 .slime STZ &no-ctrl |
||||
DUP #02 NEQ ,&no-alt JCN #0f .slime STZ &no-alt |
||||
POP |
||||
( clear ) |
||||
.Controller/button DEI |
||||
DUP #00 NEQ ,&continue JCN |
||||
POP BRK |
||||
&continue |
||||
( clear ) |
||||
#40 .Screen/sprite DEO |
||||
( detect movement ) |
||||
.Controller/button DEI |
||||
DUP #10 AND #00 EQU ,&no-up JCN |
||||
.Screen/y DEI2 #0001 SUB2 .Screen/y DEO2 |
||||
;up-icn .Screen/addr DEO2 &no-up |
||||
DUP #20 AND #00 EQU ,&no-down JCN |
||||
.Screen/y DEI2 INC2 .Screen/y DEO2 |
||||
;down-icn .Screen/addr DEO2 &no-down |
||||
DUP #40 AND #00 EQU ,&no-left JCN |
||||
.Screen/x DEI2 #0001 SUB2 .Screen/x DEO2 |
||||
;left-icn .Screen/addr DEO2 &no-left |
||||
DUP #80 AND #00 EQU ,&no-right JCN |
||||
.Screen/x DEI2 INC2 .Screen/x DEO2 |
||||
;right-icn .Screen/addr DEO2 &no-right |
||||
POP |
||||
( draw face ) |
||||
#41 .Screen/sprite DEO |
||||
( movement ) |
||||
DUP #10 AND #00 EQU ,&no-u JCN .hello/y LDZ2k #0001 SUB2 ROT STZ2 &no-u |
||||
DUP #20 AND #00 EQU ,&no-d JCN .hello/y LDZ2k INC2 ROT STZ2 &no-d |
||||
DUP #40 AND #00 EQU ,&no-l JCN .hello/x LDZ2k #0001 SUB2 ROT STZ2 &no-l |
||||
DUP #80 AND #00 EQU ,&no-r JCN .hello/x LDZ2k INC2 ROT STZ2 &no-r |
||||
&draw |
||||
( draw hello ) |
||||
.hello/x LDZ2 STH2k .Screen/x DEO2 |
||||
.hello/y LDZ2 STH2k .Screen/y DEO2 |
||||
;hello-chr .Screen/addr DEO2 |
||||
#c1 .Screen/sprite DEOk DEO |
||||
( draw slime ) |
||||
STH2r .Screen/y DEO2 |
||||
STH2r .Screen/x DEO2 |
||||
;slime-icn .Screen/addr DEO2 |
||||
.slime LDZ .Screen/sprite DEO |
||||
,get-slime JSR .Screen/sprite DEOk DEO |
||||
|
||||
BRK |
||||
|
||||
@default-icn |
||||
3c7e ffdb ffe7 7e3c |
||||
@up-icn |
||||
2466 e7db ffff 7e3c |
||||
@down-icn |
||||
3c7e ffff dbe7 6624 |
||||
@left-icn |
||||
3c7e ef1f 1fef 7e3c |
||||
@right-icn |
||||
3c7e f7f8 f8f7 7e3c |
||||
@slime-icn |
||||
0000 183c 3c18 0000 |
||||
@get-slime ( button -- color ) |
||||
|
||||
#0f AND |
||||
DUP #01 NEQ ,&no-ctrl JCN POP #05 JMP2r &no-ctrl |
||||
DUP #02 NEQ ,&no-alt JCN POP #0a JMP2r &no-alt |
||||
POP #0f |
||||
|
||||
JMP2r |
||||
|
||||
@hello-chr |
||||
0007 1820 2040 4044 0000 071f 1f3f 3f3b |
||||
00e0 1804 0402 0222 0000 e0f8 f8fc fcdc |
||||
4040 4423 2018 0700 3f3f 3b1c 1f07 0000 |
||||
0202 22c4 0418 e000 fcfc dc38 f8e0 0000 |
||||
@slime-icn |
||||
0000 0000 0003 0707 0000 0000 00c0 e0e0 |
||||
0707 0300 0000 0000 e0e0 c000 0000 0000 |
||||
|
||||
@ -1,232 +0,0 @@
|
||||
|
||||
( |
||||
uxnasm projects/examples/demos/nametable.tal bin/nametable.rom |
||||
uxnemu bin/nametable.rom |
||||
) |
||||
|
||||
%+ { ADD } %- { SUB } %/ { DIV } |
||||
%< { LTH } %> { GTH } %= { EQU } %! { NEQ } |
||||
%++ { ADD2 } %-- { SUB2 } %// { DIV2 } |
||||
%<< { LTH2 } %>> { GTH2 } %== { EQU2 } %!! { NEQ2 } |
||||
|
||||
%2** { #10 SFT2 } %2// { #01 SFT2 } |
||||
%8** { #30 SFT2 } %8// { #03 SFT2 } |
||||
%10** { #40 SFT2 } %10// { #04 SFT2 } |
||||
%MOD2 { DIV2k MUL2 SUB2 } |
||||
%MOD { DIVk MUL SUB } |
||||
%RTN { JMP2r } |
||||
|
||||
%WIDTH { #0037 } |
||||
%HEIGHT { #0029 } ( 08cf ) |
||||
%LENGTH { WIDTH HEIGHT MUL2 10** } |
||||
|
||||
( 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 &auto $1 &pad $1 &x $2 &y $2 &addr $2 &pixel $1 &sprite $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 ] |
||||
|
||||
( variables ) |
||||
|
||||
|0000 |
||||
|
||||
( program ) |
||||
|
||||
@tiles-frame |
||||
&x $2 &y $2 |
||||
@nametable-frame |
||||
&x $2 &y $2 |
||||
@buffer $10 |
||||
|
||||
|0100 ( -> ) |
||||
|
||||
( theme ) |
||||
#34cd .System/r DEO2 |
||||
#28ac .System/g DEO2 |
||||
#297b .System/b DEO2 |
||||
|
||||
WIDTH 8** #0010 ++ .Screen/width DEO2 |
||||
#01e8 .Screen/height DEO2 |
||||
|
||||
#0008 .tiles-frame/x STZ2 |
||||
HEIGHT 8** #0008 ++ .tiles-frame/y STZ2 |
||||
#0008 .nametable-frame/x STZ2 |
||||
#0008 .nametable-frame/y STZ2 |
||||
|
||||
;input-name |
||||
DUP2 ,load JSR |
||||
;assoc JSR2 |
||||
|
||||
;draw-tiles JSR2 |
||||
;draw-nametable JSR2 |
||||
;draw-short JSR2 |
||||
|
||||
BRK |
||||
|
||||
@load ( filename* -- ) |
||||
|
||||
LIT2r 0000 |
||||
.File/name DEO2 |
||||
&stream |
||||
#0010 .File/length DEO2 |
||||
;buffer |
||||
DUP2 .File/read DEO2 |
||||
,find-tile JSR #ffff !! ,&skip JCN |
||||
;buffer ;add-tile JSR2 |
||||
&skip |
||||
INC2r |
||||
.File/success DEI2 #0000 !! ,&stream JCN |
||||
STH2r #0001 -- ;result/tiles STA2 |
||||
|
||||
RTN |
||||
|
||||
@find-tile ( addr* -- addr* ) |
||||
|
||||
STH2 |
||||
;result/length LDA2 #0000 |
||||
&loop |
||||
DUP2 10** ;result/data ++ STH2kr ;tiles-equal JSR2 #00 = ,&continue JCN |
||||
NIP2 POP2r RTN |
||||
&continue |
||||
INC2 GTH2k ,&loop JCN |
||||
POP2 POP2 POP2r |
||||
( default ) #ffff |
||||
|
||||
RTN |
||||
|
||||
@tiles-equal ( a* b* -- bool ) |
||||
|
||||
STH2 |
||||
DUP2 #0010 ++ SWP2 |
||||
&loop |
||||
LDAk LDAkr STHr = ,&continue JCN |
||||
POP2 POP2 POP2r #00 RTN |
||||
&continue |
||||
INC2r |
||||
INC2 GTH2k ,&loop JCN |
||||
POP2 POP2 POP2r #01 |
||||
|
||||
RTN |
||||
|
||||
@add-tile ( addr* -- addr* ) |
||||
|
||||
STH2 |
||||
#0010 #0000 |
||||
&loop |
||||
( addr* ) DUP2 ;result/length LDA2 10** ;result/data ++ ++ |
||||
( data ) OVR2 STH2kr ++ LDA |
||||
( order ) ROT ROT STA |
||||
INC2 GTH2k ,&loop JCN |
||||
POP2 POP2 |
||||
POP2r |
||||
( incr ) ;result/length LDA2 INC2 ;result/length STA2 |
||||
|
||||
RTN |
||||
|
||||
@assoc ( -- length ) |
||||
|
||||
LIT2r 0000 |
||||
.File/name DEO2 |
||||
&stream |
||||
#0010 .File/length DEO2 |
||||
;buffer |
||||
DUP2 .File/read DEO2 |
||||
;find-tile JSR2 STH2kr SWP2 ;set-tile JSR2 |
||||
INC2r |
||||
.File/success DEI2 #0000 !! ,&stream JCN |
||||
POP2r |
||||
|
||||
RTN |
||||
|
||||
( draw ) |
||||
|
||||
@draw-tiles ( -- ) |
||||
|
||||
.tiles-frame/x LDZ2 .Screen/x DEO2 |
||||
.tiles-frame/y LDZ2 .Screen/y DEO2 |
||||
;result/data .Screen/addr DEO2 |
||||
|
||||
( width ) LITr 00 |
||||
( auto x addr ) #05 .Screen/auto DEO |
||||
;result/data ;result/length LDA2 10** ++ ;result/data |
||||
&loop |
||||
STHkr WIDTH NIP MOD ,&continue JCN |
||||
.tiles-frame/x LDZ2 .Screen/x DEO2 |
||||
.Screen/y DEI2 #0008 ++ .Screen/y DEO2 |
||||
POPr LITr 00 |
||||
&continue |
||||
INCr |
||||
#81 .Screen/sprite DEO |
||||
#0010 ++ GTH2k ,&loop JCN |
||||
POP2 POP2 |
||||
( auto none ) #00 .Screen/auto DEO |
||||
POPr |
||||
|
||||
RTN |
||||
|
||||
@set-tile ( id* addr* -- ) |
||||
|
||||
SWP2 2** ;result/data ++ ;result/length LDA2 10** ++ STA2 |
||||
|
||||
RTN |
||||
|
||||
@get-tile ( id* -- addr* ) |
||||
|
||||
2** ;result/length LDA2 10** ;result/data ++ ++ LDA2 |
||||
|
||||
RTN |
||||
|
||||
@draw-nametable ( -- ) |
||||
|
||||
;result/tiles LDA2 #0000 |
||||
&loop |
||||
DUP2 WIDTH MOD2 8** .nametable-frame/x LDZ2 ++ .Screen/x DEO2 |
||||
DUP2 WIDTH DIV2 8** .nametable-frame/y LDZ2 ++ .Screen/y DEO2 |
||||
DUP2 ;get-tile JSR2 10** ;result/data ++ .Screen/addr DEO2 |
||||
#81 .Screen/sprite DEO |
||||
INC2 GTH2k ,&loop JCN |
||||
POP2 POP2 |
||||
|
||||
RTN |
||||
|
||||
@draw-short ( -- ) |
||||
|
||||
#0008 .Screen/x DEO2 |
||||
#0008 .Screen/y DEO2 |
||||
#01 .Screen/auto DEO |
||||
;result/length LDA2 SWP |
||||
( high ) ,&draw-byte JSR |
||||
( low ) ,&draw-byte JSR |
||||
#05 .Screen/auto DEO |
||||
|
||||
RTN |
||||
|
||||
&draw-byte ( byte -- ) |
||||
DUP |
||||
( high ) #04 SFT ,&draw-char JSR |
||||
( low ) #0f AND ,&draw-char JSR |
||||
RTN |
||||
&draw-char ( num -- ) |
||||
#30 SFT #00 SWP ;font-hex ADD2 .Screen/addr DEO2 |
||||
#01 .Screen/sprite DEO |
||||
RTN |
||||
|
||||
@input-name "projects/pictures/bulma37x29.chr $1 |
||||
|
||||
@font-hex ( 0-F ) |
||||
007c 8282 8282 827c 0030 1010 1010 1010 |
||||
007c 8202 7c80 80fe 007c 8202 1c02 827c |
||||
000c 1424 4484 fe04 00fe 8080 7c02 827c |
||||
007c 8280 fc82 827c 007c 8202 1e02 0202 |
||||
007c 8282 7c82 827c 007c 8282 7e02 827c |
||||
007c 8202 7e82 827e 00fc 8282 fc82 82fc |
||||
007c 8280 8080 827c 00fc 8282 8282 82fc |
||||
007c 8280 f080 827c 007c 8280 f080 8080 |
||||
|
||||
@result |
||||
&length $2 |
||||
&tiles $2 |
||||
&data |
||||
@ -1,427 +0,0 @@
|
||||
( Dev/Screen ) |
||||
|
||||
%RTN { JMP2r } |
||||
%++ { INC2 } |
||||
%2// { #01 SFT2 } |
||||
%4// { #02 SFT2 } |
||||
%4** { #20 SFT2 } |
||||
%8** { #30 SFT2 } |
||||
%8+ { #0008 ADD2 } |
||||
%STEP8 { #33 SFT2 } |
||||
|
||||
( devices ) |
||||
|
||||
|00 @System [ &vector $2 &pad $6 &r $2 &g $2 &b $2 ] |
||||
|20 @Screen [ &vector $2 &width $2 &height $2 &pad $2 &x $2 &y $2 &addr $2 &pixel $1 &sprite $1 ] |
||||
|90 @Mouse [ &vector $2 &x $2 &y $2 &state $1 &wheel $1 ] |
||||
|
||||
( variables ) |
||||
|
||||
|0000 |
||||
|
||||
@color $1 |
||||
@selection $1 |
||||
|
||||
@center [ &x $2 &y $2 ] |
||||
@pointer [ &x $2 &y $2 ] |
||||
@rect [ &x1 $2 &y1 $2 &x2 $2 &y2 $2 ] |
||||
@window [ &x1 $2 &y1 $2 &x2 $2 &y2 $2 &w $2 &h $2 ] |
||||
@slider [ &x1 $2 &y $2 &x2 $2 &pos $2 ] |
||||
|
||||
@theme [ |
||||
&r1 $1 &r2 $1 &r3 $1 &r4 $1 |
||||
&g1 $1 &g2 $1 &g3 $1 &g4 $1 |
||||
&b1 $1 &b2 $1 &b3 $1 &b4 $1 |
||||
] |
||||
|
||||
( program ) |
||||
|
||||
|0100 ( -> ) |
||||
|
||||
( theme ) |
||||
#027f .System/r DEO2 |
||||
#04e7 .System/g DEO2 |
||||
#06c4 .System/b DEO2 |
||||
|
||||
( vectors ) |
||||
;on-mouse .Mouse/vector DEO2 |
||||
|
||||
( size window ) |
||||
#00b0 .window/w STZ2 |
||||
#0050 .window/h STZ2 |
||||
|
||||
( center window ) |
||||
.Screen/width DEI2 2// .window/w LDZ2 2// SUB2 .window/x1 STZ2 |
||||
.Screen/height DEI2 2// .window/h LDZ2 2// SUB2 .window/y1 STZ2 |
||||
|
||||
#01 .theme/r1 STZ #02 .theme/g1 STZ #03 .theme/b1 STZ |
||||
#04 .theme/r2 STZ #06 .theme/g2 STZ #07 .theme/b2 STZ |
||||
#0a .theme/r3 STZ #09 .theme/g3 STZ #08 .theme/b3 STZ |
||||
#0c .theme/r4 STZ #0b .theme/g4 STZ #0d .theme/b4 STZ |
||||
|
||||
( find screen center ) |
||||
.Screen/width DEI2 2// .center/x STZ2 |
||||
.Screen/height DEI2 2// .center/y STZ2 |
||||
|
||||
;update-theme JSR2 |
||||
;draw-background JSR2 |
||||
;draw-window JSR2 |
||||
|
||||
BRK |
||||
|
||||
@on-mouse ( -> ) |
||||
|
||||
;draw-cursor JSR2 |
||||
|
||||
.Mouse/state DEI #01 JCN [ BRK ] |
||||
|
||||
.Mouse/y DEI2 .window/y1 LDZ2 SUB2 STEP8 |
||||
DUP2 #0010 NEQ2 ,&no-touch-red JCN |
||||
.Mouse/x DEI2 .window/x1 LDZ2 #0060 ADD2 LTH2 ,&no-touch-red JCN |
||||
.Mouse/x DEI2 .window/x1 LDZ2 #009c ADD2 GTH2 ,&no-touch-red JCN |
||||
( get new value ) .Mouse/x DEI2 .window/x1 LDZ2 SUB2 #0060 SUB2 4// NIP ;theme/r1 #00 .selection LDZ ADD2 STA |
||||
&no-touch-red |
||||
DUP2 #0020 NEQ2 ,&no-touch-green JCN |
||||
.Mouse/x DEI2 .window/x1 LDZ2 #0060 ADD2 LTH2 ,&no-touch-green JCN |
||||
.Mouse/x DEI2 .window/x1 LDZ2 #009c ADD2 GTH2 ,&no-touch-green JCN |
||||
( get new value ) .Mouse/x DEI2 .window/x1 LDZ2 SUB2 #0060 SUB2 4// NIP ;theme/g1 #00 .selection LDZ ADD2 STA |
||||
&no-touch-green |
||||
DUP2 #0030 NEQ2 ,&no-touch-blue JCN |
||||
.Mouse/x DEI2 .window/x1 LDZ2 #0060 ADD2 LTH2 ,&no-touch-blue JCN |
||||
.Mouse/x DEI2 .window/x1 LDZ2 #009c ADD2 GTH2 ,&no-touch-blue JCN |
||||
( get new value ) .Mouse/x DEI2 .window/x1 LDZ2 SUB2 #0060 SUB2 4// NIP ;theme/b1 #00 .selection LDZ ADD2 STA |
||||
&no-touch-blue |
||||
DUP2 #0040 NEQ2 ,&no-touch-radio JCN |
||||
.Mouse/x DEI2 .window/x1 LDZ2 #0050 ADD2 LTH2 ,&no-touch-radio JCN |
||||
.Mouse/x DEI2 .window/x1 LDZ2 #008c ADD2 GTH2 ,&no-touch-radio JCN |
||||
.Mouse/x DEI2 .window/x1 LDZ2 SUB2 #0050 SUB2 STEP8 2// #0008 DIV2 NIP .selection STZ |
||||
&no-touch-radio |
||||
POP2 |
||||
|
||||
;update-theme JSR2 |
||||
;draw-cursor JSR2 |
||||
;draw-background JSR2 |
||||
;draw-window JSR2 |
||||
|
||||
BRK |
||||
|
||||
@update-theme ( -- ) |
||||
|
||||
#08 DEI #0f AND .theme/r1 LDZ #40 SFT ADD #08 DEO |
||||
#0a DEI #0f AND .theme/g1 LDZ #40 SFT ADD #0a DEO |
||||
#0c DEI #0f AND .theme/b1 LDZ #40 SFT ADD #0c DEO |
||||
#08 DEI #f0 AND .theme/r2 LDZ ADD #08 DEO |
||||
#0a DEI #f0 AND .theme/g2 LDZ ADD #0a DEO |
||||
#0c DEI #f0 AND .theme/b2 LDZ ADD #0c DEO |
||||
#09 DEI #0f AND .theme/r3 LDZ #40 SFT ADD #09 DEO |
||||
#0b DEI #0f AND .theme/g3 LDZ #40 SFT ADD #0b DEO |
||||
#0d DEI #0f AND .theme/b3 LDZ #40 SFT ADD #0d DEO |
||||
#09 DEI #f0 AND .theme/r4 LDZ ADD #09 DEO |
||||
#0b DEI #f0 AND .theme/g4 LDZ ADD #0b DEO |
||||
#0d DEI #f0 AND .theme/b4 LDZ ADD #0d DEO |
||||
|
||||
RTN |
||||
|
||||
@draw-background ( -- ) |
||||
|
||||
( draw hor line ) |
||||
#0000 .Screen/x DEO2 .center/y LDZ2 .Screen/y DEO2 |
||||
.Screen/width DEI2 #0000 ( to/from ) |
||||
&draw-hor |
||||
( draw ) #01 .Screen/pixel DEO |
||||
( incr ) #0002 ADD2 DUP2 .Screen/x DEO2 |
||||
GTH2k ,&draw-hor JCN |
||||
POP2 POP2 |
||||
|
||||
( draw ver line ) |
||||
.center/x LDZ2 .Screen/x DEO2 #0000 .Screen/y DEO2 |
||||
.Screen/height DEI2 #0000 ( to/from ) |
||||
&draw-ver |
||||
( draw ) #02 .Screen/pixel DEO |
||||
( incr ) #0002 ADD2 DUP2 .Screen/y DEO2 |
||||
GTH2k ,&draw-ver JCN |
||||
POP2 POP2 |
||||
|
||||
( draw blending modes ) |
||||
;preview_icn .Screen/addr DEO2 |
||||
#0010 .Screen/y DEO2 |
||||
#0800 |
||||
&draw-pixel1 |
||||
( move ) #00 OVR #30 SFT #0010 ADD2 .Screen/x DEO2 |
||||
( draw ) DUP .Screen/pixel DEO |
||||
( incr ) INC |
||||
GTHk ,&draw-pixel1 JCN |
||||
POP2 |
||||
#0018 .Screen/y DEO2 |
||||
#0800 |
||||
&draw-pixel2 |
||||
( move ) #00 OVR #30 SFT #0010 ADD2 .Screen/x DEO2 |
||||
( draw ) DUP #08 ADD .Screen/pixel DEO |
||||
( incr ) INC |
||||
GTHk ,&draw-pixel2 JCN |
||||
POP2 |
||||
#0020 .Screen/y DEO2 |
||||
#0800 |
||||
&draw-icn1 |
||||
( move ) #00 OVR #30 SFT #0010 ADD2 .Screen/x DEO2 |
||||
( draw ) DUP .Screen/sprite DEO |
||||
( incr ) INC |
||||
GTHk ,&draw-icn1 JCN |
||||
POP2 |
||||
#0028 .Screen/y DEO2 |
||||
#0800 |
||||
&draw-icn2 |
||||
( move ) #00 OVR #30 SFT #0010 ADD2 .Screen/x DEO2 |
||||
( draw ) DUP #08 ADD .Screen/sprite DEO |
||||
( incr ) INC |
||||
GTHk ,&draw-icn2 JCN |
||||
POP2 |
||||
#0030 .Screen/y DEO2 |
||||
#0800 |
||||
&draw-chr1 |
||||
( move ) #00 OVR #30 SFT #0010 ADD2 .Screen/x DEO2 |
||||
( draw ) DUP #80 ADD .Screen/sprite DEO |
||||
( incr ) INC |
||||
GTHk ,&draw-chr1 JCN |
||||
POP2 |
||||
#0038 .Screen/y DEO2 |
||||
#0800 |
||||
&draw-chr2 |
||||
( move ) #00 OVR #30 SFT #0010 ADD2 .Screen/x DEO2 |
||||
( draw ) DUP #88 ADD .Screen/sprite DEO |
||||
( incr ) INC |
||||
GTHk ,&draw-chr2 JCN |
||||
POP2 |
||||
|
||||
RTN |
||||
|
||||
@draw-window ( -- ) |
||||
|
||||
.window/x1 LDZ2 .window/w LDZ2 ADD2 .window/x2 STZ2 |
||||
.window/y1 LDZ2 .window/h LDZ2 ADD2 .window/y2 STZ2 |
||||
.window/x1 LDZ2 .window/y1 LDZ2 .window/x2 LDZ2 .window/y2 LDZ2 #02 ;fill-rect JSR2 |
||||
.window/x1 LDZ2 .window/y1 LDZ2 .window/x2 LDZ2 .window/y2 LDZ2 #01 ;line-rect JSR2 |
||||
.window/x1 LDZ2 #0002 SUB2 .window/y1 LDZ2 #0002 SUB2 .window/x2 LDZ2 #0002 ADD2 .window/y2 LDZ2 #0002 ADD2 #01 ;line-rect JSR2 |
||||
|
||||
.window/x1 LDZ2 #0008 ADD2 .window/y1 LDZ2 #0010 ADD2 ;red_txt #05 ;draw-label JSR2 |
||||
.window/x1 LDZ2 #0038 ADD2 .Screen/x DEO2 |
||||
.System/r DEI2 #08 ;draw-short JSR2 |
||||
|
||||
.window/x1 LDZ2 #0008 ADD2 .window/y1 LDZ2 #0020 ADD2 ;green_txt #05 ;draw-label JSR2 |
||||
.window/x1 LDZ2 #0038 ADD2 .Screen/x DEO2 |
||||
.System/g DEI2 #08 ;draw-short JSR2 |
||||
|
||||
.window/x1 LDZ2 #0008 ADD2 .window/y1 LDZ2 #0030 ADD2 ;blue_txt #05 ;draw-label JSR2 |
||||
.window/x1 LDZ2 #0038 ADD2 .Screen/x DEO2 |
||||
.System/b DEI2 #08 ;draw-short JSR2 |
||||
|
||||
.window/x1 LDZ2 #0060 ADD2 .window/y1 LDZ2 #0010 ADD2 .window/x1 LDZ2 #0090 ADD2 #00 ;theme/r1 .selection LDZ ADD LDA 4** #01 ;draw-slider JSR2 |
||||
.window/x1 LDZ2 #0060 ADD2 .window/y1 LDZ2 #0020 ADD2 .window/x1 LDZ2 #0090 ADD2 #00 ;theme/g1 .selection LDZ ADD LDA 4** #01 ;draw-slider JSR2 |
||||
.window/x1 LDZ2 #0060 ADD2 .window/y1 LDZ2 #0030 ADD2 .window/x1 LDZ2 #0090 ADD2 #00 ;theme/b1 .selection LDZ ADD LDA 4** #01 ;draw-slider JSR2 |
||||
|
||||
.window/x1 LDZ2 #0050 ADD2 .Screen/x DEO2 |
||||
.window/y1 LDZ2 #0040 ADD2 .Screen/y DEO2 |
||||
;radio_icns #00 .selection LDZ #00 EQU 8** ADD2 .Screen/addr DEO2 |
||||
#05 .Screen/sprite DEO |
||||
|
||||
.window/x1 LDZ2 #0060 ADD2 .Screen/x DEO2 |
||||
.window/y1 LDZ2 #0040 ADD2 .Screen/y DEO2 |
||||
;radio_icns #00 .selection LDZ #01 EQU 8** ADD2 .Screen/addr DEO2 |
||||
#05 .Screen/sprite DEO |
||||
|
||||
.window/x1 LDZ2 #0070 ADD2 .Screen/x DEO2 |
||||
.window/y1 LDZ2 #0040 ADD2 .Screen/y DEO2 |
||||
;radio_icns #00 .selection LDZ #02 EQU 8** ADD2 .Screen/addr DEO2 |
||||
#05 .Screen/sprite DEO |
||||
|
||||
.window/x1 LDZ2 #0080 ADD2 .Screen/x DEO2 |
||||
.window/y1 LDZ2 #0040 ADD2 .Screen/y DEO2 |
||||
;radio_icns #00 .selection LDZ #03 EQU 8** ADD2 .Screen/addr DEO2 |
||||
#05 .Screen/sprite DEO |
||||
|
||||
RTN |
||||
|
||||
@draw-cursor ( -- ) |
||||
|
||||
( clear last cursor ) |
||||
;pointer_icn .Screen/addr DEO2 |
||||
.pointer/x LDZ2 .Screen/x DEO2 |
||||
.pointer/y LDZ2 .Screen/y DEO2 |
||||
#40 .Screen/sprite DEO |
||||
|
||||
( record pointer positions ) |
||||
.Mouse/x DEI2 DUP2 .pointer/x STZ2 .Screen/x DEO2 |
||||
.Mouse/y DEI2 DUP2 .pointer/y STZ2 .Screen/y DEO2 |
||||
|
||||
#43 .Mouse/state DEI #00 NEQ DUP ADD SUB .Screen/sprite DEO |
||||
|
||||
RTN |
||||
|
||||
@draw-slider ( x1* y* x2* pos* color -- ) |
||||
|
||||
( load ) .color STZ .slider/pos STZ2 .slider/x2 STZ2 .slider/y STZ2 .slider/x1 STZ2 |
||||
|
||||
.slider/x1 LDZ2 .Screen/x DEO2 |
||||
.slider/y LDZ2 .Screen/y DEO2 |
||||
;halftone_icn .Screen/addr DEO2 |
||||
|
||||
;slidera_icn .Screen/addr DEO2 |
||||
( draw ) #05 .Screen/sprite DEO |
||||
;sliderb_icn .Screen/addr DEO2 |
||||
|
||||
&loop |
||||
( incr ) .Screen/x DEI2 8+ .Screen/x DEO2 |
||||
( draw ) #05 .Screen/sprite DEO |
||||
.Screen/x DEI2 .slider/x2 LDZ2 #0008 ADD2 LTH2 ,&loop JCN |
||||
|
||||
( incr ) .Screen/x DEI2 #0004 ADD2 .Screen/x DEO2 |
||||
;sliderc_icn .Screen/addr DEO2 |
||||
( draw ) #05 .Screen/sprite DEO |
||||
|
||||
.slider/x1 LDZ2 .slider/pos LDZ2 ADD2 .Screen/x DEO2 |
||||
;sliderd_icn .Screen/addr DEO2 |
||||
( draw ) #0a .Screen/sprite DEO |
||||
|
||||
RTN |
||||
|
||||
@fill-rect ( x1* y1* x2* y2* color -- ) |
||||
|
||||
.color STZ |
||||
STH2 ROT2 ROT2 STH2 ( x2 x1 / y2 y1 ) |
||||
&ver |
||||
( save ) STH2kr .Screen/y DEO2 |
||||
OVR2 OVR2 |
||||
&hor |
||||
( save ) DUP2 .Screen/x DEO2 |
||||
( draw ) .color LDZ .Screen/pixel DEO |
||||
( incr ) INC2 |
||||
GTH2k ,&hor JCN |
||||
POP2 POP2 |
||||
( incr ) INC2r |
||||
GTH2kr STHr ,&ver JCN |
||||
POP2 POP2 POP2r POP2r |
||||
|
||||
RTN |
||||
|
||||
@line-rect ( x1* y1* x2* y2* color -- ) |
||||
|
||||
STH |
||||
DUP2 ,&ver-y2 STR2 ,&hor-y2 STR2 |
||||
DUP2 ,&ver-x2 STR2 ,&hor-x2 STR2 |
||||
DUP2 ,&ver-y1 STR2 ,&hor-y1 STR2 |
||||
DUP2 ,&ver-x1 STR2 ,&hor-x1 STR2 |
||||
( horizontal ) |
||||
[ LIT2 &hor-x2 $2 ] INC2 [ LIT2 &hor-x1 $2 ] |
||||
&hor |
||||
DUP2 .Screen/x DEO2 |
||||
[ LIT2 &hor-y1 $2 ] .Screen/y DEO2 STHkr .Screen/pixel DEOk |
||||
[ LIT2 &hor-y2 $2 ] .Screen/y DEO2 DEO |
||||
INC2 GTH2k ,&hor JCN |
||||
POP2 POP2 |
||||
( vertical ) |
||||
[ LIT2 &ver-y2 $2 ] [ LIT2 &ver-y1 $2 ] |
||||
&ver |
||||
DUP2 .Screen/y DEO2 |
||||
[ LIT2 &ver-x1 $2 ] .Screen/x DEO2 STHkr .Screen/pixel DEOk |
||||
[ LIT2 &ver-x2 $2 ] .Screen/x DEO2 DEO |
||||
INC2 GTH2k ,&ver JCN |
||||
POP2 POP2 |
||||
POPr |
||||
|
||||
RTN |
||||
|
||||
@draw-label ( x* y* addr* color -- ) |
||||
|
||||
STH STH2 |
||||
.Screen/y DEO2 |
||||
.Screen/x DEO2 |
||||
STH2r |
||||
&loop |
||||
LDAk #00 SWP 8** |
||||
;font ADD2 .Screen/addr DEO2 |
||||
( draw ) STHkr .Screen/sprite DEO |
||||
( incr ) ++ |
||||
( incr ) .Screen/x DEI2 8+ .Screen/x DEO2 |
||||
LDAk ,&loop JCN |
||||
POP2 POPr |
||||
|
||||
RTN |
||||
|
||||
@draw-short ( short* color -- ) |
||||
|
||||
STH SWP |
||||
DUP #04 SFT #00 SWP 8** ;font-hex ADD2 .Screen/addr DEO2 |
||||
( draw ) STHkr .Screen/sprite DEO |
||||
#0f AND #00 SWP 8** ;font-hex ADD2 .Screen/addr DEO2 |
||||
.Screen/x DEI2 8+ .Screen/x DEO2 |
||||
( draw ) STHkr .Screen/sprite DEO |
||||
DUP #04 SFT #00 SWP 8** ;font-hex ADD2 .Screen/addr DEO2 |
||||
.Screen/x DEI2 8+ .Screen/x DEO2 |
||||
( draw ) STHkr .Screen/sprite DEO |
||||
#0f AND #00 SWP 8** ;font-hex ADD2 .Screen/addr DEO2 |
||||
.Screen/x DEI2 8+ .Screen/x DEO2 |
||||
( draw ) STHr .Screen/sprite DEO |
||||
|
||||
RTN |
||||
|
||||
@red_txt [ "Red 00 ] |
||||
@green_txt [ "Green 00 ] |
||||
@blue_txt [ "Blue 00 ] |
||||
|
||||
@pointer_icn [ 80c0 e0f0 f8e0 1000 ] |
||||
@halftone_icn [ aa55 aa55 aa55 aa55 ] |
||||
@slidera_icn [ 3f7f ffff ffff 7f3f ] |
||||
@sliderb_icn [ ffff ffff ffff ffff ] |
||||
@sliderc_icn [ fcfe ffff ffff fefc ] |
||||
@sliderd_icn [ 003c 7e7e 7e7e 3c00 ] |
||||
|
||||
@preview_icn |
||||
183c 66db db66 3c18 |
||||
0000 183c 3c18 0000 |
||||
@radio_icns |
||||
3c42 8181 8181 423c |
||||
3c42 99bd bd99 423c |
||||
|
||||
@font-hex |
||||
003c 464a 5262 3c00 0018 0808 0808 1c00 |
||||
003c 4202 3c40 7e00 003c 421c 0242 3c00 |
||||
000c 1424 447e 0400 007e 407c 0242 3c00 |
||||
003c 407c 4242 3c00 007e 0204 0810 1000 |
||||
003c 423c 4242 3c00 003c 4242 3e02 3c00 |
||||
003c 4242 7e42 4200 007c 427c 4242 7c00 |
||||
003c 4240 4042 3c00 007c 4242 4242 7c00 |
||||
007e 4078 4040 7e00 007e 4078 4040 4000 |
||||
|
||||
@font ( spectrum-zx font ) |
||||
0000 0000 0000 0000 0000 2400 7e3c 0000 0000 2400 3c42 0000 0000 6c7c 7c38 1000 |
||||
0010 387c 7c38 1000 0038 387c 6c10 3800 0010 387c 7c10 3800 0000 0018 1800 0000 |
||||
007e 4242 4242 7e00 0000 1824 2418 0000 0018 2442 4224 1800 001e 063a 4a48 3000 |
||||
0038 446c 107c 1000 000c 0808 0838 3800 003e 2222 2266 6600 0000 0822 0022 0800 |
||||
0000 1018 1c18 1000 0000 0818 3818 0800 0008 1c00 001c 0800 0028 2828 2800 2800 |
||||
003e 4a4a 3a0a 0a00 000c 3046 620c 3000 0000 0000 0000 ffff 0010 3800 3810 0038 |
||||
0008 1c2a 0808 0800 0008 0808 2a1c 0800 0000 0804 7e04 0800 0000 1020 7e20 1000 |
||||
0000 4040 7e00 0000 0000 0024 6624 0000 0000 1038 7c00 0000 0000 007c 3810 0000 |
||||
0000 0000 0000 0000 0008 0808 0800 0800 0014 1400 0000 0000 0024 7e24 247e 2400 |
||||
0008 1e28 1c0a 3c08 0042 0408 1020 4200 0030 4832 4c44 3a00 0008 1000 0000 0000 |
||||
0004 0808 0808 0400 0010 0808 0808 1000 0000 1408 3e08 1400 0000 0808 3e08 0800 |
||||
0000 0000 0008 0810 0000 0000 3c00 0000 0000 0000 0000 0800 0000 0204 0810 2000 |
||||
003c 464a 5262 3c00 0018 2808 0808 3e00 003c 4202 3c40 7e00 003c 421c 0242 3c00 |
||||
0008 1828 487e 0800 007e 407c 0242 3c00 003c 407c 4242 3c00 007e 0204 0810 1000 |
||||
003c 423c 4242 3c00 003c 4242 3e02 3c00 0000 0008 0000 0800 0000 0800 0008 0810 |
||||
0000 0810 2010 0800 0000 003e 003e 0000 0000 1008 0408 1000 003c 4202 0c00 0800 |
||||
003c 425a 5442 3c00 0018 2442 7e42 4200 007c 427c 4242 7c00 003c 4240 4042 3c00 |
||||
0078 4442 4244 7800 007e 407c 4040 7e00 003e 4040 7c40 4000 003c 4240 4e42 3c00 |
||||
0042 427e 4242 4200 003e 0808 0808 3e00 0002 0202 4242 3c00 0044 4870 4844 4200 |
||||
0040 4040 4040 7e00 0042 665a 4242 4200 0042 6252 4a46 4200 003c 4242 4242 3c00 |
||||
007c 4242 7c40 4000 003c 4242 524a 3c00 007c 4242 7c44 4200 003c 403c 0242 3c00 |
||||
00fe 1010 1010 1000 0042 4242 4242 3c00 0042 4242 4224 1800 0042 4242 5a66 4200 |
||||
0042 2418 1824 4200 0082 4428 1010 1000 007e 0408 1020 7e00 000c 0808 0808 0c00 |
||||
0040 2010 0804 0200 0018 0808 0808 1800 0008 1422 0000 0000 0000 0000 0000 7e00 |
||||
0008 0400 0000 0000 0000 1c02 1e22 1e00 0020 203c 2222 3c00 0000 1e20 2020 1e00 |
||||
0002 021e 2222 1e00 0000 1c22 3c20 1e00 000c 101c 1010 1000 0000 1c22 221e 021c |
||||
0020 202c 3222 2200 0008 0018 0808 0400 0008 0008 0808 4830 0020 2428 3028 2400 |
||||
0010 1010 1010 0c00 0000 6854 5454 5400 0000 5864 4444 4400 0000 3844 4444 3800 |
||||
0000 7844 4478 4040 0000 3c44 443c 0406 0000 2c30 2020 2000 0000 3840 3804 7800 |
||||
0010 103c 1010 0c00 0000 4444 4444 3800 0000 4444 2828 1000 0000 4454 5454 2800 |
||||
0000 4428 1028 4400 0000 4444 443c 0438 0000 7c08 1020 7c00 000c 0810 1008 0c00 |
||||
0008 0808 0808 0800 0030 1008 0810 3000 0000 0032 4c00 0000 3c42 99a1 a199 423c |
||||
Loading…
Reference in new issue