Jump to content



1

Code isn't working to overscanning


5 replies to this topic

#1 Primordial Ooze OFFLINE  

Primordial Ooze

    Dragonstomper

  • 504 posts
  • Quacker Blaster Lead Programmer
  • Location:United States of America

Posted Mon Sep 5, 2011 3:42 PM

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, Mon Sep 5, 2011 3:47 PM.


#2 Joe Musashi OFFLINE  

Joe Musashi

    Space Invader

  • 30 posts

Posted Mon Sep 5, 2011 4:38 PM

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.

Attached Thumbnails

  • stella.png


#3 Primordial Ooze OFFLINE  

Primordial Ooze

    Dragonstomper

  • 504 posts
  • Quacker Blaster Lead Programmer
  • Location:United States of America

Posted Mon Sep 5, 2011 9:10 PM

View PostJoe Musashi, on Mon Sep 5, 2011 4:38 PM, said:

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

#4 Thomas Jentzsch OFFLINE  

Thomas Jentzsch

    Thrust, Jammed, SWOOPS!

  • 16,745 posts
  • Always left from right here!
  • Location:Düsseldorf, Germany

Posted Tue Sep 6, 2011 1:16 AM

View PostPrimordial Ooze, on Mon Sep 5, 2011 9:10 PM, said:

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.

#5 Joe Musashi OFFLINE  

Joe Musashi

    Space Invader

  • 30 posts

Posted Tue Sep 6, 2011 10:15 AM

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....46#entry2118746 . Look's really scary now :)

Attached Thumbnails

  • partyofthedead.png

Attached Files



#6 Primordial Ooze OFFLINE  

Primordial Ooze

    Dragonstomper

  • 504 posts
  • Quacker Blaster Lead Programmer
  • Location:United States of America

Posted Wed Sep 7, 2011 11:36 AM

Great, thanks for fixing it. I think i might keep your zombie in the game and give you credit. The only problem now is trying to get the playfield to mimic a room instead of white snow. Any assistance would be greatly appreciated.

Sincerely,

Primordial Ooze




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users