Jump to content
tep392

Multi-segment xex loading with VBI's

Recommended Posts

I'm having a problem with loading a multi-segment XEX file from DOS. I've done some searching but havn't found the answer yet.

 

I'm trying to create an xex file that will load an intro screen and then continue loading the game while the intro screen is displayed. I believe I have it setup correctly. The screen code is loaded and executed via the init vector 0x02E2. After it runs, it rts's to the DOS loader which then loads the main code and executes via the run vector 0x02E0.

 

Now here's the problem. My intro screen used DLI's and a vertical blank interrupt. The VBI stops executing after I rts back to the loader. It then restarts when the main code starts. Is it not possible to have a vertical blank interrupt running while dos is loading the binary? I haven't traced the DOS code but it seems to be preventing the VBI from executing. I did check NMIEN and both NMI's and DLI's are enabled while the loader is executing.

Share this post


Link to post
Share on other sites

Immediate VBlank via ($222) will work fine. Deferred via ($224) won't work during SIO operations.

The other problem is that DLIs can cause SIO problems, so can VBlank routines that run too long.

 

Both can cause problems with turbo loading systems.

Your best bet is to use VBlank Immediate ($222). Try and keep both the DLIs and VBI code real trim.

 

It might also be an idea to provide a mechanism to disable the load screen. Maybe have a pause with message like "Press Esc to disable loading screen". Give the user a few seconds to respond, if nothing happens or they hit a different key, just continue as normal.

Share this post


Link to post
Share on other sites

And there even can be situation in which the SIO IRQ sporadically prevents DLI/VBI (NMI) start. It's abug in the 6502 design.

At high SIO speeds this can cause DLI/VBI "drop out". There are several ways to make esp. DLI tolerant to this situation, but sometime it fill cause "flickering".

 

Besides this, the recommendation "Your best bet is to use VBlank Immediate ($222). Try and keep both the DLIs and VBI code real trim" is the best you can do.

Share this post


Link to post
Share on other sites

Thanks for the advice. I tried the immediate VBI and the intro screen works correctly now, but the loader stops after loading 40 bytes of the main program. I'm close to giving up on having this work with DOS.

Edited by tep392

Share this post


Link to post
Share on other sites

Maybe try eliminating other causes first.

 

Trim the VBlank and DLI down to a bare minimum for testing purposes.

 

e.g. VBlank just have INC $2C8 / JMP $E45F

DLI just have one and have PHA / LDA #0 / STA $D01A / PLA / RTI

Share this post


Link to post
Share on other sites

Trimmed down VBI routine might actually be the problem. You can omit most of what the OS stage 1 handler does, but you need to run OS timer 1 in the VBI handler. If you don't, SIO won't notice if a receive operation times out, and in particular the two frame timeout for commands is really required for reliability.

Share this post


Link to post
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.

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...