***************************************************************** * * * Scrappy v 1.1 * * Copyright 1997 Kelvin Sherlock * * ALL RIGHTS RESERVED. * * * * For ORCA/M assembler * * * * * * * * * Nov 27th, 1997: * * Finalized copy routines * * * * August 27th, 1997 * * Squashed an output bug * * * * May 20th, 1997: * * Initial version. * * * ***************************************************************** mcopy scrappy.mac case on scrappy start Scrappy MyID equ 0 CmdPtr equ 2 Scrap equ 6 Length equ 10 phk plb sta MyID sty CmdPtr stx CmdPtr+2 ldy #8 loop anop iny lda [CmdPtr],y and #$00ff beq NoFlag cmp #'-' beq GotFlag bra loop NoFlag anop ;;just paste it brl DoHelp GotFlag anop ;;determine the flag iny lda [CmdPtr],y and #$00ff beq DoHelp cmp #'V' beq DoHelp cmp #'h' beq DoHelp cmp #'v' beq DoPaste cmp #'p' beq DoPaste cmp #'z' beq DoZero cmp #'c' bne DoHelp brl DoCopy ;; DoHelp ;; ;; Writes Help info to Stderr and exits ;; DoHelp anop ~ErrWriteCString #HelpTxt brl Quit ;;a=0 if ok ;; DoZero ;; ;; Zeros the scrap and exits ;; DoZero anop _ZeroScrap brl Quit ;;a=0 if ok ;; DoPaste ;; ;; Pastes the clipboard to stdout and exits ;; DoPaste anop pha pha pea $0000 ;text scrap _GetScrapHandle plx stx Scrap plx stx Scrap+2 bcc no_err ;still set ( or not ) cmp #$1610 ;BadScrapType - No scrap available bne st_err ~ErrWriteCString #No_Txt lda #1 ;error! brl Quit st_err anop ;generic error (not likely) ~ErrWriteCString #Err_Txt lda #1 ;error brl Quit no_err anop pha ;;space pha ~GetHandleSize