Magic Assembler v1.10 - Documentation I 様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様� Changes since version 1.061 - CALLF [] added - CALL [] fixed - Boot indicator added (55aa) - Incompatible bootsector mode installed for total use of 512 bytes - ][ acceptance added (e.g. [BX][SI] now recognized as [BX+SI]) - Calculations (*, /, +, -) added. - XCHG added - Assembling report added - Example program added - Error for illigal segment manipulation added - Source code creation added - EQU bug fixed - IN/OUT command improved - DD & DDE added 様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様� 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, use the following 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. Note that the program automaticly supports MS-DOS disks, so reads the first two bytes, which contain an JMP code, and let the program start at the address the JMP code points to. The program also puts at the last two bytes the code 55aa, which indicates that the boot sector is bootable. The problem is, that if you use the DOS compatibility mode, you cannot use all 512 bytes, but (calculated with my MS-DOS v5.0), 448 bytes. If you want to use all 512 bytes, you should compile using the 'I' option. If you want to compile a program and print the source with the right addresses, 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 � 青陳陳陳陳陳陳陳陳陳陳� Magic Assembler v1.10 - Documentation II 様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様� 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 RETF 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. DD double word(s) declares a double word, but can also be used to declare multiple double words. DW word(s) declares a word, but can also be used to declare multiple 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. DDE filename.ext this function puts a file in the compiled version, supposing that the file is build of double words. 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 � 青陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳潰 Magic Assembler v1.10 - Documentation III 様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様� 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 a hexadecimal number, and a 'b' behind a binary number. For example: these three commands have exactly the same meaning: 敖陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳� � mov ax,4c00h � � mov ax,19456 � � mov ax,0100110000000000b � 青陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳� 様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様� It is possible to make calculations with constant numbers. For example, the following calculation can be done: 敖陳陳陳陳陳陳陳陳陳陳陳陳陳� � mov ax,2+(7*3) � 青陳陳陳陳陳陳陳陳陳陳陳陳陳� 様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様� I hope you'll enjoy the Magic Assembler. If you have any questions, remarks or you just want to let me know you use the assembler, you can write me (please specify the version number): Bert Greevenbosch Roestmos 12 3069 AR Rotterdam The Netherlands Call me (Most chance between 17.00-22.00 CET): +31-10-4215920 Or E-mail me: bert@caiw.nl I am a scholar, and do programming in my spare time. Most of the knowledge I have about computers, comes from books and trying. For that, I often have to buy books or software, which costs a lot of money. For this reason, I want to say that donations will be appreciated. Because the software is donated to the Public Domain, donating is not paying for the software, and also not obligatory. But, it will keep me writing this kind of programs and enlarging my knowledge. And, if you donate DFL 25.00 (or US$ 20.00) or more, I'll send you, when given your address, the latest release of the public domain Magic Utilities on a 3.5" HD disk. You can send it as a postal money order, in solid form, or put it on giro 2939017 of the Postbank in the Netherlands. Thank you very much! 様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様� Magic Assembler was written by Bert Greevenbosch for Magic Software Rotterdam.