home *** CD-ROM | disk | FTP | other *** search
- ; Copyright Cornell University 1986. All rights are reserved.
- ; kevin eric saunders
-
- public _setscript
- public _keytron
-
- ; Assembly language interface to the Script Mgr routines we need
- ; to fix the Option E,I,N,U eating behavior of the standard script
- ; The calls are:
- ;
- ; script = GetEnvirons(smKeyScript);
- ; if (!SetScript((int) script, smScriptKeys, (long) EINUSCRIPT) {
- ; KeyScript(script);
- ; }
- ;
- ; shove these values (from MPW glue) onto the stack as routine selectors
- ;
- ; GetEnvirons = $84020008
- ; SetScript = $8208000e
- ; KeyScript = $80020004
- ;
- ;SetScript(scriptnum)
- ;long scriptnum;
-
- _setscript
- link a6,#0
- move.w d4,-(sp) ; save d4
-
- tst.w _keytron
- bne.s abort
-
- sub.w #4,sp ; clear space for result
- move.w #22,-(sp) ; 22 = smKeyScript
- move.l #$84020008,-(sp) ; GetEnvirons selector
- dc.w $a8b5 ; ScriptUtil Trap
- move.l (sp)+,d0 ; pop result
-
- move.w d0,d4 ; save the script #
-
- sub.w #2,sp ; clear space for result
- move.w d0,-(sp) ; push the script # result
- move.w #32,-(sp) ; smScriptKeys
- move.l 8(a6),-(sp) ; select new script table from arg
- move.l #$8208000e,-(sp) ; SetScript selector
- dc.w $a8b5
-
- move.w (sp)+,d0 ; pop result
- tst.w d0
- bne.s abort
-
- move.w d4,-(sp) ; push the script # result
- move.l #$80020004,-(sp) ; keyscript selector
- dc.w $a8b5
- bra.s return
-
- abort
- move.l #-1,d0
-
- return
- move.w (sp)+,d4 ; restore d4
- unlk a6
- rts
-