Amiga.org
Operating System Specific Discussions => Amiga OS => Amiga OS -- Development => Topic started by: kamiga on July 03, 2009, 10:06:07 PM
-
I'd like to get into writing some amiga assembly for OS 3.x and older. I'd prefer to code right on the amiga, unless there are really compelling reasons not to. I have an 68030-upgraded A500 w/ harddrive and 2+1 megs of ram.
What books should I be looking at? I'm currently reading "Microprocessor Systems Design: 68000 Hardware, Software, and Interfacing." by Clements (ISBN 0871500957) Fantastic book for learning the 68k. I also have Abacus's "Amiga Machine Language." And all the RKMs. I heard someone else mention "Amiga Systems Programming." Any good?
What's the best assembler? Best documented? Is CygnusEd still a nice editor for code?
Example assembly programs? Resources? How to call the OS functions?
I'd be pretty happy to get some very basic "hello world" type assembly source, get it assembled, and executed.
Thanks for any help
kamiga
-
What's the best assembler?
DevPac
Best documented?
Commercial: DevPac
Free: PhxAss
Is CygnusEd still a nice editor for code?
IMO yes.
How to call the OS functions?
1. open the library, store the library pointer somewhere
2. move the library pointer to a6 register
3. move function arguments to input registers
4. jsr to LVO offset (jsr -xxx(a6))
5. return value is returned in d0, if any
6. at program exit close the library
I'd be pretty happy to get some very basic "hello world" type assembly source
_LVOOpenLibrary EQU -552
_LVOCloseLibrary EQU -414
_LVOOutput EQU -60
_LVOWrite EQU -48
start:
move.l 4.w,a6
lea dosname(pc),a1
moveq #0,d0
jsr _LVOOpenLibrary(a6)
tst.l d0
beq.s nodos
move.l d0,a6
lea msg(pc),a0
moveq #-1,d3
move.l a0,d2
strlen:
addq.l #1,d3
tst.b (a0)+
bne.s strlen
jsr _LVOOutput(a6)
move.l d0,d1
jsr _LVOWrite(a6)
move.l a6,a1
move.l 4.w,a6
jsr _LVOCloseLibrary(a6)
nodos:
moveq #0,d0
rts
dosname:
dc.b 'dos.library',0
msg:
dc.b 'Hello, world!',10,0
-
Piru: I'm so relieved to see you NOT recommend ASMOne. :-) Horrible/buggy editor but very popular and ppl always seem to recommend it.
DevPac is great!
-
FreeScale (Motorola spin off) still has 68k manuals and info online for free. Assembler doesn't have very high requirements and your setup is just fine. I use CED and PhxAss also for my assembler. What Piru said but might add...
d0,d1,a0,a1 are scratch registers (contents destroyed) when calling library/device functions on the Amiga.
The absolute memory address 4 contains the location of the exec.library.
-
I would check with Frank Wille before using PhxAss for new development. Only Frank knows for sure, but I think he spends more time maintaining vbcc (an excellent C compiler), vasm (the assembler), and vlink (the linker) these days.
-
Frank will probably recommend using vasm, as it is more advanced than Phxass now I believe.
Anything but devpac :) (it is subjective of course)
-
@piru: Perfect info. Got hello world assembled and run. Awesome.
@matthey: thanks for the tips, very useful info.
Thanks everyone indeed.
kamiga
-
Thanks for that Piru, nice example :)
-
I am with Piru: Devpac 3.18 is the best assembler IDE ever written for the Amiga.
Regarding vasm: vasm 1.4a will be released soon (as part of vbcc 0.9a).
vasm is now fully Devpac compatible; it offers the support for Devpac used options but that would require to specify the '-devpac' switch on the command line.
I am currently moving from Devpac to vasm because vasm supports different processors in contrast to Devpac which is only m68k. vasm is slower than Devpac and when using the preassembled include file for Devpac vasm is even slower. I personally don't care much about this fact because the machine I am using is fast and vasm finds more things to optimise than Devpac.
If you need an IDE go for Devpac 3.18.
If you don't need an IDE I would recommend the duo vasm 1.4a and vlink 0.12e (as part of vbcc 0.9a distribution).
PhxAss, although still useable, should be only considered for unexpanded machines due to its modest requirements.
Regards