Hi Randy. I have a quick question that you might have answered here before.

Will "Windows Programming in Assembly Language" cover any of the other assemblers in particular (MASM, FASM, NASM) or will it also be HLA-based?
Posted on 2003-04-23 22:11:00 by Masmer

Hi Randy. I have a quick question that you might have answered here before.

Will "Windows Programming in Assembly Language" cover any of the other assemblers in particular (MASM, FASM, NASM) or will it also be HLA-based?


No :-)
It will definitely use HLA syntax and some features specific to HLA.
Why? Well, couple of reasons:

1. The book is already going to be too long as it is. My publisher would
like something about 600 pages; it's got 14 chapters planned and the
four chapters I've written already exceed an average of 50-75 pages.
Adding support for other assemblers means that I would have to cut
material out of the book to make room.

2. Putting source code for various assemblers in the same programming book
is bound to cause a lot of confusion.

3. I've got my own horn to toot :-) Seriously, though, one of the arguments
I've been making to people to learn HLA is the promise that I'll be writing
several books and document (both published and electronic) to support
HLA. I intend to keep that promise.

4. What other assemblers do I use? MASM32's an obvious choice, but unless
I support *every* assembler out there (which is not practical), I'm going to
get a lot of complaints regardless.

5. There are already a *ton* of examples on the web for MASM32, so having
examples in MASM32 isn't quite as important as supporting HLA.
NASM is slowly getting there. FASM could use some support. On general
principles (largely due to it's author), I absolutely refuse to do anything to
help support SpAsm :-).

6. HLA generates MASM, Gas, TASM, and FASM source code, so if you really
want to see how something is done in one of these assemblers, you can
always look at the HLA output.


For the most part, the differences in the book will be largely syntactical.
However, I'm not going to claim that a MASM32 user will be able to read
the book (without knowing HLA) and write MASM32 code straight from
the examples. As I said, though, you can always look at the HLA output.
Of course, that's not going to help with learning the material from the book
in the first place; knowning HLA is really going to be necessary, there.

Yeah, it limits the market for the book somewhat. But the price of the book,
if it were large enough to support multiple assemblers, would also scare
a lot of people away.

OTOH, I do have future plans (one or two books after "Windows Programming
in Assembly") to write a "parallel guide to x86 assembly language" that provides
an x86 reference manual for MASM, TASM, Gas, NASM, FASM, and HLA all in
a single volume. With that reference, it should be possible to quickly convert
between the syntaxes of these different assemblers.
Cheers,
Randy Hyde
Posted on 2003-04-23 22:37:36 by rhyde
Gee, and I was expecting a quick answer. :grin: Thanks for your answer.

I'm going to setup HLA on my Win95 laptop tonight and start studying the various documents you have online.

While my basic 16-bit asm knowledge is becoming engrained, I feel that I'm somewhat going in a tangent from my real goal of Win32asm programming. Maybe it's just me, but grasping Win32 API programming (via C or asm) seems fragmented and difficult. Maybe using HLA will make Win32asm programming easier to digest for me.
Posted on 2003-04-23 23:15:10 by Masmer

Gee, and I was expecting a quick answer. :grin: Thanks for your answer.

Maybe using HLA will make Win32asm programming easier to digest for me.


Well, that's a large part of the reason I gave HLA so many features -
to make it a bit easier to write Windows code.

You're absolutely right about the fragmentation issue.
There's also a *ton* of stuff you've got to learn and it always seems to
me that in order to write some simple little pieces of code I have to wind
up learning tons of stuff on the side, as well.

HLA keeps growing, too, as I find out things in Windows that an extra
feature or two helps out with. E.g., today I just added "open-ended"
array constants and variables to HLA to help make table creation a bit
easier.

The drawback, of course, is that as HLA grows, it consumes a fair amount
of time to learn all of its features, as well. Fortunately, you can take
an incremental approach to learning HLA. I.e., just learn the basic machine
instructions to get you going and then learn the more advanced features
on a piecemeal basis.
Cheers,
Randy Hyde
Posted on 2003-04-24 20:56:18 by rhyde
Hey Randy,

I'm using HLA 1.46 right now, but it does not encode all MMX instructions. in particular I have a problem with movd. I know you said you were working on SSE/SSE2, but isn't MMX support finished yet?

I have to use



#asm
movd eax, mm1
#endasm


instead of



movd (mm1, eax);
Posted on 2003-04-29 18:44:54 by V Coder

Hey Randy,

I'm using HLA 1.46 right now, but it does not encode all MMX instructions. in particular I have a problem with movd. I know you said you were working on SSE/SSE2, but isn't MMX support finished yet?

I have to use



#asm
movd eax, mm1
#endasm


instead of



movd (mm1, eax);


Well, if it's not working, then that's just an oversight.
I'll check the grammar out tomorrow.
It's quite possible that this got broken when putting in SSE
because the new grammar for SSE superceded some of the
older code.

btw, while on the subject, does anyone know what the syntax
is for the SSE variants of the CMPSD and MOVSD instructions are?
Intel really screwed up by overloading these mnemonics, IMHO.
I've yet to get MASM to assemble these, so obviously HLA doesn't
support them yet.
Cheers,
Randy Hyde
Posted on 2003-04-29 21:28:37 by rhyde



Well, if it's not working, then that's just an oversight.
I'll check the grammar out tomorrow.
It's quite possible that this got broken when putting in SSE
because the new grammar for SSE superceded some of the
older code.

btw, while on the subject, does anyone know what the syntax
is for the SSE variants of the CMPSD and MOVSD instructions are?
Intel really screwed up by overloading these mnemonics, IMHO.
I've yet to get MASM to assemble these, so obviously HLA doesn't
support them yet.
Cheers,
Randy Hyde


Actually, it has not been working quite a while... I was doing that since 1.41.

The AoA_HLA manual Volume 4, Chapter 11 (The MMX Instruction Set) 11.71 (MMX Data Transfer Instructions) shows the following forms of the movd instruction

movd (reg32, mmi)
movd (mem32, mmi)
movd (mmi, reg32)
movd (mmi, mem32)

However The Quick Guide to HLA, 5.30 (MMX Instructions), page 32 shows only

movd (mem32, mmi * mmxReg)
movd (mmi, mem32)

The form I cannot use is move to and from 32 bit registers.

Thanks .


Hmmm...

While you're there, please check the stdout routines. Do they affect ES or DS? I believe they produce a random error accessing memory in my code ... new thread...
Posted on 2003-04-29 23:00:33 by V Coder



Actually, it has not been working quite a while... I was doing that since 1.41.

The AoA_HLA manual Volume 4, Chapter 11 (The MMX Instruction Set) 11.71 (MMX Data Transfer Instructions) shows the following forms of the movd instruction

movd (reg32, mmi)
movd (mem32, mmi)
movd (mmi, reg32)
movd (mmi, mem32)

However The Quick Guide to HLA, 5.30 (MMX Instructions), page 32 shows only

movd (mem32, mmi * mmxReg)
movd (mmi, mem32)

The form I cannot use is move to and from 32 bit registers.

Thanks .


Hmmm...

While you're there, please check the stdout routines. Do they affect ES or DS? I believe they produce a random error accessing memory in my code ... new thread...


You're right. The grammar was missing these statement entirely.
I've added the statements to HLA v1.48. Don't have an ETA for the 1.48 release, though.
Cheers,
Randy Hyde
Posted on 2003-05-02 23:18:17 by rhyde
I started looking at the stdout routines on Friday, but no evidence of problems there...

I thought the problem I'm having with my code was due to HLA... let me post it in a separate thread, and get some help.
Posted on 2003-05-04 01:14:51 by V Coder
Found slight typo Randy, in The Art of Assembly - HLA, Volume 4, Chapter 11, The MMX Instruction Set, page 1129.

"The PUNPCKHWD instruction unpacks and interleaves the low-order words of the source (first) and destination (second) instructions. It places the L.O. two words, &c"

Minor proofreading still to be done I suppose. Also, is that from the bottom of page 1126, the text for each instruction is on the page preceding the page with the associated Figure. Perhaps a hard page break before the text for the PUNPCKLWD instruction, and after each subsequent figure to keep text and figure together...
Posted on 2003-05-04 13:48:21 by V Coder
Well folks, I'm downloading HLA 1.48 as I type. Yes, it has not been announced here...

I did not download 1.47, but the new features are enough for me to move from 1.46. Thanks Randall.

I was thinking to announce it as a new thread, but I reconsidered - 'twould have been rather rude, n'est-ce pas?

I'll start getting rid of the #asm ... #endasm sections in mmx code now!
Posted on 2003-05-06 01:01:24 by V Coder

Well folks, I'm downloading HLA 1.48 as I type. Yes, it has not been announced here...

I did not download 1.47, but the new features are enough for me to move from 1.46. Thanks Randall.

I was thinking to announce it as a new thread, but I reconsidered - 'twould have been rather rude, n'est-ce pas?

I'll start getting rid of the #asm ... #endasm sections in mmx code now!


I made the announcement here just before reading this post :-)
Just been busy, is all...
Cheers,
Randy Hyde
Posted on 2003-05-06 22:42:33 by rhyde
Hi Randy,

Code of dll module of Icz tutorial #26 crashes compiler.

Err message:

hlaparse.exe has generated errors and will be closed by Windows.
You will need to restart the program.

It couses error with HLA v1.47/1.48
I work under Windows 2000 Pro SP3.



unit SplashDLL;

#include("w.hhf")


procedure DLLEntry(hInst:dword; reason:dword; reserved:dword); @stdcall;external("_DLLEntry@12");
procedure ShowBitmap;external;
procedure WndProc(hWnd:dword; uMsg:dword; wParam:dword; lParam:dword);@stdcall;external;


static
hInstance : dword;
hBitMap : dword := 0;
TimerID : dword := 0;
ClassName : string := "SplashWndClass";
BitmapName : string := "MySplashBMP";

procedure WndProc(hWnd:dword; uMsg:dword; wParam:dword; lParam:dword);

[color=red]val[/color]
[color=blue]//If *static* used it doesn't raise an error[/color]
hdc : dword;
ps : w.PAINTSTRUCT;
hMemoryDC : dword;
hOldBmp : dword;
bitmap : w.BITMAP;
DlgHeight : dword;
DlgWidth : dword;
DlgRect : w.RECT;
DesktopRect : w.RECT;

buffer2 : byte[128];
template : string := "%ld";

begin WndProc;

....


Regards
GJ
Posted on 2003-05-09 07:00:23 by Green Joe
So, Randy, how do we do HeapAlloc? or VirtualLock in HLA?

Is there any example of Win32 APIs being used independently of the HLA stdlib functions?
Posted on 2003-05-11 19:36:01 by V Coder

So, Randy, how do we do HeapAlloc? or VirtualLock in HLA?

Is there any example of Win32 APIs being used independently of the HLA stdlib functions?


The Examples download on Webster contains lots of Win32 API function calls
*in addition* to various Stdlib calls. I believe the latest version of HLA (v1.48)
contains a "WPA" (Windows Programming in Assembly" folder that contains
several sample Win32 programs I'm putting into my next e-text. Although these
programs continue to use various HLA standard library calls (e.g., string processing),
they do demonstrate the Win32 API.

Of course, all the Iczelion tutorials that have been converted to HLA generally use only
the Win32 API functions, as a general rule they do not use the HLA Standard Library
function set.

The HLA Documentation downloads also include Win32 API documentation for
kernel32 calls, user32 calls, and gdi32 calls (using HLA syntax). You'll want to
take a look at these.
Cheers,
Randy Hyde
Posted on 2003-05-11 20:43:46 by rhyde