Commit graph

55 commits

Author SHA1 Message Date
43de90a9df WIP support emulator traps similar to basilisk 2025-03-30 20:28:34 -05:00
Matt Evans
0b85a7a648 Move most frequently-used items to start of m68ki_cpu_core
This enables faster access on ISAs having small immediate offsets (e.g. armv6m).
2024-05-28 23:48:48 +01:00
Matt Evans
d4c4aa290d HACK: Add fast opcode read
m68ki_read_opcode_16 is both a different access path for instructions
(meaning we can decode addresses with certain assumptions), and also can be
implemented faster (always an aligned 16b read).
2024-05-28 23:48:48 +01:00
Matt Evans
765c5af223 Add M68K_BUS_ERR_ENABLE config
Some projects don't use the m68k_pulse_bus_error() interface, so
disabling it will save some cycles in the inner loop.
2024-05-28 23:46:46 +01:00
Matt Evans
c2695c09d7 Add M68K_FIXED_CPU_TYPE config, for static CPU type selection
For some projects, runtime selection of CPU type isn't required,
and burns both time and space.  This config option allows a build-
time selection of CPU model.
2024-05-28 23:46:41 +01:00
Matt Evans
2ff6fd0683 Add M68K_DYNAMIC_INSTR_TABLES for runtime-generated decode/cycle tables
The static decode jump table is built via m68kmake, and with a project
config can be used by the main runloop.

Add M68K_CYCLE_COUNTING to enable per-instruction cycle counts
versus accumulating a dummy (constant) cost per instruction.

Move the cycle-counting to a macro -- for now, CYCLE_COUNTING is only
supported when using DYNAMIC_INSTR_TABLES (as no static table gen
is provided yet).

Static jumptable saves 256K of RAM, and avoiding cycle counting
saves 320K!
2024-05-15 23:16:46 +01:00
shadyjesse
df4d10b9cb allow bus error to occur when already exception handling a bus error (fixes page fault within a page fault in Freebee emulator) 2021-07-22 18:06:08 -04:00
Mateusz Kramarczyk
40e8cea1a4 Fix compile errors. 2020-06-13 15:09:11 +02:00
Karl Stenerud
6f04ba062e
Merge pull request #53 from zelurker/master
big fpu update
2019-12-15 08:35:14 +01:00
R. Belmont
3db368e052 m680x0 FPU updates: [R. Belmont]
- BCD packed decimal now supported, including k-factor
 - Improved FSAVE/FRESTORE including FPU reset when restoring a NULL frame
 - FREM instruction supported
 - Better disassembly of FPU instructions
2019-12-14 15:06:35 +01:00
R. Belmont
3ec8f605b4 680x0 FPU update: [R. Belmont]
- Implemented FMOVECR
 - Added load extended PC relative indexed support
 - Cleanup some duplicated code
2019-12-14 14:38:14 +01:00
R. Belmont
7a934a8506 680x0 FPU updates [R. Belmont]
- Rewritten to use SoftFloat instead of unportable native FP math
 - Support added for Motorola 96-bit extended floats
 - More addressing modes and conditions supported

The taitojc games function identically to the old implementation (I stepped
through the main matrix multiply in dendeg and the registers never diverged)
and speed on Core 2 Duo is a wash - sometimes softfloat's faster, sometimes
not, but the difference on -str 90 never exceeded 1%.
2019-12-14 13:14:18 +01:00
Karl Stenerud
710f795aaf
Merge pull request #52 from zelurker/master
the pmmu emulation
2019-12-13 20:00:27 +01:00
Emmanuel Anne
7efac187bd follow mame choice again
m68kmmu.h uses functions from m68kfpu.c which are static, so m68kfpu.c
can't be compiled alone anymore if we want to keep some basic
compatibility... I know, it's not super clean, but it's not my
choice...!
Also pmmu_translate_addr can't be inline anymore because of this (there
are quite a few functions from m68kcpu.h using it, and it can be
included only in m68kcpu.c !)
2019-12-13 13:40:42 +01:00
R. Belmont
530f644bd3 MC680x0 update
- Reworked PMMU/core interface so PMMU now sees all cop 0 instructions
 - Improved disassembly of PMMU instructions
 - Preliminary 68LC040 support
 - Fixed disassembly for EC/LC variants of '030/'040
2019-12-13 13:40:05 +01:00
Emmanuel Anne
3639c27e9c move the pmmu translation from ADDRESS_68K to the _fc functions
too dangerous in the ADDRESS_68K macro, this thing must be called only
once by address.
2019-12-13 11:41:40 +01:00
Karl Stenerud
556c574387
Merge pull request #51 from zelurker/master
2 fixes for the previous patches
2019-12-13 09:40:46 +01:00
R. Belmont
d5576b3797 m680x0 update:
- Added working PMMU address translation (not feature complete, but sufficient
  to boot several 68030 Macs in MESS)
- Fixed up disassembly of some PMMU instructions
- Added "68020 with 68851" CPU type
2019-12-12 17:34:22 +01:00
Emmanuel Anne
8126887721 move the reset_cycles to the cpu context 2019-12-12 10:41:54 +01:00
Karl Stenerud
0d60cea0e3
Merge pull request #50 from zelurker/master
a new set of patches from mame !
2019-12-12 09:46:07 +01:00
R. Belmont
29825f54a8 M680x0 update
- Add CPU types 68EC030, 68030, and 68EC040
- Start of 030/040 PMMU, including stubbed PMOVE
2019-12-12 00:08:26 +01:00
Ryan Holtz
fd717a418f Don't mention in whatsnew - puts the BSD optimization back in. 2019-12-11 19:31:08 +01:00
Ryan Holtz
6155d7171f Fleshed out SCC68070 definition in m68k core, for CD-i use in MESS [Harmony] 2019-12-11 19:22:30 +01:00
R. Belmont
093d69d650 m68k: don't save signal contexts on *BSD and Mac OS X [scarlet, R. Belmont] 2019-12-11 19:09:19 +01:00
Aaron Giles
6eb0d06b89 CPUs actually take some time to reset. Changed the 68000/68010 to eat an appropriate number of cycles after a reset. 2019-12-11 17:07:03 +01:00
Philip Pemberton
0c6b08b7f1 use CPU_RUN_MODE instead of BUS_ERROR_OCCURRED 2019-11-27 16:47:11 +00:00
Philip Pemberton
27787fbad6 remove unused m68ki_bus_error_return_jmp_buf 2019-11-27 16:26:52 +00:00
Philip Pemberton
aa603f5e29 always include setjmp 2019-11-27 16:08:04 +00:00
Philip Pemberton
8143681fd8 add bus error emulation 2019-11-27 16:06:53 +00:00
Karl Stenerud
8266fbe873 Removed INLINE and replaced it with static inline because it's part of the spec since c9x.
Beefed up the warnings and cleared them up.
m68kfpu.c is no longer included by m68kcpu.c.
Removed a bunch of internal function forward declarations, except for those used by macros.
Converted CRLF line endings to LF.
2019-11-03 19:33:07 +01:00
Karl Stenerud
890efa8bf7 Add C++ guards to header files 2019-11-03 12:51:12 +01:00
Emmanuel Anne
241d1ef7f0 illegal instruction callback 2019-09-06 13:48:36 +02:00
Aaron Giles
f0d95c3dee Fixed handling of interrupts when the CPU was in the STOP state. 2019-09-05 06:09:45 +02:00
Aaron Giles
0a75e6e85e Changed 68000 interrupts to only trigger during execution.
This means that multiple changes without any execution will be seen as atomic. It also means that PULSE_LINE no longer works for signalling IRQs.

Added checks in the debug build to catch people who try to use
PULSE_LINE for non-NMI and non-RESET input lines on CPUs that no
longer support direct interrupt generation. Over time expect this
list to increase.
2019-09-05 05:59:47 +02:00
Aaron Giles
5d9df94233 Fix m68k irq line support.
Before this patch a:
      cpunum_set_input_line(5, ASSERT_LINE);
      cpunum_set_input_line(3, ASSERT_LINE);
      cpunum_set_input_line(3, CLEAR_LINE);

    loses the state of line 5.  This patch fixes it by adding an explicit
    but optional "virtual irq line" support to the 68k interface.

    Fix m68k interrupt handling by some drivers.

    Clearing the NMI line to clear all the IRQ lines worked, but it just
    doesn't make sense.  Now that the irq lines are really independant,
    the handling can be simplified.
2019-09-05 05:55:21 +02:00
Aaron Giles
6ea3eaa77c Fixed 68000 prefetching operation.
Changed slapstic management to always install an opbase handler to more
aggressively catch code executing in the slapstic region. Updated all
drivers to separate the slapstic region of ROM into a different ROM
section from the fixed ROM.
2019-09-05 05:23:50 +02:00
Emmanuel Anne
438d1f4c14 a few quirks with the new m68ki_instr_hook format 2019-09-05 00:00:17 +02:00
Emmanuel Anne
b2ed988978 mame123: const, formating, and fix for reset instruction 2019-09-04 23:50:18 +02:00
Emmanuel Anne
25e031e169 mame120: version update to 3.31 2019-09-04 23:21:26 +02:00
Emmanuel Anne
bb4ca57463 mame115: u/sint32 definition update, movec for 040 2019-09-04 23:08:15 +02:00
Emmanuel Anne
abc09c9056 cmpild, tas and rte callbacks (mame110) 2019-09-04 22:45:50 +02:00
Emmanuel Anne
a9a9bba50b fpu emulation mainly (from mame98 to mame106)
I removed the mame specific stuff from m68kfpu.c to make it portable
again
2019-09-04 21:15:31 +02:00
Emmanuel Anne
de46c037cb mame098: support for 68040 ! 2019-09-04 19:05:11 +02:00
Derek Fawcus
3ae92a7166 Correct file modes
A number of non executable files had the execute bit set,
so clear it.
2018-07-13 18:47:16 +01:00
Karl Stenerud
769ea6bddc Merge pull request #22 from marhel/trap#n-cycles
Undo instruction cycles in trap#n exception
2016-04-28 08:41:21 -07:00
Karl Stenerud
c8faafcae7 Merge pull request #21 from marhel/trap-cycles
Undo instruction cycles in trap exception
2016-04-28 08:41:09 -07:00
Martin Hellspong
2b8ef21d76 Undo instruction cycles in trap#n exception
As trap#n exceptions are called from within a normal instruction handler
(as opposed to the address error handler that are called via a longjmp),
control will eventually return to the execution loop where the
instructions cycles will be deducted.

This fix adds the cycles for the instructions back to the available
cycles, or we will pay both the cost of the exception, and of the
instruction.
2016-04-27 23:40:54 +02:00
Martin Hellspong
843ce23f5c Undo instruction cycles in trap exception
As trap exceptions are called from within a normal instruction handler
(as opposed to the address error handler that are called via a longjmp),
control will eventually return to the execution loop where the
instructions cycles will be deducted.

This fix adds the cycles for the instructions back to the available
cycles, or we will pay both the cost of the exception, and of the
instruction.
2016-04-27 23:37:06 +02:00
Martin Hellspong
c19c87166d Guard re-entry of exec-loop after address errors
If an address error depletes all remaining cycles, control will no
longer re-enter the execution loop. This prevents consuming more cycles
when there are none remaining, and will in such situations no longer
execute at least one instruction from the address error exception
handler.
2016-04-27 22:51:58 +02:00
Martin Hellspong
78b3b1308a Don't deduct instruction cycles during address errors
The address error handler is called after a longjmp that does not pass
the part of the excecute loop that deducts instruction cycles. This
means we should not try to undo the instruction's cycles here, as other
exception handlers do, because this will incorrectly reduce the cost of
the exception by the number of cycles for the current instruction.

For costly instructions like MUL and DIV, this will in effect result in
a net increase of available cycles.
2016-04-27 21:49:18 +02:00