project...
MACC*

*MenuetOS ACC

Updated July 30, 2002

MenuetOS is a 32-bit preemptive multitasking multithreaded operating system for 386+ CPUs and IBM-compatible PC architecture, complete desktop GUI, TCP/IP networking, CDROM, keyboard, mouse, sound, video interfaces, realtime I/O, size only 61K bytes. International open source project. Complete with source fits on a floppy disk.
Introduction to MenuetOS

MenuetOS itself is written in assembly language and assembled with FASM or NASM. Applications may also be written in assembly language or a high-level language. The requirement is that the generated file be a flat 32-bit binary file with a small header.

MACC is a 32-bit small C compiler for DOS, originally developed by David Ashley and named ACC. David dropped the project in 1997, however he very kindly supplied me with the source code and I have fixed bugs and modified ACC to work with FASM, and adopted the new name of MACC.
Here is the file distributed by David: acc5.zip (172KB)

Please note that ACC/MACC is very basic and has some bugs. Currently there is no FPU support. It is not intended to compete with the heavyweight C compilers such as GCC and DJGPP -- these can also be used for MenuetOS applications. Having stated that however, ACC/MACC is quite remakable for it's size and is much better than some other tiny C compilers that I have evaluated.

You can very easily create applications for MenuetOS using MACC. The only executables you need are the compiler 'macc.exe' and the assembler 'fasm.exe'.
This file has these, plus our first example application: macc1.zip (87KB)

This is the first example application: macc1.c

The file 'macc1.zip' is all you need. Unzip it and do this from the DOS prompt:
C:> acc macc1
C:> fasm macc1.a macc1
That's it, you now have 'macc1' which you can copy to the MenuetOS floppy disk. Reboot with the floppy inserted, and when you have the MenuetOS desktop, choose
Start -> System -> Prompt
and at the Mash prompt type:
mash> MACC1

Differences between ACC and MACC

ACC version 5, the last that David distributed, generates assembly language output file, and required David's A86 assembler to generate the executable or object file. He also has a linker.

A major problem is that the syntax of A86 is not compatible with the two major open source assemblers, FASM and NASM. Also, A86 only supports the basic 386 instructions, not even the FPU instruction set, and is missing numeric overflow checking, plus heaps more probably.
ACC has a problem with numerical values. If you have a numerical value passed as a parameter in a function call, it gets assembled as a 16-bit push regardless of what it should be. Plus there are more problems with numeric values. I have partially fixed this by changing the default to 32-bit, plus I've removed code that was giving an incorrect "numeric overflow" warning message.
If you encounter any problems with numerical sizes, MACC allows values to be appended (postfixed) with:
'l' or 'L'
long, 32-bit
's' or 'S'
short, 16-bit
'k' or 'K'
char, 8-bit
Use the 's' and 'k' postfixes for passed parameters if they are not 32-bit, as MACC now defaults to 32-bit.

I made the following changes for compatibility with FASM and NASM:
push offset var1
mov eax,[var1]

A86 follows the MASM syntax. Now, MACC places square brackets to denote "contents of". FASM will object to the 'offset' keyword, however I have placed it there to make the code more readable for MASM people. At the start of each application you need to define 'offset' as nothing, that is: 'offset equ '.
mov eax,dword [ebx]
ACC uses 'long', now replaced with 'dword'.
_z: times 16 db 0
ACC has '_z: ds.b 16' to reserve uninitialised data. The equivalent in FASM would be '_z rb 16' however I haven't quite figured out the code of ACC yet, and '_z:' is already outputed when it reaches this situation. So, I have opted for the initialised format as shown on the left column, at least for now.
mov eax,0x24
ACC uses '$' prefix for hex numbers.
;public _z
ACC has the 'public' declaration, however FASM objects, at least for "binary output" mode, so I've commented them out.



Planned soon for this page:

Regards,
Barry Kauler

(c) 2002 Barry Kauler  http://www.goosee.com/explorer/