Jump to content
  • entries
    657
  • comments
    2,699
  • views
    900,557

Reposition Player 1 routines done


SpiceWare

1,011 views

The Reposition Player 1 routines have been rewritten. It now takes 4 scanlines to reposition player 1, plus an additional scan line to get back into sync with the main kernel loop. The player 1 graphics can start on the additional scan line, but a reposition of player 0 cannot be triggered on it as the BMI KernelEvent is what was dropped to get back in sync.

 

The new kernels take up a bit more ROM than before as I had to move the jmp() outside of the horizontal retrace time, which means each reposition kernel has more duplicated code than before. There was also a minor tradeoff, the reposition kernels that hit RESP1 on cycles 65 and 70 do not update AUDV0.

 

At the moment which reposition kernel is called is hardcoded in Color1DataStream.

 

This screenshot shows reposition kernel P1EarlyHM65 in use, as well as the updating of NUSIZ1 (missile 1's size is currently being changed) so that player 1 can be resized for the special room objects. If you want to see the other kernels in use, change the entry in Color1DataStream and recompile.

 

blogentry-3056-0-02213200-1331417337_thumb.png

 

In the prior post's comments I speculated that I might not need all 11 kernels because I didn't use all 160 positions. I changed my mind about that after remembering that the room & humanoid shift offscreen when you exit the room.

 

Next up is to rewrite the Reposition Player 0 routines.

 

 

ROM

frantic_20120310.bin

 

source

Frantic20120310.zip

Frantic20120311.zip

  • Like 1

3 Comments


Recommended Comments

That is some very tight code!

 

You could save a few cycles by arranging all the repositioning kernels to be in the same bank. This would free up 5 cycles, although you would need to set this before the kernel:

 

lda #<ReposBank
sta EarlyHMjmp+1

 

For the ones that won't fit in the bank, you can put a placeholder in the repositioning bank to jump to the real kernel:

 

P1EarlyHM25:
 jmp RealP1EarlyHM25

 

That would still save you 2 cycles and might just be enough for those missing AUDV0 writes?

 

Chris

Link to comment

Interesting idea.

 

Just checked and the P1EarlyHMxx kernels go from $f2dd to $f5f so most of them would end up with a jmp RealP1EarlyHMxx.

 

The LDA # part must still occur as that's stored in the ColorPlayer1 data stream and it needs to stay in sync with the other datastreams (ie: the 10th byte in the datastream is for the 10th scanline). As such any kernel with the jmp Realxxx would end up taking exactly the same amount of time as it does now. However, only EarlyHM65 and 70 need the extra time and if they're in the "default" page it might buy enough time to add back the audio update...

Link to comment

Thanks, it panned out! New source in blog entry.

 

Turned out my EarlyHM60 routine was wrong, it had the exact same code as for 55. When I fixed it I ran into the same timing conflict as 65 & 70 had where I had to drop the AUDV0 update before. Luckily enough 3 of the EarlyHM routines ended up on the same page as all the jmp RealEarlyxxx entries, so it worked out.

Link to comment
Guest
Add a comment...

×   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...