News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

are these right? quick and easy!

Started by drapaki, February 26, 2007, 11:02:45 PM

Previous topic - Next topic

drapaki

just getting started in MASM (if you can't tell.. hehehe)
;use direct offse to move four values from Uarray to EAX
.386
.model flat,stdcall
.stack 100h
INCLUDE <c:\masm615\include\GraphWin.inc>

.data
Uarray WORD 1000h,2000h,3000h,4000h

.code
main PROC
mov EAX,Uarray ;put 1000h in register EAX
mov EBX,Uarray+4 ;go to offset of 2000h and put in register EBX
mov ECX,Uarray+8 ;go to offset of 3000h and put in register ECX
mov EDX,Uarray+12 ;go to offset of 4000h and put in register EDX

call DumpRegs ;show registers

main ENDP
end MAIN

and

;implement followint expression: EAX = -val2 + 7 – val3 + val1
.386
.model flat,stdcall
.stack 100h
INCLUDE <c:\masm615\include\GraphWin.inc>

.data
val1 SDWORD 8
val2 SDWORD -15
val3 SDWORD 20

.code
main PROC
mov EAX,val2 ;EAX = -Fh
neg EAX ;EAX = Fh
add EAX,7 ;EAX = 16h
sub EAX,val3 ;EAX = FFFFFFFFFFFFFFFF6h
add EAX,val1 ;EAX = FFFFFFFFFFFFFFFFEh

call DumpRegs

main ENDP
end MAIN

PBrennick

drapaki,
I see you are using the masm615 package. Updates for that package are now in a package called GeneSys. masm615 has been withdrawn but if you have any problems with it, Vortex and I will still support it.

Paul
The GeneSys Project is available from:
The Repository or My crappy website

drapaki

um.. teacher has us using this 615 version... guess he wants to keep it old school..  :dance:

hutch--

Remove the line,


.stack 100h


32 bit PE files set the stack limit if needed with the linker.

Your application will not exit correctly, it needs a call to ExitProcess().

Ensure that the "DumpRegs" procedure is available or you will get a linker error.
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php