simple source code... but can´t compile it :(
simple source code... but can´t compile it :(
(OP)
Hi,
I´m using MASM32 (version7 I think) to compile this "simple" code:
;set 32 Bit "flat" memory model:
.386
.model flat
;windows.inc for MASM needs the following option set:
IFDEF masm
option casemap :none
ENDIF
;constants and structures for the
;WinAPI core functions (TASM/MASM-Syntax):
include WINDOWS.inc
;include external (windows) functions:
IFDEF masm
MessageBoxA equ _MessageBoxA@16
ExitProcess equ _ExitProcess@4
ENDIF
extrn ExitProcess : near
extrn MessageBoxA : near
;put the data here:
.data
MessageBoxJustatitle db "Unbelievable, but reality",0
MessageBoxUselessContent db "Great message, isn`t it ?",0
ErrorCode dd 0
;and the code there:
.code
;execution starts here
_letsbegin:
;masses of code, this MessageBox, for example
push MB_ICONHAND or MB_OKCANCEL
push offset MessageBoxJustatitle
push offset MessageBoxUselessContent
;One could pass the window handle here,
;but windows are introduced in the next tutorial:
push 0
call MessageBoxA
;return value: in EAX resides a value
;indicating which button was clicked on
;thats enuf today: lets get outta here
push ErrorCode
call ExitProcess
;astalavista, baby...
;define the entry point:
end _letsbegin
However I got a lot of error messages like these:
c:\<file>\windows.inc(35) : error A2119: language type must be specified
(have a lot of these.......................)
c:\<file>\windows.inc(8746) : error A2008: syntax error: in structure
(a lot of these too)
c:\<file>\windows.inc(8758) : error A20008: structure improperly initialize
(a lot of these too)
What is happen? So much erros to a simple piece of code?
I can´t even compile my first "hello world" program in assembly? lol
Need help!
Thank you
Sérgio Oliveira
I´m using MASM32 (version7 I think) to compile this "simple" code:
;set 32 Bit "flat" memory model:
.386
.model flat
;windows.inc for MASM needs the following option set:
IFDEF masm
option casemap :none
ENDIF
;constants and structures for the
;WinAPI core functions (TASM/MASM-Syntax):
include WINDOWS.inc
;include external (windows) functions:
IFDEF masm
MessageBoxA equ _MessageBoxA@16
ExitProcess equ _ExitProcess@4
ENDIF
extrn ExitProcess : near
extrn MessageBoxA : near
;put the data here:
.data
MessageBoxJustatitle db "Unbelievable, but reality",0
MessageBoxUselessContent db "Great message, isn`t it ?",0
ErrorCode dd 0
;and the code there:
.code
;execution starts here
_letsbegin:
;masses of code, this MessageBox, for example
push MB_ICONHAND or MB_OKCANCEL
push offset MessageBoxJustatitle
push offset MessageBoxUselessContent
;One could pass the window handle here,
;but windows are introduced in the next tutorial:
push 0
call MessageBoxA
;return value: in EAX resides a value
;indicating which button was clicked on
;thats enuf today: lets get outta here
push ErrorCode
call ExitProcess
;astalavista, baby...
;define the entry point:
end _letsbegin
However I got a lot of error messages like these:
c:\<file>\windows.inc(35) : error A2119: language type must be specified
(have a lot of these.......................)
c:\<file>\windows.inc(8746) : error A2008: syntax error: in structure
(a lot of these too)
c:\<file>\windows.inc(8758) : error A20008: structure improperly initialize
(a lot of these too)
What is happen? So much erros to a simple piece of code?
I can´t even compile my first "hello world" program in assembly? lol
Need help!
Thank you
Sérgio Oliveira
RE: simple source code... but can´t compile it :(
if you are trying to push MB_ICONHAND onto the stack i would expect to see something like
assume ds=YOUR_DATA_SEGMENT
mov ax,YOUR_DATA_SEGMENT_SELECTOR
mov ds,ax
mov eax,[MB_ICONHAND] (if 32bit operand)
push eax
or
mov ax,[MB_ICONHAND] (if 16bit or 8bit operand)
push ax
"People who have nothing to say, say it too loud and have little knowledge. It's the quiet ones you need to worry about!"
RE: simple source code... but can´t compile it :(
Maybe you should just try using the 'Template' provided with the MASM32V7 package... unless you're using MASM v7 not the MASM32 v7 package... I based my template on the provided template and I never get that sort of problem.
Straiph... this is win32 asm... the 386 now supports pushing immediates and memory locs (there's a .386 at the top).
"Information has a tendency to be free. Which means someone will always tell you something you don't want to know."
RE: simple source code... but can´t compile it :(
Thankyou.
"People who have nothing to say, say it too loud and have little knowledge. It's the quiet ones you need to worry about!"
RE: simple source code... but can´t compile it :(
family of microprocessors.' I got it in Windows' .hlp format if you don't want to search for it any more. Very nice document on how to optimize for most Intel processors, although it's kinda difficult to start reading it (hard to figure out where to start IMO).
SIB rocks especially with lea, you can add a constant, another number, and add another number that's shifted. Say you need to multiply by 9,
lea eax,[eax][eax*8]
very nasty optimization trick IMO since the Pentium tries to get it executed in one clock cycle (barring interlocks and stuff like that).
"Information has a tendency to be free. Which means someone will always tell you something you don't want to know."