Skip to content

Print warnings when reading write-only VERA register, or writing read-only#131

Merged
indigodarkwolf merged 1 commit into
indigodarkwolf:masterfrom
irmen:readwriteonlywarnings
Oct 14, 2025
Merged

Print warnings when reading write-only VERA register, or writing read-only#131
indigodarkwolf merged 1 commit into
indigodarkwolf:masterfrom
irmen:readwriteonlywarnings

Conversation

@irmen
Copy link
Copy Markdown
Contributor

@irmen irmen commented Oct 14, 2025

Box16's equivalent of X16Community/x16-emulator#359

Implemented after Wavicle's sleuthing for the cause of the Another World graphics glitch
see forum post https://cx16forum.com/forum/viewtopic.php?p=37485#p37485

example output

Warning: 086E read from write-only VERA register at 9F2B (DCSEL=6)
Warning: 0875 read from write-only VERA register at 9F2C (DCSEL=6)

question @indigodarkwolf I don't understand the difference between the "debug" versions of several routines and structures vs. the regular ones. Did I modify the right ones? When should you use the "debug" versions?
(example: debug_state6502.pc vs state6502.pc and vera_debug_video_read() vs vera_video_read())

@indigodarkwolf
Copy link
Copy Markdown
Owner

TL;DR: I think you got it right.

Most places would want to use state6502, because most places have always used that and the processor emulation didn't always support breakpoints that could trigger prior to an instruction running to completion. But you're doing something special.

debug_state6502 is the "debug copy" of the cpu's state made prior to executing the current operation, so that the CPU can return itself to that state in the event that an instruction halts mid-way due to a breakpoint. Since you're in the middle of an instruction, you probably want to refer to that debug copy since most folks won't easily be able to interpret a debug message that indicates a PC register that isn't aligned with the instruction, or worse, possibly points to the next instruction being executed. Lord knows I've certainly gotten confused by that in the past.

@indigodarkwolf indigodarkwolf merged commit 188bb36 into indigodarkwolf:master Oct 14, 2025
10 checks passed
@irmen irmen deleted the readwriteonlywarnings branch October 16, 2025 19:54
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