Commit Graph

92 Commits

Author SHA1 Message Date
transistor
481dd0d7f7 Fixed part of the problem in RTE test failures with Address Error
The I/N bit in the special status word on the stack should be set
when returning from RTE results in a PC that isn't word aligned.
Every other case pretty much, it should be clear
2022-09-17 21:29:04 -07:00
transistor
e3c4ad88ee Fixed most DIVU tests, and some more DIVS ones 2022-09-16 22:54:59 -07:00
transistor
71c10ff0f0 Slightly improved the handling of the I/N bit in Address Error 2022-09-16 20:49:44 -07:00
transistor
ef6fde2a4f Minor fix to RTE 2022-09-15 20:56:52 -07:00
transistor
5304df2a9f Minor fixes to the shift flags, but still haven't fixed the issue 2022-09-15 20:29:47 -07:00
transistor
a3fbcc7c16 Fixed some DIV tests 2022-09-14 21:52:24 -07:00
transistor
2a9ca9beae Fixed LINK instruction 2022-09-14 20:09:07 -07:00
transistor
42ca95ef5a Minor changes 2022-09-13 22:00:34 -07:00
transistor
575501599a Fixed MULS tests
DIVS tests are no better
2022-09-13 20:56:19 -07:00
transistor
873741846c Implemented the CHK and NEGX instructions 2022-09-12 22:19:01 -07:00
transistor
9ff528c463 Fixed some AddressError tests
Adjusted the PC value stored when an Address Error fault occurs to
use the size of the access operation.

I also flipped the IN bit in the word that's written to the top of
the stack on an AddressError, even though that's opposite of what
the docs say.  It seems to pass the tests.  I probably have something
else going wrong, but it shouldn't be an important bit either way.
2022-09-12 21:47:36 -07:00
transistor
1a098bde6f Fixed various m68k bugs
Added support for RTR and RESET.
Fixed flags behavior for ASd
Added function to set PC, and fixed some instruction's handling of
an address fault a bit better
2022-09-11 21:27:29 -07:00
transistor
d9a1295dda Fixed ADDX/SUBX instructions 2022-09-11 20:08:29 -07:00
transistor
03f4e11e3b Added proper AddressError handling to m68k
Also a few fixes, such as correcting a decode error in ADDX
2022-09-11 17:42:54 -07:00
transistor
aa39b4b11f Modified to use SR mask so that certain bits in SR are always 0 2022-09-11 14:50:37 -07:00
transistor
0582625b5e Fixed some issue with m68k
Some debug code was enabled that prevented illegal instructions
from being handled normally with a processor exception

The brief instruction word decoding could cause an illegal instruction
if it didn't match the docs, but the actual implementation would not
complain in those cases, so I modified it to not perform validation
for <=MC68010

Increment and Decrement addressing modes, when using the stack pointer,
will always inc/dec by at least 2 bytes, even if it's a byte operation,
to keep the stack aligned to the nearest word boundary
2022-09-10 21:09:35 -07:00
transistor
1a3d8cc0c5 Fixed issue with Inc/Dec addressing modes
For instructions that use an operand twice, where it called
get_target_value and set_target_value, if the addressing mode was
one where it would increment or decrement a pointer, it was
causing a double inc/dec because of the two calls to get/set target.
I added an argument to let the functions know if they will be called
twice, in which case it assumes that get will be the first and set
will be the second, and inc/decs only once in the appropriate function
for whether it pre-incs or post-decs
2022-09-10 14:27:19 -07:00
transistor
c53253c050 Added more options to run select tests to harte test runner 2022-09-10 14:08:01 -07:00
transistor
8060f7179b Fixed some warnings 2022-09-09 22:31:55 -07:00
transistor
588c0b56a2 Fixed bug in DIVS for m68k (was using unsigned operation) 2021-12-26 16:28:34 -08:00
transistor
cbf91309d9 Fixed debugger to easier debug one cpu at a time
Previously it would show a dump of whatever device was next scheduled
to step, if it was Debuggable, but now each debuggable device has a
flag for whether that device is being debugging, and a system flag
to disable it entirely.  When the system flag is set, it will try
to enable debugging on the device labelled "cpu".  I need to also add
a way of setting a breakpoint on a named device, which will enable
debugging of that device
2021-12-20 19:53:12 -08:00
transistor
e3819fe549 Added timing to m68k implementation 2021-12-14 21:13:01 -08:00
transistor
1b6cbfa831 Fixed some decoder bugs in m68k 2021-12-14 16:06:34 -08:00
transistor
75e4a760eb Added ABCD, SBCD, and TAS instructions to m68k 2021-12-03 15:32:17 -08:00
transistor
b165e18fac Added ADDX/SUBX instructions to m68k 2021-12-01 15:40:41 -08:00
transistor
0f2f989775 Fixed bug in m68k with Extend flag in shift instructions 2021-12-01 10:45:24 -08:00
transistor
03f23da544 Added A and F instructions to m68k 2021-11-23 11:45:11 -08:00
transistor
f601290771 Fixed bug in MOVEM and added tests for it
It was previously decrementing addresses if the direction was from
registers to memory, but that's incorrect.  It should increment the
address always when using an addressing mode other than the ARecDec
mode.  I also added a memory location to the test cases to test the
MOVEM instruction by comparing what memory was read/written (but it's
only one u32 because that's the minimum we need)
2021-11-19 09:55:31 -08:00
transistor
02b10c5b32 Changed msp to ssp to match docs 2021-11-18 12:13:36 -08:00
transistor
a342ef3b86 Added MOVEP and more tests to m68k and IM to z80 2021-11-15 20:52:19 -08:00
transistor
a00d7b2f26 Fixed warnings 2021-11-13 11:39:20 -08:00
transistor
e0d863a845 Fixed overflow bug in m68k 2021-11-13 10:54:59 -08:00
transistor
7d2a4e4b44 Fixed m68k overflow flags (almost) 2021-11-04 21:29:52 -07:00
transistor
8ba506cc11 Added tracing mode to debugger 2021-11-04 13:32:51 -07:00
transistor
2cb21d7b8d Fixed a number of instruction bugs with m68k 2021-11-03 23:55:50 -07:00
transistor
bd5a798fa1 Fixed bug in ADDA/SUBA instructions 2021-11-03 15:30:38 -07:00
transistor
58fc9ac827 Moved the debugger out of m68k 2021-11-01 16:51:45 -07:00
transistor
93c080eae6 Fixed interrupts
Previously the m68k wasn't masking interrupts with an equal priorty.
I also modified how they work, such that the cpus will check the
controller rather than wait for the notification call
2021-10-29 22:02:29 -07:00
transistor
c1ca666aa4 Simplified event queue 2021-10-29 20:06:15 -07:00
transistor
250c0e83d2 Minor fixes 2021-10-29 15:05:41 -07:00
transistor
892f93f053 Added BusPort to more accurately emulate the bus requests of the 68k
The BusPort is created before the CPU and is passed to it.  It can
have an offset, limit the address sizes, and break up bus request
beyond a certain number of bytes into multiple requests
2021-10-26 21:32:25 -07:00
transistor
1ad7ad1807 Added Debuggable trait and added tests 2021-10-26 12:17:59 -07:00
transistor
0b17b0fc8c Modified timer to store its own start time 2021-10-25 19:29:39 -07:00
transistor
089f25903b Added adjustable frequency to m68k, and added log levels 2021-10-25 10:29:13 -07:00
transistor
fd894f0638 Modified to use a nanosecond clock 2021-10-23 22:22:02 -07:00
transistor
e81a5d430a Fixed some bugs and added the ROXd instruction 2021-10-19 19:50:42 -07:00
transistor
3579529764 Minor fixes and refactoring 2021-10-19 11:33:51 -07:00
transistor
2d8e5f6359 Added support for long word MUL and DIV instructions 2021-10-18 21:22:57 -07:00
transistor
b88b0a890c Updated tests for new addressing modes 2021-10-18 16:34:55 -07:00
transistor
731c89845e Added MC68020+ addressing modes 2021-10-18 15:44:42 -07:00