From 6573e6951142baf66192e7743893fda8dcc65f96 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20Fr=C3=B6schle?= Date: Tue, 13 Aug 2013 15:20:23 +0000 Subject: [PATCH] add a routine to set interrupt level from C --- BaS_gcc/sources/exceptions.S | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/BaS_gcc/sources/exceptions.S b/BaS_gcc/sources/exceptions.S index ba56f5e..1b0298a 100644 --- a/BaS_gcc/sources/exceptions.S +++ b/BaS_gcc/sources/exceptions.S @@ -1001,3 +1001,29 @@ video_chg_end: lea 7 * 4(sp),a7 rte + +asm_set_ipl: +_asm_set_ipl: + link a6,#-8 // some space for locals + movem.l d6-d7,(sp) // save register + move.w sr,d7 // current sr + + move.l d7,d0 // prepare return value + andi.l #0x0700,d0 // maks out ipl bits + lsr.l #8,d0 // IPL + + move.l 8(a6),d6 // get argument + andi.l #0x07,d6 // least significant three bits + lsl.l #8,d6 // shift to make mask + + andi.l #0x0000f8ff,d7 // zero out current ipl + or.l d6,d7 // place new ipl in sr + move.w d7,sr + + movem.l (sp),d6-d7 // restore registers + lea 8(sp),sp // clear local variables + unlk a6 + + rts + +