Merge branch 'vim' into feat/code-check
[vim_extended.git] / src / swis.s
blob562747adba8beb1137629e75206e415cb6812bcd
1 ; Thomas Leonard
2 ; 24/5/98
4 ar0 rn 0
5 ar1 rn 1
6 ar2 rn 2
7 ar3 rn 3
8 ar4 rn 4
9 ar5 rn 5
10 ar6 rn 6
11 ar7 rn 7
12 ar10 rn 10
13 ar11 rn 11
14 lk rn 14
15 ar15 rn 15
17 AREA DATA
18 align 4
20 export |r0|
21 r0: dcd 0
23 export |r1|
24 r1: dcd 0
26 export |r2|
27 r2: dcd 0
29 export |r3|
30 r3: dcd 0
32 export |r4|
33 r4: dcd 0
35 export |r5|
36 r5: dcd 0
38 export |r6|
39 r6: dcd 0
41 export |r7|
42 r7: dcd 0
44 export |time_of_last_poll|
45 time_of_last_poll: dcd 0
47 AREA CODE, READONLY
48 align 4
49 import |r0|
50 export |swi|
51 = "swi"
52 align 4
53 swi:
54 ; r0 = swi number
55 stmfd sp!,{ar4-ar10,lk}
56 orr ar10,ar0,#1<<17 ;always use the X form
57 mov ar0,ar1
58 mov ar1,ar2
59 mov ar2,ar3
60 add ar3,sp,#4*8
61 ldmia ar3,{ar3-ar7}
62 swi 0x6f ; OS_CallASWI
63 ldr ar10,regs_addr
64 stmia ar10,{ar0-ar7}
65 ldmvcfd sp!,{ar4-ar10,pc}^
66 ; report the error and quit on Cancel
67 mov r1,#0x17
68 adr r2,s_title
69 swi 0x400df ; Wimp_ReportError
70 cmp r1,#1 ;OK selected?
71 ldmeqfd sp!,{ar4-ar10,pc}^ ;yes - try to continue
72 swi 0x11 ;no - die (OS_Exit)
73 s_title:
74 = "Nasty error - Cancel to quit"
75 = 0
77 align 4
78 export |xswi|
79 = "xswi"
80 align 4
81 xswi:
82 ; r0 = swi number
83 stmfd sp!,{ar4-ar10,lk}
84 orr ar10,ar0,#1<<17 ;always use the X form
85 mov ar0,ar1
86 mov ar1,ar2
87 mov ar2,ar3
88 add ar3,sp,#4*8
89 ldmia ar3,{ar3-ar7}
90 swi 0x6f ; OS_CallASWI
91 ldr ar10,regs_addr
92 stmia ar10,{ar0-ar7}
93 mov ar0,#0
94 orr ar0,ar0,ar15
95 ldmfd sp!,{ar4-ar10,pc}^
97 regs_addr:
98 dcd r0
100 ; The Wimp_Poll swis have to be done specially because,
101 ; for some reason, r13 sometimes gets corrupted by Wimp_Poll
102 ; (eg when running FileFind)
103 AREA CODE, READONLY
104 align 4
105 import |time_of_last_poll|
106 export |wimp_poll|
107 = "wimp_poll"
108 align 4
109 wimp_poll:
110 mov ar3,sp
111 swi 0x400c7 ; Wimp_Poll
112 mov sp,ar3
114 mov ar3,ar0
115 swi 0x42 ; OS_ReadMonotonicTime
116 ldr ar2,addr_time
117 str ar0,[ar2]
118 mov ar0,ar3
120 mov ar2,#0
121 wfs ar2 ; Write floating point status. Needed?
122 movs pc,lk
124 align 4
125 export |wimp_pollidle|
126 = "wimp_pollidle"
127 align 4
128 wimp_pollidle:
129 mov ar3,sp
130 swi 0x400e1 ; Wimp_PollIdle
131 mov sp,ar3
133 mov ar3,ar0
134 swi 0x42 ; OS_ReadMonotonicTime
135 ldr ar2,addr_time
136 str ar0,[ar2]
137 mov ar0,ar3
139 mov ar2,#0
140 wfs ar2 ; Write floating point status. Needed?
141 movs pc,lk
143 addr_time: dcd time_of_last_poll