Welcome, Guest. Please login or register.

Author Topic: Learning how to Program the Amiga  (Read 7729 times)

Description:

0 Members and 1 Guest are viewing this topic.

Offline Piru

  • \' union select name,pwd--
  • Hero Member
  • *****
  • Join Date: Aug 2002
  • Posts: 6946
    • Show all replies
    • http://www.iki.fi/sintonen/
Re: Learning how to Program the Amiga
« on: May 02, 2010, 04:50:37 PM »
Quote from: Super TWiT;556329
I only have workbench 1.3. Where can I find DevCD 2.1?

I would seriously suggest that you get hold of amiga forever and use UAE. Else you will have tons of pain.
 

Offline Piru

  • \' union select name,pwd--
  • Hero Member
  • *****
  • Join Date: Aug 2002
  • Posts: 6946
    • Show all replies
    • http://www.iki.fi/sintonen/
Re: Learning how to Program the Amiga
« Reply #1 on: May 05, 2010, 05:40:27 AM »
Quote from: Fanscale;556706
Here's a link to Hello world for 68k Amiga:

http://www.helloworldexample.net/cisc-amiga-workbench-20-motorola-68000-hello-world-example.html

And here's the fixed version of the same example:
Code: [Select]
       include lvo/exec_lib.i
        include lvo/dos_lib.i

        ; open DOS library
        movea.l  4.w,a6
        lea      dosname(pc),a1
        moveq    #36,d0
        jsr      _LVOOpenLibrary(a6)
        tst.l    d0
        beq.b    .nodos
        movea.l  d0,a6

        ; actual print string
        lea      hellostr(pc),a0
        move.l   a0,d1
        jsr      _LVOPutStr(a6)

        ; close DOS library
        movea.l  a6,a1
        movea.l  4.w,a6
        jsr      _LVOCloseLibrary(a6)
        moveq    #0,d0
        rts

.nodos:
        moveq    #20,d0
        rts

dosname     dc.b 'dos.library',0
hellostr    dc.b 'Hello, world!',0


Changes:
- Properly test for OpenLibrary failure. No longer crashes when run on KS 1.3.
- Set return code properly.