Welcome, Guest. Please login or register.

Author Topic: getting started in amiga assembly  (Read 9589 times)

Description:

0 Members and 1 Guest are viewing this topic.

Offline kamigaTopic starter

  • Full Member
  • ***
  • Join Date: Oct 2005
  • Posts: 165
    • Show only replies by kamiga
getting started in amiga assembly
« 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
 

Offline Piru

  • \' union select name,pwd--
  • Hero Member
  • *****
  • Join Date: Aug 2002
  • Posts: 6946
    • Show only replies by Piru
    • http://www.iki.fi/sintonen/
Re: getting started in amiga assembly
« Reply #1 on: July 03, 2009, 11:10:52 PM »
Quote from: kamiga;514417
What's the best assembler?

DevPac
Quote
Best documented?

Commercial: DevPac
Free: PhxAss
Quote
Is CygnusEd still a nice editor for code?

IMO yes.

Quote
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

Quote
I'd be pretty happy to get some very basic "hello world" type assembly source

Code: [Select]

_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
 

Offline amiga4ever

  • Jr. Member
  • **
  • Join Date: Jun 2006
  • Posts: 62
    • Show only replies by amiga4ever
Re: getting started in amiga assembly
« Reply #2 on: July 03, 2009, 11:19:50 PM »
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!
 

Offline matthey

  • Hero Member
  • *****
  • Join Date: Aug 2007
  • Posts: 1294
    • Show only replies by matthey
Re: getting started in amiga assembly
« Reply #3 on: July 04, 2009, 06:26:54 AM »
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.
 

Offline Trev

  • Hero Member
  • *****
  • Join Date: May 2003
  • Posts: 1550
  • Country: 00
    • Show only replies by Trev
Re: getting started in amiga assembly
« Reply #4 on: July 04, 2009, 08:07:19 PM »
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.
 

Offline buzz

  • Hero Member
  • *****
  • Join Date: Mar 2002
  • Posts: 612
    • Show only replies by buzz
Re: getting started in amiga assembly
« Reply #5 on: July 04, 2009, 09:00:28 PM »
Frank will probably recommend using vasm, as it is more advanced than Phxass now I believe.

Anything but devpac :) (it is subjective of course)
 

Offline kamigaTopic starter

  • Full Member
  • ***
  • Join Date: Oct 2005
  • Posts: 165
    • Show only replies by kamiga
Re: getting started in amiga assembly
« Reply #6 on: July 04, 2009, 09:57:09 PM »
@piru: Perfect info. Got hello world assembled and run. Awesome.

@matthey: thanks for the tips, very useful info.

Thanks everyone indeed.

kamiga
 

Offline NovaCoder

Re: getting started in amiga assembly
« Reply #7 on: July 05, 2009, 02:25:13 AM »
Thanks for that Piru, nice example :)
Life begins at 100 MIPS!


Nice Ports on AmiNet!
 

Offline Joloo

Re: getting started in amiga assembly
« Reply #8 on: July 05, 2009, 08:50:59 AM »
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