home *** CD-ROM | disk | FTP | other *** search
/ Club Amiga de Montreal - CAM / CAM_CD_1.iso / files / 332.lha / AmigaAsmPreprocessor_v0.2 / ap.doc < prev    next >
Text File  |  1990-01-06  |  3KB  |  171 lines

  1.  
  2.          AP V0.2 -- Amiga Assembler preprocessor
  3.  
  4.                by Risto Paasivirta
  5.  
  6.            Copyright © 1989, Risto Paasivirta    
  7.                    All rights reserved.    
  8.         
  9.  
  10.     This program, source and document can be freely used and copied
  11.                 *spread and enjoy*
  12.  
  13.  
  14. AP is a half-day-hack which I meant to be a tool for writing quick math
  15. oriented routines in assembler. Version 0.2 (another half-day) implements
  16. some control structures. If you need more, you have the source...
  17.  
  18. Version 0.2 features:
  19. - 16-bit maths
  20. - bit operations
  21. - ifcc -- else -- then
  22. - begin -- until
  23. - begin -- while -- repeat
  24. - horrible bug colony?
  25.  
  26. AP simply converts some RPN expressions to assembler source, error cheking
  27. is let to assembler. Anything which is not an AP-operand is handled as an
  28. assembler label/expression, and thus may generate illegal instructions.
  29.  
  30. exp:
  31. d0 #45 + . generates add.w #45,d0 , which is legal but
  32. #45 d0 + . generates add.w d0,#45 !!!
  33.  
  34. Syntax:
  35.  
  36. ap [<source.a] [>destination.a] [debug] 
  37.  
  38. AP reads source from stdin and outputs it to stdout, error messages go
  39. to stderr.
  40.  
  41.  
  42. Exprssions:
  43.  
  44. x y + .        x=x+y
  45.  
  46. x y - z + .    x=x-y+z
  47.  
  48. x y z - + .    x=x+(y=y-z)
  49.  
  50. x y *        x=x*y
  51.  
  52. z a + .        z=z+a (warning extra stuff: x)
  53.  
  54. etc...
  55.  
  56. Operations:
  57.  
  58. {        start to process AP code. Must be first char of line,
  59.         rest of line is ignored.
  60.  
  61. }        pass stuff to assembler until next '{', rest of line ignored
  62.  
  63. .        end of exprssion.
  64.  
  65. Math:
  66.  
  67. x y +        add.w y,x
  68.  
  69. x y -        sub.w y,x
  70.  
  71. x y *        muls y,x
  72.  
  73. x y /        ext.l x
  74.         divu y,x
  75.  
  76. x %        swap x
  77.  
  78. x y z */    muls y,x
  79.         divs z,x
  80.  
  81. Bit opers:
  82.  
  83. x y &        and.w y,x
  84.  
  85. x y |        or.w y,x
  86.  
  87. x y ^        eor.w y,x
  88.  
  89. x ~         not.w x
  90.  
  91. x y <?        btst y,x
  92.  
  93. x y <^        bchg y,x
  94.  
  95. x y <0        bclr y,x
  96.  
  97. x y <1        bset y,x
  98.  
  99. x y <<        lsr.w y,x
  100.  
  101. x y >>        asl.w y,x
  102.  
  103. Tests:
  104.  
  105. x y ==        cmp.w y,x
  106.  
  107. x 0=        tst.w x
  108.  
  109. !        eor.w #4,CCR    (reverse Z flag, use as logigal not)
  110.  
  111. Moves:
  112.  
  113. x y =        move.w y,x
  114.  
  115. x y :=:        exg y,x
  116.  
  117. Controls:
  118.  
  119. ifcc ... then
  120.          __    
  121.         bcc if.xxx
  122.         ...            
  123.     if.xxx    
  124.  
  125. ifcc ... else ,,, then
  126.          __
  127.         bcc if.xxx
  128.         ...
  129.         bra if.yyy
  130.     if.xxx
  131.         ,,,
  132.     if.yyy
  133.  
  134. begin ... until
  135.  
  136.     beg.xxx    
  137.         ...
  138.         beq beg.xxx
  139.  
  140. begin ... while ,,, repeat    
  141.  
  142.     beg.xxx
  143.         ...
  144.         beq whl.yyy
  145.         ,,,
  146.         bra beg.xxx
  147.     whl.yyy
  148.  
  149. Comments:
  150.     
  151. ; comment    ; comment
  152.  
  153. BUGS:
  154.  
  155. - ifcc -- until and begin -- then constucts give no warnings...
  156. - Programming style is't most clean.
  157. - This stuff has not been throughly tested.
  158. - This manual is written at finglish...
  159. - I won't get any money from this stuff..
  160. - There are no funny error messages (well, is 'too much stuff' funny?)
  161.  
  162. Author:
  163.  
  164. Risto Paasivirta
  165. Ainolantie 2
  166. 40520 Jyväskylä
  167. Finland
  168.  
  169. (paasivir@tukki.jyu.fi)
  170.  
  171.