flat assembler
Message board for the users of flat assembler.

Index > High Level Languages > About This Section

Author
Thread Post new topic Reply to topic
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid 15 Dec 2006, 16:03
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
- Context
- PureBASIC

Discussing other languages:
- D
- C--
- Forth


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
Post 15 Dec 2006, 16:03
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid 31 Dec 2006, 09:10
Post 31 Dec 2006, 09:10
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
xyh



Joined: 08 Apr 2014
Posts: 10
Location: China
xyh 23 Mar 2015, 16:10
Post 23 Mar 2015, 16:10
View user's profile Send private message Reply with quote
Gerry Rzeppa



Joined: 10 Apr 2015
Posts: 37
Location: Franklin, KY
Gerry Rzeppa 11 Apr 2015, 06:38
vid wrote:
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:

http://board.flatassembler.net/topic.php?t=18031

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:

www.osmosian.com/instructions.pdf

And the whole shebang, include all the source code, is here:

www.osmosian.com/cal-3040.zip

If you're interested in further discussion, please respond in the aforementioned thread to keep the discussion in one place. Or write me directly (gerry.rzeppa@pobox.com). Thanks.
Post 11 Apr 2015, 06:38
View user's profile Send private message Send e-mail Visit poster's website 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-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.