|
-
Nov 3rd, 2004, 12:28 AM
#1
rate my posts if they help ya!
Extract thumbnail without reading the whole image file: (C# - VB)
Apply texture to bitmaps: (C# - VB)
Extended console library: (VB)
Save JPEG with a certain quality (image compression): (C# - VB )
VB.NET to C# conversion tips!!
-
Nov 18th, 2004, 06:00 AM
#2
I don't know what assembler you are using but from what I can tell your program looks fine. Here is one suggestion though:
Perhaps you could use the XCHG (exchange (swap) instruction)?
Also what do you mean it does nothing? Does the pogram hang when executed or does it return the values that it supposed to swap without swapping them?
Last edited by Peter Swinkels; Nov 23rd, 2004 at 09:01 AM.
-
Nov 18th, 2004, 02:28 PM
#3
hehe yeah it would display the result without them being swapped... I wrote this afterwards... after turning it in haha. it works:
Code:
INCLUDE irvine32.inc
.data
charArr BYTE 2 DUP(?)
.code
main PROC
; Get two character inputs and save them in a 2-byte array
call ReadChar
mov charArr, al
call ReadChar
mov [charArr+1], al
; push the offsets of characters onto the stack
mov eax, OFFSET charArr +1
push eax ; second parameter
dec eax
push eax ; first parameter
call swap2
mov al, charArr
call WriteChar
mov al, [charArr+1]
call WriteChar
exit
main ENDP
swap2 PROC
push ebp ; save EBP
mov ebp, esp
mov eax, [ebp+8] ; offset of first parameter
; EBP+8 is an offset. when dereferenced, it points
; to the offset of the first array element (yeah, offset of an offset)
; EAX has now the offset of the first array element
;mov al, [eax] ; this would give the value of the first array element
mov bl, [eax] ; Value of first parameter
mov eax, [ebp+12] ; offset of second parameter
xchg [eax],bl ; bl=val of second param. Second param is set to first param.
mov eax, [ebp+8] ; offset of first param
xchg [eax],bl ; first param is set to second param
pop ebp ; restore EBP
ret 8
swap2 ENDP
END main
rate my posts if they help ya!
Extract thumbnail without reading the whole image file: (C# - VB)
Apply texture to bitmaps: (C# - VB)
Extended console library: (VB)
Save JPEG with a certain quality (image compression): (C# - VB )
VB.NET to C# conversion tips!!
-
Jan 2nd, 2005, 12:34 PM
#4
Fanatic Member
Re: desperate help!!!
Code:
; push the characters onto the stack
push OFFSET [charArr + 1]
push OFFSET charArr
call swap
Methinks it was the fact that you should have either not have had brackets or had brackets (this fact changes from assembler to assembler.)
"Can't" and "shouldn't" are two totally separate things.
All questions should be answered. All answers should be true. That is why I post.
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
|