News:

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

To HLA or not to HLA

Started by Jorrj, January 22, 2009, 04:28:08 PM

Previous topic - Next topic

BlackVortex

What ? Integrated operating system functions don't count as impurities.  :naughty:

brethren

#16
Quote from: BlackVortex on February 24, 2010, 06:20:15 AM
What ? Integrated operating system functions don't count as impurities.  :naughty:

whats your point? its an assembler with a library of procedures, whats 'impure' about that?

edit-
oh right. i see what your saying :wink i'm pretty sure daves comment about api calls wasn't mean't to be taken seriously :P

Astro

Quote from: Sergiu FUNIERU on February 23, 2010, 06:39:42 PM
I tried to use HLA myself. The bright side is that the syntax is easier to read than the asm syntax. My problem was that I had to learn another syntax. I prefer to learn the syntax that's as close to the machine code as possible, simply because I'd like as few as possible layers between my code and the machine code.
Couldn't put it better!

It's why I moved to assembler on the x86. I was fed up with "How does C++ know that? How does C++ do that? WTF??" so I gave up after much trying and wasting time figuring out where everything came from. HANDLE, LPSTR etc.. just finished me off when I discovered they were all the same type - a DWORD. It was too much - what is wrong with using the actual type? Equates are about the only thing that made sense, but then what is wrong with using the actual value and a quick comment?

Best regards,
Robin.

hutch--

 :P

Robin,

Sounds like you have already been converted.  :U
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

sinsi

Quote from: jj2007\masm32\examples\exampl10\slickhuh\slickhuh.asm
What's with using [ebp] and leave? RealASMers uses [esp] and count what's pushed.
Nothing better than seeing push eax
push [esp+16]
push [esp+16]
call WindowsAPI

Light travels faster than sound, that's why some people seem bright until you hear them.

dedndave

leave = good   :P
sometimes, you want to exit a routine from different points in the code
leave can save you a lot of balancing code
i don't always use it, but it seems to work well for more complex routines

sinsi

leave = ebp -> that thing like 'enter x,y' that was such a good idea.
Isn't leave a slow instruction?

x86 has a lack of registers, having ebp available is *A Good Thing*.
x64 has more and is more fun  :bg

ymmv,imho,ime,etc.
Light travels faster than sound, that's why some people seem bright until you hear them.

dedndave

enter is the slow one
leave is actually pretty fast (and small)
i don't use enter   :bg

in my ling long kai fang routines, i use EBP as a stack frame base pointer throughout most of the routine
but for the base conversion loop, i push/pop it and use it as a general register
during the loop, i don't need to access the stack frame

jj2007

Quote from: dedndave on February 25, 2010, 11:22:29 AM
i don't use enter   :bg

Me neither. I always use invoke, which results in
push ebp
mov ebp, esp
add esp, nn

I wonder if old versions of Masm use enter...?

brethren

Quote from: jj2007 on February 25, 2010, 03:46:40 PM
Quote from: dedndave on February 25, 2010, 11:22:29 AM
i don't use enter   :bg

Me neither. I always use invoke, which results in
push ebp
mov ebp, esp
add esp, nn

I wonder if old versions of Masm use enter...?

in the prologue it should be sub esp,nn for reserving the space for local vars on the stack.

jj2007

Quote from: brethren on February 25, 2010, 04:59:29 PM
in the prologue it should be sub esp,nn for reserving the space for local vars on the stack.

Masm uses add esp, -offset
JWasm uses sub esp, offset

The former saves some bytes if the required # of bytes is exactly 128

include \masm32\include\masm32rt.inc

MyTest PROTO: DWORD, :DWORD

.code
AppName db "Masm32 is great!", 0
Hello db "A message:", 0

start:
invoke MyTest, offset AppName, addr Hello
exit

MyTest proc arg1:DWORD, arg2:DWORD
LOCAL locbuf[128]:BYTE
  MsgBox 0, arg1, arg2, MB_OK
  ret
MyTest endp

end start


Masm
00401033       /$  55                       push ebp
00401034       |.  8BEC                     mov ebp, esp
00401036       |.  83C4 80                  add esp, -80

JWasm
00401033       /$  55                       push ebp
00401034       |.  8BEC                     mov ebp, esp
00401036       |.  81EC 80000000            sub esp, 80

dedndave

not very many procs have 32 dword parms (thank goodness)