youki Posted March 26, 2009 Share Posted March 26, 2009 Hi, I did some ASM test routine for sound few time ago using HITECH C , I called my_sound() function from C , and the my_sound function was implemented in a ASM file. here a sample of a ASM File: psect text global set_reg_1 global _my_sound ; my_sound (void) _my_sound: ld a,87h out (0f0h),a ld a,35h out (0f0h),a ld a,90h out (0f0h),a ret that worked well with HITECH C. Now i'm using SDCC I want do the same thing. But it seems the SDCC does not like "out (0f0h)" . How to do? I'm not a Z80 expert at all. Thanks Quote Link to comment Share on other sites More sharing options...
JamesD Posted March 26, 2009 Share Posted March 26, 2009 I'm guessing it doesn't like the numeric format. Try: out (0xf0) But that's just a guess. Quote Link to comment Share on other sites More sharing options...
youki Posted March 27, 2009 Author Share Posted March 27, 2009 I'm guessing it doesn't like the numeric format. Try: out (0xf0) But that's just a guess. Thanks but i had tried that too , as well out($f0) In fact , after lot of try, i manage to do what i want like that : ; mysound.s .module _direct_sound ; global from this code .globl _direct_sound ;_direct_sound (byte sound); .area _CODE _direct_sound: pop bc pop de push de push bc push ix push iy ld b,e ld a,#240 ld c,a out (c),b pop iy pop ix ret not sure if it is a good way ... but for my test it is enough. ... i think i should buy a book on Z80 asm... (i'm more familiar with 6502 and 68000) Quote Link to comment Share on other sites More sharing options...
JamesD Posted March 27, 2009 Share Posted March 27, 2009 Oops, that was supposed to be: out (0xf0),a The only other thing I can think of to try is: out (#0xf0),a There is a section in the SDCC docs on inline assembler but it doesn't mention the out instruction. Quote Link to comment Share on other sites More sharing options...
PkK Posted March 29, 2009 Share Posted March 29, 2009 out (0xbe), a Works fine for me. Philipp Quote Link to comment Share on other sites More sharing options...
newcoleco Posted April 6, 2009 Share Posted April 6, 2009 The answer was : The assembler part of what is done during the NMI include getting new values from joysticks and updating sound. So, if you try hearing a sound you make outiside the coleco bios sound routines when the nmi is enabled, of course you will not hear a sound. I don't know what you are trying to do, but the coleco bios sound routines are there. If you really want to turn this off, you will have to open the file crtcv.s (in the lib4k folder), comment the updating sounds calls, and double-click on build.bat to recompile the library... or trying to use the sound routines available in the devkit. Quote Link to comment Share on other sites More sharing options...
youki Posted April 7, 2009 Author Share Posted April 7, 2009 (edited) The answer was : The assembler part of what is done during the NMI include getting new values from joysticks and updating sound. So, if you try hearing a sound you make outiside the coleco bios sound routines when the nmi is enabled, of course you will not hear a sound. I don't know what you are trying to do, but the coleco bios sound routines are there. If you really want to turn this off, you will have to open the file crtcv.s (in the lib4k folder), comment the updating sounds calls, and double-click on build.bat to recompile the library... or trying to use the sound routines available in the devkit. Hi Daniel , I managed to perform my directsound. The question was just the "syntax" to use for the "out" in the .S file . It was just for test purpose. But what you say is interresting. But my current sound routine does not use the Coleco bios sound routines. I'm using just direct output on the 0xff port. And my music sounds strange like if the note was not maintained and cut too early. So it is may be a side effect of what you are saying. I will try to turn off the bios routines! Thanks! #edit: Thanks so much Daniel!!!.. I have turned off the bios routines and now my music is perfect!!! Edited April 7, 2009 by youki Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.