A unix like FORK instruction has been added to the core. This allows a unix paradigm to used when setting up a task. A sample test of the FORK instruction seems to work. It runs keyboard initialization as a task.
Code: Select all
FORK #6 ; use context register #6
TTA ; get the running context (pid) (Transfer TR to Acc)
CMP #6 ; are we running in context #6 ?
LBEQ KeybdInit ; if so, initialize keyboard
.... continues with monitor code
The stack has been modified so that it no longer resides in the data segment. Instead the stack pointer is a flat unsegmented address pointer (or rather based on stack segment value of zero).
I ran into problems calling BIOS routines where the data segment needed to be switched. This created havoc with the stack since it was located in the data segment.
I've been writing a little invaders app that runs with its own data segment at $10000. However I'd like to be able to call BIOS routines. BIOS routines assume the data segment is $0000. That means the data segment needed to be switched. However, as soon as the DS was changed, the stack was lost because the stack was located by the data segment.
Unfortunately, the only way to change the DS is by pushing a value onto the stack, then popping the DS.
Since the stack was being switched around, interrupts also had to be disabled while this took place. It ended up being a whole bunch of ugly nonsense. 30+ bytes of code just to call a subroutine.
I'd planned to use shared memory located by using segment zero, as a means to communicate parameters to tasks, rather than the stack. So I thought having the stack in the data segment wouldn't be a big issue. Live and learn.
The other alternative I've been toying with is having four segment registers like the x86.