Articles

Metasploit Framework Windows Tutorial
Remote Desktop Connection
Windows Processes That May Be Dangerous
How-To use NetCat a Tutorial
Common Linux Commands
Common Ports
Netcat Commands
HTTP Response Codes
War-Google Hack Terms
Wardriving
Avoiding Social Engineering and Phishing Attacks
Intrusion Detection on Linux
Linux Intrusion Detection
Penetration Testing Guide
Penetration Testing Tools
Social Engineering Fundamentals, Part I: Hacker Tactics
Social engineering (computer security)
The Psychology of Social Engineering

The Archives

General GSO
GovernmentSecurity.org News & Suggestions
In The News
Open Topic
General Security Information
Trash Can
Exploit & Vulnerability Mailing List Archives
Trial Member Forum
Product and Program Reviews GSO Tutorials
System Security
Windows Systems
Beginners Section
Linux & Unix Systems
File Downloads
Exploit Research & Discussion Trojan & Virus Errata
Networking Security / Firewall / IDS / VPN / Routers
System Hardening
E-Mail Security
Wifi Security
Trial Member Uploads
Upload discovered Trojans & Mal ware
GSO Programming Section
C , C++ , VC++
Visual Basic.NET
Perl /CGI
Java/Javascript
PHP/XML/ASP/HTML
Assembly + Other
The Cork Board
Network Security Consultant Directory
Network Security Jobs
The Archives
Encryption Information
General Network Security
Internet Anonymity
HTTP Protocol Security
Linux Security
MS IIS Information
Exploit Articles
Programming / Tool Design
GSO Software Projects
Public Downloads
Microsoft Security Questions and Papers

Full Version: Which Asm Language?
tibbar
hi,

i have been programming with an asm language called goasm for ages, but after reading some of the asm source posted on gso in masm i am having second thoughts...

in goasm to loop i have to use cmp and jz, whereas in masm you have macro language .WHILE, .IF etc.

to me, this macro language looks more like c than asm, and i wonder which is a more efficient asm language.

so my question is whether there are disadvantages to masm's macro language, or whether i am wasting my time in goasm doing it so low level?

thanks.
DumpZ
Well i don't know one word ASM but i didn't knew there were diffrent kinds
thesource
Im thinking I would like to learn ASM so this is a good question cause I'd like to learn the one that will help me most in the future, learning new languages.
White Scorpion
you can test it easily, but most of the time you won't waste much using the macros from masm32 .

take a look here:

CODE

.586
.model flat,stdcall
option casemap:none

include \masm32\include\windows.inc
include \masm32\include\kernel32.inc
include \masm32\include\user32.inc

includelib \masm32\lib\kernel32.lib
includelib \masm32\lib\user32.lib

.DATA

.CODE
start:

mov eax,13
mov ebx,12
.IF eax>ebx
mov ecx,eax
.ELSE
mov ecx,ebx
.ENDIF

.WHILE ecx!=0
inc eax
dec ecx
.ENDW

; here we start normal assembly:
xor eax,eax;to make a line in disassembled code
mov eax,45
mov ebx,32
cmp eax,ebx
jnz not_equal
jmp equal

not_equal:
mov ecx,ebx
my_loop:
inc eax
dec ecx
jnz my_loop

equal:
push 0
call ExitProcess

end start


disassembled code:
CODE

00401000  MOV EAX,0D
00401005  MOV EBX,0C
0040100A  CMP EAX,EBX
0040100C  JBE SHORT test.00401012
0040100E  MOV ECX,EAX
00401010  JMP SHORT test.00401014
00401012  MOV ECX,EBX
00401014  JMP SHORT test.00401018
00401016  INC EAX
00401017  DEC ECX
00401018  OR ECX,ECX
0040101A  JNZ SHORT test.00401016
0040101C  XOR EAX,EAX
0040101E  MOV EAX,2D
00401023  MOV EBX,20
00401028  CMP EAX,EBX
0040102A  JNZ SHORT test.0040102E
0040102C  JMP SHORT test.00401034
0040102E  MOV ECX,EBX
00401030  INC EAX
00401031  DEC ECX
00401032  JNZ SHORT test.00401030
00401034  PUSH 0                                  ; /ExitCode = 0
00401036  CALL <JMP.&kernel32.ExitProcess>        ; \ExitProcess



as you can see it doesn't really matter much, but the big advantage of the macro assembler is that you can do both, if you want to code normal assembly for full control on a particular part of the program you can, and if you don't need it for another then you can use macros where useful...


btw, the code above is assembled with masm32 v8.2 (latest release) via:
ml /c /coff test.asm
link /subsystem:windows test.obj

i have used others as well, but now i only use tasm once in a while for 16-bit coding, the rest i use masm32 .

also using :

invoke ExitProcess,0

is a lot easier then :

push 0
call ExitProcess

both can be used, and if you use invoke it will do exactly the same in the result of the code....


this is just my opinion, do with it what you like laugh.gif

illwill
masm gives you more time for pussy and beer
low level asm makes your gf leave you and a beer gut


i mean its all part of preference ... thats why people choose higher languages like vb .. you can do the shit quick and easy and any 8 yr old with visual studio can push out a prog.

i like masm because its quick and easier to read and still small and sexy, plus its easier to transfer msdn code over
strohunter
by far, nasm (and maybe yasm in some times ^^)
belgther
what about tasm? I heard it is pretty good,too. I didn't use TASM so much, but i had a version of MASM with an editor which had some stupidities, but contained great tutorials of Iczelion, that can be good for beginners to learn ASM...
But programming with machine language would be better if we had an automatic PE generator, where you don't have to include anything but external DLLs which aren't in windows... Then you only had to write your code, and it would be more flexible than any other compiler+linker...
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2005 Invision Power Services, Inc.