mirror of
https://github.com/holub/mame
synced 2025-07-05 09:57:47 +03:00
MC68328 and PalmPilot: More cleanups and better LCDC emulation (#10641)
This commit is contained in:
parent
7e11c0968d
commit
69916dcec0
File diff suppressed because it is too large
Load Diff
@ -93,6 +93,8 @@
|
||||
class mc68328_device : public m68000_device
|
||||
{
|
||||
public:
|
||||
typedef device_delegate<void (double, int, int)> lcd_info_changed_delegate;
|
||||
|
||||
mc68328_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
|
||||
|
||||
auto out_port_a() { return m_out_port_a_cb.bind(); }
|
||||
@ -118,12 +120,20 @@ public:
|
||||
auto out_pwm() { return m_out_pwm_cb.bind(); }
|
||||
auto out_spim() { return m_out_spim_cb.bind(); }
|
||||
auto in_spim() { return m_in_spim_cb.bind(); }
|
||||
auto spim_xch_trigger() { return m_spim_xch_trigger_cb.bind(); }
|
||||
|
||||
DECLARE_WRITE_LINE_MEMBER(set_penirq_line);
|
||||
void set_port_d_lines(uint8_t state, int bit);
|
||||
|
||||
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
|
||||
auto out_flm() { return m_out_flm_cb.bind(); }
|
||||
auto out_llp() { return m_out_llp_cb.bind(); }
|
||||
auto out_lsclk() { return m_out_lsclk_cb.bind(); }
|
||||
auto out_ld() { return m_out_ld_cb.bind(); }
|
||||
|
||||
template <typename T>
|
||||
std::enable_if_t<lcd_info_changed_delegate::supports_callback<T>::value> set_lcd_info_changed(T &&callback, const char *name)
|
||||
{
|
||||
m_lcd_info_changed_cb.set(std::forward<T>(callback), name);
|
||||
}
|
||||
|
||||
protected:
|
||||
// device-level overrides
|
||||
@ -148,6 +158,7 @@ protected:
|
||||
BLKC_BD = 0x7f,
|
||||
BLKC_BKEN = 0x80,
|
||||
|
||||
LPICF_GRAYSCALE_BIT = 0,
|
||||
LPICF_PBSIZ = 0x06,
|
||||
LPICF_PBSIZ_1 = 0x00,
|
||||
LPICF_PBSIZ_2 = 0x02,
|
||||
@ -155,15 +166,15 @@ protected:
|
||||
LPICF_PBSIZ_INVALID = 0x06,
|
||||
|
||||
LPOLCF_PIXPOL = 0x01,
|
||||
LPOLCF_LPPOL = 0x02,
|
||||
LPOLCF_FLMPOL = 0x04,
|
||||
LPOLCF_LPPOL_BIT = 1,
|
||||
LPOLCF_FLMPOL_BIT = 2,
|
||||
LPOLCF_LCKPOL = 0x08,
|
||||
|
||||
LACDRC_MASK = 0x0f,
|
||||
|
||||
LPXCD_MASK = 0x3f,
|
||||
|
||||
LCKCON_PCDS = 0x01,
|
||||
LCKCON_PCDS_BIT = 0,
|
||||
LCKCON_DWIDTH = 0x02,
|
||||
LCKCON_WS = 0x30,
|
||||
LCKCON_WS_1 = 0x00,
|
||||
@ -171,8 +182,7 @@ protected:
|
||||
LCKCON_WS_3 = 0x20,
|
||||
LCKCON_WS_4 = 0x30,
|
||||
LCKCON_DMA16 = 0x40,
|
||||
LCKCON_LCDON = 0x80,
|
||||
LCKCON_LCDC_EN = 0x80,
|
||||
LCKCON_LCDON_BIT = 7,
|
||||
|
||||
LBAR_MASK = 0x7f,
|
||||
|
||||
@ -201,6 +211,7 @@ protected:
|
||||
PLLCR_SYSCLK_SEL_DIV1_2 = 0x0600,
|
||||
PLLCR_SYSCLK_SEL_DIV1_3 = 0x0700,
|
||||
PLLCR_SYSCLK_SEL = 0x0700,
|
||||
PLLCR_SYSCLK_SHIFT = 8,
|
||||
PLLCR_PIXCLK_SEL_DIV2 = 0x0000,
|
||||
PLLCR_PIXCLK_SEL_DIV4 = 0x0800,
|
||||
PLLCR_PIXCLK_SEL_DIV8 = 0x1000,
|
||||
@ -210,6 +221,7 @@ protected:
|
||||
PLLCR_PIXCLK_SEL_DIV1_2 = 0x3000,
|
||||
PLLCR_PIXCLK_SEL_DIV1_3 = 0x3800,
|
||||
PLLCR_PIXCLK_SEL = 0x3800,
|
||||
PLLCR_PIXCLK_SHIFT = 11,
|
||||
|
||||
PLLFSR_PCNT = 0x00ff,
|
||||
PLLFSR_QCNT = 0x0f00,
|
||||
@ -275,30 +287,15 @@ protected:
|
||||
SPIS_IRQEN = 0x4000,
|
||||
SPIS_SPIS_IRQ = 0x8000,
|
||||
|
||||
SPIM_CLOCK_COUNT = 0x000f,
|
||||
SPIM_POL = 0x0010,
|
||||
SPIM_POL_HIGH = 0x0000,
|
||||
SPIM_POL_LOW = 0x0010,
|
||||
SPIM_PHA = 0x0020,
|
||||
SPIM_PHA_NORMAL = 0x0000,
|
||||
SPIM_PHA_OPPOSITE = 0x0020,
|
||||
SPIM_IRQEN = 0x0040,
|
||||
SPIM_SPIMIRQ = 0x0080,
|
||||
SPIM_XCH = 0x0100,
|
||||
SPIM_XCH_IDLE = 0x0000,
|
||||
SPIM_XCH_INIT = 0x0100,
|
||||
SPIM_SPMEN = 0x0200,
|
||||
SPIM_SPMEN_DISABLE = 0x0000,
|
||||
SPIM_SPMEN_ENABLE = 0x0200,
|
||||
SPIM_RATE = 0xe000,
|
||||
SPIM_RATE_4 = 0x0000,
|
||||
SPIM_RATE_8 = 0x2000,
|
||||
SPIM_RATE_16 = 0x4000,
|
||||
SPIM_RATE_32 = 0x6000,
|
||||
SPIM_RATE_64 = 0x8000,
|
||||
SPIM_RATE_128 = 0xa000,
|
||||
SPIM_RATE_256 = 0xc000,
|
||||
SPIM_RATE_512 = 0xe000,
|
||||
SPIM_BIT_COUNT = 0x000f,
|
||||
SPIM_POL_BIT = 4,
|
||||
SPIM_PHA_BIT = 5,
|
||||
SPIM_IRQEN_BIT = 6,
|
||||
SPIM_SPIMIRQ_BIT = 7,
|
||||
SPIM_XCH_BIT = 8,
|
||||
SPIM_SPMEN_BIT = 9,
|
||||
SPIM_RATE_MASK = 0xe000,
|
||||
SPIM_RATE_SHIFT = 13,
|
||||
|
||||
USTCNT_TX_AVAIL_EN = 0x0001,
|
||||
USTCNT_TX_HALF_EN = 0x0002,
|
||||
@ -369,6 +366,10 @@ protected:
|
||||
CWCH_CH = 0x001f,
|
||||
CWCH_CW = 0x1f00,
|
||||
|
||||
LXMAX_MASK = 0x03ff,
|
||||
|
||||
LYMAX_MASK = 0x03ff,
|
||||
|
||||
LGPMR_PAL2 = 0x0007,
|
||||
LGPMR_PAL3 = 0x0070,
|
||||
LGPMR_PAL0 = 0x0700,
|
||||
@ -813,6 +814,9 @@ protected:
|
||||
// $(FF)FFF800
|
||||
uint16_t m_spimdata; // SPIM Data Register
|
||||
uint16_t m_spimcont; // SPIM Control/Status Register
|
||||
bool m_spmtxd; // SPIM Shift-register output (TODO: multiplex onto Port K)
|
||||
bool m_spmrxd; // SPIM Shift-register input (TODO: multiplex onto Port K)
|
||||
bool m_spmclk; // SPIM Shift-register clock (TODO: multiplex onto Port K)
|
||||
|
||||
// $(FF)FFF900
|
||||
uint16_t m_ustcnt; // UART Status/Control Register
|
||||
@ -857,6 +861,7 @@ protected:
|
||||
void cpu_space_map(address_map &map);
|
||||
uint8_t irq_callback(offs_t offset);
|
||||
|
||||
attotime get_pixclk_rate();
|
||||
template<int Timer> uint32_t get_timer_frequency();
|
||||
template<int Timer> void maybe_start_timer(uint32_t new_enable);
|
||||
|
||||
@ -865,39 +870,57 @@ protected:
|
||||
template<int Timer> TIMER_CALLBACK_MEMBER(timer_tick);
|
||||
TIMER_CALLBACK_MEMBER(pwm_tick);
|
||||
TIMER_CALLBACK_MEMBER(rtc_tick);
|
||||
TIMER_CALLBACK_MEMBER(spim_tick);
|
||||
TIMER_CALLBACK_MEMBER(lcd_scan_tick);
|
||||
void fill_lcd_dma_buffer();
|
||||
|
||||
emu_timer *m_gptimer[2];
|
||||
emu_timer *m_rtc;
|
||||
emu_timer *m_pwm;
|
||||
emu_timer *m_spim;
|
||||
|
||||
devcb_write8 m_out_port_a_cb; /* 8-bit output */
|
||||
devcb_write8 m_out_port_b_cb; /* 8-bit output */
|
||||
devcb_write8 m_out_port_c_cb; /* 8-bit output */
|
||||
devcb_write8 m_out_port_d_cb; /* 8-bit output */
|
||||
devcb_write8 m_out_port_e_cb; /* 8-bit output */
|
||||
devcb_write8 m_out_port_f_cb; /* 8-bit output */
|
||||
devcb_write8 m_out_port_g_cb; /* 8-bit output */
|
||||
devcb_write8 m_out_port_j_cb; /* 8-bit output */
|
||||
devcb_write8 m_out_port_k_cb; /* 8-bit output */
|
||||
devcb_write8 m_out_port_m_cb; /* 8-bit output */
|
||||
emu_timer *m_lcd_scan;
|
||||
bool m_lcd_first_line;
|
||||
uint32_t m_lcd_sysmem_ptr;
|
||||
std::unique_ptr<uint16_t[]> m_lcd_line_buffer;
|
||||
uint32_t m_lcd_line_bit;
|
||||
uint32_t m_lcd_line_word;
|
||||
bool m_lsclk;
|
||||
|
||||
devcb_read8 m_in_port_a_cb; /* 8-bit input */
|
||||
devcb_read8 m_in_port_b_cb; /* 8-bit input */
|
||||
devcb_read8 m_in_port_c_cb; /* 8-bit input */
|
||||
devcb_read8 m_in_port_d_cb; /* 8-bit input */
|
||||
devcb_read8 m_in_port_e_cb; /* 8-bit input */
|
||||
devcb_read8 m_in_port_f_cb; /* 8-bit input */
|
||||
devcb_read8 m_in_port_g_cb; /* 8-bit input */
|
||||
devcb_read8 m_in_port_j_cb; /* 8-bit input */
|
||||
devcb_read8 m_in_port_k_cb; /* 8-bit input */
|
||||
devcb_read8 m_in_port_m_cb; /* 8-bit input */
|
||||
devcb_write8 m_out_port_a_cb;
|
||||
devcb_write8 m_out_port_b_cb;
|
||||
devcb_write8 m_out_port_c_cb;
|
||||
devcb_write8 m_out_port_d_cb;
|
||||
devcb_write8 m_out_port_e_cb;
|
||||
devcb_write8 m_out_port_f_cb;
|
||||
devcb_write8 m_out_port_g_cb;
|
||||
devcb_write8 m_out_port_j_cb;
|
||||
devcb_write8 m_out_port_k_cb;
|
||||
devcb_write8 m_out_port_m_cb;
|
||||
|
||||
devcb_write_line m_out_pwm_cb; /* 1-bit output */
|
||||
devcb_read8 m_in_port_a_cb;
|
||||
devcb_read8 m_in_port_b_cb;
|
||||
devcb_read8 m_in_port_c_cb;
|
||||
devcb_read8 m_in_port_d_cb;
|
||||
devcb_read8 m_in_port_e_cb;
|
||||
devcb_read8 m_in_port_f_cb;
|
||||
devcb_read8 m_in_port_g_cb;
|
||||
devcb_read8 m_in_port_j_cb;
|
||||
devcb_read8 m_in_port_k_cb;
|
||||
devcb_read8 m_in_port_m_cb;
|
||||
|
||||
devcb_write16 m_out_spim_cb; /* 16-bit output */
|
||||
devcb_read16 m_in_spim_cb; /* 16-bit input */
|
||||
devcb_write_line m_out_pwm_cb;
|
||||
|
||||
devcb_write_line m_spim_xch_trigger_cb; /* SPIM exchange trigger */ /*todo: not really a write line, fix*/
|
||||
devcb_write_line m_out_spim_cb;
|
||||
devcb_read_line m_in_spim_cb;
|
||||
|
||||
devcb_write_line m_out_flm_cb;
|
||||
devcb_write_line m_out_llp_cb;
|
||||
devcb_write_line m_out_lsclk_cb;
|
||||
devcb_write8 m_out_ld_cb;
|
||||
lcd_info_changed_delegate m_lcd_info_changed_cb;
|
||||
|
||||
static const uint32_t VCO_DIVISORS[8];
|
||||
};
|
||||
|
||||
|
||||
|
70
src/mame/layout/pilot1k.lay
Normal file
70
src/mame/layout/pilot1k.lay
Normal file
@ -0,0 +1,70 @@
|
||||
<?xml version="1.0"?>
|
||||
<!--
|
||||
license:CC0
|
||||
-->
|
||||
<mamelayout version="2">
|
||||
|
||||
<!-- define elements -->
|
||||
|
||||
<element name="bgcol_rect"><rect><color red="0.886" green="0.925" blue="0.878" /></rect></element>
|
||||
<element name="penbox_rect"><rect><color red="0.475" green="0.49" blue="0.494" /></rect></element>
|
||||
<element name="action_disk"><disk><color red="0.475" green="0.49" blue="0.494" /></disk></element>
|
||||
<element name="applications_label">
|
||||
<text string="APPLICATIONS">
|
||||
<bounds x="0.0" y="0.0" width="1.0" height="1.0" />
|
||||
<color red="0.475" green="0.49" blue="0.494" />
|
||||
</text>
|
||||
</element>
|
||||
<element name="menu_label">
|
||||
<text string="MENU">
|
||||
<bounds x="0.0" y="0.0" width="1.0" height="1.0" />
|
||||
<color red="0.475" green="0.49" blue="0.494" />
|
||||
</text>
|
||||
</element>
|
||||
<element name="calculator_label">
|
||||
<text string="CALCULATOR">
|
||||
<bounds x="0.0" y="0.0" width="1.0" height="1.0" />
|
||||
<color red="0.475" green="0.49" blue="0.494" />
|
||||
</text>
|
||||
</element>
|
||||
<element name="find_label">
|
||||
<text string="FIND">
|
||||
<bounds x="0.0" y="0.0" width="1.0" height="1.0" />
|
||||
<color red="0.475" green="0.49" blue="0.494" />
|
||||
</text>
|
||||
</element>
|
||||
<element name="abcde_label">
|
||||
<text string="abcde" align="1">
|
||||
<bounds x="0.0" y="0.0" width="1.0" height="1.0" />
|
||||
<color red="0.475" green="0.49" blue="0.494" />
|
||||
</text>
|
||||
</element>
|
||||
<element name="12345_label">
|
||||
<text string="12345" align="2">
|
||||
<bounds x="0.0" y="0.0" width="1.0" height="1.0" />
|
||||
<color red="0.475" green="0.49" blue="0.494" />
|
||||
</text>
|
||||
</element>
|
||||
|
||||
<view name="Internal Layout">
|
||||
<bounds left="0" right="160" top="0" bottom="220" />
|
||||
|
||||
<screen index="0">
|
||||
<bounds left="0" top="0" right="160" bottom="220" />
|
||||
</screen>
|
||||
|
||||
<element ref="bgcol_rect"><bounds x="0" y="160" width="160" height="60" /></element>
|
||||
<element ref="penbox_rect"><bounds x="32" y="162" width="96" height="56" /></element>
|
||||
<element ref="bgcol_rect"><bounds x="34" y="164" width="92" height="52" /></element>
|
||||
<element name="apps_disk" ref="action_disk"><bounds x="6" y="162" width="20" height="20" /></element>
|
||||
<element name="calc_disk" ref="action_disk"><bounds x="134" y="162" width="20" height="20" /></element>
|
||||
<element name="menu_disk" ref="action_disk"><bounds x="6" y="194" width="20" height="20" /></element>
|
||||
<element name="find_disk" ref="action_disk"><bounds x="134" y="194" width="20" height="20" /></element>
|
||||
<element name="apps_text" ref="applications_label"><bounds x="0" y="183" width="32" height="5" /></element>
|
||||
<element name="calc_text" ref="calculator_label"><bounds x="128" y="183" width="32" height="5" /></element>
|
||||
<element name="menu_text" ref="menu_label"><bounds x="0" y="215" width="32" height="5" /></element>
|
||||
<element name="find_text" ref="find_label"><bounds x="128" y="215" width="32" height="5" /></element>
|
||||
<element name="abcde_text" ref="abcde_label"><bounds x="35" y="200" width="32" height="5" /></element>
|
||||
<element name="12345_text" ref="12345_label"><bounds x="93" y="200" width="32" height="5" /></element>
|
||||
</view>
|
||||
</mamelayout>
|
@ -20,6 +20,10 @@
|
||||
#include "screen.h"
|
||||
#include "speaker.h"
|
||||
|
||||
#include "pilot1k.lh"
|
||||
|
||||
namespace {
|
||||
|
||||
class palm_state : public driver_device
|
||||
{
|
||||
public:
|
||||
@ -27,6 +31,8 @@ public:
|
||||
driver_device(mconfig, type, tag),
|
||||
m_maincpu(*this, "maincpu"),
|
||||
m_ram(*this, RAM_TAG),
|
||||
m_screen(*this, "screen"),
|
||||
m_palette(*this, "palette"),
|
||||
m_io_penx(*this, "PENX"),
|
||||
m_io_peny(*this, "PENY"),
|
||||
m_io_penb(*this, "PENB"),
|
||||
@ -48,26 +54,62 @@ protected:
|
||||
virtual void machine_start() override;
|
||||
virtual void machine_reset() override;
|
||||
|
||||
private:
|
||||
void palm_port_f_out(uint8_t data);
|
||||
uint8_t palm_port_c_in();
|
||||
uint8_t palm_port_f_in();
|
||||
void palm_spim_out(uint16_t data);
|
||||
uint16_t palm_spim_in();
|
||||
DECLARE_WRITE_LINE_MEMBER(palm_spim_exchange);
|
||||
void palm_palette(palette_device &palette) const;
|
||||
enum : uint8_t
|
||||
{
|
||||
PORTF_Y_VCCN_BIT = 0,
|
||||
PORTF_Y_GND_BIT = 1,
|
||||
PORTF_X_VCCN_BIT = 2,
|
||||
PORTF_X_GND_BIT = 3,
|
||||
PORTF_LCD_EN_BIT = 4,
|
||||
PORTF_LCD_VCCN_BIT = 5,
|
||||
PORTF_LCD_VEE_BIT = 6,
|
||||
PORTF_ADC_CSN_BIT = 7,
|
||||
|
||||
offs_t palm_dasm_override(std::ostream &stream, offs_t pc, const util::disasm_interface::data_buffer &opcodes, const util::disasm_interface::data_buffer ¶ms);
|
||||
void palm_map(address_map &map);
|
||||
PORTF_PEN_MASK = 0x8f,
|
||||
PORTF_X_MASK = (1 << PORTF_X_VCCN_BIT) | (1 << PORTF_Y_GND_BIT),
|
||||
PORTF_Y_MASK = (1 << PORTF_Y_VCCN_BIT) | (1 << PORTF_X_GND_BIT),
|
||||
};
|
||||
|
||||
private:
|
||||
offs_t dasm_override(std::ostream &stream, offs_t pc, const util::disasm_interface::data_buffer &opcodes, const util::disasm_interface::data_buffer ¶ms);
|
||||
void mem_map(address_map &map);
|
||||
|
||||
void flm_out(int state);
|
||||
void llp_out(int state);
|
||||
void lsclk_out(int state);
|
||||
void ld_out(uint8_t data);
|
||||
void lcd_info_changed(double refresh_hz, int width, int height);
|
||||
uint32_t screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
|
||||
void init_palette(palette_device &palette) const;
|
||||
|
||||
void port_f_out(uint8_t data);
|
||||
uint8_t port_c_in();
|
||||
uint8_t port_f_in();
|
||||
|
||||
int spi_in();
|
||||
|
||||
required_device<mc68328_device> m_maincpu;
|
||||
required_device<ram_device> m_ram;
|
||||
uint8_t m_port_f_latch;
|
||||
uint16_t m_spim_data;
|
||||
required_device<screen_device> m_screen;
|
||||
required_device<palette_device> m_palette;
|
||||
required_ioport m_io_penx;
|
||||
required_ioport m_io_peny;
|
||||
required_ioport m_io_penb;
|
||||
required_ioport m_io_portd;
|
||||
|
||||
uint8_t m_port_f_latch;
|
||||
|
||||
uint16_t m_spim_data;
|
||||
|
||||
bitmap_rgb32 m_lcd_bitmap;
|
||||
int m_lcd_first_line;
|
||||
int m_lcd_line_pulse;
|
||||
int m_lcd_shift_clk;
|
||||
uint8_t m_lcd_data;
|
||||
int m_lcd_scan_x;
|
||||
int m_lcd_scan_y;
|
||||
|
||||
static const int EXTRA_ARTWORK_HEIGHT = 60;
|
||||
};
|
||||
|
||||
|
||||
@ -91,46 +133,43 @@ INPUT_CHANGED_MEMBER(palm_state::button_check)
|
||||
m_maincpu->set_port_d_lines(button_state, (int)param);
|
||||
}
|
||||
|
||||
void palm_state::palm_port_f_out(uint8_t data)
|
||||
void palm_state::port_f_out(uint8_t data)
|
||||
{
|
||||
const uint8_t old = m_port_f_latch;
|
||||
m_port_f_latch = data;
|
||||
const uint8_t changed = old ^ data;
|
||||
|
||||
if (BIT(changed, PORTF_ADC_CSN_BIT) && !BIT(m_port_f_latch, PORTF_ADC_CSN_BIT))
|
||||
{
|
||||
switch (m_port_f_latch & PORTF_PEN_MASK)
|
||||
{
|
||||
case PORTF_X_MASK:
|
||||
m_spim_data = (0xff - m_io_penx->read()) * 2;
|
||||
break;
|
||||
|
||||
case PORTF_Y_MASK:
|
||||
m_spim_data = (0xff - m_io_peny->read()) * 2;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
uint8_t palm_state::palm_port_c_in()
|
||||
uint8_t palm_state::port_c_in()
|
||||
{
|
||||
return 0x10;
|
||||
}
|
||||
|
||||
uint8_t palm_state::palm_port_f_in()
|
||||
uint8_t palm_state::port_f_in()
|
||||
{
|
||||
return m_port_f_latch;
|
||||
}
|
||||
|
||||
void palm_state::palm_spim_out(uint16_t data)
|
||||
int palm_state::spi_in()
|
||||
{
|
||||
m_spim_data = data;
|
||||
}
|
||||
|
||||
uint16_t palm_state::palm_spim_in()
|
||||
{
|
||||
return m_spim_data;
|
||||
}
|
||||
|
||||
WRITE_LINE_MEMBER(palm_state::palm_spim_exchange)
|
||||
{
|
||||
uint8_t x = m_io_penx->read();
|
||||
uint8_t y = m_io_peny->read();
|
||||
|
||||
switch (m_port_f_latch & 0x0f)
|
||||
{
|
||||
case 0x06:
|
||||
m_spim_data = (0xff - x) * 2;
|
||||
break;
|
||||
|
||||
case 0x09:
|
||||
m_spim_data = (0xff - y) * 2;
|
||||
break;
|
||||
}
|
||||
int out_state = BIT(m_spim_data, 15);
|
||||
m_spim_data <<= 1;
|
||||
m_spim_data |= 1;
|
||||
return out_state;
|
||||
}
|
||||
|
||||
void palm_state::machine_start()
|
||||
@ -140,6 +179,13 @@ void palm_state::machine_start()
|
||||
|
||||
save_item(NAME(m_port_f_latch));
|
||||
save_item(NAME(m_spim_data));
|
||||
|
||||
save_item(NAME(m_lcd_first_line));
|
||||
save_item(NAME(m_lcd_line_pulse));
|
||||
save_item(NAME(m_lcd_shift_clk));
|
||||
save_item(NAME(m_lcd_data));
|
||||
save_item(NAME(m_lcd_scan_x));
|
||||
save_item(NAME(m_lcd_scan_y));
|
||||
}
|
||||
|
||||
void palm_state::machine_reset()
|
||||
@ -148,13 +194,87 @@ void palm_state::machine_reset()
|
||||
uint8_t* bios = memregion("bios")->base();
|
||||
memset(m_ram->pointer(), 0, m_ram->size());
|
||||
memcpy(m_ram->pointer(), bios, 0x20000);
|
||||
|
||||
m_spim_data = 0xffff;
|
||||
|
||||
m_lcd_first_line = 1;
|
||||
m_lcd_line_pulse = 0;
|
||||
m_lcd_shift_clk = 0;
|
||||
m_lcd_data = 0;
|
||||
m_lcd_scan_x = 0;
|
||||
m_lcd_scan_y = 0;
|
||||
}
|
||||
|
||||
/* THIS IS PRETTY MUCH TOTALLY WRONG AND DOESN'T REFLECT THE MC68328'S INTERNAL FUNCTIONALITY AT ALL! */
|
||||
void palm_state::palm_palette(palette_device &palette) const
|
||||
/***************************************************************************
|
||||
LCD HARDWARE
|
||||
***************************************************************************/
|
||||
|
||||
void palm_state::init_palette(palette_device &palette) const
|
||||
{
|
||||
palette.set_pen_color(0, 0x7b, 0x8c, 0x5a);
|
||||
palette.set_pen_color(1, 0x00, 0x00, 0x00);
|
||||
palette.set_pen_color(0, 0xbd, 0xbd, 0xaa);
|
||||
palette.set_pen_color(1, 0x40, 0x40, 0x40);
|
||||
}
|
||||
|
||||
void palm_state::flm_out(int state)
|
||||
{
|
||||
m_lcd_first_line = state;
|
||||
}
|
||||
|
||||
void palm_state::llp_out(int state)
|
||||
{
|
||||
const int old = m_lcd_line_pulse;
|
||||
m_lcd_line_pulse = state;
|
||||
if (!state && old)
|
||||
{
|
||||
m_lcd_scan_x = 0;
|
||||
if (m_lcd_first_line)
|
||||
{
|
||||
m_lcd_scan_y = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_lcd_scan_y++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void palm_state::lsclk_out(int state)
|
||||
{
|
||||
const int old = m_lcd_shift_clk;
|
||||
m_lcd_shift_clk = state;
|
||||
if (state && !old)
|
||||
{
|
||||
for (uint8_t i = 0; i < 4; i++)
|
||||
{
|
||||
m_lcd_bitmap.pix(m_lcd_scan_y, m_lcd_scan_x) = m_palette->pen_color(BIT(m_lcd_data, 3 - i));
|
||||
m_lcd_scan_x++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void palm_state::ld_out(uint8_t data)
|
||||
{
|
||||
m_lcd_data = data;
|
||||
}
|
||||
|
||||
void palm_state::lcd_info_changed(double refresh_hz, int width, int height)
|
||||
{
|
||||
m_screen->set_refresh_hz(refresh_hz);
|
||||
m_screen->set_size(width, height + EXTRA_ARTWORK_HEIGHT);
|
||||
m_screen->set_visarea(0, width - 1, 0, (height + EXTRA_ARTWORK_HEIGHT) - 1);
|
||||
m_lcd_bitmap.resize(width, height);
|
||||
}
|
||||
|
||||
uint32_t palm_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
|
||||
{
|
||||
bitmap.fill(m_palette->pen_color(0));
|
||||
if (m_lcd_bitmap.valid())
|
||||
{
|
||||
uint32_t *src = &m_lcd_bitmap.pix(0);
|
||||
uint32_t *dst = &bitmap.pix(0);
|
||||
std::copy_n(src, m_lcd_bitmap.width() * m_lcd_bitmap.height(), dst);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@ -162,7 +282,7 @@ void palm_state::palm_palette(palette_device &palette) const
|
||||
ADDRESS MAPS
|
||||
***************************************************************************/
|
||||
|
||||
void palm_state::palm_map(address_map &map)
|
||||
void palm_state::mem_map(address_map &map)
|
||||
{
|
||||
map(0xc00000, 0xe07fff).rom().region("bios", 0);
|
||||
}
|
||||
@ -176,29 +296,31 @@ void palm_state::palm(machine_config &config)
|
||||
{
|
||||
/* basic machine hardware */
|
||||
MC68328(config, m_maincpu, 32768*506); /* 16.580608 MHz */
|
||||
m_maincpu->set_addrmap(AS_PROGRAM, &palm_state::palm_map);
|
||||
m_maincpu->set_dasm_override(FUNC(palm_state::palm_dasm_override));
|
||||
m_maincpu->out_port_f().set(FUNC(palm_state::palm_port_f_out));
|
||||
m_maincpu->in_port_c().set(FUNC(palm_state::palm_port_c_in));
|
||||
m_maincpu->in_port_f().set(FUNC(palm_state::palm_port_f_in));
|
||||
m_maincpu->set_addrmap(AS_PROGRAM, &palm_state::mem_map);
|
||||
m_maincpu->set_dasm_override(FUNC(palm_state::dasm_override));
|
||||
m_maincpu->out_port_f().set(FUNC(palm_state::port_f_out));
|
||||
m_maincpu->in_port_c().set(FUNC(palm_state::port_c_in));
|
||||
m_maincpu->in_port_f().set(FUNC(palm_state::port_f_in));
|
||||
m_maincpu->out_pwm().set("dac", FUNC(dac_bit_interface::write));
|
||||
m_maincpu->out_spim().set(FUNC(palm_state::palm_spim_out));
|
||||
m_maincpu->in_spim().set(FUNC(palm_state::palm_spim_in));
|
||||
m_maincpu->spim_xch_trigger().set(FUNC(palm_state::palm_spim_exchange));
|
||||
m_maincpu->in_spim().set(FUNC(palm_state::spi_in));
|
||||
m_maincpu->out_flm().set(FUNC(palm_state::flm_out));
|
||||
m_maincpu->out_llp().set(FUNC(palm_state::llp_out));
|
||||
m_maincpu->out_lsclk().set(FUNC(palm_state::lsclk_out));
|
||||
m_maincpu->out_ld().set(FUNC(palm_state::ld_out));
|
||||
m_maincpu->set_lcd_info_changed(FUNC(palm_state::lcd_info_changed));
|
||||
|
||||
config.set_maximum_quantum(attotime::from_hz(60));
|
||||
|
||||
/* video hardware */
|
||||
screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_LCD));
|
||||
screen.set_refresh_hz(60);
|
||||
screen.set_vblank_time(ATTOSECONDS_IN_USEC(1260));
|
||||
screen.set_video_attributes(VIDEO_UPDATE_BEFORE_VBLANK);
|
||||
screen.set_size(160, 220);
|
||||
screen.set_visarea(0, 159, 0, 219);
|
||||
screen.set_screen_update("maincpu", FUNC(mc68328_device::screen_update));
|
||||
screen.set_palette("palette");
|
||||
SCREEN(config, m_screen, SCREEN_TYPE_LCD);
|
||||
m_screen->set_refresh_hz(60);
|
||||
m_screen->set_vblank_time(ATTOSECONDS_IN_USEC(0));
|
||||
m_screen->set_video_attributes(VIDEO_UPDATE_BEFORE_VBLANK);
|
||||
m_screen->set_size(160, 160);
|
||||
m_screen->set_visarea(0, 159, 0, 159);
|
||||
m_screen->set_screen_update(FUNC(palm_state::screen_update));
|
||||
|
||||
PALETTE(config, "palette", FUNC(palm_state::palm_palette), 2);
|
||||
PALETTE(config, m_palette, FUNC(palm_state::init_palette), 2);
|
||||
|
||||
/* audio hardware */
|
||||
SPEAKER(config, "speaker").front_center();
|
||||
@ -423,6 +545,8 @@ void palm_state::pilot1k(machine_config &config)
|
||||
|
||||
/* internal ram */
|
||||
RAM(config, RAM_TAG).set_default_size("128K").set_extra_options("512K,1M,2M,4M,8M");
|
||||
|
||||
config.set_default_layout(layout_pilot1k);
|
||||
}
|
||||
|
||||
void palm_state::pilot5k(machine_config &config)
|
||||
@ -465,6 +589,8 @@ void palm_state::palmvx(machine_config &config)
|
||||
RAM(config, RAM_TAG).set_default_size("8M");
|
||||
}
|
||||
|
||||
} // anonymous namespace
|
||||
|
||||
// YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS
|
||||
COMP( 1996, pilot1k, 0, 0, pilot1k, palm, palm_state, empty_init, "U.S. Robotics", "Pilot 1000", MACHINE_SUPPORTS_SAVE | MACHINE_NO_SOUND )
|
||||
COMP( 1996, pilot5k, pilot1k, 0, pilot5k, palm, palm_state, empty_init, "U.S. Robotics", "Pilot 5000", MACHINE_SUPPORTS_SAVE | MACHINE_NO_SOUND )
|
||||
|
@ -1162,7 +1162,7 @@ static const char *lookup_trap(uint16_t opcode)
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
offs_t palm_state::palm_dasm_override(std::ostream &stream, offs_t pc, const util::disasm_interface::data_buffer &opcodes, const util::disasm_interface::data_buffer ¶ms)
|
||||
offs_t palm_state::dasm_override(std::ostream &stream, offs_t pc, const util::disasm_interface::data_buffer &opcodes, const util::disasm_interface::data_buffer ¶ms)
|
||||
{
|
||||
unsigned result = 0;
|
||||
const char *trap;
|
||||
|
Loading…
Reference in New Issue
Block a user