Sprites in MSX-C

Page 3/8
1 | 2 | | 4 | 5 | 6 | 7 | 8

By Marq

Champion (386)

Marq's picture

22-04-2014, 10:03

Probably the easiest way to do vblank sync on the MSX is to insert the Z80 instruction HALT. Dunno how to do that in MSX-C, tho. Let's just say that particular compiler wasn't the shape of my heart Smile

By Daemos

Paragon (1672)

Daemos's picture

22-04-2014, 10:11

Quote:

VBLANK is a bios call? Or is it a framething, not familiar with it. Is there documentation on it somewhere?

The vertical blank is a moment where the VDP does not update the screen and waits for the TV beam to go back up. During that moment it generates an interrupt. For PAL TV this is at 50Hz for NTSC this is 60Hz. Not only will a intterupt be generated but a status register in the VDP will be set as well which you can read out during handling your interupts. This way all you have to do is:

1.) wait for an interrupt
2.) during interrupt, poll the registers for the vblank flag

You can then let your program run at 60, 50, 30, 25 frames per second and any /2 division of the 60, 50 speeds.

By Wolverine_nl

Paragon (1046)

Wolverine_nl's picture

22-04-2014, 10:27

@ Marq; I will figure that out, starting to get the hang of the MSX-C compiler, cross-compiling on SDCC i also did, but copying the compiled file and testing it, means copying it to a virtual disk or a real one and testing it, with MSX-C I made my own batches and using a emulator to compile and directly run it, the coding itself i do on the pc with Programmers' Notepad.

@ Daemos: Thanks, that explains allot about it, so it is the time between the visual frames, the interuptions, those i can manipulate.

By Grauw

Ascended (8516)

Grauw's picture

22-04-2014, 13:24

Best way to wait for VBLANK is to poll the JIFFY (0FC9EH) memory address until it changes. This is a 16-bit timer that gets increased every time a vblank interrupt occurs. I imagine this is also rather trivial to do in C.

By Wolverine_nl

Paragon (1046)

Wolverine_nl's picture

22-04-2014, 13:47

Or i need to add #asm to the external code and create a function out of it that can handle that, or something in that order. Tongue
I got some homework to do it seems -=lol=-

By Wolverine_nl

Paragon (1046)

Wolverine_nl's picture

22-04-2014, 13:58

@Grauw
would poking at that adress do any good untill it changes? I can do that in C.

By Grauw

Ascended (8516)

Grauw's picture

22-04-2014, 14:03

Yep. Just read that address’s value in a loop until it changes.

By Wolverine_nl

Paragon (1046)

Wolverine_nl's picture

22-04-2014, 14:09

ok, great! Thanks all ! Wink

By Marq

Champion (386)

Marq's picture

22-04-2014, 18:36

If you ever get that Nowind, then cross-development becomes a joy.

By Wolverine_nl

Paragon (1046)

Wolverine_nl's picture

22-04-2014, 20:14

lol "ever" Tongue

Page 3/8
1 | 2 | | 4 | 5 | 6 | 7 | 8