commanderx16 / x16-emulator

Emulator for the Commander X16 8-bit computer
384 stars 61 forks source link

Debugging improvements #439

Closed stefan-b-jakobsson closed 1 year ago

stefan-b-jakobsson commented 1 year ago

This PR is to improve debugging in two ways that are somewhat linked to each other.

Currently, all RAM is initialized to zero in the emulator. This is not the case on real hardware, where you must not rely on the values of uninitialized RAM.

From experience, it's easy to write code by mistake that needs some part of RAM being initialized to zero when you use the current emulator.

To make this kind of bug easier to find, I propose the following changes:

mist64 commented 1 year ago

(Sorry for the coding style nitpicks. I try to keep the code very consistent.)

stefan-b-jakobsson commented 1 year ago

I tried to handle your comments in b6bb6c8. I think randomized RAM is useful, as it will tell you more realistically if a program will fly on the real thing. But I now put it behind the option "-randram". Besides code formatting, I made changes so that these debug options do not have a performance impact when not selected. The commit ae453bb disables the debug message "buffer full...". It was originally disabled in R35, but I managed to have it return in the code you merged during the weekend. It is way too noisy, and should be removed.

stefan-b-jakobsson commented 1 year ago

About code formatting. I have no problem with strict formatting rules - I like that code looks consistent. I must improve my skills, but it's hard to learn old dogs new tricks (or to format code differently than what they are used to) :-)