flat assembler
Message board for the users of flat assembler.

Index > Projects and Ideas > Tiny 8086 assemblers?

Author
Thread Post new topic Reply to topic
bitshifter



Joined: 04 Dec 2007
Posts: 796
Location: Massachusetts, USA
bitshifter 19 Jun 2011, 09:47
I am designing my own 8086 assembler for my hobby-os.
First i thought to search the web for any hits (google)
I was surprised to only find one single < 8k assembler.
(Which runs under DOS and is written in its own language)
I thought there would be many, but only one?
Maybe the complex instruction encoding scares most people away?
Anyway, here is the one i found...
http://code.google.com/p/x86-s/
I think its pretty cool, minus a few small bugs and syntax weirdness.
So, do you know of any self-assembling assemblers in < 8k ?
If so, i would like to study them.
Writing an assembler is a lot of work and i could save a lot of time
if i could find something usable and tweak it a bit, rather than from scratch.

_________________
Coding a 3D game engine with fasm is like trying to eat an elephant,
you just have to keep focused and take it one 'byte' at a time.
Post 19 Jun 2011, 09:47
View user's profile Send private message Reply with quote
Picnic



Joined: 05 May 2007
Posts: 1398
Location: Piraeus, Greece
Picnic 19 Jun 2011, 10:08
I do not know if they meet the conditions you require, however you will find a list of sources here
Maybe you'll find something useful.
Post 19 Jun 2011, 10:08
View user's profile Send private message Visit poster's website Reply with quote
JoeCoder1



Joined: 13 Jun 2011
Posts: 62
JoeCoder1 19 Jun 2011, 12:49
There is always tiny assembler which was part of the tiny c project in the 1970s. I don't know the home page but you can search online "tiny assembler"
Post 19 Jun 2011, 12:49
View user's profile Send private message Reply with quote
Teehee



Joined: 05 Aug 2009
Posts: 570
Location: Brazil
Teehee 19 Jun 2011, 13:01
i liked the comment style Smile
Post 19 Jun 2011, 13:01
View user's profile Send private message Reply with quote
typedef



Joined: 25 Jul 2010
Posts: 2909
Location: 0x77760000
typedef 19 Jun 2011, 15:26
Here's what I found so far|

http://code.google.com/p/pe-asm/

http://code.google.com/p/comasm/ ---> You should definitely check this one out.
Post 19 Jun 2011, 15:26
View user's profile Send private message Reply with quote
bitshifter



Joined: 04 Dec 2007
Posts: 796
Location: Massachusetts, USA
bitshifter 20 Jun 2011, 08:19
Hmm, this page says there are no downloads available?
http://code.google.com/p/comasm/
It also says my browser is out of date.
Maybe you could leave link to download file?
Post 20 Jun 2011, 08:19
View user's profile Send private message Reply with quote
typedef



Joined: 25 Jul 2010
Posts: 2909
Location: 0x77760000
typedef 20 Jun 2011, 12:11
Yeah I'm sorry about that. It seems like theere has not been any submitted project files. Sorry


Last edited by typedef on 18 Aug 2011, 14:25; edited 1 time in total
Post 20 Jun 2011, 12:11
View user's profile Send private message Reply with quote
bitshifter



Joined: 04 Dec 2007
Posts: 796
Location: Massachusetts, USA
bitshifter 21 Jun 2011, 13:28
I found one more, although written in C, and somewhat larger in exe.
This one is table driven, MASM syntax, with fewer bugs.
http://www.bbs.motion-bg.com/index.php?file=343
See: GASMSRC\GASM.C (2000+ lines of core, all in one file)
I was planning to prototype my assembler in C anyway.
And MASM syntax is way nicer than AS syntax.
Then once its good and tight i can write it in asm!
Post 21 Jun 2011, 13:28
View user's profile Send private message Reply with quote
Artlav



Joined: 23 Dec 2004
Posts: 188
Location: Moscow, Russia
Artlav 22 Jun 2011, 15:57
bitshifter wrote:
Maybe the complex instruction encoding scares most people away?
You bet.
I'm making an assembler with multiple targets about now, and here are some stats:
-Supporting code: 1100 LOC
-Code generator for ZPU microcontroller: 200 LOC (and complete)
-Code generator for a memory-based VM: 250 LOC (and also complete)
-Code generator for x86-32: 1250 LOC (and still barely scratches the surface)

To make one you need to carefully study the instruction set, which have a few patterns, and design from ground up with ALL the cases in mind. Then you'll get a fully functional assembler when everything will be done. Many asm-for-fun projects simply run out of steam on first encounter with mov al, [ds:si+bx] or something.
Post 22 Jun 2011, 15:57
View user's profile Send private message Visit poster's website Reply with quote
Picnic



Joined: 05 May 2007
Posts: 1398
Location: Piraeus, Greece
Picnic 18 Aug 2011, 13:00
MSA a simple DOS assembler with a NASM-like syntax in about 1500 lines of C.
At first glance seems to runs fine under xp, i used old Turbo C++ 3.0 to compile sources.

MSA
Post 18 Aug 2011, 13:00
View user's profile Send private message Visit poster's website Reply with quote
me239



Joined: 06 Jan 2011
Posts: 200
me239 19 Aug 2011, 02:26
A86
Post 19 Aug 2011, 02:26
View user's profile Send private message Reply with quote
Madis731



Joined: 25 Sep 2003
Posts: 2139
Location: Estonia
Madis731 19 Aug 2011, 06:34
It depends: 1250 LOC C or 1250 LOC ASM? Smile
Post 19 Aug 2011, 06:34
View user's profile Send private message Visit poster's website Yahoo Messenger MSN Messenger Reply with quote
bitshifter



Joined: 04 Dec 2007
Posts: 796
Location: Massachusetts, USA
bitshifter 20 Aug 2011, 01:48
Picnic wrote:
MSA a simple DOS assembler with a NASM-like syntax in about 1500 lines of C.
At first glance seems to runs fine under xp, i used old Turbo C++ 3.0 to compile sources.
MSA

Very cool, i will study these sources now.
And i have Turbo C 2.0 also on my dev box.
Aaah, the good old days, where makefiles ruled.

_________________
Coding a 3D game engine with fasm is like trying to eat an elephant,
you just have to keep focused and take it one 'byte' at a time.
Post 20 Aug 2011, 01:48
View user's profile Send private message Reply with quote
Picnic



Joined: 05 May 2007
Posts: 1398
Location: Piraeus, Greece
Picnic 10 Dec 2011, 14:03
8086 Assembler Implemented in C++. Single source file.
Post 10 Dec 2011, 14:03
View user's profile Send private message Visit poster's website Reply with quote
Hugh Aguilar



Joined: 15 Nov 2011
Posts: 62
Location: Arizona
Hugh Aguilar 12 Jan 2012, 01:50
bitshifter wrote:
I am designing my own 8086 assembler for my hobby-os.
First i thought to search the web for any hits (google)
I was surprised to only find one single < 8k assembler.
(Which runs under DOS and is written in its own language)
I thought there would be many, but only one?
Maybe the complex instruction encoding scares most people away?
Anyway, here is the one i found...
http://code.google.com/p/x86-s/
I think its pretty cool, minus a few small bugs and syntax weirdness.
So, do you know of any self-assembling assemblers in < 8k ?
If so, i would like to study them.
Writing an assembler is a lot of work and i could save a lot of time
if i could find something usable and tweak it a bit, rather than from scratch.


There are a lot of assemblers written in Forth for various processors, and they tend to be very small because they use Forth's interpreter rather than do their own parsing. As Chuck Moore famously said: "Let the dictionary do the deciding."

You could start with LMI UR/Forth, which is available in both 16-bit and 32-bit. It used to be a commercial product. Now it is shareware, although Laboratory Microsystems Inc. is out of business afaik. A lot of it is open-source, including the assembler.

The company where I used to work had the complete source for UR/Forth, but I never saw it because I hadn't signed the non-disclosure form. There are other Forths available for the 16-bit x86 that are fully open-source that you might be able to port over to your OS.

Why do you want an assembler that runs under your OS? What advantage would that have over using FASM to cross-assemble? On the other hand, getting a Forth to run under your OS would make sense, as you would get the Forth interactive development environment.

Why are you targeting the 16-bit x86? Did you buy a computer at the Salvation Army for $5 and decided to write an OS for it? Smile
Post 12 Jan 2012, 01:50
View user's profile Send private message Send e-mail Reply with quote
Picnic



Joined: 05 May 2007
Posts: 1398
Location: Piraeus, Greece
Picnic 08 Aug 2012, 09:14
Here's another small 8086 Assembler which i discovered by chance, written in C by Dave Dunfield, about 1400 lines.

MICRO 8086 ASSEMBLER
Post 08 Aug 2012, 09:14
View user's profile Send private message Visit poster's website Reply with quote
ASM-Man



Joined: 11 Jan 2013
Posts: 64
ASM-Man 18 Jan 2013, 03:47
There is too the as86(can run even on Linux) and M80(by Microsoft) . But both (until I know) it is'nt free. Some older OS such as CP/M provide an assembler for 8086. Also,I'm not sure,but I think that the BCC(Bruce's C Compiler) can act as an assembler too.
Post 18 Jan 2013, 03:47
View user's profile Send private message Reply with quote
JohnFound



Joined: 16 Jun 2003
Posts: 3499
Location: Bulgaria
JohnFound 18 Jan 2013, 05:30
bitshifter, IMHO, if you want to write OS, you must concentrate on the OS, not on the assembler. You can simply port FASM for your OS and to have very powerful assembler with only 2..3 days coding. Then you will be free to create your fine OS and you will have decent assembler from the day one.
Post 18 Jan 2013, 05:30
View user's profile Send private message Visit poster's website ICQ Number Reply with quote
sid123



Joined: 30 Jul 2013
Posts: 339
Location: Asia, Singapore
sid123 17 Nov 2013, 06:38
http://posx86.codeplex.com/SourceControl/latest#programs/pasm.asm
Checkout PASM. Its for my OS.
16 bit 8086 Assembler for Posx86

_________________
"Those who can make you believe in absurdities can make you commit atrocities" -- Voltaire https://github.com/Benderx2/R3X
XD
Post 17 Nov 2013, 06:38
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-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.