-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtrap.txt
188 lines (142 loc) · 7.6 KB
/
trap.txt
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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
```
- TRAP EXCEPTION MANAGER MANUAL -
==============================================================================
・TRAP 例外処理一覧
trap #0 User definition (Ko-Window)
trap #1 〃 (bgdrv, mpcm)
trap #2 〃 (pcm8*)
trap #3 〃 (zmusic, zmsc3, middrv)
trap #4 〃 (mxdrv, madrv, mld, mcdrv, mndrv)
trap #5 〃 (cdc)
trap #6 〃
trap #7 〃
trap #8 Break point (ROM debugger)
trap #9 〃 (db、scd)
trap #10 Reset / field off processing
trap #11 BREAK key processing
trap #12 COPY key processing
trap #13 CTRL+C processing
trap #14 Error handling
trap #15 IOCS call
※ In ether_ne.sys, one of trap # 0 to # 6 is used (sometimes not used).
Also, inetd · hinetd · xip uses one of trap # 0 to # 7 (it may not be used).
==============================================================================
・trap #10 Reset / field off processing
Arg d0.l = $58363801('X68'<<8+1) Power off by front switch
$58363802('X68'<<8+2) Power off by external switch
$58363803('X68'<<8+3) Power off with soft switch
Other than those above Software reset
It is called from the power off interrupt and keyboard processing, or
from the user program, and performs power off and reset processing by software.
It is hooked at Human 68k startup, it will not be executed immediately even if
it is called during DOS call execution, and it will be called after it ends.
==============================================================================
・trap #11 BREAK key processing
Arg d0.b Shift key status
Called from the keyboard process when the BREAK key is pressed.
However, it is ignored while executing disk related IOCS of $40 to $4f.
It is hooked at Human 68k startup, it will not be executed immediately even if it is called during DOS call execution, and it will be called after it ends.
If you press the BREAK key without pressing SHIFT, trap # 13 is also executed after trap # 11.
Since multiple calls are not made, there is no need to have a reentrant structure.
==============================================================================
・trap #12 COPY key processing
Arg d0.b Shift key status
When the COPY key is pressed, it is called from the keyboard processing and
performs the hard copy processing of the screen. Since multiple calls are not
made, there is no need to have a reentrant structure.
The following operations are performed depending on the shift key state.
COPY Reduced copy (1 color)
SHIFT + COPY Enlarged copy (1 color)
CTRL + COPY Enlarged copy (4 colors)
OPT.1 + COPY FF output.
OPT.2 + COPY LF 〃
==============================================================================
・trap #13 CTRL + C processing
Called from the keyboard process when CTRL + C and BREAK keys are entered.
Usually routines that do not do anything are registered, so they can be used by users.
==============================================================================
・trap #14 Error handling
Arg d7.w Error number
a5.l String address (only for d7.w = $??00)
Ret d7.b 1: Rerun 2: Ignore
Immediately after startup, it waits for key input and restarts by software reset, but after Human 68k is started it is hooked and replaced with a routine that displays the white band and waits for the user's response.
If the system detects an error, it sets error number in d7.w and executes trap #14.
In this error processing routine, after outputting a message according to the type of error, it sets 1 (reexecution) or 2 (ignore) to d7.b by input from the keyboard and returns.
If abort is specified, abort immediately and do not return to where trap # 14 was executed.
・Error number
$00xx CPU exception processing / unregistered interrupt (stop only)
The lower byte is the vector number.
$0002 Bus error occurred
$0003 An address error occurred
$0004 I executed a funny instruction
$0005 Divided by 0
$0006 Executed CHK instruction
$0007 Execute the TRAPV instruction
$0008 Executed privileged instruction
$001f Interrupt switch pressed
$01xx Unregistered IOCS call
The lower byte is the IOCS call number.
It is also called when using a call to SASI that can only be performed on FD, or vice versa.
$02xx〜$0fxx Reservation
$10xx〜$1fxx Error (cancellation only)
$20xx〜$2fxx Error (re-execute only)
$30xx〜$3fxx Error (Rerun & Abort)
$301f Interrupt switch pressed
$40xx〜$4fxx Error (Ignored only)
$50xx〜$5fxx Error (Ignored & Canceled)
$60xx〜$6fxx Error (ignore & re-execute)
$70xx〜$7fxx Error (ignore & re-execute & cancel)
$80xx〜$efxx Reservation
$f0xx〜$fdxx Interrupt other than F series DOS call (stop only)
$fexx Floating-point arithmetic package not built in (stop only)
$ffxx Unregistered DOS call
In Human 68k version 3.0x, unregistered DOS calls only return -1, so error handling is not invoked.
There are two error numbers when the interrupt switch is pressed, $ 001f and $ 003f, but usually the latter is used.
The error number of $ 1000 to $ 7fff corresponds to abort, reexecution, ignoring, respectively, of the upper byte of bits 4, 5 and 6. The contents of the lower byte at this time are as follows.
$00 User defined (put a character string address in a5.l).
$01 An invalid unit number was specified.
$02 There is no disc in it.
$03 An invalid command was specified for the device driver.
$04 CRC error.
$05 Disk management area is destroyed.
$06 Seek error.
$07 Invalid media.
$08 Sector can not be found.
$09 Printer is not connected.
$0a Write error.
$0b Error loading.
$0c Other errors.
$0d Write protect (remove protect and put the same disc).
$0e Unable to write.
$0f File sharing violation.
When the low byte is 0, the user can specify the character string to be displayed.
The address of the character string is passed in a5.l and the character string must be not more than 52 display width.
However, when returning it as an error code of the device driver, if the lower byte (3rd byte from the head of the request header) is 0, it is handled as normal termination and it is impossible to pass the address of the character string, so this function can not be used.
==============================================================================
・trap #15 IOCS processing
Arg d0.b IOCS call number
Execute IOCS.
During execution, the IOCS call number is stored in one word from IOCS work $a0e (upper byte is always 0).
Arguments and return values other than d0.b differ depending on the call number
To speed up the IOCS call, execute the shortcut call by the following method.
However, it must be in supervisor state.
movea.l (IOCS call number *4+$400),a0
jsr (a0)
Each function of IOCS is created as a subroutine returning with rts.
Although there is no problem in destroying a0.l (from the viewpoint of the user, there is no guarantee that it will be saved when shortcutting), do not destroy other registers that do not pass Ret.
How to handle vector base register vbr:
With X 68030 (ROM IOCS version 1.3), you can use vbr, except those calling routines in ROM directly for some IOCS calls.
First, after confirming that the following vectors are standard vectors pointing to inside the ROM, change to the value obtained by subtracting 2 from each setting address.
Next, change the processing address of unused interrupts (one with the highest byte of the processing address not equal to 0) among them to $ 00ff0770.
Naturally you have to create the correct address table at the point pointed to by vbr.
trap # 15 (IOCS processing address table is also changed to vbr + $400)
IOCS _FNTGET
IOCS _OPMINTST
IOCS _TIMERDST
IOCS _VDISPST
IOCS _CRTCRAS
IOCS _HSYNCST
IOCS _PRNINTST
IOCS _B_INTVCS
==============================================================================
```