News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Encode 7 bit Interger

Started by ilian007, October 16, 2009, 09:18:57 PM

Previous topic - Next topic

ilian007

Hi we have to encode 7bit unsigned integer using certain procedure.

However for starting it I dont know how to get to the point where i will have only 7bit binary number.

From the keyboard it is 8 16 or etc .... The teacher just said: dont take attention of the 8 one .... any ideas ?

regular getdec will get 8 16 or etc number .... 

thanks

dedndave

well - if it is a signed integer, it can be from -64 to +63
if it is unsigned, it can be from 0 to 127
the real work here is the routine that reads the keyboard
you have to limit input to whichever range applies

FORTRANS

Hi,

   To get a 7-bit number, use AND to delete all higher bits.


; Limit contents of AX to only 7 bits.
        AND     AX,0000000001111111B


   This assumes you've got some data in AX to begin with
of course.

Steve N.

ilian007

yeah I see thank you :) I was looking online and it says AND it with 7F which is I guess same as what FORTRANs said in HEX

thanks will start doing the procedure using that new info  :)

ilian007

I have a binary number : "0000000100110101"  when trying to represent it in oct with putoct it prints "000465".

Please can you help me with how to make it to display number without the zeroes which I dont need in that case?

Would be great if I can make it instead of "000465" to display "465" or even better "465Q"

Thank you :)

dedndave

try the attached file...

ilian007

Thanks dedndave it works great. However, the teacher is ok if we leave the number with 0's in front 000344Q is ok for him :P Now, studying for midterm tomorrow :)