Re: HLA and embedded controllers
- From: "randyhyde@xxxxxxxxxxxxx" <randyhyde@xxxxxxxxxxxxx>
- Date: 30 Oct 2006 18:11:39 -0800
( I thought I'd responded to this, but it didn't seem to appear; so
excuse this post if it winds up replicating another one I made).
vid512@xxxxxxxxx wrote:
Actually, I am doing that right now. The HLA stdlib v2.x will probablywow, i've got competition ;)
start appearing within a month or so. There are a couple of reasons
I'm rewriting the library (though this has nothihng to do with
supporting microcontrollers); in order of priority:
Not really. I can't imagine any FASM programmer not grabbing and using
both sets of library code, if they're interested in library code.
Indeed, if you're interested, I'll be more than happy to work with you
and supply you with code to use as I clean up the HLA stdlib. If you're
pretty good with FASM macros, I could even use a little help getting
the FASM include files up and operational for FASM.
i am writing FASMLIB, std library for FASM, and want to make it
seriously. Yours library is only one looking like real std library i've
seen yet. unfortunately it is limited to HLA-only by design, thus
unusable for ASM programmers.
It certainly is *not* limited to HLA, only. While there are a couple of
routines that don't make sense outside the context of HLA, most of the
routines are relatively generic. You push the parameters on the stack
(or in registers), you call the routine, the results come back in
appropriate places. Indeed, as a sort of "proof of concept" I'd
written a header file for MASM to demonstrate calling HLA stdlib
routines,
http://webster.cs.ucr.edu/AsmTools/MASM/index.html
and someone else (Nathan?) did a FASM proof-of-concept:
http://webster.cs.ucr.edu/AsmTools/FASM/index.html
And Frank played around with some NASM stuff.
These examples are far from perfect; but they do demonstrate that it's
pretty easy to call HLA stdlib routines from different assemblers. Of
course, it should be pretty obvious that most of the HLA stdlib
routines can be called from MASM, TASM, FASM, and Gas because HLA emits
source code for these different assemblers. Obviously, you can call the
stdlib routines using the same code sequences that HLA emits.
OTOH, I feel that a *decent* implementation of the HLA stdlib for other
assemblers will define a set of macros that make it easy to call the
stdlib routines, in a more "HLA style". For example, under FASM you
should be able to write:
stdout.puts someStrVar
and it would automatically emit the code
push someStrVar
call stdout_puts
That's where the real work for ports to other assemblers will be, in
providing decent macros for data structures and all the functions to
give them a consistent (as possible) calling sequence.
1) Separating out the OS-dependent functions to make it easier to portyou should have at the beginning
the library to another OS.
Sure.
Originally, HLA was designed for Win32 and I had no intention of
porting it to other OSes. At one point or another, enough people asked
for a Linux version that I figured I do a port to Linux when HLA v2.0
came out. Alas, HLA v2.0's development kept getting put off, so I
kludged together a port to Linux. As I continued work on HLA v2.0, I
realized that it made sense to do the port (of HLA v2.0) to Win32,
Linux, FreeBSD, and MacOS all at once (from the beginning) rather than
trying to port them later. Therefore, I needed to port HLA v1.x (which
HLA v2.0 is being written in) to FreeBSD and MacOS. That means porting
the HLA stdlib to these OSes. Rather than continuing the mistake of
kludging the library code, I decided to go in and refactor all the
code. Yep, hindsight is 20/20. Should have done it that way in the
first place. But better now rather than later. :-)
3) Make the library available to other assembler users, not just HLA.how? as COFF?
COFF and ELF. I guess I could do OMF for TASM, but I doubt there's
much call for that today.
how does your throwing mechanism work in lowlevel?
Actually, the HLA 'raise' statement is just two instructions: load EAX
with a value and jump to a global symbol ("_raise", as it turns out). A
simple macro handles this nicely. The try..except..endtry sequence is
a bit more work, but it's certainly possible to encode this statement
sequence using MASM, TASM, FASM, and NASM macro facilities. Other
assemblers (that I'm aware of), probably not.
To use exception handling requires linking in (and calling from the
main program) one small routine and a small data structure.
do you want to have it usable for pure-asm coders? (these were some of
main questions i was solving when designing FASMLIB)
Of course it's usable by people who want to write bare machine
instructions. But my goal is to supply macros to make the calls a
little more palatable.
Do keep in mind, however, that I do not consider the HLA standard librarynice step imho
to be part of the HLA language.
Agreed. That's why I laugh when people start talking about how "HLA is
just a high-level language" and the "proof" of this they give is
stdout.put( "Hello world" nl );
The stdout.put macro invocation isn't a part of the HLA language at
all.
Cheers,
Randy Hyde
.
- Follow-Ups:
- Re: HLA and embedded controllers
- From: vid512@xxxxxxxxx
- Re: HLA and embedded controllers
- From: Betov
- Re: HLA and embedded controllers
- References:
- HLA and embedded controllers
- From: johnzulu
- Re: HLA and embedded controllers
- From: randyhyde@xxxxxxxxxxxxx
- Re: HLA and embedded controllers
- From: vid512@xxxxxxxxx
- Re: HLA and embedded controllers
- From: randyhyde@xxxxxxxxxxxxx
- Re: HLA and embedded controllers
- From: vid512@xxxxxxxxx
- HLA and embedded controllers
- Prev by Date: Re: HLA is for advanced assembly programmers
- Next by Date: Re: A modern view of the halting problem
- Previous by thread: Re: HLA and embedded controllers
- Next by thread: Re: HLA and embedded controllers
- Index(es):
Relevant Pages
|