VRAM Checks during scroll MSX 1

Por Chilly Willy

Expert (75)

Imagen del Chilly Willy

22-04-2022, 16:21

I have been using a pattern type scroll using register 4 pointing to a pattern set for each stage of the scroll.

My issues is what is the best method for sprite collisions while scrolling.

The conditions are hitting a scrolling wall made of patterns but every formula I come up with will never get aligned.

So I guess the real question is there an industry wide standard to handle this problem.

This is a formula that was posted to read a pattern in vram which is a professional routine.
Is there a book, a link, what with similar routines that just work.

PLAYER_TO_TILE: ; Updated June 26, 2021. Less Cycles and more Accurate. Direct VRAM
; In: HL = XY
; Out: HL = Pointer to buffer
LD A, L
RRA
RRA
RRA
RRA
RR H
RRA
RR H
RRA
RR H
LD L, H
AND 3
ADD A, VRAM_NAME/256
LD H, A

CALL SETRD
IN A, (DATA_PORT)

Login sesión o register para postear comentarios

Por MsxKun

Paragon (1105)

Imagen del MsxKun

22-04-2022, 20:27

Well, I don't know why it cares about to use "less cycles" and then uses direct VRAM read wich is slow and not really handy, instead of using a RAM buffer, probably to save RAM?
So, as usual, there's not only one way to do things. So, no, no industry wide standards. The routine you need will depend of your exacts needs. The best one will be the one wich works good for you. The same routine can be crap for other user with different needs.
That said, as a general tip, if you have a fixed screen, once you have on HL the Pointer to buffer and you can read wich character is in that position, the job is done, no matter if screen is in RAM or VRAM. But if you do scroll, depends on your scroll. Usually scroll is an offset of N pixels, so... try adding or substracting that N offset to the Player XY coordinates first Smile