Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MEGA65: correct CIA TOD implementation and behaviour #343

Open
dillof opened this issue May 23, 2022 · 2 comments
Open

MEGA65: correct CIA TOD implementation and behaviour #343

dillof opened this issue May 23, 2022 · 2 comments

Comments

@dillof
Copy link

dillof commented May 23, 2022

Describe the bug
Writing 0 CIA TODs registers $DC08-$DC0B doesn't reset the clock. It works on a real MEGA65 as well as C64 (both real and vice).

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 08ed045 20220426121838 official-build
EMULATE: MEGA65 (mega65): xmega65 (../../build/bin/xmega65.native) for mega65 on osx (native) using cc

To Reproduce
The following program demonstrates the problem.

stopwatch-min.zip

It's written in cc65 assembler.

Expected behavior
It should start at 00:00:00.0.

Computer/Device (please complete the following information):

  • Device/Platform: M1 Mac
  • OS and its version: macOS 12.3.1
@dillof dillof changed the title Resetting the CIA realtime clock doesn't work MEGA65: Resetting the CIA realtime clock doesn't work May 23, 2022
@lgblgblgb
Copy link
Owner

lgblgblgb commented May 23, 2022

Thanks for the report! Yes, that is intentional, Xemu emulates the real-time clock for TOD (also for the RTC) getting the time there from the host OS (= the OS which runs Xemu). Thus it's impossible to set to other values. Sure, this is not the correct behaviour, needless to say though ;)

Of course I had/have plan to correct that at one point. Also keep in mind that the CIA emulation in Xemu is absolutely crude minimal implementation without about anything working not needed for the emulated machine to be able to work at all (this is true for some other things as well, not just CIA, I'm afraid).

I'll keep this open - and thanks again - surely I have to implement correct TOD behaviour at some point, when I get there. By the way, CIA emulation is shared with the C65 emulator, so a fix would fix both, using the same source.

@lgblgblgb
Copy link
Owner

By the way, also "TOD alarm" does not work. I'll refactor this issue being "correct TOD behaviour of CIAs" in general, I think.

@lgblgblgb lgblgblgb changed the title MEGA65: Resetting the CIA realtime clock doesn't work MEGA65: correct CIA TOD implementation and behaviour May 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

2 participants