base:efficient_tod_initialisation
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionLast revisionBoth sides next revision | ||
base:efficient_tod_initialisation [2019-05-12 11:14] – [Proper solution] silverdr | base:efficient_tod_initialisation [2020-04-09 21:36] – Added credis for the article directly under the heading ftc | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== TOD initialisation - the problem ====== | ====== TOD initialisation - the problem ====== | ||
- | Each [[https:// | + | |
+ | By Silver Dream | ||
+ | |||
+ | Each [[https:// | ||
===== Popular misconception ===== | ===== Popular misconception ===== | ||
First let's say how NOT to do it. It is important to note that contrary to a very popular and utterly wrong belief, NTSC or PAL video/ | First let's say how NOT to do it. It is important to note that contrary to a very popular and utterly wrong belief, NTSC or PAL video/ | ||
===== Proper solution ===== | ===== Proper solution ===== | ||
- | While there are various approaches to this problem, we believe the one presented below is not only the most compact but can also serve dual purpose, increasing the byte-size savings even further. | + | While there are various approaches to this problem, we believe the one presented below is not only the most compact but can also serve dual purpose |
<code 6502acme> | <code 6502acme> | ||
; Detecting TOD frequency by Silver Dream ! / Thorgal / W.F.M.H. | ; Detecting TOD frequency by Silver Dream ! / Thorgal / W.F.M.H. | ||
Line 45: | Line 48: | ||
which correspond to the four possible C64 hardware setup combinations. Comparing to $51, which falls more or less in the middle, gives us the expected answer. If the HI byte of the timer has value higher than $51 we have 60Hz supplied to the TOD pin. If OTOH it has lower value, we have 50Hz supplied. | which correspond to the four possible C64 hardware setup combinations. Comparing to $51, which falls more or less in the middle, gives us the expected answer. If the HI byte of the timer has value higher than $51 we have 60Hz supplied to the TOD pin. If OTOH it has lower value, we have 50Hz supplied. | ||
- | Please also note that we use CIA #2 and not CIA #1. CIA #2 is chosen because | + | Advantages: |
+ | * Does not break on Super-CPU and similar | ||
+ | * No screen side-effects | ||
+ | * Short and fast | ||
+ | |||
+ | Please also note that we use CIA #2 and not CIA #1. CIA #2 is chosen because | ||
===== Dual purpose ===== | ===== Dual purpose ===== | ||
I mentioned before that this routine can serve also another purpose and give us potentially even more savings. Yes, with addition of only a few bytes: | I mentioned before that this routine can serve also another purpose and give us potentially even more savings. Yes, with addition of only a few bytes: | ||
Line 62: | Line 70: | ||
; we run on PAL machine with 60Hz TOD clock | ; we run on PAL machine with 60Hz TOD clock | ||
</ | </ | ||
- | we can determine not only the TOD frequency but also the video standard. This is possible because – unlike | + | we can determine not only the TOD frequency but also the video norm. This is possible because – unlike TOD frequency – the CPU clock frequency is directly related to the computer' |
base/efficient_tod_initialisation.txt · Last modified: 2020-10-27 02:31 by silverdr