My objects have 16 bit fixed point coordinates; that's a byte of pixel positioning and a byte of subpixel positioning. Simple enough. My objects also have 16 bit fixed point velocities, but those values are signed. This is very simple when it comes to applying the most significant byte of the velocity to the most significant byte of the coordinate:

Code: Select all

```
lda OBJHIH,x ;load this OBJect's HI byte for Horizontal velocity
clc
adc OBJHIX,x ;add it to this OBJect's HI byte for the X coordinates
sta OBJHIX,x ;store result
```

I've also expanded on this to handle the subpixel velocity:

Code: Select all

```
lda OBJHIH,x ;load this OBJect's HI byte for Horizontal velocity
clc
adc OBJHIX,x ;add it to this OBJect's HI byte for the X coordinates
sta OBJHIX,x ;store result
lda OBJLOH,x ;lo byte of horizontal velocity
clc
adc OBJLOX,x
bcc .carryHandled
inc OBJHIX,x
.carryHandled
```

Code: Select all

```
lda OBJHIH,x ;load this OBJect's HI byte for Horizontal velocity
clc
adc OBJHIX,x ;add it to this OBJect's HI byte for the X coordinates
sta OBJHIX,x ;store result
lda OBJHIH,x ;negative flag set if our horizontal velocity is negative
php ;store the negative flag
lda OBJLOX,x
plp ;pull negative flag
bmi .HNeg ;branch on negative
clc
adc OBJLOH,x
bcc .PosCarryHandled
inc OBJHIX,x ;increase the pixel x coordinate if we overflowed subpixels
.PosCarryHandled
jmp .HLoDone
.HNeg
sec
sbc OBJLOH,x
bcc .NegCarryHandled
dec OBJHIX,x ;DEcrease the pixel x coordinate if we UNDERflowed subpixels
.NegCarryHandled
.HLoDone
sta OBJLOX,x
```

But I don't think there's a way to express a number between 0 and -1 under this system. I can't conceive of any other way to do this, either. Is this an entirely flawed approach? Anyone have any sage advice?