[Coco] NitrOS9 and 6309 code
L. Curtis Boyle
curtisboyle at sasktel.net
Sat Jun 1 09:12:17 EDT 2019
That is correct to see if you are running on a 6309. Checking for native mode is a little more complicated (basically set up a stack to look like the CPU has pushed all registers, but with two copies of the RTI address so that both a 6809 and 6309 will go to your test code when you issue the RTI. At that point check either if W has changed to your stack version (obviously you should pre-Init W before the RTI to something different) or check the stack pointer to see if it moved by 12 or 14 bytes). Native mode should be checked to see if you are running NitrOS-9, as the plain 6309 test will pass even when running 6809 NitrOS-9, and any software that uses software interrupts (or redefines system calls - like Home Publisher) will not work correctly or crash.
Sent from my iPhone
> On Jun 1, 2019, at 6:09 AM, Robert Gault <robert.gault at att.net> wrote:
>
> Gene,
>
> The following should work as I believe the 6809 just ignores "illegal" opcode.
>
> ldb #123
> clrd
> tstb
> beq 6309 code
> 6809 code
>
> CLRD looks like a CLRA to a 6809 as it skips over the $10 in $10,$4F.
>
> Robert
>
> Gene Heskett wrote:
>> <snip>
>> I don't recall if there is a bulletproof method to actually do a runtime
>> test to see which processor we're running on, one that gives a yes/no
>> answer without crashing a 6809. Has anyone written such a critter yet?
>>
>> <snip>
>
> --
> Coco mailing list
> Coco at maltedmedia.com
> https://pairlist5.pair.net/mailman/listinfo/coco
>
More information about the Coco
mailing list