rjwilldohisbest
Technical User
Hello
I have the art of assembly tutorial and another one and I appear to be having trouble with converting binary into decimal.
Here's an example of what I mean:
**********************************************************
BIN to DEC coversions self exercises
BIN: 11001
This one from the tutorial and comes out to be correct:
1*2^0 + 1*2^1 + 0*2^2 + 0*2^3 + 1*2^4
= 1 + 2 + 0 + 0 + 16 //--> 19 DEC
*******************************************************************
These answers should be flip-flopped
41 should be the first example and 37 should be the second example?
BIN: 101001
1*2^0 + 0*2^1 + 1*2^2 + 0*2^3 + 0*2^4 + 1*2^5
= 1 + 0 + 4 + 0 + 0 + 32 //--> 37 DEC
100101
1*2^0 + 0*2^1 + 0*2^2 + 1*2^3 + 0*2^4 + 1*2^5
= 1 + 0 + 0 + 8 + 0 + 32 //--> 41 DEC
********************************************************************
One I tried out on my own.
Another one that comes out wrong. Should be 78, not 57?
BIN: 1001110
1*2^0 + 0*2^1 + 0*2^2 + 1*2^3 + 1*2^4 + 1*2^5 + 0*2^6
= 1 + 0 + 0 + 8 + 16 + 32 + 0 //--> 57 DEC
I do not know what I may be doing wrong. I do examples on paper and they come out different, but the example from the tutorial comes out right. I am a total beginner at this and if anyone knows what I might be doing wrong, please let me know.
Thanks for your time.
RJ
I have the art of assembly tutorial and another one and I appear to be having trouble with converting binary into decimal.
Here's an example of what I mean:
**********************************************************
BIN to DEC coversions self exercises
BIN: 11001
This one from the tutorial and comes out to be correct:
1*2^0 + 1*2^1 + 0*2^2 + 0*2^3 + 1*2^4
= 1 + 2 + 0 + 0 + 16 //--> 19 DEC
*******************************************************************
These answers should be flip-flopped
41 should be the first example and 37 should be the second example?
BIN: 101001
1*2^0 + 0*2^1 + 1*2^2 + 0*2^3 + 0*2^4 + 1*2^5
= 1 + 0 + 4 + 0 + 0 + 32 //--> 37 DEC
100101
1*2^0 + 0*2^1 + 0*2^2 + 1*2^3 + 0*2^4 + 1*2^5
= 1 + 0 + 0 + 8 + 0 + 32 //--> 41 DEC
********************************************************************
One I tried out on my own.
Another one that comes out wrong. Should be 78, not 57?
BIN: 1001110
1*2^0 + 0*2^1 + 0*2^2 + 1*2^3 + 1*2^4 + 1*2^5 + 0*2^6
= 1 + 0 + 0 + 8 + 16 + 32 + 0 //--> 57 DEC
I do not know what I may be doing wrong. I do examples on paper and they come out different, but the example from the tutorial comes out right. I am a total beginner at this and if anyone knows what I might be doing wrong, please let me know.
Thanks for your time.
RJ