Welcome, Guest. Please login or register.


Author Topic: "Freezer" cart (Read 2223 times)

Offline ssr86

  • EP user
  • *
  • Posts: 355
  • Country: pl
"Freezer" cart
« on: 2016.December.01. 18:07:35 »
How hard would it be to make a stripped-down freezer function cartridge (like final3, action replay for c64) that would allow saving game snapshots/screenshots onto a sd card?
(I mean as an upgrade to the sd card interface).

Offline ergoGnomik

  • EP addict
  • *
  • Posts: 1291
  • Country: hu
  • Stray cat from Commodore alley
Re: "Freezer" cart
« Reply #1 on: 2016.December.01. 18:58:43 »
Unfortunately, I don't know nearly anything about that SD interface. Yes, shame on me. However, if it goes into the Cartridge Port then it is impossible, if it goes into the Expansion Port then it is impossible to do it absolutely glitch free, and next to impossible to do it at all. This latter is meant in the sense that it requires around as much effort as it was necessary to make the Turbo Chameleon 64, and I can't really imagine that anyone would invest that much into this. Or at least, that's my understanding of the task.

Offline lgb

  • EP addict
  • *
  • Posts: 3563
  • Country: hu
  • æðsta yfirmaður
    • http://lgb.hu/
Re: "Freezer" cart
« Reply #2 on: 2016.December.01. 19:14:41 »
I guess ergoGnomik is right, if you mean _very_ exact freezing ... What was mentioned for the C64, would not do "very exact" save/load either, I think (I don't have my own experiences with these, but as far as I can say that from the theories at least) ... Since it's not possible to save/load the internal state of some hardware elements, that's true for C64 and EP too ... Well, yes, with things like Chameloen, it is, but the fact that it's an FPGA implementation of the whole machine, so it's easy to "extend" and "access" internal features too, unlike in the original hardware. I think, if you give up the "cycle exact" etc save/load then it's not impossible even without cloning the whole machine, though there are some non-readable (or other function if you read ..) I/O ports. So you need still something for example to "book" the state of I/O port writes (maybe a small RAM, which is written, if I/O ports are written?). Note however, that this kind of solutions can fail, eg it's not so much possible to save (then load back ...) the internal states of hardware elements, like Dave counter current values, Nick current scanline, and things like that ....

I just commented here, since - as far as I can remember correctly - this was already a topic somewhere and sometime but I don't know where and when :-D Anyway, it's possible that in the Hungarian section ...

Offline Zozosoft

  • Global Moderator
  • EP addict
  • *
  • Posts: 14723
  • Country: hu
    • http://enterprise.iko.hu/
Re: "Freezer" cart
« Reply #3 on: 2016.December.01. 19:34:02 »
I think it is near to impossible at all, or least very hard work needed with limitations.
On Z80 systems the NMI used for this function, which is jump to 66h. On ZX Spectrum this is in ROM area, and the external devices can disable the onboard ROM, and page in the own ROM.
On Enterprise this is in the Page 0 RAM, and it is a free usable area. And external devices can't change paging.
Need to install NMI routine to Page 0 before the program loaded, and hope it is don't overwrite it, and don't change P0 segment.

And when saveing machine state, many hw registers can't readed. Possibe solution make a mirror registers to the devices, which are remember for the last written values. But these are only the last written values, not are the actual state. (for example which LPB readed now)

And also problem to ask the current IM of Z80. My enhaced Spectrum Emulator program use this trick: it is set the I register to unusable value (point to ROM code), and check is it: if it is changed to normal used value then think: IM 2 mode used.
But at Enterprise programs this trick don't working, because full Z80 area can be a RAM.

Also problem with memory: it is not fixed size like as Spectrum 48 or Spectrum 128. Many different configurations exist. Possible read the current configuration, if the program don't overwrited the system segment...

I think more easy add snapshot save function to your favorite game :-)

Offline lgb

  • EP addict
  • *
  • Posts: 3563
  • Country: hu
  • æðsta yfirmaður
    • http://lgb.hu/
Re: "Freezer" cart
« Reply #4 on: 2016.December.01. 20:10:25 »
Yeah, that would work _a_bit_ with some ugly tricks. Like keeping the last written I/O regs in memory (which can be read then ...), on NMI, forcing 0xB0 to a known state (without messing up the "I/O register backup), being the ROM of the "freezer cartridge", but then maybe SP pointed there and it's a problem, etc etc. Things like used IM mode is hard to get even that. Also internal states, as I've written will not be saved, the exact scanline/LPB, etc ... Even with these serve limitations, it's kinda hard to do this in a hardware. And for sure, this kind of snapshot is "not portable" ie it's a problem if someone wants to load a machine (or even the same one having modification ....) with different ROMs, RAM amount, etc etc. I would say, it's not impossible but with very serve limitations and some ugly complex logic. For sure, it can be done, if you implement a whole Enterprise-128 in an FPGA, what Chameloen does (if I know well, it was born from the FPGA64 open source project once, though now it's not open source as the Chameloen). But then you have a whole computer in  FPGA ... Not even needing a "real" Enterprise hardware ...

Offline ssr86

  • EP user
  • *
  • Posts: 355
  • Country: pl
Re: "Freezer" cart
« Reply #5 on: 2016.December.01. 20:34:32 »
I've thought more in the lines of a "simple" memory backup (+ current PC) as the Action Replay cartridge (if I remember correctly) had. It was something like "Backup to tape/disc" and pirates used it to make tape versions of disc games (ripped into single level tape programs) and these loaded and started from the point the save was made. I had completely ignored the hardware state :oops: . Also the c64 has memory mapped io so maybe that's also a factor...

Offline lgb

  • EP addict
  • *
  • Posts: 3563
  • Country: hu
  • æðsta yfirmaður
    • http://lgb.hu/
Re: "Freezer" cart
« Reply #6 on: 2016.December.01. 21:05:17 »
I've thought more in the lines of a "simple" memory backup (+ current PC) as the Action Replay cartridge (if I remember correctly) had. It was something like "Backup to tape/disc" and pirates used it to make tape versions of disc games (ripped into single level tape programs) and these loaded and started from the point the save was made. I had completely ignored the hardware state :oops: . Also the c64 has memory mapped io so maybe that's also a factor...

The memory mapped I/O is not so much the problem, it's matter of some decoding that on C64 the I/O is the "memory" at address Dxxxh (if it's enabled with the CPU port, btw ...) where on EP, you need to decode IORQ etc etc, just the details are different. The main problem - I think - that C64 has more or less standard memory configuration. Ie, you have 64K RAM, kernal+basic+chargen ROM (at the very same "position"). You can have some memory expansions but non-standard, and I guess even FC etc won't save that. On the other hand, EPs are designed to have versatile and expandable, so there is not so much a "standard configuration", it's even hard to find two EPs with the really same ROM/RAM segments (even 128K RAM can be on different segments etc ...), especially today, maybe it was easy at the "golden" time of EP when most users has the stock machine only :) And oh well, the other things, Zozo mentioned too, etc ... And for sure, other possible problems as well ...