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

[FEATURE] RTC clock implementation #10

Open
RichardBrown384 opened this issue Jul 2, 2024 · 1 comment
Open

[FEATURE] RTC clock implementation #10

RichardBrown384 opened this issue Jul 2, 2024 · 1 comment
Labels
component:rtc enhancement New feature or request

Comments

@RichardBrown384
Copy link
Owner

RichardBrown384 commented Jul 2, 2024

Is your feature request related to a problem? Please describe.
It would be great if the RTC clock actually worked instead of returning zero.

Describe the solution you'd like
When RISC OS asks for the time it gets an approximation thereof.

Describe alternatives you've considered
N/A

Additional context
There are a few ways that have been considered to implement this problem

  1. Query the host for the time on each call. This has the problem that the emulator is running faster than
    a real archimedes. This can lead to the situation where the archimedes has simulated 2ms of time but on the host only 900ns has elapsed
  2. At the start of each frame sample the time from the host and then use CPU time events to drive the clock in the intervening time. This has the problem that the clock might roll back (e.g. we simulate 17ms of time in a 16ms frame, and resynchronising the clock will result in time jumping backwards).
  3. We sample the host clock on application start and use the CPU time events to drive the clock for the duration of the application run. This will guarantee a monotonic clock but it will eventually drift away from the host time.
@RichardBrown384 RichardBrown384 added enhancement New feature or request component:rtc labels Jul 2, 2024
@RichardBrown384
Copy link
Owner Author

RISC OS 2 setting the date

11:14pm Sat, 8 October 1988

; c0 - 64 = 128 which according to the docs is part of the current year
; c1 - 64 = 129 which according to the docs is part of the current year

RTC8583 write to c0 (58) ; (88, remember this is hex)
RTC8583 write to c1 (13) ; (19, remember this is hex)
RTC8583 write to 01 (00) ; hundredths
RTC8583 write to 02 (12) ; seconds
RTC8583 write to 03 (14) ; minutes
RTC8583 write to 04 (23) ; hours (upper two bits am/pm control flags)
RTC8583 write to 05 (08) ; year/date (upper two bits are year)
RTC8583 write to 06 (10) ; weekdays/months (upper 3 bits are weekdays)
RTC8583 read from 01 (00)
RTC8583 read from c0 (58)
RTC8583 read from c1 (13)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component:rtc enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant