ENTERPRISE KLUB
2019. május 25., 1055 Budapest, Nyugati tér 9. 14-19 óráig
Részletek
Welcome, Guest. Please login or register.


Author Topic: EXOS/EXDOS friendly programming (Read 553 times)

Offline Sdw

  • User
  • *
  • Posts: 50
  • OS:
  • Windows 7/Server 2008 R2 Windows 7/Server 2008 R2
  • Browser:
  • Firefox 52.0 Firefox 52.0
    • View Profile
EXOS/EXDOS friendly programming
« 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?

Offline IstvanV

  • EP addict
  • *
  • Posts: 4806
  • OS:
  • Linux Linux
  • Browser:
  • Firefox 51.0 Firefox 51.0
    • View Profile
Re: EXOS/EXDOS friendly programming
« Reply #1 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).

Online Zozosoft

  • EP addict
  • *
  • Posts: 13330
  • Country: hu
  • OS:
  • Windows 7/Server 2008 R2 Windows 7/Server 2008 R2
  • Browser:
  • Firefox 53.0 Firefox 53.0
    • View Profile
    • http://enterprise.iko.hu/
Re: EXOS/EXDOS friendly programming
« Reply #2 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 E0-EF,FC-FF.
At Enterprise 576K: 10-1F,E0-EF,FC-FF.

The good way is what are IstvanV suggested.
« Last Edit: 2017.April.22. 14:48:07 by Zozosoft »