I'm trying to play a 3000hz sample, but as I've never programmed sound on the Dragon, I'm sure I'm not doing it right.
Here's my code:
Code: Select all
ORG 20000
orcc #$50 ; Disable Interrupts
lda $ff01 ; Select DAC as sound source
anda #$f7
sta $ff01
lda $ff03
anda #$f7
sta $ff03
lda $ff21 ; PIA direction
anda #$FB
sta $ff21
lda $ff23 ; Enable sound
ora #$8
sta $ff23
LDX #$35E2
doit LDA ,x+ ; 5 cycles
ANDA #$FC
STA $FF20 ; 5 cycles
; 272 cycles
CMPU #0 ; 4 * 8 = 32 cycles
CMPS #0
CMPU #0
CMPS #0
CMPU #0 ; 4 * 8 = 32 cycles
CMPS #0
CMPU #0
CMPS #0
CMPU #0 ; 4 * 8 = 32 cycles
CMPS #0
CMPU #0
CMPS #0
CMPU #0 ; 4 * 8 = 32 cycles
CMPS #0
CMPU #0
CMPS #0
CMPU #0 ; 4 * 8 = 32 cycles
CMPS #0
CMPU #0
CMPS #0
CMPU #0 ; 4 * 8 = 32 cycles
CMPS #0
CMPU #0
CMPS #0
CMPU #0 ; 4 * 8 = 32 cycles
CMPS #0
CMPU #0
CMPS #0
CMPU #0 ; 4 * 8 = 32 cycles
CMPS #0
CMPU #0
CMPS #0
CMPU #0 ; 2 * 8 = 16 cycles
CMPS #0
TFR x,d ; 6 cycles
CMPD #$4498 ; 8 cycles
BEQ theend ; 3 cycles
LBRA doit ; 5 cycles
theend ANDCC #$AF
RTS
Can anyone please tell me what am I doing wrong?
Cheers,
Rob