Gameboy Development Forum

Discussion about software development for the old-school Gameboys, ranging from the "Gray brick" to Gameboy Color
(Launched in 2008)

You are not logged in.

Ads

#1 2024-03-31 19:26:19

MadCornDog
New member
Registered: 2022-07-09
Posts: 2

Help with delay()

I'm making a game for nes and everythings been working smoothly until now. I'm trying to use the delay() function and I'm getting this error:

Code:

?ASlink-Warning-Undefined Global '_delay' referenced by module 'game'

I have the nes.h file included and my text editor can even find the delay function and its description.

Help please!

Offline

 

#2 2024-04-01 12:34:34

Ardis
Member
From: USA
Registered: 2019-06-06
Posts: 60
Website

Re: Help with delay()

I don't use the built in Delay() function, personally. I'll provide you with what I use instead.

Code:

void smartDelay(uint8_t interval, BOOLEAN musicPlaying){ //Delays the game for inverval number of frames by waiting for that frame to fully render before starting the next loop
    uint8_t i;
    for(i=0; i < interval; i++){
        if (musicPlaying == TRUE){
            // Frame specific music update, my code has been removed as it wouldn't be useful for NES
        }
        wait_vbl_done();
    }
}

It waits a specific number of vertical blank intervals/frames.

Hope this helps.

EDIT: This post was made assuming you're using the experimental NES support for GBDK. If you're using something else, the code above may be able to be adapted, but won't be a drop-in.

Last edited by Ardis (2024-04-01 12:35:43)


Also known as Arvex in other places.

Interceptor (Demo)
https://arvex.itch.io/interceptor

Offline

 

Board footer

Powered by PunBB
© Copyright 2002–2005 Rickard Andersson