
*****************************************************************************
* Project Details                                                           *
* ---------------                                                           *
* Project Name:    CS (Clear Screen)                                        *
* Project Version: 1                                                        *
* Copyright:       Anthony N Peck                                           *
* Date:            Sunday 28th May 1995                                     *
*                                                                           *
* Contact:                                                                  *
* 68 Woralul ST                                                             *
* Waramanga ACT 2611                                                        *
* AUSTRALIA                                                                 *
*                                                                           *
* E-Mail: Anthony.Peck@Radford.act.edu.au                                   *
*                                                                           *
*****************************************************************************
* Project Summary:                                                          *
* ---------------                                                           *
*                                                                           *
* Usage: CS                                                                 *
*                                                                           *
* Simply clears the screen by writing a "CONTROL L" character to the CLI or *
* Shell window.  As opposed to my normal modus operandi, this code contains *
* examples of how to save space so that the executable is small (e.g. no    *
* macros in this code).  Instead of the DosBase being saved to a memory     *
* location, it is stored in the A4 register.  All up these savings change   *
* the executable size from an original 166 bytes to the 116 bytes that you  *
* see now.  There is no real advantage to such a saving, but I thought you  *
* might like to see it anyhow!  The program and the source are FREEWARE!    *
*                                                                           *
*****************************************************************************

; Some Quick equivalents...

ExecBase            = $04          ; Exec Base...ahem
Openlibrary         = -$0228       ; Exec function opens libraries
Closelibrary        = -$019e       ; Exec function closes libraries
Write               = -$30         ; Dos function writes to shell
Output              = -$3C         ; Dos function gets output handle

Start:

; Program really starts here...

        MOVE.L  ExecBase,A6        ; Move Exec into A6
        LEA     Dosname,A1         ; Load the dos library
        CLR.L   D0                 ; Any version will do
        JSR     Openlibrary(A6)    ; Jump to open library routine
        BEQ     Exit               ; If there's a problem, close down
        MOVE.L  D0,A4              ; Save DosBase to A4
        JSR     Output(A4)         ; Jump to output routine
        MOVE.L  D0,D1              ; Shift output handle to D1
        MOVE.L  #Clear,D2          ; This is the Clear character
        MOVE.L  #$01,D3            ; it's only one byte in length
        JSR     Write(A4)          ; Jump to the Write routine

; Clean up and finish...

Close:        

        MOVE.L  A4,A1              ; Move Dos Base from A4 to A1
        JSR     Closelibrary(A6)   ; Jump to Close library routine
                                   ; NB: $04 still in A6 from
                                   ;     previous exec call...

Exit:

        CLR.L   D0                 ; Clear D0
        RTS                        ; Return To System

; Memory Allocations

Dosname:

        DC.B    "dos.library",$00  ; dos library name

Clear:  DC.B    $0C                ; Control L (Clear)

        END

