Home    LittleBigPlanet 2 - 3 - Vita - Karting    LittleBigPlanet 2    [LBP2] Help!
#1

4 bit addition/subtraction overflow help

Archive: 1 post


I'm using a string of BCDs (binary-coded digits) for a display, so I can add/subtract, and do all that fun stuff. I've got the addition and subtraction taken care of, and it works pretty well except handling the overflow.

I'm not quite sure how to handle overflow. I'm guessing that if I go above 1001, then I should just add 0001 to my next display digit. Then subtract 1010 from the current one.

so say I have 8+4 that gives me 12 (1100), so I send a 0001 addition to the tens BCD. Then I subtract 1010 from my 1100 leaving me 0010. Is that correct?

On the other end, when it comes to dropping below 0, I am at a complete loss for what to do.

Is using a string of BCDs the easiest way to go, or is there another way that would be simpler for creating a scoreboard type object?
2011-01-29 21:23:00

Author:
tdarb
Posts: 689


LBPCentral Archive Statistics
Posts: 1077139    Threads: 69970    Members: 9661    Archive-Date: 2019-01-19

Datenschutz
Aus dem Archiv wurden alle persönlichen Daten wie Name, Anschrift, Email etc. - aber auch sämtliche Inhalte wie z.B. persönliche Nachrichten - entfernt.
Die Nutzung dieser Webseite erfolgt ohne Speicherung personenbezogener Daten. Es werden keinerlei Cookies, Logs, 3rd-Party-Plugins etc. verwendet.