Later it will be necessary.Chilly Willy wrote:You're welcome. If you need the mouse, I can work that in as well.
What function in SDK 0.9 is similar to function "VDP_setTileRectDma(u16 plan, const u16 *data, u16 x, u16 y, u16 w, u16 h);"?
Moderator: Stef
There is not as you cannot use DMA efficiently with VDP_setTileRect(...).Mixail wrote: What function in SDK 0.9 is similar to function "VDP_setTileRectDma(u16 plan, const u16 *data, u16 x, u16 y, u16 w, u16 h);"?
Code: Select all
// VBlank Callback
void _vblank_callback()
{
vtimer++;
// joy state refresh
JOY_update();
// palette fading processing
if (VBlankProcess & PROCESS_PALETTE_FADING)
{
if (!VDP_doStepFading()) VBlankProcess &= ~PROCESS_PALETTE_FADING;
}
// bitmap process
// if (VBlankProcess & PROCESS_BITMAP_TASK)
// {
// if (!BMP_doBlankProcess()) VBlankProcess &= ~PROCESS_BITMAP_TASK;
// }
// ...
// then call user's callback
if (VBlankCB) VBlankCB();
}
Yeah you're right, every spare cycle is important during VBlank.Chilly Willy wrote:Speaking of DMA, one thing I wanted to ask about.
...
Notice how it does the joypad update before calling the callback. Everyone knows that the only free time for vram update is the vblank, so it's quite likely that someone will setup a vblank callback to trigger pending DMA operations during the vblank. However, reading the pads takes a significant amount of time due to banging on the ports - even more so for six button pads, or especially the mouse. Given that, maybe the JOY_update() should be AFTER the callback instead of before. After all, the joy ports can be banged on at any time equally, while the DMA is best done in the vblank.
Actually, I thought of that too, and it's still valid reasoning. What you REALLY need here is TWO vblank callbacks: a pre and post CB. The pre callback would be first allowing the user to start DMA if need be, then all the heavy vblank stuff like JOY_update() occurs, then you call the post callback where the user can check the just-updated controllers.Stef wrote:Yeah you're right, every spare cycle is important during VBlank.Chilly Willy wrote:Speaking of DMA, one thing I wanted to ask about.
...
Notice how it does the joypad update before calling the callback. Everyone knows that the only free time for vram update is the vblank, so it's quite likely that someone will setup a vblank callback to trigger pending DMA operations during the vblank. However, reading the pads takes a significant amount of time due to banging on the ports - even more so for six button pads, or especially the mouse. Given that, maybe the JOY_update() should be AFTER the callback instead of before. After all, the joy ports can be banged on at any time equally, while the DMA is best done in the vblank.
I initially put the JOY_Update() here because i wanted joypad state to be updated before the user callback process but actually that doesn't mind even if user put its logic code in vblank...
I need to modify that, thanks for pointing it.
I could use a pre / post callback, and even a priority list system as you mention but i want to keep stuff simple for user and fast in implementation. Having a priority callback list on V-Int would probably gives a minor drawback in performance but this is another story for the H-Int...Chilly Willy wrote: Actually, I thought of that too, and it's still valid reasoning. What you REALLY need here is TWO vblank callbacks: a pre and post CB. The pre callback would be first allowing the user to start DMA if need be, then all the heavy vblank stuff like JOY_update() occurs, then you call the post callback where the user can check the just-updated controllers.
That would probably be the easiest way to handle this. A more flexible approach would be to do like the Amiga - have a priority based list of callbacks where the normal vblank code is inserted at a set priority, then tasks add vblank callbacks at a priority that would go before or after the system callback. Let's say the JOY_update() was in a callback added at priority 0; then you would add a callback for DMA at a priority of like 1 or 2, and reading the pads at -1 or -2.
yep : H-IntAre there other places in sgdk where that would make sense? A place where a system routine is done before calling the user callback. Perhaps callback lists could replace plain callbacks in general.
Indeed, you can always do that if you need itChilly Willy wrote:Ah, makes sense... keep it as fast as possible for those things. Well, if you want the pad state "fresh" - there's always the joypad callback - that's called immediately after reading the pad from the update function. That will do for folks that need lower lag.
Code: Select all
jtype = JOY_readJoypad(JOY_1) >> 12;
Code: Select all
#define JOY_TYPE_PAD3 0x00
#define JOY_TYPE_PAD6 0x01
#define JOY_TYPE_MOUSE 0x02
#define JOY_TYPE_UNKNOWN 0x0F
Code: Select all
mx = JOY_readJoypad(JOY_MOUSEX + i);
my = JOY_readJoypad(JOY_MOUSEY + i);
My current method of making 32X programs just uses a small assembly loop for the 68000. You COULD modify it to include some C, but you can't directly use sgdk with it. That's probably one of the things I'll work in support for now that I have write access to the repo.ammianus wrote:I haven't read the entire thread, but I briefly looked at the SGDK documentation in your google code site and did a forum search and didn't see this discussed.
Would any of the SGDK functions be useful for 32X development? If you wanted to use the MD to draw somethings in a 32X game, would it be wise to include parts or all of the SGDK for this? Or maybe for sound effects or something else?
I don't understand what problem you have.Mixail wrote:help me!Mixail wrote:There was such problem.
That it is possible to use from musical engine with sound engine PCM_ENV. What music and a sound played in common.
Code: Select all
/* <b>Z80_DRIVER_4PCM_ENV</b><br>
* 4 channels 8 bits signed sample driver with volume support.<br>
* It can mix up to 4 samples (8 bit signed) at a fixed 16 Khz rate.<br>
* with volume support (16 levels du to memory limitation).<br>
* Address and size of samples have to be 256 bytes boundary.<br>
* The driver does support "cutoff" when mixing so you can use true 8 bits samples :)<br>
*/
SND_setVolume_4PCM_ENV(SOUND_PCM_CH1, end);
if (SND_isPlaying_4PCM_ENV(SOUND_PCM_CH1_MSK))
SND_stopPlay_4PCM_ENV(SOUND_PCM_CH1);
else
SND_startPlay_4PCM_ENV(sample, sizeof(sample), SOUND_PCM_CH1, loop);