flat assembler
Message board for the users of flat assembler.

Index > High Level Languages > HLA Standard Library v2.3

Author
Thread Post new topic Reply to topic
Evenbit



Joined: 02 Nov 2005
Posts: 7
Evenbit
http://sourceforge.net/project/showfiles.php?group_id=165727

Version 2.3 of the StdLib is now on SourceForge.

- Improvements: Linux support is now more complete.
- Includes: Automated Test Suite

The intention of this project is to support users of Randall Hyde's HLA (High Level Assembly) language who wish to maintain, extend, or evolve the HLA Standard Library. http://webster.cs.ucr.edu/AsmTools/HLA/index.html

http://webster.cs.ucr.edu/AsmTools/HLA/stdlib2/index.html

Nathan.
Post 02 Oct 2007, 19:54
View user's profile Send private message Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid
can you provide example of usage in FASM? Or at least some .lib version, so i can try it? I am not accustomed with compiling HLA code.
Post 02 Oct 2007, 20:07
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
rhyde



Joined: 03 May 2007
Posts: 21
rhyde
vid wrote:
can you provide example of usage in FASM? Or at least some .lib version, so i can try it? I am not accustomed with compiling HLA code.


Well, the easiest way to see how to call the libraries from FASM is to compile an HLA program and tell it to produce FASM output code. If you have a program xyz.hla, the way to do this is
Code:
hla -sf xyz
    


As for the longer term issue of calling HLA stdlib code from FASM, yes, there are plans to provide MASM, NASM, and FASM header files that allow this sort of stuff. But first, I've got to finish documenting all the code.

BTW, if you look here:
http://webster.cs.ucr.edu/AsmTools/MASM/HLA4MASM.html
You'll see a very old attempt I made at calling stdlib functions from MASM. Nathan, I believe it was, converted some of this code to FASM. These attempts do *not* apply directly to stdlib v2.3, but they should give you a start on how it's done.

BTW, if you're still interested, here's the MASM macro that (sort of) handles the HLA TRY..ENDTRY statement:
Code:
__tryCntr__         =               0
__exCntr__         =               0
__exLabel__                textequ <>

try                             macro
%                              ifnb    <__exLabel__>
                         .err    <Cannot      statically nest TRY/ENDTRY statements>
                           exitm
                               endif
__exLabel__            CatStr  <__exception>,%__exCntr__
__endExLabel__       CatStr  <__endExcept>,%__tryCntr__
__unprotected__     =               0

                               push    offset32 __exLabel__
                                push    ebp
                         mov             ebp, [ExceptionPtr__hla_]
                           push    dword ptr [ebp+8]
                           mov             ebp, [esp+4]
                                push    offset32 HWexcept__hla_
                             push    dword ptr [ExceptionPtr__hla_]
                              mov             dword ptr [ExceptionPtr__hla_], esp                     
                            endm

exception           macro   exNum
%                              ifb             <__exLabel__>
                         .err    <EXCEPTION outside TRY..ENDTRY block>
                         exitm
                               endif
                               if              __unprotected__ eq 0
                                mov             esp, dword ptr [ExceptionPtr__hla_]
                         pop             dword ptr [ExceptionPtr__hla_]
                              add             esp, 8
                              pop             ebp
                         add             esp, 4
                              endif
                               jmp             __endExLabel__
__exLabel__:
__exCntr__                =               __exCntr__+1
__exLabel__             CatStr  <__exception>,%__exCntr__
__unprotected__      =               1
                           cmp             eax, exNum
                          jne             __exLabel__
                         endm

unprotected         macro
%                              ifb             <__exLabel__>
                         .err    <UNPROTECTED outside TRY..ENDTRY block>
                               exitm
                               endif
__unprotected__        =               1
                           mov             esp, dword ptr [ExceptionPtr__hla_]
                         pop             dword ptr [ExceptionPtr__hla_]
                              add             esp, 8
                              pop             ebp
                         add             esp, 4
                              endm

anyexception        macro
%                              ifb             <__exLabel__>
                         .err    <ANYEXCEPTION outside TRY..ENDTRY block>
                              exitm
                               endif
                               if              __unprotected__ eq 0
                                mov             esp, dword ptr [ExceptionPtr__hla_]
                         pop             dword ptr [ExceptionPtr__hla_]
                              add             esp, 8
                              pop             ebp
                         add             esp, 4
                              endif
                               jmp             __endExLabel__
__exLabel__:
__exCntr__                =               __exCntr__+1
__exLabel__             CatStr  <__exception>,%__exCntr__
__unprotected__      =               1
                           endm

endtry                      macro
%                              ifb             <__exLabel__>
                         .err    <ENDTRY      w/o     corresponding TRY statement>
                             exitm
                               endif
                               if              __unprotected__ eq 0
                                .err    <TRY..ENDTRY w/o an  exception handler>
                               endif
__exLabel__:
__endExLabel__:
__exCntr__          =               __exCntr__+1
__tryCntr__             =               __tryCntr__+1
__exLabel__            textequ <>
__endExLabel__      textequ <>
                            endm
    


A *far better* one could be written in FASM (that allows static nesting), indeed a far better one could be written in MASM, but this macro, at least, shows you the code you need to generate for try..exception..anyexception..endtry.
hLater,
Randy Hyde
Post 04 Oct 2007, 21:03
View user's profile Send private message Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid
okay, i got the idea now. can you also provide .LIB (or at least .OBJ) version of your library, so i can try it?

By the way, i've read that you plan to implement multithread support. That means you will have to convert these to procedure calls anyway... Why don't you do it that way right now?
Post 04 Oct 2007, 22:13
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
Evenbit



Joined: 02 Nov 2005
Posts: 7
Evenbit
rhyde wrote:

BTW, if you look here:
http://webster.cs.ucr.edu/AsmTools/MASM/HLA4MASM.html
You'll see a very old attempt I made at calling stdlib functions from MASM. Nathan, I believe it was, converted some of this code to FASM.


Just for the record, this was not me. I am of the impression that such work was attempted prior to my awareness of the existence of HLA. A targeted search of the available newsgroups and forums might reveal to person's identity. { unless Hutch's "delete happy" fingers have already destroyed such information Wink }

Nathan.
Post 06 Oct 2007, 20:15
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2020, Tomasz Grysztar. Also on YouTube, Twitter.

Website powered by rwasa.