27. CLS

*------------------------------------------------------------------------------
* NAME          CLS
*------------------------------------------------------------------------------
* DEPENDENCY    None
* PURPOSE       To clear a screen/console channel.
* DESCRIPTION   Clears the screen channel whose ID is supplied in A0.
* INPUTS :
*               A0.L = channel ID
* OUTPUTS :
*               D0 = Error code
*               A0.L = channel ID (preserved)
*               Z flag set if no errors, unset otherwise.
*------------------------------------------------------------------------------
cls             move.l   d1/d3/a1,-(a7) ; These will be corrupted by SD_CLEAR
                moveq    #sd_clear,d0   ; CLS (SD_CLEAR defined in GWASL)
                moveq    #-1,d3         ; Infinite timeout
                trap     #3             ; CLS the window
                move.l   (a7)+,d1/d3/a1 ; Restore corrupted registers
                tst.l    d0             ; Set Z flag if all ok, else not set
                rts