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 >
Wrap
Text File
|
1990-01-06
|
3KB
|
171 lines
AP V0.2 -- Amiga Assembler preprocessor
by Risto Paasivirta
Copyright © 1989, Risto Paasivirta
All rights reserved.
This program, source and document can be freely used and copied
*spread and enjoy*
AP is a half-day-hack which I meant to be a tool for writing quick math
oriented routines in assembler. Version 0.2 (another half-day) implements
some control structures. If you need more, you have the source...
Version 0.2 features:
- 16-bit maths
- bit operations
- ifcc -- else -- then
- begin -- until
- begin -- while -- repeat
- horrible bug colony?
AP simply converts some RPN expressions to assembler source, error cheking
is let to assembler. Anything which is not an AP-operand is handled as an
assembler label/expression, and thus may generate illegal instructions.
exp:
d0 #45 + . generates add.w #45,d0 , which is legal but
#45 d0 + . generates add.w d0,#45 !!!
Syntax:
ap [<source.a] [>destination.a] [debug]
AP reads source from stdin and outputs it to stdout, error messages go
to stderr.
Exprssions:
x y + . x=x+y
x y - z + . x=x-y+z
x y z - + . x=x+(y=y-z)
x y * x=x*y
z a + . z=z+a (warning extra stuff: x)
etc...
Operations:
{ start to process AP code. Must be first char of line,
rest of line is ignored.
} pass stuff to assembler until next '{', rest of line ignored
. end of exprssion.
Math:
x y + add.w y,x
x y - sub.w y,x
x y * muls y,x
x y / ext.l x
divu y,x
x % swap x
x y z */ muls y,x
divs z,x
Bit opers:
x y & and.w y,x
x y | or.w y,x
x y ^ eor.w y,x
x ~ not.w x
x y <? btst y,x
x y <^ bchg y,x
x y <0 bclr y,x
x y <1 bset y,x
x y << lsr.w y,x
x y >> asl.w y,x
Tests:
x y == cmp.w y,x
x 0= tst.w x
! eor.w #4,CCR (reverse Z flag, use as logigal not)
Moves:
x y = move.w y,x
x y :=: exg y,x
Controls:
ifcc ... then
__
bcc if.xxx
...
if.xxx
ifcc ... else ,,, then
__
bcc if.xxx
...
bra if.yyy
if.xxx
,,,
if.yyy
begin ... until
beg.xxx
...
beq beg.xxx
begin ... while ,,, repeat
beg.xxx
...
beq whl.yyy
,,,
bra beg.xxx
whl.yyy
Comments:
; comment ; comment
BUGS:
- ifcc -- until and begin -- then constucts give no warnings...
- Programming style is't most clean.
- This stuff has not been throughly tested.
- This manual is written at finglish...
- I won't get any money from this stuff..
- There are no funny error messages (well, is 'too much stuff' funny?)
Author:
Risto Paasivirta
Ainolantie 2
40520 Jyväskylä
Finland
(paasivir@tukki.jyu.fi)