Francis -
Don't know if you've got sample playback working yet, but I've disassembled a beeb sample player that could be useful. It's from The Yorkshire Boys' Retribution demo demo, it's got all sorts of problems (only 4-bit, iffy timing, all interrupts disabled) but it works, it's standalone, and I think it's simple enough to post here. I've attempted to comment it where possible.
Code:
$00001C00: sei
$00001C01: lda #$FF ;set VIA DDR to output
$00001C03: sta $FE43
$00001C06: lda #$84 ;set all voices to max frequency
$00001C08: jsr $1C65
$00001C0B: lda #$00
$00001C0D: jsr $1C65
$00001C10: lda #$A4
$00001C12: jsr $1C65
$00001C15: lda #$00
$00001C17: jsr $1C65
$00001C1A: lda #$C4
$00001C1C: jsr $1C65
$00001C1F: lda #$00
$00001C21: jsr $1C65
$00001C24: lda #$00
$00001C26: sta $70
$00001C28: lda $75 ;set to $1D by loader, ie sample start $1D00
$00001C2A: sta $71
$00001C2C: ldy #$00
$00001C2E: lda ($70),y
$00001C30: and #$0F
$00001C32: jsr $1C79
$00001C35: ldy #$04
$00001C37: dey
$00001C38: bne $1C37
$00001C3A: lda ($70),y
$00001C3C: and #$F0
$00001C3E: lsr a
$00001C3F: lsr a
$00001C40: lsr a
$00001C41: lsr a
$00001C42: jsr $1C79
$00001C45: inc $70
$00001C47: bne $1C2C
$00001C49: inc $71
$00001C4B: lda $71
$00001C4D: cmp $76 ;set to $76, ie sample end at $75FF
$00001C4F: beq $1C00
$00001C51: lda #$81 ;check if key is pressed
$00001C53: ldx #$9D ;this actually causes a delay
$00001C55: ldy #$80 ;resulting in a minor bump every 256 samples
$00001C57: jsr $FFF4
$00001C5A: cpx #$FF
$00001C5C: bne $1C2C
$00001C5E: lda #$0F ;set all voices to no volume - not strictly necessary
$00001C60: jsr $1C79
$00001C63: cli
$00001C64: rts
$00001C65: sta $FE4F ;write data to soundchip
$00001C68: ldy #$00
$00001C6A: sty $FE40
$00001C6D: nop ;in a proper player, you'd do something useful with this time
$00001C6E: nop ;instead of just nop-ing
$00001C6F: nop
$00001C70: nop
$00001C71: nop
$00001C72: nop
$00001C73: ldy #$08
$00001C75: sty $FE40
$00001C78: rts
$00001C79: tay
$00001C7A: lda $1C92,y ;grab adjusted volume from lookup table
$00001C7D: ora #$90 ;write to all 3 volume registers
$00001C7F: jsr $1C65
$00001C82: ora #$20
$00001C84: jsr $1C65
$00001C87: eor #$60
$00001C89: jsr $1C65
$00001C8C: ldy $74 ;set to 35 by loader
$00001C8E: dey ;horrible delay loop
$00001C8F: bne $008E
$00001C91: rts
;lookup table to convert linear 4-bit sample to log 4-bit sample
$00001C92: .DB $00,$00,$01,$01,$01,$02,$02,$03,$04,$05,$06,$07,$08,$09,$0C,$0F