Jump to content
IGNORED

Out (0f0h) with SDCC kit?


youki

Recommended Posts

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

Link to comment
Share on other sites

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)

Link to comment
Share on other sites

  • 2 weeks later...

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.

Link to comment
Share on other sites

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 by youki
Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...