xemu
xemu copied to clipboard
MEGA65: VIC-II bank ignored when displaying sprites in VIC-IV mode
Describe the bug The VIC-II bank is set to $8000 via CIA2_PRA, VIC hot registers disabled, charset, screen position, and sprite pointer set via VIC-IV registers.
On MEGA65, the correct sprites are displayed, on xmega65 the data from bank 0 is displayed instead.
Used version of the project
**** The Evolving MEGA65 emulator from LGB ****
This software is part of the Xemu project: https://github.com/lgblgblgb/xemu
CREATED: travis@lgb on Darwin 18.7.0 at Tue Apr 26 10:24:46 GMT 2022
CREATED: clang 4.2.1 Compatible Apple LLVM 11.0.0 (clang-1100.0.33.8) 64LE for osx
VERSION: https://github.com/lgblgblgb/xemu.git master 08ed0450f53a65a285dcac802373aea4f9c6450d 20220426121838 official-build
EMULATE: MEGA65 (mega65): xmega65 (../../build/bin/xmega65.native) for mega65 on osx (native) using cc
To Reproduce Start the attached program on the emulator.
Sources are at GitHub. (For the build above, I've commented out line 135 of start-vicii.s that copies the sprite data to bank 0 as a workaround for this bug.)
If it helps, I can try to create a smaller example program.
Expected behavior In the lower right corner, a logo should be displayed.
Screenshots
How it looks in the emulator:
How it looks on the MEGA65:
Computer/Device (please complete the following information):
- Device/Platform: Mac
- OS and its version: macOS 12.3.1
Additional context
@hernandp Any chance you to want this? :) If no, I would queue it for myself after my ongoing things sorted out a bit.
Sure , I will handle it
On Tue, 24 May 2022 at 16:20 LGB @.***> wrote:
@hernandp https://github.com/hernandp Any chance you to want this? :) If no, I would queue it for myself after my ongoing things sorted out a bit.
— Reply to this email directly, view it on GitHub https://github.com/lgblgblgb/xemu/issues/342#issuecomment-1136393549, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABEFMBMND6A4B2VKZIAEV6LVLU2ZFANCNFSM5WMX4HXA . You are receiving this because you were mentioned.Message ID: @.***>
@dillof Looking at your code, it is possible that for the MEGA65 case you are not touching any of the $DD00 registers?
.if .not .defined(__MEGA65__)
lda CIA2_PRA ; switch VIC bank
and #$fc
ora #((base_address >> 14) ^ 3)
sta CIA2_PRA
.endif
.endmacro
Because I wrote some other test programs and I'm a bit puzzled on how banking scheme is behaving with MEGA65 mode.
That is for the MEGA65 native program, which mostly uses VIC-IV native registers.
The error above is from the C64 program running in C64 mode on the MEGA65, in which case the bank switching is done.
If it helps, I can try to make a simpler demo program over the weekend.
Fixed. Now I understand: bank is fetched always from bits 14 and 15 and this may be set by $D06C-$D06E or $DD00 if Hotregs are enabled. Sounds much better.
PR issued. https://github.com/lgblgblgb/xemu/pull/355
@hernandp Closing this now. If you have objection not to do that yet, please tell ;)