tep392 #1 Posted March 1, 2012 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. Quote Share this post Link to post Share on other sites
Rybags #2 Posted March 1, 2012 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. Quote Share this post Link to post Share on other sites
+JAC! #3 Posted March 1, 2012 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. Quote Share this post Link to post Share on other sites
tep392 #4 Posted March 1, 2012 (edited) 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 March 1, 2012 by tep392 Quote Share this post Link to post Share on other sites
Rybags #5 Posted March 2, 2012 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 Quote Share this post Link to post Share on other sites
phaeron #6 Posted March 2, 2012 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. Quote Share this post Link to post Share on other sites