Autor
| How to....
|
PingPong msx master Mensajes: 1069 | Publicado: Marzo 09 2008, 20:14   |
detect the vdp refresh speed (50hz or 60hz) on a MSX1:
actually i use a void loop and i count the jiffy increments before and after the loop. But i'm looking for a more elegant solution . Any idea?
|
|
GhostwriterP msx addict Mensajes: 320 | Publicado: Marzo 09 2008, 21:13   |
ld a,(2Bh) And then it is one of the 8 bits 
bit 7 I think... |
|
jltursan msx professional Mensajes: 887 | Publicado: Marzo 09 2008, 21:35   |
Right, bit 7, 0=60Hz & 1=50Hz
|
|
PingPong msx master Mensajes: 1069 | Publicado: Marzo 09 2008, 21:58   |
thx, a lot!!!!!!!!!!!!!!!!!!!!!!!!
|
|
ro msx guru Mensajes: 2353 | Publicado: Marzo 10 2008, 09:03   |
euh, that only works when MSX BIOS is enabled (in page 0) and VDP change has been made via BIOS call. (or if the user updates 0x2B when changing VDP regs)
|
|
pitpan msx master Mensajes: 1418 | Publicado: Marzo 10 2008, 09:39   |
And it won't be reliable in MSX1 machines with MSX1 BIOS installed and featuring V9938 VDP, such as SVI738 and Yamaha CMX5II/128. For these machines, first you should detect them and then read the corresponding VDP register.
Reading the BIOS byte, you'll only know the default retrace frequency. That's OK if it cannot be changed (TMS99xx). If it can be changed, then you'll have to make a guess  |
|
ro msx guru Mensajes: 2353 | Publicado: Marzo 10 2008, 10:17   |
my prev post was a bit fuzzy (aah, whatsinnaname)
VDP regs update to vars is not stored in 2B ofcourse but in VDP buf in Hi-Mem.
2B is initial (default) startup and machine type /BIOS settings.
Basic ROM version
here's an excerpt from MAP: (http://map.tni.nl/resources/msxsystemvars.php)
7 6 5 4 3 2 1 0
| | | | +-+-+-+-- Character set
| | | | 0 = Japanese, 1 = International, 2=Korean
| +-+-+---------- Date format
| 0 = Y-M-D, 1 = M-D-Y, 2 = D-M-Y
+---------------- Default interrupt frequency
0 = 60Hz, 1 = 50Hz
Here's where the BIOS calls and BASIC store any VDP changes (reg 0 till 7 + stat):
#F3DF-#F3E7 |
|
PingPong msx master Mensajes: 1069 | Publicado: Marzo 10 2008, 19:31   |
I will stay to the old solution: delay loop of 1 second (all msx1 have z80 @3.58Mhz) and count of nints....
|
|
dvik online msx master Mensajes: 1376 | Publicado: Marzo 10 2008, 19:39   |
Here is the one I wrote and have been using in several games and demos:
;;
;; returns 1 in a and clears z flag if vdp is 60Hz
;;
CheckIf60Hz:
di
in a,($99)
nop
nop
nop
vdpSync:
in a,($99)
and 0x80
jr z,vdpSync
ld hl,$900
vdpLoop:
dec hl
ld a,h
or l
jr nz,vdpLoop
in a,($99)
rlca
and 1
ei
ret
|
|
dvik online msx master Mensajes: 1376 | Publicado: Marzo 10 2008, 19:41   |
The code starts with syncing to vblank. Then the vdpLoop pretty much loops for around 290 scanlines. If the vblank bit is set after the loop finishes it means that more than one frame has passed (60Hz).
|
|
PingPong msx master Mensajes: 1069 | Publicado: Marzo 10 2008, 20:59   |
Quote:
| The code starts with syncing to vblank. Then the vdpLoop pretty much loops for around 290 scanlines. If the vblank bit is set after the loop finishes it means that more than one frame has passed (60Hz).
|
thx dvik, this is similar to mine. |
|
dvik online msx master Mensajes: 1376 | Publicado: Marzo 10 2008, 21:03   |
I wasn't sure what you had. This one doesn't wait a full second, only about 1/50 of a second, so its not really notable by the user.
|
|
|
|
|