home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Fish 'n' More 2
/
fishmore-publicdomainlibraryvol.ii1991xetec.iso
/
disks
/
disk393.lzh
/
LibTool
/
AsmComplex
/
ComplexApp.asm
< prev
Wrap
Assembly Source File
|
1990-10-28
|
2KB
|
88 lines
;**************************************************************************
; ComplexApp.asm
;
; This is an application which tests our "complex.library" assembly example.
; It opens the complex.library, and calls each of the functions with some
; args. It prints results to the CLI. Then, it close the lib and exits.
;
;Link as follows:
;Blink startup.o complexapp.o small.lib nodebug to TEST
INCLUDE "Complex.i" ;our asm INCLUDE file made by LibTool (-a option)
;from StartUp.o
XREF _DOSBase,_SysBase,_stdout
;from amiga.lib or small.lib
XREF _LVORawDoFmt,_LVOWrite,_LVOOpenLibrary,_LVOCloseLibrary
XDEF _main
_main:
;--- Open our simple.library
lea ComplexName,a1
moveq #complexVERSION,d0 ;from the INCLUDE file
movea.l _SysBase,a6
jsr _LVOOpenLibrary(a6)
lea NoComplex,a0
move.l d0,d7
beq.s printf
;--- Call MakeWindow
movea.l d7,a6
jsr _LVOMakeWindow(a6)
move.l d0,d6
bne.s 2$
lea NoWind,a0
bsr.s printf
bra.s 1$
;--- Call PrintMsg
2$ moveq #20,d1 ;y
moveq #8,d0 ;x
lea MyMsg,a1 ;msg
movea.l d6,a0
jsr _LVOPrintMsg(a6)
;--- Call RemWindow
movea.l d6,a0
jsr _LVORemWindow(a6)
;--- Close Complex.library and exit
1$ movea.l d7,a1
movea.l _SysBase,a6
jmp _LVOCloseLibrary(a6)
XDEF printf
printf:
move.l _stdout,d0
beq.s 3$
lea 4(sp),a1 ;args to format (if any)
movem.l d2/d3/a2/a3/a4/a6,-(sp)
movea.l d0,a4
moveq #126,d0
suba.l d0,sp ;get a buffer to hold the string
lea storeIt,a2
movea.l sp,a3
movea.l _SysBase,a6
jsr _LVORawDoFmt(a6)
moveq #-1,d3
1$ move.b (a3)+,d0
Dbeq d3,1$(pc)
not.l d3
beq.s 2$
move.l sp,d2
move.l a4,d1
movea.l _DOSBase,a6
jsr _LVOWrite(a6)
2$ moveq #126,d0
adda.l d0,sp
movem.l (sp)+,d2/d3/a2/a3/a4/a6
3$ rts
storeIt move.b d0,(a3)+
rts
ComplexName dc.b 'complex.library',0
NoComplex dc.b 'can',$27,'t get complex.library in LIBS',10,0
NoWind dc.b 'can',$27,'t open window',10,0
MyMsg dc.b 'Close window to exit',0
END