Commit graph

40 commits

Author SHA1 Message Date
bebbo
7ec87cd98a fix cycles for shift and mul 2024-02-03 21:18:59 +01:00
Poul-Henning Kamp
91878a8c8f Add void argument to make these proper prototypes 2021-08-15 06:58:45 +00:00
jotd
8633295412 in m68k_in.c
- fixed all CHK2/CMP2 instructions to support signed bounds. Previously it only worked with unsigned. Also sped up a bit
  by changing | by || in Z evaluation formula
- cptrapcc opcodes are still unsupported, but if no exception occurs, at least PC is properly updated
- trapt/trapcc 16 & 32 instructions: PC is updated before exception is triggered (or if exception isn't triggered). This fixes the
  return address value (just in case code returns from trap with RTE) and also the stackframe (XDAda 68040 compiler
  read the data parameter to check exception type, wrong exception type is read if stackframe is incorrect)

in m68kfpu.c

- fatalerror message fprintf => vfprintf
- added address register + displacement mode (mode 5, READ_EA_FPE/WRITE_EA_FPE), also changed prototype to it can be called with this mode
  from FMOVEM loop
- added immediate mode (READ_EA_FPE)
- fpgen_rm_reg (FMOVE to register): added a lot of missing condition code update (SET_CONDITION_CODES(REG_FP[dst]))
- added FSDIVS and FSMULS (easy as it's the same case as FDIV and FMUL). Updated condition codes for FDIV
- fmove_fpcr: connected softfloat 4 rounding modes to this instruction, that didn't set rounding at all, when it's
  perfectly emulated in softfloat module (just added:  float_rounding_mode = (REG_FPCR >> 4) & 0x3;)
- fmovem: added address register+displacement mode (READ_EA_FPE/WRITE_EA_FPE interface had to be changed)
- added FScc instruction
- note: number of cycles for the added instructions isn't exact
2020-06-07 11:45:28 +02:00
jotd
3b8e84fd83 m68k_in.c:
- fixed all CHK2/CMP2 instructions to support signed bounds. Previously it only worked with unsigned. Also sped up a bit
  by changing | by || in Z evaluation formula
- cptrapcc opcodes are still unsupported, but if no exception occurs, at least PC is properly updated
- trapt/trapcc 16 & 32 instructions: PC is updated before exception is triggered (or if exception isn't triggered). This fixes the
  return address value (just in case code returns from trap with RTE) and also the stackframe (XDAda 68040 compiler
  read the data parameter to check exception type, wrong exception type is read if stackframe is incorrect)

m68kfpu.c:

- fatalerror message fprintf => vfprintf
- added address register + displacement mode (mode 5, READ_EA_FPE/WRITE_EA_FPE), also changed prototype to it can be called with this mode
  from FMOVEM loop
- added immediate mode (READ_EA_FPE)
- fpgen_rm_reg (FMOVE to register): added a lot of missing condition code update (SET_CONDITION_CODES(REG_FP[dst]))
- added FSDIVS and FSMULS (easy as it's the same case as FDIV and FMUL). Updated condition codes for FDIV
- fmove_fpcr: connected softfloat 4 rounding modes to this instruction, that didn't set rounding at all, when it's
  perfectly emulated in softfloat module (just added:  float_rounding_mode = (REG_FPCR >> 4) & 0x3;)
- fmovem: added address register+displacement mode (READ_EA_FPE/WRITE_EA_FPE interface had to be changed)
- added FScc instruction
- note: number of cycles for the added instructions isn't exact
2020-06-06 14:41:52 +02:00
Karl Stenerud
710f795aaf
Merge pull request #52 from zelurker/master
the pmmu emulation
2019-12-13 20:00:27 +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
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
50baa65d4c 680x0 update: - Support PMOVE modes from PMMU - Allow the FPU to be used for both '030 and '040 - Add byte and word FPU loads/stores - Fixed buggy FPU 64-bit stores in the (An) addressing mode
If anyone has any ideas on how to sanely handle the 68k FPU's 96-bit "take
that, Intel" mode let me know ;-)
2019-12-12 21:24:43 +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
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
414590fc75 m68k: throw F-line trap correctly when PMMU instructions are hit on non-equipped CPUs. 2019-12-12 09:26:19 +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
Emmanuel Anne
24366e2462 missed some more cycle usage in mame081 ! 2019-12-11 16:27:24 +01: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
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
Emmanuel Anne
9667752d8d from mame088 to mame097
mainly disassembler stuff and mainly for mame only, but I keep that to
make applying later patches easier
2019-09-04 18:39:08 +02:00
Emmanuel Anne
d506471941 Revert "Fix MOVEM cycle-counts"
This reverts commit 577966a9dc.
2019-09-04 14:42:20 +02:00
Emmanuel Anne
a30886f11c Revert "Fix spelling, add note about unverified 020-counts"
This reverts commit 84df9a6300.
2019-09-04 14:41:24 +02:00
Emmanuel Anne
5bcffd74b8 Revert "Fix size of ANDI, EORI, ORI"
This reverts commit a16bd2bb28.
2019-09-04 14:40:34 +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
SteveKwok
df0fb402a8 Fix size of ANDI, EORI, ORI 2017-09-24 15:58:07 +08:00
SteveKwok
a16bd2bb28 Fix size of ANDI, EORI, ORI
According to the manual, the following three instructions size should be byte
    ANDI #imm, CCR
    EORI #imm, CCR
    ORI #imm, CCR
2017-09-24 15:53:14 +08:00
Martin Hellspong
b38f33bb21 Make STOP properly consume all cycles 2016-04-17 18:53:07 +02:00
Martin Hellspong
84df9a6300 Fix spelling, add note about unverified 020-counts 2016-03-17 23:08:07 +01:00
Martin Hellspong
577966a9dc Fix MOVEM cycle-counts
The cycle counts in m68k_in.c are representative for the minimum An/Dn
base case, and additional addressing mode cycle costs are added
elsewhere per mode.

But no An/Dn base case is available for MOVEM, so the data were likely
from the "address indirect" mode, causing an additional cost of 4 or 8
cycles for all addressing modes in the "." case in the table.

So we now fill the table with the cycles for a hypothetical register
base case not present for MOVEM, in order to end up with the correct
calculated cycles for the existing addressing modes.
2016-03-17 22:12:31 +01:00
Martin Hellspong
72d5f81103 Fix incorrect Scc cycle count
The Scc instruction with a register operand takes two extra cycles when
the condition is true, on the 68000. On the 010/020 there are no such
penalty.
2016-03-08 21:58:34 +01:00
Karl Stenerud
0c55d50af2 Merge pull request #12 from marhel/dbf-cycles
Fix cycle count for DBF instruction
2016-02-09 08:32:13 -08:00
Martin Hellspong
d74f063e81 Fix cycle count for DBF instruction
Which always consumes 14 cycles before, but now consumes either 10 or 14
cycles, depending on if the branch was taken (10), or not (14). This is
consistent with the behaviour of the other DBcc instructions, as well as
other compared emulators.
2016-02-09 08:23:00 +01:00
Martin Hellspong
974774db82 Fix suba operand evaluation order
The SUBA <ea>, An instruction (both word and long variants) must
evaluate the source operand before the destination operand (<ea> before
An), because in case of pi/pd addressing modes, the increment/decrement
side-effect to AY must happen before reading AX if both AX and AY
references the same register!
2016-02-04 10:31:37 +01:00
Martin Hellspong
52e7606e24 Fix adda operand evaluation order
The ADDA <ea>, An instruction (both word and long variants) must
evaluate the source operand before the destination operand (<ea> before
An), because in case of pi/pd addressing modes, the increment/decrement
side-effect to AY must happen before reading AX if both AX and AY
references the same register!
2016-01-30 16:23:34 +01:00
Martin Hellspong
148bcf1e2a Fix byte sized Bcc cycle counts
Fixes cycle counts for byte sized BHI, BLS, BCC, BCS, BNE, BEQ, BVC,
BVS, BPL, BMI, BGE, BLT, BGT and BLE on the 68000 and 68010, for both
'branch taken' and 'branch not taken' cases.

MC680000UM (9th ed) Table 8-9 lists the 68000 byte sized Bcc 'branch
taken' as 10 cycles, and 'not taken' as 8 cycles. Table 9-15 lists the
corresponding 68010 times as 10 and 6 cycles.

Musashi consumes 2 fewer cycles for each case.

The M68KMAKE_TABLE_BODY should specify the cycle count for 'branch
taken', as m68k_set_cpu_type() sets up relative adjustments for 'branch
not taken', used in the 14 different bcc_8 instructions.

The relative adjustment specified in Musashi (CYC_BCC_NOTAKE_B) is -2
for the 68000, and -4 for the 68010, so M68KMAKE_TABLE_BODY should say
10, not 8 for both CPU types.
2016-01-20 11:27:16 +01:00
Martin Hellspong
d0d207dfeb Fix incorrect cycle counts for some bit-shift ops
On the 68000 and 68010 shift distance affect execution time, so the
cycle cost of shifting must be taken into account. (On the 68020, shift
distance does not affect execution time.)

This commit fixes a bug in the adjustments made to the m68ki_cycles
table, for all shift operations with known shift distance (where the
shift distance is encoded in the instruction word).

Affects cycle counts for ASL/ASR, LSL/LSR, ROL/ROR, ROXL/ROXR on the
68000 and 68010.
2016-01-19 13:04:23 +01:00
Karl Stenerud
09e885364e Convert CD to LF so that m68kmake doesn't choke in unix. 2014-07-02 07:30:56 -07:00
Karl Stenerud
ecaf821d8f Version 3.4 2013-07-15 15:46:55 -07:00