Hey!
I'm having trouble getting scrolling to work on the SNES.
I have looked through "Walker.asm" from neviksti's SNES-starterkit, and as far as I see, you only
have to update 2 variables in RAM in your moving routine and then write those coordinates to $210d and $210e in the NMI.
This is basically what I do for up/down/left/right:
and at the end of the NMI I have:
Now, my sprite is moving around as it should, but I get no scrolling at all. I looked at it in the no$sns VRAM viewer, and my 64*64 map is loaded as it should be, and the camera_n variables are updated in RAM appropriately.
Thanks!
I'm having trouble getting scrolling to work on the SNES.
I have looked through "Walker.asm" from neviksti's SNES-starterkit, and as far as I see, you only
have to update 2 variables in RAM in your moving routine and then write those coordinates to $210d and $210e in the NMI.
This is basically what I do for up/down/left/right:
Code:
HandleInput:
php
sep #{MEM}
rep #{XY}
lda {joy1_held} + 1
and #{JOY_UP}
beq .notUp
lda {player1_y}
sec
sbc #$01
sta {player1_y}
lda {camera_y}
sec
sbc #$02
sta {camera_y}
lda {player1_direction}
and #%11111101
sta {player1_direction}
.notUp:
lda {joy1_held} + 1
and #{JOY_DOWN}
beq .notDown
e.t.c.
php
sep #{MEM}
rep #{XY}
lda {joy1_held} + 1
and #{JOY_UP}
beq .notUp
lda {player1_y}
sec
sbc #$01
sta {player1_y}
lda {camera_y}
sec
sbc #$02
sta {camera_y}
lda {player1_direction}
and #%11111101
sta {player1_direction}
.notUp:
lda {joy1_held} + 1
and #{JOY_DOWN}
beq .notDown
e.t.c.
and at the end of the NMI I have:
Code:
lda <{camera_x}
sta $210d
lda <{camera_x} + 1
sta $210d
lda <{camera_y}
sta $210e
lda <{camera_y} + 1
sta $210e
jsr ReadJoypad
lda $4210
plp
ply
plx
pla
rti
sta $210d
lda <{camera_x} + 1
sta $210d
lda <{camera_y}
sta $210e
lda <{camera_y} + 1
sta $210e
jsr ReadJoypad
lda $4210
plp
ply
plx
pla
rti
Now, my sprite is moving around as it should, but I get no scrolling at all. I looked at it in the no$sns VRAM viewer, and my 64*64 map is loaded as it should be, and the camera_n variables are updated in RAM appropriately.
Thanks!