Determine if an instance is running in the emulator vs on real hardware

All aspects of programming on the Commander X16.
Post Reply
russell-s-harper
Posts: 24
Joined: Sat Jan 27, 2024 7:22 pm

Determine if an instance is running in the emulator vs on real hardware

Post by russell-s-harper »

There is a bug in the hardware VERA in that the FX Line Helper in 4bpp mode doesn't correctly draw lines in octants where "sometimes horizontally increment" applies. Based on the discussion in the CX16 Video Discord https://discord.com/channels/5475596260 ... 9835214960 it appears as though this fix https://github.com/X16Community/vera-mo ... l/33/files exceeds a timing budget and produces undesirable side effects. I'm not sure of the next steps or when it will be fixed. The software VERA used in the emulator works okay.

In the meantime, the Helper sort of works in that for the affected octants it does draw lines in the reverse direction although it is decrementing by one byte as opposed to a nibble. I might be able to implement a temporary workaround where the lines will look janky but "good enough".

My question is: Is there a way to determine if an instance is running in the emulator vs on real hardware? It should be accessible using C.

Thank you,

Russell
User avatar
ahenry3068
Posts: 1218
Joined: Tue Apr 04, 2023 9:57 pm

Re: Determine if an instance is running in the emulator vs on real hardware

Post by ahenry3068 »

russell-s-harper wrote: Thu Dec 26, 2024 1:33 pm There is a bug in the hardware VERA in that the FX Line Helper in 4bpp mode doesn't correctly draw lines in octants where "sometimes horizontally increment" applies. Based on the discussion in the CX16 Video Discord https://discord.com/channels/5475596260 ... 9835214960 it appears as though this fix https://github.com/X16Community/vera-mo ... l/33/files exceeds a timing budget and produces undesirable side effects. I'm not sure of the next steps or when it will be fixed. The software VERA used in the emulator works okay.

In the meantime, the Helper sort of works in that for the affected octants it does draw lines in the reverse direction although it is decrementing by one byte as opposed to a nibble. I might be able to implement a temporary workaround where the lines will look janky but "good enough".

My question is: Is there a way to determine if an instance is running in the emulator vs on real hardware? It should be accessible using C.

Thank you,

Russell
I have a routine I use that determines HOSTFS vs SD-Card filesystem but that doesn't tell hardware for sure because it does detect Emulated SD-Card as well. There are Clock registers on the Emu that don't exist on hardware. (To read how many CPU cycles the Emulator has been running). You could probably work out a detection algorithm using those addresses.
User avatar
desertfish
Posts: 1126
Joined: Tue Aug 25, 2020 8:27 pm
Location: Netherlands

Re: Determine if an instance is running in the emulator vs on real hardware

Post by desertfish »

There are emulator-specific IO registers see https://github.com/X16Community/x16-emu ... -registers
the last 2 can tell you if you're on the emulator or not
russell-s-harper
Posts: 24
Joined: Sat Jan 27, 2024 7:22 pm

Re: Determine if an instance is running in the emulator vs on real hardware

Post by russell-s-harper »

desertfish wrote: Thu Dec 26, 2024 2:46 pm There are emulator-specific IO registers see https://github.com/X16Community/x16-emu ... -registers
the last 2 can tell you if you're on the emulator or not
Thank you. I can work with this! /Russell
Post Reply