Re: HLA and embedded controllers
- From: "vid512@xxxxxxxxx" <vid512@xxxxxxxxx>
- Date: 31 Oct 2006 03:30:04 -0800
this is gonna be long one...
Not really. I can't imagine any FASM programmer not grabbing and usingsure, competition is always good, we can "steal" ideas from ourselves
both sets of library code, if they're interested in library code.
;)
for example maybe you could steal my CF/EAX-based error
returning/throwing/catching
Indeed, if you're interested, I'll be more than happy to work with youi often could take some inspiration. for example, do you have text
and supply you with code to use as I clean up the HLA stdlib.
input system? i would be really interested in it. I mean routines like
"read decimal number from console" or "read 8-byte string from file"
etc.
If you're pretty good with FASM macros, I could even use a little help gettingyou can post any question about macrosolutions on the board, i
the FASM include files up and operational for FASM.
preferably answer there, so other can see it.
and yes, i am of those better FASM macrowriters ;)
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.htmlyou are forgetting ambigous syntax, and that new MASM requires .NET
framework (~20MB) to run, and that MASM code can't be compiled with
MASM for anything else than win32 (no COFF / ELF), etc. etc.
really, MASM is just the most often used. not bad, but far from best in
any other area.
from your examples to use MASM, only "Most Windows' assembly language
examples on the Internet today use MASM syntax" counts, others are
"off"
to HLA4MASM: looks like it works. too bad you don't have prebuilt
executable there. But, i am against such usage, because you are in fact
redefining MASM language with these macros. in MASM "language" calling
procedure is "call gets", not "gets". you are pushing MASM outside it's
bounds, into something unnatural. MASM is not designed for that.
in FASM there are macros, which allow you to do:
MessageBox(0, "Caption", GetText(GetText()), MB_OK)
but i am against using them too. There is no reason to code assembly
then. I have myself several ideas about implementing OO language in
assembly via macros in MUCH more efficient way than C++. But if i would
do that, it will be just "look how it could have been done without
backward C compatibility ". Nothing to use.
i wonder how will pure assembly (no macros) example, with HLA exception
handling look like. after that, i can judhe.
http://webster.cs.ucr.edu/AsmTools/FASM/index.htmlFASM is "reasonably capable" while MASM is "very powerful" and TASM is
"even more powerful"?!? what useful can MASM do (besides symbolic info
support and inline macros...), that FASM can't? i can give tons of
counter examples.
These examples are far from perfect; but they do demonstrate that it'ssure, question if these "code sequences that HLA emits" are reasonably
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.
simple for handwritten code
OTOH, I feel that a *decent* implementation of the HLA stdlib for otherthis is no problem in FASM
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, inwell, this is your decision. I believe that ASM library should be
providing decent macros for data structures and all the functions to
give them a consistent (as possible) calling sequence.
neatly usable
from pure asm code. Otherwise, it can't become "real" ASM library
To use exception handling requires linking in (and calling from the*static* data structure? is it thread-safe?
main program) one small routine and a small data structure.
so, then, please show me example how try/throw/except pure asm codedo you want to have it usable for pure-asm coders? (these were some ofOf course it's usable by people who want to write bare machine
main questions i was solving when designing FASMLIB)
instructions. But my goal is to supply macros to make the calls a
little more palatable.
looks like...
Agreed. That's why I laugh when people start talking about how "HLA issure, that doesn't imply HLA is HLL.
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.
My opinion is that HLA is neither assembler nor HLL. It just doesn't
fit into any usual category. I personally dislike the idea of putting
abstraction into assembly code. That abstraction is only speed/size
disadvantage C has over ASM. And you got ASM rid of this, so you often
end up with using ASM where HLL would do better, and using HLL where
ASM would do better.
It is usable by other assemblers. The biggest problem I can see tosure it can't, and shouldn't, FASM is assembler, even lower level
porting it to FASM is using the HLA stdlib's 'put' macros since FASM
lacks type-casting. So you can't do something like
stdout.put uns32Var, nl, stringPtr, csetVar, int32Var
assembler, eg. symbolic notation of processor instructions. Processor
doesn't differentiate types, only sizes (like FASM). How do you know if
"db 0" is empty string, or byte variable?
And have the macro sort out the correct routines to call. If there isyou can get size assigned to symbol with various tricks, but i think
a way to write a macro like that in FASM, I would sure like to know
about it :)
"clean" solution will be to create macros to define each data type.
Then
it is easy to check type.
.
- Follow-Ups:
- 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
- Re: HLA and embedded controllers
- From: randyhyde@xxxxxxxxxxxxx
- HLA and embedded controllers
- Prev by Date: Re: Improving one's algorithm
- Next by Date: Re: HLA and embedded controllers
- Previous by thread: Re: HLA and embedded controllers
- Next by thread: Re: HLA and embedded controllers
- Index(es):
Relevant Pages
|