Search found 12 matches
- Mon Oct 06, 2014 8:48 am
- Forum: Programming
- Topic: Need help with a loop that has 16 bit counter
- Replies: 19
- Views: 3358
Re: Need help with a loop that has 16 bit counter
Just letting you know that I got the 16 bit counter working. The reason why it looked like it didn't, was that I had the PPU turned on when I drew the background. Anyway, thanks for the help. I'm off to learn how to use NMI and VBlank. 
- Tue Sep 09, 2014 6:36 pm
- Forum: Programming
- Topic: Need help with a loop that has 16 bit counter
- Replies: 19
- Views: 3358
Re: Need help with a loop that has 16 bit counter
You can directly INC or DEC a memory location without using a register.
Replace:
LDA pointerLo
CLC
ADC #$01
STA pointerLo
with:
INC pointerlo
But anyway, here is a suggested way of doing things that is simple.. if you make sure your data is a multiple of 4 bytes (4 bytes of data, 8 ...
Replace:
LDA pointerLo
CLC
ADC #$01
STA pointerLo
with:
INC pointerlo
But anyway, here is a suggested way of doing things that is simple.. if you make sure your data is a multiple of 4 bytes (4 bytes of data, 8 ...
- Tue Sep 09, 2014 4:02 pm
- Forum: Programming
- Topic: Need help with a loop that has 16 bit counter
- Replies: 19
- Views: 3358
Re: Need help with a loop that has 16 bit counter
I almost got it working. This is what I used:
DrawBackground: ; Loop for drawing background
LDA #$B3
STA pointerLo
LDA #$80
STA pointerHi
LDA #$00
STA counterLo
LDA #$04
STA counterHi
BgLoop:
LDA [pointerLo], y
STA $2007
LDA pointerLo
CLC
ADC #$01
STA pointerLo
LDA pointerHi
ADC ...
DrawBackground: ; Loop for drawing background
LDA #$B3
STA pointerLo
LDA #$80
STA pointerHi
LDA #$00
STA counterLo
LDA #$04
STA counterHi
BgLoop:
LDA [pointerLo], y
STA $2007
LDA pointerLo
CLC
ADC #$01
STA pointerLo
LDA pointerHi
ADC ...
- Tue Sep 09, 2014 2:28 pm
- Forum: Programming
- Topic: Need help with a loop that has 16 bit counter
- Replies: 19
- Views: 3358
Re: Need help with a loop that has 16 bit counter
That suggests the assembler you're using doesn't like/understand standard 6502 syntax. What assembler are you using?
I'm using NESASM3.
EIDT: Also there is some weird issue that I forgot to mention that started around the time I started doing the 16 Bit counter stuff. It happens whenever I ...
- Tue Sep 09, 2014 2:14 pm
- Forum: Programming
- Topic: Need help with a loop that has 16 bit counter
- Replies: 19
- Views: 3358
Re: Need help with a loop that has 16 bit counter
Okay. I tried this code (I of course edited the pointer names and labels to fit in my program), but I got few syntax errors (marked red in the code)
...
DrawBackground:
lda #<background ; init background pointer
sta zppointer
lda #>background
sta zppointer+1
ldy #0
DrawLoop: ; transfer 3 ...
...
DrawBackground:
lda #<background ; init background pointer
sta zppointer
lda #>background
sta zppointer+1
ldy #0
DrawLoop: ; transfer 3 ...
- Tue Sep 09, 2014 11:50 am
- Forum: Programming
- Topic: Need help with a loop that has 16 bit counter
- Replies: 19
- Views: 3358
Re: Need help with a loop that has 16 bit counter
You can squeeze a few cycles (and one byte!) using X to count the pages
It shouldn't matter where the data for the background is. The assembler will work out the actual address and use it in the <background and >background expressions used to initialise the pointer.
So, using the < and > with a ...
It shouldn't matter where the data for the background is. The assembler will work out the actual address and use it in the <background and >background expressions used to initialise the pointer.
So, using the < and > with a ...
- Tue Sep 09, 2014 9:13 am
- Forum: Programming
- Topic: Need help with a loop that has 16 bit counter
- Replies: 19
- Views: 3358
Re: Need help with a loop that has 16 bit counter
One way to do it is to put the address of "background" into a pair of ZP bytes
How do I know where the background is in the program?
The way I learned to load the background is doing this (not sure if this is how everybody does it):
background:
.db $2F,$2F,$2F,$2F,$2F,$2F,$2F,$2F,$2F,$2F,$2F ...
How do I know where the background is in the program?
The way I learned to load the background is doing this (not sure if this is how everybody does it):
background:
.db $2F,$2F,$2F,$2F,$2F,$2F,$2F,$2F,$2F,$2F,$2F ...
- Tue Sep 09, 2014 5:27 am
- Forum: Programming
- Topic: Need help with a loop that has 16 bit counter
- Replies: 19
- Views: 3358
Need help with a loop that has 16 bit counter
So, I'm trying to make a loop that counts to 960 (decimal), but I have never used 16 bit numbers so far, so I have no idea how to do it. What the loop is supposed to do is that it loads data from different location with indexed X addressing mode and stores it to $2007 (which automatically stores the ...
- Tue Apr 29, 2014 7:07 pm
- Forum: Programming
- Topic: Code structure help (NES specifically)
- Replies: 2
- Views: 667
Code structure help (NES specifically)
So, I think I now have all that I need to actually make some code, but I can't find a reference code (for NES) anywhere. I know some of the stuff I need to add to the code, but I don't know the overall code structure. Can someone make a short code that has everything that is needed (iNES header ...
- Sat Apr 26, 2014 4:08 pm
- Forum: Programming
- Topic: Help with ADC/SBC and Carry/Overflow Flags
- Replies: 38
- Views: 31273
Help with ADC/SBC and Carry/Overflow Flags
I'm so confused with ADC, SBC, Carry Flag and Overflow Flag that I need some help. I tried looking many places for these, but the information is either unclear, confusing or the information on the sites might differ so greatly that I don't know which one to believe. 
- Sun Feb 23, 2014 6:42 pm
- Forum: Programming
- Topic: 6502 assembly A, X and Y. What are they?
- Replies: 9
- Views: 14586
Re: 6502 assembly A, X and Y. What are they?
Few more questions:
1. What's the difference between the accumulator (A) register and the indexing function (X and Y) registers (in what kind of situations they are used)?
2. What are the S and P registers and the stack used?
3. How is the Memory are divided for specific actions (like drawing ...
1. What's the difference between the accumulator (A) register and the indexing function (X and Y) registers (in what kind of situations they are used)?
2. What are the S and P registers and the stack used?
3. How is the Memory are divided for specific actions (like drawing ...
- Sun Feb 23, 2014 1:55 pm
- Forum: Programming
- Topic: 6502 assembly A, X and Y. What are they?
- Replies: 9
- Views: 14586
6502 assembly A, X and Y. What are they?
Every guide about 6502 assembly talks about things called A, X and Y, but none of them explain what they are, where they are used, etc. It's odd that in the very beginning parts these are introduced but never explained.