Need some direction with multiple backgrounds

Are you new to 6502, NES, or even programming in general? Post any of your questions here. Remember - the only dumb question is the question that remains unasked.

Moderator: Moderators

User avatar
tokumaru
Posts: 12106
Joined: Sat Feb 12, 2005 9:43 pm
Location: Rio de Janeiro - Brazil

Re: Need some direction with multiple backgrounds

Post by tokumaru »

Oh, you're right. I'll just pretend it was intentional... you know, to prevent mindless copying & pasting. :mrgreen:

BTW, I like to use "+0" like this when working with 16-bit variables, even though it doesn't do anything, just to make it clear that it's a 2-byte variable. This is particularly helpful when you manipulate only the lower byte, for whatever reason.
User avatar
thefox
Posts: 3139
Joined: Mon Jan 03, 2005 10:36 am
Location: Tampere, Finland
Contact:

Re: Need some direction with multiple backgrounds

Post by thefox »

Was the double-post intentional as well? ;)
Download STREEMERZ for NES from fauxgame.com! — Some other stuff I've done: fo.aspekt.fi
User avatar
tokumaru
Posts: 12106
Joined: Sat Feb 12, 2005 9:43 pm
Location: Rio de Janeiro - Brazil

Re: Need some direction with multiple backgrounds

Post by tokumaru »

Crap! I've been posting from my phone too often. Posting on forums with a phone is usually a chore, due to the smaller screen and reduced typing capabilities, so I end up making these stupid mistakes. Sorry about that.
User avatar
log in
Posts: 72
Joined: Tue Jun 24, 2008 1:06 pm
Location: neverland

Re: Need some direction with multiple backgrounds

Post by log in »

He guys i had some time to code again.
I learned some things and got a error.

The first thing i did was taking a step back. :( :D :wink:
I learned some more about NMI. The nesdev tutorial with the clock example was great.
I also found an example code that switched between 3 background ( red,green and blue) with the help of loose flags.
Flags are still a bit unclear to me.
And i learn nothing from copying and pasta.


When i tried to work with the 2 codes from this topic.
I got this error : ASL operand is missing.

Should LDA screen number be replaced with a binary number ? #10011001
This is also a way of setting a flag if i am correct ?


So what is the problem with this ASL ?
I'm struggeling with my english trying to explain and ask things.

I'm also struggeling with the hole code. I seem to understand the parts. But when i put it all together i seem to lose focus and controlover my code.
im a newbie,lets see how far i can get
User avatar
dougeff
Posts: 2875
Joined: Fri May 08, 2015 7:17 pm
Location: DIGDUG
Contact:

Re: Need some direction with multiple backgrounds

Post by dougeff »

If you're trying to ASL a RAM address, for example 00...

Code: Select all

asl $00
If A (Accumulator) is being ASL -ed

Code: Select all

asl A
[Syntax may vary in different assemblers]
nesdoug.com -- blog/tutorial on programming for the NES
User avatar
dougeff
Posts: 2875
Joined: Fri May 08, 2015 7:17 pm
Location: DIGDUG
Contact:

Re: Need some direction with multiple backgrounds

Post by dougeff »

when i put it all together i seem to lose focus and control over my code.
Consider making a flowchart of the code, to help you keep it organized.
nesdoug.com -- blog/tutorial on programming for the NES
User avatar
tokumaru
Posts: 12106
Joined: Sat Feb 12, 2005 9:43 pm
Location: Rio de Janeiro - Brazil

Re: Need some direction with multiple backgrounds

Post by tokumaru »

For some assemblers, A is implied if you write ASL with no operand, but others (NESASM?) will require you to write ASL A.
User avatar
Sogona
Posts: 186
Joined: Thu Jul 23, 2015 7:54 pm
Location: USA
Contact:

Re: Need some direction with multiple backgrounds

Post by Sogona »

tokumaru wrote:For some assemblers, A is implied if you write ASL with no operand, but others (NESASM?) will require you to write ASL A.
NESASM3 requires you to put A, but I believe ASM6 will throw an error if you do this.

However, 6502.org says

Code: Select all

lsr a
and

Code: Select all

asl a
is the standard syntax
User avatar
rainwarrior
Posts: 8062
Joined: Sun Jan 22, 2012 12:03 pm
Location: Canada
Contact:

Re: Need some direction with multiple backgrounds

Post by rainwarrior »

There's no "standard" syntax. That particular article on 6502.org just adheres to this particular convention.
User avatar
Sogona
Posts: 186
Joined: Thu Jul 23, 2015 7:54 pm
Location: USA
Contact:

Re: Need some direction with multiple backgrounds

Post by Sogona »

rainwarrior wrote:There's no "standard" syntax. That particular article on 6502.org just adheres to this particular convention.
So MOS didn't come up with the instruction mnemonics?
User avatar
tokumaru
Posts: 12106
Joined: Sat Feb 12, 2005 9:43 pm
Location: Rio de Janeiro - Brazil

Re: Need some direction with multiple backgrounds

Post by tokumaru »

Sogona wrote:NESASM3 requires you to put A, but I believe ASM6 will throw an error if you do this.
ASM6 doesn't throw any errors if you put the A, it appears to work fine. An older version did have a bug related to this though... It couldn't handle variables starting with "A" after ASL or any other instruction that can use the accumulator as an implied operand. This has been fixed a long time ago.

I don't know what the standard is in this case (if there even is one), but I learned to write these instructions without the A and have always done it that way.

EDIT: Apparently, the official syntax requires the A.
Post Reply