This could have been improved in many ways.. maybe next year
Source is included.
GeoCities Download:
http://www.geocities.com/matrixz15/2009.zip
Enjoy.. and be welcome to do whatever good can be done with the source code.
Moderator: Moderators
Code: Select all
shoot_sound:
lda #$01
sta $400C
lda <random+3
and #$03
sta $400E
lda #$08
sta $400F
rts
explode_sound:
lda #0
sta $4015
lda #$F
sta $4010
lda #0
sta $4011
lda #0
sta $4012
lda #$C0-3 ; -3 to get rid of thump at end of sample
sta $4013
lda #$18
sta $4015
; Noise burst
lda #$00
sta $400C
lda <random+3
lsr a
and #1
adc #$0B
sta $400E
lda #$08
sta $400F
rts$400C=$01 sets the envelope decay rate (lower is faster) and turns on the hardware length counter.Petruza wrote:Matrixz and/or Blargg: could you explain the code for the sound effects?
[...]Code: Select all
shoot_sound: lda #$01 sta $400C lda <random+3 and #$03 sta $400E lda #$08 sta $400F rts
$4015=$00 turns off all length counters and the sample playback hardware.Code: Select all
explode_sound: lda #0 sta $4015 lda #$F sta $4010 lda #0 sta $4011 lda #0 sta $4012 lda #$C0-3 ; -3 to get rid of thump at end of sample sta $4013 lda #$18 sta $4015
Virtually identical to the first snippet, except at a lower pitch.Code: Select all
; Noise burst lda #$00 sta $400C lda <random+3 lsr a and #1 adc #$0B sta $400E lda #$08 sta $400F rts
By converting a .wav file, I'm guessing. See wiki article and conversion tool.Petruza wrote:So, it's reading the sample info from some binary data right?
How were that samples generated?