source: buchla-68k/orig/IOLIB/SETIPL.S@ 4f508e6

Last change on this file since 4f508e6 was 3ae31e9, checked in by Thomas Lopatic <thomas@…>, 8 years ago

Imported original source code.

  • Property mode set to 100755
File size: 1.2 KB
Line 
1*
2* setipl.s -- Set internal processor interrupt level
3* -------- --------------------------------------
4* Version 2 -- 1988-06-29 -- D.N. Lynx Crowe
5*
6* short
7* setipl(arg);
8* short arg;
9*
10* Sets processor interrupt level to arg.
11* Returns old interrupt level, or -1 if arg < 0 or > 7
12*
13* Assumes you are in supervisor mode.
14* You get a Privelege Violation TRAP if you aren't.
15*
16 .text
17*
18 .xdef _setipl
19*
20_setipl: link a6,#0 * Link up stack frames
21 move.w 8(a6),d0 * Get argument
22 tst.w d0 * Check lower limit
23 bmi setipler * Jump if < 0 (error)
24*
25 cmpi.w #7,d0 * Check upper limit
26 bgt setipler * Jump if > 7 (error)
27*
28 move.w sr,d1 * Get current level
29 move.w d1,d2 * ... save for later
30 lsl.w #8,d0 * Shift argument into position
31 andi.w #$F8FF,d1 * Mask out old level
32 or.w d0,d1 * OR in new level
33 move.w d2,d0 * Setup return of old level
34 lsr.w #8,d0 * ...
35 andi.l #$7,d0 * ...
36 move.w d1,sr * Set the new interrupt level
37 unlk a6 * Unlink stack frames
38 rts * Return to caller
39*
40setipler: moveq.l #-1,d0 * Setup to return error code
41 unlk a6 * Unlink stack frames
42 rts * Return to caller
43*
44 .end
Note: See TracBrowser for help on using the repository browser.