CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    Nov 2004
    Posts
    20

    Check this little assignment...

    Dear Gurus!

    I'm just begginner level student of assembly and I found the following question in my assignment. However, I've solved it but I want confirmation about its correctness, and if it isn't correct, please do it. (These results have been achieved by using NASM assembler).

    Problem: Fill out the corresponding values in HEX in the register table after the execution of each instruction.

    Code:
    Instructions        AL     Carry Flag
    mov al, 5dh         
    shr al, 3
    mov al, 3ch
    sar al, 6
    mov ax, 12d4h
    rol ax, 7
    rcr ax, 2
    sar ax, 1
    
    Solution:
    Instructions        AL     Carry Flag
    mov al, 5dh         5d     0
    shr al, 3           0b     1
    mov al, 3ch         3c     1
    sar al, 6           00     1
    mov ax, 12d4h       12d4   1
    rol ax, 7           00     0
    rcr ax, 2           00     0
    sar ax, 1           00     0
    Highly thanx.


    Mood.

  2. #2
    Join Date
    Dec 2004
    Location
    Poland
    Posts
    1,165

    Re: Check this little assignment...

    Unfortunately, starting with line 'rol ax, 7' your results appear to be incorrect. I will not write you correct results here, jus will let you rethink this problem again . You can complete this task with writing program and debugging it with some debugger (TD, Visual Studio inline assembly, or maybe there is some debugger coming with NASM?).

    Regards,
    Hob
    B+!
    'There is no cat' - A. Einstein

    Use [code] [/code] tags!

    Did YOU share your photo with us at CG Members photo gallery ?

  3. #3
    Join Date
    Nov 2004
    Posts
    20

    Re: Check this little assignment...

    Dear Hobson!

    I've checked again this assignment and the solution with some changes is here. Now please check it critically. Actually, I want to get full marks in this assignment.

    Code:
    Instructions        AL     Carry Flag
    mov al, 5dh         
    shr al, 3
    mov al, 3ch
    sar al, 6
    mov ax, 12d4h
    rol ax, 7
    rcr ax, 2
    sar ax, 1
    
    Solution:
    Instructions        AL     Carry Flag
    mov al, 5dh         5d     0
    shr al, 3           0b     1
    mov al, 3ch         3c     1
    sar al, 6           00     1
    mov ax, 12d4h       d4     1
    rol ax, 7           09     1
    rcr ax, 2           82     0
    sar ax, 1           41     0
    Thanx a lot.


    Mood

  4. #4
    Join Date
    Dec 2004
    Location
    Poland
    Posts
    1,165

    Re: Check this little assignment...

    Now your solution seems to be OK. I wish you full marks for this assignment, but I think that it would be really good if you learn how to check this by yourself using debugger.

    Regards,
    Hob
    B+!
    'There is no cat' - A. Einstein

    Use [code] [/code] tags!

    Did YOU share your photo with us at CG Members photo gallery ?

  5. #5
    Join Date
    Nov 2004
    Posts
    20

    Re: Check this little assignment...

    Dear Hobson!

    Being student of very beginner level, I'm trying to understanding the debugger's usage, but I'm not confirmed about the results, so I drop a request for check.

    However, thanx a lot for guiding.


    Mood.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured