home *** CD-ROM | disk | FTP | other *** search
/ Fish 'n' More 2 / fishmore-publicdomainlibraryvol.ii1991xetec.iso / dirs / libtool_463.lzh / LibTool / LibTool.lzh / AsmComplex / ComplexApp.asm < prev   
Assembly Source File  |  1990-06-27  |  2KB  |  88 lines

  1. ;**************************************************************************
  2. ; ComplexApp.asm
  3. ;
  4. ; This is an application which tests our "complex.library" assembly example.
  5. ; It opens the complex.library, and calls each of the functions with some
  6. ; args. It prints results to the CLI. Then, it close the lib and exits.
  7. ;
  8. ;Link as follows:
  9. ;Blink startup.o complexapp.o small.lib nodebug to TEST
  10.  
  11.     INCLUDE    "Complex.i"    ;our asm INCLUDE file made by LibTool (-a option)
  12.  
  13.     ;from StartUp.o
  14.     XREF    _DOSBase,_SysBase,_stdout
  15.  
  16.     ;from amiga.lib or small.lib
  17.     XREF    _LVORawDoFmt,_LVOWrite,_LVOOpenLibrary,_LVOCloseLibrary
  18.  
  19.     XDEF    _main
  20. _main:
  21.     ;--- Open our simple.library
  22.     lea    ComplexName,a1
  23.     moveq    #complexVERSION,d0    ;from the INCLUDE file
  24.     movea.l    _SysBase,a6
  25.     jsr    _LVOOpenLibrary(a6)
  26.     lea    NoComplex,a0
  27.     move.l    d0,d7
  28.     beq.s    printf
  29.     ;--- Call MakeWindow
  30.     movea.l    d7,a6
  31.     jsr    _LVOMakeWindow(a6)
  32.     move.l    d0,d6
  33.     bne.s    2$
  34.     lea    NoWind,a0
  35.     bsr.s    printf
  36.     bra.s    1$
  37.     ;--- Call PrintMsg
  38. 2$    moveq    #20,d1        ;y
  39.     moveq    #8,d0        ;x
  40.     lea    MyMsg,a1    ;msg
  41.     movea.l    d6,a0
  42.     jsr    _LVOPrintMsg(a6)
  43.     ;--- Call RemWindow
  44.     movea.l    d6,a0
  45.     jsr    _LVORemWindow(a6)
  46.     ;--- Close Complex.library and exit
  47. 1$    movea.l    d7,a1
  48.     movea.l    _SysBase,a6
  49.     jmp    _LVOCloseLibrary(a6)
  50.  
  51.  
  52.     XDEF     printf
  53. printf:
  54.     move.l    _stdout,d0
  55.     beq.s    3$
  56.     lea    4(sp),a1    ;args to format (if any)
  57.     movem.l    d2/d3/a2/a3/a4/a6,-(sp)
  58.     movea.l    d0,a4
  59.     moveq    #126,d0
  60.     suba.l    d0,sp        ;get a buffer to hold the string
  61.     lea    storeIt,a2
  62.     movea.l    sp,a3
  63.     movea.l    _SysBase,a6
  64.     jsr    _LVORawDoFmt(a6)
  65.     moveq    #-1,d3
  66. 1$    move.b    (a3)+,d0
  67.     Dbeq    d3,1$(pc)
  68.     not.l    d3
  69.     beq.s    2$
  70.     move.l    sp,d2
  71.     move.l    a4,d1
  72.     movea.l    _DOSBase,a6
  73.     jsr    _LVOWrite(a6)
  74. 2$    moveq    #126,d0
  75.     adda.l    d0,sp
  76.     movem.l    (sp)+,d2/d3/a2/a3/a4/a6
  77. 3$    rts
  78.  
  79. storeIt    move.b    d0,(a3)+
  80.     rts
  81.  
  82. ComplexName    dc.b    'complex.library',0
  83. NoComplex    dc.b    'can',$27,'t get complex.library in LIBS',10,0
  84. NoWind        dc.b    'can',$27,'t open window',10,0
  85. MyMsg        dc.b    'Close window to exit',0
  86.  
  87.     END
  88.