Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


The beginner needs help

bogdanul2003bogdanul2003 Member Posts: 153
I've read the Data Organization from Art of assembly and now i'm trying to make the applications they propose for that chapter.The problem is at the third application where i have to make a date format in a word variabel (MMMM DDDDD YYYYYYY where the first 4 bits are for the month the next 5 for the day and the last seven for the year).
First i'm geting the month from a textbox in string format(Delphi).After that i'm converting that string into a number and put the result into a byte variabel let's say x:byte;and let's say x has the value 10 (x=10).This means that x is 0000 1010.How do i make x to have this value: 1010 0000.I can do this by x:=x*16;Is there other way
to do this?something with shl and shr.
If someone knows pls tell me.


  • CroWCroW Member Posts: 348
    SHL/SHR shifts a number by a given number of bits left/right.example:

    mov al,10011001b
    shl al,1
    -> AL is now 00110010b

    mov al,10011001b
    shr al,1
    -> AL is now 01001100b

    one shift left(right) is the same as multiplicate(divide) by 2.
    shifting 2 does *4 (or /4),shifting 3 does *8 ( or /8).

Sign In or Register to comment.