Jump to content
IGNORED

Code isn't working to overscanning


Primordial Ooze

Recommended Posts

This is the code i am using for drawing the playfield. For some reason it's causing the scan lines to jump to 343. However what i am doing is much simpler then most games, yet it still is using more scan lines then normal.

 

Snip:

lda (pf0_ptr),y							; load PF0 data

sta PF0								; set it as PF0

lda (pf1_ptr),y							; load PF1 data

sta PF1								; set it as PF1

lda (pf2_ptr),y							; load PF2 data

sta PF2								; set it as PF2

 

If anyone can help me it would be greatly appreciated.

 

Sincerely,

 

Primordial Ooze

Edited by Primordial Ooze
Link to comment
Share on other sites

I took a (very) quick look at it in the Stella debugger.

 

It seems that your ScanLoop is too time consuming. Even when no players are visible, i.e., all the skip branches are taken (SkipActivatePlayer, FinishPlayer, SkipActivateZombie, FinishZombie) the CPU is already at cycle 74 when it arrives at

 

$F10E bne ScanLoop

 

If the branch is taken it crosses a page boundary and the instruction will take 4 cycles. At

 

ScanLoop: sta WSYNC

 

the CPU is then already at cycle 2 in the next line and the sta WSYNC skips this line. So a single loop iteration takes two lines.

post-27536-0-04707800-1315261957_thumb.png

Link to comment
Share on other sites

I took a (very) quick look at it in the Stella debugger.

 

It seems that your ScanLoop is too time consuming. Even when no players are visible, i.e., all the skip branches are taken (SkipActivatePlayer, FinishPlayer, SkipActivateZombie, FinishZombie) the CPU is already at cycle 74 when it arrives at

 

$F10E bne ScanLoop

 

If the branch is taken it crosses a page boundary and the instruction will take 4 cycles. At

 

ScanLoop: sta WSYNC

 

the CPU is then already at cycle 2 in the next line and the sta WSYNC skips this line. So a single loop iteration takes two lines.

I don't understand why. Even combat does more stuff then I'm trying to do and it uses less cycles not to mention page boundaries. Can you please tell me what I'm doing wrong? Any assistence in this matter would be greatly appreciated.

 

Sincerely,

 

Primordial Ooze

Link to comment
Share on other sites

I don't understand why. Even combat does more stuff then I'm trying to do and it uses less cycles not to mention page boundaries. Can you please tell me what I'm doing wrong?

Its not the number of things you are doing, but HOW you are doing them.Your code is less efficient than required, taking 2 cycles too long. Count your cycles and compare with Combat, then you will find what is making the difference.

Link to comment
Share on other sites

Ah, now I see. You want to use a two-line kernel (as Combat does). Then you have 2*76 cycles for each loop iteration. This then means your line counter needs to be adapted so that it counts double lines instead of single lines, i.e., you have to initialize Y with

 

ldy #(192/2)-1

 

I did a couple of small changes and got your kernel running, code is attached. Here are some more comments:

 

- In a two-line kernel players have to move at least two scanlines per frame when moving vertically. If this is too fast, you have to make use of the VDEL register. VDEL explained explains how this works.

 

- It's probably necessary to rearrange the TIA writes in the scan loop so that they are not done in the visible part of the scanline. You can see this in the image were the player graphics is changed in the middle of the player sprite.

 

- There was a typo, cpy #zombiey needs to be cpy zombiey.

 

- I added two more WSYNCs so that Stella reports 262 scanlines. I haven't checked but maybe vblank is too short.

 

- And finally, just for fun I replaced the zombie graphics with the one from PAC-MAN-RED's thread http://www.atariage.com/forums/topic/169238-free-sprites-for-the-taking/page__st__75__p__2118746#entry2118746 . Look's really scary now :)

post-27536-0-97655700-1315324809_thumb.png

partyofthedead.zip

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