Hola
Estoy intentando conseguir un bucle infinito con la misma música, con el 128K y el AY
He intentado varias cosas con los puertos del AY como ponerlos a 0 en un estado inicial
pero nada ha funcionado
Hay algo que se me escapa, pero no se que es
Esta es la rutina simple, que estoy probando con unas cuantas notas
En principio solo
A) Se pone la IM2 para que apunte a la ISR
B) La ISR va tocando notas
C) Desde la propia ISR se intenta poner el puntero de las notas otra vez al principio
En teoría esto debería funcionar ¿NO?
Os dejo la rutina por si alguien ve alguna forma de poder hacer un bucle infinito de música para que funcione
Gracias por adelantado
; Intentando hacer un bucle repetitivo con la misma musica
org 8000h
; Calculo de la direccion donde saltara la interrupcion IM2
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 $ ; Bucle infinito que solo espera para tocar musica
; Empiezxa la ISR
rsi
ld hl,(pos)
bucle
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 bucle
waitSound
ld (pos),hl
dec a
ld (hl),a
ei
ret
jumpNotes
inc hl
inc hl
ld (pos),hl
ei
ret
; Aqui llegamos cuando es el final de la musica
; y se deberia poner algo para repetir el bucle de nuevo
endMusic
; He intentando simplemente cambiando el puntero de las notas al inicio pero no ha funcionado
; Tambien he intentado otras cosas con los puertos del AY pero no ha funcionado
ld hl,notes
ld (pos),hl
ei
ret
; Puntero a las notas
pos dw notes
;Ejemplo de notas musicales
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
Help con música infinita en 128K y el AY
Moderador: Sir Cilve Sinclair
-
- rst 0
- Mensajes: 21
- Registrado: Mar Abr 30, 2019 8:52 am
-
- rst 0
- Mensajes: 21
- Registrado: Mar Abr 30, 2019 8:52 am
Re: Help con música infinita en 128K y el AY
Ya he encontrado el problema
Resulta que la rutina eliminaba los propios datos de la música y solo se podía ejecutar una vez
Por si a alguien le sirve aqui hay una solución que me han dado en otro foro
; ROUTINE BEGINS
; Trying to do infinite music ( WITH PASMO ASSEMBLER)
org 8000h
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 a,(delay)
or a ; check if we need to wait longer
jr nz,waitSound
ld hl,(pos)
loop
ld a,(hl)
or a
jr nz,startDelay
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 hl,delay
ld a,(hl)
dec a
ld (hl),a
ei
ret
startDelay
inc hl ; advance to next piece of music data
ld (pos),hl ; set up delay variable
ld (delay),a
jr waitSound
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
delay db 0
; RSI JUMP ADDRESS
lowRSI equ (rsi % 256)
hiRSI equ (rsi - lowRSI)/256
;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, 000h, 07eh, 000h, 002h, 0fch
db 000h, 003h, 000h, 00dh, 000h, 000h, 0a8h, 000h, 002h, 07eh
db 000h, 004h, 0fch, 000h, 005h, 000h, 019h, 000h, 000h, 0fch
db 000h, 009h, 000h, 000h, 0ffh, 000h
END begin
Resulta que la rutina eliminaba los propios datos de la música y solo se podía ejecutar una vez
Por si a alguien le sirve aqui hay una solución que me han dado en otro foro
; ROUTINE BEGINS
; Trying to do infinite music ( WITH PASMO ASSEMBLER)
org 8000h
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 a,(delay)
or a ; check if we need to wait longer
jr nz,waitSound
ld hl,(pos)
loop
ld a,(hl)
or a
jr nz,startDelay
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 hl,delay
ld a,(hl)
dec a
ld (hl),a
ei
ret
startDelay
inc hl ; advance to next piece of music data
ld (pos),hl ; set up delay variable
ld (delay),a
jr waitSound
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
delay db 0
; RSI JUMP ADDRESS
lowRSI equ (rsi % 256)
hiRSI equ (rsi - lowRSI)/256
;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, 000h, 07eh, 000h, 002h, 0fch
db 000h, 003h, 000h, 00dh, 000h, 000h, 0a8h, 000h, 002h, 07eh
db 000h, 004h, 0fch, 000h, 005h, 000h, 019h, 000h, 000h, 0fch
db 000h, 009h, 000h, 000h, 0ffh, 000h
END begin
¿Quién está conectado?
Usuarios navegando por este Foro: Bing [Bot] y 39 invitados