Menu

#2244 External RAM should be visible to the VIC in MAX Machine emulation mode.

v3.10
open-need-info
gpz
None
GTK3
x64sc
6 hours ago
2026-07-28
Pi Itsu
No

Presently "MAX Machine" emulation in x64sc seemingly does not allow the VIC chip to access the External 2k Cartridge RAM. This behavior is inconsistent with a real MAX machine (325565 Rev.B) (6703 PLA dated 4382) where the 2k External cartridge RAM is accessible by the VIC chip.

Attached is proof in the form of a sprite being displayed from sprite location 63, where MAX-BASIC variables live in External RAM.

1 Attachments

Discussion

  • gpz

    gpz - 2026-07-28

    For reference, this was discussed here:
    https://www.lemon64.com/forum/viewtopic.php?p=1103479

    still need to come up with that test program :)

     
  • gpz

    gpz - 2026-08-02

    Sooo, first half is done :) I updated the test program that shows the memory mapping for the CPU (so not quite what the ticket wants to fix, but we really should make sure this is ok first)

    Please have a look at https://sourceforge.net/p/vice-emu/code/HEAD/tree/testprogs/C64/carts/ultimax/

    ultimax(bin/crt) is the test program built for plain 16k ROM in Ultimax mode
    ultimax-maxbasic(bin/crt) is the test program built for Maxbasic Cartridge

    (They are really the same thing right now)

    So we first have to make sure the memory mapping for the CPU side is correct in all cases. I believe this is actually the case for both RAM and ROM, for both "c64" and "max" models, and for both cartridges. Questions arise about the I/O area:

    • in C64 mode, when using the Maxbasic cartridge, there apparently should be one page of the cartridge RAM visible in IO1 - which page is that? and what about IO2?
    • in MAX mode, how should the IO mirrors look like exactly? CIA1 at $dd.., $de.., $df.. ?

    (Please don't bother burning EPROMs yet. We should first make sure the emulation works like we expect the real Max Machine to work - then make the test work on that exact config - and only then confirm them on the real thing :))

     
  • Pi Itsu

    Pi Itsu - 2026-08-03

    I'll be referring to the linked schematic and my own experiences when talking about the 6703 PLA and Cartridge port pin assignments. The schematic was chosen because it exactly matches my MAX board revision. I understand there is a hand drawn Commodore schematic and a recreation of that by Ruud available on Zimmers also which might be related to an earlier revision of the Max boards, but I have my doubts that they relate to an actual released product.
    https://www.zimmers.net/anonftp/pub/cbm/schematics/computers/c64/maxschematic.jpg
    https://github.com/itsPkun/6703-Dumping

    Pin 7 of the cartridge port on the MAX is the chip select for External RAM.
    Pin7 of the cartridge port on a c64 is IO1.
    If you were to plug a MAX cartridge that has External RAM included (MAX-BASIC, MultiMAX) into a c64 then External RAM would be accessible via IO1. This equates to 06xx in the MAX's memory map or specifically 03xx on the 2k RAM chip itself.

    Do note that with MAX-BASIC, the CPU R/W on the cartridge port line isn't used. Rather a separate R/W signal is generated by the 6703 PLA and presents a qualified R/W for external RAM on cartridge pin 13. As this pin is reused for /DMA on a c64, and pulled high by default, the RAM on a MAX BASIC will be held in a constant read state.

    It is therefore impossible to write to the external RAM on a MAX cartridge on a c64. A read via IO1 would return 00 00 FF FF 00 00 FF FF or some other default RAM state (Unless some cartridge out in the wild has a ROM chip hanging off the External Ram chip select (?)).

    The MultiMAX may or may not use the qualified R/W signal. I don't own one, but if the schematics still exist online somewhere we can glean the answer from those.

    IO2 on the c64 is the same pin as the CIA chip select on a MAX. It is part of the loopback necessary for a MAX cartridge to use its CIA. Technically, accessing IO2 on a MAX cart will pull EXROM low. As the CPU is addressing IO2 at the time EXROM is pulled low this should be invisible to the CPU. IO2 would just therefore be a floating bus.

    IO mirrors on the MAX are both easy and complicated. The 6703 PLA only has A15 down to A10 to work with so each mirror can be no smaller than 4 pages.

    VIC - D000 - D3FF
    SID - D400 - D7FF
    COLOUR - D800 - DBFF
    CIA - DC00 - DFFF ~~

    ~~The default CIA mirroring scheme assumes the loopback between pins 10 and 9 of the cartridge port are joined together with no additional address decoding on the cartridge. This seems to be true for every MAX cartridge released so far. However, the loopback can be interrupted and additional address decoding can be done by the cartridge if the cartridge designer so desires. I imagine Commodore designed it like that so additional IO chips could be shoehorned into the memory map.

    Naturally this could alter the CIA mirroring. Because the cartridge designer can intercept the loopback and do whatever they want with the CIA Chip Select line, they can map it anywhere. Map the CIA to DF80, map it to the External RAM chip select, etc... How you emulate those possibilities I don't have an answer for.

    There is also the case that the 6703 PLA does not allow writing to the SID when BA is pulled low. No three cycle leeway. Do note I have only determined this for myself by reading my PLA dump. My methodology and conclusion is probably flawed.

     
  • gpz

    gpz - 10 hours ago

    Sooo - comitted the VICII test(s) and also the VICE fixes. Ultimax/Maxbasic/Multimax cartridges should now behave as expected, both in C64 and MAX Machine mode.

    Please test :)

     
  • gpz

    gpz - 6 hours ago
    • status: open --> open-need-info
    • assigned_to: gpz
     

Log in to post a comment.