-
Notifications
You must be signed in to change notification settings - Fork 1
/
netusbee_int.S
80 lines (74 loc) · 2.17 KB
/
netusbee_int.S
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
/*
* NetUSBee USB driver for TOS
*
* Modified for TOS-only version of NetUSBee
* Copyright (C) 2018 Roger Burrows
*
* Parts of this code are derived from the Lightning VME driver by
* Ingo Uhlemann & Christian Zietz, and from:
*
* NetUSBee USB driver for FreeMiNT.
* Modified for USB by David Galvez. 2010 - 2011
*
* Copyright (c) 2007 Henrik Gilda.
*
* This file is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This file is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
*
* Low level and interrupt routines for the NetUSBee driver
*
* 2005-02-12 Henrik Gilda
* 2000-08-02 Frank Naumann
* 2000-03-24 Vassilis Papathanassiou
*
*
*/
.globl _set_old_int_lvl
.globl _set_int_lvl6
.globl _fake_ikbd_int
.text
oldSR: ds.w 1
// Sets interrupt level to what was in the SR
_set_old_int_lvl:
andi.w #0x0f00,oldSR //just keep the int lvl
move.w d0,-(sp) //save reg
move.w sr,d0
andi.w #0xf0ff,d0 //remove current int lvl
or.w oldSR,d0 // & wedge old one in
move.w d0,sr
move.w (sp)+,d0 //restore reg
rts
// Sets interrupt level to 6
_set_int_lvl6:
move.w d0,-(sp) //save reg
move.w sr,d0
move.w d0,oldSR
andi.w #0xf0ff,d0 //remove current int lvl
ori.w #0x0600,d0 // & wedge new one in
move.w d0,sr
move.w (sp)+,d0 //restore reg
rts
// calls the keyboard/MIDI handler as though an interrupt has occurred
_fake_ikbd_int:
tst.w 0x59e.w //handle 68000/68030 difference
beq.b shortframe
move.w #0x118,-(sp) //push vector offset
shortframe:
pea retaddr(pc) // return address
move sr,-(sp) // and SR
move.l 0x118,a0
jmp (a0) //go to interrupt handler
retaddr: // (returns here)
rts