source: buchla-68k/iolib/setipl.s@ b28a12e

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

Converted assembly language files.

  • Property mode set to 100644
File size: 1.1 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 #0xF8FF,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 #0x7,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.