Message board for the users of flat assembler.
> High Level Languages > About This Section
This section is dedicated to mixing assembly with high level languages (HLL), or about discussing behavior of code produced by HLLs.
Interesting things on this topic:
- mixing C and ASM - via MS COFF objects
- using LIBC in ASM - portable asm coding with standard C library
- using Java in ASM
- using ASM in .NET
- using ASM in D - via DLL
- using ASM in Python - via DLL
- using ASM in Win64 drivers - with MSVC, also covers SAFESEH
- using MySQL
- integrating FASM to Visual Studio 2005
Compilers using FASM:
- HLA - Randal Hyde's "High Level Assembly", uses FASM as backend
- RetroForth - Forth implementation in FASM
- B0 - uses FASM as backend
Discussing other languages:
NOTE: Please post links to interesting threads, external articles, and tools you think that should be here.
Last edited by vid on 17 Mar 2009, 23:53; edited 10 times in total
|15 Dec 2006, 16:03||
note for myself:
|31 Dec 2006, 09:10||
a interpreter of a forth-like language written in FASM
|23 Mar 2015, 16:10||
This section is dedicated to mixing assembly with high level languages (HLL)
I was invited to discuss our Plain English compiler (which mixes machine code with English) in a thread over in the Heap forum, here:
A couple of typical routines that mix the two appear below. First, a rather obvious example from our general purpose library:
To add a number to another number:
Intel $8B8508000000. \ mov eax,[ebp+8] \ the number
Intel $8B00. \ mov eax,[eax]
Intel $8B9D0C000000. \ mov ebx,[ebp+12] \ the other number
Intel $0103. \ add [ebx],eax
This routine can be called with statements like:
Add 1 to a count.
Add the running total to the grand total.
Add the offset to the base address.
Secondly, a routine from our compiler that generates the machine code for a routine's prolog:
To transmogrify a fragment (prolog):
Attach $55 to the fragment's code. \ push ebp
Attach $8BEC to the fragment's code. \ mov ebp,esp
Put the current routine's local size divided by 4 into a number.
If the number is not 0, attach $B9 and the number and $6A004975FB to the fragment's code. \ mov ecx,number; loop: push 0; dex ecx; jnz loop
If the current routine's callback flag is set, attach $535657 to the fragment's code. \ push ebx, esi, edi
The above routine is called in our compiler after all the relevant details have been collected from the source code and we're ready to generate executable code.
Relatively few of the 25,000 lines of our Plain English system are of this sort, since it really doesn't take that much machine code to construct a basis for higher-level programming -- so instead of implementing a built-in assembler we simply "assembled" the necessary instructions in our heads and typed them in as the hex literals you see above ("$" marks the start of a hex literal, and "\" marks the start of a comment).
The instructions for the system are available here:
And the whole shebang, include all the source code, is here:
If you're interested in further discussion, please respond in the aforementioned thread to keep the discussion in one place. Or write me directly (email@example.com). Thanks.
|11 Apr 2015, 06:38||
< Last Thread | Next Thread >
Copyright © 1999-2018, Tomasz Grysztar.
Powered by rwasa.