Jump to content
IGNORED

How do you keep in sync?


Recommended Posts

I'm working on a Roobarb and Custard game, and I'm editing scripts from other tutorials I've seen on 2600 programming, but whenever I do something new, especially if it involves WSYNC or something, it starts flickering!

 

No matter how many tutorials I look up, whenever I do some code I always end up with flickering and horizontal hold/sync issues.

 

I'm not really asking what's wrong with the code here, it's more like how can I find what's wrong with the code as well as in future projects?

 

 

 

Thanks in advance!

bum.asm

bum.bin

Edited by Shufflehound
Link to comment
Share on other sites

In one part you decrease Y and check if it is zero:

 

FinishPlayer
DEY
BNE ScanLoop
Edit: half of my message was deleted somehow:

 

Later in the code you do this again:

FinishEnemy
DEY
BNE ScanLoop
But Y was already 0 at this part. decreasing it makes it 255. So the loop will be executed 255 (256?) more times. This creates extra lines and makes the screen roll. I guess the loop is executed forever. Edited by roland p
Link to comment
Share on other sites

I'm not really asking what's wrong with the code here, it's more like how can I find what's wrong with the code as well as in future projects?

I used the debugger in stella and hit the '~' key for the debugger. And hit Scan +1 a few times. I saw you checked Y every time, so I hit it a few times more until Y was 0 and then stepped through the code with 'step' to see what happened next. Then I saw you decreased Y another time, making it 255, followed by a check. I realised the code never quit. Then I disabled the second loop (the part after 'CheckActivateEnemy', until the BNE ScanLoop), recompiled the code and got a stable picture.
Link to comment
Share on other sites

'EnemyBuffer' is loaded with a value only one time.

 

 

Maybe it's easier to draw sprites using indirect addressing?

 

I've changed the kernel to:

ScanLoop
		STA WSYNC
		LDA (player_ptr),Y
		STA GRP0
		LDA (enemy_ptr),Y
		STA GRP1
		
		DEY
		BNE ScanLoop
The player_ptr is setup with:

	LDA TopDelay
	STA player_ptr
	LDA #>Roobarb
	STA player_ptr + 1
I used TopDelay because that value changes when you move the joystick. I also changed the sprite data a bit.

bum_modified.asm

bum2.bin

Edited by roland p
Link to comment
Share on other sites

Your code is a bit messy and the kernel isn't implemented fully, I was doing a merge of your code into a template I wrote up years back that helps keeps things neat and organized.

Give me a little more time to make sure everything you need is well commented and written up and you should be able to use it for any future projects.

Edited by ScumSoft
Link to comment
Share on other sites

Thanks that's very much appreciated. But, might I ask what IS wrong with my current kernel?

I'd like to know how it's not implemented fully as well as how it's messy as it might help.

The 2600 is great in that there is no one shoe fits all (yet) boiler plate code, but there is a generally accepted method to how most kernels are laid out.

Your draw kernel is segmenting itself twice when it should be one contiguous flow, the way your HMOVE is handled can be improved greatly, joystick polling also. Your variables for position checking are not required ect..

 

[edit]Oh, and when you can see how other people work the kernels you can get an idea how it compares to your methods. I am not implying mine are better, just a different way of approaching the build and might be of some use.

Edited by ScumSoft
Link to comment
Share on other sites

What does the 'ds' command mean? Has that got something to do with the Data Segment Register?

 

ds fills the memory with numbers.

The command ds 150,$0 fills 150 bytes with the number 0. I use this to pad the sprite data above and below with 0's otherwise you would see garbage above and below the sprites.

 

But my example is just one way (with its own set of compromises :)) of accomplishing it. You could also try to imporove your current code. At first you should try to make it one loop with one branch to the 'ScanLoop' label.

Edited by roland p
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...