source: trunk/minix/lib/i86/em/em_trp.s@ 10

Last change on this file since 10 was 9, checked in by Mattia Monga, 14 years ago

Minix 3.1.2a

File size: 1.7 KB
RevLine 
[9]1.define .trpdivz
2.define .trpilin
3.define .trpcase
4.define .trprang
5.define .trpset
6.define .trpnofp
7.define .trpheap
8.define .trp
9
10.bss
11.M: .zerow 24/2
12
13.text
14.extern .trpdivz
15.extern .trpilin
16.extern .trpcase
17.extern .trprang
18.extern .trpset
19.extern .trpnofp
20.extern .trpheap
21.extern .trp
22
23.trpdivz:
24mov ax,#6
25mov dx,#.Mdivz
26jmp .Trp
27.trpilin:
28mov ax,#18
29mov dx,#.Milin
30jmp .Trp
31.trpcase:
32mov ax,#20
33mov dx,#.Mcase
34jmp .Trp
35.trprang:
36mov ax,#1
37mov dx,#.Mrang
38jmp .Trp
39.trpset:
40mov ax,#2
41mov dx,#.Mset
42jmp .Trp
43.trpnofp:
44mov ax,#18
45mov dx,#.Mnofp
46jmp .Trp
47.trpheap:
48mov ax,#17
49mov dx,#.Mheap
50jmp .Trp
51
52.Trp:
53xor bx,bx
54.extern .trppc
55xchg bx,.trppc
56test bx,bx
57jz 2f
58push ax
59call (bx)
60pop ax
61ret
622:
63mov bx,#22
64push bx
65push dx
66mov ax,#2
67push ax
68call .Write
69call __exit
70
71.trp:
72mov dx,ax
73cmp dx,#21
74jae 1f
75sal dx,#1
76mov bx,#.Mtable
77add bx,dx
78mov bx,(bx)
79test bx,bx
80jz 1f
81mov dx,bx
82jmp 2f
831:
84mov bx,#.Mtrp+14
85mov cx,#6
86mov dx,ax
871:
88and dx,#7
89add dx,'0'
90movb (bx),dl
91dec bx
92sar dx,#1
93sar dx,#1
94sar dx,#1
95loop 1b
96mov dx,#.Mtrp
972:
98jmp .Trp
99
100.Write:
101push bp
102mov bp,sp
103mov .M+2,#4
104mov bx,4(bp)
105mov .M+4,bx
106mov bx,8(bp)
107mov .M+6,bx
108mov bx,6(bp)
109mov .M+10,bx
110mov ax,#.M
111push ax
112mov ax,#1
113push ax
114
115mov ax,#1
116mov bx,#.M
117mov cx,#3
118int 32
119mov sp,bp
120pop bp
121ret
122
123
124.data
125.Mtable:
126 .data2 0, .Mrang, .Mset, 0, 0, 0, .Mdivz, 0
127 .data2 0, 0, 0, 0, 0, 0, 0, 0
128 .data2 0, .Mheap, .Milin, .Milin, .Mcase
129
130.Mdivz: .asciz "Error: Division by 0 \n"
131.Milin: .asciz "Illegal EM instruct'n\n"
132.Mcase: .asciz "Err in EM case instr \n"
133.Mrang: .asciz "Variable out of range\n"
134.Mset: .asciz "Err in EM set instr \n"
135.Mnofp: .asciz "Floating pt not impl.\n"
136.Mheap: .asciz "Heap overflow \n"
137
138.Mtrp: .asciz "EM trap 0000000 octal\n"
Note: See TracBrowser for help on using the repository browser.