:'(
i m a beginer and not able to compile this program
include WIN.INC
.data
rval sdword ?
xval sdword 26
yval sdword 30
zval sdword 40
.code
main PROC
mov ax,1000h
inc ax
dec ax
;experssion rval= -xval+(yval-zval)
mov eax,xval
reg eax
mov ebx,yval
sub ebx,zval
add eax,ebx
mov rval,eax
;zero flag example
mov cx,1
sub cx,1
mov ax,0ffffh
inc ax
;sign flah example
mov cx,0
sub cx,1
mov ax,7fffh
add ax,2
;carry flag example
mov al,0ffh
add al,1
;overflow flag example
mov al,-127
add al,1
mov al,-128
sub al,1
exit
main ENDP
END main
i m using MASM611 with its IDE (pwb)
please pin point the faults. :( please help.
Regards,
Beginner
; read Iczelion tutorials: www.win32asm.cjb.net !!!
; try MASM32 Version 8.2 [32 Bit Macro Assembler]: http://www.codingcrew.de/masm32/index.php
; and RasAsm: http://radasm.visualassembler.com/
.386 ; that you can use the 386 instructions
.model flat, stdcall ; memory modell for win32
option casemap:none ; case sensitive link
;include WIN.INC
include kernel32.inc ; for api ExitProcess
includelib kernel32.lib
.data
rval sdword ?
xval sdword 26
yval sdword 30
zval sdword 40
.code
start: ; programm entry point
call main ; call your main proc
; you can also remove "call main" and write the content of your main function there -> I did it
; only this way, because you wanted your code in a function
invoke ExitProcess, 0 ; exit programm (you can also use ret)
main PROC
mov ax,1000h
inc ax
dec ax
;experssion rval= -xval+(yval-zval)
mov eax,xval
;reg eax ; I never heard of that command
mov ebx,yval
sub ebx,zval
add eax,ebx
mov rval,eax
;zero flag example
mov cx,1
sub cx,1
mov ax,0ffffh
inc ax
;sign flah example
mov cx,0
sub cx,1
mov ax,7fffh
add ax,2
;carry flag example
mov al,0ffh
add al,1
;overflow flag example
mov al,-127
add al,1
mov al,-128
sub al,1
;exit ; to exit use ret
ret
main ENDP
;END main
end start ; programm code ends here
In addition to n-w's post, the *rval sdword ?* needs to be in the .data? (uninitialized) section:
.data?
rval sdword ?
.data
xval sdword 26
yval sdword 30
zval sdword 40
Change:
reg eax
to:
neg eax
Paul