Enterprise Forever

:UK => Programming => Topic started by: Sdw on 2017.April.22. 13:40:10

Title: EXOS/EXDOS friendly programming
Post by: Sdw on 2017.April.22. 13:40:10
I thought it was time to start a new topic now, since the "research" part of the IRQ-loading seems to be almost done now!

As the tests have shown that there seems to be a way to actually load and have music playing at the same time, I need to start creating a system-friendly (EXOS/EXDOS) framework that will allow my demo to run, and then load from SD-card or RAMDISK between parts.
One issue is that my demo effects will need to have access to more or less the entire VRAM (I already have one cool effect that uses VRAM $0000-$e800!).
And my understanding is that the system resides in the last VRAM page ($ff).
In one of my earlier questions here on the forum, someone did suggest that it could be possible to copy the VRAM page to another page, and then restore it when the system was needed again.

Here's my plan in that case:

The first thing I would do on startup is to switch $ff into another bank, and then copy the contents to a non-vram bank.

On standard 128kb EP, the memory layout would be like this.

$f8 - Demo code
$f9 - Demo code
$fa - Partial demo code, at the end code that handles loading etc.
$fb - System segment copy
$fc - VRAM1 free for use by demo part
$fd - VRAM2 free for use by demo part
$fe - VRAM3 free for use by demo part
$ff - VRAM4 free for use by demo part

The, when it's time to load, I will copy it back, and during loading we have something like this:

$f8 - Free to load in new stuff
$f9 - Free to load in new stuff
$fa - Partial free to load in new stuff, at the end code that handles loading etc.
$fb - System segment copy - old, will be updated when loading completes.
$fc - VRAM1
$fd - VRAM2
$fe - VRAM3
$ff - System segment

When the loading is finished, I update the $fb page with the contents from $ff page.

Now, of course the next problem is that the segment layout above is only true for standard 128kb machine.
Since expanded machine with RAMDISK is one of the targets, I need to make sure that it works on that as well.
VRAM should still be in the same place, but the other four segments can be anywhere.
I can't just allocate to get the segments either, since the first two or three are probably already filled
by the .COM file being loaded.
Anyone have good ideas on this?

Another question - do I need to manually switch in the $ff segment to the last bank before calling EXOS?
Title: Re: EXOS/EXDOS friendly programming
Post by: IstvanV on 2017.April.22. 14:00:02
I can't just allocate to get the segments either, since the first two or three are probably already filled
by the .COM file being loaded.
Anyone have good ideas on this?

It is best to store the segment numbers in variables, rather than using fixed numbers, and where speed is important, self modifying code can be used. The second and third segments allocated for the .com file can be found at BFFD-BFFEh on the system segment.

Quote
Another question - do I need to manually switch in the $ff segment to the last bank before calling EXOS?

No, you only need the page 0 segment on port B0h, and a valid stack pointer (EXOS only uses a few bytes of user stack).
Title: Re: EXOS/EXDOS friendly programming
Post by: Zozosoft on 2017.April.22. 14:43:34
Expanded machines are possible in various configuration, for example EP64 with MICROTEAM card: 40-5F,FC-FF are the RAM segments. On Model 911 (https://www.youtube.com/watch?v=EuvBDcGRR6w) E0-EF,FC-FF.
At Enterprise 576K (http://ep128.hu/Album/Pic/Internal_512K_RAM_expansion.jpg): 10-1F,E0-EF,FC-FF.

The good way is what are IstvanV suggested.