Videopac / Odyssey2 forum

Programming the Videopac / Odyssey2 => Programming => Topic started by: dr beep on July 03, 2021, 09:11:14 PM



Title: 2 soundeffects needed
Post by: dr beep on July 03, 2021, 09:11:14 PM
I have been searching but I can't find anything usefull to make some sound.

I need 2 soundeffects.

1 short beep to signal an item is correctly selected
1 longer beep (or higher beep) to signal any illegal move done.

Who can help with a small routine I can use in both cases?

Thanks!


Title: Re: 2 soundeffects needed
Post by: Rafael on July 03, 2021, 11:21:53 PM
Not sure if is it you needing, but here´s a routine by SOeren Gust:

start   section main
   ; wait silently until key pressed
   call   waitvsync
   call   readkey
   jb7   start
   ; play tune
   mov   a,#076h
   call   playsound
   ; repeat
   jmp   start
   endsection main

   org   0700h

mysoundirq
   ; check if BIOS sound or custom sound
   mov   a,r4
   add   a,#08ah      ; >= 076h
   jc   .custom
   jmp   soundirq   ; BIOS tune

.custom   ; custom sound handler, read sound opcodes from current page
   mov   a,r4
   movp   a,@a
   mov   r1,a      ; command byte
   inc   r4
   xrl   a,#0fh
   jz   .op0f      ; test for new opcode
   mov   a,r4
   movp   a,@a
   mov   r2,a      ; parameter byte
   jmp   parsesnd   ; let BIOS sound IRQ handle opcode

   ; opcode 0F: sound off, copy next 3 bytes into A7/8/9
.op0f   mov   r0,#vdc_soundctrl
   clr   a
   movx   @r0,a      ; old sound off
   mov   r0,#vdc_sound0
   mov   r1,#3      ; number of bytes to copy
.loop   mov   a,r4
   movp   a,@a
   movx   @r0,a
   inc   r0
   inc   r4
   djnz   r1,.loop
   jmp   mysoundirq   ; restart sound handler

   org   0776h

; tune for level win on KTAA
   db   081h, 000h
   db   082h, 004h
   db   083h, 008h
   db   084h, 00ch
   db   085h, 010h
   db   086h, 014h
   db   087h, 018h
   db   088h, 01ch
   db   089h, 020h
   db   08ah, 024h
   db   021h, 0

   end


Title: Re: 2 soundeffects needed
Post by: Chris! on July 11, 2021, 12:54:28 AM
How about the buzz sound effect for an incorrect answer and the keypress sound effect for the other one.