[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: 6502 Multitasking OS announce
holger@deep.hb.provi.de (Holger Bruns) wrote:
>An operating system for the 6502 should have some of the properties of CPM.
>Parameters could be passed into registers and some zeropage locations.
>The operating system should be invoked with the BRK instruction. This was my
>latest idea. But it seems so far, I am to late. I do not know, if your system
>works in this way, Andre. I have not seen your code until now. But you have
>done the job. My congratulations.
>
There are two problems with the above:
1) Passing parameters via registers is not such a great idea on the 6502 because,
as you know, there are only three of them. It's very difficult to convery
any amount of information in 24 total bits of data. At best you get on address
and one byte of data. Not enough really.
2) Passing parameters via zero page has problems with the fact that your code will
NOT be reentrant. If you propose to do ANY multitasking whatsoever, you must
write reentrant code. If you don't, the following will happen:
1. parameters are installed and program jumps to routine
2. timer interrupt comes in and invokes the dispatcher which then
decides to give time to another task
3. other task determines that the same work needs to be done calls the
routine of step 1
4. the routine completes and the processor returns to the original task
5. the original task pulls its parameters out of ram only to find that
they were corrupted by the last task who stored its parameters in the
some block of RAM.
The way to get around this is to pass all parameters on the stack, and use separate
stacks for the separate tasks.
Hope this helps...
Michael Ellis