Skip to content

Commit 4a7c424

Browse files
committed
-bus/isa/ubpnic.cpp: Added side effect checks.
-cpu/uml.cpp: Added a simplification rule for pathological cases of SEXT. -docs: Documented the DRC UML SEXT instruction. -Tidied some random stuff.
1 parent 2223127 commit 4a7c424

File tree

9 files changed

+195
-98
lines changed

9 files changed

+195
-98
lines changed

docs/source/techspecs/uml_instructions.rst

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2126,6 +2126,60 @@ Simplification rules
21262126
``src1`` and ``src2`` operands refer to the same memory location or
21272127
register.
21282128

2129+
.. _umlinst-sext:
2130+
2131+
SEXT
2132+
~~~~
2133+
2134+
Sign extend an integer value.
2135+
2136+
+--------------------------+---------------------------------------+
2137+
| Disassembly | Usage |
2138+
+==========================+=======================================+
2139+
| .. code-block:: | .. code-block:: |
2140+
| | |
2141+
| sext dst,src,size | UML_SEXT(block, dst, src, size); |
2142+
| dsext dst,src,size | UML_DSEXT(block, dst, src, size); |
2143+
+--------------------------+---------------------------------------+
2144+
2145+
Sets ``dst`` to the value of ``src`` sign extended from the size
2146+
specified by the ``size`` operand to the instruction size.
2147+
2148+
Operands
2149+
^^^^^^^^
2150+
2151+
dst (32-bit or 64-bit – memory, integer register)
2152+
The destination where the sign extended value will be stored.
2153+
src (32-bit or 64-bit – memory, integer register, immediate, map variable)
2154+
The value to sign extend.
2155+
size (access size)
2156+
The size of the value to sign extend. Must be ``SIZE_BYTE``
2157+
(8-bit), ``SIZE_WORD`` (16-bit) or ``SIZE_DWORD`` (32-bit).
2158+
2159+
Flags
2160+
^^^^^
2161+
2162+
carry (C)
2163+
Undefined.
2164+
overflow (V)
2165+
Undefined.
2166+
zero (Z)
2167+
Set if the result is zero, or cleared otherwise.
2168+
sign (S)
2169+
Set to the value of the most significant bit of the result (set if
2170+
the result is a negative signed integer value, or cleared
2171+
otherwise).
2172+
unordered (U)
2173+
Undefined.
2174+
2175+
Simplification rules
2176+
^^^^^^^^^^^^^^^^^^^^
2177+
2178+
* Converted to :ref:`MOV <umlinst-mov>`, :ref:`AND <umlinst-and>` or
2179+
:ref:`OR <umlinst-or>` if the ``src`` operand is an immediate value or
2180+
if the ``size`` operand specifies a size no smaller than the
2181+
instruction size.
2182+
21292183
.. _umlinst-lzcnt:
21302184

21312185
LZCNT

src/devices/bus/isa/ubpnic.cpp

Lines changed: 28 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,8 @@ class isa8_ubpnic_device
8484
, m_buf(nullptr)
8585
, m_idx(nullptr)
8686
, m_int_state(false)
87-
{
88-
}
87+
{
88+
}
8989

9090
protected:
9191
virtual tiny_rom_entry const *device_rom_region() const override ATTR_COLD;
@@ -212,42 +212,50 @@ void isa8_ubpnic_device::mem_map(address_map &map)
212212

213213
u8 isa8_ubpnic_device::txinit_r()
214214
{
215-
LOGMASKED(LOG_REGR, "%s: txinit_r\n", machine().describe_context());
215+
if (!machine().side_effects_disabled())
216+
{
217+
LOGMASKED(LOG_REGR, "%s: txinit_r\n", machine().describe_context());
216218

217-
m_intstat &= ~(INTSTAT_TPKTOK | INTSTAT_TXDONE);
219+
m_intstat &= ~(INTSTAT_TPKTOK | INTSTAT_TXDONE);
218220

219-
// trigger dma transfer
220-
txdrq_w(1);
221+
// trigger dma transfer
222+
txdrq_w(1);
223+
}
221224

222225
return 0;
223226
}
224227

225228
u8 isa8_ubpnic_device::clrpav_r()
226229
{
227-
LOGMASKED(LOG_REGR, "%s: clrpav_r\n", machine().describe_context());
230+
if (!machine().side_effects_disabled())
231+
{
232+
LOGMASKED(LOG_REGR, "%s: clrpav_r\n", machine().describe_context());
228233

229-
// initialize next empty page if rx buffer was full
230-
if (rxb_full())
231-
m_idx[m_epppav & EPP_EPP] = 0;
234+
// initialize next empty page if rx buffer was full
235+
if (rxb_full())
236+
m_idx[m_epppav & EPP_EPP] = 0;
232237

233-
m_epppav &= ~EPP_PAV;
238+
m_epppav &= ~EPP_PAV;
234239

235-
if (!(m_intstat & INTSTAT_PAVINT))
236-
irq<INTSTAT_PAVINT>(0);
240+
if (!(m_intstat & INTSTAT_PAVINT))
241+
irq<INTSTAT_PAVINT>(0);
242+
}
237243

238244
return 0;
239245
}
240246

241247
u8 isa8_ubpnic_device::intstat_r()
242248
{
243-
LOGMASKED(LOG_REGR, "%s: intstat_r 0x%02x\n", machine().describe_context(), m_intstat);
249+
if (!machine().side_effects_disabled())
250+
LOGMASKED(LOG_REGR, "%s: intstat_r 0x%02x\n", machine().describe_context(), m_intstat);
244251

245252
return m_intstat;
246253
}
247254

248255
u8 isa8_ubpnic_device::epppav_r()
249256
{
250-
LOGMASKED(LOG_REGR, "%s: epppav_r 0x%02x\n", machine().describe_context(), m_epppav);
257+
if (!machine().side_effects_disabled())
258+
LOGMASKED(LOG_REGR, "%s: epppav_r 0x%02x\n", machine().describe_context(), m_epppav);
251259

252260
return m_epppav;
253261
}
@@ -327,6 +335,7 @@ void isa8_ubpnic_device::intctl_w(u8 data)
327335

328336
interrupt();
329337
}
338+
330339
void isa8_ubpnic_device::fppmie_w(u8 data)
331340
{
332341
LOGMASKED(LOG_REGW, "%s: fppmie_w 0x%02x\n", machine().describe_context(), data);
@@ -338,7 +347,8 @@ void isa8_ubpnic_device::fppmie_w(u8 data)
338347

339348
u8 isa8_ubpnic_device::rpidx_r(offs_t offset)
340349
{
341-
LOGMASKED(LOG_REGR, "%s: rpidx_r 0x%02x data 0x%02x\n", machine().describe_context(), offset, m_idx[offset]);
350+
if (!machine().side_effects_disabled())
351+
LOGMASKED(LOG_REGR, "%s: rpidx_r 0x%02x data 0x%02x\n", machine().describe_context(), offset, m_idx[offset]);
342352

343353
return m_idx[offset];
344354
}
@@ -352,7 +362,8 @@ void isa8_ubpnic_device::rpidx_w(offs_t offset, u8 data)
352362

353363
u8 isa8_ubpnic_device::buf_r(offs_t offset)
354364
{
355-
LOGMASKED(LOG_BUF, "%s: buf_r 0x%02x data 0x%02x\n", machine().describe_context(), offset, m_buf[offset]);
365+
if (!machine().side_effects_disabled())
366+
LOGMASKED(LOG_BUF, "%s: buf_r 0x%02x data 0x%02x\n", machine().describe_context(), offset, m_buf[offset]);
356367

357368
return m_buf[offset];
358369
}

src/devices/bus/thomson/cd90_351.cpp

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,39 @@
1010

1111
#include "emu.h"
1212
#include "cd90_351.h"
13+
14+
#include "imagedev/floppy.h"
15+
#include "machine/thmfc1.h"
16+
1317
#include "formats/sap_dsk.h"
1418
#include "formats/thom_dsk.h"
15-
#include "machine/thmfc1.h"
1619

17-
DEFINE_DEVICE_TYPE(CD90_351, cd90_351_device, "cd90_351", "Thomson CD 90-351 Diskette Controller")
20+
namespace {
21+
22+
class cd90_351_device : public device_t, public thomson_extension_interface
23+
{
24+
public:
25+
cd90_351_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
26+
virtual ~cd90_351_device() = default;
27+
28+
virtual void rom_map(address_map &map) override ATTR_COLD;
29+
virtual void io_map(address_map &map) override ATTR_COLD;
30+
31+
protected:
32+
virtual const tiny_rom_entry *device_rom_region() const override ATTR_COLD;
33+
virtual void device_add_mconfig(machine_config &config) override ATTR_COLD;
34+
virtual void device_start() override ATTR_COLD;
35+
virtual void device_reset() override ATTR_COLD;
36+
37+
private:
38+
required_memory_region m_rom;
39+
memory_bank_creator m_rom_bank;
40+
41+
static void floppy_formats(format_registration &fr);
42+
static void floppy_drives(device_slot_interface &device);
43+
44+
void bank_w(u8 data);
45+
};
1846

1947
cd90_351_device::cd90_351_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
2048
device_t(mconfig, CD90_351, tag, owner, clock),
@@ -86,3 +114,7 @@ void cd90_351_device::bank_w(u8 data)
86114
logerror("bank_w %d\n", data & 3);
87115
m_rom_bank->set_entry(data & 3);
88116
}
117+
118+
} // anonymous namespace
119+
120+
DEFINE_DEVICE_TYPE_PRIVATE(CD90_351, thomson_extension_interface, cd90_351_device, "cd90_351", "Thomson CD 90-351 Diskette Controller")

src/devices/bus/thomson/cd90_351.h

Lines changed: 3 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -5,38 +5,13 @@
55
//
66
// Handles up to two 3.5 dual-sided drives (DD 90-352)
77
// or up to two 2.8 dual-sided QDD drivers (QD 90-280)
8-
98
#ifndef MAME_BUS_THOMSON_CD90_351_H
109
#define MAME_BUS_THOMSON_CD90_351_H
1110

12-
#include "extension.h"
13-
#include "imagedev/floppy.h"
14-
15-
class cd90_351_device : public device_t, public thomson_extension_interface
16-
{
17-
public:
18-
cd90_351_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
19-
virtual ~cd90_351_device() = default;
20-
21-
virtual void rom_map(address_map &map) override ATTR_COLD;
22-
virtual void io_map(address_map &map) override ATTR_COLD;
11+
#pragma once
2312

24-
protected:
25-
virtual const tiny_rom_entry *device_rom_region() const override ATTR_COLD;
26-
virtual void device_add_mconfig(machine_config &config) override ATTR_COLD;
27-
virtual void device_start() override ATTR_COLD;
28-
virtual void device_reset() override ATTR_COLD;
29-
30-
private:
31-
required_memory_region m_rom;
32-
memory_bank_creator m_rom_bank;
33-
34-
static void floppy_formats(format_registration &fr);
35-
static void floppy_drives(device_slot_interface &device);
36-
37-
void bank_w(u8 data);
38-
};
13+
#include "extension.h"
3914

40-
DECLARE_DEVICE_TYPE(CD90_351, cd90_351_device)
15+
DECLARE_DEVICE_TYPE(CD90_351, thomson_extension_interface)
4116

4217
#endif

src/devices/cpu/uml.cpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -427,6 +427,19 @@ struct uml::instruction::simplify_op
427427
}
428428
convert_to_mov_immediate(inst, val);
429429
}
430+
else if ((1 << inst.param(2).size()) >= inst.size())
431+
{
432+
if (inst.flags())
433+
{
434+
inst.m_opcode = OP_AND;
435+
inst.m_param[2] = size_mask(inst);
436+
}
437+
else
438+
{
439+
inst.m_opcode = OP_MOV;
440+
inst.m_numparams = 2;
441+
}
442+
}
430443
}
431444

432445
static void roland(instruction &inst)

src/devices/video/upd7220.cpp

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1426,14 +1426,12 @@ void upd7220_device::process_fifo()
14261426
LOGCMD3("WDAT PATTERN=%04x\n", m_pattern);
14271427
if (m_figs.m_figure_type)
14281428
break;
1429-
LOGCMD3("- CR=%02x (%02x %02x) (%c) EAD=%06x - FIGS DC=%04x\n"
1430-
, m_cr
1431-
, m_pr[2]
1432-
, m_pr[1]
1433-
, m_pr[1] ? m_pr[1]:' '
1434-
, m_ead
1435-
, m_figs.m_dc
1436-
);
1429+
LOGCMD3("- CR=%02x (%02x %02x) (%c) EAD=%06x - FIGS DC=%04x\n",
1430+
m_cr,
1431+
m_pr[2], m_pr[1],
1432+
m_pr[1] ? m_pr[1] : ' ',
1433+
m_ead,
1434+
m_figs.m_dc);
14371435
fifo_set_direction(FIFO_WRITE);
14381436

14391437
wdat((m_cr & 0x18) >> 3,m_cr & 3);

src/mame/atari/atarisy2.h

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,23 @@
55
Atari System 2 hardware
66
77
*************************************************************************/
8+
#ifndef MAME_ATARI_ATARISY2_H
9+
#define MAME_ATARI_ATARISY2_H
10+
11+
#pragma once
12+
13+
#include "atarimo.h"
14+
#include "slapstic.h"
815

916
#include "cpu/m6502/m6502.h"
1017
#include "cpu/t11/t11.h"
1118
#include "machine/gen_latch.h"
12-
#include "slapstic.h"
1319
#include "machine/timer.h"
1420
#include "machine/watchdog.h"
1521
#include "sound/pokey.h"
1622
#include "sound/tms5220.h"
1723
#include "sound/ymopm.h"
18-
#include "atarimo.h"
24+
1925
#include "emupal.h"
2026
#include "screen.h"
2127
#include "tilemap.h"
@@ -53,18 +59,18 @@ class atarisy2_state : public driver_device
5359
, m_leds(*this, "led%u", 0U)
5460
{ }
5561

56-
void init_ssprint();
57-
void init_apb();
58-
void init_csprint();
59-
void init_paperboy();
60-
void init_720();
62+
void init_ssprint() ATTR_COLD;
63+
void init_apb() ATTR_COLD;
64+
void init_csprint() ATTR_COLD;
65+
void init_paperboy() ATTR_COLD;
66+
void init_720() ATTR_COLD;
6167

62-
void atarisy2(machine_config &config);
63-
void apb(machine_config &config);
64-
void paperboy(machine_config &config);
65-
void ssprint(machine_config &config);
66-
void _720(machine_config &config);
67-
void csprint(machine_config &config);
68+
void atarisy2(machine_config &config) ATTR_COLD;
69+
void apb(machine_config &config) ATTR_COLD;
70+
void paperboy(machine_config &config) ATTR_COLD;
71+
void ssprint(machine_config &config) ATTR_COLD;
72+
void _720(machine_config &config) ATTR_COLD;
73+
void csprint(machine_config &config) ATTR_COLD;
6874

6975
protected:
7076
virtual void machine_start() override ATTR_COLD;
@@ -167,3 +173,5 @@ class atarisy2_state : public driver_device
167173
void main_map(address_map &map) ATTR_COLD;
168174
void sound_map(address_map &map) ATTR_COLD;
169175
};
176+
177+
#endif // MAME_ATARI_ATARISY2_H

src/mame/dynax/hanafuda.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
// license:BSD-3-Clause
22
// copyright-holders:Fabio Priuli
3+
#ifndef MAME_DYNAX_HANAFUDA_H
4+
#define MAME_DYNAX_HANAFUDA_H
5+
6+
#pragma once
37

48
INPUT_PORTS_EXTERN(dynax_hanafuda_keys);
59
INPUT_PORTS_EXTERN(dynax_hanafuda_keys_bet);
10+
11+
#endif // MAME_DYNAX_HANAFUDA_H

0 commit comments

Comments
 (0)