aboutsummaryrefslogtreecommitdiff
path: root/panic.asm
blob: 5076174e582310f342c9af9940f0e21a1404d1ee (plain)
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
81
82
83
84
85
86
87
88
89
90
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: