CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Oct 2006
    Posts
    10

    help me please.. im missing something and i don't know :(

    DESIGN AN IA-32 ASSEMBLY LANGUAGE PROGRAM TO ENTER 10 DOUBLE
    WORD INTEGERS, CHANGE BITS 3 AND 4 IN BYTE 2 OF EACH INTEGER
    TO 10, AND PRINT THE RESULT IN BINARY STRING.

    People are telling me that I'm missing something, Can someone help me what am i missing?? it seems that i did everything that is asked for.

    Code:
    include irvine32.inc
    
    makeChange proto, baseAddr:ptr dword, count:dword
    printBinary proto, baseAddr:ptr dword, count:dword
    
    .data
    numbers    sdword    1234,-1234,3456,-3456,12345
    
    .code
    begin:
    invoke    makeChaange, addr numbers, lengthof numbers
    invoke    printBinary, addr numbers, lengthof numbers
    
    
    
    
    
    makeChange proc, baseAddr:ptr dword, count:dword
    pushad
    
    mov    esi,baseAddr
    mov    ecx,count
    
    next:
    mov    ah,byte ptr [esi+2]    ;byte 2 of each dword
    and    ah,11100111b        ;clear bits 3 and 4
    or    ah,00010000b        ;change bits 3 and 4 to 10
    mov    byte ptr [esi+2],ah
    
    add    esi,4                ;advance to next dword
    loop    next
    
    popad                    ;restore all the dword registers
    ret
    makeChange endp
    
    printBinary proc, baseAddr:ptr dword, count:dword
    
    
    printBinary    endp

  2. #2
    Join Date
    Nov 2004
    Posts
    34

    Re: help me please.. im missing something and i don't know :(

    I don't know exactly what kind of problem you are getting, so this solution may not apply to you: Offset zero = 1st byte, you are modifying the 3rd byte.

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