Subversion Repositories Kolibri OS

Rev

Blame | Last modification | View Log | Download | RSS feed

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