Help with infinite music on 128K with the AY
Posted: Tue Jul 09, 2019 5:44 pm
Hi
I'm trying to play infinite simple music on 128K with the AY, but i don't know what is wrong with the loop
I tried this routine but doesn't work I don't know why
I tried some other stuff with the AY ports, but nothing worked
This is the simple routine if anyone want to help and fixit to do infinite loop
Only does:
A) Put IM2 ON
B) ISR play notes
C) When finish try to repeat at the begining of the notes ( this is the wrong part, i don't know why. I tried a lot of things)
Thanks in advance
; ROUTINE BEGINS
; Trying to do infinite music ( WITH PASMO ASSEMBLER)
org 8000h
; RSI JUMP ADDRESS
lowRSI equ (rsi % 256)
hiRSI equ (rsi - lowRSI)/256
begin
di
ld hl,$FEFF
ld (hl),lowRSI
inc hl
ld (hl), hiRSI
ld a,$FE
ld i,a
im 2 ; IM2 ON
ei
jr $ ; infinite loop only waits for play music
; RSI begin
rsi
ld hl,(pos)
loop
ld a,(hl)
or a
jr nz,waitSound
inc hl
ld a,(hl)
cp $FF
jr z,endMusic
cp $FE
jr z,jumpNotes
ld bc,$FFFD
out (c),a
inc hl
ld a,(hl)
ld b,$BF
out (c),a
inc hl
jr loop
waitSound
ld (pos),hl
dec a
ld (hl),a
ei
ret
jumpNotes
inc hl
inc hl
ld (pos),hl
ei
ret
; Here i must put something to begin again when the music ends
endMusic
; I tried this but doesn't work I don't know why
; I tried some other stuff with the AY ports but nothing worked
ld hl,notes
ld (pos),hl
ei
ret
; Music Pointer
pos dw notes
;Litle Music example
notes
db 000h, 007h, 038h, 000h, 008h, 000h, 000h, 009h, 000h
db 000h, 010h, 000h, 000h, 000h, 0fch, 000h, 001h, 000h
db 000h, 008h, 00fh, 019h, 000h, 07eh, 000h, 002h, 0fch
db 000h, 003h, 000h, 00dh, 000h, 0a8h, 000h, 002h, 07eh
db 000h, 004h, 0fch, 000h, 005h, 000h, 019h, 000h, 0fch
db 000h, 009h, 000h, 000h, 0ffh, 000h
END begin
;ROUTINE END
I'm trying to play infinite simple music on 128K with the AY, but i don't know what is wrong with the loop
I tried this routine but doesn't work I don't know why
I tried some other stuff with the AY ports, but nothing worked
This is the simple routine if anyone want to help and fixit to do infinite loop
Only does:
A) Put IM2 ON
B) ISR play notes
C) When finish try to repeat at the begining of the notes ( this is the wrong part, i don't know why. I tried a lot of things)
Thanks in advance
; ROUTINE BEGINS
; Trying to do infinite music ( WITH PASMO ASSEMBLER)
org 8000h
; RSI JUMP ADDRESS
lowRSI equ (rsi % 256)
hiRSI equ (rsi - lowRSI)/256
begin
di
ld hl,$FEFF
ld (hl),lowRSI
inc hl
ld (hl), hiRSI
ld a,$FE
ld i,a
im 2 ; IM2 ON
ei
jr $ ; infinite loop only waits for play music
; RSI begin
rsi
ld hl,(pos)
loop
ld a,(hl)
or a
jr nz,waitSound
inc hl
ld a,(hl)
cp $FF
jr z,endMusic
cp $FE
jr z,jumpNotes
ld bc,$FFFD
out (c),a
inc hl
ld a,(hl)
ld b,$BF
out (c),a
inc hl
jr loop
waitSound
ld (pos),hl
dec a
ld (hl),a
ei
ret
jumpNotes
inc hl
inc hl
ld (pos),hl
ei
ret
; Here i must put something to begin again when the music ends
endMusic
; I tried this but doesn't work I don't know why
; I tried some other stuff with the AY ports but nothing worked
ld hl,notes
ld (pos),hl
ei
ret
; Music Pointer
pos dw notes
;Litle Music example
notes
db 000h, 007h, 038h, 000h, 008h, 000h, 000h, 009h, 000h
db 000h, 010h, 000h, 000h, 000h, 0fch, 000h, 001h, 000h
db 000h, 008h, 00fh, 019h, 000h, 07eh, 000h, 002h, 0fch
db 000h, 003h, 000h, 00dh, 000h, 0a8h, 000h, 002h, 07eh
db 000h, 004h, 0fch, 000h, 005h, 000h, 019h, 000h, 0fch
db 000h, 009h, 000h, 000h, 0ffh, 000h
END begin
;ROUTINE END