I think you should have just one addition, but that's my opinion. Though in my scrolling routine, I do subtractions to scroll left and up, but this actually avoids complications in this case. Depending on what kind of game it's really a good idea to have the object handled with the same code no matter if it's facing left or right. If you have lots of objects, this will save you a lot of space in the long run.
But Bregalad is probably right about the 16-bit coords. You are probably going to want to deal with precision bits (Like .5 pixels) so you can move something at 1.5 pixels a frame, or to give something a parabolic effect for gravity and such. But you can still use the "addition for subtraction" method for 16-bit, all you have to do for the code Bregalad posted would be:
Code:
ldy Direction
lda XPosition
clc
adc PosAddTbl,Y
sta XPosition
lda XPositionHigh
adc PosAddTbl,Y
sta XPositionHigh
...
PosAddTbl
.db $01, $ff
PosAddTblH:
.db $00,$ff
Though there are several things you can do to optimize this. I currently have to heavily optimize some of my AI code. If you were going to access that table a lot, you'd probably want to do something like this:
Code:
ldy Direction
lda PosAddTbl,Y
sta ZTempVar1
lda PosAddTblH,Y
sta ZTempVar2
lda XPosition
clc
adc ZTempVar1
sta XPosition
lda XPositionHigh
adc ZTempVar2
sta XPositionHigh
...
PosAddTbl
.db $01, $ff
PosAddTblH:
.db $00,$ff
Where "ZTempVar" is a temporary variable in Zero Page. If you don't have any space reserved for TempVars in ZP, I highly highly advise reserving about 8 bytes for them.