saitek_risc2500.cpp: Use SED1520 device for the LCD screen. [Sandro Ronco]

This commit is contained in:
Sandro Ronco 2020-11-01 10:48:57 +01:00
parent 314580ee4a
commit ec9882c74c
4 changed files with 54 additions and 51 deletions

View File

@ -214,7 +214,7 @@ HD61202_UPDATE_CB(pce220_state::hd61202_update)
static const uint16_t lcd_symbol_bits[] = static const uint16_t lcd_symbol_bits[] =
{ {
//BUSY CAPS KANA SYO 2ndF DE G RAD CONST M E BATT RUN PRO CASL TEXT STAT PRINT //BUSY CAPS KANA SHO 2ndF DE G RAD CONST M E BATT RUN PRO CASL TEXT STAT PRINT
480, 481, 482, 483, 484, 2534, 2533, 2532, 2531, 2530, 2529, 2528, 2022, 2021, 2020, 2019, 4069, 4070 480, 481, 482, 483, 484, 2534, 2533, 2532, 2531, 2530, 2529, 2528, 2022, 2021, 2020, 2019, 4069, 4070
}; };
@ -245,7 +245,7 @@ HD61202_UPDATE_CB(pcg815_state::hd61202_1_update)
static const uint16_t lcd_symbol_bits[] = static const uint16_t lcd_symbol_bits[] =
{ {
//BUSY CAPS KANA SYO 2ndF DE G RAD CONST M E BATT RUN PRO CASL TEXT STAT PRINT //BUSY CAPS KANA SHO 2ndF DE G RAD CONST M E BATT RUN PRO CASL TEXT STAT PRINT
504, 2555, 2553, 2552, 2556, 3068, 3067, 3066, 2554, 3065, 1529, 3576, 505, 506, 507, 510, 509, 3064 504, 2555, 2553, 2552, 2556, 3068, 3067, 3066, 2554, 3065, 1529, 3576, 505, 506, 507, 510, 509, 3064
}; };
@ -311,7 +311,7 @@ SED1560_UPDATE_CB(pcg850v_state::sed1560_update)
static const uint16_t lcd_symbol_bits[] = static const uint16_t lcd_symbol_bits[] =
{ {
//BUSY BATT RUN PRO TEXT CASL STAT 2ndF M CAPS KANA SYO DE G RAD CONST PRINT //BUSY BATT RUN PRO TEXT CASL STAT 2ndF M CAPS KANA SHO DE G RAD CONST PRINT
7798, 7799, 1153, 1155, 1158, 2483, 3808, 3813, 3815, 5138, 5143, 6465, 6468, 6470, 7792, 7795, 7796, 7798, 7799, 1153, 1155, 1158, 2483, 3808, 3813, 3815, 5138, 5143, 6465, 6468, 6470, 7792, 7795, 7796,
}; };

View File

@ -18,7 +18,6 @@ TODO:
Is cpu cycle timing wrong? I suspect conditional branch timing due to cache miss Is cpu cycle timing wrong? I suspect conditional branch timing due to cache miss
(pipeline has to refill). The delay loop between writing to the speaker is simply: (pipeline has to refill). The delay loop between writing to the speaker is simply:
SUBS R2, R2, #$1, BNE $2000cd8 SUBS R2, R2, #$1, BNE $2000cd8
- use SED1520 device for the LCD
******************************************************************************/ ******************************************************************************/
@ -28,6 +27,7 @@ TODO:
#include "machine/ram.h" #include "machine/ram.h"
#include "machine/nvram.h" #include "machine/nvram.h"
#include "machine/sensorboard.h" #include "machine/sensorboard.h"
#include "video/sed1520.h"
#include "sound/dac.h" #include "sound/dac.h"
#include "emupal.h" #include "emupal.h"
#include "screen.h" #include "screen.h"
@ -45,6 +45,7 @@ public:
, m_ram(*this, "ram") , m_ram(*this, "ram")
, m_nvram(*this, "nvram") , m_nvram(*this, "nvram")
, m_dac(*this, "dac") , m_dac(*this, "dac")
, m_lcdc(*this, "lcdc")
, m_board(*this, "board") , m_board(*this, "board")
, m_inputs(*this, "P%u", 0) , m_inputs(*this, "P%u", 0)
, m_digits(*this, "digit%u", 0U) , m_digits(*this, "digit%u", 0U)
@ -64,7 +65,7 @@ protected:
virtual void machine_start() override; virtual void machine_start() override;
virtual void machine_reset() override; virtual void machine_reset() override;
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); SED1520_UPDATE_CB(screen_update_cb);
void install_boot_rom(); void install_boot_rom();
void remove_boot_rom(); void remove_boot_rom();
void lcd_palette(palette_device &palette) const; void lcd_palette(palette_device &palette) const;
@ -76,6 +77,7 @@ private:
required_device<ram_device> m_ram; required_device<ram_device> m_ram;
required_device<nvram_device> m_nvram; required_device<nvram_device> m_nvram;
required_device<dac_byte_interface> m_dac; required_device<dac_byte_interface> m_dac;
required_device<sed1520_device> m_lcdc;
required_device<sensorboard_device> m_board; required_device<sensorboard_device> m_board;
required_ioport_array<8> m_inputs; required_ioport_array<8> m_inputs;
output_finder<12> m_digits; output_finder<12> m_digits;
@ -83,8 +85,6 @@ private:
output_finder<16> m_leds; output_finder<16> m_leds;
uint32_t m_p1000; uint32_t m_p1000;
uint16_t m_vram_addr;
uint8_t m_vram[0x100];
emu_timer *m_boot_rom_disable_timer; emu_timer *m_boot_rom_disable_timer;
}; };
@ -106,32 +106,42 @@ void risc2500_state::lcd_palette(palette_device &palette) const
palette.set_pen_color(2, rgb_t(138, 146, 148)); // background palette.set_pen_color(2, rgb_t(138, 146, 148)); // background
} }
uint32_t risc2500_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) SED1520_UPDATE_CB(risc2500_state::screen_update_cb)
{ {
bitmap.fill(2, cliprect); bitmap.fill(2, cliprect);
for(int c=0; c<12; c++) for (int c=0; c<12; c++)
{ {
// 12 characters 5 x 7 // 12 characters 5 x 7
for(int x=0; x<5; x++) for (int x=0; x<5; x++)
{ {
uint8_t gfx = bitswap<8>(m_vram[c*5 + x], 6,5,0,1,2,3,4,7); uint8_t gfx = 0;
if (lcd_on)
gfx = bitswap<8>(dram[c * 5 + x], 6,5,0,1,2,3,4,7);
for(int y=0; y<7; y++) for (int y=1; y<8; y++)
bitmap.pix(y + 1, 71 - (c*6 + x)) = (gfx >> (y + 1)) & 1; bitmap.pix(y, 71 - (c * 6 + x)) = BIT(gfx, y);
} }
// LCD digits and symbols // LCD digits and symbols
int data_addr = 0x40 + c * 5; if (lcd_on)
uint16_t data = ((m_vram[data_addr + 1] & 0x3) << 5) | ((m_vram[data_addr + 2] & 0x7) << 2) | (m_vram[data_addr + 4] & 0x3); {
data = bitswap<8>(data, 7,3,0,1,4,6,5,2) | ((m_vram[data_addr - 1] & 0x04) ? 0x80 : 0); int data_addr = 80 + c * 5;
uint16_t data = ((dram[data_addr + 1] & 0x3) << 5) | ((dram[data_addr + 2] & 0x7) << 2) | (dram[data_addr + 4] & 0x3);
data = bitswap<8>(data, 7,3,0,1,4,6,5,2) | ((dram[data_addr - 1] & 0x04) ? 0x80 : 0);
m_digits[c] = data; m_digits[c] = data;
m_syms[c] = BIT(m_vram[data_addr + 1], 2); m_syms[c] = BIT(dram[data_addr + 1], 2);
}
else
{
m_digits[c] = 0;
m_syms[c] = 0;
}
} }
m_syms[12] = BIT(m_vram[0x63], 0); m_syms[12] = lcd_on ? BIT(dram[0x73], 0) : 0;
m_syms[13] = BIT(m_vram[0x4a], 0); m_syms[13] = lcd_on ? BIT(dram[0x5a], 0) : 0;
return 0; return 0;
} }
@ -187,7 +197,7 @@ uint32_t risc2500_state::p1000_r()
{ {
uint32_t data = 0; uint32_t data = 0;
for(int i=0; i<8; i++) for (int i=0; i<8; i++)
{ {
if (m_p1000 & (1 << i)) if (m_p1000 & (1 << i))
{ {
@ -196,37 +206,30 @@ uint32_t risc2500_state::p1000_r()
} }
} }
return data; return data | ((uint32_t)m_lcdc->status_read() << 16);
} }
void risc2500_state::p1000_w(uint32_t data) void risc2500_state::p1000_w(uint32_t data)
{ {
if ((data & 0xff000000) == 0x01000000) // VRAM address if (!BIT(data, 27))
{ {
if (data & 0x80) if (BIT(data, 26))
m_vram_addr = (m_vram_addr & ~0x40) | (data & 0x01 ? 0x40 : 0); m_lcdc->data_write(data);
else else
m_vram_addr = (m_vram_addr & 0x40) | (data & 0xff); m_lcdc->control_write(data);
} }
else if (data & 0x04000000) // VRAM write
if (BIT(data, 31)) // Vertical LED
{ {
if (!(data & 0x08000000)) for (int i=0; i<8; i++)
m_vram[m_vram_addr++ & 0x7f] = data & 0xff;
}
else if (data & 0x80000000) // Vertical LED
{
for(int i=0; i<8; i++)
m_leds[i] = BIT(data, i); m_leds[i] = BIT(data, i);
} }
else if (data & 0x40000000) // Horizontal LED
if (BIT(data, 30)) // Horizontal LED
{ {
for(int i=0; i<8; i++) for (int i=0; i<8; i++)
m_leds[8 + i] = BIT(data, i); m_leds[8 + i] = BIT(data, i);
} }
else if ((data & 0xff000000) == 0x08000000) // Power OFF
{
memset(m_vram, 0, sizeof(m_vram));
}
m_dac->write(data >> 28 & 3); // Speaker m_dac->write(data >> 28 & 3); // Speaker
@ -255,8 +258,6 @@ void risc2500_state::machine_start()
m_boot_rom_disable_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(risc2500_state::disable_boot_rom), this)); m_boot_rom_disable_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(risc2500_state::disable_boot_rom), this));
save_item(NAME(m_p1000)); save_item(NAME(m_p1000));
save_item(NAME(m_vram_addr));
save_item(NAME(m_vram));
machine().save().register_postload(save_prepost_delegate(FUNC(risc2500_state::remove_boot_rom), this)); machine().save().register_postload(save_prepost_delegate(FUNC(risc2500_state::remove_boot_rom), this));
} }
@ -264,7 +265,6 @@ void risc2500_state::machine_start()
void risc2500_state::machine_reset() void risc2500_state::machine_reset()
{ {
m_p1000 = 0; m_p1000 = 0;
m_vram_addr = 0;
install_boot_rom(); install_boot_rom();
} }
@ -289,13 +289,16 @@ void risc2500_state::risc2500(machine_config &config)
screen.set_vblank_time(ATTOSECONDS_IN_USEC(2500)); /* not accurate */ screen.set_vblank_time(ATTOSECONDS_IN_USEC(2500)); /* not accurate */
screen.set_size(12*6+1, 7+2); screen.set_size(12*6+1, 7+2);
screen.set_visarea_full(); screen.set_visarea_full();
screen.set_screen_update(FUNC(risc2500_state::screen_update)); screen.set_screen_update(m_lcdc, FUNC(sed1520_device::screen_update));
screen.set_palette("palette"); screen.set_palette("palette");
config.set_default_layout(layout_saitek_risc2500); config.set_default_layout(layout_saitek_risc2500);
PALETTE(config, "palette", FUNC(risc2500_state::lcd_palette), 3); PALETTE(config, "palette", FUNC(risc2500_state::lcd_palette), 3);
SED1520(config, m_lcdc);
m_lcdc->set_screen_update_cb(FUNC(risc2500_state::screen_update_cb));
SENSORBOARD(config, m_board); SENSORBOARD(config, m_board);
m_board->set_type(sensorboard_device::BUTTONS); m_board->set_type(sensorboard_device::BUTTONS);
m_board->init_cb().set(m_board, FUNC(sensorboard_device::preset_chess)); m_board->init_cb().set(m_board, FUNC(sensorboard_device::preset_chess));

View File

@ -28,12 +28,12 @@
<color state="1" red="0.200" green="0.165" blue="0.169"/> <color state="1" red="0.200" green="0.165" blue="0.169"/>
</text> </text>
</element> </element>
<element name="syo"> <element name="sho">
<rect> <rect>
<color red="0.541" green="0.573" blue="0.580"/> <color red="0.541" green="0.573" blue="0.580"/>
</rect> </rect>
<!-- --> <!-- -->
<text string="SYO"> <text string="SHO">
<color state="0" red="0.514" green="0.533" blue="0.545"/> <color state="0" red="0.514" green="0.533" blue="0.545"/>
<color state="1" red="0.200" green="0.165" blue="0.169"/> <color state="1" red="0.200" green="0.165" blue="0.169"/>
</text> </text>
@ -188,7 +188,7 @@
<element ref="busy" name="sym.0"> <bounds x="5" y="0.5" width="8" height="3"/> </element> <element ref="busy" name="sym.0"> <bounds x="5" y="0.5" width="8" height="3"/> </element>
<element ref="caps" name="sym.1"> <bounds x="16" y="0.5" width="8" height="3"/> </element> <element ref="caps" name="sym.1"> <bounds x="16" y="0.5" width="8" height="3"/> </element>
<element ref="kana" name="sym.2"> <bounds x="28" y="0.5" width="8" height="3"/> </element> <element ref="kana" name="sym.2"> <bounds x="28" y="0.5" width="8" height="3"/> </element>
<element ref="syo" name="sym.3"> <bounds x="40" y="0.5" width="6" height="3"/> </element> <element ref="sho" name="sym.3"> <bounds x="40" y="0.5" width="6" height="3"/> </element>
<element ref="2ndf" name="sym.4"> <bounds x="63" y="0.5" width="8" height="3"/> </element> <element ref="2ndf" name="sym.4"> <bounds x="63" y="0.5" width="8" height="3"/> </element>
<element ref="de" name="sym.5"> <bounds x="75" y="0.5" width="3" height="3"/> </element> <element ref="de" name="sym.5"> <bounds x="75" y="0.5" width="3" height="3"/> </element>
<element ref="g" name="sym.6"> <bounds x="78" y="0.5" width="1.5" height="3"/> </element> <element ref="g" name="sym.6"> <bounds x="78" y="0.5" width="1.5" height="3"/> </element>

View File

@ -28,12 +28,12 @@
<color state="1" red="0.200" green="0.165" blue="0.169"/> <color state="1" red="0.200" green="0.165" blue="0.169"/>
</text> </text>
</element> </element>
<element name="syo"> <element name="sho">
<rect> <rect>
<color red="0.541" green="0.573" blue="0.580"/> <color red="0.541" green="0.573" blue="0.580"/>
</rect> </rect>
<!-- --> <!-- -->
<text string="SYO"> <text string="SHO">
<color state="0" red="0.514" green="0.533" blue="0.545"/> <color state="0" red="0.514" green="0.533" blue="0.545"/>
<color state="1" red="0.200" green="0.165" blue="0.169"/> <color state="1" red="0.200" green="0.165" blue="0.169"/>
</text> </text>
@ -187,7 +187,7 @@
<element ref="m" name="sym.8"> <bounds x="163" y="21.5" width="2.5" height="4.5"/> </element> <element ref="m" name="sym.8"> <bounds x="163" y="21.5" width="2.5" height="4.5"/> </element>
<element ref="caps" name="sym.9"> <bounds x="154" y="26.2" width="8" height="4.5"/> </element> <element ref="caps" name="sym.9"> <bounds x="154" y="26.2" width="8" height="4.5"/> </element>
<element ref="kana" name="sym.10"> <bounds x="154" y="31.0" width="6" height="4.5"/> </element> <element ref="kana" name="sym.10"> <bounds x="154" y="31.0" width="6" height="4.5"/> </element>
<element ref="syo" name="sym.11"> <bounds x="161" y="31.0" width="4" height="4.5"/> </element> <element ref="sho" name="sym.11"> <bounds x="161" y="31.0" width="4" height="4.5"/> </element>
<element ref="de" name="sym.12"> <bounds x="154" y="35.7" width="3.5" height="4.5"/> </element> <element ref="de" name="sym.12"> <bounds x="154" y="35.7" width="3.5" height="4.5"/> </element>
<element ref="g" name="sym.13"> <bounds x="157.5" y="35.7" width="1.8" height="4.5"/> </element> <element ref="g" name="sym.13"> <bounds x="157.5" y="35.7" width="1.8" height="4.5"/> </element>
<element ref="rad" name="sym.14"> <bounds x="159.3" y="35.7" width="6.5" height="4.5"/> </element> <element ref="rad" name="sym.14"> <bounds x="159.3" y="35.7" width="6.5" height="4.5"/> </element>