Hello again,
thanks for all of your suggests, I'm learning a lot of things in this forum, but the ASM for Nes always give me new challenges. I will try to explain my problem. In my Arkanoid clone I copied all the tiles on RAM to check the collision detection, everything works great, the collision works, the VRAM is updated correctly so I can see the change on the background... Until the tile 255! I know that NES can store only 8 bit value and the best way to work is using 16 addressing, I have no problem to use low and high byte to use the 16 addressing and access to all address on VRAM or on RAM. BUT. I can't really understand how to compute a tile greater than 255. I do something like this:
I know BALL_POS_X_ON_TILE is always between 0-255 because it's a value stored on a single location, but I can't understand how to store or use a tile that is greater than 255, with addressing it's not a problem, but in this case? How can I do that? Could you please give me an example to learn?
Thanks a lot, this is the last big "problem" to solve to finish my first demo!
thanks for all of your suggests, I'm learning a lot of things in this forum, but the ASM for Nes always give me new challenges. I will try to explain my problem. In my Arkanoid clone I copied all the tiles on RAM to check the collision detection, everything works great, the collision works, the VRAM is updated correctly so I can see the change on the background... Until the tile 255! I know that NES can store only 8 bit value and the best way to work is using 16 addressing, I have no problem to use low and high byte to use the 16 addressing and access to all address on VRAM or on RAM. BUT. I can't really understand how to compute a tile greater than 255. I do something like this:
Code:
LDA #$00
STA BALL_POS_X_ON_TILE
STA BALL_POS_Y_ON_TILE
LDA BALL_POS_X
LSR A
LSR A
LSR A ; Divide by 8
STA BALL_POS_X_ON_TILE
LDA BALL_POS_Y
LSR A
LSR A
LSR A ; Divide by 8
STA BALL_POS_Y_ON_TILE
...
LDX #$00
ComputeXYOnTile:
LDA BALL_POS_X_ON_TILE
CLC
ADC #$20
STA BALL_POS_X_ON_TILE
INX
CPX BALL_POS_Y_ON_TILE
BNE ComputeXYOnTile
....
PerformBallColWithBrickLeft:
LDX BALL_POS_X_ON_TILE
LDA $0400, x ( $400 is where the ram map begin )
CMP #$2D
BEQ PerformBallCollisionWithBrick
...
STA BALL_POS_X_ON_TILE
STA BALL_POS_Y_ON_TILE
LDA BALL_POS_X
LSR A
LSR A
LSR A ; Divide by 8
STA BALL_POS_X_ON_TILE
LDA BALL_POS_Y
LSR A
LSR A
LSR A ; Divide by 8
STA BALL_POS_Y_ON_TILE
...
LDX #$00
ComputeXYOnTile:
LDA BALL_POS_X_ON_TILE
CLC
ADC #$20
STA BALL_POS_X_ON_TILE
INX
CPX BALL_POS_Y_ON_TILE
BNE ComputeXYOnTile
....
PerformBallColWithBrickLeft:
LDX BALL_POS_X_ON_TILE
LDA $0400, x ( $400 is where the ram map begin )
CMP #$2D
BEQ PerformBallCollisionWithBrick
...
I know BALL_POS_X_ON_TILE is always between 0-255 because it's a value stored on a single location, but I can't understand how to store or use a tile that is greater than 255, with addressing it's not a problem, but in this case? How can I do that? Could you please give me an example to learn?
Thanks a lot, this is the last big "problem" to solve to finish my first demo!