home *** CD-ROM | disk | FTP | other *** search
/ Dave Lowe: Devpac Amiga 1 / Lowe_DevpacAmiga1.adf / examples / demo.s < prev    next >
Encoding:
Text File  |  1987-11-09  |  1.1 KB  |  55 lines

  1.     opt    l-,c+,d+        nolink,case dependant,debug
  2.  
  3. * this source code (C) HiSoft 1987 All Rights Reserved
  4. * a simple demo program to print a message on the screen then quit
  5.  
  6. * it uses the DOS and EXEC libraries
  7.  
  8.     incdir    ":include/"        where to look
  9.  
  10.     include    exec/exec_lib.i        I want to call EXEC
  11.     include    libraries/dos_lib.i    and DOS
  12.     include    libraries/dos.i
  13.  
  14. * start by opening the DOS library
  15. start    move.l    #dosname,a1
  16.     moveq    #0,d0            any version
  17.     CALLEXEC OpenLibrary
  18.     tst.l    d0
  19.     beq    quit_fast        quit if cant
  20.  
  21.     move.l    d0,_DOSBase        save pointer
  22.  
  23. * now find our output handle
  24.     CALLDOS    Output
  25.     move.l    d0,d4            d4=output handle
  26.  
  27. * and print a message
  28.     move.l    d4,d1            file handle
  29.     move.l    #string,d2        address of message
  30.     moveq    #stringlen,d3        length
  31.     CALLDOS    Write            and send it
  32.  
  33. * dont close the output handle otherwise the CLI bombs!
  34.  
  35.  
  36. * finished so close DOS library
  37.     move.l    _DOSBase,a1
  38.     CALLEXEC CloseLibrary
  39.  
  40. quit_fast
  41.     rts                amd finish
  42.  
  43. _DOSBase    dc.l    0        space for pointer
  44.  
  45. * strings here
  46.  
  47. * this defines the name of the DOS library
  48. dosname    DOSNAME
  49.  
  50. string    dc.b    'A Program written with HiSoft''s Devpac Amiga',10
  51. stringlen    equ    *-string
  52.  
  53.     even
  54.  
  55.