*************************************************************** * * * GnoP8 1.0 * * Author Date Compiler * * Kelvin Sherlock March 1997 Orca/M 2.1 * * Copyright 1997. All Rights reserved * * * * This is a finder extra to stop people from running p8 * * applications from Finder 6.0 when GNO/ME is active * * If you've ever tried launching prodos 8 applications * * while GNO/ME was active, you'll probably remember that * * it didn't work so well. * * * *************************************************************** mcopy GnoP8.macros copy 13/ainclude/e16.finder copy 13/ainclude/e16.locator Startup start using Globals phb phk plb sta MyID ;;A has ID on entry pha _QDVersion pla and #$0fff cmp #$0307 bcc bad_env pea MyStr|-16 pea MyStr lda MyID pha pea ReqProc|-16 pea ReqProc _AcceptRequests plb rtl bad_env anop ;;tell loader to unload us plb lda 4,S bne quit_now ora #$0001 sta 4,S quit_now rtl startup end ************************************* Globals data MyID ds 2 MyStr pstr 'Kelvin~GnoP8~' errmsg dc c'54~Since GNO/ME is active, running a ProDOS 8 ' dc c'application wouldn' dc i1'$D5' ;;fancy ' dc c't be a good idea.~Oh yeah!' dc i1'0' ;;c string Globals end ReqProc start *************************************************************** * This is our request handler * * entry exit * |--------------------| |--------------------| * | result | 14,S | result | * |--------------------| |--------------------| * | request code | 12,S | RTL (3 bytes) | * |--------------------| |- -| * | dataIn | | | * |- -| |--------------------| * | | 8,S sp * |--------------------| * | dataOut | * |- -| * | | 4,S * |--------------------| * | RTL (3 bytes) | * |- -| * | | 1,S * |--------------------| * sp * *************************************************************** using Globals p8 equ $FF reqCode equ $0C result equ $0E dataIn equ $08 dataOut equ $04 udispatch equ $e10008 kernStatus equ $0603 ToolNotFound equ $0001 tsc phd ;;save old dpage tcd ;;set dpage lda reqCode cmp #finderSaysBeforeOpen beq PreventAction cmp #finderSaysOpenFailed beq PreventAction cmp #srqGoAway bne QuitNow * * Goodbye! * ldy #2 lda MyID sta [dataOut],y iny iny lda #$8000 ;restartable sta [dataOut],y pea MyStr|-16 pea MyStr lda MyID pha pea 0 pea 0 _AcceptRequests lda #$8000 sta result * result is prezeroed, so I just restore the old dp and * fix the stack to deny a request QuitNow anop lda $1 ;;fix rtl address sta $0B lda $2 sta $0C pld ;;restore dp tsc ;;fix the stack clc adc #10 tcs rtl PreventAction anop * first, we check the filetype ldy #$000A ;;offset for filetype lda [dataIn],y cmp #p8 bne QuitNow * to check if GNO is active, we call the user tool KernStatus * implemented by GNO. If GNO is NOT active, the Tool Locator will * give us an error (ToolNotFound). If GNO is active, there won't be * an error. See page 7 of the GNO Kernel Reference Manual for more info. pha ldx #kernStatus jsl udispatch plx ;;result cmp ToolNotFound ;;A still has error code beq QuitNow ;;if Gno's not active * it's p8, and gno is active! *show our pretty alert message pha ;;space for result lda #$0000 pha ;;flags - ptr, cstring pha ;;null substr ptr pha pea errmsg|-16 ;;the cstring pea errmsg _AlertWindow pla ;;discard the result lda #$8000 sta result ;;tell finder we took care of it bra QuitNow ReqProc end