Jump to content
IGNORED

Help debugging


DtY

Recommended Posts

My program should start by clearing all the ram, then display a black screen, and every twenty frames increment the colour counter, the code was based on the 2600 for newbies tutorials, the one that changed the background colour every scanline, and the one that showed the play field and changed it every twenty frames.

 

What it does do:

I start the game up, and it goes to a blank screen, I go into stella's debugger, and it shows that none of the memory was cleared, and y is not counting the time until the next frame.

 

y is used to count how many frames have gone by since the last change, $80 in memory is used to store the current colour, a and x are used for various other tasks throughout the program.

 

Attached are the original assembler source code, and what I got when I compiled it (both were given a .txt extension as the forum would not let me upload them without)

 

Also, people seem to just include vcs.h and macro.h and not think anything about it? When I try that I get an error that the file doesn't exist and have to copy them into the same directory, is there a global include path for dasm somewhere I can put them? (I am on fedora core linux, btw)

background.asm.txt

Background.a26.txt

Link to comment
Share on other sites

You forgot to set your interrupt vectors at the end of the program like this:

 

 

 

	org $FFFA
.word Reset
.word Reset
.word Reset

 

also you made a few simple mistakes in your code. For example:

 

VerticalBlank
ldx #0
inx
cpx #37
bne VerticalBlank

 

this is an infinate loop because the 'ldx #0' should be out of the VerticalBlank Loop

 

and at the top when you start the frame I changed

 

	lda #0
sta VBLANK
lda #2
sta WSYNC
sta WSYNC
sta WSYNC
lda #0
sta VSYNC

 

to

 

	lda #2
sta VBLANK
sta VSYNC

sta WSYNC
sta WSYNC
sta WSYNC

lda #0
sta VSYNC

 

Hope this helps! Here is a fixed source and binary. BTW, if you want to post source code, you should zip it so you dont have to change the extension.

background.zip

Link to comment
Share on other sites

Okay, great, thank you. Just, now there are black bars flickering all over, and when I replace that block with the code you gave me, it shows nothing, I checked, and the memory is changing properly, but the background is staying black. When I ran the example you sent me, it worked fine.

 

Also, what exactly do the interrupt vectors do? All I can gather is they insert $F000 three times at $FFFA, I'm guessing that's to insert nulls for the rest of the cartridge, but why three?

 

[edit] Forgot to upload what I had

background_changer.zip

Edited by DtY
Link to comment
Share on other sites

Also, what exactly do the interrupt vectors do? All I can gather is they insert $F000 three times at $FFFA, I'm guessing that's to insert nulls for the rest of the cartridge, but why three?

 

They point to a certain ROM location that the processor will jump to if it gets interrupted. Also, the second vector points to where you want the processor to start the program (it does not have to be at $F000, many games start elsewhere).

 

Im not sure why your program has black bars on the top left, I will analyze your source further later on. Welcome to AA by the way!

Link to comment
Share on other sites

I forgot to tell you, add this:

 

	ldx #0
stx VBLANK   ;Add this line.  you must store a 0 to VBLANK to enable display
Picture

 

and to get rid of the black lines at the top left, do this:

 

	ldx #0
VerticalBlank
sta WSYNC
inx
cpx #36	 ; change from 37 to 36
bne VerticalBlank

 

then at label 'NotYet'

 

NotYet
lda $80
sta COLUBK
 
sta WSYNC	 ;add this line

 

Hope it works for you!

background2.zip

Link to comment
Share on other sites

Before I replaced the block of code you gave me, the one right after StartOfFrame, I had black bars that flickered all over horizontally, then I replaced the block with what you gave me, it showed nothing at all, however the one you gave me worked. (I'll go through line by line and see if I can find the problem though)

 

And thanks

 

[edit] I'll try that stuff you jsut posted :)

Edited by DtY
Link to comment
Share on other sites

AFAIK, the NMI vector (at $xFFA-B) is not used by the 2600. You can use these 2 bytes for whatever you want (or keep them unused along with the previous 2 bytes to provide unmodded Supercharger-compatability). If BRK interrupts are not used by the program, the interrupt vector ($xFFE-F) can also be used for something else if you wish (or kept unused for the SC-compatability). All a general program needs is the cold start vector ($xFFC-D) to lead it to the ram clear routine. Common practice among early programs was to fill unused vectors with the cold start address, but there is no need to follow it. You can also save a good deal of space if you set an often-called subroutine as the interrupt (as described by Thomas at the top of The Dig's programming guide).

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