home *** CD-ROM | disk | FTP | other *** search
- * --------------------------------------------------------------------
- * Example fib1.s
- * --------------------------------------------------------------------
- ; some system include files...
-
- include exec/libraries.i
- include exec/exec_lib.i
- include dos/dos.i
- include dos/dos_lib.i
-
- * --------------------------------------------------------------------
-
- CALLSYS MACRO
-
- LINKLIB _LVO\1,\2
-
- ENDM
-
- * --------------------------------------------------------------------
-
- ; EQUate definitions...
-
- _AbsExecBase EQU 4
-
- LF EQU 10
-
- NULL EQU 0
-
- * --------------------------------------------------------------------
- ; main program code...
-
- _main movem.l d2,-(sp) preserve registers
-
- move.l _AbsExecBase,_SysBase set up SysBase variable
-
- subq.l #1,d0
-
- lea buffer,a1 program's filename buffer
-
- .loop move.b (a0)+,(a1)+ copy bytes
-
- dbra d0,.loop
-
- subq.l #1,a1 back to command line LF
-
- move.b #NULL,(a1) replace with NULL
-
- lea dos_name,a1 library name start in a1
-
- moveq #0,d0 any version will do
-
- CALLSYS OpenLibrary,_SysBase
-
- move.l d0,_DOSBase store library base
-
- beq EXIT check result
-
-
- move.l #buffer,d1 filename
-
- moveq #ACCESS_READ,d2
-
- CALLSYS Lock,_DOSBase
-
- move.l d0,filelock_p BPTR pointer!
-
- beq.s CLOSEDOS
-
-
- move.l d0,d1 filelock_p
-
- move.l #FIB,d2 address of file info block
-
- CALLSYS Examine,_DOSBase
-
-
- move.l filelock_p,d1
-
- CALLSYS UnLock,_DOSBase
-
-
- lea FIB,a0
-
- move.l fib_Protection(a0),d2
-
- bchg.l #FIBB_DELETE,d2
-
- move.l #buffer,d1 filename
-
- CALLSYS SetProtection,_DOSBase
-
-
- CLOSEDOS move.l _DOSBase,a1 base needed in a1
-
- CALLSYS CloseLibrary,_SysBase
-
-
- EXIT movem.l (sp)+,d2 restore registers
-
- clr.l d0
-
- rts logical end of program
-
- * --------------------------------------------------------------------
- ; variables and static data...
-
- filelock_p ds.l 1
-
- _SysBase ds.l 1
-
- _DOSBase ds.l 1
-
- buffer ds.b 100
-
- dos_name dc.b 'dos.library',NULL
-
- cnop 0,4
-
- FIB ds.b fib_SIZEOF
-
- * --------------------------------------------------------------------
-
-