Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

suprterminal: fix unpredictable memory map due to uninitialized value #12872

Merged
merged 1 commit into from
Oct 12, 2024

Conversation

SpecLad
Copy link
Contributor

@SpecLad SpecLad commented Oct 12, 2024

Poking CFFF and then C300 is supposed to map the C800 range to the Sup'R'Terminal extension ROM.

But if you do that right after bootup, then the CFFF poke will not run a2bus_suprterminal_device::write_c800, because the C800 range is not yet assigned to the Sup'R'Terminal. (IOW, apple2_state:m_cnxx_slot is still -1.) Because of that, m_bC800IsRAM will remain uninitialized.

The C300 poke will then assign the C800 range to the Sup'R'Terminal, but since m_bC800IsRAM is uninitialized, it will be unpredictable whether accesses to that range go to the extension ROM or RAM.

Fix this by initializing m_bC800IsRAM in a2bus_suprterminal_device::device_start.

Poking CFFF and then C300 is supposed to map the C800 range to the
Sup'R'Terminal extension ROM.

But if you do that right after bootup, then the CFFF poke will not run
`a2bus_suprterminal_device::write_c800`, because the C800 range is not yet
assigned to the Sup'R'Terminal. (IOW, `apple2_state:m_cnxx_slot` is still -1.)
Because of that, `m_bC800IsRAM` will remain uninitialized.

The C300 poke will then assign the C800 range to the Sup'R'Terminal, but since
`m_bC800IsRAM` is uninitialized, it will be unpredictable whether accesses to
that range go to the extension ROM or RAM.

Fix this by initializing `m_bC800IsRAM` in
`a2bus_suprterminal_device::device_start`.
@cuavas cuavas merged commit b54aefd into mamedev:master Oct 12, 2024
5 checks passed
@SpecLad SpecLad deleted the suprterm-unpredictable-map branch October 12, 2024 17:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants