Jump to content
IGNORED

Random Color Problem


codyr783

Recommended Posts

I'm trying to set the color to green, but instead I get a random color every time I play the .bin. I want to use Color_Grass as the color. This is my first go at this so help would be appreciated.

 

 processor 6502
 include "vcs.h"
 include "macro.h"
 SEG
 ORG $F000
Color_Grass = #$D5

Reset
StartOfFrame  ;vertical blank processing
  lda #0
  sta VBLANK
  lda #2
  sta VSYNC
sta WSYNC ;VSYNCH
			sta WSYNC
sta WSYNC
		lda #0
		sta VSYNC		  
;VBLANK
REPEAT 37
			sta WSYNC
REPEND
		  
Picture:  ldx #$05
 REPEAT 170
stx COLUBK
			sta WSYNC
			REPEND
ldx Color_Grass
REPEAT 22
stx COLUBK
sta WSYNC
REPEND
 
 
		lda #%01000010
		sta VBLANK					 ; end of screen - enter blanking
REPEAT 30  ;overscan(30)
			sta WSYNC
			REPEND

		jmp StartOfFrame
;TitleScreen  lda #0
 
		ORG $FFFA
		.word Reset		  ; NMI
		.word Reset		  ; RESET
		.word Reset		  ; IRQ
	END

Edited by codyr783
Link to comment
Share on other sites

short story: you're using memory location $D5 for the grass color, not the value $D5.

 

"Color_Grass = #$D5" doesn't cause a substitution of "#$D5" for every occurance of "Color_Grass". It literally puts the value $D5 into Color_Grass. The # is ignored.

 

To do what you want, lose the hash when you set Color_Grass and then add a hash when you actually use it, like " ldx #Color_Grass"

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