home *** CD-ROM | disk | FTP | other *** search
-
- *************************************************************************
- * *
- * Copyright (C) 1985, Commodore Amiga Inc. All rights reserved. *
- * Permission granted for non-commercial use * *
- * *
- ************************************************************************/
-
-
- *************************************************************************
- *
- * testdev.asm -- test the mylib.asm code
- *
- * Source Control
- * ------ -------
- *
- * $Header: amain.asm,v 31.3 85/10/18 19:04:04 neil Exp $
- *
- * $Locker: neil $
- *
- * $Log: amain.asm,v $
- *
- ************************************************************************/
-
- INCLUDE 'exec/types.i'
- INCLUDE 'exec/libraries.i'
- INCLUDE 'exec/devices.i'
- INCLUDE 'exec/io.i'
- INCLUDE 'exec/tasks.i'
- INCLUDE 'exec/interrupts.i'
-
- INCLUDE 'asmsupp.i'
- INCLUDE 'mydev.i'
-
-
-
- XDEF _main
-
- XREF _printf
- XREF _AbsExecBase
- XREF _CreatePort
- XREF _DeletePort
- XREF _CreateStdIO
- XREF _DeleteStdIO
-
- XLIB OpenDevice
- XLIB CloseDevice
-
-
- _main:
- move.l _AbsExecBase,a6
-
- ;------ make a reply port
- pea 0
- pea myName
- jsr _CreatePort
- addq.l #8,sp
-
- move.l d0,Port
- beq.s main_end
-
- ;------ get an io request
- move.l d0,-(sp)
- jsr _CreateStdIO
- addq.l #4,sp
-
- move.l d0,Iob
- beq main_DeletePort
-
- move.l d0,a1
- move.l #myName,LN_NAME(a1)
-
- ;------ open the test device: this will bring it in from disk
- lea myDevName(pc),a0
- moveq.l #1,d0
- moveq.l #0,d1
- CALLSYS OpenDevice
-
- tst.l d0
- beq.s 1$
-
- ;------ couldn't find the library
- pea 0
- move.l d0,a0
- move.b IO_ERROR(a0),3(sp)
- pea myDevName(pc)
- pea nodevmsg(pc)
- jsr _printf
- addq.l #8,sp
-
- bra main_DeleteIob
-
- 1$:
-
- ;------ close the device
- move.l Iob,a1
- CALLSYS CloseDevice
-
- main_DeleteIob:
- move.l Iob,-(sp)
- jsr _DeleteStdIO
- addq.l #4,sp
-
- main_DeletePort
- move.l Port,-(sp)
- jsr _DeletePort
- addq.l #4,sp
-
- main_end:
- rts
-
- myDevName: MYDEVNAME
- myName: dc.b 'testdev',0
- nodevmsg: dc.b 'can not open device "%s": error %ld',10,0
- testmsg: dc.b 'function MYFUNC%ld returned %ld',10,0
-
- Port: dc.l 0
- Iob: dc.l 0
-
- END
-