Menu

Addition on a Word variable

Help
Tom
2008-11-14
2013-05-30
  • Tom

    Tom - 2008-11-14

    Evening All

    This is probably a bit of a daft question but anyway...

    If you define a variable as a word and then keep adding 1 to it when it's at 255 and you add another 1 what happends?

    I need to count to over 800, and was initially thinking a word variable keep adding 1 and testing with an if x = 800 then, but I suspect that won't work, I think the lower byte will over flow back to 1, and I have no idea what the if will do.

    Tom

     
    • Tom

      Tom - 2008-11-15

      OK, looking at the generated ASM file, when the lower byte rolls over in a word variable it does handle it correctly, ie carries into the upper byte as well.

      As for the if statement, haven't quite figured out what the ASM is doing there.

      Tom

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.