the health bar is 64 pixel wide so i want that this represents 100% of your max health while when got hit it will be reduced by the amount of hit points.
so as far as i remember i would need following routines. all calculations must be done in 16bit as i will use 8.8 fixed point maths.
assume that 10 is your max hp so actually i would calculate like this
64/10 = 6.4 pixel represent 1 hp.
so when got hit by 1 the healthbar would be adjusted by subtracting of 6.4 pixels. in 16 bit maths:
$4000/10 = $0666 = 1638. so hibyte of the result would be $06 which is the 6 pixel...
so when hit by 3 i would need to multiply $0666 * 3 = $1332 = 4914 = $13 = 19 pixel which seems to correct,,,
now another case
let assume our hero has 100 hp max.
64/100 = 0,64 = $4000/100 = 16384/100 = 163,84 = $00a3
so hit by 1 means a 16 bit subtraction by $00a3 and a hit by 3 means 3*$00a3 = $01e9
i think i am on the right track here BUT as it is a realtime action game i would need quick solutions for
16bit division
16bit multiplication
but without too many usage of tables like in 3d demos etc...
any ideas here from our 6502 maniacs? dont think in 2600 terms just in 6502 terms... as i am on atari 800...
Thanks a lot!













