home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 1996 November / PCW-9611.7z / PCW-9611 / image.IMA / ASM.TXT < prev    next >
Encoding:
Text File  |  1996-02-25  |  7.9 KB  |  165 lines

  1. Magic Assembler v1.10 - Documentation                                         I
  2. ═══════════════════════════════════════════════════════════════════════════════
  3. Changes since version 1.061
  4. - CALLF [] added
  5. - CALL [] fixed
  6. - Boot indicator added (55aa)
  7. - Incompatible bootsector mode installed for total use of 512 bytes
  8. - ][ acceptance added (e.g. [BX][SI] now recognized as [BX+SI])
  9. - Calculations (*, /, +, -) added.
  10. - XCHG added
  11. - Assembling report added
  12. - Example program added
  13. - Error for illigal segment manipulation added
  14. - Source code creation added
  15. - EQU bug fixed
  16. - IN/OUT command improved
  17. - DD & DDE added
  18. ═══════════════════════════════════════════════════════════════════════════════
  19. Magic Assembler is a public domain assembly language compiler, which can
  20. produce as well as COM files as boot sector programs. Compiling to COM files
  21. can be done using the following command line:
  22. ┌────────────────┐
  23. │ ASM MYPROG.ASM │
  24. └────────────────┘
  25. To put the program in the boot sector of a disk which is in drive A, use the
  26. following command line:
  27. ┌────────────────────┐
  28. │ ASM MYPROG.ASM B:A │
  29. └────────────────────┘
  30. Note that if you want to make a boot program, you should include a code like
  31. this:
  32. ┌─────────────────────────┐
  33. │         mov     ax,07c0 │
  34. │         mov     ds,ax   │
  35. │         mov     es,ax   │
  36. │         mov     ss,ax   │
  37. └─────────────────────────┘
  38. This is because DOS isn't loaded, so DOS cannot do the correct memory settings
  39. before running the program. All bootsector programs are loaded at 07c0:0000, so
  40. that's why this code should be included. Note that the program automaticly 
  41. supports MS-DOS disks, so reads the first two bytes, which contain an JMP code,
  42. and let the program start at the address the JMP code points to. The program
  43. also puts at the last two bytes the code 55aa, which indicates that the boot
  44. sector is bootable. The problem is, that if you use the DOS compatibility mode,
  45. you cannot use all 512 bytes, but (calculated with my MS-DOS v5.0), 448 bytes.
  46. If you want to use all 512 bytes, you should compile using the 'I' option.
  47. If you want to compile a program and print the source with the right addresses,
  48. use the 'P' parameter:
  49. ┌──────────────────┐
  50. │ ASM MYPROG.ASM P │
  51. └──────────────────┘
  52. This can also be done with a boot sector program, then the command line could
  53. be for example this:
  54. ┌─────────────────────┐
  55. │ ASM MYPROG.ASM B:AP │
  56. └─────────────────────┘
  57. Magic Assembler v1.10 - Documentation                                        II
  58. ═══════════════════════════════════════════════════════════════════════════════
  59. The commands included with this assembler are the standard assembly commands,
  60. but there are some exeptions. There are three different JMP commands, and two
  61. different CALL commands. Below the difference are discussed:
  62.  
  63. JMPS    jumps 128 bytes back to 127 bytes further, and uses 2 bytes of code.
  64. JMP     jumps 32768 bytes back to 32767 bytes further, and uses 3 bytes of 
  65.         code.
  66. JMPF    jumps to every possible place in the low memory, and uses 5 bytes of 
  67.         code.
  68. CALL    see JMP, but with this the RET function can be used.
  69. CALLF   see JMPF, but with this the RETF function can be used.
  70. ═══════════════════════════════════════════════════════════════════════════════
  71. Variables can be declared with the following functions:
  72.  
  73. DB      byte(s)         declares a byte, but can also be used to declare 
  74.                         multiple bytes.
  75. DD      double word(s)  declares a double word, but can also be used to declare
  76.                         multiple double words.
  77. DW      word(s)         declares a word, but can also be used to declare 
  78.                         multiple words.
  79. DS      x bytes         declares a free array of x bytes.
  80. DBE     filename.ext    this function puts a file in the compiled version, 
  81.                         supposing that the file is build of bytes.
  82. DDE     filename.ext    this function puts a file in the compiled version,
  83.                         supposing that the file is build of double words.
  84. DWE     filename.ext    this function puts a file in the compiled version, 
  85.                         supposing that the file is build of words.
  86.  
  87. With DB and DW you can also put a ? instead of a value.
  88. If you want to declare data, for which only space in memory must be reserved,
  89. but no space on disk, you should put them on the end of the source. Before you
  90. declare that data you must put an empty line before them, containing only a '-'
  91. at the first place. See the example programs for details.
  92. ═══════════════════════════════════════════════════════════════════════════════
  93. You do not need to tell the assembler that a procedure is a procedure, so you
  94. can declare a procedure like this:
  95. ┌─────────────────────────┐
  96. │ cls     mov     ax,0003 │
  97. │         int     10      │
  98. │         ret             │
  99. └─────────────────────────┘
  100. You can then in the program put the line
  101. ┌─────────────────────┐
  102. │         call    cls │
  103. └─────────────────────┘
  104. ═══════════════════════════════════════════════════════════════════════════════
  105. Standard, all numbers must be in hexadecimal. But, it is possible to work with
  106. binary and decimal numbers too: just put '%b' before the binary number or '%d'
  107. before the decimal number. For example: these three commands have exactly the
  108. same meaning:
  109. ┌──────────────────────────────────────┐
  110. │        mov     ax,4c00               │
  111. │        mov     ax,%d19456            │
  112. │        mov     ax,%b0100110000000000 │
  113. └──────────────────────────────────────┘
  114. Magic Assembler v1.10 - Documentation                                       III
  115. ═══════════════════════════════════════════════════════════════════════════════
  116. It is also possible to write the numbers in a standard form, which is used by 
  117. most other assemblers. When you want so, you should add an 'n' as the parameter
  118. to the compiler:
  119. ┌──────────────────┐
  120. │ ASM MYPROG.ASM N │
  121. └──────────────────┘
  122. If you want to use this mode, you should put an 'h' behind a hexadecimal 
  123. number, and a 'b' behind a binary number. For example: these three commands 
  124. have exactly the same meaning:
  125. ┌─────────────────────────────────────┐
  126. │        mov     ax,4c00h             │
  127. │        mov     ax,19456             │
  128. │        mov     ax,0100110000000000b │
  129. └─────────────────────────────────────┘
  130. ═══════════════════════════════════════════════════════════════════════════════
  131. It is possible to make calculations with constant numbers. For example, the
  132. following calculation can be done:
  133. ┌───────────────────────────┐
  134. │        mov     ax,2+(7*3) │
  135. └───────────────────────────┘
  136. ═══════════════════════════════════════════════════════════════════════════════
  137. I hope you'll enjoy the Magic Assembler. If you have any questions, remarks or
  138. you just want to let me know you use the assembler, you can write me (please
  139. specify the version number):
  140.  
  141. Bert Greevenbosch
  142. Roestmos 12
  143. 3069 AR  Rotterdam
  144. The Netherlands
  145.  
  146. Call me (Most chance between 17.00-22.00 CET):
  147. +31-10-4215920
  148.  
  149. Or E-mail me:
  150. bert@caiw.nl
  151.  
  152. I am a scholar, and do programming in my spare time. Most of the knowledge I
  153. have about computers, comes from books and trying. For that, I often have to
  154. buy books or software, which costs a lot of money. For this reason, I want to
  155. say that donations will be appreciated. Because the software is donated to the
  156. Public Domain, donating is not paying for the software, and also not
  157. obligatory. But, it will keep me writing this kind of programs and enlarging my
  158. knowledge. And, if you donate DFL 25.00 (or US$ 20.00) or more, I'll send you,
  159. when given your address, the latest release of the public domain
  160. Magic Utilities on a 3.5" HD disk. You can send it as a postal money order, in
  161. solid form, or put it on giro 2939017 of the Postbank in the Netherlands. Thank
  162. you very much!
  163. ═══════════════════════════════════════════════════════════════════════════════
  164. Magic Assembler was written by Bert Greevenbosch for Magic Software Rotterdam.
  165.