16 bit addition
Code:
;initialization
lda #$00
sta byte0;Low Byte
sta byte1;High Byte
;Iteration One
clc;Cleared only before the first addition in 16bit addition
lda byte0;a = #$00
adc #$80;a = #$80, carry clear
sta byte0;byte0 = #$80
lda byte1
adc #$00;I'm adding zero, but if the carry was set, I'd be adding one
sta byte1;byte1 = #$00
;Iteration Two
clc;Cleared only before the first addition in 16bit addition
lda byte0;a = #$80
adc #$80;#$80 + #$80 = #$0100 but that won't fit in a byte.
;So we get #$00, but the carry is set because the result would have been greater than #$FF
sta byte0;byte0 = #$00
lda byte1
adc #$00;adc adds the number you give it plus the carry bit.
;It's set because the result of the last addition would have been greater than #$FF. So I'm adding #$00 plus 1 thanks to the set carry.
sta byte1;byte1 = #$01
;End Result
;256 * High Byte (byte1 in this case) + Low Byte (byte0) gives you your 16bit result.
;byte0 = #$00
;byte1 = #$01
;256 * 1 + 0 = 256.
;Or... like it's explained in the comments #$(High Byte)(Low Byte)
;#$0100 = 256.
One last note, is you need not always add #$00 in 16bit addition, it's just easiest to show how the carry flag works that way (since one might assume adding zero would not change the accumulator). By first adding #$80 to the low byte, then adding #$00 to the high byte I really added #$0080 to the 16bit number stored. But I could just as easily add #$FE40, by first adding #$40 to the low byte, then adding #$FE to the high byte.
Hmm... on to your jumping question. 16bit addition can help you, but as Bregalad stated, a whole byte is a lot to dedicate to the fractional part of a pixel. Either way, for a jump you,
1. Set y velocity when the jump is triggered.
;Then loop the following each frame
2. Add 1 (or more depending on your gravity) to the velocity value.
3. Add y velocity to position
If you did use a whole byte for fractions of a pixel, you'd use the high byte to display where the sprite is on screen (the whole pixel) and the low byte would keep fractions of a pixel. Though for scrolling you'd of course need an additional byte.