home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Elysian Archive
/
AmigaElysianArchive.iso
/
prog
/
source
/
cls.lha
/
CLS.asm
Wrap
Assembly Source File
|
1986-12-07
|
3KB
|
86 lines
* CLI TOY #1
* CLS.ASM: A command to clear the current (CLI) window. Works by
* sending a HOME/CLEAR TO END OF SCREEN sequence to CON:
*
* Perpetrator: Dewi Williams ..!ihnp4!druca!dewi
* Unconditionally placed in the public domain.
* Included equate files.
* -----------------------------------------------------------------------
NOLIST
INCLUDE "exec/types.i"
INCLUDE "exec/libraries.i"
INCLUDE "libraries/dos.i"
LIST
* Local Equates
* ------------------------------------------------------------------------
SysBase EQU 4 ; The one known address in the system.
* External references
* -----------------------------------------------------------------------
EXTERN_LIB OpenLibrary
EXTERN_LIB Write
EXTERN_LIB Output
EXTERN_LIB IoErr
* macros
* ------------------------------------------------------------------------
* Calls to dos.library and exec library
callsys MACRO
CALLLIB _LVO\1
ENDM
* The code segment
* -------------------------------------------------------------------------
RORG 0 ; Relocatable code.
;------ get Exec's library base pointer:
move.l SysBase,a6
LEA.L DOSName(PC),A1 ; name of dos library
move.l #LIBRARY_VERSION,d0
callsys OpenLibrary
MOVE.L D0,A6 ; Save library pointer (always in A6).
BEQ.S DOSFAIL ; Give up!
* Obtaining the output handle (needed for write)
callsys Output ; Always works -- copy from process structure.
MOVE.L D0,D1 ; Needed there by write
* Write the sequence to the driver
LEA.L CLS(PC),A0
MOVE.L A0,D2 ; Effective address of the buffer
MOVEQ #4,D3 ; Length of buffer to write
callsys Write ; Do it
TST.L D0 ; Just set condition code
BMI.S IOFAIL ; For disks & suchlike check == D3.
* Exit back to CLI (shouldn't close CLI handles).
MOVEQ #0,D0 ; Success exit code
FINISHED:
rts
* All the error traps go here
* ---------------------------
; Get here if we can't write to CON: for some reason.
IOFAIL:
callsys IoErr ; Returns real reason for failure.
BRA.S FINISHED ; Quit
; Get here if we can't open dos.library. Give up! We should really
; alert...
DOSFAIL:
MOVEQ #RETURN_FAIL,D0
RTS
* Data declarations
* ------------------------------------------------
DOSName DOSNAME;
CLS DC.B $9B,'H',$9B,'J' ; HOME, CLEAR TO END OF SCREEN
END