AuthorMessage
Meka][Meka
Unstopable
Posts: 700

heres a quick sample ive whipped up, will maybe help you understand the basics...
this will compile with masm32
Code:

;directives
.386
.model   flat, stdcall
option   casemap:none
;includes
include      windows.inc
include      kernel32.inc
include      user32.inc
includelib   user32.lib
includelib   kernel32.lib
;your header :)
ShowMessage PROTO :DWORD,:DWORD
FloodMessage PROTO :DWORD,:DWORD,:DWORD
FloodMessage2 PROTO :DWORD,:DWORD,:DWORD
;const
.data
   AppName   db    "Delphi32", 0 ;Lol
   OutputText   db    "Small sample by Meka.", 0
.data?
.code
start:
   ;your main application inside here
   invoke FloodMessage2,addr OutputText, addr AppName, 10
   invoke ExitProcess, NULL
   ;end your application
   
   
;can add your library here... to make it simple :)   
ShowMessage PROC msg:DWORD, cap:DWORD
   invoke MessageBox, 0, msg, cap, MB_OK
   ret
ShowMessage EndP
FloodMessage PROC msg:DWord, cap:DWORD, count:DWORD
;type 1
@loop:
   invoke ShowMessage, msg, cap
   dec count
   .if count > 0
      jmp @loop
   .endif
   
   ret
FloodMessage EndP
FloodMessage2 PROC msg:DWord, cap:DWORD, count:DWORD
;type2
   .while count > 0
      invoke ShowMessage, msg, cap
      dec count
   .endw
   
   ret
FloodMessage2 EndP
end start

note that both FloodMessage and FloodMessage2, are both the same, they both do the same thing, but only 2 is much more readable ;) (higherlevel)
note that you can also use jump instructions such as JL, but i will come to this later
; M E K A ;
Meka][Meka
Unstopable
Posts: 700

you can also make your code a little bit more readable by using typedef
Code:
newname typedef type

for example check in my example
Code:

;directives
.386
.model   flat, stdcall
option   casemap:none
;includes
include      windows.inc
include      kernel32.inc
include      user32.inc
includelib   user32.lib
includelib   kernel32.lib
;const
.data
   ;# lets typedef some things to make it easier to read...
   string      typedef      DWORD                  ; <<<< NOTICE HERE
   AppName   db    "Delphi32", 0 ;lol
   OutputText   db    "Small sample by Meka.", 0
.data?
;your header :)
ShowMessage PROTO :string,:string
.code
start:
   ;your main application inside here
   invoke ShowMessage,addr OutputText, addr AppName
   invoke ExitProcess, NULL
   ;end your application
   
   
;can add your library here... to make it simple :)   
ShowMessage PROC msg:string, cap:string
   invoke MessageBox, 0, msg, cap, MB_OK
   ret
ShowMessage EndP
end start

notice that i have defined string, so now i can use the string type, to make it readable to say a delphi programmer (which i am), you could add int, char, or anything you want....
Nina
Ametuar
Posts: 134

The same can be accomplished with the following code:
Code:

newname typedef type {
    int data1;
    int data2;
    char data3;
}newtype;

Meka][Meka
Unstopable
Posts: 700

Quoted from Nina
The same can be accomplished with the following code:
Code:

newname typedef type {
    int data1;
    int data2;
    char data3;
}newtype;

that is not assembly.....and that wouldnt make assembly resemble delphi in keywords.....