Virtualc64: Rom-Ram Test Cartridge

Created on 3 Aug 2019  路  13Comments  路  Source: dirkwhoffmann/virtualc64

Hi, I have found this cartridge test:
romram.crt.zip

Vice:
Schermata 2019-08-03 alle 09 33 30

VirtualC64:
Schermata 2019-08-03 alle 09 34 06

...maybe it is only an unsupported cartridge !

bug

All 13 comments

馃 Seems like this cartridge is performing a test and VirtualC64 fails on that test.

I expect this to be a bug in the emulator. Needs investigation...

Hello, a blue screen for me too.
Is this really a bug ?

Yes it is, this romram.crt is a test that I have found also here:

https://vice-emu.pokefinder.org/index.php/Testbench

I have seen that it works on VICESC and in HOXS64

This cartridge actually just tests if EasyFlash is emulated correctly. The code is actually quite trivial:

; +-------------------------------------------------------------------------+
; |      This file was generated by The Interactive Disassembler (IDA)      |
; |           Copyright (c) 2020 Hex-Rays, <[email protected]>           |
; |                      License info: 48-3051-7314-20                      |
; |                       Markus Fritze, personal use                       |
; +-------------------------------------------------------------------------+

                .org 8000h
loc_8000:   SEI
                LDA     #7
                STA     0DE02h      ; EasyFlash: 16 Kb cart  (low bank at $8000, high bank at $a000)

; Copy 512 bytes to RAM
                LDX     #0
loc_8008:       LDA     loc_8000,X
                STA     loc_8000,X
                LDA     byte_8100,X
                STA     byte_8100,X
                INX
                BNE     loc_8008

                LDA     #4Ch        ; patch a JMP opcode into RAM
                STA     loc_8021
                LDA     #4
                STA     0DE02h      ; EasyFlash: Cartridge ROM off (256 Bytes of RAM still available at $dfxx)

loc_8021:       LDA     loc_8031    ; This should now be a JMP, if the ROM is off

                LDA     #2      ; red = fail
                STA     0D020h      ; VIA border color
                LDA     #0FFh
                STA     0D7FFh      ; exit emulator with code 255 (fail) - used by Kernal64
endless_a:      JMP     endless_a


loc_8031:       LDA     #5      ; green = success
                STA     0D020h      ; VIA border color
                LDA     #0
                STA     0D7FFh      ; exit emulator with code 0 (success) - used by Kernal64
endless_b:      JMP     endless_b

The details for EasyFlash can be found here

Without the green or red border, the crt is probably not recognized correctly.

Might be related to #564. I'll look into it...

My EasyFlash implementation doesn't handle the write correctly:

LDA     #4Ch        ; patch a JMP opcode into RAM
STA     loc_8021

If a ROM location is written to, it passes the write request to the Flash Roms, but doesn't write the value into the C64 RAM. Hence, it reads back a BRK where the JMP should be 馃檮.

Bildschirmfoto 2020-09-01 um 11 27 29

Working on a fix...

Green border 馃槑:

Bildschirmfoto 2020-09-01 um 11 47 32

However, it looks different than the first screenshot in this thread. In the sources, I can't see anything that would change the canvas background color. Was it perhaps a different test cartridge?

Maybe, I looked at the code in the cartridge, which was attached. There is clearly no background color access.

Maybe VICE acts on the write to 0D7FFh and exits the emulation, resulting in a weird green background?

Maybe VICE acts on the write to 0D7FFh and exits the emulation, resulting in a weird green background?

STA     0D7FFh      ; exit emulator with code 0 (success) - used by Kernal64

Oh yes, I haven't seen this. VirtualC64 continues to run normally and I guess this makes the difference.

I've checked in the fix on the dev branch where v4.0 is being developed. If nobody complains, I'll ignore the v3.4 branch.

Maybe VICE acts on the write to 0D7FFh and exits the emulation, resulting in a weird green background?

It's the "Debugcart" feature which is enable by passing "-debugcart" to VICE as a command line parameter:

https://vice-emu.pokefinder.org/index.php/Debugcart

Starting with v4.0, VirtualC64 will support "-debugcart", too.

You are on fire 馃憤

Was this page helpful?
0 / 5 - 0 ratings

Related issues

dirkwhoffmann picture dirkwhoffmann  路  5Comments

ChuckCaplan picture ChuckCaplan  路  7Comments

bluecursor picture bluecursor  路  7Comments

Somuchfun picture Somuchfun  路  3Comments

Alessandro1970 picture Alessandro1970  路  5Comments