rm/rm380z.cpp: Fix vram access to allow reading of character data from screen #11988
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
As noted in https://mametesters.org/view.php?id=6484 the first character of the "Disc not ready" error message went missing when trying to boot from the monitor without a disc. The message was written correctly, but then corrupted because it was not possible for the firmware to read character data back from the screen. rm380z_state::videoram_read() always returned the last byte written to a (row,col) which was usually the attributes of a character rather than the character itself :-) This lead to some sort of bug in the firmware where it would overwrite the "D" character with zero.
I've updated rm380z_state::videoram_read() so that it returns the requested data (either a character or it's attributes) and the error message now displays correctly. While doing this I've also tidied up the vram storage so that it just uses two 2d arrays which seems to mirror the actual hardware from reading the documentation (it had separate banks of RAM for character data and attributes). This is also more efficient and make the code easier to read.
Unfortunately, I don't have any software for the machine but I wrote a quick assembler program to help debug and test the issue:
Before my change both the A and E registers contained 0x02 (the underline attribute) after running the program. Now A contains the character ('A').
The program can be assembled on Linux using z80asm and then loaded using the MAME debugger. To run start the 380Z front panel by pressing (Ctrl + F) and then enter j followed by 100.
It looks like there are other bugs in the driver so I will try to improve it further when time allows. It would also be nice to get the 480z driver to work (it's currently completely broken).