You are on page 1of 6

Contents last updated Jun 06/06 macros.hhf maclib.hhf extensions.hhf assign.hhf win32macs.hhf maclib.

hhf zstr push5 pop5 pushabi popabi RGB move enumX enumBT auxreg extern USE extensions.hhf testnz testz cmpe cmpne cmpa cmpna cmpae cmpnae cmpg cmpng cmpge cmpnge cmpl cmpnl cmple cmpnle cmpz cmpnz cmpb cmpnb cmpbe cmpnbe assign.hhf assign win32macs.hhf strToBA macros.hhf ---------------------------------------------------------------------------Include this file to include all the macro files at once.

---------------------------------------------------------------------------maclib.hhf ---------------------------------------------------------------------------#macro zstr ( _strData_ ); Creates a dword aligned, zero terminated string out of _strData_ These are not HLA strings. eg: static myZstr :zstr ("This is a zero terminated string"); compatibility: win32, linux ---------------------------------------------------------------------------#macro push5; #macro pop5; This pair of macros push and pop EDX, ECX, ESI, EDI and EBX. Useful for preserving general purpose registers except EAX (reserved for return values) without using pushad and popad. compatibility: win32, linux ---------------------------------------------------------------------------#macro pushabi; #macro popabi; This pair of macros push and pop EBX, ESI and EDI. Useful for quickly preserving the registers that Windows requires to be preserved. compatibility: win32, linux (though useful only in win32) ---------------------------------------------------------------------------#macro RGB ( _red_, _green_, _blue_ ); This creates a color constant that can be used with GUI related tasks (eg: brushes, pens, backgrounds, etc). eg: const RGB ( 100, 100, 100); // create a dark gray color compatibility: win32, linux ---------------------------------------------------------------------------#macro move (_source_, _dest_); pushes source, pops dest. Works like HLA special mov syntax, though the use of 'move' will distinguish it as something not directly supported by x/86.

eg: mov ( srcMem, dstMem); compatibility: win32, linux ---------------------------------------------------------------------------Enumeration macros: #macro enumX ( _startfrom, _enums_[] ); #macro enumBT ( _enums_[]); This pair of macros creates an enumeration list in an HLA const section. With enumX, you specify a starting value followed by a list of labels. With enumBT, a bit list is created, starting from bit #0. eg: const enumX ( 0, zero, one, two); creates: zero one two const enumBT ( bit0, bit1, bit2); creates: bit0 bit1 bit2 := @{0}; := @{1}; := @{2}; := 0; := 1; := 2;

compatibility: win32, linux ---------------------------------------------------------------------------#macro USE ( _reglist_[]); #terminator ENDUSE; pushes the registers specified in _reglist_. Pops them in reverse order after ENDUSE. eg: USE (EAX, EBX); ... other code ENDUSE; // eax, ebx preserved compatibility: win32, linux ---------------------------------------------------------------------------#macro auxreg This is a special label macro that creates an auxillary 'register' in memory (static or automatic). The label provided must be a single alphabetic letter that does not correspond to existing register names. a (eax), b (ebx), c (ecx), d (edx) are not allowed. Most other letters should be legal, if not an error will be displayed. These "registers" can be used almost like regular registers except for

limitations that come with instruction use on memory locations. eg: var g :auxreg; In the above, auxreg will create a memory "register" called "egx" This "register" may be accessed in various methods: egx gx eg gl gh 32 bit low order word high order word low order byte high order byte of low order word

Limitations: HLA's extended mov can take care of memory to memory moves between 2 auxregs. There is a limitation however as byte size memory moves are not allowed. eg: var g h ... mov mov mov mov (0, egx); (al, hl); (cx, eh); (ehx, egx); // copy // zero out egx // mov al into hl // mov cx into high order word of ehx ehx into egx :auxreg; :auxreg;

compatibility: win32, linux ---------------------------------------------------------------------------#macro extern ( _parms_[]); Use the extern macro to declare a series of @external labels in one place without having to specify each individual label as external. There are 2 different syntax. Normal lables follow the pattern <label>: <type>; Procedure labels are written as standard procedures with argument lists. Both formats have an optional "as" keyword that allows you to redefine the external label, similar to HLA's @external ("newname"); The extern macro is used in its own section. eg: extern ( flist :list;, entry :string; as ("_entrystr");, procedure someProc;, procedure myProc (var dst:dword); as ("myProc@4"); ); Labels defined as extern do not have actual storage. Each lable must have its corresponding lable in it's specific section. Note: using the extern macro in HIDE will confuse HIDE's label scanner. compatibility: win32, linux

----------------------------------------------------------------------------

extensions.hhf ---------------------------------------------------------------------------This header contains various helper instruction extensions with return values. Each of the following macros take two arguments, source and dest. Designed specifically to be used within other instructions and built-in HLA structures. macro testnz testz cmpe cmpne cmpa cmpna cmpae cmpnae cmpg cmpng cmpge cmpnge cmpl cmpnl cmple cmpnle cmpz cmpnz cmpb cmpnb cmpbe cmpnbe returns @nz @z @e @ne @a @na @ae @nae @g @ng @ge @nge @l @nl @le @nle @z @nz @b @nb @be @nbe

eg: IF ( testnz ( bit4_c, eax) ) THEN .. do something if above returns "@nz" ENDIF; assign.hhf ---------------------------------------------------------------------------Author: Bernd Kastenholz Email: Berndkastenholz@web.de #macro assign ( _input_[]); Definition: Combines blocks of mov() statements. Examples of usage: assign ( eax = 0 ) assign ( testvar = ecx = xor(eax, eax) returns eax, ebx = 33)

assign ( ecx

= 323, eax = 34, testvar = 77 )

Set up the window class (wc) object: assign( wc.cbSize = @size( w.WNDCLASSEX ), wc.style = w.CS_HREDRAW | w.CS_VREDRAW, wc.lpfnWndProc = &WndProc, wc.cbClsExtra = NULL, wc.cbWndExtra = NULL, wc.hbrBackground = w.COLOR_WINDOW+1, wc.lpszMenuName = ID_MAINMENU, wc.lpszClassName = ClassName, // Get this process' handle: hInstance = w.GetModuleHandle( NULL ), wc.hInstance = eax, wc.hIcon = w.LoadIcon( ID_ICONLOGO2, hInstance ), wc.hIconSm = w.LoadIcon(hInstance, val ID_ICONSM ALL ), wc.hCursor = w.LoadCursor( NULL, val w.IDC_ARROW ) ) compatibility: win32, linux ---------------------------------------------------------------------------win32macs.hhf ---------------------------------------------------------------------------#macro strToBA ( _theStr_, _bufSize_); Specifically designed to be used within a LOGFONT (though it may work for other arrays, not tested). Eg: font01 :w.LOGFONT :=w.LOGFONT :[-12,0,0,0,400,0,0,0,0,3,2,1,49, strToBA("Lucida Console",w.LF_FACESIZE)] ; The macro automatically fills in the string characters and zeros out the remaini ng elements of the array. compatibility: win32 ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

You might also like