Jump to content
IGNORED

Clear hit register inside or outside VBI


Recommended Posts

Doing som small tests and Programming in assembler, and to Clear the collision register one should store value 1 in adress 53278 ($D01E).

 

And it seem to only work when run inside the VBI,when trying to do that outside the VBI it would not Clear the collision register, So if this is the norm in assembler, then when doing it in BASIC With a poke 53278,1 then this would then happen within the VBI ?.. does this check out or is there something else going on ?

Edited by Grevle
Link to comment
Share on other sites

It can be written just after the VBI, before the screen is been "refreshed", as collision registers are updated while it is "painted".

 

Just be sure to check collision registers after the screen was completed (it might be inside the VBI), or only when you have already detected a collision.

 

As in pure BASIC we are not able to use VBI, depending on the flavor, it is possible to POKE 53278,1 just after a PAUSE 0 or a loop waiting for a change of PEEK(20).

 

 

Edited by vitoco
when to check
Link to comment
Share on other sites

21 minutes ago, Grevle said:

maybe in basic  a poke 53278,1 take effect just after the vbi.. makes sense i Guess..

No... Actually, we are forcing things to happen just after the timer change (RTCLOK+2, memory address 20), which happens during VBI. Using PAUSE or a loop waiting for that change allows us to avoid graphical glitches, because we can do some POKEs or MOVEs before the screen begins to be drawn.

 

But as I said, a way to be sure that a collision was detected when we cannot control real speed in BASIC, it is to clear the register only when a collision has already been detected. In my latest tenliner (not yet published), I clean the collisions just before the round starts and look one of the collision registers to finish the round, and another one to score a bonus for that round (happens once). No need to keep cleaning the collision registers during the action. Of course this is an extreme example, but I hope it gaves you the idea.

 

Link to comment
Share on other sites

Generally Basic will be too slow but it's not absolutely critical to do HITCLR in VBlank in many cases.

You'd want to read your collision registers then act on any collisions which might involve removing objects so that no further collision occurs, e.g. bullet hitting enemy.

Once the objects are taken care of do a HITCLR and the collision shouldn't reoccur.

 

In assembly you'd generally read the collision registers then HITCLR during VBlank.  But in some cases you might do it more often, usually in a DLI with sufficient delay, e.g. WSYNC then a few NOPs or other instructions.   In that case you'd generally store the collision results in an array then process them later on like in VBlank when there's more time available.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...