Skip to content

Instantly share code, notes, and snippets.

@cheery
Created February 5, 2019 19:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cheery/b7a209a18bc6ca9c5037a64845d198b9 to your computer and use it in GitHub Desktop.
Save cheery/b7a209a18bc6ca9c5037a64845d198b9 to your computer and use it in GitHub Desktop.
C128 assembly program
. 1800 LDX #$00 # This clears the SID memory
LDA #$00
STA $D400,X
INX
CPX #$29
BNE $1804
. 180C LDX #$0F # Set master volume
STX $D418
LDX #$4F # Set attack/decay
STX $D405
LDX #$08 # Set duty cycle high byte
STX $D403
LDX #$00 # Set frequency high byte.
STX $D401
LDX #$41 # Pulse, gate on
STX $D404
. 1825 LDA $D012 # Vertical refresh wait
CMP #$FF
BNE $1825
CLC # Add to frequency
LDA #$03
ADC $D400
LDA #$00
ADC $D401
STA $D401
CMP #$F0 # If frequency not tapped, blah.
BPL $1825
LDA #$0B # Shorten decay for the last.
STA $D405
. 1846 LDX #$00
. 1848 LDA $D012 # Vertical refresh wait again.
CMP #$FF
BNE $1848
INX
CPX #$20
BNE $1848
BRK
J F1800
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment