Skip to content

Instantly share code, notes, and snippets.

@thelbane
Last active December 23, 2019 21:09
Embed
What would you like to do?
; TO PLAY A TONE FROM APPLESOFT...
; POKE 769,DURATION : POKE 771,FREQUENCY : CALL 768
0300- A0 64 LDY #$FF ; LOAD DURATION
0302- A9 01 LDA #$FF ; LOAD FREQUENCY
0304- 85 FA STA $FA ; VALUE AT $FA WILL SLIDE DOWN, CREATING THE VIOLIN EFFECT
0306- AE 03 03 LDX $0303 ; INITIALIZE TONE COUNTER WITH FREQUENCY
0309- E4 FA CPX $FA ; COMPARE WITH SLIDING VALUE
030B- D0 03 BNE $0310 ; SKIP SPEAKER CLICK IF NOT EQUAL
030D- AD 30 C0 LDA $C030 ; CLICK SPEAKER
0310- CA DEX ; DECREMENT TONE COUNTER
0311- D0 F6 BNE $0309 ; LOOP UNTIL TONE COUNTER IS ZERO
0313- AD 30 C0 LDA $C030 ; CLICK SPEAKER AGAIN
0316- 88 DEY ; DECREASE DURATION COUNTER
0317- F0 07 BEQ $0320 ; BRANCH TO END IF DURATION COUNTER REACHES ZERO
0319- C6 FA DEC $FA ; ELSE DECREMENT THE SLIDING VALUE
031B- D0 E9 BNE $0306 ; LOOP UNTIL THE SLIDING VALUE IS ZERO
031D- 4C 02 03 JMP $0302 ; RESET SLIDING VALUE IF IT'S EQUAL TO ZERO
0320- 60 RTS ; DONE
@thelbane
Copy link
Author

Ack. It's clicky when the slider value resets. Ack! I used decimal values where I clearly meant to use hex! At least I can fix the latter easily.

@TedThompson
Copy link

TedThompson commented Sep 19, 2018

DATA 160,100,169,1,133,250,174,3,3,228,250,208,3,173,48,192,202,208,246,173,48,192,136,240,7,198,250,208,233,76,2,3,96
Just to make life easier for anyone else who finds it. Not too bad. In fact I made a little "tune" over at https://gist.github.com/TedThompson/f24afa324949bee61114ac22e1bf6df2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment