A task switcher for the Final Expansion

Basic and Machine Language

Moderator: Moderators

Post Reply
Kananga
Vic 20 Afficionado
Posts: 317
Joined: Mon Mar 08, 2010 2:11 pm

A task switcher for the Final Expansion

Post by Kananga »

There are of course more amazing things going on, but here is another small contribution to the growing software pool for the VIC-20:

A task switcher for the VIC-20 & FE3. Link

(Already announced in the thread "WIP: VIC GUI", but now with more text ;-) )

--- README ---
FE3TS allows you to have up to eight virtual environments on your VIC-20 & FE3.
FE3TS-SV is an example for the supervisor written in BASIC that demonstrates
how to use the task switcher.

You can:
* create and reset environments
* switch between them by using the restore key
* save the state of an environment
* load the state of an environment

Everything works fine unless you overwrite the 3K RAM expansion area at $0400-$0FFF.

If the restore handler doesn't work, because the NMI vector was overwritten, just type SYS 1033 to return to the supervisor (environment 0).


Usage:
------

Code: Select all

LOAD"FE3TS.PRG",8,1
NEW
LOAD"FE3TS-SV.PRG",8
RUN
Interface to FE3TS:
-------------------

Code: Select all

SYS 1024
Initialises the environment structures.

Code: Select all

POKE 780, <nr> : SYS 1027
Resets environment <nr>. (<nr> between 0..7)

Code: Select all

POKE 780, <nr> : SYS 1030
Switches to environment <nr>. Before you can switch to an environments other than 0, you have to initialise it with a call to "Reset".

Code: Select all

SYS 1033
Switches to environment 0. (Equivalent to POKE 780, 0 : SYS 1030)

Code: Select all

POKE 780, <nr> : POKE 781, <file> : SYS 1036
Writes environment <nr> to <file>. You have to open a file in write mode before calling this routine and close it afterwards. <file> is the logical file number you chose for your file. You can write more than one environment to one file through successive calls to this routine.

Code: Select all

POKE 780, <nr> : POKE 781, <file> : SYS 1039
Reads environment <nr> from <file>. <file> is the logical file number of a file and must be open for reading.
Buy the new Bug-Wizard, the first 100 bugs are free!
Vic20-Ian
Vic 20 Scientist
Posts: 1214
Joined: Sun Aug 24, 2008 1:58 pm

Post by Vic20-Ian »

So the VIC now has a kind of unix like virtual console for 8 machines?

If above = true then WOW!
Vic20-Ian

The best things in life are Vic-20

Upgrade all new gadgets and mobiles to 3583 Bytes Free today! Ready
Kananga
Vic 20 Afficionado
Posts: 317
Joined: Mon Mar 08, 2010 2:11 pm

Post by Kananga »

Vic20-Ian wrote:So the VIC now has a kind of unix like virtual console for 8 machines?
Sorry, but no. It is neither multi-tasking nor multi-user.

You have 8 virtual machines (with one dedicated to be the supervisor), but they don't run simultaneously. If you switch back to the supervisor, all RAM, Video & CPU state is saved and you can
- switch to another machine.
- switch back to were you left.
- save the state to disk and load it again anytime later.
- hit reset (yellow button) to reset the active machine (only).
- (soft) reset the machine from the supervisor.

I have to admit that it works better than I expected, considering that the Vic-20 has no concept of memory protection. Also I do not see a way to reliably save & restore the state of the VIAs. It is just not possible.

Basically, I wanted to make use of the 512K RAM on the FE3 that is mostly idle, which is a shame ;)
Buy the new Bug-Wizard, the first 100 bugs are free!
Post Reply