summaryrefslogtreecommitdiffstats
path: root/Bachelor/Mikroprozessorsysteme2/mi2/Termin5/swi.S
diff options
context:
space:
mode:
Diffstat (limited to 'Bachelor/Mikroprozessorsysteme2/mi2/Termin5/swi.S')
-rw-r--r--Bachelor/Mikroprozessorsysteme2/mi2/Termin5/swi.S34
1 files changed, 34 insertions, 0 deletions
diff --git a/Bachelor/Mikroprozessorsysteme2/mi2/Termin5/swi.S b/Bachelor/Mikroprozessorsysteme2/mi2/Termin5/swi.S
new file mode 100644
index 0000000..09d5cc4
--- /dev/null
+++ b/Bachelor/Mikroprozessorsysteme2/mi2/Termin5/swi.S
@@ -0,0 +1,34 @@
+@----------------------------------------------------------------------------
+@ File Name : swi.S
+@ Object : SoftwareInterruptHandler
+@
+@ 1.0 27/10/02 GR : Creation
+@
+@----------------------------------------------------------------------------
+
+
+ .global SWIHandler
+ .text
+SWIHandler:
+
+ ldr sp, STACK @ den Wert von STACK (0x78c) auf sp kopieren
+ stmfd sp!, {lr} @ retten der Rücksprungadresse
+ ldr ip,[r14, #-4] @ hole "swi X" Aufruf in ip (lr steht auf Aufruf nach swi Befehl im aufrufenden Programm)
+ bic ip, ip, #0xff000000 @ maskiere X aus und speichere in ip
+ mov ip, ip, lsl #2 @ X ist in ip, X * 4 (entspricht lsl #2) ist Offset des swi
+ ldr lr, =SWIJumpTable @ Lade Adresse von SWIJumpTable in lr
+ ldr ip, [lr, ip] @ Addiere ip (Offset des SWI) zu Adresse SWIJumpTable und speichere in ip
+ mov lr, pc @ Speichere pc in lr für Rücksprung
+ mov pc, ip @ Lade ip nach pc, entspricht Sprung in jeweilige SWI-Routine
+ ldmfd sp!, {pc}^ @ Rücksprung
+STACK:
+ .word 0x78c
+
+SWIJumpTable:
+ .word init_ser
+ .word putchar
+ .word getchar
+.end
+
+
+