
Show HN: 8086/8088 assembler that runs over 8088 hardware with modern syntax - nanochess
https://github.com/nanochess/tinyasm/
======
dwrodri
For those who are unfamiliar, Óscar Toledo G. (and his family) are all world-
class hackers (and teachers) when it comes to low-level computing[1]. I
learned about his family's work (as well as his own) on this website[2].

1 =
[http://www.biyubi.com/tecnologia.html#resumen](http://www.biyubi.com/tecnologia.html#resumen)

2 =
[https://news.ycombinator.com/item?id=20570154](https://news.ycombinator.com/item?id=20570154)

------
userbinator
I'm a little surprised that it wasn't itself written in Asm (and thus has the
possibility to be self-assembling), and the binary is almost 30KB. That may
seem tiny today, but in the 8086/8088 era, it's huge; the first IBM PC in its
minimum configuration had only 16K RAM.

For a more "authentic" 8088 experience, you could use the assembler that came
with MS-DOS 1.25, written by Tim Paterson:

[https://github.com/microsoft/MS-
DOS/blob/master/v1.25/source...](https://github.com/microsoft/MS-
DOS/blob/master/v1.25/source/ASM.ASM)

~~~
cameldrv
That's true but nobody bought a PC with 16K of RAM. The smallest I ever saw on
a PC was 256k, and I think I might have encountered a near-clone with 128k.

~~~
Narishma
64K was a pretty common configuration in the first couple of years.

------
convivialdingo
Very, very cool! I love the fact that you used an 8086 C compiler to make the
whole toolchain work.

~~~
WalterBright
Digital Mars C and C++ compilers still support 16 bit 8086 code generation and
are free:

[https://www.digitalmars.com/download/freecompiler.html](https://www.digitalmars.com/download/freecompiler.html)

Source code to the compiler/libraries is also free:

[https://github.com/DigitalMars/dmc](https://github.com/DigitalMars/dmc)

[https://github.com/DigitalMars/Compiler](https://github.com/DigitalMars/Compiler)

~~~
zokier
There is also GCC 6.2/6.3 for IA16 targets:

[https://blogs.mentor.com/embedded/blog/2017/04/01/announcing...](https://blogs.mentor.com/embedded/blog/2017/04/01/announcing-
sourcery-codebench-lite-for-ia16/)

[https://github.com/tkchia/build-ia16](https://github.com/tkchia/build-ia16)

[https://slideslive.com/38902413/gcc-
ia16-backend](https://slideslive.com/38902413/gcc-ia16-backend)

~~~
pan69
> The toolchain can be used on either a GNU/Linux® or Microsoft® Windows®
> host.

Bingo. I love programming for early DOS systems (86, 286, 386) but it's
difficult to find a tool-chain that runs on Linux and is able to produce DOS
compatible binaries. I think OpenWatcom might but I could not get it to work
correctly.

Definitely going to give this a try.

~~~
h2odragon
If you have not yet done so, may I suggest you investigate 'Dessqview/X'.
Lovely stunts there.

------
acqq
"The compiler has many bugs and limitations, but it works for tinyasm
purposes, and it's freely available. Supposedly it should support ANSI C, but
I couldn't fit a standard ANSI C function definition"

I've tried

    
    
       25.07.1988  15:39            54,272 C88.EXE
    

from c88v31_1.zip (disk 1 on
[http://www.desmet-c.com/ver_31h.shtml](http://www.desmet-c.com/ver_31h.shtml)
) with

    
    
        int f( int x, int y ) { return x * y; }
        int main( void ) {  return f( 3, 4 ); }
    

and it didn't complain? What's then that that didn't work?

(Also, I used Borland's C compiler for these platforms, and there is an
official version now available for free, but it's a little annoying to
download).

~~~
nanochess
Just try changing the first function definition in my source for tinyasm code
to "struct label _define_label(char_ name, int value)" and it will complain of
error. Same with all my functions. I didn't had time for further dive looking
for the error cause, so I just resorted to K&R.

~~~
acqq
I haven't tried to use the whole setup (with all headers etc) but if I put in
my .c file the definition of struct and the ANSI C version of the definition
of define_label,

    
    
       struct label *define_label(char* name, int value)
       {  ..
    

then C88 compiles without errors. On the page about the compiler the author of
the page writes that he had to fix the standard libraries, but the compiler
(C88) is definitely made to work with ANSI C "draft" which matches my
experiment.

And I surely understand it was "good enough" a solution for you to do what you
did.

------
qx89l4
Awesome project, congrats!

