fix compatibility with ancient gas
[cyclone68000.git] / Cyclone.txt
1 \r
2       _____            __                                     \r
3      / ___/__ __ ____ / /___   ___  ___   ___________________ \r
4     / /__ / // // __// // _ \ / _ \/ -_) ___________________  \r
5     \___/ \_, / \__//_/ \___//_//_/\__/ ___________________   \r
6          /___/                                                \r
7          ___________________  ____ ___   ___   ___   ___      \r
8         ___________________  / __// _ \ / _ \ / _ \ / _ \     \r
9        ___________________  / _ \/ _  // // // // // // /     \r
10                             \___/\___/ \___/ \___/ \___/      \r
11                                                               \r
12 ___________________________________________________________________________\r
13 \r
14   Copyright (c) 2004,2011 FinalDave (emudave (at) gmail.com)\r
15   Copyright (c) 2005-2011 GraÅžvydas "notaz" Ignotas (notasas (at) gmail.com)\r
16 \r
17   This code is licensed under the GNU General Public License version 2.0 and the MAME License.\r
18   You can choose the license that has the most advantages for you.\r
19 \r
20   Homepage: http://code.google.com/p/cyclone68000/\r
21 \r
22 ___________________________________________________________________________\r
23 \r
24 \r
25 About\r
26 -----\r
27 \r
28 Cyclone 68000 is an emulator for the 68000 microprocessor, written in ARM 32-bit assembly.\r
29 It is aimed at chips such as ARM7 and ARM9 cores, StrongARM and XScale, to interpret 68000\r
30 code as fast as possible. It can emulate all 68000 instructions quite accurately, instruction\r
31 timing was synchronized with MAME's Musashi. Most 68k features are emulated (trace mode,\r
32 address errors), but prefetch is not emulated.\r
33 \r
34 \r
35 How to Compile\r
36 --------------\r
37 \r
38 Like Starscream and A68K, Cyclone uses a 'Core Creator' program which calculates and outputs\r
39 all possible 68000 Opcodes and a jump table into file called Cyclone.s or Cyclone.asm.\r
40 Only Cyclone.h and the mentioned .s or .asm file will be needed for your project, other files\r
41 are here to produce or test it.\r
42 \r
43 First unzip "Cyclone.zip" into a "Cyclone" directory. The next thing to do is to edit config.h\r
44 file to tune Cyclone for your project. There are lots of options in config.h, but all of them\r
45 are documented and have defaults. You should set a define value to 1 to enable option, and\r
46 to 0 to disable.\r
47 \r
48 After you are done with config.h, save it and compile Cyclone. If you are using Linux, Cygwin,\r
49 mingw or similar, you can simply cd to Cyclone/proj and type "make". If you are under Windows\r
50 and have Visual Studio installed, you can import cyclone.dsp in the proj/ directory and compile\r
51 it from there (this will produce cyclone.exe which you will have to run to get .s or .asm).\r
52 You can also use Microsoft command line compile tools by entering Cyclone/proj directory and\r
53 typing "nmake -f Makefile.win". Note that this step is done only to produce .s or .asm, and it\r
54 is done using native tools on your PC (not using cross-compiler or similar).\r
55 \r
56 The .s file is meant to be compiled with GNU assembler, and .asm with ARMASM.EXE\r
57 (the Microsoft ARM assembler). Once you have the file, you can add it to your\r
58 Makefile/project/whatever.\r
59 \r
60 \r
61 Adding to your project\r
62 ----------------------\r
63 \r
64 Compiling the .s or .asm (from previous step) for your target platform may require custom\r
65 build rules in your Makefile/project.\r
66 \r
67 If you use some gcc-based toolchain, you will need to add Cyclone.o to an object list in\r
68 the Makefile. GNU make will use "as" to build Cyclone.o from Cyclone.s by default, so\r
69 you may need to define correct cross-assembler by setting AS variable like this:\r
70 \r
71 AS = arm-linux-as\r
72 \r
73 This might be different in your case, basically it should be same prefix as for gcc.\r
74 You may also need to specify floating point type in your assembler flags for Cyclone.o\r
75 to link properly. This is done like this:\r
76 \r
77 ASFLAGS = -mfloat-abi=soft\r
78 \r
79 Note that Cyclone does not use floating points, this is just to make the linker happy.\r
80 \r
81 \r
82 If you are using Visual Studio, you may need to add "custom build step", which creates\r
83 Cyclone.obj from Cyclone.asm (asmasm.exe Cyclone.asm). Alternatively you can create\r
84 Cyclone.obj by using armasm once and then just add it to you project.\r
85 \r
86 Don't worry if this seem very minimal - its all you need to run as many 68000s as you want.\r
87 It works with both C and C++.\r
88 \r
89 \r
90 Byteswapped Memory\r
91 ------------------\r
92 \r
93 If you have used Starscream, A68K or Turbo68K or similar emulators you'll be familiar with this!\r
94 \r
95 Any memory which the 68000 can access directly must be have every two bytes swapped around.\r
96 This is to speed up 16-bit memory accesses, because the 68000 has Big-Endian memory\r
97 and ARM has Little-Endian memory (in most cases).\r
98 \r
99 Now you may think you only technically have to byteswap ROM, not RAM, because\r
100 16-bit RAM reads go through a memory handler and you could just return (mem[a]<<8) | mem[a+1].\r
101 \r
102 This would work, but remember some systems can execute code from RAM as well as ROM, and\r
103 that would fail.\r
104 So it's best to use byteswapped ROM and RAM if the 68000 can access it directly.\r
105 It's also faster for the memory handlers, because you can do this:\r
106   \r
107   return *(unsigned short *)(mem+a)\r
108 \r
109 \r
110 Declaring Memory handlers\r
111 -------------------------\r
112 \r
113 Before you can reset or execute 68000 opcodes you must first set up a set of memory handlers.\r
114 There are 7 functions you have to set up per CPU, like this:\r
115 \r
116   static unsigned int   MyCheckPc(unsigned int pc)\r
117   static unsigned char  MyRead8  (unsigned int a)\r
118   static unsigned short MyRead16 (unsigned int a)\r
119   static unsigned int   MyRead32 (unsigned int a)\r
120   static void MyWrite8 (unsigned int a,unsigned char  d)\r
121   static void MyWrite16(unsigned int a,unsigned short d)\r
122   static void MyWrite32(unsigned int a,unsigned int   d)\r
123 \r
124 You can think of these functions representing the 68000's memory bus.\r
125 The Read and Write functions are called whenever the 68000 reads or writes memory.\r
126 For example you might set MyRead8 like this:\r
127 \r
128   unsigned char MyRead8(unsigned int a)\r
129   {\r
130     a&=0xffffff; // Clip address to 24-bits\r
131 \r
132     if (a<RomLength) return RomData[a^1]; // ^1 because the memory is byteswapped\r
133     if (a>=0xe00000) return RamData[(a^1)&0xffff];\r
134     return 0xff; // Out of range memory access\r
135   }\r
136 \r
137 The other 5 read/write functions are similar. I'll describe the CheckPc function later on.\r
138 \r
139 \r
140 Declaring a CPU Context\r
141 -----------------------\r
142 \r
143 To declare a CPU simple declare a struct Cyclone in your code (don't forget to include Cyclone.h).\r
144 For example to declare two 68000s:\r
145 \r
146   struct Cyclone MyCpu;\r
147   struct Cyclone MyCpu2;\r
148 \r
149 It's probably a good idea to initialize the memory to zero:\r
150 \r
151   memset(&MyCpu, 0,sizeof(MyCpu));\r
152   memset(&MyCpu2,0,sizeof(MyCpu2));\r
153 \r
154 Next point to your memory handlers:\r
155 \r
156   MyCpu.checkpc=MyCheckPc;\r
157   MyCpu.read8  =MyRead8;\r
158   MyCpu.read16 =MyRead16;\r
159   MyCpu.read32 =MyRead32;\r
160   MyCpu.write8 =MyWrite8;\r
161   MyCpu.write16=MyWrite16;\r
162   MyCpu.write32=MyWrite32;\r
163 \r
164 You also need to point the fetch handlers - for most systems out there you can just\r
165 point them at the read handlers:\r
166   MyCpu.fetch8  =MyRead8;\r
167   MyCpu.fetch16 =MyRead16;\r
168   MyCpu.fetch32 =MyRead32;\r
169 \r
170 ( Why a different set of function pointers for fetch?\r
171   Well there are some systems, the main one being CPS2, which return different data\r
172   depending on whether the 'fetch' line on the 68000 bus is high or low.\r
173   If this is the case, you can set up different functions for fetch reads.\r
174   Generally though you don't need to. )\r
175 \r
176 Now you are nearly ready to reset the 68000, except a few more functions,\r
177 one of them is: checkpc().\r
178 \r
179 \r
180 The checkpc() function\r
181 ----------------------\r
182 \r
183 When Cyclone reads opcodes, it doesn't use a memory handler every time, this would be\r
184 far too slow, instead it uses a direct pointer to ARM memory.\r
185 For example if your Rom image was at 0x3000000 and the program counter was $206,\r
186 Cyclone's program counter would be 0x3000206.\r
187 \r
188 The difference between an ARM address and a 68000 address is also stored in a variable called\r
189 'membase'. In the above example it's 0x3000000. To retrieve the real 68k PC, Cyclone just\r
190 subtracts 'membase'.\r
191 \r
192 When a long jump happens, Cyclone calls checkpc(). If the PC is in a different bank,\r
193 for example Ram instead of Rom, change 'membase', recalculate the new PC and return it:\r
194 \r
195 static int MyCheckPc(unsigned int pc)\r
196 {\r
197   pc-=MyCpu.membase; // Get the real program counter\r
198 \r
199   if (pc<RomLength) MyCpu.membase=(int)RomMem;          // Jump to Rom\r
200   if (pc>=0xff0000) MyCpu.membase=(int)RamMem-0xff0000; // Jump to Ram\r
201 \r
202   return MyCpu.membase+pc; // New program counter\r
203 }\r
204 \r
205 Notice that the membase is always ARM address minus 68000 address.\r
206 \r
207 The above example doesn't consider mirrored ram, but for an example of what to do see\r
208 PicoDrive (in Memory.c).\r
209 \r
210 The exact cases when checkpc() is called can be configured in config.h.\r
211 \r
212 \r
213 Initialization\r
214 --------------\r
215 \r
216 Add a call to CycloneInit(). This is really only needed to be called once at startup\r
217 if you enabled COMPRESS_JUMPTABLE in config.h, but you can add this in any case,\r
218 it won't hurt.\r
219 \r
220 \r
221 Almost there - Reset the 68000!\r
222 -------------------------------\r
223 \r
224 Cyclone doesn't provide a reset function, so next we need to Reset the 68000 to get\r
225 the initial Program Counter and Stack Pointer. This is obtained from addresses\r
226 000000 and 000004.\r
227 \r
228 Here is code which resets the 68000 (using your memory handlers):\r
229 \r
230   MyCpu.state_flags=0; // Go to default state (not stopped, halted, etc.)\r
231   MyCpu.srh=0x27; // Set supervisor mode\r
232   MyCpu.a[7]=MyCpu.read32(0); // Get Stack Pointer\r
233   MyCpu.membase=0; // Will be set by checkpc()\r
234   MyCpu.pc=MyCpu.checkpc(MyCpu.read32(4)); // Get Program Counter\r
235 \r
236 And that's ready to go.\r
237 \r
238 \r
239 Executing the 68000\r
240 -------------------\r
241 \r
242 To execute the 68000, set the 'cycles' variable to the number of cycles you wish to execute,\r
243 and then call CycloneRun with a pointer to the Cyclone structure.\r
244 \r
245 e.g.:\r
246   // Execute 1000 cycles on the 68000:\r
247   MyCpu.cycles=1000; CycloneRun(&MyCpu);\r
248 \r
249 For each opcode, the number of cycles it took is subtracted and the function returns when\r
250 it reaches negative number. The result is stored back to MyCpu.cycles.\r
251 \r
252 e.g.\r
253   // Execute one instruction on the 68000:\r
254   MyCpu.cycles=0; CycloneRun(&MyCpu);\r
255   printf("  The opcode took %d cycles\n", -MyCpu.cycles);\r
256 \r
257 You should try to execute as many cycles as you can for maximum speed.\r
258 The number actually executed may be slightly more than requested, i.e. cycles may come\r
259 out with a small negative value:\r
260 \r
261 e.g.\r
262   int todo=12000000/60; // 12Mhz, for one 60hz frame\r
263   MyCpu.cycles=todo; CycloneRun(&MyCpu);\r
264   printf("  Actually executed %d cycles\n", todo-MyCpu.cycles);\r
265 \r
266 To calculate the number of cycles executed, use this formula:\r
267   Number of cycles requested - Cycle counter at the end\r
268 \r
269 \r
270 Interrupts\r
271 ----------\r
272 \r
273 Causing an interrupt is very simple, simply set the irq variable in the Cyclone structure\r
274 to the IRQ number.\r
275 To lower the IRQ line, set it to zero.\r
276 \r
277 e.g:\r
278   MyCpu.irq=6; // Interrupt level 6\r
279   MyCpu.cycles=20000; CycloneRun(&MyCpu);\r
280 \r
281 Note that the interrupt is not actually processed until the next call to CycloneRun,\r
282 and the interrupt may not be taken until the 68000 interrupt mask is changed to allow it.\r
283 \r
284 If you need to force interrupt processing, you can use CycloneFlushIrq() function.\r
285 It is the same as doing\r
286 \r
287 MyCpu.cycles=0; CycloneRun(&MyCpu);\r
288 \r
289 but is better optimized and doesn't update .cycles (returns them instead).\r
290 This function can't be used from memory handlers and has no effect if interrupt is masked.\r
291 \r
292 The IRQ isn't checked on exiting from a memory handler. If you need to cause interrupt\r
293 check immediately, you should change cycle counter to 0 to cause a return from CycloneRun(),\r
294 and then call CycloneRun() again or just call CycloneFlushIrq(). Note that you need to\r
295 enable MEMHANDLERS_CHANGE_CYCLES in config.h for this to work.\r
296 \r
297 If you need to do something during the interrupt acknowledge (the moment when interrupt\r
298 is taken), you can set USE_INT_ACK_CALLBACK in config.h and specify IrqCallback function.\r
299 This function should update the IRQ level (.irq variable in context) and return the\r
300 interrupt vector number. But for most cases it should return special constant\r
301 CYCLONE_INT_ACK_AUTOVECTOR so that Cyclone uses autovectors, which is what most real\r
302 systems were doing. Another less commonly used option is to return CYCLONE_INT_ACK_SPURIOUS\r
303 for spurious interrupt.\r
304 \r
305 \r
306 Accessing Program Counter and registers\r
307 ---------------------------------------\r
308 \r
309 You can read most Cyclone's registers directly from the structure at any time.\r
310 However, the PC value, CCR and cycle counter are cached in ARM registers and can't\r
311 be accessed from memory handlers by default. They are written back and can be\r
312 accessed after execution.\r
313 \r
314 But if you need to access the mentioned registers during execution, you can set\r
315 MEMHANDLERS_NEED_* and MEMHANDLERS_CHANGE_* options in config.h\r
316 \r
317 The Program Counter, should you need to read or write it, is stored with membase\r
318 added on. So use this formula to calculate the real 68000 program counter:\r
319 \r
320   pc = MyCpu.pc - MyCpu.membase;\r
321 \r
322 For performance reasons Cyclone keeps the status register split into .srh\r
323 (status register "high" supervisor byte), .xc for the X flag, and .flags for remaining\r
324 CCR flags (in ARM order). To easily read/write the status register as normal 68k\r
325 16bit SR register, use CycloneGetSr() and CycloneSetSr() utility functions.\r
326 \r
327 \r
328 Emulating more than one CPU\r
329 ---------------------------\r
330 \r
331 Since everything is based on the structures, emulating more than one cpu at the same time\r
332 is just a matter of declaring more than one structures and timeslicing. You can emulate\r
333 as many 68000s as you want.\r
334 Just set up the memory handlers for each cpu and run each cpu for a certain number of cycles.\r
335 \r
336 e.g.\r
337   // Execute 1000 cycles on 68000 #1:\r
338   MyCpu.cycles=1000; CycloneRun(&MyCpu);\r
339 \r
340   // Execute 1000 cycles on 68000 #2:\r
341   MyCpu2.cycles=1000; CycloneRun(&MyCpu2);\r
342 \r
343 \r
344 Quick API reference\r
345 -------------------\r
346 \r
347 void CycloneInit(void);\r
348   Initializes Cyclone. Must be called if the jumptable is compressed,\r
349   doesn't matter otherwise.\r
350 \r
351 void CycloneRun(struct Cyclone *pcy);\r
352   Runs cyclone for pcy->cycles. Writes amount of cycles left back to\r
353   pcy->cycles (always negative).\r
354 \r
355 unsigned int CycloneGetSr(const struct Cyclone *pcy);\r
356   Reads status register in internal form from pcy, converts to standard 68k SR and returns it.\r
357 \r
358 void CycloneSetSr(struct Cyclone *pcy, unsigned int sr);\r
359   Takes standard 68k status register (sr), and updates Cyclone context with it.\r
360   \r
361 int CycloneFlushIrq(struct Cyclone *pcy);\r
362   If .irq is greater than IRQ mask in SR, or it is equal to 7 (NMI), processes interrupt\r
363   exception and returns number of cycles used. Otherwise, does nothing and returns 0.\r
364 \r
365 void CyclonePack(const struct Cyclone *pcy, void *save_buffer);\r
366   Writes Cyclone state to save_buffer. This allows to avoid all the trouble figuring what\r
367   actually needs to be saved from the Cyclone structure, as saving whole struct Cyclone\r
368   to a file will also save various pointers, which may become invalid after your program\r
369   is restarted, so simply reloading the structure will cause a crash. save_buffer size\r
370   should be 128 bytes (now it is really using less, but this allows future expansion).\r
371 \r
372 void CycloneUnpack(struct Cyclone *pcy, const void *save_buffer);\r
373   Reloads Cyclone state from save_buffer, which was previously saved by CyclonePack().\r
374   This function uses checkpc() callback to rebase the PC, so .checkpc must be initialized\r
375   before calling it.\r
376 \r
377 Callbacks:\r
378 \r
379 .checkpc\r
380 unsigned int (*checkpc)(unsigned int pc);\r
381   This function is called when PC changes are performed in 68k code or because of exceptions.\r
382   It is passed ARM pointer and should return ARM pointer casted to int. It must also update\r
383   .membase if needed. See "The checkpc() function" section above.\r
384 \r
385 unsigned int (*read8  )(unsigned int a);\r
386 unsigned int (*read16 )(unsigned int a);\r
387 unsigned int (*read32 )(unsigned int a);\r
388   These are the read memory handler callbacks. They are called when 68k code reads from memory.\r
389   The parameter is a 68k address in data space, return value is a data value read. Data value\r
390   doesn't have to be masked to 8 or 16 bits for read8 or read16, Cyclone will do that itself\r
391   if needed.\r
392 \r
393 unsigned int (*fetch8 )(unsigned int a);\r
394 unsigned int (*fetch16)(unsigned int a);\r
395 unsigned int (*fetch32)(unsigned int a);\r
396   Same as above, but these are reads from program space (PC relative reads mostly).\r
397  \r
398 void (*write8 )(unsigned int a,unsigned char  d);\r
399 void (*write16)(unsigned int a,unsigned short d);\r
400 void (*write32)(unsigned int a,unsigned int   d);\r
401   These are called when 68k code writes to data space. d is the data value.\r
402 \r
403 int (*IrqCallback)(int int_level);\r
404   This function is called when Cyclone acknowledges an interrupt. The parameter is the IRQ\r
405   level being acknowledged, and return value is exception vector to use, or one of these special\r
406   values: CYCLONE_INT_ACK_AUTOVECTOR or CYCLONE_INT_ACK_SPURIOUS. Can be disabled in config.h.\r
407   See "Interrupts" section for more information.\r
408 \r
409 void (*ResetCallback)(void);\r
410   Cyclone will call this function if it encounters RESET 68k instruction.\r
411   Can be disabled in config.h.\r
412 \r
413 int (*UnrecognizedCallback)(void);\r
414   Cyclone will call this function if it encounters illegal instructions (including A-line and\r
415   F-line ones). Can be tuned / disabled in config.h.\r
416 \r
417 \r
418 Function codes\r
419 --------------\r
420 \r
421 Cyclone doesn't pass function codes to it's memory handlers, but they can be calculated:\r
422 FC2: just use supervisor state bit from status register (eg. (MyCpu.srh & 0x20) >> 5)\r
423 FC1: if we are in fetch* function, then 1, else 0.\r
424 FC0: if we are in read* or write*, then 1, else 0.\r
425 CPU state (all FC bits set) is active in IrqCallback function.\r
426 \r
427 \r
428 References\r
429 ----------\r
430 \r
431 These documents were used while writing Cyclone and should be useful for those who want to\r
432 understand deeper how the 68000 works.\r
433 \r
434 MOTOROLA M68000 FAMILY Programmer's Reference Manual\r
435 common name: 68kPM.pdf\r
436 \r
437 M68000 8-/16-/32-Bit Microprocessors User's Manual\r
438 common name: MC68000UM.pdf\r
439 \r
440 68000 Undocumented Behavior Notes by Bart Trzynadlowski\r
441 http://www.trzy.org/files/68knotes.txt\r
442 \r
443 Instruction prefetch on the Motorola 68000 processor by Jorge Cwik\r
444 http://pasti.fxatari.com/68kdocs/68kPrefetch.html\r
445 \r
446 \r
447 ARM Register Usage\r
448 ------------------\r
449 \r
450 See source code for up to date of register usage, however a summary is here:\r
451 \r
452   r0-3: Temporary registers\r
453   r4  : Current PC + Memory Base (i.e. pointer to next opcode)\r
454   r5  : Cycles remaining\r
455   r6  : Pointer to Opcode Jump table\r
456   r7  : Pointer to Cpu Context\r
457   r8  : Current Opcode\r
458   r10 : Flags (NZCV) in highest four bits\r
459  (r11 : Temporary register)\r
460 \r
461 Flags are mapped onto ARM flags whenever possible, which speeds up the processing of opcode.\r
462 r9 is not used intentionally, because AAPCS defines it as "platform register", so it's\r
463 reserved in some systems.\r
464 \r
465 \r
466 Thanks to...\r
467 ------------\r
468 \r
469 * All the previous code-generating assembler cpu core guys!\r
470   Who are iirc... Neill Corlett, Neil Bradley, Mike Coates, Darren Olafson\r
471     Karl Stenerud and Bart Trzynadlowski\r
472 \r
473 * Charles Macdonald, for researching just about every console ever\r
474 * MameDev+FBA, for keeping on going and going and going\r
475 \r
476 \r
477 What's New\r
478 ----------\r
479 v0.0099\r
480   * Cyclone no longer uses r9, because AAPCS defines it as "platform register",\r
481     so it's reserved in some systems.\r
482   * Made SPLIT_MOVEL_PD to affect MOVEM too.\r
483 \r
484 v0.0088\r
485   - Reduced amount of code in opcode handlers by ~23% by doing the following:\r
486     - Removed duplicate opcode handlers\r
487     - Optimized code to use less ARM instructions\r
488     - Merged some duplicate handler endings\r
489   + Cyclone now does better job avoiding pipeline interlocks.\r
490   + Replaced incorrect handler of DBT with proper one.\r
491   + Changed "MOVEA (An)+ An" behavior.\r
492   + Fixed flag behavior of ROXR, ASL, LSR and NBCD in certain situations.\r
493     Hopefully got them right now.\r
494   + Cyclone no longer sets most significant bits while pushing PC to stack.\r
495     Amiga Kickstart depends on this.\r
496   + Added optional trace mode emulation.\r
497   + Added optional address error emulation.\r
498   + Additional functionality added for MAME and other ports (see config.h).\r
499   + Added return value for IrqCallback to make it suitable for emulating devices which\r
500     pass the vector number during interrupt acknowledge cycle. For usual autovector\r
501     processing this function must return CYCLONE_INT_ACK_AUTOVECTOR, so those who are\r
502     upgrading must add "return CYCLONE_INT_ACK_AUTOVECTOR;" to their IrqCallback functions.\r
503   * Updated documentation.\r
504 \r
505 v0.0086\r
506   + Cyclone now can be customized to better suit your project, see config.h .\r
507   + Added an option to compress the jumptable at compile-time. Must call CycloneInit()\r
508     at runtime to decompress it if enabled (see config.h).\r
509   + Added missing CHK opcode handler (used by SeaQuest DSV).\r
510   + Added missing TAS opcode handler (Gargoyles,Bubba N Stix,...). As in real genesis,\r
511     memory write-back phase is ignored (but can be enabled in config.h if needed).\r
512   + Added missing NBCD and TRAPV opcode handlers.\r
513   + Added missing addressing mode for CMP/EOR.\r
514   + Added some minor optimizations.\r
515   - Removed 216 handlers for 2927 opcodes which were generated for invalid addressing modes.\r
516   + Fixed flags for ASL, NEG, NEGX, DIVU, ADDX, SUBX, ROXR.\r
517   + Bugs fixed in MOVEP, LINK, ADDQ, DIVS handlers.\r
518   * Undocumented flags for CHK, ABCD, SBCD and NBCD are now emulated the same way as in Musashi.\r
519   + Added Uninitialized Interrupt emulation.\r
520   + Altered timing for about half of opcodes to match Musashi's.\r
521 \r
522 v0.0082\r
523   + Change cyclone to clear cycles before returning when halted\r
524   + Added Irq call back function.  This allows emulators to be notified\r
525     when cyclone has taken an interrupt allowing them to set internal flags\r
526     which can help fix timing problems.\r
527 \r
528 v0.0081\r
529   + .asm version was broken and did not compile with armasm. Fixed.\r
530   + Finished implementing Stop opcode. Now it really stops the processor.\r
531 \r
532 v0.0080\r
533   + Added real cmpm opcode, it was using eor handler before this.\r
534     Fixes Dune and Sensible Soccer.\r
535 \r
536 v0.0078\r
537   note: these bugs were actually found Reesy, I reimplemented these by\r
538         using his changelog as a guide.\r
539   + Fixed a problem with divu which was using long divisor instead of word.\r
540     Fixes gear switching in Top Gear 2.\r
541   + Fixed btst opcode, The bit to test should shifted a max of 31 or 7\r
542     depending on if a register or memory location is being tested.\r
543   + Fixed abcd,sbcd. They did bad decimal correction on invalid BCD numbers\r
544     Score counters in Streets of Rage level end work now.\r
545   + Changed flag handling of abcd,sbcd,addx,subx,asl,lsl,...\r
546     Some ops did not have flag handling at all.\r
547     Some ops must not change Z flag when result is zero, but they did.\r
548     Shift ops must not change X if shift count is zero, but they did.\r
549     There are probably still some flag problems left.\r
550   + Patially implemented Stop and Reset opcodes - Fixes Thunderforce IV\r
551 \r
552 v0.0075\r
553   + Added missing displacement addressing mode for movem (Fantastic Dizzy)\r
554   + Added OSP <-> A7 swapping code in opcodes, which change privilege mode\r
555   + Implemented privilege violation, line emulator and divide by zero exceptions\r
556   + Added negx opcode (Shining Force works!)\r
557   + Added overflow detection for divs/divu\r
558 \r
559 v0.0072\r
560   note: I could only get v0.0069 cyclone, so I had to implement these myself using Dave's\r
561         changelog as a guide.\r
562   + Fixed a problem with divs - remainder should be negative when divident is negative\r
563   + Added movep opcode (Sonic 3 works)\r
564   + Fixed a problem with DBcc incorrectly decrementing if the condition is true (Shadow of the Beast)\r
565 \r
566 v0.0069\r
567   + Added SBCD and the flags for ABCD/SBCD. Score and time now works in games such as\r
568     Rolling Thunder 2, Ghouls 'N Ghosts\r
569   + Fixed a problem with addx and subx with 8-bit and 16-bit values.\r
570     Ghouls 'N' Ghosts now works!\r
571 \r
572 v0.0068\r
573   + Added ABCD opcode (Streets of Rage works now!)\r
574 \r
575 v0.0067\r
576   + Added dbCC (After Burner)\r
577   + Added asr EA (Sonic 1 Boss/Labyrinth Zone)\r
578   + Added andi/ori/eori ccr (Altered Beast)\r
579   + Added trap (After Burner)\r
580   + Added special case for move.b (a7)+ and -(a7), stepping by 2\r
581     After Burner is playable! Eternal Champions shows more\r
582   + Fixed lsr.b/w zero flag (Ghostbusters)\r
583     Rolling Thunder 2 now works!\r
584   + Fixed N flag for .b and .w arithmetic. Golden Axe works!\r
585 \r
586 v0.0066\r
587   + Fixed a stupid typo for exg (orr r10,r10, not orr r10,r8), which caused alignment\r
588     crashes on Strider\r
589 \r
590 v0.0065\r
591   + Fixed a problem with immediate values - they weren't being shifted up correctly for some\r
592     opcodes. Spiderman works, After Burner shows a bit of graphics.\r
593   + Fixed a problem with EA:"110nnn" extension word. 32-bit offsets were being decoded as 8-bit\r
594     offsets by mistake. Castlevania Bloodlines seems fine now.\r
595   + Added exg opcode\r
596   + Fixed asr opcode (Sonic jumping left is fixed)\r
597   + Fixed a problem with the carry bit in rol.b (Marble Madness)\r
598 \r
599 v0.0064\r
600   + Added rtr\r
601   + Fixed addq/subq.l (all An opcodes are 32-bit) (Road Rash)\r
602   + Fixed various little timings\r
603 \r
604 v0.0063\r
605   + Added link/unlk opcodes\r
606   + Fixed various little timings\r
607   + Fixed a problem with dbCC opcode being emitted at set opcodes\r
608   + Improved long register access, the EA fetch now does ldr r0,[r7,r0,lsl #2] whenever\r
609      possible, saving 1 or 2 cycles on many opcodes, which should give a nice speed up.\r
610   + May have fixed N flag on ext opcode?\r
611   + Added dasm for link opcode.\r
612 \r
613 v0.0062\r
614   * I was a bit too keen with the Arithmetic opcodes! Some of them should have been abcd,\r
615     exg and addx. Removed the incorrect opcodes, pending re-adding them as abcd, exg and addx.\r
616   + Changed unknown opcodes to act as nops.\r
617     Not very technical, but fun - a few more games show more graphics ;)\r
618 \r
619 v0.0060\r
620   + Fixed divu (EA intro)\r
621   + Added sf (set false) opcode - SOR2\r
622   * Todo: pea/link/unlk opcodes\r
623 \r
624 v0.0059: Added remainder to divide opcodes.\r
625 \r
626 \r