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

Jorrj

That is the question.

I've been reading AoA and learning using HLA under the impression that I would eventually be learning straight up assembly.  Now I'm beginning to wonder if that is that case at all.  I still value the reading I've done...I've no doubt that the concepts will transfer quite nicely to pure assembly...but I'm considering moving to something else.  Obviously, the general consensus here seems to be to use MASM(32).  It might seem silly to ask, but how should I go about getting started?  A book maybe?  I haven't been able to find much on learning to use MASM that isn't extremely old.

However, the main question here is whether I should continue with HLA (I'm 20% through the book) or move on before I get too caught up in it.

Thank you!

Mark Jones

Hello, well of course learning is all personal taste. Given unlimited time, it would be beneficial to learn AoA first, just as it would be to learn any other programming methodology, as each one expands our perspective, knowledge, and understanding. However I would say that if you don't plan on USING AoA, or are only studying it to learn MASM syntax, then this is the longer path to assembler nirvana.

Some people can teach themselves, and some cannot. If you cannot, then I could suggest Kip Irvine's book at http://kipirvine.com/asm/ -- apparently he teaches a course also. Every semester we see various questions from his students. (Usually because they are lazy and don't want to think for themselves!) :P

If you are the type that can learn on your own, then there are only three things needed to learn MASM32:
1. The MASM32 package: http://masm32.com/
2. The URL to Iczelion's Win32 tutorials: http://win32assembly.online.fr/tutorials.html
3. The ability to open the \masm32\help\*.CHM help files.

In those help files is mission-critical information: they must be referenced; print them out if need-be. Then it is just a matter of following the beginner-to-intermediate Iczelion tutorials to learn the majority of assembly programming. For any specific questions, the Search box here (top-left) probably has the answer.

Welcome aboard! :U
"To deny our impulses... foolish; to revel in them, chaos." MCJ 2003.08

Jorrj

In all my years of using forums (good and bad), that's probably the most straightforward and informative post that has been directed to me.  Thank you.

I don't think I'm learning HLA specifically to learn MASM syntax, but when using it, I fell more like I'm programming in C++ all over again than in a new language.  I have more questions, but I'll wait to see if some (most [all?]) are answered as I learn.

Edit: I do actually have a question.  You mentioned that "Given unlimited time, it would be beneficial to learn AoA first."  I forgot to ask why.

Mark Jones

Quote from: Jorrj on January 22, 2009, 11:42:05 PM
..."Given unlimited time, it would be beneficial to learn AoA first."  I forgot to ask why...

Hi there. Randall Hyde has spent a great deal of time creating AoA, with the intention that it be a "middle-ground" between high-level languages and assembler. While debatable, his reasoning is that some people would rather learn a higher-level assembler, and that it may be more readily adopted by those with existing HLL experience.

His website does a better job of explaining this than I can, please see:
http://webster.cs.ucr.edu/AsmTools/HLA/index.html

Regards,
Mark
"To deny our impulses... foolish; to revel in them, chaos." MCJ 2003.08

GregL

#4
Jorrj ,

In my opinion, HLA is not assembly language, HLA is a high-level language.

The original book 'The Art of Assembly Language' by Randall Hyde (1996) was about assembly language and MASM and was a very good book on the subject. The later book of the same name and by the same author (2003) is all about HLA. I think using the title 'The Art of Assembly Language' for the later book is very misleading. How many people have bought the book thinking it was about assembly language, only to find out it's about programming with HLA?

There is nothing wrong with HLA, but it's not assembly language.


dedndave

Hi Jorri,
   I am new to 32-bit code, myself. I looked at the AoA stuff also, including HLA. From what I could see, HLA looked like something that might be great for the right group of students. I think if someone is totally new to programming, it would be a good place to start, if they selected assembly language. And, I think that was the intention of HLA, to begin with; To get beginners up and running without having to learn all the information needed to write assembly language. I am experienced with 16-bit assembly language, and am (trying) making the transition to 32-bit. For me, I thought the HLA was an unneccessary excursion from my real goal.
  You and I are in similar circumstances, with one big difference. I am experienced with assembly language, in general. You are experienced with C. If you can learn the raw assembly instructions and processor architecture without going the HLA route, you may be better off, in the long run. Your C experience already has you primed with many of the basic foundations needed to write software.
- Dave

excisetax

HLA is a true assembler. It allows you to write higher level constructs through macros but you DON'T have to. You can write the lowest level assembly if you wanted to.
HLA also works for windows, linux, freebsd and MacOS. And another advantage is that HLA can translate your code to MASM, TASM, NASM, FASM and I forgot what else, which is cool if you want to examine their syntax.

HLA was designed as a tool to teach you Assembly but is no less powerful than MASM. You can't go wrong with HLA, and you can very easily switch to MASM or any other assembler later.


BlackVortex

Just take a look at some HLA proggies and at Iczelion's tutorials. What seems better and more natural to you ?

There is a HLA subforum here, take a look there and around the main masm sections for samples of code. There are also other assemblers, like goasm, but they aren't exactly for beginners.

Personally, I think all asm beginners should start with masm, period. After a few weeks/months you can look at other stuff, knowing what you want/need ...

Bill Cravener



I have to ask. I have been on occasion hearing the phrase "Pure Assembly" and I must confess I don't understand that terms use. What is pure assembly? Back when I did this stuff for a living we called it "Assembly Language". There was never anything "pure" about it. What is this pure? What does that mean, pure assembly?
My MASM32 Examples.

"Prejudice does not arise from low intelligence it arises from conservative ideals to which people of low intelligence are drawn." ~ Isaidthat

BlackVortex

Everyone has a different notion of asm purity. For me, it's that I want my source to look "kinda" close to the actual (dis)assembly. I debug my exes ALL the time, it's cool to see stuff and recognize what it is. The main thing is to use as much winAPI as possible, when possible.

I love simple HLL structs, especially runtime conditionals, because testing and jumping to labels screwes up my source and my brain. One of these days I may drop dead in front of goasm between a "@" and a ":", but I can't go back to masm's red tape.   :green2

Also, using the msvcrt library of masm was useful to me in some occasions, that's cool, too.

P.S.: I like Intel's syntax   :bg

jj2007

Quote from: Bill Cravener on February 23, 2010, 03:04:05 PM
What is pure assembly?

    .686p
    .model flat, stdcall
    option casemap :none
    externdef _imp__DispatchMessageA@4:PTR pr1
    m2wp equ <_imp__DispatchMessageA@4>
    externdef _imp__GetMessageA@16:PTR pr4
    gms equ <_imp__GetMessageA@16>
    externdef _imp__DefWindowProcA@16:PTR pr4
    dpro equ <_imp__DefWindowProcA@16>
    externdef _imp__PostQuitMessage@4:PTR pr1
    pqm equ <_imp__PostQuitMessage@4>
    externdef _imp__RegisterClassExA@4:PTR pr1
    scln equ <_imp__RegisterClassExA@4>
    externdef _imp__ShowWindow@8:PTR pr2
    wshw equ <_imp__ShowWindow@8>
    externdef _imp__LoadCursorA@8:PTR pr2
    lsc equ <_imp__LoadCursorA@8>
    externdef _imp__CreateWindowExA@48:PTR pr12
    crwe equ <_imp__CreateWindowExA@48>
    includelib \masm32\lib\user32.lib
  .code
    ims db "Slick Huh ?", 0
    pcl dd ims
  slick_huh:
    push ebp
    mov ebp, esp
    sub esp, 96
    push 32512
    xor edi, edi
    push edi
    mov esi, 4194304
    mov ebx, pcl
    call lsc
    mov DWORD PTR [ebp-96], 48
    mov DWORD PTR [ebp-92], 3
    mov DWORD PTR [ebp-88], OFFSET wpep
    mov DWORD PTR [ebp-84], edi
    mov DWORD PTR [ebp-80], edi
    mov DWORD PTR [ebp-76], esi
    mov DWORD PTR [ebp-72], edi
    mov DWORD PTR [ebp-68], eax
    mov DWORD PTR [ebp-64], 10h
    mov DWORD PTR [ebp-60], edi
    mov DWORD PTR [ebp-56], ebx
    mov DWORD PTR [ebp-52], edi
    lea eax, [ebp-96]
    push eax
    call scln
    mov ecx, -2147483648
    push 1
    push edi
    push esi
    push edi
    push edi
    push edi
    push ecx
    push edi
    push ecx
    push 13565952
    push ebx
    push ebx
    push edi
    call crwe
    push eax
    call wshw
    lea ebx, [ebp-48]
    push edi
    push edi
    push edi
    push ebx
    jmp mlep
  @@: push edi
    push edi
    push edi
    push ebx
    push ebx
    call m2wp
    mlep: call gms
    test al, al
    jnz @B
    leave
    retn
  wpep: cmp DWORD PTR [esp+8], 2
    jne @F
    push 0
    call pqm
  @@: jmp dpro
  end slick_huh


\masm32\examples\exampl10\slickhuh\slickhuh.asm

If you want it purer than that, you'll have to use the db xx, xx, xx syntax.
Me personally I stick to pure Massembly

hutch--

I am not sure as to why this thread has come to life after so long or that the Campus is the place for later comments but to try and do Randy Hyde some justice here, his own work with HLA is something akin to an extended macro interface to a variety of assemblers for different platforms. Now while it is not classic x86 Intel assembler, it is an unusual tool that does unusual things and the general drift is the output has a reasonably good mapping to the input so its not just another compiler.

JJ,

I am not sure if that example qualifies as the real thing[tm] and it may be too high level for real men[tm] as it uses mnemonics instead of direct opcodes in hex but then there are few of us left.  :green2
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

dedndave

HLA is a great way for students to get going   :U

JJ - all a matter of interpretation, i guess
to me, "pure assembler" would have no API calls   :P
you'd be hard-pressed to write a program that does something
by that definition, BIOS code is the only "pure assembler" in PCs

Sergiu FUNIERU

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.

jj2007

Quote from: dedndave on February 23, 2010, 05:36:11 PM
to me, "pure assembler" would have no API calls   :P

Exactly - that's why I prefer pure Massemblertm
:green