odyssey2: shorthand variable types in source code

This commit is contained in:
hap 2020-09-28 20:29:32 +02:00
parent 56f30e3ca0
commit b16e7df42a
22 changed files with 168 additions and 168 deletions

View File

@ -22,7 +22,7 @@ DEFINE_DEVICE_TYPE(O2_ROM_4IN1, o2_4in1_device, "o2_4in1", "Odyssey 2 Videopac 4
// o2_4in1_device - constructor
//-------------------------------------------------
o2_4in1_device::o2_4in1_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
o2_4in1_device::o2_4in1_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) :
device_t(mconfig, O2_ROM_4IN1, tag, owner, clock),
device_o2_cart_interface(mconfig, *this)
{ }

View File

@ -21,7 +21,7 @@ class o2_4in1_device : public device_t,
{
public:
// construction/destruction
o2_4in1_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
o2_4in1_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock);
protected:
// device-level overrides

View File

@ -21,7 +21,7 @@ DEFINE_DEVICE_TYPE(O2_ROM_CHESS, o2_chess_device, "o2_chess", "Odyssey 2 Videopa
// o2_chess_device - constructor
//-------------------------------------------------
o2_chess_device::o2_chess_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
o2_chess_device::o2_chess_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) :
device_t(mconfig, O2_ROM_CHESS, tag, owner, clock),
device_o2_cart_interface(mconfig, *this),
m_maincpu(*this, "maincpu"),

View File

@ -24,7 +24,7 @@ class o2_chess_device : public device_t,
{
public:
// construction/destruction
o2_chess_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
o2_chess_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock);
protected:
// device-level overrides

View File

@ -30,7 +30,7 @@ DEFINE_DEVICE_TYPE(O2_ROM_HOMECOMP, o2_homecomp_device, "o2_homecomp", "Odyssey
// o2_homecomp_device - constructor
//-------------------------------------------------
o2_homecomp_device::o2_homecomp_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
o2_homecomp_device::o2_homecomp_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) :
device_t(mconfig, O2_ROM_HOMECOMP, tag, owner, clock),
device_o2_cart_interface(mconfig, *this),
m_maincpu(*this, "maincpu"),

View File

@ -25,7 +25,7 @@ class o2_homecomp_device : public device_t,
{
public:
// construction/destruction
o2_homecomp_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
o2_homecomp_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock);
protected:
// device-level overrides

View File

@ -18,7 +18,7 @@ DEFINE_DEVICE_TYPE(O2_ROM_KTAA, o2_ktaa_device, "o2_ktaa", "Odyssey 2 Homebrew K
// o2_ktaa_device - constructor
//-------------------------------------------------
o2_ktaa_device::o2_ktaa_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
o2_ktaa_device::o2_ktaa_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) :
device_t(mconfig, O2_ROM_KTAA, tag, owner, clock),
device_o2_cart_interface(mconfig, *this)
{ }

View File

@ -21,7 +21,7 @@ class o2_ktaa_device : public device_t,
{
public:
// construction/destruction
o2_ktaa_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
o2_ktaa_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock);
protected:
// device-level overrides

View File

@ -26,7 +26,7 @@ DEFINE_DEVICE_TYPE(O2_ROM_RALLY, o2_rally_device, "o2_rally", "Odyssey 2 Videopa
// o2_rally_device - constructor
//-------------------------------------------------
o2_rally_device::o2_rally_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
o2_rally_device::o2_rally_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) :
device_t(mconfig, O2_ROM_RALLY, tag, owner, clock),
device_o2_cart_interface(mconfig, *this)
{ }

View File

@ -21,7 +21,7 @@ class o2_rally_device : public device_t,
{
public:
// construction/destruction
o2_rally_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
o2_rally_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock);
protected:
// device-level overrides

View File

@ -16,7 +16,7 @@ DEFINE_DEVICE_TYPE(O2_ROM_STD, o2_rom_device, "o2_rom", "Odyssey 2 Standard Cart
// o2_rom_device - constructor
//-------------------------------------------------
o2_rom_device::o2_rom_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
o2_rom_device::o2_rom_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) :
device_t(mconfig, O2_ROM_STD, tag, owner, clock),
device_o2_cart_interface(mconfig, *this)
{ }

View File

@ -21,7 +21,7 @@ class o2_rom_device : public device_t,
{
public:
// construction/destruction
o2_rom_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
o2_rom_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock);
protected:
// device-level overrides

View File

@ -50,7 +50,7 @@ device_o2_cart_interface::~device_o2_cart_interface()
//-------------------------------------------------
// o2_cart_slot_device - constructor
//-------------------------------------------------
o2_cart_slot_device::o2_cart_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
o2_cart_slot_device::o2_cart_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock)
: device_t(mconfig, O2_CART_SLOT, tag, owner, clock)
, device_image_interface(mconfig, *this)
, device_single_card_slot_interface<device_o2_cart_interface>(mconfig, *this)
@ -148,7 +148,7 @@ image_init_result o2_cart_slot_device::call_load()
}
else
{
uint32_t size = length();
u32 size = length();
fread(m_cart->m_rom, size);
m_type = (size == 0x4000) ? O2_RALLY : O2_STD;
@ -174,7 +174,7 @@ std::string o2_cart_slot_device::get_default_card_software(get_default_card_soft
if (hook.image_file())
{
const char *slot_string;
uint32_t size = hook.image_file()->size();
u32 size = hook.image_file()->size();
int type = (size == 0x4000) ? O2_RALLY : O2_STD;
slot_string = o2_get_slot(type);
@ -190,7 +190,7 @@ std::string o2_cart_slot_device::get_default_card_software(get_default_card_soft
read_rom**
-------------------------------------------------*/
uint8_t o2_cart_slot_device::read_rom04(offs_t offset)
u8 o2_cart_slot_device::read_rom04(offs_t offset)
{
if (m_cart)
return m_cart->read_rom04(offset);
@ -198,7 +198,7 @@ uint8_t o2_cart_slot_device::read_rom04(offs_t offset)
return 0xff;
}
uint8_t o2_cart_slot_device::read_rom0c(offs_t offset)
u8 o2_cart_slot_device::read_rom0c(offs_t offset)
{
if (m_cart)
return m_cart->read_rom0c(offset);
@ -210,13 +210,13 @@ uint8_t o2_cart_slot_device::read_rom0c(offs_t offset)
io
-------------------------------------------------*/
void o2_cart_slot_device::io_write(offs_t offset, uint8_t data)
void o2_cart_slot_device::io_write(offs_t offset, u8 data)
{
if (m_cart)
m_cart->io_write(offset, data);
}
uint8_t o2_cart_slot_device::io_read(offs_t offset)
u8 o2_cart_slot_device::io_read(offs_t offset)
{
if (m_cart)
return m_cart->io_read(offset);

View File

@ -37,30 +37,30 @@ public:
virtual ~device_o2_cart_interface();
// reading and writing
virtual uint8_t read_rom04(offs_t offset) { return 0xff; }
virtual uint8_t read_rom0c(offs_t offset) { return 0xff; }
virtual void write_p1(uint8_t data) { }
virtual void write_p2(uint8_t data) { }
virtual u8 read_rom04(offs_t offset) { return 0xff; }
virtual u8 read_rom0c(offs_t offset) { return 0xff; }
virtual void write_p1(u8 data) { }
virtual void write_p2(u8 data) { }
virtual void io_write(offs_t offset, uint8_t data) { }
virtual uint8_t io_read(offs_t offset) { return 0xff; }
virtual void io_write(offs_t offset, u8 data) { }
virtual u8 io_read(offs_t offset) { return 0xff; }
virtual DECLARE_READ_LINE_MEMBER(t0_read) { return 0; }
virtual int b_read() { return -1; }
virtual void cart_init() { } // called after loading ROM
uint8_t* get_rom_base() { return m_rom ? &m_rom[0] : nullptr; }
uint32_t get_rom_size() { return m_rom ? m_rom.bytes() : 0; }
u8* get_rom_base() { return m_rom ? &m_rom[0] : nullptr; }
u32 get_rom_size() { return m_rom ? m_rom.bytes() : 0; }
uint8_t* get_voice_base() { return m_voice ? &m_voice[0] : nullptr; }
uint32_t get_voice_size() { return m_voice ? m_voice.bytes() : 0; }
u8* get_voice_base() { return m_voice ? &m_voice[0] : nullptr; }
u32 get_voice_size() { return m_voice ? m_voice.bytes() : 0; }
protected:
device_o2_cart_interface(const machine_config &mconfig, device_t &device);
optional_shared_ptr<uint8_t> m_rom;
optional_shared_ptr<uint8_t> m_exrom;
optional_shared_ptr<uint8_t> m_voice;
optional_shared_ptr<u8> m_rom;
optional_shared_ptr<u8> m_exrom;
optional_shared_ptr<u8> m_voice;
};
@ -82,7 +82,7 @@ public:
set_fixed(false);
}
o2_cart_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0);
o2_cart_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock = 0);
virtual ~o2_cart_slot_device();
// image-level overrides
@ -105,15 +105,15 @@ public:
device_o2_cart_interface* cart() { return m_cart; }
// reading and writing
uint8_t read_rom04(offs_t offset);
uint8_t read_rom0c(offs_t offset);
void io_write(offs_t offset, uint8_t data);
uint8_t io_read(offs_t offset);
u8 read_rom04(offs_t offset);
u8 read_rom0c(offs_t offset);
void io_write(offs_t offset, u8 data);
u8 io_read(offs_t offset);
DECLARE_READ_LINE_MEMBER(t0_read) { if (m_cart) return m_cart->t0_read(); else return 0; }
int b_read();
void write_p1(uint8_t data) { if (m_cart) m_cart->write_p1(data); }
void write_p2(uint8_t data) { if (m_cart) m_cart->write_p2(data); }
void write_p1(u8 data) { if (m_cart) m_cart->write_p1(data); }
void write_p2(u8 data) { if (m_cart) m_cart->write_p2(data); }
protected:
// device-level overrides

View File

@ -24,7 +24,7 @@ DEFINE_DEVICE_TYPE(O2_ROM_VOICE, o2_voice_device, "o2_voice", "Odyssey 2 The Voi
// o2_voice_device - constructor
//-------------------------------------------------
o2_voice_device::o2_voice_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
o2_voice_device::o2_voice_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) :
device_t(mconfig, O2_ROM_VOICE, tag, owner, clock),
device_o2_cart_interface(mconfig, *this),
m_speech(*this, "speech"),

View File

@ -22,7 +22,7 @@ class o2_voice_device : public device_t,
{
public:
// construction/destruction
o2_voice_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
o2_voice_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock);
virtual void cart_init() override;

View File

@ -34,7 +34,7 @@ TODO:
DEFINE_DEVICE_TYPE(EF9340_1, ef9340_1_device, "ef9340_1", "Thomson EF9340+EF9341")
ef9340_1_device::ef9340_1_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
ef9340_1_device::ef9340_1_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock)
: device_t(mconfig, EF9340_1, tag, owner, clock)
, device_video_interface(mconfig, *this)
, m_charset(*this, "ef9340_1")
@ -128,7 +128,7 @@ void ef9340_1_device::device_timer(emu_timer &timer, device_timer_id id, int par
}
uint16_t ef9340_1_device::ef9340_get_c_addr(uint8_t x, uint8_t y)
u16 ef9340_1_device::ef9340_get_c_addr(u8 x, u8 y)
{
if ( ( y & 0x18 ) == 0x18 )
{
@ -157,7 +157,7 @@ void ef9340_1_device::ef9340_inc_c()
}
void ef9340_1_device::ef9341_write( uint8_t command, uint8_t b, uint8_t data )
void ef9340_1_device::ef9341_write( u8 command, u8 b, u8 data )
{
LOG("ef9341 %s write, t%s, data %02X\n", command ? "command" : "data", b ? "B" : "A", data );
@ -205,7 +205,7 @@ void ef9340_1_device::ef9341_write( uint8_t command, uint8_t b, uint8_t data )
{
if ( b )
{
uint16_t addr = ef9340_get_c_addr( m_ef9340.X, m_ef9340.Y ) & 0x3ff;
u16 addr = ef9340_get_c_addr( m_ef9340.X, m_ef9340.Y ) & 0x3ff;
m_ef9341.TB = data;
m_ef9341.busy = true;
@ -224,9 +224,9 @@ void ef9340_1_device::ef9341_write( uint8_t command, uint8_t b, uint8_t data )
case 0x80: /* Write slice */
{
uint8_t a = m_ram_a[addr];
uint8_t b = m_ram_b[addr];
uint8_t slice = m_ef9340.M & 0x0f;
u8 a = m_ram_a[addr];
u8 b = m_ram_b[addr];
u8 slice = m_ef9340.M & 0x0f;
if (b >= 0xa0)
m_write_exram(a << 12 | b << 4 | slice, m_ef9341.TA);
@ -249,9 +249,9 @@ void ef9340_1_device::ef9341_write( uint8_t command, uint8_t b, uint8_t data )
}
uint8_t ef9340_1_device::ef9341_read( uint8_t command, uint8_t b )
u8 ef9340_1_device::ef9341_read( u8 command, u8 b )
{
uint8_t data;
u8 data;
LOG("ef9341 %s read, t%s\n", command ? "command" : "data", b ? "B" : "A" );
@ -270,7 +270,7 @@ uint8_t ef9340_1_device::ef9341_read( uint8_t command, uint8_t b )
{
if ( b )
{
uint16_t addr = ef9340_get_c_addr( m_ef9340.X, m_ef9340.Y ) & 0x3ff;
u16 addr = ef9340_get_c_addr( m_ef9340.X, m_ef9340.Y ) & 0x3ff;
data = m_ef9341.TB;
m_ef9341.busy = true;
@ -289,16 +289,16 @@ uint8_t ef9340_1_device::ef9341_read( uint8_t command, uint8_t b )
case 0xA0: /* Read slice */
{
uint8_t a = m_ram_a[addr];
uint8_t b = m_ram_b[addr];
uint8_t slice = m_ef9340.M & 0x0f;
u8 a = m_ram_a[addr];
u8 b = m_ram_b[addr];
u8 slice = m_ef9340.M & 0x0f;
m_ef9341.TA = 0xff;
m_ef9341.TB = 0xff;
if (b >= 0xa0)
m_ef9341.TA = m_read_exram(a << 12 | b << 4 | slice);
else if (slice < 10)
else if (b < 0x80 && slice < 10)
m_ef9341.TA = m_charset[(((a & 0x80) | (b & 0x7f)) * 10) + slice];
// Increment slice number
@ -337,9 +337,9 @@ void ef9340_1_device::ef9340_scanline(int vpos)
if (m_ef9340.R & 0x01 && vpos < max_vpos)
{
int y_row = 0;
uint16_t char_data = 0x00;
uint8_t fg = 0;
uint8_t bg = 0;
u16 char_data = 0x00;
u8 fg = 0;
u8 bg = 0;
bool underline = false;
bool blank = false;
bool w_parity = false;
@ -369,9 +369,9 @@ void ef9340_1_device::ef9340_scanline(int vpos)
for (int x = 0; x < 40; x++)
{
int s = slice;
uint16_t addr = ef9340_get_c_addr(x, y_row);
uint8_t a = m_ram_a[addr];
uint8_t b = m_ram_b[addr];
u16 addr = ef9340_get_c_addr(x, y_row);
u8 a = m_ram_a[addr];
u8 b = m_ram_b[addr];
bool blink = m_ef9340.R & 0x80 && m_ef9340.blink;
bool cursor = m_ef9340.R & 0x10 && x == m_ef9340.X && y_row == m_ef9340.Y;
bool invert = cursor && !blink;
@ -464,7 +464,7 @@ void ef9340_1_device::ef9340_scanline(int vpos)
for (int i = 0; i < 8; i++)
{
uint16_t d = blank ? 0 : (char_data & 1) ? fg : bg;
u16 d = blank ? 0 : (char_data & 1) ? fg : bg;
m_tmp_bitmap.pix(m_offset_y + vpos, m_offset_x + x*8 + i) = d | 8;
char_data >>= 1;
}
@ -493,7 +493,7 @@ void ef9340_1_device::ef9340_scanline(int vpos)
}
uint32_t ef9340_1_device::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
u32 ef9340_1_device::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
// note: palette d3 is transparency (datasheet calls it "I"), this handler masks it off
for (int y = cliprect.min_y; y <= cliprect.max_y; y++)

View File

@ -18,7 +18,7 @@ class ef9340_1_device : public device_t,
public:
// construction/destruction
template <typename T>
ef9340_1_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock, T &&screen_tag)
ef9340_1_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock, T &&screen_tag)
: ef9340_1_device(mconfig, tag, owner, clock)
{
set_screen(std::forward<T>(screen_tag));
@ -29,13 +29,13 @@ public:
auto write_exram() { return m_write_exram.bind(); } // ADR0-ADR3 in a0-a3, B in a4-a11, A in a12-a19
auto read_exram() { return m_read_exram.bind(); } // "
ef9340_1_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
ef9340_1_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock);
inline bitmap_ind16 *get_bitmap() { return &m_tmp_bitmap; }
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
u32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void ef9341_write( uint8_t command, uint8_t b, uint8_t data );
uint8_t ef9341_read( uint8_t command, uint8_t b );
void ef9341_write( u8 command, u8 b, u8 data );
u8 ef9341_read( u8 command, u8 b );
protected:
// device-level overrides
@ -43,7 +43,7 @@ protected:
virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override;
virtual const tiny_rom_entry *device_rom_region() const override;
inline uint16_t ef9340_get_c_addr(uint8_t x, uint8_t y);
inline u16 ef9340_get_c_addr(u8 x, u8 y);
inline void ef9340_inc_c();
void ef9340_scanline(int vpos);
@ -55,7 +55,7 @@ protected:
emu_timer *m_line_timer;
emu_timer *m_blink_timer;
required_region_ptr<uint8_t> m_charset;
required_region_ptr<u8> m_charset;
bitmap_ind16 m_tmp_bitmap;
@ -64,25 +64,25 @@ protected:
struct
{
uint8_t TA;
uint8_t TB;
u8 TA;
u8 TB;
bool busy;
} m_ef9341;
struct
{
uint8_t X;
uint8_t Y;
uint8_t Y0;
uint8_t R;
uint8_t M;
u8 X;
u8 Y;
u8 Y0;
u8 R;
u8 M;
bool blink;
int blink_prescaler;
bool h_parity;
} m_ef9340;
uint8_t m_ram_a[0x400];
uint8_t m_ram_b[0x400];
u8 m_ram_a[0x400];
u8 m_ram_b[0x400];
devcb_write8 m_write_exram;
devcb_read8 m_read_exram;

View File

@ -24,13 +24,13 @@ DEFINE_DEVICE_TYPE(I8245, i8245_device, "i8245", "Intel 8245")
// i8244_device - constructor
//-------------------------------------------------
i8244_device::i8244_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
i8244_device::i8244_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock)
: i8244_device(mconfig, I8244, tag, owner, clock)
{
}
i8244_device::i8244_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock)
i8244_device::i8244_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock)
: device_t(mconfig, type, tag, owner, clock)
, device_sound_interface(mconfig, *this)
, device_video_interface(mconfig, *this)
@ -40,7 +40,7 @@ i8244_device::i8244_device(const machine_config &mconfig, device_type type, cons
}
i8245_device::i8245_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
i8245_device::i8245_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock)
: i8244_device(mconfig, I8245, tag, owner, clock)
{
}
@ -280,9 +280,9 @@ bool i8244_device::invalid_register( offs_t offset, bool rw )
}
uint8_t i8244_device::read(offs_t offset)
u8 i8244_device::read(offs_t offset)
{
uint8_t data;
u8 data;
offset = fix_register_mirrors(offset);
@ -337,7 +337,7 @@ uint8_t i8244_device::read(offs_t offset)
}
void i8244_device::write(offs_t offset, uint8_t data)
void i8244_device::write(offs_t offset, u8 data)
{
offset = fix_register_mirrors(offset);
@ -470,7 +470,7 @@ void i8244_device::write_cx(int x, bool cx)
}
uint32_t i8244_device::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
u32 i8244_device::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
/* Draw background color */
bitmap.fill(bitswap<3>(m_vdc.s.color,3,4,5), cliprect);
@ -483,7 +483,7 @@ uint32_t i8244_device::screen_update(screen_device &screen, bitmap_ind16 &bitmap
/* Display grid if enabled */
if ( m_vdc.s.control & 0x08 )
{
uint16_t color = bitswap<4>(m_vdc.s.color,6,0,1,2);
u16 color = bitswap<4>(m_vdc.s.color,6,0,1,2);
int x_grid_offset = 13;
int y_grid_offset = 24;
int width = 16;
@ -590,11 +590,11 @@ uint32_t i8244_device::screen_update(screen_device &screen, bitmap_ind16 &bitmap
for ( int j = 0; j < ARRAY_LENGTH( m_vdc.s.quad[0].single ); j++, x += 16 )
{
uint16_t color = 8 + ( ( m_vdc.s.quad[i].single[j].color >> 1 ) & 0x07 );
u16 color = 8 + ( ( m_vdc.s.quad[i].single[j].color >> 1 ) & 0x07 );
int offset = ( m_vdc.s.quad[i].single[j].ptr | ( ( m_vdc.s.quad[i].single[j].color & 0x01 ) << 8 ) ) + ( y >> 1 ) + ( ( scanline - y ) >> 1 );
uint8_t chr = m_charset[ offset & 0x1FF ];
u8 chr = m_charset[ offset & 0x1FF ];
for ( uint8_t m = 0x80; m > 0; m >>= 1, x += 2 )
for ( u8 m = 0x80; m > 0; m >>= 1, x += 2 )
{
if ( chr & m )
{
@ -637,12 +637,12 @@ uint32_t i8244_device::screen_update(screen_device &screen, bitmap_ind16 &bitmap
if ( y <= scanline && scanline < y + height * 2 )
{
uint16_t color = 8 + ( ( m_vdc.s.foreground[i].color >> 1 ) & 0x07 );
u16 color = 8 + ( ( m_vdc.s.foreground[i].color >> 1 ) & 0x07 );
int offset = ( m_vdc.s.foreground[i].ptr | ( ( m_vdc.s.foreground[i].color & 0x01 ) << 8 ) ) + ( y >> 1 ) + ( ( scanline - y ) >> 1 );
uint8_t chr = m_charset[ offset & 0x1FF ];
u8 chr = m_charset[ offset & 0x1FF ];
int x = (m_vdc.s.foreground[i].x + 5) * 2;
for ( uint8_t m = 0x80; m > 0; m >>= 1, x += 2 )
for ( u8 m = 0x80; m > 0; m >>= 1, x += 2 )
{
if ( chr & m )
{
@ -685,8 +685,8 @@ uint32_t i8244_device::screen_update(screen_device &screen, bitmap_ind16 &bitmap
if ( y <= scanline && scanline < y + height * zoom_px )
{
uint16_t color = 8 + ( ( m_vdc.s.sprites[i].color >> 3 ) & 0x07 );
uint8_t chr = m_vdc.s.shape[i][ ( ( scanline - y ) / zoom_px ) ];
u16 color = 8 + ( ( m_vdc.s.sprites[i].color >> 3 ) & 0x07 );
u8 chr = m_vdc.s.shape[i][ ( ( scanline - y ) / zoom_px ) ];
int x = (m_vdc.s.sprites[i].x + 5) * 2;
int x_shift = 0;
@ -707,7 +707,7 @@ uint32_t i8244_device::screen_update(screen_device &screen, bitmap_ind16 &bitmap
x += x_shift * (zoom_px / 2);
for ( uint8_t m = 0x01; m > 0; m <<= 1, x += zoom_px )
for ( u8 m = 0x01; m > 0; m <<= 1, x += zoom_px )
{
if ( chr & m )
{

View File

@ -27,68 +27,68 @@ class i8244_device : public device_t
{
public:
// construction/destruction
i8244_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
i8244_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock);
// configuration helpers
auto irq_cb() { return m_irq_func.bind(); }
i8244_device &set_screen_size(int width, int height, int cropx = 0, int cropy = 0);
uint8_t read(offs_t offset);
void write(offs_t offset, uint8_t data);
u8 read(offs_t offset);
void write(offs_t offset, u8 data);
void write_cx(int x, bool cx); // CX pin on current scanline
int vblank();
int hblank();
void i8244_palette(palette_device &palette) const;
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
u32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
protected:
union vdc_t {
uint8_t reg[0x100];
u8 reg[0x100];
struct {
// 0x00
struct {
uint8_t y,x,color,unused;
u8 y,x,color,unused;
} sprites[4];
// 0x10
struct {
uint8_t y,x,ptr,color;
u8 y,x,ptr,color;
} foreground[12];
// 0x40
struct {
struct {
uint8_t y,x,ptr,color;
u8 y,x,ptr,color;
} single[4];
} quad[4];
// 0x80
uint8_t shape[4][8];
u8 shape[4][8];
// 0xa0
uint8_t control;
uint8_t status;
uint8_t collision;
uint8_t color;
uint8_t y;
uint8_t x;
uint8_t unused;
uint8_t shift1;
uint8_t shift2;
uint8_t shift3;
uint8_t sound;
uint8_t unused2[5+0x10];
u8 control;
u8 status;
u8 collision;
u8 color;
u8 y;
u8 x;
u8 unused;
u8 shift1;
u8 shift2;
u8 shift3;
u8 sound;
u8 unused2[5+0x10];
// 0xc0
uint8_t hgrid[2][0x10];
uint8_t vgrid[0x10];
uint8_t unused3[0x10];
u8 hgrid[2][0x10];
u8 vgrid[0x10];
u8 unused3[0x10];
} s;
};
i8244_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock);
i8244_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock);
// device-level overrides
virtual void device_config_complete() override;
@ -113,7 +113,7 @@ protected:
// callbacks
devcb_write_line m_irq_func;
required_region_ptr<uint8_t> m_charset;
required_region_ptr<u8> m_charset;
emu_timer *m_hblank_timer;
emu_timer *m_vblank_timer;
@ -135,12 +135,12 @@ protected:
int m_bgate_start;
vdc_t m_vdc;
uint8_t m_collision_map[0x200];
u8 m_collision_map[0x200];
uint8_t m_x_beam_pos = 0;
uint8_t m_y_beam_pos = 0;
uint8_t m_control_status = 0;
uint8_t m_collision_status = 0;
u8 m_x_beam_pos = 0;
u8 m_y_beam_pos = 0;
u8 m_control_status = 0;
u8 m_collision_status = 0;
bool m_sh_written = false;
bool m_sh_pending = false;
@ -155,7 +155,7 @@ class i8245_device : public i8244_device
{
public:
// construction/destruction
i8245_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
i8245_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock);
protected:
virtual void set_default_params() override;

View File

@ -85,7 +85,7 @@ private:
virtual void machine_start() override;
virtual void machine_reset() override;
virtual void video_start() override;
uint32_t screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
u32 screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
void odyssey_map(address_map &map);
};
@ -93,7 +93,7 @@ void odyssey_state::video_start()
{
}
uint32_t odyssey_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
u32 odyssey_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
{
return 0;
}

View File

@ -142,9 +142,9 @@ protected:
required_device<screen_device> m_screen;
required_device<o2_cart_slot_device> m_cart;
uint8_t m_ram[0x80];
uint8_t m_p1 = 0xff;
uint8_t m_p2 = 0xff;
u8 m_ram[0x80];
u8 m_p1 = 0xff;
u8 m_p2 = 0xff;
DECLARE_READ_LINE_MEMBER(t1_read);
@ -156,15 +156,15 @@ protected:
required_ioport_array<8> m_keyboard;
required_ioport_array<2> m_joysticks;
virtual uint8_t io_read(offs_t offset);
virtual void io_write(offs_t offset, uint8_t data);
uint8_t bus_read();
void p1_write(uint8_t data);
uint8_t p2_read();
void p2_write(uint8_t data);
virtual u8 io_read(offs_t offset);
virtual void io_write(offs_t offset, u8 data);
u8 bus_read();
void p1_write(u8 data);
u8 p2_read();
void p2_write(u8 data);
private:
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
u32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
};
class vpp_state : public odyssey2_state
@ -183,26 +183,26 @@ public:
protected:
virtual void machine_start() override;
virtual uint8_t io_read(offs_t offset) override;
virtual void io_write(offs_t offset, uint8_t data) override;
virtual u8 io_read(offs_t offset) override;
virtual void io_write(offs_t offset, u8 data) override;
private:
required_device<i8243_device> m_i8243;
required_device<ef9340_1_device> m_ef934x;
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
u32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void p2_write(uint8_t data);
uint8_t io_vpp(offs_t offset, uint8_t data);
template<int P> void i8243_port_w(uint8_t data);
void p2_write(u8 data);
u8 io_vpp(offs_t offset, u8 data);
template<int P> void i8243_port_w(u8 data);
inline offs_t ef934x_extram_address(offs_t offset);
uint8_t ef934x_extram_r(offs_t offset);
void ef934x_extram_w(offs_t offset, uint8_t data);
u8 ef934x_extram_r(offs_t offset);
void ef934x_extram_w(offs_t offset, u8 data);
uint8_t m_mix_i8244 = 0xff;
uint8_t m_mix_ef934x = 0xff;
uint8_t m_ef934x_extram[0x800];
u8 m_mix_i8244 = 0xff;
u8 m_mix_ef934x = 0xff;
u8 m_ef934x_extram[0x800];
};
void odyssey2_state::machine_start()
@ -259,7 +259,7 @@ void odyssey2_state::odyssey2_palette(palette_device &palette) const
}
uint32_t odyssey2_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
u32 odyssey2_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
m_i8244->screen_update(screen, bitmap, cliprect);
@ -273,7 +273,7 @@ uint32_t odyssey2_state::screen_update(screen_device &screen, bitmap_ind16 &bitm
return 0;
}
uint32_t vpp_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
u32 vpp_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
u8 lum = ~m_p1 >> 4 & 0x08;
bitmap_ind16 *ef934x_bitmap = m_ef934x->get_bitmap();
@ -288,8 +288,8 @@ uint32_t vpp_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, c
for (int x = clip.min_x; x <= clip.max_x; x++)
{
uint16_t d = bitmap.pix(y, x) & 7;
uint16_t e = ef934x_bitmap->pix(y, x);
u16 d = bitmap.pix(y, x) & 7;
u16 e = ef934x_bitmap->pix(y, x);
// i8244 decoder enable is masked with cartridge pin B
bool en = (e & 8) || !m_cart->b_read();
@ -321,7 +321,7 @@ uint32_t vpp_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, c
I/O
******************************************************************************/
uint8_t odyssey2_state::io_read(offs_t offset)
u8 odyssey2_state::io_read(offs_t offset)
{
u8 data = m_cart->io_read(offset);
if (!(m_p1 & 0x10) && ~offset & 0x80)
@ -333,7 +333,7 @@ uint8_t odyssey2_state::io_read(offs_t offset)
return data;
}
void odyssey2_state::io_write(offs_t offset, uint8_t data)
void odyssey2_state::io_write(offs_t offset, u8 data)
{
if (!(m_p1 & 0x40))
{
@ -349,7 +349,7 @@ void odyssey2_state::io_write(offs_t offset, uint8_t data)
// 8048 ports
void odyssey2_state::p1_write(uint8_t data)
void odyssey2_state::p1_write(u8 data)
{
// LUM changed
if ((m_p1 ^ data) & 0x80)
@ -359,7 +359,7 @@ void odyssey2_state::p1_write(uint8_t data)
m_cart->write_p1(m_p1 & 0x13);
}
uint8_t odyssey2_state::p2_read()
u8 odyssey2_state::p2_read()
{
u8 data = 0xff;
@ -374,13 +374,13 @@ uint8_t odyssey2_state::p2_read()
return data;
}
void odyssey2_state::p2_write(uint8_t data)
void odyssey2_state::p2_write(u8 data)
{
m_p2 = data;
m_cart->write_p2(m_p2 & 0x0f);
}
uint8_t odyssey2_state::bus_read()
u8 odyssey2_state::bus_read()
{
u8 data = 0xff;
@ -402,19 +402,19 @@ READ_LINE_MEMBER(odyssey2_state::t1_read)
// G7400-specific
uint8_t vpp_state::io_read(offs_t offset)
u8 vpp_state::io_read(offs_t offset)
{
u8 data = odyssey2_state::io_read(offset);
return io_vpp(offset, data);
}
void vpp_state::io_write(offs_t offset, uint8_t data)
void vpp_state::io_write(offs_t offset, u8 data)
{
odyssey2_state::io_write(offset, data);
io_vpp(offset, data);
}
uint8_t vpp_state::io_vpp(offs_t offset, uint8_t data)
u8 vpp_state::io_vpp(offs_t offset, u8 data)
{
if (!(m_p1 & 0x20))
{
@ -428,14 +428,14 @@ uint8_t vpp_state::io_vpp(offs_t offset, uint8_t data)
return data;
}
void vpp_state::p2_write(uint8_t data)
void vpp_state::p2_write(u8 data)
{
odyssey2_state::p2_write(data);
m_i8243->p2_w(m_p2 & 0x0f);
}
template<int P>
void vpp_state::i8243_port_w(uint8_t data)
void vpp_state::i8243_port_w(u8 data)
{
// P4,P5: color mix I8244 side (IC674)
// P6,P7: color mix EF9340 side (IC678)
@ -468,12 +468,12 @@ offs_t vpp_state::ef934x_extram_address(offs_t offset)
return address | (offset << 4 & 0x60) | (latch << 2 & 0x180);
}
uint8_t vpp_state::ef934x_extram_r(offs_t offset)
u8 vpp_state::ef934x_extram_r(offs_t offset)
{
return m_ef934x_extram[ef934x_extram_address(offset)];
}
void vpp_state::ef934x_extram_w(offs_t offset, uint8_t data)
void vpp_state::ef934x_extram_w(offs_t offset, u8 data)
{
m_ef934x_extram[ef934x_extram_address(offset)] = data;
}