Magic Assembler v1.06 - Documentation

Changes since version 1.051:
- LEA command added
- binary and decimal number recognation added
- example programs added
- remark bug fixed
- standard numbers added
- comma acception in DB and DW functions added
- EQU command improved

Magic Assembler is a public domain assembly language compiler, which can
produce as well as COM files as boot sector programs. Compiling to COM files
can be done using the following command line:
Ŀ
 ASM MYPROG.ASM 

To put the program in the boot sector of a disk which is in drive A, the use 
this command line:
Ŀ
 ASM MYPROG.ASM B:A 

Note that if you want to make a boot program, you should include a code like
this:
Ŀ
         mov     ax,07c0 
         mov     ds,ax   
         mov     es,ax   
         mov     ss,ax   

This is because DOS isn't loaded, so DOS cannot do the correct memory settings
before running the program. All bootsector programs are loaded at 07c0:0000, so
that's why this code should be included.
If you want to compile a program and print the source with the right adresses,
use the 'P' parameter:
Ŀ
 ASM MYPROG.ASM P 

This can also be done with a boot sector program, then the command line could
be for example this:
Ŀ
 ASM MYPROG.ASM B:AP 


The commands included with this assembler are the standard assembly commands,
but there are some exeptions. There are three different JMP commands, and two
different CALL commands. Below the difference are discussed:

JMPS    jumps 128 bytes back to 127 bytes further, and uses 2 bytes of code.
JMP     jumps 32768 bytes back to 32767 bytes further, and uses 3 bytes of 
        code.
JMPF    jumps to every possible place in the low memory, and uses 5 bytes of 
        code.
CALL    see JMP, but with this the RET function can be used.
CALLF   see JMPF, but with this the RET function can be used.

Variables can be declared with the following functions:

DB      byte(s)         declares a byte, but can also be used to declare 
                        multiple bytes.
DW      word(s)         declares a word, but can also be used to declare 
                        mutiple words.
DS      x bytes         declares a free array of x bytes.
DBE     filename.ext    this function puts a file in the compiled version, 
                        supposing that the file is build of bytes.
DWE     filename.ext    this function puts a file in the compiled version, 
                        supposing that the file is build of words.

With DB and DW you can also put a ? instead of a value.
If you want to declare data, for which only space in memory must be reserved,
but no space on disk, you should put them on the end of the source. Before you
declare that data you must put an empty line before them, containing only a '-'
at the first place. See the example programs for details.

You do not need to tell the assembler that a procedure is a procedure, so you
can declare a procedure like this:
Ŀ
 cls     mov     ax,0003 
         int     10      
         ret             

You can then in the program put the line
Ŀ
         call    cls 


Standard, all numbers must be in hexadecimal. But, it is possible to work with
binary and decimal numbers too: just put '%b' before the binary number or '%d'
before the decimal number. For example: these three commands have exactly the
same meaning:
Ŀ
        mov     ax,4c00               
        mov     ax,%d19456            
        mov     ax,%b0100110000000000 


It is also possible to write the numbers in a standard form, which is used by 
most other assemblers. When you want so, you should add an 'n' as the parameter
to the compiler:
Ŀ
 ASM MYPROG.ASM N 

If you want to use this mode, you should put an 'h' behind an hexadecimal 
number, and a 'b' behind binary numbers. For example: these three commands have
exactly have the same meaning:
Ŀ
        mov     ax,4c00h              
        mov     ax,19456              
        mov     ax,0100110000000000b  


I hope you'll enjoy the Magic Assembler. If you have any questions or remarks
about the assembler, the documenation or the sample programs, you can write me
on E-mail bert.greevenbosch@mmm.xs4all.nl

Magic Assembler was written by Bert Greevenbosch for Magic Software.
Program created in Rotterdam, the Netherlands.
