File: libti68k.html

package info (click to toggle)
libti68k 1.4.2-6
  • links: PTS
  • area: main
  • in suites: woody
  • size: 3,252 kB
  • ctags: 3,111
  • sloc: ansic: 32,548; sh: 9,077; makefile: 437; sed: 93
file content (381 lines) | stat: -rw-r--r-- 18,379 bytes parent folder | download
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
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
<head>
   <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
   <meta name="Author" content="Corvazier Thomas">
   <meta name="GENERATOR" content="Mozilla/4.72 [fr] (X11; U; Linux 2.2.14-5.0 i686) [Netscape]">
   <title>Lib68k specification</title>
</head>
<body>

<center><u><font size=+3>LIB68K SPECIFICATION</font></u></center>

<p><a href="#members">1) Members</a>
<br><a href="#basic">2) Basic routines</a>
<br><a href="#debugging">3) Debugging routines</a>
<br><a href="#low level">4) Low level access</a>
<br>&nbsp;
<p><a NAME="members"></a><u><font size=+2>1) Members</font></u>
<p><font color="#000000"><a href="#1">int initLib68k(void)</a></font>
<br><font color="#000000"><a href="#2">int closeLib68k(void)</a></font>
<br><font color="#000000"><a href="#3">int loadRom(const char *romname)</a></font>
<br><font color="#000000"><a href="#4">int doInstructions(int n)</a></font>
<br><font color="#000000"><a href="#5">int getCalc(void)</a></font>
<br><font color="#000000"><a href="#6">const char* romVersion(void)</a></font>
<br>
<hr width="100%">
<br><font color="#000000"><a href="#a">int disasm(int addr,char *output)</a></font>
<br><font color="#000000"><a href="#b">int setBreakpointAddress(int address)</a></font>
<br><font color="#000000"><a href="#range">int setBreakpointRange(int addressMin,int
addressMax,int mode)</a></font>
<br><font color="#000000"><a href="#c">int setBreakpointAccess(int address,
int mode)</a></font>
<br><font color="#000000"><a href="#d">void setBreakpointVector(int id)</a></font>
<br><font color="#000000"><a href="#e">int setBreakpointTrap(int trap)</a></font>
<br><font color="#000000"><a href="#j">void getBreakpointCause(int *type,int
*id,int *mode)</a></font>
<br><font color="#000000"><a href="#f">void delBreakpointAddress(int address)</a></font>
<br><font color="#000000"><a href="#g">void delBreakpointAccess(int id)</a></font>
<br><font color="#000000"><a href="#delrange">void delBreakpointAccessRange(int
id)</a></font>
<br><font color="#000000"><a href="#h">void delBreakpointVector(int id)</a></font>
<br><font color="#000000"><a href="#i">void delBreakpointTrap(int id)</a></font>
<p>
<hr width="100%">
<br><font color="#000000"><a href="#7">void setDataRegister(int n,int val)</a></font>
<br><font color="#000000"><a href="#8">void setAddressRegister(int n,int
val)</a></font>
<br><font color="#000000"><a href="#9">void setSpRegister(int val)</a></font>
<br><font color="#000000"><a href="#10">void setPcRegister(int val)</a></font>
<br><font color="#000000"><a href="#11">void setSrRegister(int val)</a></font>
<br><font color="#000000"><a href="#12">void setFlagRegister(unsigned char
flag)</a></font>
<br><font color="#000000"><a href="#13">int getDataRegister(int n)</a></font>
<br><font color="#000000"><a href="#14">int getAddressRegister(int n)</a></font>
<br><font color="#000000"><a href="#15">int getSpRegister(void)</a></font>
<br><font color="#000000"><a href="#16">int getPcRegister(void)</a></font>
<br><font color="#000000"><a href="#17">int getSrRegister(void)</a></font>
<br><font color="#000000"><a href="#19">unsigned char getFlagRegister(void)</a></font>
<br><font color="#000000"><a href="#21">void* getRam(void)</a></font>
<br><font color="#000000"><a href="#20">void* getRom(void)</a></font>
<br><font color="#000000"><a href="#21">void* getLcdmem(void)</a></font>
<br><font color="#000000"><a href="#contrast">char getContrast(void)</a></font>
<br><font color="#000000"><a href="#22">void setActiveKey(int key,int active)</a></font>
<br>&nbsp;
<p><a NAME="basic"></a><u><font size=+2>2) Basic routines</font></u>
<p><a NAME="1"></a><i><font color="#FF0000"><font size=+1>int initLib68k(void)</font></font></i>
<p><font color="#000000">This function must be called first. It allocates
memory buffer and makes some initilisation.</font>
<br><font color="#000000"><b>Return : </b>zero if initialisation is unsuccessfull
otherwise non-zero.</font>
<br><font color="#000000"><b>Implementation : </b>bugs fixed</font>
<br>
<hr width="100%">
<p><a NAME="2"></a><i><font color="#FF0000"><font size=+1>int closeLib68k(void)</font></font></i>
<p><font color="#000000">This function must be called in the end of the
program.</font>
<br><font color="#000000"><b>Return</b> : zero if unsuccessfull otherwise
non-zero.</font>
<br><font color="#000000"><b>Implementation</b> : bugs fixed</font>
<br>
<hr width="100%">
<p><a NAME="3"></a><i><font color="#FF0000"><font size=+1>int loadRom(const
char *romname)</font></font></i>
<p><font color="#000000">Load a rom file, make necessary CPU initialisation
and use it by default. The rom file can be one of those format : *.tib,
*.rom, *.9xu.</font>
<br><font color="#000000"><b>Romname : </b>file name in current directory
or complete file path.</font>
<br><font color="#000000"><b>Return</b> : zero if unsuccessfull otherwise
non-zero.</font>
<br><b>Implementation</b> : not really finished yet =). It works fine with
ti92 rom x.x, ti92plus rom 1.x (not rom 2.x) and ti89 rom 1.0.
<p>
<hr width="100%">
<p><a NAME="4"></a><i><font color="#FF0000"><font size=+1>int doInstructions(int
n)</font></font></i>
<p><font color="#000000"><b>n</b> : number of cpu instruction.</font>
<br><font color="#000000"><b>Return</b> : zero if a breakpoint had been
called otherwise non-zero.</font>
<br><font color="#000000"><b>Implementation</b> : bugs fixed</font>
<p>
<hr width="100%">
<p><a NAME="5"></a><i><font color="#FF0000"><font size=+1>int getCalc(void)</font></font></i>
<p>Call this function to retrieve the type of the current calculator.
<br><b>Return</b> : a flag. Here are the bit mask :
<br>&nbsp;&nbsp;&nbsp; TI92
<br>&nbsp;&nbsp;&nbsp; TI89
<br>&nbsp;&nbsp;&nbsp; MODULEPLUS
<br><b>Implementation</b> : not finishd, always return TI92 | MODULEPLUS
currently. TODO : find a way to retrieve the calculator type ...
<p>
<hr width="100%">
<p><a NAME="6"></a><i><font color="#FF0000"><font size=+1>const char* romVersion(void)</font></font></i>
<p><b>Return</b> : a pointer to a string contening information about rom
version.
<br><b>Implementation</b> : NOT IMPLEMENTED YET
<br>&nbsp;
<br>&nbsp;
<p><a NAME="debugging"></a><u><font size=+2>3) Debugging routines</font></u>
<p><a NAME="a"></a><i><font color="#FF0000"><font size=+1>int disasm(int
addr,char *output)</font></font></i>
<p><font color="#000000">Dissasemble an instruction located at the specified
address.</font>
<br><font color="#000000"><b>addr</b> : address of the instruction.</font>
<br><font color="#000000"><b>output</b> : address of a string for storing
instruction (50 characters should be enough).</font>
<br><b>Return</b> : size of instruction (0 if it is an illegal instruction
or if address is not valid).
<br><b>Implementation</b> : not finished yet, should not work correctly
with illegal instruction and invalid address.
<p>
<hr width="100%">
<p><a NAME="b"></a><i><font color="#FF0000"><font size=+1>int setBreakpointAddress(int
address)</font></font></i>
<p><font color="#000000">Activate a breakpoint at the specified address.
Cause the end of doInstruction function when PC==address.</font>
<br><font color="#000000"><b>address</b> : address of code breakpoint.</font>
<br><font color="#000000"><b>Return</b> : breakpoint id : -1 means that
the breakpoint could not be set.</font>
<br><b>Implementation </b>: maybe some bugs with intlist ...
<p>
<hr width="100%">
<p><a NAME="range"></a><i><font color="#FF0000"><font size=+1>int setBreakpointRange(int
addressMin,int addressMax,int mode)</font></font></i>
<p><font color="#000000">Activate a breakpoint at the specified address.
Cause the end of doInstruction function when PC==address.</font>
<br><font color="#000000"><b>address</b> : address of code breakpoint.</font>
<br><font color="#000000"><b>mode</b> : it must be one of these values
:</font>
<br><font color="#000000">&nbsp;&nbsp;&nbsp; BK_READ</font>
<br><font color="#000000">&nbsp;&nbsp;&nbsp; BK_WRITE</font>
<br><font color="#000000"><b>Return</b> : breakpoint id : -1 means that
the breakpoint could not be set.</font>
<br><b>Implementation </b>: maybe some bugs with intlist ...
<p>
<hr width="100%">
<p><a NAME="c"></a><i><font color="#FF0000"><font size=+1>int setBreakpointAccess(int
address, int mode)</font></font></i>
<p><font color="#000000">Activate a breakpoint when the CPU try to write
or read a byte/word/long word at the specified address.</font>
<br><font color="#000000"><b>address</b> : address of code breakpoint.</font>
<br><font color="#000000"><b>mode</b> : it must be one of these values
:</font>
<br><font color="#000000">&nbsp;&nbsp;&nbsp; BK_READ_BYTE</font>
<br><font color="#000000">&nbsp;&nbsp;&nbsp; BK_READ_WORD</font>
<br><font color="#000000">&nbsp;&nbsp;&nbsp; BK_READ_LONG_WORD</font>
<br><font color="#000000">&nbsp;&nbsp;&nbsp; BK_WRITE_BYTE</font>
<br><font color="#000000">&nbsp;&nbsp;&nbsp; BK_WRITE_WORD</font>
<br><font color="#000000">&nbsp;&nbsp;&nbsp; BK_WRITE_LONG_WORD</font>
<br><font color="#000000"><b>Return</b> : breakpoint id : -1 means that
the breakpoint could not be set.</font>
<br><b>Implementation </b>: should works
<p>
<hr width="100%">
<p><a NAME="d"></a><i><font color="#FF0000"><font size=+1>void setBreakpointVector(int
vector)</font></font></i>
<p>Activate a breakpoint on a CPU exception.
<br><b>vector</b> : should be one of these values :
<br>&nbsp;&nbsp;&nbsp; BK_ADDRESS_ERROR
<br>&nbsp;&nbsp;&nbsp; BK_ILLEGAL_INSTRUCTION
<br>&nbsp;&nbsp;&nbsp; BK_ZERO_DIVIDE
<br>&nbsp;&nbsp;&nbsp; BK_CHK_INSTRUCTION
<br>&nbsp;&nbsp;&nbsp; BK_TRAPV_INSTRUCTION
<br>&nbsp;&nbsp;&nbsp; BK_PRIVILEGE_VIOLATION
<br>&nbsp;&nbsp;&nbsp; BK_TRACE
<br>&nbsp;&nbsp;&nbsp; BK_LINE1010
<br>&nbsp;&nbsp;&nbsp; BK_LINE1011
<br><b>Return</b> : <font color="#000000">breakpoint id : -1 means that
the breakpoint could not be set.</font>
<br><font color="#000000"><b>Implementation</b> : NOT IMPLEMENTED YET,
return -1 every time.</font>
<p>
<hr width="100%">
<p><a NAME="e"></a><i><font color="#FF0000"><font size=+1>int setBreakpointTrap(int
trap)</font></font></i>
<p><font color="#000000">Activate a breakpoint at a specified trap instruction.</font>
<br><font color="#000000"><b>trap</b> : trap number.</font>
<br><font color="#000000"><b>Return</b> : breakpoint id : -1 means that
the breakpoint could not be set.</font>
<br><font color="#000000"><b>Implementation</b> : NOT IMPLEMENTED YET,
return -1 every time.</font>
<p>
<hr width="100%">
<p><a NAME="e"></a><i><font color="#FF0000"><font size=+1>void getBreakpointCause(int
*type,int *id,int *mode)</font></font></i>
<p><font color="#000000">Retrieve the cause which have interrupts doInstructions().</font>
<br><font color="#000000"><b>type : </b>the value<b> </b>returned inshould
be one of these values :</font>
<br><font color="#000000">&nbsp;&nbsp;&nbsp; BK_CAUSE_ACCESS</font>
<br><font color="#000000">&nbsp;&nbsp;&nbsp; BK_CAUSE_ACCESS_RANGE</font>
<br><font color="#000000">&nbsp;&nbsp;&nbsp; BK_CAUSE_ADDRESS</font>
<br><font color="#000000">&nbsp;&nbsp;&nbsp; BK_CAUSE_VECTOR</font>
<br><font color="#000000">&nbsp;&nbsp;&nbsp; BK_CAUSE_TRAP</font>
<br><font color="#000000"><b>id</b> : the breakpoint id returned by setBreakpoint*</font>
<br><font color="#000000"><b>mode</b> : this is used only when type==BK_CAUSE_ACCESS</font>
<br><font color="#000000">In this case, it should be one of these values
:</font>
<br><font color="#000000">&nbsp;&nbsp;&nbsp; BK_READ_BYTE</font>
<br><font color="#000000">&nbsp;&nbsp;&nbsp; BK_READ_WORD</font>
<br><font color="#000000">&nbsp;&nbsp;&nbsp; BK_READ_LONG_WORD</font>
<br><font color="#000000">&nbsp;&nbsp;&nbsp; BK_WRITE_BYTE</font>
<br><font color="#000000">&nbsp;&nbsp;&nbsp; BK_WRITE_WORD</font>
<br><font color="#000000">&nbsp;&nbsp;&nbsp; BK_WRITE_LONG_WORD</font>
<br><font color="#000000"><b>Implementation</b> : should works</font>
<p>
<hr width="100%">
<p><a NAME="f"></a><i><font color="#FF0000"><font size=+1>void delBreakpointAddress(int
address)</font></font></i>
<p><font color="#000000">Delete an address breakpoint.</font>
<br><font color="#000000"><b>id</b> : breakpoint id.</font>
<br><b>Implementation </b>: should works
<p>
<hr width="100%">
<p><a NAME="g"></a><i><font color="#FF0000"><font size=+1>void delBreakpointAccess(int
id)</font></font></i>
<p><font color="#000000">Delete an access breakpoint.</font>
<br><font color="#000000"><b>id</b> : breakpoint id.</font>
<br><b>Implementation </b>: okay
<p>
<hr width="100%">
<p><a NAME="delrange"></a><i><font color="#FF0000"><font size=+1>void delBreakpointAccessRange(int
id)</font></font></i>
<p><font color="#000000">Delete an access range breakpoint.</font>
<br><font color="#000000"><b>id</b> : breakpoint id.</font>
<br><b>Implementation </b>: okay
<p>
<hr width="100%">
<p><a NAME="h"></a><i><font color="#FF0000"><font size=+1>void delBreakpointVector(int
id)</font></font></i>
<p><font color="#000000">Delete a vector breakpoint.</font>
<br><font color="#000000"><b>id</b> : breakpoint id.</font>
<br><b>Implementation </b>: <font color="#000000">NOT IMPLEMENTED YET</font>
<p>
<hr width="100%">
<p><a NAME="i"></a><i><font color="#FF0000"><font size=+1>void delBreakpointTrap(int
id)</font></font></i>
<p><font color="#000000">Delete a trap breakpoint.</font>
<br><font color="#000000"><b>id</b> : breakpoint id.</font>
<br><b>Implementation </b>: <font color="#000000">NOT IMPLEMENTED YET</font>
<br>&nbsp;
<br>&nbsp;
<br>&nbsp;
<br>&nbsp;
<br>&nbsp;
<p><a NAME="low level"></a><u><font size=+2>4) Low level access</font></u>
<p><a NAME="7"></a><i><font color="#FF0000"><font size=+1>void setDataRegister(int
n,int val)</font></font></i>
<p><font color="#000000">Set the value of Dn.</font>
<br><font color="#000000"><b>n</b> : index of the data register (0,1,2,3,4,5,6
or 7).</font>
<br><b>val </b>: the new value
<br><b>Implementation </b>: ok, no bugs
<p>
<hr width="100%">
<p><a NAME="8"></a><i><font color="#FF0000"><font size=+1>void setAddressRegister(int
n,int val)</font></font></i>
<p><font color="#000000">Set the value of An.</font>
<br><font color="#000000"><b>n</b> : index of the address register (0,1,2,3,4,5,6
or 7).</font>
<br><b>val </b>: the new value
<br><b>Implementation </b>: ok, no bugs
<p>
<hr width="100%">
<p><a NAME="9"></a><i><font color="#FF0000"><font size=+1>void setSpRegister(int
val)</font></font></i>
<p><font color="#000000">Set the value of SP (supervisor stack pointer).</font>
<br><b>val </b>: the new value
<br><b>Implementation </b>: ok, no bugs
<p>
<hr width="100%">
<p><a NAME="10"></a><i><font color="#FF0000"><font size=+1>void setPcRegister(int
val)</font></font></i>
<p><font color="#000000">Set the value of PC (program counter).</font>
<br><b>val </b>: the new value
<br><b>Implementation </b>: ok, no bugs
<p>
<hr width="100%">
<p><a NAME="11"></a><i><font color="#FF0000"><font size=+1>void setSrRegister(int
val)</font></font></i>
<p><font color="#000000">Set the value of SR.</font>
<br><b>val </b>: the new value
<br><b>Implementation </b>: ok, no bugs
<p>
<hr width="100%">
<p><a NAME="12"></a><i><font color="#FF0000"><font size=+1>void setFlagRegister(unsigned
char flag)</font></font></i>
<p><b>Implementation </b>: NOT IMPLEMENTED YET (i need more doc about the
68000 flags&nbsp; ...)
<p>
<hr width="100%">
<p><a NAME="13"></a><i><font color="#FF0000"><font size=+1>int getDataRegister(int
n)</font></font></i>
<p><font color="#000000">Get the value of Dn.</font>
<br><font color="#000000"><b>n</b> : index of the data register (0,1,2,3,4,5,6
or 7).</font>
<br><b>Return </b>: the value
<br><b>Implementation </b>: ok, no bugs
<p>
<hr width="100%">
<p><a NAME="14"></a><i><font color="#FF0000"><font size=+1>int getAddressRegister(int
n)</font></font></i>
<p><font color="#000000">Get the value of An.</font>
<br><font color="#000000"><b>n</b> : index of the address register (0,1,2,3,4,5,6
or 7).</font>
<br><b>Return </b>: the value
<br><b>Implementation </b>: ok, no bugs
<p>
<hr width="100%">
<p><a NAME="15"></a><i><font color="#FF0000"><font size=+1>int getSpRegister(void)</font></font></i>
<p><font color="#000000">Get the value of SP (supervisor stack pointer).</font>
<br><b>Return </b>: the value
<br><b>Implementation </b>: ok, no bugs
<p>
<hr width="100%">
<p><a NAME="16"></a><i><font color="#FF0000"><font size=+1>int getPcRegister(void)</font></font></i>
<p><font color="#000000">Get the value of PC (program counter).</font>
<br><b>Return </b>: the new value
<br><b>Implementation </b>: ok, no bugs
<p>
<hr width="100%">
<p><a NAME="17"></a><i><font color="#FF0000"><font size=+1>int getSrRegister(void)</font></font></i>
<p><font color="#000000">Get the value of SR.</font>
<br><b>Return </b>: the new value
<br><b>Implementation </b>: ok, no bugs
<p>
<hr width="100%">
<p><a NAME="18"></a><i><font color="#FF0000"><font size=+1>unsigned char
getFlagRegister(void)</font></font></i>
<p><b>Implementation </b>: NOT IMPLEMENTED YET (i need more doc about the
68000 flags&nbsp; ...)
<p>
<hr width="100%">
<p><a NAME="19"></a><i><font color="#FF0000"><font size=+1>void* getRam(void)</font></font></i>
<p><font color="#000000"><b>Return</b> : a pointer to the RAM.</font>
<br><font color="#000000"><b>Implementation</b> : ok, no bugs</font>
<p>
<hr width="100%">
<p><a NAME="20"></a><i><font color="#FF0000"><font size=+1>void* getRom(void)</font></font></i>
<p><font color="#000000"><b>Return</b> : a pointer to the ROM.</font>
<br><font color="#000000"><b>Implementation</b> : ok, no bugs</font>
<p>
<hr width="100%">
<p><a NAME="21"></a><i><font color="#FF0000"><font size=+1>void*getLcdmem(void)</font></font></i>
<p><b>Return</b> : a pointer to the lcd memory (in most case, it is : getRam()+0x4c00).
<br><b>Implementation</b> : ok, no bugs
<p>
<hr width="100%">
<p><a NAME="contrast"></a><i><font color="#FF0000"><font size=+1>char getContrast(void)</font></font></i>
<p><b>Return</b> : return the contrast level, the value returned is between
0 and 15.
<br><b>Implementation</b> : ok, no bugs
<p>
<hr width="100%">
<p><a NAME="22"></a><i><font color="#FF0000"><font size=+1>void setActiveKey(int
key,int active)</font></font></i>
<p>M&amp;&amp;odify the state of a key.
<br><b>key</b> : see keydef.h for more details
<br><b>active</b> : non-zero to enable the key, zero to disable the key
<br><b>Implementation</b> : ok, no bugs
</body>
</html>