Repository navigation
GeoRAM IO handler for GEOS 64, sharing the REU's RAM bank code - #61
Conversation
Moves the RAM1/RAM2 8K bank allocator, the image preload and the numbered button save out of IOH_REU.c into RAMBanks.c, so the GeoRAM handler can use the same code. The REU keeps its own bank array and count: SerUSBIO's busy check reads NumREU_Banks to mean the REU's DMA is live, which a GeoRAM must not trip. Behavior is unchanged except that the save writes whole banks instead of a byte at a time.
A Berkeley Softworks geoRAM: the $DE00 page window onto RAM banks from RAMBanks.c, with the page ($DFFE) and 16K block ($DFFF) registers decoded across $DF80-$DFFF the way VICE does, leaving $DF00-$DF7F free. No DMA, so it is in every full build, TR and TR+, and serves C64 and C128 mode alike. Up to 512K, as much as fits beside a loaded crt; preloads SD:/georam.ram, and the special button saves the next free georamNNN.ram. Freed with the REU wherever the menu reclaims RAM.
A short write (card full, drive pulled) printed "Saved" and flashed the save LED. Load stops at a read error rather than adding -1 to its count.
…om one shared page
Placed before Debug it moved Debug's number, and that number is what eepAdNextIOHndlr stores, so a board saved with Debug as its default came up on GeoRAM. After Debug, with LastSelectableIOH moved to it, every selectable handler keeps the number it had.
SensoriumEmbedded
left a comment
There was a problem hiding this comment.
Thank you Kelly for the GEOS64 implementation, this is exciting! :)
I reviewed the whole GEOS set merged onto current main (57a9d76) in the order you suggested, each PR on top of the one before it, and built both targets at every step. The note on each PR covers only that PR's own changes. As always, feel free to push back on anything that's inappropriate or would take significant memory/code to resolve.
Memory: this adds 512 B of RAM1 variables and 576 B of ITCM code to the main image on both the TR and the TR+. Free-for-locals goes from 80,700 to 80,188 on the TR+ and from 127,644 to 127,132 on the TR. MinimalBoot and the extension image are unchanged. One improvement:
- Drop
GeoRAM_NoRAM(IOH_GeoRAM.c:38): 256 B of DTCM. It's never read:IO1Hndlr_GeoRAMreturns whenever there are no banks, and the handler only becomes current after its init has selected a page.
One thing to look at before merging:
1. A saved GeoRAM never comes back (IOH_GeoRAM.c:25, :63)
The button save goes through SaveRAMBanks's numbered naming, so it writes georam000.ram, georam001.ram and so on. The preload always reads georam.ram. The REU's preload file is a setting, but GeoRAM has no way to point at the saved file. So a GEOS RAM disk saved with the button is never loaded again unless the user renames the file on a computer.
Suggested fix: save over georam.ram, keeping the previous one as a backup if you like. Or preload the highest-numbered georamNNN.ram when there is one.
Hardware testing still to do: for one of us to possibly get to before release, not gates, and anything I noted that isn't listed is covered by your follow-ups or fine as it is
Your test program covers the 512K sizing, the block probe, every page and the register mirror, on a TR+ in C64 mode and in VICE.
- GeoRAM under GEOS itself, with GEOS's own geoRAM RAM disk
- a plain TR
- a C128 in 128 mode
- GeoRAM alongside a generic crt, where it gets less than 512K
- a button save followed by a relaunch (after fix 1)
- a preload with no SD card in the slot
- the REU now that its bank code has moved: a preload, a button save, and the freezer + REU modes (SSv5, Retro Replay, FC3 1.01)
- a downgrade with GeoRAM selected as Special IO: the handler numbers after it shift
- PAL
Thank you!
GeoRAM_NoRAM was never read: the IO handlers return while there are no banks. Init now points the window at the first page before it publishes the bank count, so that stays true without it; the two are volatile so the stores keep that order.
…oram.bak The button saved to the REU's numbered names (georam000.ram, ...), but preload reads only georam.ram, so a saved GeoRAM never came back. The new image is written to georam.tmp first and renamed into place only after the write succeeds. The REU keeps its numbered saves.
…nd puts it back if the save cannot take its place If the last rename failed, georam.ram was gone: the next session preloaded nothing, and saving that blank RAM removed georam.bak, the last good image.
… running handler's memory A launch is accepted while a handler is busy. One naming a TR menu path that does not exist returned after the CRT chips, REU, GeoRAM and SwiftLink buffers were freed, without resetting to the menu, leaving the running program on freed memory.
# Conflicts: # Source/Teensy/MinimalBoot/Common/IO_Handlers/IOH_REU.c # Source/Teensy/RemoteControl.ino
|
Thank you for reviewing the whole GEOS stack this carefully, and for the build at every step! I've merged current main (5f16876) into this PR and carried it up through #70, so all six merge cleanly again. Main had already made the same remote-launch fix this PR carried (find the TR menu target before freeing anything), so I took main's version and added Memory: across the whole stack, free-for-locals in the main image now drops 768 B on both boards (TR 123,548 to 122,780, TR+ 80,700 to 79,932), so the TR no longer crosses the 4 KiB alignment step. On this PR:
1. A saved GeoRAM never comes backFixed: the button save now writes Hardware testing
One unrelated thing I hit on main itself: |
Part of the GEOS 64 package (#61, #66, #67, #69, #70; #64 is separate). Adds a Berkeley Softworks geoRAM as a Special IO handler. GEOS 64 runs under this handler: the USB mouse (#66) and the TR block device (#69) put their registers in the IO page it leaves free.
RAMBanks.c): the REU's 8K bank allocation, image preload and numbered button save move out ofIOH_REU.cso GeoRAM can use them. The REU keeps its own bank array and count, and its saves still go to the next freereuNNN, now written in whole 8K banks instead of a byte at a time. A failed write is now reported instead of acked with the LED.IOH_GeoRAM:$DE00onto the page selected by the write-only$DFFE(page) and$DFFF(16K block) registers, decoded across$DF80–$DFFFas VICE does.$DF00–$DF7Fstays free.SD:/georam.ram. The special button saves back togeoram.ramthrough a temporary file, keeping the previous save asgeoram.bak.GeoRAM is the last manually selectable handler (
LastSelectableIOHmoves to it), so every handler number already saved in EEPROM keeps its meaning.Tested on a TR+ in an NTSC C64, and in PAL through a VIC-II Kawari:
georam.ramand keeps the previous one asgeoram.bak; a first-ever save createsgeoram.ram; with onlygeoram.bakand a stalegeoram.tmpon the card,.baksurvives and a newgeoram.ramis written.reu001,reu002, ...), and a stash/fetch from BASIC.Not run: GeoRAM beside a crt.