How to....

Página 1/2
| 2

Por PingPong

Prophet (3513)

imagem de PingPong

09-03-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?

Entrar ou registrar-se para comentar

Por GhostwriterP

Hero (528)

imagem de GhostwriterP

09-03-2008, 21:13

ld a,(2Bh) And then it is one of the 8 bits Smile
bit 7 I think...

Por jltursan

Prophet (2273)

imagem de jltursan

09-03-2008, 21:35

Right, bit 7, 0=60Hz & 1=50Hz

Por PingPong

Prophet (3513)

imagem de PingPong

09-03-2008, 21:58

thx, a lot!!!!!!!!!!!!!!!!!!!!!!!!

Por ro

Guardian (4162)

imagem de ro

10-03-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)

Por pitpan

Prophet (3131)

imagem de pitpan

10-03-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 Wink

Por ro

Guardian (4162)

imagem de ro

10-03-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

Por PingPong

Prophet (3513)

imagem de PingPong

10-03-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....

Por dvik

Prophet (2200)

imagem de dvik

10-03-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

Por dvik

Prophet (2200)

imagem de dvik

10-03-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).

Por PingPong

Prophet (3513)

imagem de PingPong

10-03-2008, 20:59

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.

Página 1/2
| 2