Monitor is able to view VERA memory, but does not save to file

This is the starting place for reporting bugs to the team. We will pass bug reports on to the developers after validating the reports.

You can report bugs in hardware, operating system (KERNAL or BASIC ROMs), the emulator, or the Demo library. For bugs specific to downloaded programs, use the download forum.
Fruggs
Posts: 4
Joined: Thu Oct 24, 2024 10:29 pm

Monitor is able to view VERA memory, but does not save to file

Post by Fruggs »

I wrote some code in BASIC to write to a palette, and looking for a lazy way to spin it out to a file that I can use BVLOAD later.

(I'm aware I could just write it out sequentially to a file instead or in addition to poking it in, but I want to be lazy)

Thought I'd try using the monitor but it looks like it's not saving from VRAM.

Reproduction:
1. Mess with the palette (tokenized EGAPALETTE.BAS will do)
2. Enter the monitor, enter some commands (a sample is included in the picture)
3. The output data looks way off from what the memory view showed (attached as SAMPLE.RAW inside the zip file, sorry, can't attach raw files)

Running on the emulator, haven't tried on hardware. I'm not sure where the data comes from, but the sample doesn't match the display at all.
Attachments
SAMPLE.zip
(188 Bytes) Downloaded 9 times
monPalSave.png
monPalSave.png (48.53 KiB) Viewed 339 times
EGAPALETTE.BAS
(967 Bytes) Downloaded 9 times
User avatar
ahenry3068
Posts: 1132
Joined: Tue Apr 04, 2023 9:57 pm

Re: Monitor is able to view VERA memory, but does not save to file

Post by ahenry3068 »

Fruggs wrote: Tue Nov 05, 2024 1:42 am I wrote some code in BASIC to write to a palette, and looking for a lazy way to spin it out to a file that I can use BVLOAD later.

(I'm aware I could just write it out sequentially to a file instead or in addition to poking it in, but I want to be lazy)

Thought I'd try using the monitor but it looks like it's not saving from VRAM.

Reproduction:
1. Mess with the palette (tokenized EGAPALETTE.BAS will do)
2. Enter the monitor, enter some commands (a sample is included in the picture)
3. The output data looks way off from what the memory view showed (attached as SAMPLE.RAW inside the zip file, sorry, can't attach raw files)

Running on the emulator, haven't tried on hardware. I'm not sure where the data comes from, but the sample doesn't match the display at all.
You might want to look at my game HANGMAN
viewtopic.php?p=30065#p30065
I threw the Kitchen Sink at this one. Among other things I did a Wysiwyg Palette Editor in BASIC into the mix.
It's a separate program from the main game. It's written using BASLOAD format not line numbered but it
is in BASIC.


There is a PAL2FILE subroutine in the Palette Editor.
paleditor.png
paleditor.png (14.13 KiB) Viewed 298 times
User avatar
ahenry3068
Posts: 1132
Joined: Tue Apr 04, 2023 9:57 pm

Re: Monitor is able to view VERA memory, but does not save to file

Post by ahenry3068 »

Also. I don't think you can directly view VERA ram from the monitor.

VERA Ram is accessed through a single DATA Port address and is not mapped to the main processor address space.
User avatar
desertfish
Posts: 1094
Joined: Tue Aug 25, 2020 8:27 pm
Location: Netherlands

Re: Monitor is able to view VERA memory, but does not save to file

Post by desertfish »

If you use the alternate emulator Box16, you actually can inspect VERA ram and then some. It provides a plethora of different monitoring and debugging windows
jaydg
Posts: 10
Joined: Tue Sep 24, 2024 10:23 pm

Re: Monitor is able to view VERA memory, but does not save to file

Post by jaydg »

ahenry3068 wrote: Tue Nov 05, 2024 8:12 am Also. I don't think you can directly view VERA ram from the monitor.

VERA Ram is accessed through a single DATA Port address and is not mapped to the main processor address space.
The K command lets you select a vram bank but I don't know if save/load respect that.
Fruggs
Posts: 4
Joined: Thu Oct 24, 2024 10:29 pm

Re: Monitor is able to view VERA memory, but does not save to file

Post by Fruggs »

ahenry3068 wrote: Tue Nov 05, 2024 8:02 am You might want to look at my game HANGMAN
viewtopic.php?p=30065#p30065
I threw the Kitchen Sink at this one. Among other things I did a Wysiwyg Palette Editor in BASIC into the mix.
It's a separate program from the main game. It's written using BASLOAD format not line numbered but it
is in BASIC.
Can't get easier than a tool already written! Thank you!
ahenry3068 wrote: Tue Nov 05, 2024 8:12 am Also. I don't think you can directly view VERA ram from the monitor.

VERA Ram is accessed through a single DATA Port address and is not mapped to the main processor address space.
Admittedly I didn't check all 512 bytes of the palette area, or the greater VRAM in general, but from the small 32 bytes I checked out, it looked like a match. That I might have gotten lucky and found a section of main RAM that had those same values doesn't seem likely.
desertfish wrote: Tue Nov 05, 2024 2:02 pm If you use the alternate emulator Box16, you actually can inspect VERA ram and then some. It provides a plethora of different monitoring and debugging windows
Is this the one you mean? https://github.com/indigodarkwolf/box16
Will it work with the current ROM release? Looks like it's matched with r41 instead of 48
DragWx
Posts: 341
Joined: Tue Mar 07, 2023 9:07 pm

Re: Monitor is able to view VERA memory, but does not save to file

Post by DragWx »

When you READ from VERA 1:F9C0..1:FFFF, you don't get the contents of the register, but rather the last byte written to that address by the CPU. On a cold boot, those values are unpredictable even if the registers themselves are initialized.

This information comes from here, the VERA chapter of the docs, the very end of the VRAM address space layout section.

I don't know that this is what's happening, but here's how you can check: Try writing some bytes to the palette, then dump the palette memory. Does the dump show unexpected values except for the bytes you wrote? If so, then that's what's happening. If everything is wrong, then it's a different issue.
User avatar
ahenry3068
Posts: 1132
Joined: Tue Apr 04, 2023 9:57 pm

Re: Monitor is able to view VERA memory, but does not save to file

Post by ahenry3068 »

DragWx wrote: Tue Nov 05, 2024 7:13 pm When you READ from VERA 1:F9C0..1:FFFF, you don't get the contents of the register, but rather the last byte written to that address by the CPU. On a cold boot, those values are unpredictable even if the registers themselves are initialized.

This information comes from here, the VERA chapter of the docs, the very end of the VRAM address space layout section.

I don't know that this is what's happening, but here's how you can check: Try writing some bytes to the palette, then dump the palette memory. Does the dump show unexpected values except for the bytes you wrote? If so, then that's what's happening. If everything is wrong, then it's a different issue.
I don't know about the rest of the memory. But somewhere around r45 they did start initializing the Palette Ram on boot so those should be reliable. (512 bytes starting at 1:$FA00) .. Before that came about I just made sure my code initialized them on program start
jaydg
Posts: 10
Joined: Tue Sep 24, 2024 10:23 pm

Re: Monitor is able to view VERA memory, but does not save to file

Post by jaydg »

Will it work with the current ROM release? Looks like it's matched with r41 instead of 48
--

When I built it locally I used 48. Have had no issues.
DragWx
Posts: 341
Joined: Tue Mar 07, 2023 9:07 pm

Re: Monitor is able to view VERA memory, but does not save to file

Post by DragWx »

ahenry3068 wrote: Tue Nov 05, 2024 7:31 pm I don't know about the rest of the memory. But somewhere around r45 they did start initializing the Palette Ram on boot so those should be reliable. (512 bytes starting at 1:$FA00)
I thought so too, I double checked, and it does, so that's not the issue.


The problem seems to be simpler: the monitor uses the plain Kernal LOAD and SAVE routines for the L and S commands. The monitor hardcodes L to always load to system memory (not the VERA), and SAVE can only read from system memory anyway.

So, while the monitor can be used to dump the contents of VRAM to the screen, there doesn't seem to be a way to use the S command to dump VRAM to a file.

You yourself would need to copy your data out of VRAM and into system memory first, then you could save that to a file.
Post Reply