|
-
Dec 13th, 2006, 12:23 AM
#1
Thread Starter
New Member
Wat do i need to do? im missing thing...
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
-
Dec 14th, 2006, 05:17 PM
#2
Member
Re: Wat do i need to do? im missing thing...
Is this a schoolwork?
What is it you include with irving32.inc?
What's the error message?
You are definitly missing the printing code.
Some comments
1. you invoke "makeChaange", should be "makeChange".
2. Unnessasary to preserve all registers. Preserving
esi is enough.
3. "mov ah,byte ptr [esi+2]". You are not copying the second byte.
It is the third. Should be "mov ah,byte ptr [esi+1]".
4. "and ah,11100111b". You are not clearing bits 3 and 4, but 4 and 5.
Should be "and ah,11110011b".
5. "or ah,00010000b". You are not adding 1 to bit 4 and 0 to bit 3
Should be "or ah,1000b". You don't need the preceding zeros.
6. "mov byte ptr [esi+2],ah". Consequently this should be "mov byte ptr [esi+1],ah"
7. You should exit with kernel32.dll function "invoke ExitProcess,0"
8. Finally last line should be "end begin". "begin:" is the entry point.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|