CPC Rulez https://cpcrulez.fr/forum/ |
|
Struggling to get any sounds https://cpcrulez.fr/forum/viewtopic.php?f=4&t=6000 |
Page 1 sur 1 |
Auteur : | Fabrizio [ 10 Oct 2017, 00:32 ] |
Sujet du message : | Struggling to get any sounds |
Hi everyone! I am trying to get some sound into my multi-system game CROSS CHASE https://github.com/Fabrizio-Caruso/CROSS-CHASE/releases The game is written in ANSI C and compiled with a different compilers for different targets. For the Z80 I am using Z88DK (CPCTelera not yet supported because I need to figure out how to adapt it to my "universal "Makefile). I am trying to get a couple of very simple short sounds like a beep and an explosion. So far I have failed miserably... I am trying to use simple sound queues but I get either no sound or random crackling sounds. For example: void __ping_sound(void) { #asm EXTERN firmware jr ping_code ping_data: defb 1,0,0,142,0,0,12,50,0 ping_code: ld hl,ping_data call firmware defw 0xbcaa #endasm } Who could help me with a very simple sound? Line a single short beep? |
Auteur : | xeirwn [ 04 Déc 2017, 20:36 ] |
Sujet du message : | Re: Struggling to get any sounds |
Here's my way of doing a simple "shoot" sound without using the firmware... Assembly only... some comments for explanations are included!! Code : ;Shooting
ld H,6:ld L,30:call setayreg ld H,7:ld L,55:call setayreg ld H,8:ld L,16:call setayreg ld H,11:ld L,255:call setayreg ld H,12:ld L,2:call setayreg ld H,13:ld L,1:call setayreg ret setayreg ; INPUT ;H = REG.AY ;L = VALUE DI ld bc,&F400:OUT(C),H ; Out &F400, H n° de registre ; donnee sur le port 1 ld bc,&F6C0:out(C),c ; xor a:out(c),a ;Out &F600, &C0 ; lecture du registre par le PSG ;Out &F600, &00 ; etat repos pour le PSG Jour ecrire le numero de registre qui deviendra actif DEC B:DEC B:OUT(C),L ;Out &F400, Valeur L ; donnee sur le port 1 ld bc,&F680:out(c),c:out(c),a ;Out &F600, &80 ; lecture de la donnee Jar le PSG ;Out &F600, 0 ; etat repos pour le PSG pour ranger une valeur dans le registre courant. EI RET |
Page 1 sur 1 | Le fuseau horaire est UTC+1 heure |
Powered by phpBB® Forum Software © phpBB Group https://www.phpbb.com/ |