aboutsummaryrefslogtreecommitdiff
path: root/panic.asm
diff options
context:
space:
mode:
authorDavid <dbphillipsnz@gmail.com>2013-07-19 11:47:17 +1200
committerDavid <dbphillipsnz@gmail.com>2013-07-19 11:47:17 +1200
commit3155f0ec7fb015225c6ae42f782b8c25f2d79f88 (patch)
tree318f786dee38947393dfc4cf602923603dac8cb9 /panic.asm
parenta7b1b157fc118a6e7d4f88f9a057101ca9c54e1a (diff)
downloadjaspos-3155f0ec7fb015225c6ae42f782b8c25f2d79f88.tar.xz
Committed
Diffstat (limited to 'panic.asm')
-rw-r--r--panic.asm91
1 files changed, 91 insertions, 0 deletions
diff --git a/panic.asm b/panic.asm
new file mode 100644
index 0000000..5076174
--- /dev/null
+++ b/panic.asm
@@ -0,0 +1,91 @@
+jaspos.panic:
+ ; Quick! Save state of registers before perhaps
+ ; accidentally corrupting them while printing
+ push sp
+ push bp
+ push di
+ push si
+
+ push gs
+ push ss
+ push es
+ push ds
+ push cs
+
+ push dx
+ push cx
+ push bx
+ push ax
+
+ push msgPanic ; Show a panic message
+ call jaspos_monitor_dispstring ; ... Then halt (see lines below)
+
+ push msgAX
+ call jaspos_monitor_dispstring
+ pop ax
+ call .printax
+ push msgBX
+ call jaspos_monitor_dispstring
+ pop ax
+ call .printax
+ push msgCX
+ call jaspos_monitor_dispstring
+ pop ax
+ call .printax
+ push msgDX
+ call jaspos_monitor_dispstring
+ pop ax
+ call .printax
+
+ push msgCS
+ call jaspos_monitor_dispstring
+ pop ax
+ call .printax
+ push msgDS
+ call jaspos_monitor_dispstring
+ pop ax
+ call .printax
+ push msgES
+ call jaspos_monitor_dispstring
+ pop ax
+ call .printax
+ push msgSS
+ call jaspos_monitor_dispstring
+ pop ax
+ call .printax
+ push msgGS
+ call jaspos_monitor_dispstring
+ pop ax
+ call .printax
+
+ push msgSI
+ call jaspos_monitor_dispstring
+ pop ax
+ call .printax
+ push msgDI
+ call jaspos_monitor_dispstring
+ pop ax
+ call .printax
+ push msgBP
+ call jaspos_monitor_dispstring
+ pop ax
+ call .printax
+ push msgSP
+ call jaspos_monitor_dispstring
+ pop ax
+ call .printax
+
+ jmp .end
+
+.printax:
+ mov [free_ram + 4], byte 0
+ push free_ram + 3
+ push ax
+ call jaspos_strutils_hex2str
+ push msg0x
+ call jaspos_monitor_dispstring
+ push free_ram
+ call jaspos_monitor_dispstring
+ ret
+
+.end: \ No newline at end of file