mirror of
https://git.sr.ht/~rabbits/uxn
synced 2024-11-27 16:23:02 +00:00
Ported examples to new audio api
This commit is contained in:
parent
dcfb6fb5bf
commit
edd7abdca5
3 changed files with 23 additions and 8 deletions
2
build.sh
2
build.sh
|
@ -28,7 +28,7 @@ else
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Assembling.."
|
echo "Assembling.."
|
||||||
./bin/assembler projects/examples/dev.audio.usm bin/boot.rom
|
./bin/assembler projects/examples/dev.time.usm bin/boot.rom
|
||||||
|
|
||||||
echo "Running.."
|
echo "Running.."
|
||||||
if [ "${2}" = '--cli' ];
|
if [ "${2}" = '--cli' ];
|
||||||
|
|
|
@ -10,9 +10,11 @@
|
||||||
;pointer { x 2 y 2 }
|
;pointer { x 2 y 2 }
|
||||||
;circle { xc 2 yc 2 x 2 y 2 r 2 d 2 }
|
;circle { xc 2 yc 2 x 2 y 2 r 2 d 2 }
|
||||||
|
|
||||||
|
|0100 ;Console { pad 8 char 1 byte 1 short 2 }
|
||||||
|0110 ;Screen { width 2 height 2 pad 4 x 2 y 2 color 1 }
|
|0110 ;Screen { width 2 height 2 pad 4 x 2 y 2 color 1 }
|
||||||
|0120 ;Sprite { pad 8 x 2 y 2 addr 2 color 1 }
|
|0120 ;Sprite { pad 8 x 2 y 2 addr 2 color 1 }
|
||||||
|0150 ;Mouse { x 2 y 2 state 1 chord 1 }
|
|0150 ;Mouse { x 2 y 2 state 1 chord 1 }
|
||||||
|
|0170 ;Audio { ch1adsr 2 ch2adsr 2 ch3adsr 2 ch4adsr 2 ch1vol 1 ch1pitch 1 ch2vol 1 ch2pitch 1 ch3vol 1 ch3pitch 1 ch4vol 1 ch4pitch 1 }
|
||||||
|01F0 ;System { pad 8 r 2 g 2 b 2 }
|
|01F0 ;System { pad 8 r 2 g 2 b 2 }
|
||||||
|0200 ^RESET JMP
|
|0200 ^RESET JMP
|
||||||
|0204 ,ERROR JMP2
|
|0204 ,ERROR JMP2
|
||||||
|
@ -20,8 +22,10 @@
|
||||||
|
|
||||||
@RESET
|
@RESET
|
||||||
|
|
||||||
( theme ) #13fd =System.r #1ef3 =System.g #1bf2 =System.b
|
( theme ) #03fd =System.r #0ef3 =System.g #0bf2 =System.b
|
||||||
|
|
||||||
|
#004f =Audio.ch1adsr #33 =Audio.ch1vol
|
||||||
|
|
||||||
BRK
|
BRK
|
||||||
|
|
||||||
@FRAME
|
@FRAME
|
||||||
|
@ -32,9 +36,11 @@ BRK
|
||||||
,draw-cursor JSR2
|
,draw-cursor JSR2
|
||||||
|
|
||||||
~Mouse.state #00 EQU ^$no-touch JNZ
|
~Mouse.state #00 EQU ^$no-touch JNZ
|
||||||
~Mouse.x =circle.xc
|
~Mouse.x DUP2 =circle.xc
|
||||||
~Mouse.y =circle.yc
|
~Mouse.y DUP2 =circle.yc
|
||||||
#0000 =circle.r
|
#0000 =circle.r
|
||||||
|
( play sound ) ~Screen.width #000c DIV2 ADD2 #0002 DIV2 SWP POP =Audio.ch1pitch
|
||||||
|
( release ) #00 =Mouse.state
|
||||||
$no-touch
|
$no-touch
|
||||||
|
|
||||||
( draw )
|
( draw )
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
|0100 ;Console { pad 8 char 1 byte 1 short 2 }
|
|0100 ;Console { pad 8 char 1 byte 1 short 2 }
|
||||||
|0110 ;Screen { width 2 height 2 pad 4 x 2 y 2 color 1 }
|
|0110 ;Screen { width 2 height 2 pad 4 x 2 y 2 color 1 }
|
||||||
|0120 ;Sprite { pad 8 x 2 y 2 addr 2 color 1 }
|
|0120 ;Sprite { pad 8 x 2 y 2 addr 2 color 1 }
|
||||||
|0170 ;Audio { ch1adsr 2 ch2adsr 2 ch3adsr 2 ch4adsr 2 ch1pitch 1 ch1vol 1 ch2pitch 1 ch2vol 1 ch3pitch 1 ch3vol 1 ch4pitch 1 ch4vol 1 }
|
|0170 ;Audio { ch1adsr 2 ch2adsr 2 ch3adsr 2 ch4adsr 2 ch1vol 1 ch1pitch 1 ch2vol 1 ch2pitch 1 ch3vol 1 ch3pitch 1 ch4vol 1 ch4pitch 1 }
|
||||||
|0190 ;Time { year 2 month 1 day 1 hour 1 minute 1 second 1 dow 1 doy 2 isdst 1 get 1 }
|
|0190 ;Time { year 2 month 1 day 1 hour 1 minute 1 second 1 dow 1 doy 2 isdst 1 get 1 }
|
||||||
|01F0 ;System { pad 8 r 2 g 2 b 2 }
|
|01F0 ;System { pad 8 r 2 g 2 b 2 }
|
||||||
|
|
||||||
|
@ -33,6 +33,12 @@
|
||||||
|
|
||||||
( theme ) #0ff8 =System.r #0f08 =System.g #0f08 =System.b
|
( theme ) #0ff8 =System.r #0f08 =System.g #0f08 =System.b
|
||||||
|
|
||||||
|
#1000 =Audio.ch1adsr
|
||||||
|
#66 =Audio.ch1vol
|
||||||
|
|
||||||
|
#0003 =Audio.ch2adsr
|
||||||
|
#66 =Audio.ch2vol
|
||||||
|
|
||||||
BRK
|
BRK
|
||||||
|
|
||||||
@FRAME
|
@FRAME
|
||||||
|
@ -43,9 +49,12 @@ BRK
|
||||||
~Time.second ~current.second NEQ #01 JNZ BRK
|
~Time.second ~current.second NEQ #01 JNZ BRK
|
||||||
~Time.second =current.second
|
~Time.second =current.second
|
||||||
|
|
||||||
#1444 =Audio.ch1adsr
|
( play sounds )
|
||||||
~Time.second #1d ADD =Audio.ch1pitch
|
#0d =Audio.ch1pitch
|
||||||
~Time.second #03 AND #4b MUL #0f ADD =Audio.ch1vol
|
|
||||||
|
~Time.second #0f MOD #00 NEQ ^$no-tone JNZ
|
||||||
|
#0d #02 MUL =Audio.ch2pitch
|
||||||
|
$no-tone
|
||||||
|
|
||||||
( clear )
|
( clear )
|
||||||
#0080 SCALEX #0080 SCALEY ~needles.sx ~needles.sy #00 ,draw-line JSR2
|
#0080 SCALEX #0080 SCALEY ~needles.sx ~needles.sy #00 ,draw-line JSR2
|
||||||
|
|
Loading…
Reference in a new issue