summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author mooglyguy <therealmogminer@gmail.com>2018-12-10 23:27:06 +0100
committer mooglyguy <therealmogminer@gmail.com>2018-12-10 23:27:55 +0100
commit7e140bb4d0de91013ef5e216c43e6b2c2d3fce25 (patch)
tree43cc035aed6168b881b80bf3f311329fbfeea994
parent00e967ec030cd92b465a3f0983a013c24840874b (diff)
-scmp, sc61860: Removed MCFG macros. [Ryan Holtz]
-mk14: Removed MACHINE_CONFIG macros. [Ryan Holtz] -pocketc: Various cleanups: [Ryan Holtz} * First pass on cleaning up duplicate code. * Removed redundant driver-name prefixes from member functions. * Mostly fixed ghastly spacing. * Removed use of ioport() and made use of required_ioport_array for keys. * Added logmacro support. * Removed MACHINE_CONFIG macros. * Cleaned up spelling errors and random use of German in comments. * Eliminated use of machine().system().name in favor of a subclass. * Eliminated use of an anonymous timer. * Mostly switched to using BIT() macro instead of direct masks. * Imposed some order via protected/private. * Removed ancient #ifdef'd-out code. * Made use of modern inline variable declarations instead of C-style.
-rw-r--r--src/devices/cpu/sc61860/sc61860.h57
-rw-r--r--src/devices/cpu/scmp/scmp.h12
-rw-r--r--src/mame/drivers/mk14.cpp32
-rw-r--r--src/mame/drivers/pocketc.cpp361
-rw-r--r--src/mame/includes/pc1251.h90
-rw-r--r--src/mame/includes/pc1350.h62
-rw-r--r--src/mame/includes/pc1401.h71
-rw-r--r--src/mame/includes/pc1403.h94
-rw-r--r--src/mame/includes/pocketc.h49
-rw-r--r--src/mame/machine/pc1251.cpp99
-rw-r--r--src/mame/machine/pc1350.cpp89
-rw-r--r--src/mame/machine/pc1401.cpp198
-rw-r--r--src/mame/machine/pc1403.cpp167
-rw-r--r--src/mame/machine/pocketc.cpp38
-rw-r--r--src/mame/video/pc1251.cpp202
-rw-r--r--src/mame/video/pc1350.cpp184
-rw-r--r--src/mame/video/pc1401.cpp261
-rw-r--r--src/mame/video/pc1403.cpp338
-rw-r--r--src/mame/video/pocketc.cpp62
19 files changed, 1025 insertions, 1441 deletions
diff --git a/src/devices/cpu/sc61860/sc61860.h b/src/devices/cpu/sc61860/sc61860.h
index cd38606e486..57246e1d672 100644
--- a/src/devices/cpu/sc61860/sc61860.h
+++ b/src/devices/cpu/sc61860/sc61860.h
@@ -16,15 +16,16 @@
#pragma once
/*
- official names seam to be
+ Official names seem to be:
ESR-H, ESR-J
- (ESR-L SC62015 ist complete different)
- */
+ (ESR-L SC62015 is completely different)
+*/
-/* unsolved problems
- the processor has 8 kbyte internal rom
- only readable with special instructions and program execution
- 64 kb external ram (first 8kbyte not seen for program execution?) */
+/* Known Issues:
+ - The processor has an 8kbyte internal ROM which is only readable with
+ special instructions and program execution.
+ - 64kbyte external RAM (first 8kbytes not seen for program execution?)
+*/
enum
@@ -33,7 +34,7 @@ enum
SC61860_P, SC61860_Q, SC61860_R,
SC61860_CARRY,
SC61860_ZERO,
- // the following are in the internal ram!
+ // The following are in the internal RAM!
SC61860_BA,
SC61860_X, SC61860_Y,
SC61860_I, SC61860_J, SC61860_K, SC61860_L, SC61860_V, SC61860_W,
@@ -44,30 +45,6 @@ enum
};
-#define MCFG_SC61860_READ_RESET_HANDLER(_devcb) \
- downcast<sc61860_device &>(*device).set_reset_cb(DEVCB_##_devcb);
-
-#define MCFG_SC61860_READ_BRK_HANDLER(_devcb) \
- downcast<sc61860_device &>(*device).set_brk_cb(DEVCB_##_devcb);
-
-#define MCFG_SC61860_READ_X_HANDLER(_devcb) \
- downcast<sc61860_device &>(*device).set_x_cb(DEVCB_##_devcb);
-
-#define MCFG_SC61860_READ_A_HANDLER(_devcb) \
- downcast<sc61860_device &>(*device).set_ina_cb(DEVCB_##_devcb);
-
-#define MCFG_SC61860_WRITE_A_HANDLER(_devcb) \
- downcast<sc61860_device &>(*device).set_outa_cb(DEVCB_##_devcb);
-
-#define MCFG_SC61860_READ_B_HANDLER(_devcb) \
- downcast<sc61860_device &>(*device).set_inb_cb(DEVCB_##_devcb);
-
-#define MCFG_SC61860_WRITE_B_HANDLER(_devcb) \
- downcast<sc61860_device &>(*device).set_outb_cb(DEVCB_##_devcb);
-
-#define MCFG_SC61860_WRITE_C_HANDLER(_devcb) \
- downcast<sc61860_device &>(*device).set_outc_cb(DEVCB_##_devcb);
-
class sc61860_device : public cpu_device
{
public:
@@ -75,14 +52,14 @@ public:
sc61860_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
// configuration helpers
- template <class Object> devcb_base &set_reset_cb(Object &&cb) { return m_reset.set_callback(std::forward<Object>(cb)); }
- template <class Object> devcb_base &set_brk_cb(Object &&cb) { return m_brk.set_callback(std::forward<Object>(cb)); }
- template <class Object> devcb_base &set_x_cb(Object &&cb) { return m_x.set_callback(std::forward<Object>(cb)); }
- template <class Object> devcb_base &set_ina_cb(Object &&cb) { return m_ina.set_callback(std::forward<Object>(cb)); }
- template <class Object> devcb_base &set_outa_cb(Object &&cb) { return m_outa.set_callback(std::forward<Object>(cb)); }
- template <class Object> devcb_base &set_inb_cb(Object &&cb) { return m_inb.set_callback(std::forward<Object>(cb)); }
- template <class Object> devcb_base &set_outb_cb(Object &&cb) { return m_outb.set_callback(std::forward<Object>(cb)); }
- template <class Object> devcb_base &set_outc_cb(Object &&cb) { return m_outc.set_callback(std::forward<Object>(cb)); }
+ auto reset_cb() { return m_reset.bind(); }
+ auto brk_cb() { return m_brk.bind(); }
+ auto x_cb() { return m_x.bind(); }
+ auto in_a_cb() { return m_ina.bind(); }
+ auto out_a_cb() { return m_outa.bind(); }
+ auto in_b_cb() { return m_inb.bind(); }
+ auto out_b_cb() { return m_outb.bind(); }
+ auto out_c_cb() { return m_outc.bind(); }
/* this is though for power on/off of the sharps */
uint8_t *internal_ram();
diff --git a/src/devices/cpu/scmp/scmp.h b/src/devices/cpu/scmp/scmp.h
index 9a3a6f2fece..18ffac53b1a 100644
--- a/src/devices/cpu/scmp/scmp.h
+++ b/src/devices/cpu/scmp/scmp.h
@@ -22,12 +22,12 @@ public:
scmp_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
// configuration helpers
- template <class Object> devcb_base &set_flag_out_cb(Object &&cb) { return m_flag_out_func.set_callback(std::forward<Object>(cb)); }
- template <class Object> devcb_base &set_sout_cb(Object &&cb) { return m_sout_func.set_callback(std::forward<Object>(cb)); }
- template <class Object> devcb_base &set_sin_cb(Object &&cb) { return m_sin_func.set_callback(std::forward<Object>(cb)); }
- template <class Object> devcb_base &set_sensea_cb(Object &&cb) { return m_sensea_func.set_callback(std::forward<Object>(cb)); }
- template <class Object> devcb_base &set_senseb_cb(Object &&cb) { return m_senseb_func.set_callback(std::forward<Object>(cb)); }
- template <class Object> devcb_base &set_halt_cb(Object &&cb) { return m_halt_func.set_callback(std::forward<Object>(cb)); }
+ auto flag_out() { return m_flag_out_func.bind(); }
+ auto s_out() { return m_sout_func.bind(); }
+ auto s_in() { return m_sin_func.bind(); }
+ auto sense_a() { return m_sensea_func.bind(); }
+ auto sense_b() { return m_senseb_func.bind(); }
+ auto halt() { return m_halt_func.bind(); }
protected:
enum
diff --git a/src/mame/drivers/mk14.cpp b/src/mame/drivers/mk14.cpp
index 118f25be403..39db2ca1e04 100644
--- a/src/mame/drivers/mk14.cpp
+++ b/src/mame/drivers/mk14.cpp
@@ -69,7 +69,7 @@ private:
virtual void machine_reset() override;
virtual void machine_start() override;
- required_device<cpu_device> m_maincpu;
+ required_device<scmp_device> m_maincpu;
required_ioport_array<8> m_keyboard;
required_device<cassette_image_device> m_cass;
required_device<dac_bit_interface> m_dac;
@@ -201,12 +201,18 @@ void mk14_state::machine_start()
m_digits.resolve();
}
-MACHINE_CONFIG_START(mk14_state::mk14)
+void mk14_state::mk14(machine_config &config)
+{
/* basic machine hardware */
// IC1 1SP-8A/600 (8060) SC/MP Microprocessor
- MCFG_DEVICE_ADD("maincpu", INS8060, XTAL(4'433'619))
- MCFG_SCMP_CONFIG(WRITELINE(*this, mk14_state, cass_w), NOOP, READLINE(*this, mk14_state, cass_r), CONSTANT(0), READLINE(*this, mk14_state, cass_r), NOOP)
- MCFG_DEVICE_PROGRAM_MAP(mem_map)
+ INS8060(config, m_maincpu, XTAL(4'433'619));
+ m_maincpu->flag_out().set(FUNC(mk14_state::cass_w));
+ m_maincpu->s_out().set_nop();
+ m_maincpu->s_in().set(FUNC(mk14_state::cass_r));
+ m_maincpu->sense_a().set_constant(0);
+ m_maincpu->sense_b().set(FUNC(mk14_state::cass_r));
+ m_maincpu->halt().set_nop();
+ m_maincpu->set_addrmap(AS_PROGRAM, &mk14_state::mem_map);
/* video hardware */
config.set_default_layout(layout_mk14);
@@ -214,19 +220,21 @@ MACHINE_CONFIG_START(mk14_state::mk14)
// sound
SPEAKER(config, "speaker").front_center();
WAVE(config, "wave", "cassette").add_route(ALL_OUTPUTS, "speaker", 0.05);
- MCFG_DEVICE_ADD("dac", DAC_1BIT, 0) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "speaker", 0.25)
- MCFG_DEVICE_ADD("dac8", ZN425E, 0) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "speaker", 0.5) // Ferranti ZN425E
- MCFG_DEVICE_ADD("vref", VOLTAGE_REGULATOR, 0) MCFG_VOLTAGE_REGULATOR_OUTPUT(5.0)
- MCFG_SOUND_ROUTE(0, "dac", 1.0, DAC_VREF_POS_INPUT)
- MCFG_SOUND_ROUTE(0, "dac8", 1.0, DAC_VREF_POS_INPUT) MCFG_SOUND_ROUTE(0, "dac8", -1.0, DAC_VREF_NEG_INPUT)
+ DAC_1BIT(config, m_dac, 0).add_route(ALL_OUTPUTS, "speaker", 0.25);
+ ZN425E(config, "dac8", 0).add_route(ALL_OUTPUTS, "speaker", 0.5); // Ferranti ZN425E
+ voltage_regulator_device &vref(VOLTAGE_REGULATOR(config, "vref", 0));
+ vref.set_output(5.0);
+ vref.add_route(0, "dac", 1.0, DAC_VREF_POS_INPUT);
+ vref.add_route(0, "dac8", 1.0, DAC_VREF_POS_INPUT);
+ vref.add_route(0, "dac8", -1.0, DAC_VREF_NEG_INPUT);
/* devices */
ins8154_device &ic8(INS8154(config, "ic8"));
ic8.out_a().set(FUNC(mk14_state::port_a_w));
ic8.out_b().set("dac8", FUNC(dac_byte_interface::data_w));
- MCFG_CASSETTE_ADD( "cassette" )
-MACHINE_CONFIG_END
+ CASSETTE(config, m_cass);
+}
/* ROM definition */
ROM_START( mk14 )
diff --git a/src/mame/drivers/pocketc.cpp b/src/mame/drivers/pocketc.cpp
index 060a5165af6..634a3ff7d4b 100644
--- a/src/mame/drivers/pocketc.cpp
+++ b/src/mame/drivers/pocketc.cpp
@@ -1,9 +1,9 @@
// license:GPL-2.0+
// copyright-holders:Peter Trauner
/******************************************************************************
- sharp pocket computers
- pc1401/pc1403
- PeT mess@utanet.at May 2000
+ Sharp pocket computers
+ PC1401/PC1403
+ PeT mess@utanet.at May 2000
******************************************************************************/
#include "emu.h"
@@ -13,17 +13,13 @@
#include "includes/pc1350.h"
#include "includes/pc1403.h"
-#include "cpu/sc61860/sc61860.h"
#include "machine/ram.h"
-#include "screen.h"
+/* PC1430 lacks peek/poke operations */
+/* PC1280?? */
-/* pc1430 no peek poke operations! */
-
-/* pc1280?? */
-
-/* pc126x
+/* PC126x
port
1 ?
2 +6v
@@ -37,7 +33,7 @@
10 ib5
11 ib4 */
-/* pc1350 other keyboard,
+/* PC1350 other keyboard,
f2 instead f0 at port
port
1 ?
@@ -53,20 +49,20 @@
11 ib4
*/
-/* similar computers
- pc1260/1261
- pc1402/1403
- pc1421 */
-/* pc140x
+/* Similar Computers:
+ - PC1260/1261
+ - PC1402/1403
+ - PC1421 */
+/* PC140x
a,b0..b5 keyboard matrix
b0 off key
c0 display on
c1 counter reset
c2 cpu halt
c3 computer off
- c4 beeper frequency (1 4kHz, 0 2kHz), or (c5=0) membran pos1/pos2
+ c4 beeper frequency (1 4kHz, 0 2kHz), or (c5=0) membrane pos1/pos2
c5 beeper on
- c6 beeper steuerung
+ c6 beeper control
port
1 ?
@@ -82,14 +78,13 @@
11 ?
*/
-/* special keys
- red c-ce and reset; warm boot, program NOT lost*/
+/* Special Leys Red C-CE and Reset; warm boot, program NOT lost */
void pc1401_state::pc1401_mem(address_map &map)
{
map(0x0000, 0x1fff).rom();
map(0x3800, 0x47ff).ram();
- map(0x6000, 0x67ff).rw(FUNC(pc1401_state::pc1401_lcd_read), FUNC(pc1401_state::pc1401_lcd_write)).mirror(0x1000);
+ map(0x6000, 0x67ff).rw(FUNC(pc1401_state::lcd_read), FUNC(pc1401_state::lcd_write)).mirror(0x1000);
map(0x8000, 0xffff).rom();
}
@@ -97,7 +92,7 @@ void pc1401_state::pc1402_mem(address_map &map)
{
map(0x0000, 0x1fff).rom();
map(0x2000, 0x47ff).ram();
- map(0x6000, 0x67ff).rw(FUNC(pc1401_state::pc1401_lcd_read), FUNC(pc1401_state::pc1401_lcd_write)).mirror(0x1000);
+ map(0x6000, 0x67ff).rw(FUNC(pc1401_state::lcd_read), FUNC(pc1401_state::lcd_write)).mirror(0x1000);
map(0x8000, 0xffff).rom();
}
@@ -106,7 +101,7 @@ void pc1251_state::pc1250_mem(address_map &map)
map(0x0000, 0x1fff).rom();
map(0x4000, 0x7fff).rom();
map(0xc000, 0xc7ff).ram(); // 2KB RAM
- map(0xf800, 0xf8ff).rw(FUNC(pc1251_state::pc1251_lcd_read), FUNC(pc1251_state::pc1251_lcd_write));
+ map(0xf800, 0xf8ff).rw(FUNC(pc1251_state::lcd_read), FUNC(pc1251_state::lcd_write));
}
void pc1251_state::pc1251_mem(address_map &map)
@@ -114,7 +109,7 @@ void pc1251_state::pc1251_mem(address_map &map)
map(0x0000, 0x1fff).rom();
map(0x4000, 0x7fff).rom();
map(0xb800, 0xc7ff).ram(); // 4KB RAM
- map(0xf800, 0xf8ff).rw(FUNC(pc1251_state::pc1251_lcd_read), FUNC(pc1251_state::pc1251_lcd_write));
+ map(0xf800, 0xf8ff).rw(FUNC(pc1251_state::lcd_read), FUNC(pc1251_state::lcd_write));
}
void pc1251_state::pc1255_mem(address_map &map)
@@ -122,14 +117,13 @@ void pc1251_state::pc1255_mem(address_map &map)
map(0x0000, 0x1fff).rom();
map(0x4000, 0x7fff).rom();
map(0xa000, 0xc7ff).ram(); // 10KB RAM
- map(0xf800, 0xf8ff).rw(FUNC(pc1251_state::pc1251_lcd_read), FUNC(pc1251_state::pc1251_lcd_write));
+ map(0xf800, 0xf8ff).rw(FUNC(pc1251_state::lcd_read), FUNC(pc1251_state::lcd_write));
}
void pc1251_state::pc1260_mem(address_map &map)
{
map(0x0000, 0x1fff).rom();
- map(0x2000, 0x20ff).rw(FUNC(pc1251_state::pc1251_lcd_read), FUNC(pc1251_state::pc1251_lcd_write));
- //map( 0x2800, 0x28ff) AM_READWRITE(pc1251_lcd_read, pc1251_lcd_write)
+ map(0x2000, 0x20ff).rw(FUNC(pc1251_state::lcd_read), FUNC(pc1251_state::lcd_write));
map(0x5800, 0x67ff).ram(); // 4KB RAM
map(0x8000, 0xffff).rom();
}
@@ -137,25 +131,23 @@ void pc1251_state::pc1260_mem(address_map &map)
void pc1251_state::pc1261_mem(address_map &map)
{
map(0x0000, 0x1fff).rom();
- map(0x2000, 0x20ff).rw(FUNC(pc1251_state::pc1251_lcd_read), FUNC(pc1251_state::pc1251_lcd_write));
- //map( 0x2800, 0x28ff) AM_READWRITE(pc1251_lcd_read, pc1251_lcd_write)
+ map(0x2000, 0x20ff).rw(FUNC(pc1251_state::lcd_read), FUNC(pc1251_state::lcd_write));
map(0x4000, 0x67ff).ram(); // 10KB RAM
map(0x8000, 0xffff).rom();
}
-
void pc1350_state::pc1350_mem(address_map &map)
{
map(0x0000, 0x1fff).rom();
- map(0x7000, 0x7eff).rw(FUNC(pc1350_state::pc1350_lcd_read), FUNC(pc1350_state::pc1350_lcd_write));
+ map(0x7000, 0x7eff).rw(FUNC(pc1350_state::lcd_read), FUNC(pc1350_state::lcd_write));
map(0x8000, 0xffff).rom();
}
void pc1403_state::pc1403_mem(address_map &map)
{
map(0x0000, 0x1fff).rom();
- map(0x3000, 0x30bf).rw(FUNC(pc1403_state::pc1403_lcd_read), FUNC(pc1403_state::pc1403_lcd_write));
- map(0x3800, 0x3fff).rw(FUNC(pc1403_state::pc1403_asic_read), FUNC(pc1403_state::pc1403_asic_write));
+ map(0x3000, 0x30bf).rw(FUNC(pc1403_state::lcd_read), FUNC(pc1403_state::lcd_write));
+ map(0x3800, 0x3fff).rw(FUNC(pc1403_state::asic_read), FUNC(pc1403_state::asic_write));
map(0x4000, 0x7fff).bankr("bank1");
map(0xe000, 0xffff).ram();
}
@@ -163,34 +155,33 @@ void pc1403_state::pc1403_mem(address_map &map)
void pc1403_state::pc1403h_mem(address_map &map)
{
map(0x0000, 0x1fff).rom();
- map(0x3000, 0x30bf).rw(FUNC(pc1403_state::pc1403_lcd_read), FUNC(pc1403_state::pc1403_lcd_write));
- map(0x3800, 0x3fff).rw(FUNC(pc1403_state::pc1403_asic_read), FUNC(pc1403_state::pc1403_asic_write));
+ map(0x3000, 0x30bf).rw(FUNC(pc1403_state::lcd_read), FUNC(pc1403_state::lcd_write));
+ map(0x3800, 0x3fff).rw(FUNC(pc1403_state::asic_read), FUNC(pc1403_state::asic_write));
map(0x4000, 0x7fff).bankr("bank1");
map(0x8000, 0xffff).ram();
}
-
#if 0
void pc1403_state::pc1421_readmem(address_map &map)
{
- map( 0x0000, 0x1fff).rom();
- map( 0x3800, 0x47ff).ram();
- map( 0x8000, 0xffff).rom();
+ map(0x0000, 0x1fff).rom();
+ map(0x3800, 0x47ff).ram();
+ map(0x8000, 0xffff).rom();
}
void pc1403_state::pc1421_writemem(address_map &map)
{
- map( 0x0000, 0x1fff).rom();
- map( 0x2000, 0x37ff).ram();
- map( 0x3800, 0x47ff).ram();
- map( 0x8000, 0xffff).rom();
+ map(0x0000, 0x1fff).rom();
+ map(0x2000, 0x37ff).ram();
+ map(0x3800, 0x47ff).ram();
+ map(0x8000, 0xffff).rom();
}
#endif
/* 2008-05 FP: the following input ports are based on the way ports are read, but I would like
to have confirmation from technical docs before considering these correct.
- If they need to be changed, you must also update the clickable artwork.
+ If they need to be changed, you must also update the clickable artwork.
*/
static INPUT_PORTS_START( pc1401 )
@@ -724,161 +715,143 @@ static GFXDECODE_START( gfx_pc1251 )
GFXDECODE_ENTRY( "gfx1", 0x0000, pc1251_charlayout, 0, 8 )
GFXDECODE_END
-MACHINE_CONFIG_START(pocketc_state::pocketc)
- MCFG_QUANTUM_TIME(attotime::from_hz(60))
+void pocketc_state::pocketc_base(machine_config &config)
+{
+ config.m_minimum_quantum = attotime::from_hz(60);
NVRAM(config, "cpu_nvram", nvram_device::DEFAULT_ALL_0);
NVRAM(config, "ram_nvram", nvram_device::DEFAULT_ALL_0);
- /*
- aim: show sharp with keyboard
- resolution depends on the dots of the lcd
- (lcd dot displayed as 2x3 pixel)
- it seems to have 3/4 ratio in the real pc1401 */
- /* video hardware */
- MCFG_SCREEN_ADD("screen", LCD)
- MCFG_SCREEN_REFRESH_RATE(20) /* very early and slow lcd */
- MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */
- MCFG_SCREEN_SIZE(594, 273)
- MCFG_SCREEN_VISIBLE_AREA(0, 594-1, 0, 273-1)
-// MCFG_SCREEN_SIZE(640, 273)
-// MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 273-1)
- MCFG_SCREEN_PALETTE("palette")
-
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_pc1401)
- MCFG_PALETTE_ADD("palette", 8*2)
- MCFG_PALETTE_INDIRECT_ENTRIES(6)
- MCFG_PALETTE_INIT_OWNER( pocketc_state, pocketc )
-MACHINE_CONFIG_END
-
-MACHINE_CONFIG_START(pc1401_state::pc1401)
- pocketc(config);
- MCFG_DEVICE_ADD("maincpu", SC61860, 192000) /* 7.8336 MHz */
- MCFG_DEVICE_PROGRAM_MAP(pc1401_mem)
- MCFG_SC61860_READ_RESET_HANDLER(READLINE(*this, pc1401_state,pc1401_reset))
- MCFG_SC61860_READ_BRK_HANDLER(READLINE(*this, pc1401_state,pc1401_brk))
- MCFG_SC61860_READ_X_HANDLER(CONSTANT(0))
- MCFG_SC61860_READ_A_HANDLER(READ8(*this, pc1401_state,pc1401_ina))
- MCFG_SC61860_WRITE_A_HANDLER(WRITE8(*this, pc1401_state,pc1401_outa))
- MCFG_SC61860_READ_B_HANDLER(READ8(*this, pc1401_state,pc1401_inb))
- MCFG_SC61860_WRITE_B_HANDLER(WRITE8(*this, pc1401_state,pc1401_outb))
- MCFG_SC61860_WRITE_C_HANDLER(WRITE8(*this, pc1401_state,pc1401_outc))
-
- MCFG_SCREEN_MODIFY("screen")
- MCFG_SCREEN_UPDATE_DRIVER(pc1401_state, screen_update_pc1401)
-MACHINE_CONFIG_END
-
-MACHINE_CONFIG_START(pc1401_state::pc1402)
+ // TODO: Convert to an SVG
+ SCREEN(config, m_screen, SCREEN_TYPE_LCD);
+ m_screen->set_refresh_hz(20);
+ m_screen->set_vblank_time(ATTOSECONDS_IN_USEC(2500)); /* not accurate */
+ m_screen->set_size(594, 273);
+ m_screen->set_visarea(0, 594-1, 0, 273-1);
+ m_screen->set_palette(m_palette);
+
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_pc1401);
+ PALETTE(config, m_palette, 8*2);
+ m_palette->set_indirect_entries(6);
+ m_palette->set_init(palette_init_delegate(FUNC(pocketc_state::palette_init_pocketc), this));
+}
+
+void pc1401_state::pc1401(machine_config &config)
+{
+ pocketc_base(config);
+ SC61860(config, m_maincpu, 192000); /* 7.8336 MHz */
+ m_maincpu->set_addrmap(AS_PROGRAM, &pc1401_state::pc1401_mem);
+ m_maincpu->reset_cb().set(FUNC(pc1401_state::reset_r));
+ m_maincpu->brk_cb().set(FUNC(pc1401_state::brk_r));
+ m_maincpu->x_cb().set_constant(0);
+ m_maincpu->in_a_cb().set(FUNC(pc1401_state::in_a_r));
+ m_maincpu->out_a_cb().set(FUNC(pc1401_state::out_a_w));
+ m_maincpu->in_b_cb().set(FUNC(pc1401_state::in_b_r));
+ m_maincpu->out_b_cb().set(FUNC(pc1401_state::out_b_w));
+ m_maincpu->out_c_cb().set(FUNC(pc1401_state::out_c_w));
+
+ m_screen->set_screen_update(FUNC(pc1401_state::screen_update));
+}
+
+void pc1401_state::pc1402(machine_config &config)
+{
pc1401(config);
- MCFG_DEVICE_MODIFY( "maincpu" )
- MCFG_DEVICE_PROGRAM_MAP( pc1402_mem)
-MACHINE_CONFIG_END
-
-MACHINE_CONFIG_START(pc1251_state::pc1250)
- pocketc(config);
- MCFG_DEVICE_ADD("maincpu", SC61860, 192000) /* 7.8336 MHz */
- MCFG_DEVICE_PROGRAM_MAP( pc1250_mem)
- MCFG_SC61860_READ_RESET_HANDLER(CONSTANT(0))
- MCFG_SC61860_READ_BRK_HANDLER(READLINE(*this, pc1251_state,pc1251_brk))
- MCFG_SC61860_READ_X_HANDLER(CONSTANT(0))
- MCFG_SC61860_READ_A_HANDLER(READ8(*this, pc1251_state,pc1251_ina))
- MCFG_SC61860_WRITE_A_HANDLER(WRITE8(*this, pc1251_state,pc1251_outa))
- MCFG_SC61860_READ_B_HANDLER(READ8(*this, pc1251_state,pc1251_inb))
- MCFG_SC61860_WRITE_B_HANDLER(WRITE8(*this, pc1251_state,pc1251_outb))
- MCFG_SC61860_WRITE_C_HANDLER(WRITE8(*this, pc1251_state,pc1251_outc))
+ m_maincpu->set_addrmap(AS_PROGRAM, &pc1401_state::pc1402_mem);
+}
+
+void pc1251_state::pc1250(machine_config &config)
+{
+ pocketc_base(config);
+ SC61860(config, m_maincpu, 192000); /* 7.8336 MHz */
+ m_maincpu->set_addrmap(AS_PROGRAM, &pc1251_state::pc1250_mem);
+ m_maincpu->reset_cb().set_constant(0);
+ m_maincpu->brk_cb().set(FUNC(pc1251_state::brk_r));
+ m_maincpu->x_cb().set_constant(0);
+ m_maincpu->in_a_cb().set(FUNC(pc1251_state::in_a_r));
+ m_maincpu->out_a_cb().set(FUNC(pc1251_state::out_a_w));
+ m_maincpu->in_b_cb().set(FUNC(pc1251_state::in_b_r));
+ m_maincpu->out_b_cb().set(FUNC(pc1251_state::out_b_w));
+ m_maincpu->out_c_cb().set(FUNC(pc1251_state::out_c_w));
/* video hardware */
- MCFG_SCREEN_MODIFY("screen")
- MCFG_SCREEN_SIZE(608, 300)
- MCFG_SCREEN_VISIBLE_AREA(0, 608-1, 0, 300-1)
- MCFG_SCREEN_UPDATE_DRIVER(pc1251_state, screen_update_pc1251)
- MCFG_GFXDECODE_MODIFY("gfxdecode", gfx_pc1251)
-MACHINE_CONFIG_END
-
-MACHINE_CONFIG_START(pc1251_state::pc1251)
- pc1250(config);
- MCFG_DEVICE_MODIFY( "maincpu" )
- MCFG_DEVICE_PROGRAM_MAP( pc1251_mem)
-MACHINE_CONFIG_END
+ m_screen->set_size(608, 300);
+ m_screen->set_visarea(0, 608-1, 0, 300-1);
+ m_screen->set_screen_update(FUNC(pc1251_state::screen_update));
+ m_gfxdecode->set_info(gfx_pc1251);
+}
-MACHINE_CONFIG_START(pc1251_state::pc1255)
+void pc1251_state::pc1251(machine_config &config)
+{
pc1250(config);
- MCFG_DEVICE_MODIFY( "maincpu" )
- MCFG_DEVICE_PROGRAM_MAP( pc1255_mem)
-MACHINE_CONFIG_END
+ m_maincpu->set_addrmap(AS_PROGRAM, &pc1251_state::pc1251_mem);
+}
-MACHINE_CONFIG_START(pc1251_state::pc1260)
+void pc1251_state::pc1255(machine_config &config)
+{
pc1250(config);
- MCFG_DEVICE_MODIFY( "maincpu" )
- MCFG_DEVICE_PROGRAM_MAP( pc1260_mem)
+ m_maincpu->set_addrmap(AS_PROGRAM, &pc1251_state::pc1255_mem);
+}
- MCFG_MACHINE_START_OVERRIDE(pc1251_state, pc1260 )
-MACHINE_CONFIG_END
+void pc1260_state::pc1260(machine_config &config)
+{
+ pc1250(config);
+ m_maincpu->set_addrmap(AS_PROGRAM, &pc1260_state::pc1260_mem);
+}
-MACHINE_CONFIG_START(pc1251_state::pc1261)
+void pc1260_state::pc1261(machine_config &config)
+{
pc1260(config);
- MCFG_DEVICE_MODIFY( "maincpu" )
- MCFG_DEVICE_PROGRAM_MAP( pc1261_mem)
-MACHINE_CONFIG_END
-
-MACHINE_CONFIG_START(pc1350_state::pc1350)
- pocketc(config);
- MCFG_DEVICE_ADD("maincpu", SC61860, 192000) /* 7.8336 MHz */
- MCFG_DEVICE_PROGRAM_MAP( pc1350_mem)
- MCFG_SC61860_READ_RESET_HANDLER(CONSTANT(0))
- MCFG_SC61860_READ_BRK_HANDLER(READLINE(*this, pc1350_state,pc1350_brk))
- MCFG_SC61860_READ_X_HANDLER(CONSTANT(0))
- MCFG_SC61860_READ_A_HANDLER(READ8(*this, pc1350_state,pc1350_ina))
- MCFG_SC61860_WRITE_A_HANDLER(WRITE8(*this, pc1350_state,pc1350_outa))
- MCFG_SC61860_READ_B_HANDLER(READ8(*this, pc1350_state,pc1350_inb))
- MCFG_SC61860_WRITE_B_HANDLER(WRITE8(*this, pc1350_state,pc1350_outb))
- MCFG_SC61860_WRITE_C_HANDLER(WRITE8(*this, pc1350_state,pc1350_outc))
-
- /*
- aim: show sharp with keyboard
- resolution depends on the dots of the lcd
- (lcd dot displayed as 2x2 pixel) */
+ m_maincpu->set_addrmap(AS_PROGRAM, &pc1260_state::pc1261_mem);
+}
+
+void pc1350_state::pc1350(machine_config &config)
+{
+ pocketc_base(config);
+ SC61860(config, m_maincpu, 192000); /* 7.8336 MHz */
+ m_maincpu->set_addrmap(AS_PROGRAM, &pc1350_state::pc1350_mem);
+ m_maincpu->reset_cb().set_constant(0);
+ m_maincpu->brk_cb().set(FUNC(pc1350_state::brk_r));
+ m_maincpu->x_cb().set_constant(0);
+ m_maincpu->in_a_cb().set(FUNC(pc1350_state::in_a_r));
+ m_maincpu->out_a_cb().set(FUNC(pc1350_state::out_a_w));
+ m_maincpu->in_b_cb().set(FUNC(pc1350_state::in_b_r));
+ m_maincpu->out_b_cb().set(FUNC(pc1350_state::out_b_w));
+ m_maincpu->out_c_cb().set(FUNC(pc1350_state::out_c_w));
+
/* video hardware */
- MCFG_SCREEN_MODIFY("screen")
- MCFG_SCREEN_SIZE(640, 252)
- MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 252-1)
- MCFG_SCREEN_UPDATE_DRIVER(pc1350_state, screen_update_pc1350)
+ m_screen->set_size(640, 252);
+ m_screen->set_visarea(0, 640-1, 0, 252-1);
+ m_screen->set_screen_update(FUNC(pc1350_state::screen_update));
/* internal ram */
- RAM(config, RAM_TAG).set_default_size("4K").set_extra_options("12K,20K");
-MACHINE_CONFIG_END
-
-MACHINE_CONFIG_START(pc1403_state::pc1403)
- pocketc(config);
- MCFG_DEVICE_ADD( "maincpu", SC61860, 256000 )
- MCFG_DEVICE_PROGRAM_MAP( pc1403_mem)
- MCFG_SC61860_READ_RESET_HANDLER(CONSTANT(0))
- MCFG_SC61860_READ_BRK_HANDLER(READLINE(*this, pc1403_state,pc1403_brk))
- MCFG_SC61860_READ_X_HANDLER(CONSTANT(0))
- MCFG_SC61860_READ_A_HANDLER(READ8(*this, pc1403_state,pc1403_ina))
- MCFG_SC61860_WRITE_A_HANDLER(WRITE8(*this, pc1403_state,pc1403_outa))
- MCFG_SC61860_READ_B_HANDLER(CONSTANT(0))
- MCFG_SC61860_WRITE_B_HANDLER(NOOP)
- MCFG_SC61860_WRITE_C_HANDLER(WRITE8(*this, pc1403_state,pc1403_outc))
-
- /*
- aim: show sharp with keyboard
- resolution depends on the dots of the lcd
- (lcd dot displayed as 2x2 pixel) */
+ RAM(config, m_ram).set_default_size("4K").set_extra_options("12K,20K");
+}
+
+void pc1403_state::pc1403(machine_config &config)
+{
+ pocketc_base(config);
+ SC61860(config, m_maincpu, 256000);
+ m_maincpu->set_addrmap(AS_PROGRAM, &pc1403_state::pc1403_mem);
+ m_maincpu->reset_cb().set_constant(0);
+ m_maincpu->brk_cb().set(FUNC(pc1403_state::brk_r));
+ m_maincpu->x_cb().set_constant(0);
+ m_maincpu->in_a_cb().set(FUNC(pc1403_state::in_a_r));
+ m_maincpu->out_a_cb().set(FUNC(pc1403_state::out_a_w));
+ m_maincpu->in_b_cb().set_constant(0);
+ m_maincpu->out_b_cb().set_nop();
+ m_maincpu->out_c_cb().set(FUNC(pc1403_state::out_c_w));
+
/* video hardware */
- MCFG_SCREEN_MODIFY("screen")
- MCFG_SCREEN_SIZE(848, 320)
- MCFG_SCREEN_VISIBLE_AREA(0, 848-1, 0, 320-1)
-// MCFG_SCREEN_SIZE(848, 361)
-// MCFG_SCREEN_VISIBLE_AREA(0, 848-1, 0, 361-1)
- MCFG_SCREEN_UPDATE_DRIVER(pc1403_state, screen_update_pc1403)
-MACHINE_CONFIG_END
-
-MACHINE_CONFIG_START(pc1403_state::pc1403h)
+ m_screen->set_size(848, 320);
+ m_screen->set_visarea(0, 848-1, 0, 320-1);
+ m_screen->set_screen_update(FUNC(pc1403_state::screen_update));
+}
+
+void pc1403_state::pc1403h(machine_config &config)
+{
pc1403(config);
- MCFG_DEVICE_MODIFY( "maincpu" )
- MCFG_DEVICE_PROGRAM_MAP( pc1403h_mem)
-MACHINE_CONFIG_END
+ m_maincpu->set_addrmap(AS_PROGRAM, &pc1403_state::pc1403h_mem);
+}
ROM_START(pc1401)
@@ -986,23 +959,23 @@ ROM_END
// YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS
// cpu sc61860
-COMP( 1982, pc1245, 0, 0, pc1250, pc1251, pc1251_state, init_pc1251, "Sharp", "Pocket Computer 1245", MACHINE_NOT_WORKING | MACHINE_NO_SOUND )
-COMP( 1982, pc1250, 0, 0, pc1250, pc1251, pc1251_state, init_pc1251, "Sharp", "Pocket Computer 1250", MACHINE_NO_SOUND)
-COMP( 1982, pc1251, pc1250, 0, pc1251, pc1251, pc1251_state, init_pc1251, "Sharp", "Pocket Computer 1251", MACHINE_NO_SOUND)
-COMP( 1982, pc1255, pc1250, 0, pc1255, pc1251, pc1251_state, init_pc1251, "Sharp", "Pocket Computer 1255", MACHINE_NO_SOUND)
-COMP( 1983, trs80pc3, pc1250, 0, pc1251, pc1251, pc1251_state, init_pc1251, "Tandy Radio Shack", "TRS-80 Pocket Computer PC-3", MACHINE_NO_SOUND)
+COMP( 1982, pc1245, 0, 0, pc1250, pc1251, pc1251_state, empty_init, "Sharp", "Pocket Computer 1245", MACHINE_NOT_WORKING | MACHINE_NO_SOUND )
+COMP( 1982, pc1250, 0, 0, pc1250, pc1251, pc1251_state, empty_init, "Sharp", "Pocket Computer 1250", MACHINE_NO_SOUND)
+COMP( 1982, pc1251, pc1250, 0, pc1251, pc1251, pc1251_state, empty_init, "Sharp", "Pocket Computer 1251", MACHINE_NO_SOUND)
+COMP( 1982, pc1255, pc1250, 0, pc1255, pc1251, pc1251_state, empty_init, "Sharp", "Pocket Computer 1255", MACHINE_NO_SOUND)
+COMP( 1983, trs80pc3, pc1250, 0, pc1251, pc1251, pc1251_state, empty_init, "Tandy Radio Shack", "TRS-80 Pocket Computer PC-3", MACHINE_NO_SOUND)
-COMP( 1982, pc1260, 0, 0, pc1260, pc1251, pc1251_state, init_pc1251, "Sharp", "Pocket Computer 1260", MACHINE_NOT_WORKING | MACHINE_NO_SOUND )
-COMP( 1982, pc1261, pc1260, 0, pc1261, pc1251, pc1251_state, init_pc1251, "Sharp", "Pocket Computer 1261/1262", MACHINE_NOT_WORKING | MACHINE_NO_SOUND)
+COMP( 1982, pc1260, 0, 0, pc1260, pc1251, pc1260_state, empty_init, "Sharp", "Pocket Computer 1260", MACHINE_NOT_WORKING | MACHINE_NO_SOUND )
+COMP( 1982, pc1261, pc1260, 0, pc1261, pc1251, pc1260_state, empty_init, "Sharp", "Pocket Computer 1261/1262", MACHINE_NOT_WORKING | MACHINE_NO_SOUND)
// pc1261/pc1262
-COMP( 1984, pc1350, 0, 0, pc1350, pc1350, pc1350_state, empty_init, "Sharp", "Pocket Computer 1350", MACHINE_NO_SOUND )
-COMP( 198?, pc1450, 0, 0, pc1350, pc1350, pc1350_state, empty_init, "Sharp", "Pocket Computer 1450", MACHINE_NOT_WORKING | MACHINE_NO_SOUND )
+COMP( 1984, pc1350, 0, 0, pc1350, pc1350, pc1350_state, empty_init, "Sharp", "Pocket Computer 1350", MACHINE_NO_SOUND )
+COMP( 198?, pc1450, 0, 0, pc1350, pc1350, pc1350_state, empty_init, "Sharp", "Pocket Computer 1450", MACHINE_NOT_WORKING | MACHINE_NO_SOUND )
-COMP( 1983, pc1401, 0, 0, pc1401, pc1401, pc1401_state, init_pc1401, "Sharp", "Pocket Computer 1401", MACHINE_NO_SOUND)
-COMP( 1984, pc1402, pc1401, 0, pc1402, pc1401, pc1401_state, init_pc1401, "Sharp", "Pocket Computer 1402", MACHINE_NO_SOUND)
-COMP( 198?, pc1360, pc1401, 0, pc1401, pc1401, pc1401_state, init_pc1401, "Sharp", "Pocket Computer 1360", MACHINE_NOT_WORKING | MACHINE_NO_SOUND )
+COMP( 1983, pc1401, 0, 0, pc1401, pc1401, pc1401_state, empty_init, "Sharp", "Pocket Computer 1401", MACHINE_NO_SOUND)
+COMP( 1984, pc1402, pc1401, 0, pc1402, pc1401, pc1401_state, empty_init, "Sharp", "Pocket Computer 1402", MACHINE_NO_SOUND)
+COMP( 198?, pc1360, pc1401, 0, pc1401, pc1401, pc1401_state, empty_init, "Sharp", "Pocket Computer 1360", MACHINE_NOT_WORKING | MACHINE_NO_SOUND )
// 72kb rom, 32kb ram, cpu? pc1360
-COMP( 1986, pc1403, 0, 0, pc1403, pc1403, pc1403_state, init_pc1403, "Sharp", "Pocket Computer 1403", MACHINE_NOT_WORKING | MACHINE_NO_SOUND)
-COMP( 198?, pc1403h, pc1403, 0, pc1403h, pc1403, pc1403_state, init_pc1403, "Sharp", "Pocket Computer 1403H", MACHINE_NOT_WORKING | MACHINE_NO_SOUND)
+COMP( 1986, pc1403, 0, 0, pc1403, pc1403, pc1403_state, empty_init, "Sharp", "Pocket Computer 1403", MACHINE_NOT_WORKING | MACHINE_NO_SOUND)
+COMP( 198?, pc1403h, pc1403, 0, pc1403h, pc1403, pc1403_state, empty_init, "Sharp", "Pocket Computer 1403H", MACHINE_NOT_WORKING | MACHINE_NO_SOUND)
diff --git a/src/mame/includes/pc1251.h b/src/mame/includes/pc1251.h
index 60fd39bd013..7d7bfb4e75c 100644
--- a/src/mame/includes/pc1251.h
+++ b/src/mame/includes/pc1251.h
@@ -12,68 +12,70 @@
#define MAME_INCLUDES_PC1251_H
#include "pocketc.h"
-#include "cpu/sc61860/sc61860.h"
-#include "machine/nvram.h"
-#include "emupal.h"
-
-#define PC1251_CONTRAST (ioport("DSW0")->read() & 0x07)
-
class pc1251_state : public pocketc_state
{
public:
- enum
- {
- TIMER_POWER_UP
- };
-
pc1251_state(const machine_config &mconfig, device_type type, const char *tag)
- : pocketc_state(mconfig, type, tag),
- m_maincpu(*this, "maincpu"),
- m_gfxdecode(*this, "gfxdecode"),
- m_palette(*this, "palette"),
- m_cpu_nvram(*this, "cpu_nvram"),
- m_ram_nvram(*this, "ram_nvram") { }
-
- uint8_t m_outa;
- uint8_t m_outb;
- int m_power;
- uint8_t m_reg[0x100];
+ : pocketc_state(mconfig, type, tag)
+ , m_keys(*this, "KEY%u", 0U)
+ , m_mode(*this, "MODE")
+ { }
void init_pc1251();
- uint32_t screen_update_pc1251(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
- DECLARE_WRITE8_MEMBER(pc1251_outa);
- DECLARE_WRITE8_MEMBER(pc1251_outb);
- DECLARE_WRITE8_MEMBER(pc1251_outc);
-
- DECLARE_READ_LINE_MEMBER(pc1251_reset);
- DECLARE_READ_LINE_MEMBER(pc1251_brk);
- DECLARE_READ8_MEMBER(pc1251_ina);
- DECLARE_READ8_MEMBER(pc1251_inb);
- DECLARE_READ8_MEMBER(pc1251_lcd_read);
- DECLARE_WRITE8_MEMBER(pc1251_lcd_write);
- virtual void machine_start() override;
- DECLARE_MACHINE_START(pc1260);
- required_device<sc61860_device> m_maincpu;
- required_device<gfxdecode_device> m_gfxdecode;
- required_device<palette_device> m_palette;
- void pc1261(machine_config &config);
- void pc1260(machine_config &config);
void pc1255(machine_config &config);
void pc1251(machine_config &config);
void pc1250(machine_config &config);
+
+protected:
+ virtual void machine_start() override;
+
+ uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
+
void pc1250_mem(address_map &map);
void pc1251_mem(address_map &map);
void pc1255_mem(address_map &map);
void pc1260_mem(address_map &map);
void pc1261_mem(address_map &map);
-protected:
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override;
+ DECLARE_WRITE8_MEMBER(out_b_w);
+ DECLARE_WRITE8_MEMBER(out_c_w);
+
+ DECLARE_READ_LINE_MEMBER(reset_r);
+ DECLARE_READ8_MEMBER(in_a_r);
+ DECLARE_READ8_MEMBER(in_b_r);
+ DECLARE_READ8_MEMBER(lcd_read);
+ DECLARE_WRITE8_MEMBER(lcd_write);
- required_device<nvram_device> m_cpu_nvram;
- required_device<nvram_device> m_ram_nvram;
+private:
+ required_ioport_array<10> m_keys;
+ required_ioport m_mode;
+
+ uint8_t m_reg[0x100];
+
+ static const char *const s_def[5];
+ static const char *const s_shift[5];
+ static const char *const s_de[5];
+ static const char *const s_g[5];
+ static const char *const s_rad[5];
+ static const char *const s_run[5];
+ static const char *const s_pro[5];
+ static const char *const s_rsv[5];
+};
+
+class pc1260_state : public pc1251_state
+{
+public:
+ pc1260_state(const machine_config &mconfig, device_type type, const char *tag)
+ : pc1251_state(mconfig, type, tag)
+ { }
+
+ void pc1260(machine_config &config);
+ void pc1261(machine_config &config);
+
+protected:
+ virtual void machine_start() override;
};
#endif // MAME_INCLUDES_PC1251_H
diff --git a/src/mame/includes/pc1350.h b/src/mame/includes/pc1350.h
index be52db0f3dd..5c206b9bb7f 100644
--- a/src/mame/includes/pc1350.h
+++ b/src/mame/includes/pc1350.h
@@ -12,51 +12,47 @@
#define MAME_INCLUDES_PC1350_H
#include "pocketc.h"
-#include "cpu/sc61860/sc61860.h"
-#include "machine/nvram.h"
#include "machine/ram.h"
-#define PC1350_CONTRAST (ioport("DSW0")->read() & 0x07)
-
-
class pc1350_state : public pocketc_state
{
public:
- enum
- {
- TIMER_POWER_UP
- };
-
pc1350_state(const machine_config &mconfig, device_type type, const char *tag)
- : pocketc_state(mconfig, type, tag),
- m_maincpu(*this, "maincpu"),
- m_ram(*this, RAM_TAG) { }
+ : pocketc_state(mconfig, type, tag)
+ , m_ram(*this, RAM_TAG)
+ , m_keys(*this, "KEY%u", 0U)
+ { }
- uint8_t m_outa;
- uint8_t m_outb;
- int m_power;
- uint8_t m_reg[0x1000];
- uint32_t screen_update_pc1350(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
+ void pc1350(machine_config &config);
- DECLARE_WRITE8_MEMBER(pc1350_outa);
- DECLARE_WRITE8_MEMBER(pc1350_outb);
- DECLARE_WRITE8_MEMBER(pc1350_outc);
+protected:
+ virtual void machine_start() override;
- DECLARE_READ_LINE_MEMBER(pc1350_brk);
- DECLARE_READ8_MEMBER(pc1350_ina);
- DECLARE_READ8_MEMBER(pc1350_inb);
- DECLARE_READ8_MEMBER(pc1350_lcd_read);
- DECLARE_WRITE8_MEMBER(pc1350_lcd_write);
- DECLARE_READ8_MEMBER(pc1350_keyboard_line_r);
+ uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
- virtual void machine_start() override;
- required_device<sc61860_device> m_maincpu;
+ void pc1350_mem(address_map &map);
+
+ DECLARE_WRITE8_MEMBER(out_b_w);
+ DECLARE_WRITE8_MEMBER(out_c_w);
+
+ DECLARE_READ8_MEMBER(in_a_r);
+ DECLARE_READ8_MEMBER(in_b_r);
+ DECLARE_READ8_MEMBER(lcd_read);
+ DECLARE_WRITE8_MEMBER(lcd_write);
+ DECLARE_READ8_MEMBER(keyboard_line_r);
+
+private:
required_device<ram_device> m_ram;
+ required_ioport_array<12> m_keys;
- void pc1350(machine_config &config);
- void pc1350_mem(address_map &map);
-protected:
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override;
+ uint8_t m_reg[0x1000];
+
+ static const char* const s_def[5];
+ static const char* const s_shift[5];
+ static const char* const s_run[5];
+ static const char* const s_pro[5];
+ static const char* const s_japan[5];
+ static const char* const s_sml[5];
};
#endif // MAME_INCLUDES_PC1350_H
diff --git a/src/mame/includes/pc1401.h b/src/mame/includes/pc1401.h
index 11f66eb34b2..56fba456224 100644
--- a/src/mame/includes/pc1401.h
+++ b/src/mame/includes/pc1401.h
@@ -12,54 +12,53 @@
#define MAME_INCLUDES_PC1401_H
#include "pocketc.h"
-#include "cpu/sc61860/sc61860.h"
-#include "machine/nvram.h"
-#include "emupal.h"
-
-#define CONTRAST (ioport("DSW0")->read() & 0x07)
-
class pc1401_state : public pocketc_state
{
public:
- enum
- {
- TIMER_POWER_UP
- };
-
pc1401_state(const machine_config &mconfig, device_type type, const char *tag)
- : pocketc_state(mconfig, type, tag),
- m_maincpu(*this, "maincpu"),
- m_gfxdecode(*this, "gfxdecode"),
- m_palette(*this, "palette") { }
+ : pocketc_state(mconfig, type, tag)
+ , m_keys(*this, "KEY%u", 0U)
+ { }
- uint8_t m_portc;
- uint8_t m_outa;
- uint8_t m_outb;
- int m_power;
- uint8_t m_reg[0x100];
void init_pc1401();
- uint32_t screen_update_pc1401(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
- DECLARE_READ_LINE_MEMBER(pc1401_reset);
- DECLARE_READ_LINE_MEMBER(pc1401_brk);
- DECLARE_WRITE8_MEMBER(pc1401_outa);
- DECLARE_WRITE8_MEMBER(pc1401_outb);
- DECLARE_WRITE8_MEMBER(pc1401_outc);
- DECLARE_READ8_MEMBER(pc1401_ina);
- DECLARE_READ8_MEMBER(pc1401_inb);
- DECLARE_READ8_MEMBER(pc1401_lcd_read);
- DECLARE_WRITE8_MEMBER(pc1401_lcd_write);
- virtual void machine_start() override;
- required_device<sc61860_device> m_maincpu;
- required_device<gfxdecode_device> m_gfxdecode;
- required_device<palette_device> m_palette;
void pc1401(machine_config &config);
void pc1402(machine_config &config);
+
+protected:
+ virtual void machine_start() override;
+
+ uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
+
void pc1401_mem(address_map &map);
void pc1402_mem(address_map &map);
-protected:
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override;
+
+ DECLARE_READ_LINE_MEMBER(reset_r);
+ DECLARE_WRITE8_MEMBER(out_b_w);
+ DECLARE_WRITE8_MEMBER(out_c_w);
+ DECLARE_READ8_MEMBER(in_a_r);
+ DECLARE_READ8_MEMBER(in_b_r);
+ DECLARE_READ8_MEMBER(lcd_read);
+ DECLARE_WRITE8_MEMBER(lcd_write);
+
+private:
+ required_ioport_array<13> m_keys;
+
+ uint8_t m_portc;
+ uint8_t m_reg[0x100];
+
+ static const char* const s_line[5];
+ static const char* const s_busy[5];
+ static const char* const s_def[5];
+ static const char* const s_shift[5];
+ static const char* const s_hyp[5];
+ static const char* const s_de[5];
+ static const char* const s_g[5];
+ static const char* const s_rad[5];
+ static const char* const s_braces[5];
+ static const char* const s_m[5];
+ static const char* const s_e[5];
};
#endif // MAME_INCLUDES_PC1401_H
diff --git a/src/mame/includes/pc1403.h b/src/mame/includes/pc1403.h
index 8223728d380..0b6d1641150 100644
--- a/src/mame/includes/pc1403.h
+++ b/src/mame/includes/pc1403.h
@@ -12,61 +12,73 @@
#define MAME_INCLUDES_PC1403_H
#include "pocketc.h"
-#include "cpu/sc61860/sc61860.h"
-#include "machine/nvram.h"
-#include "emupal.h"
-
-#define CONTRAST (ioport("DSW0")->read() & 0x07)
-
class pc1403_state : public pocketc_state
{
public:
- enum
- {
- TIMER_POWER_UP
- };
-
pc1403_state(const machine_config &mconfig, device_type type, const char *tag)
- : pocketc_state(mconfig, type, tag),
- m_maincpu(*this, "maincpu"),
- m_gfxdecode(*this, "gfxdecode"),
- m_palette(*this, "palette") { }
+ : pocketc_state(mconfig, type, tag)
+ , m_keys(*this, "KEY%u", 0U)
+ { }
- uint8_t m_portc;
- uint8_t m_outa;
- int m_power;
- uint8_t m_asic[4];
- int m_DOWN;
- int m_RIGHT;
- uint8_t m_reg[0x100];
+ void pc1403(machine_config &config);
+ void pc1403h(machine_config &config);
- void init_pc1403();
- uint32_t screen_update_pc1403(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
- DECLARE_READ_LINE_MEMBER(pc1403_reset);
- DECLARE_READ_LINE_MEMBER(pc1403_brk);
- DECLARE_WRITE8_MEMBER(pc1403_outa);
- DECLARE_WRITE8_MEMBER(pc1403_outc);
- DECLARE_READ8_MEMBER(pc1403_ina);
-
- DECLARE_READ8_MEMBER(pc1403_asic_read);
- DECLARE_WRITE8_MEMBER(pc1403_asic_write);
- DECLARE_READ8_MEMBER(pc1403_lcd_read);
- DECLARE_WRITE8_MEMBER(pc1403_lcd_write);
- virtual void video_start() override;
+protected:
virtual void machine_start() override;
- required_device<sc61860_device> m_maincpu;
- required_device<gfxdecode_device> m_gfxdecode;
- required_device<palette_device> m_palette;
+ virtual void video_start() override;
+
+ uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
- void pc1403h(machine_config &config);
- void pc1403(machine_config &config);
void pc1403_mem(address_map &map);
void pc1403h_mem(address_map &map);
void pc1421_readmem(address_map &map);
void pc1421_writemem(address_map &map);
+
+ DECLARE_READ_LINE_MEMBER(reset_r);
+ DECLARE_WRITE8_MEMBER(out_c_w);
+ DECLARE_READ8_MEMBER(in_a_r);
+
+ DECLARE_READ8_MEMBER(asic_read);
+ DECLARE_WRITE8_MEMBER(asic_write);
+ DECLARE_READ8_MEMBER(lcd_read);
+ DECLARE_WRITE8_MEMBER(lcd_write);
+
+ int m_down;
+ int m_right;
+
+private:
+ required_ioport_array<14> m_keys;
+
+ uint8_t m_portc;
+ uint8_t m_asic[4];
+ uint8_t m_reg[0x100];
+
+ static const char* const s_line[5];
+ static const char* const s_busy[5];
+ static const char* const s_def[5];
+ static const char* const s_shift[5];
+ static const char* const s_hyp[5];
+ static const char* const s_de[5];
+ static const char* const s_g[5];
+ static const char* const s_rad[5];
+ static const char* const s_braces[5];
+ static const char* const s_m[5];
+ static const char* const s_e[5];
+ static const char* const s_kana[5];
+ static const char* const s_shoo[5];
+ static const char* const s_sml[5];
+};
+
+class pc1403h_state : public pc1403_state
+{
+public:
+ pc1403h_state(const machine_config &mconfig, device_type type, const char *tag)
+ : pc1403_state(mconfig, type, tag)
+ { }
+
protected:
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override;
+ virtual void video_start() override;
};
#endif // MAME_INCLUDES_PC1403_H
diff --git a/src/mame/includes/pocketc.h b/src/mame/includes/pocketc.h
index 51e6865b246..6b21c0b07b1 100644
--- a/src/mame/includes/pocketc.h
+++ b/src/mame/includes/pocketc.h
@@ -9,26 +9,59 @@
#ifndef MAME_INCLUDES_POCKETC_H
#define MAME_INCLUDES_POCKETC_H
+#include "cpu/sc61860/sc61860.h"
+#include "machine/nvram.h"
#include "emupal.h"
-
-typedef const char *POCKETC_FIGURE[];
+#include "screen.h"
class pocketc_state : public driver_device
{
public:
pocketc_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag) { }
+ : driver_device(mconfig, type, tag)
+ , m_maincpu(*this, "maincpu")
+ , m_gfxdecode(*this, "gfxdecode")
+ , m_palette(*this, "palette")
+ , m_screen(*this, "screen")
+ , m_cpu_nvram(*this, "cpu_nvram")
+ , m_ram_nvram(*this, "ram_nvram")
+ , m_dsw0(*this, "DSW0")
+ , m_extra(*this, "EXTRA")
+ , m_power_timer(nullptr)
+ { }
- void pocketc(machine_config &config);
+ void pocketc_base(machine_config &config);
protected:
- void pocketc_draw_special(bitmap_ind16 &bitmap,int x, int y, const POCKETC_FIGURE fig, int color);
-
- static const unsigned short pocketc_colortable[8][2];
+ virtual void machine_start() override;
+ virtual void machine_reset() override;
+ virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override;
-private:
DECLARE_PALETTE_INIT(pocketc);
+ void pocketc_draw_special(bitmap_ind16 &bitmap,int x, int y, const char* const *fig, int color);
+
+ static const device_timer_id TIMER_POWER_UP = 0;
+
+ DECLARE_WRITE8_MEMBER(out_a_w);
+ DECLARE_READ_LINE_MEMBER(brk_r);
+
+ required_device<sc61860_device> m_maincpu;
+ required_device<gfxdecode_device> m_gfxdecode;
+ required_device<palette_device> m_palette;
+ required_device<screen_device> m_screen;
+ required_device<nvram_device> m_cpu_nvram;
+ required_device<nvram_device> m_ram_nvram;
+ required_ioport m_dsw0;
+ required_ioport m_extra;
+
+ uint8_t m_outa;
+ uint8_t m_outb;
+ int m_power;
+ emu_timer *m_power_timer;
+
+ static const int colortable[8][2];
+ static const rgb_t indirect_palette[6];
};
#endif // MAME_INCLUDES_POCKETC_H
diff --git a/src/mame/machine/pc1251.cpp b/src/mame/machine/pc1251.cpp
index 852db32b352..7abc31af973 100644
--- a/src/mame/machine/pc1251.cpp
+++ b/src/mame/machine/pc1251.cpp
@@ -8,121 +8,72 @@
/* C-CE while reset, program will not be destroyed! */
-
-
-WRITE8_MEMBER(pc1251_state::pc1251_outa)
-{
- m_outa = data;
-}
-
-WRITE8_MEMBER(pc1251_state::pc1251_outb)
+WRITE8_MEMBER(pc1251_state::out_b_w)
{
m_outb = data;
}
-WRITE8_MEMBER(pc1251_state::pc1251_outc)
+WRITE8_MEMBER(pc1251_state::out_c_w)
{
}
-READ8_MEMBER(pc1251_state::pc1251_ina)
+READ8_MEMBER(pc1251_state::in_a_r)
{
int data = m_outa;
- if (m_outb & 0x01)
+ if (BIT(m_outb, 0))
{
- data |= ioport("KEY0")->read();
+ data |= m_keys[0]->read();
/* At Power Up we fake a 'CL' pressure */
if (m_power)
data |= 0x02; // problem with the deg lcd
}
- if (m_outb & 0x02)
- data |= ioport("KEY1")->read();
-
- if (m_outb & 0x04)
- data |= ioport("KEY2")->read();
-
- if (m_outa & 0x01)
- data |= ioport("KEY3")->read();
+ for (int bit = 0, key = 1; bit < 3; bit++, key++)
+ if (BIT(m_outb, bit))
+ data |= m_keys[key]->read();
- if (m_outa & 0x02)
- data |= ioport("KEY4")->read();
-
- if (m_outa & 0x04)
- data |= ioport("KEY5")->read();
-
- if (m_outa & 0x08)
- data |= ioport("KEY6")->read();
-
- if (m_outa & 0x10)
- data |= ioport("KEY7")->read();
-
- if (m_outa & 0x20)
- data |= ioport("KEY8")->read();
-
- if (m_outa & 0x40)
- data |= ioport("KEY9")->read();
+ for (int bit = 0, key = 3; bit < 7; bit++, key++)
+ if (BIT(m_outa, bit))
+ data |= m_keys[key]->read();
return data;
}
-READ8_MEMBER(pc1251_state::pc1251_inb)
+READ8_MEMBER(pc1251_state::in_b_r)
{
int data = m_outb;
- if (m_outb & 0x08)
- data |= (ioport("MODE")->read() & 0x07);
+ if (BIT(m_outb, 3))
+ data |= m_mode->read() & 0x07;
return data;
}
-READ_LINE_MEMBER(pc1251_state::pc1251_brk)
+READ_LINE_MEMBER(pc1251_state::reset_r)
{
- return (ioport("EXTRA")->read() & 0x01);
-}
-
-READ_LINE_MEMBER(pc1251_state::pc1251_reset)
-{
- return (ioport("EXTRA")->read() & 0x02);
+ return BIT(m_extra->read(), 1);
}
void pc1251_state::machine_start()
{
- uint8_t *ram = memregion("maincpu")->base() + 0x8000;
- uint8_t *cpu = m_maincpu->internal_ram();
-
- m_cpu_nvram->set_base(cpu, 96);
- m_ram_nvram->set_base(ram, 0x4800);
-}
+ pocketc_state::machine_start();
-MACHINE_START_MEMBER(pc1251_state,pc1260 )
-{
- uint8_t *ram = memregion("maincpu")->base() + 0x4000;
- uint8_t *cpu = m_maincpu->internal_ram();
+ m_ram_nvram->set_base(memregion("maincpu")->base() + 0x8000, 0x4800);
- m_cpu_nvram->set_base(cpu, 96);
- m_ram_nvram->set_base(ram, 0x2800);
+ uint8_t *gfx = memregion("gfx1")->base();
+ for (int i = 0; i < 128; i++)
+ gfx[i] = i;
}
-void pc1251_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
+void pc1260_state::machine_start()
{
- switch (id)
- {
- case TIMER_POWER_UP:
- m_power = 0;
- break;
- default:
- assert_always(false, "Unknown id in pc1251_state::device_timer");
- }
-}
+ pocketc_state::machine_start();
+
+ m_ram_nvram->set_base(memregion("maincpu")->base() + 0x4000, 0x2800);
-void pc1251_state::init_pc1251()
-{
uint8_t *gfx = memregion("gfx1")->base();
for (int i = 0; i < 128; i++)
gfx[i] = i;
-
- m_power = 1;
- timer_set(attotime::from_seconds(1), TIMER_POWER_UP);
}
diff --git a/src/mame/machine/pc1350.cpp b/src/mame/machine/pc1350.cpp
index e7fa3699aff..b5f0d881877 100644
--- a/src/mame/machine/pc1350.cpp
+++ b/src/mame/machine/pc1350.cpp
@@ -7,102 +7,59 @@
#include "includes/pc1350.h"
#include "machine/ram.h"
-
-
-WRITE8_MEMBER(pc1350_state::pc1350_outa)
-{
- m_outa=data;
-}
-
-WRITE8_MEMBER(pc1350_state::pc1350_outb)
+WRITE8_MEMBER(pc1350_state::out_b_w)
{
- m_outb=data;
+ m_outb = data;
}
-WRITE8_MEMBER(pc1350_state::pc1350_outc)
+WRITE8_MEMBER(pc1350_state::out_c_w)
{
}
-READ8_MEMBER(pc1350_state::pc1350_ina)
+READ8_MEMBER(pc1350_state::in_a_r)
{
int data = m_outa;
- int t = pc1350_keyboard_line_r(space,0);
-
- if (t & 0x01)
- data |= ioport("KEY0")->read();
+ int t = keyboard_line_r(space, 0);
- if (t & 0x02)
- data |= ioport("KEY1")->read();
+ for (int bit = 0; bit < 6; bit++)
+ if (BIT(t, bit))
+ data |= m_keys[bit]->read();
- if (t & 0x04)
- data |= ioport("KEY2")->read();
+ for (int bit = 0, key = 6; bit < 2; bit++, key++)
+ if (BIT(m_outa, bit))
+ data |= m_keys[key]->read();
- if (t & 0x08)
- data |= ioport("KEY3")->read();
-
- if (t & 0x10)
- data |= ioport("KEY4")->read();
-
- if (t & 0x20)
- data |= ioport("KEY5")->read();
-
- if (m_outa & 0x01)
- data |= ioport("KEY6")->read();
-
- if (m_outa & 0x02)
- data |= ioport("KEY7")->read();
-
- if (m_outa & 0x04)
+ if (BIT(m_outa, 2))
{
- data |= ioport("KEY8")->read();
+ data |= m_keys[8]->read();
/* At Power Up we fake a 'CLS' pressure */
if (m_power)
data |= 0x08;
}
- if (m_outa & 0x08)
- data |= ioport("KEY9")->read();
-
- if (m_outa & 0x10)
- data |= ioport("KEY10")->read();
+ for (int bit = 3, key = 9; bit < 5; bit++, key++)
+ if (BIT(m_outa, bit))
+ data |= m_keys[key]->read();
if (m_outa & 0xc0)
- data |= ioport("KEY11")->read();
+ data |= m_keys[11]->read();
// missing lshift
return data;
}
-READ8_MEMBER(pc1350_state::pc1350_inb)
+READ8_MEMBER(pc1350_state::in_b_r)
{
return m_outb;
}
-READ_LINE_MEMBER(pc1350_state::pc1350_brk)
-{
- return (ioport("EXTRA")->read() & 0x01);
-}
-
-void pc1350_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
-{
- switch (id)
- {
- case TIMER_POWER_UP:
- m_power=0;
- break;
- default:
- assert_always(false, "Unknown id in pc1350_state::device_timer");
- }
-}
-
void pc1350_state::machine_start()
{
- address_space &space = m_maincpu->space(AS_PROGRAM);
+ pocketc_state::machine_start();
- m_power = 1;
- timer_set(attotime::from_seconds(1), TIMER_POWER_UP);
+ address_space &space = m_maincpu->space(AS_PROGRAM);
space.install_readwrite_bank(0x6000, 0x6fff, "bank1");
membank("bank1")->set_base(&m_ram->pointer()[0x0000]);
@@ -127,9 +84,5 @@ void pc1350_state::machine_start()
space.nop_readwrite(0x2000, 0x3fff);
}
- uint8_t *ram = memregion("maincpu")->base() + 0x2000;
- uint8_t *cpu = m_maincpu->internal_ram();
-
- subdevice<nvram_device>("cpu_nvram")->set_base(cpu, 96);
- subdevice<nvram_device>("ram_nvram")->set_base(ram, 0x5000);
+ m_ram_nvram->set_base(memregion("maincpu")->base() + 0x2000, 0x5000);
}
diff --git a/src/mame/machine/pc1401.cpp b/src/mame/machine/pc1401.cpp
index d5a7b6fcaea..e29bc1e1ce3 100644
--- a/src/mame/machine/pc1401.cpp
+++ b/src/mame/machine/pc1401.cpp
@@ -21,222 +21,62 @@
8 i/o device error
9 other errors*/
-
-
-WRITE8_MEMBER(pc1401_state::pc1401_outa)
-{
- m_outa = data;
-}
-
-WRITE8_MEMBER(pc1401_state::pc1401_outb)
+WRITE8_MEMBER(pc1401_state::out_b_w)
{
m_outb = data;
}
-WRITE8_MEMBER(pc1401_state::pc1401_outc)
+WRITE8_MEMBER(pc1401_state::out_c_w)
{
- //logerror("%g outc %.2x\n", machine.time().as_double(), data);
m_portc = data;
}
-READ8_MEMBER(pc1401_state::pc1401_ina)
+READ8_MEMBER(pc1401_state::in_a_r)
{
int data = m_outa;
- if (m_outb & 0x01)
- data |= ioport("KEY0")->read();
-
- if (m_outb & 0x02)
- data |= ioport("KEY1")->read();
-
- if (m_outb & 0x04)
- data |= ioport("KEY2")->read();
-
- if (m_outb & 0x08)
- data |= ioport("KEY3")->read();
-
- if (m_outb & 0x10)
- data |= ioport("KEY4")->read();
+ for (int bit = 0; bit < 5; bit++)
+ if (BIT(m_outb, 0))
+ data |= m_keys[bit]->read();
if (m_outb & 0x20)
{
- data |= ioport("KEY5")->read();
+ data |= m_keys[5]->read();
/* At Power Up we fake a 'C-CE' pressure */
if (m_power)
data |= 0x01;
}
- if (m_outa & 0x01)
- data |= ioport("KEY6")->read();
-
- if (m_outa & 0x02)
- data |= ioport("KEY7")->read();
-
- if (m_outa & 0x04)
- data |= ioport("KEY8")->read();
-
- if (m_outa & 0x08)
- data |= ioport("KEY9")->read();
-
- if (m_outa & 0x10)
- data |= ioport("KEY10")->read();
-
- if (m_outa & 0x20)
- data |= ioport("KEY11")->read();
-
- if (m_outa & 0x40)
- data |= ioport("KEY12")->read();
+ for (int bit = 0, key = 6; bit < 7; bit++, key++)
+ if (BIT(m_outa, bit))
+ data |= m_keys[key]->read();
return data;
}
-READ8_MEMBER(pc1401_state::pc1401_inb)
+READ8_MEMBER(pc1401_state::in_b_r)
{
- int data=m_outb;
+ int data = m_outb;
- if (ioport("EXTRA")->read() & 0x04)
+ if (BIT(m_extra->read(), 2))
data |= 0x01;
return data;
}
-READ_LINE_MEMBER(pc1401_state::pc1401_brk)
+READ_LINE_MEMBER(pc1401_state::reset_r)
{
- return (ioport("EXTRA")->read() & 0x01);
-}
-
-READ_LINE_MEMBER(pc1401_state::pc1401_reset)
-{
- return (ioport("EXTRA")->read() & 0x02);
+ return (m_extra->read() & 0x02);
}
void pc1401_state::machine_start()
{
- uint8_t *ram = memregion("maincpu")->base() + 0x2000;
- uint8_t *cpu = m_maincpu->internal_ram();
+ pocketc_state::machine_start();
- subdevice<nvram_device>("cpu_nvram")->set_base(cpu, 96);
- subdevice<nvram_device>("ram_nvram")->set_base(ram, 0x2800);
-}
+ m_ram_nvram->set_base(memregion("maincpu")->base() + 0x2000, 0x2800);
-void pc1401_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
-{
- switch (id)
- {
- case TIMER_POWER_UP:
- m_power = 0;
- break;
- default:
- assert_always(false, "Unknown id in pc1401_state::device_timer");
- }
-}
-
-void pc1401_state::init_pc1401()
-{
- int i;
- uint8_t *gfx=memregion("gfx1")->base();
-#if 0
- static const char sucker[]={
- /* this routine dump the memory (start 0)
- in an endless loop,
- the pc side must be started before this
- its here to allow verification of the decimal data
- in mame disassembler
- */
-#if 1
- 18,4,/*lip xl */
- 2,0,/*lia 0 startaddress low */
- 219,/*exam */
- 18,5,/*lip xh */
- 2,0,/*lia 0 startaddress high */
- 219,/*exam */
-/*400f x: */
- /* dump internal rom */
- 18,5,/*lip 4 */
- 89,/*ldm */
- 218,/*exab */
- 18,4,/*lip 5 */
- 89,/*ldm */
- 4,/*ix for increasing x */
- 0,0,/*lii,0 */
- 18,20,/*lip 20 */
- 53, /* */
- 18,20,/* lip 20 */
- 219,/*exam */
-#else
- 18,4,/*lip xl */
- 2,255,/*lia 0 */
- 219,/*exam */
- 18,5,/*lip xh */
- 2,255,/*lia 0 */
- 219,/*exam */
-/*400f x: */
- /* dump external memory */
- 4, /*ix */
- 87,/* ldd */
-#endif
- 218,/*exab */
-
-
-
- 0,4,/*lii 4 */
-
- /*a: */
- 218,/* exab */
- 90,/* sl */
- 218,/* exab */
- 18,94,/* lip 94 */
- 96,252,/* anma 252 */
- 2,2, /*lia 2 */
- 196,/* adcm */
- 95,/* outf */
- /*b: */
- 204,/*inb */
- 102,128,/*tsia 0x80 */
-#if 0
- 41,4,/* jnzm b */
-#else
- /* input not working reliable! */
- /* so handshake removed, PC side must run with disabled */
- /* interrupt to not lose data */
- 78,20, /*wait 20 */
-#endif
-
- 218,/* exab */
- 90,/* sl */
- 218,/* exab */
- 18,94,/* lip 94 */
- 96,252,/*anma 252 */
- 2,0,/* lia 0 */
- 196,/*adcm */
- 95,/* outf */
- /*c: */
- 204,/*inb */
- 102,128,/*tsia 0x80 */
-#if 0
- 57,4,/* jzm c */
-#else
- 78,20, /*wait 20 */
-#endif
-
- 65,/*deci */
- 41,34,/*jnzm a */
-
- 41,41,/*jnzm x: */
-
- 55,/* rtn */
- };
-
- int i = 0;
- for (; i < sizeof(sucker); i++)
- pc1401_mem[0x4000 + i] = sucker[i];
- logerror("%d %d\n", i, 0x4000 + i);
-#endif
-
- for (i = 0; i < 128; i++)
+ uint8_t *gfx = memregion("gfx1")->base();
+ for (int i = 0; i < 128; i++)
gfx[i] = i;
-
- m_power = 1;
- timer_set(attotime::from_seconds(1), TIMER_POWER_UP);
}
diff --git a/src/mame/machine/pc1403.cpp b/src/mame/machine/pc1403.cpp
index e0e84a515b3..36cb2b0eaaa 100644
--- a/src/mame/machine/pc1403.cpp
+++ b/src/mame/machine/pc1403.cpp
@@ -7,10 +7,12 @@
#include "includes/pc1403.h"
#include "machine/ram.h"
-/* C-CE while reset, program will not be destroyed! */
-
+#define LOG_ASIC (1 << 0)
+#define VERBSOE (0)
+#include "logmacro.h"
+/* C-CE while reset, program will not be destroyed! */
/*
port 2:
@@ -19,155 +21,84 @@
bits 0..6 keyboard output select matrix line
*/
-WRITE8_MEMBER(pc1403_state::pc1403_asic_write)
+WRITE8_MEMBER(pc1403_state::asic_write)
{
- m_asic[offset>>9]=data;
- switch( (offset>>9) ){
- case 0/*0x3800*/:
- // output
- logerror ("asic write %.4x %.2x\n",offset, data);
- break;
- case 1/*0x3a00*/:
- logerror ("asic write %.4x %.2x\n",offset, data);
- break;
- case 2/*0x3c00*/:
- membank("bank1")->set_base(memregion("user1")->base()+((data&7)<<14));
- logerror ("asic write %.4x %.2x\n",offset, data);
- break;
- case 3/*0x3e00*/: break;
+ m_asic[offset >> 9] = data;
+ switch (offset >> 9)
+ {
+ case 0: // 0x3800
+ // output
+ LOGMASKED(LOG_ASIC, "asic write %.4x %.2x\n", offset, data);
+ break;
+ case 1: // 0x3a00
+ LOGMASKED(LOG_ASIC, "asic write %.4x %.2x\n", offset, data);
+ break;
+ case 2: // 0x3c00
+ membank("bank1")->set_base(memregion("user1")->base() + ((data & 7) << 14));
+ LOGMASKED(LOG_ASIC, "asic write %.4x %.2x\n", offset, data);
+ break;
+ case 3: // 0x3e00
+ break;
}
}
-READ8_MEMBER(pc1403_state::pc1403_asic_read)
+READ8_MEMBER(pc1403_state::asic_read)
{
- uint8_t data=m_asic[offset>>9];
- switch( (offset>>9) ){
- case 0: case 1: case 2:
- logerror ("asic read %.4x %.2x\n",offset, data);
- break;
+ uint8_t data = m_asic[offset >> 9];
+ switch (offset >> 9)
+ {
+ case 0:
+ case 1:
+ case 2:
+ LOGMASKED(LOG_ASIC, "asic read %.4x %.2x\n", offset, data);
+ break;
}
return data;
}
-WRITE8_MEMBER(pc1403_state::pc1403_outa)
+READ8_MEMBER(pc1403_state::in_a_r)
{
- m_outa=data;
-}
+ uint8_t data = m_outa;
-READ8_MEMBER(pc1403_state::pc1403_ina)
-{
- uint8_t data=m_outa;
+ for (int bit = 0; bit < 7; bit++)
+ if (BIT(m_asic[3], bit))
+ data |= m_keys[bit]->read();
- if (m_asic[3] & 0x01)
- data |= ioport("KEY0")->read();
-
- if (m_asic[3] & 0x02)
- data |= ioport("KEY1")->read();
-
- if (m_asic[3] & 0x04)
- data |= ioport("KEY2")->read();
-
- if (m_asic[3] & 0x08)
- data |= ioport("KEY3")->read();
-
- if (m_asic[3] & 0x10)
- data |= ioport("KEY4")->read();
-
- if (m_asic[3] & 0x20)
- data |= ioport("KEY5")->read();
-
- if (m_asic[3] & 0x40)
- data |= ioport("KEY6")->read();
-
- if (m_outa & 0x01)
+ if (BIT(m_outa, 0))
{
- data |= ioport("KEY7")->read();
+ data |= m_keys[7]->read();
/* At Power Up we fake a 'C-CE' pressure */
if (m_power)
data |= 0x02;
}
- if (m_outa & 0x02)
- data |= ioport("KEY8")->read();
-
- if (m_outa & 0x04)
- data |= ioport("KEY9")->read();
-
- if (m_outa & 0x08)
- data |= ioport("KEY10")->read();
-
- if (m_outa & 0x10)
- data |= ioport("KEY11")->read();
-
- if (m_outa & 0x20)
- data |= ioport("KEY12")->read();
-
- if (m_outa & 0x40)
- data |= ioport("KEY13")->read();
-
- return data;
-}
-
-#if 0
-READ8_MEMBER(pc1403_state::pc1403_inb)
-{
- int data = m_outb;
-
- if (ioport("KEY13")->read())
- data |= 1;
+ for (int bit = 1, key = 8; bit < 7; bit++, key++)
+ if (BIT(m_outa, bit))
+ data |= m_keys[key]->read();
return data;
}
-#endif
-WRITE8_MEMBER(pc1403_state::pc1403_outc)
+WRITE8_MEMBER(pc1403_state::out_c_w)
{
m_portc = data;
-// logerror("%s %g pc %.4x outc %.2x\n", machine().describe_context(), machine().time().as_double(), data);
-}
-
-
-READ_LINE_MEMBER(pc1403_state::pc1403_brk)
-{
- return (ioport("EXTRA")->read() & 0x01);
}
-READ_LINE_MEMBER(pc1403_state::pc1403_reset)
+READ_LINE_MEMBER(pc1403_state::reset_r)
{
- return (ioport("EXTRA")->read() & 0x02);
+ return BIT(m_extra->read(), 1);
}
void pc1403_state::machine_start()
{
- uint8_t *ram = memregion("maincpu")->base() + 0x8000;
- uint8_t *cpu = m_maincpu->internal_ram();
+ pocketc_state::machine_start();
- subdevice<nvram_device>("cpu_nvram")->set_base(cpu, 96);
- subdevice<nvram_device>("ram_nvram")->set_base(ram, 0x8000);
-}
-
-void pc1403_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
-{
- switch (id)
- {
- case TIMER_POWER_UP:
- m_power=0;
- break;
- default:
- assert_always(false, "Unknown id in pc1403_state::device_timer");
- }
-}
-
-void pc1403_state::init_pc1403()
-{
- int i;
- uint8_t *gfx=memregion("gfx1")->base();
-
- for (i=0; i<128; i++) gfx[i]=i;
+ membank("bank1")->set_base(memregion("user1")->base());
- m_power = 1;
- timer_set(attotime::from_seconds(1), TIMER_POWER_UP);
+ m_ram_nvram->set_base(memregion("maincpu")->base() + 0x8000, 0x8000);
- membank("bank1")->set_base(memregion("user1")->base());
+ uint8_t *gfx = memregion("gfx1")->base();
+ for (int i = 0; i < 128; i++)
+ gfx[i] = i;
}
diff --git a/src/mame/machine/pocketc.cpp b/src/mame/machine/pocketc.cpp
new file mode 100644
index 00000000000..3b51ca442d0
--- /dev/null
+++ b/src/mame/machine/pocketc.cpp
@@ -0,0 +1,38 @@
+// license:GPL-2.0+
+// copyright-holders:Peter Trauner
+
+#include "includes/pocketc.h"
+
+WRITE8_MEMBER(pocketc_state::out_a_w)
+{
+ m_outa = data;
+}
+
+READ_LINE_MEMBER(pocketc_state::brk_r)
+{
+ return BIT(m_extra->read(), 0);
+}
+
+void pocketc_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
+{
+ switch (id)
+ {
+ case TIMER_POWER_UP:
+ m_power = 0;
+ break;
+ default:
+ assert_always(false, "Unknown id in pocketc_state::device_timer");
+ }
+}
+
+void pocketc_state::machine_start()
+{
+ m_cpu_nvram->set_base(m_maincpu->internal_ram(), 96);
+ m_power_timer = timer_alloc(TIMER_POWER_UP);
+}
+
+void pocketc_state::machine_reset()
+{
+ m_power = 1;
+ m_power_timer->adjust(attotime::from_seconds(1));
+}
diff --git a/src/mame/video/pc1251.cpp b/src/mame/video/pc1251.cpp
index 0f2987592e2..32974c9a677 100644
--- a/src/mame/video/pc1251.cpp
+++ b/src/mame/video/pc1251.cpp
@@ -5,159 +5,129 @@
#include "includes/pocketc.h"
#include "includes/pc1251.h"
-static const POCKETC_FIGURE /*busy={
- "11 1 1 11 1 1",
- "1 1 1 1 1 1 1",
- "11 1 1 1 1 1",
- "1 1 1 1 1 1",
- "11 1 11 1e"
-},*/ def={
+// TODO: Convert to SVG rendering or internal layout
+
+#define LOG_LCD (1 << 0)
+
+#define VERBOSE (0)
+#include "logmacro.h"
+
+const char *const pc1251_state::s_def[5] =
+{
"11 111 111",
- "1 1 1 1",
- "1 1 111 11",
- "1 1 1 1",
- "11 111 1e"
-}, shift={
+ "1 1 1 1 ",
+ "1 1 111 11 ",
+ "1 1 1 1 ",
+ "11 111 1 "
+};
+const char *const pc1251_state::s_shift[5] =
+{
" 11 1 1 1 111 111",
- "1 1 1 1 1 1",
- " 1 111 1 11 1",
- " 1 1 1 1 1 1",
- "11 1 1 1 1 1e"
-}, /*hyp={
- "1 1 1 1 11",
- "1 1 1 1 1 1",
- "111 1 1 11",
- "1 1 1 1",
- "1 1 1 1e"
-},*/ de={
+ "1 1 1 1 1 1 ",
+ " 1 111 1 11 1 ",
+ " 1 1 1 1 1 1 ",
+ "11 1 1 1 1 1 "
+};
+const char *const pc1251_state::s_de[5] =
+{
"11 111",
- "1 1 1",
+ "1 1 1 ",
"1 1 111",
- "1 1 1",
- "11 111e"
-}, g={
+ "1 1 1 ",
+ "11 111"
+};
+const char *const pc1251_state::s_g[5] =
+{
" 11",
- "1",
+ "1 ",
"1 1",
"1 1",
- " 11e"
-}, rad={
- "11 1 11",
+ " 11"
+};
+const char *const pc1251_state::s_rad[5] =
+{
+ "11 1 11 ",
"1 1 1 1 1 1",
"11 111 1 1",
"1 1 1 1 1 1",
- "1 1 1 1 11e"
-}, /*braces={
- " 1 1",
- "1 1",
- "1 1",
- "1 1",
- " 1 1e"
-}, m={
- "1 1",
- "11 11",
- "1 1 1",
- "1 1",
- "1 1e"
-}, e={
- "111",
- "1",
- "111",
- "1",
- "111e"
-},*/ run={
+ "1 1 1 1 11 "
+};
+const char *const pc1251_state::s_run[5] =
+{
"11 1 1 1 1",
"1 1 1 1 11 1",
"11 1 1 1 11",
"1 1 1 1 1 1",
- "1 1 1 1 1e"
-}, pro={
+ "1 1 1 1 1"
+};
+const char *const pc1251_state::s_pro[5] =
+{
"11 11 1 ",
- "1 1 1 1 1 1",
- "11 11 1 1",
- "1 1 1 1 1",
- "1 1 1 1e"
-}, /*japan={
- " 1 1 11 1 1 1",
- " 1 1 1 1 1 1 1 11 1",
- " 1 111 11 111 1 11",
- "1 1 1 1 1 1 1 1 1",
- " 1 1 1 1 1 1 1 1e"
-}, sml={
- " 11 1 1 1",
- "1 111 1",
- " 1 1 1 1",
- " 1 1 1 1",
- "11 1 1 111e"
-},*/ rsv={
+ "1 1 1 1 1 1 ",
+ "11 11 1 1 ",
+ "1 1 1 1 1 ",
+ "1 1 1 1 "
+};
+const char *const pc1251_state::s_rsv[5] =
+{
"11 11 1 1",
"1 1 1 1 1",
- "11 1 1 1",
- "1 1 1 1 1",
- "1 1 11 1e"
+ "11 1 1 1 ",
+ "1 1 1 1 1 ",
+ "1 1 11 1 "
};
-READ8_MEMBER(pc1251_state::pc1251_lcd_read)
+READ8_MEMBER(pc1251_state::lcd_read)
{
- uint8_t data = m_reg[offset&0xff];
- logerror("pc1251 read %.3x %.2x\n",offset,data);
+ uint8_t data = m_reg[offset & 0xff];
+ LOGMASKED(LOG_LCD, "pc1251 read %.3x %.2x\n", offset, data);
return data;
}
-WRITE8_MEMBER(pc1251_state::pc1251_lcd_write)
+WRITE8_MEMBER(pc1251_state::lcd_write)
{
- logerror("pc1251 write %.3x %.2x\n",offset,data);
- m_reg[offset&0xff] = data;
+ LOGMASKED(LOG_LCD, "pc1251 write %.3x %.2x\n", offset, data);
+ m_reg[offset & 0xff] = data;
}
#define DOWN 62
#define RIGHT 68
-uint32_t pc1251_state::screen_update_pc1251(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
+uint32_t pc1251_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
- int x, y, i, j;
- int color[2];
+ int color[2] =
+ {
+ 7, //pocketc_colortable[PC1251_CONTRAST][0],
+ 8, //pocketc_colortable[PC1251_CONTRAST][1]
+ };
bitmap.fill(11, cliprect);
- /* HJB: we cannot initialize array with values from other arrays, thus... */
- color[0] = 7; //pocketc_colortable[PC1251_CONTRAST][0];
- color[1] = 8; //pocketc_colortable[PC1251_CONTRAST][1];
+ const int contrast = m_dsw0->read() & 7;
+ int x = RIGHT;
+ int y = DOWN;
+ for (int i = 0; i < 60; x += 3)
+ for (int j = 0; j < 5; j++, i++, x += 3)
+ m_gfxdecode->gfx(0)->opaque(bitmap, cliprect, m_reg[i], contrast, 0, 0, x, y);
- for (x=RIGHT,y=DOWN, i=0; i<60; x+=3)
- {
- for (j=0; j<5; j++, i++, x+=3)
- m_gfxdecode->gfx(0)->opaque(bitmap,cliprect, m_reg[i],
- PC1251_CONTRAST,0,0,
- x,y);
- }
- for (i=0x7b; i>=0x40; x+=3)
- {
- for (j=0; j<5; j++, i--, x+=3)
- m_gfxdecode->gfx(0)->opaque(bitmap,cliprect, m_reg[i],
- PC1251_CONTRAST,0,0,
- x,y);
- }
-
- pocketc_draw_special(bitmap, RIGHT+134, DOWN-10, de,
- m_reg[0x3c] & 0x08 ? color[1] : color[0]);
- pocketc_draw_special(bitmap, RIGHT+142, DOWN-10, g,
- m_reg[0x3c] & 0x04 ? color[1] : color[0]);
- pocketc_draw_special(bitmap, RIGHT+146, DOWN-10, rad,
- m_reg[0x3d] & 0x04 ? color[1] : color[0]);
- pocketc_draw_special(bitmap, RIGHT+18, DOWN-10, def,
- m_reg[0x3c] & 0x01 ? color[1] : color[0]);
- pocketc_draw_special(bitmap, RIGHT, DOWN-10, shift,
- m_reg[0x3d] & 0x02 ? color[1] : color[0]);
- pocketc_draw_special(bitmap, RIGHT+38, DOWN-10, pro,
- m_reg[0x3e] & 0x01 ? color[1] : color[0]);
- pocketc_draw_special(bitmap, RIGHT+53, DOWN-10, run,
- m_reg[0x3e] & 0x02 ? color[1] : color[0]);
- pocketc_draw_special(bitmap, RIGHT+68, DOWN-10, rsv,
- m_reg[0x3e] & 0x04 ? color[1] : color[0]);
+ for (int i = 0x7b; i >= 0x40; x += 3)
+ for (int j = 0; j < 5; j++, i--, x += 3)
+ m_gfxdecode->gfx(0)->opaque(bitmap,cliprect, m_reg[i], contrast, 0, 0, x, y);
/* 0x3c 1 def?, 4 g, 8 de
0x3d 2 shift, 4 rad, 8 error
0x3e 1 pro?, 2 run?, 4rsv?*/
+
+ pocketc_draw_special(bitmap, RIGHT+18, DOWN-10, s_def, BIT(m_reg[0x3c], 0) ? color[1] : color[0]);
+ pocketc_draw_special(bitmap, RIGHT+142, DOWN-10, s_g, BIT(m_reg[0x3c], 2) ? color[1] : color[0]);
+ pocketc_draw_special(bitmap, RIGHT+134, DOWN-10, s_de, BIT(m_reg[0x3c], 3) ? color[1] : color[0]);
+
+ pocketc_draw_special(bitmap, RIGHT, DOWN-10, s_shift, BIT(m_reg[0x3d], 1) ? color[1] : color[0]);
+ pocketc_draw_special(bitmap, RIGHT+146, DOWN-10, s_rad, BIT(m_reg[0x3d], 2) ? color[1] : color[0]);
+
+ pocketc_draw_special(bitmap, RIGHT+38, DOWN-10, s_pro, BIT(m_reg[0x3e], 0) ? color[1] : color[0]);
+ pocketc_draw_special(bitmap, RIGHT+53, DOWN-10, s_run, BIT(m_reg[0x3e], 1) ? color[1] : color[0]);
+ pocketc_draw_special(bitmap, RIGHT+68, DOWN-10, s_rsv, BIT(m_reg[0x3e], 2) ? color[1] : color[0]);
+
return 0;
}
diff --git a/src/mame/video/pc1350.cpp b/src/mame/video/pc1350.cpp
index ab91563bce6..7f28f5f10e2 100644
--- a/src/mame/video/pc1350.cpp
+++ b/src/mame/video/pc1350.cpp
@@ -5,112 +5,76 @@
#include "includes/pocketc.h"
#include "includes/pc1350.h"
-static const POCKETC_FIGURE /*busy={
- "11 1 1 11 1 1",
- "1 1 1 1 1 1 1",
- "11 1 1 1 1 1",
- "1 1 1 1 1 1",
- "11 1 11 1e"
-},*/ def={
+// TODO: Convert to SVG rendering or internal layout
+
+#define LOG_LCD (1 << 0)
+
+#define VERBOSE (0)
+#include "logmacro.h"
+
+const char* const pc1350_state::s_def[5] =
+{
"11 111 111",
- "1 1 1 1",
- "1 1 111 11",
- "1 1 1 1",
- "11 111 1e"
-}, shift={
+ "1 1 1 1 ",
+ "1 1 111 11 ",
+ "1 1 1 1 ",
+ "11 111 1 "
+};
+const char* const pc1350_state::s_shift[5] =
+{
" 11 1 1 1 111 111",
- "1 1 1 1 1 1",
- " 1 111 1 11 1",
- " 1 1 1 1 1 1",
- "11 1 1 1 1 1e"
-}, /*hyp={
- "1 1 1 1 11",
- "1 1 1 1 1 1",
- "111 1 1 11",
- "1 1 1 1",
- "1 1 1 1e"
-}, de={
- "11 111",
- "1 1 1",
- "1 1 111",
- "1 1 1",
- "11 111e"
-}, g={
- " 11",
- "1",
- "1 1",
- "1 1",
- " 11e"
-}, rad={
- "11 1 11",
- "1 1 1 1 1 1",
- "11 111 1 1",
- "1 1 1 1 1 1",
- "1 1 1 1 11e"
-}, braces={
- " 1 1",
- "1 1",
- "1 1",
- "1 1",
- " 1 1e"
-}, m={
- "1 1",
- "11 11",
- "1 1 1",
- "1 1",
- "1 1e"
-}, e={
- "111",
- "1",
- "111",
- "1",
- "111e"
-},*/ run={
+ "1 1 1 1 1 1 ",
+ " 1 111 1 11 1 ",
+ " 1 1 1 1 1 1 ",
+ "11 1 1 1 1 1 "
+};
+const char* const pc1350_state::s_run[5] =
+{
"11 1 1 1 1",
"1 1 1 1 11 1",
"11 1 1 1 11",
"1 1 1 1 1 1",
- "1 1 1 1 1e"
-}, pro={
- "11 11 1 ",
+ "1 1 1 1 1"
+};
+const char* const pc1350_state::s_pro[5] =
+{
+ "11 11 1 ",
"1 1 1 1 1 1",
"11 11 1 1",
"1 1 1 1 1",
- "1 1 1 1e"
-}, japan={
+ "1 1 1 1 "
+};
+const char* const pc1350_state::s_japan[5] =
+{
" 1 1 11 1 1 1",
" 1 1 1 1 1 1 1 11 1",
" 1 111 11 111 1 11",
"1 1 1 1 1 1 1 1 1",
- " 1 1 1 1 1 1 1 1e"
-}, sml={
- " 11 1 1 1",
- "1 111 1",
- " 1 1 1 1",
- " 1 1 1 1",
- "11 1 1 111e"
-}/*, rsv={
- "11 11 1 1",
- "1 1 1 1 1",
- "11 1 1 1",
- "1 1 1 1 1",
- "1 1 11 1e"
-}*/;
+ " 1 1 1 1 1 1 1 1"
+};
+const char* const pc1350_state::s_sml[5] =
+{
+ " 11 1 1 1 ",
+ "1 111 1 ",
+ " 1 1 1 1 ",
+ " 1 1 1 1 ",
+ "11 1 1 111"
+};
-READ8_MEMBER(pc1350_state::pc1350_lcd_read)
+READ8_MEMBER(pc1350_state::lcd_read)
{
- uint8_t data = m_reg[offset&0xfff];
- logerror("pc1350 read %.3x %.2x\n",offset,data);
+ uint8_t data = m_reg[offset & 0xfff];
+ LOGMASKED(LOG_LCD, "pc1350 read %.3x %.2x\n",offset,data);
return data;
}
-WRITE8_MEMBER(pc1350_state::pc1350_lcd_write)
+WRITE8_MEMBER(pc1350_state::lcd_write)
{
- logerror("pc1350 write %.3x %.2x\n",offset,data);
- m_reg[offset&0xfff] = data;
+ LOGMASKED(LOG_LCD, "pc1350 write %.3x %.2x\n",offset,data);
+ m_reg[offset & 0xfff] = data;
}
-READ8_MEMBER(pc1350_state::pc1350_keyboard_line_r)
+READ8_MEMBER(pc1350_state::keyboard_line_r)
{
return m_reg[0xe00];
}
@@ -127,39 +91,33 @@ static const int pc1350_addr[4]={ 0, 0x40, 0x1e, 0x5e };
#define DOWN 45
#define RIGHT 76
-uint32_t pc1350_state::screen_update_pc1350(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
+uint32_t pc1350_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
- int x, y=DOWN, i, j, k=0, b;
- int color[4];
- bitmap.fill(11, cliprect);
-
- /* HJB: we cannot initialize array with values from other arrays, thus... */
- color[0] = pocketc_colortable[PC1350_CONTRAST][0];
- color[1] = pocketc_colortable[PC1350_CONTRAST][1];
- color[2] = 8;
- color[3] = 7;
+ const int contrast = m_dsw0->read() & 7;
+ int color[4] =
+ {
+ colortable[contrast][0],
+ colortable[contrast][1],
+ 8,
+ 7
+ };
- for (k=0, y=DOWN; k<4; y+=16, k++)
- for (x=RIGHT, i=pc1350_addr[k]; i<0xa00; i+=0x200)
- for (j=0; j<=0x1d; j++, x+=2)
- for (b = 0; b < 8; b++)
- bitmap.plot_box(x, y + b * 2, 2, 2, color[(m_reg[j+i] >> b) & 1]);
+ bitmap.fill(11, cliprect);
+ for (int k = 0, y = DOWN; k < 4; y += 16, k++)
+ for (int x = RIGHT, i = pc1350_addr[k]; i < 0xa00; i += 0x200)
+ for (int j = 0; j <= 0x1d; j++, x+=2)
+ for (int bit = 0; bit < 8; bit++)
+ bitmap.plot_box(x, y + bit * 2, 2, 2, color[BIT(m_reg[j+i], bit)]);
/* 783c: 0 SHIFT 1 DEF 4 RUN 5 PRO 6 JAPAN 7 SML */
- /* I don't know how they really look like in the lcd */
- pocketc_draw_special(bitmap, RIGHT-30, DOWN+45, shift,
- m_reg[0x83c] & 0x01 ? color[2] : color[3]);
- pocketc_draw_special(bitmap, RIGHT-30, DOWN+55, def,
- m_reg[0x83c] & 0x02 ? color[2] : color[3]);
- pocketc_draw_special(bitmap, RIGHT-30, DOWN+5, run,
- m_reg[0x83c] & 0x10 ? color[2] : color[3]);
- pocketc_draw_special(bitmap, RIGHT-30, DOWN+15, pro,
- m_reg[0x83c] & 0x20 ? color[2] : color[3]);
- pocketc_draw_special(bitmap, RIGHT-30, DOWN+25, japan,
- m_reg[0x83c] & 0x40 ? color[2] : color[3]);
- pocketc_draw_special(bitmap, RIGHT-30, DOWN+35, sml,
- m_reg[0x83c] & 0x80 ? color[2] : color[3]);
+ /* I don't know how they really look like on the LCD */
+ pocketc_draw_special(bitmap, RIGHT-30, DOWN+45, s_shift, BIT(m_reg[0x83c], 0) ? color[2] : color[3]);
+ pocketc_draw_special(bitmap, RIGHT-30, DOWN+55, s_def, BIT(m_reg[0x83c], 1) ? color[2] : color[3]);
+ pocketc_draw_special(bitmap, RIGHT-30, DOWN+5, s_run, BIT(m_reg[0x83c], 4) ? color[2] : color[3]);
+ pocketc_draw_special(bitmap, RIGHT-30, DOWN+15, s_pro, BIT(m_reg[0x83c], 5) ? color[2] : color[3]);
+ pocketc_draw_special(bitmap, RIGHT-30, DOWN+25, s_japan, BIT(m_reg[0x83c], 6) ? color[2] : color[3]);
+ pocketc_draw_special(bitmap, RIGHT-30, DOWN+35, s_sml, BIT(m_reg[0x83c], 7) ? color[2] : color[3]);
return 0;
}
diff --git a/src/mame/video/pc1401.cpp b/src/mame/video/pc1401.cpp
index be8b26c9d7a..08fb2cd911b 100644
--- a/src/mame/video/pc1401.cpp
+++ b/src/mame/video/pc1401.cpp
@@ -5,209 +5,176 @@
#include "includes/pocketc.h"
#include "includes/pc1401.h"
+// TODO: Convert to SVG rendering or internal layout
+
/* pc140x
16 5x7 with space between char
6000 .. 6027, 6067.. 6040
- 603c: 3 STAT
- 603d: 0 BUSY, 1 DEF, 2 SHIFT, 3 HYP, 4 PRO, 5 RUN, 6 CAL
- 607c: 0 E, 1 M, 2 (), 3 RAD, 4 G, 5 DE, 6 PRINT */
+ 603c: 3 STAT
+ 603d: 0 BUSY, 1 DEF, 2 SHIFT, 3 HYP, 4 PRO, 5 RUN, 6 CAL
+ 607c: 0 E, 1 M, 2 (), 3 RAD, 4 G, 5 DE, 6 PRINT */
/* pc1421
16 5x7 with space between char
6000 .. 6027, 6067.. 6040
- 603c: 3 RUN
- 603d: 0 BUSY, 1 DEF, 2 SHIFT, 3 BGN, 4 STAT, 5 FIN, 6 PRINT
- 607c: 0 E, 1 M, 2 BAL, 3 INT, 4 PRN, 5 Sum-Sign, 6 PRO */
+ 603c: 3 RUN
+ 603d: 0 BUSY, 1 DEF, 2 SHIFT, 3 BGN, 4 STAT, 5 FIN, 6 PRINT
+ 607c: 0 E, 1 M, 2 BAL, 3 INT, 4 PRN, 5 Sum-Sign, 6 PRO */
-READ8_MEMBER(pc1401_state::pc1401_lcd_read)
+READ8_MEMBER(pc1401_state::lcd_read)
{
return m_reg[offset & 0xff];
}
-WRITE8_MEMBER(pc1401_state::pc1401_lcd_write)
+WRITE8_MEMBER(pc1401_state::lcd_write)
{
- m_reg[offset & 0xff]=data;
+ m_reg[offset & 0xff] = data;
}
-static const POCKETC_FIGURE line={ /* simple line */
+const char* const pc1401_state::s_line[5] = /* simple line */
+{
+ " ",
+ " ",
"11111",
"11111",
- "11111e"
+ "11111"
};
-static const POCKETC_FIGURE busy={
+const char* const pc1401_state::s_busy[5] =
+{
"11 1 1 11 1 1",
"1 1 1 1 1 1 1",
"11 1 1 1 1 1",
- "1 1 1 1 1 1",
- "11 1 11 1e"
-}, def={
+ "1 1 1 1 1 1 ",
+ "11 1 11 1 "
+};
+const char* const pc1401_state::s_def[5] =
+{
"11 111 111",
- "1 1 1 1",
- "1 1 111 11",
- "1 1 1 1",
- "11 111 1e"
-}, shift={
+ "1 1 1 1 ",
+ "1 1 111 11 ",
+ "1 1 1 1 ",
+ "11 111 1 "
+};
+const char* const pc1401_state::s_shift[5] =
+{
" 11 1 1 1 111 111",
- "1 1 1 1 1 1",
- " 1 111 1 11 1",
- " 1 1 1 1 1 1",
- "11 1 1 1 1 1e"
-}, hyp={
- "1 1 1 1 11",
+ "1 1 1 1 1 1 ",
+ " 1 111 1 11 1 ",
+ " 1 1 1 1 1 1 ",
+ "11 1 1 1 1 1 "
+};
+const char* const pc1401_state::s_hyp[5] =
+{
+ "1 1 1 1 11 ",
"1 1 1 1 1 1",
- "111 1 1 11",
- "1 1 1 1",
- "1 1 1 1e"
-}, de={
+ "111 1 1 11 ",
+ "1 1 1 1 ",
+ "1 1 1 1 "
+};
+const char* const pc1401_state::s_de[5] =
+{
"11 111",
- "1 1 1",
+ "1 1 1 ",
"1 1 111",
- "1 1 1",
- "11 111e"
-}, g={
+ "1 1 1 ",
+ "11 111"
+};
+const char* const pc1401_state::s_g[5] =
+{
" 11",
- "1",
+ "1 ",
"1 1",
"1 1",
- " 11e"
-}, rad={
- "11 1 11",
+ " 11"
+};
+const char* const pc1401_state::s_rad[5] =
+{
+ "11 1 11 ",
"1 1 1 1 1 1",
"11 111 1 1",
"1 1 1 1 1 1",
- "1 1 1 1 11e"
-}, braces={
- " 1 1",
+ "1 1 1 1 11 "
+};
+const char* const pc1401_state::s_braces[5] =
+{
+ " 1 1 ",
"1 1",
"1 1",
"1 1",
- " 1 1e"
-}, m={
+ " 1 1 "
+};
+const char* const pc1401_state::s_m[5] =
+{
"1 1",
"11 11",
"1 1 1",
"1 1",
- "1 1e"
-}, e={
+ "1 1"
+};
+const char* const pc1401_state::s_e[5] =
+{
"111",
- "1",
+ "1 ",
"111",
- "1",
- "111e"
-}/*, run={
- "11 1 1 1 1",
- "1 1 1 1 11 1",
- "11 1 1 1 11",
- "1 1 1 1 1 1",
- "1 1 1 1 1e"
-}, pro={
- "11 11 1 ",
- "1 1 1 1 1 1",
- "11 11 1 1",
- "1 1 1 1 1",
- "1 1 1 1e"
-}, japan={
- " 1 1 11 1 1 1",
- " 1 1 1 1 1 1 1 11 1",
- " 1 111 11 111 1 11",
- "1 1 1 1 1 1 1 1 1",
- " 1 1 1 1 1 1 1 1e"
-}, sml={
- " 11 1 1 1",
- "1 111 1",
- " 1 1 1 1",
- " 1 1 1 1",
- "11 1 1 111e"
-}, rsv={
- "11 11 1 1",
- "1 1 1 1 1",
- "11 1 1 1",
- "1 1 1 1 1",
- "1 1 11 1e"
-}*/;
+ "1 ",
+ "111"
+};
#define DOWN 57
#define RIGHT 114
-uint32_t pc1401_state::screen_update_pc1401(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
+uint32_t pc1401_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
- int x, y, i, j;
- int color[2];
-
- bitmap.fill(11, cliprect);
-
+ const int contrast = m_dsw0->read() & 7;
+ int color[2] =
+ {
#if 0
- /* HJB: we cannot initialize array with values from other arrays, thus... */
- color[0] = pocketc_colortable[CONTRAST][0];
- color[1] = pocketc_colortable[CONTRAST][1];
+ pocketc_colortable[contrast][0],
+ pocketc_colortable[contrast][1]
#endif
- /* Above can be unreadable or misleading at certain contrast settings, this is better */
- color[0] = 7;
- color[1] = 8;
+ /* Above can be unreadable or misleading at certain contrast settings, this is better */
+ 7,
+ 8
+ };
- if (m_portc&1)
+ bitmap.fill(11, cliprect);
+
+ if (BIT(m_portc, 0))
{
- for (x=RIGHT,y=DOWN,i=0; i<0x28;x+=2)
- {
- for (j=0; j<5;j++,i++,x+=2)
- m_gfxdecode->gfx(0)->opaque(bitmap,cliprect, m_reg[i],CONTRAST,0,0,x,y);
- }
- for (i=0x67; i>=0x40;x+=2)
- {
- for (j=0; j<5;j++,i--,x+=2)
- m_gfxdecode->gfx(0)->opaque(bitmap,cliprect, m_reg[i],CONTRAST,0,0,x,y);
- }
+ int x = RIGHT;
+ int y = DOWN;
+ for (int i = 0; i < 0x28; x += 2)
+ for (int j = 0; j < 5; j++, i++, x += 2)
+ m_gfxdecode->gfx(0)->opaque(bitmap, cliprect, m_reg[i], contrast, 0, 0, x, y);
+
+ for (int i = 0x67; i >= 0x40; x += 2)
+ for (int j = 0; j < 5; j++, i--, x+=2)
+ m_gfxdecode->gfx(0)->opaque(bitmap, cliprect, m_reg[i], contrast, 0, 0, x, y);
}
- pocketc_draw_special(bitmap, RIGHT+149, DOWN+24, line,
- m_reg[0x3c] & 0x08 ? color[1] : color[0]);
-
- pocketc_draw_special(bitmap, RIGHT, DOWN-10, busy,
- m_reg[0x3d] & 0x01 ? color[1] : color[0]);
-
- pocketc_draw_special(bitmap, RIGHT+18, DOWN-10, def,
- m_reg[0x3d] & 0x02 ? color[1] : color[0]);
-
- pocketc_draw_special(bitmap, RIGHT+43, DOWN-10,shift,
- m_reg[0x3d] & 0x04 ? color[1] : color[0]);
-
- pocketc_draw_special(bitmap, RIGHT+63, DOWN-10,hyp,
- m_reg[0x3d] & 0x08 ? color[1] : color[0]);
-
- pocketc_draw_special(bitmap, RIGHT+38, DOWN+24,line,
- m_reg[0x3d] & 0x10 ? color[1] : color[0]);
-
- pocketc_draw_special(bitmap, RIGHT+23, DOWN+24,line,
- m_reg[0x3d] & 0x20 ? color[1] : color[0]);
-
- pocketc_draw_special(bitmap, RIGHT+8, DOWN+24,line,
- m_reg[0x3d] & 0x40 ? color[1] : color[0]);
-
- pocketc_draw_special(bitmap, RIGHT+183, DOWN-10,e,
- m_reg[0x7c] & 0x01 ? color[1] : color[0]);
-
- pocketc_draw_special(bitmap, RIGHT+176, DOWN-10,m,
- m_reg[0x7c] & 0x02 ? color[1] : color[0]);
-
- pocketc_draw_special(bitmap, RIGHT+168, DOWN-10,braces,
- m_reg[0x7c] & 0x04 ? color[1] : color[0]);
-
- pocketc_draw_special(bitmap, RIGHT+138, DOWN-10,rad,
- m_reg[0x7c] & 0x08 ? color[1] : color[0]);
-
- pocketc_draw_special(bitmap, RIGHT+134, DOWN-10,g,
- m_reg[0x7c] & 0x10 ? color[1] : color[0]);
-
- pocketc_draw_special(bitmap, RIGHT+126, DOWN-10,de,
- m_reg[0x7c] & 0x20 ? color[1] : color[0]);
-
- pocketc_draw_special(bitmap, RIGHT+165, DOWN+24,line,
- m_reg[0x7c] & 0x40 ? color[1] : color[0]);
-
/*
603c: 3 STAT
603d: 0 BUSY, 1 DEF, 2 SHIFT, 3 HYP, 4 PRO, 5 RUN, 6 CAL
607c: 0 E, 1 M, 2 (), 3 RAD, 4 G, 5 DE, 6 PRINT
*/
+
+ pocketc_draw_special(bitmap, RIGHT+149, DOWN+24, s_line, BIT(m_reg[0x3c], 3) ? color[1] : color[0]);
+
+ pocketc_draw_special(bitmap, RIGHT, DOWN-10, s_busy, BIT(m_reg[0x3d], 0) ? color[1] : color[0]);
+ pocketc_draw_special(bitmap, RIGHT+18, DOWN-10, s_def, BIT(m_reg[0x3d], 1) ? color[1] : color[0]);
+ pocketc_draw_special(bitmap, RIGHT+43, DOWN-10, s_shift, BIT(m_reg[0x3d], 2) ? color[1] : color[0]);
+ pocketc_draw_special(bitmap, RIGHT+63, DOWN-10, s_hyp, BIT(m_reg[0x3d], 3) ? color[1] : color[0]);
+ pocketc_draw_special(bitmap, RIGHT+38, DOWN+24, s_line, BIT(m_reg[0x3d], 4) ? color[1] : color[0]); // pro
+ pocketc_draw_special(bitmap, RIGHT+23, DOWN+24, s_line, BIT(m_reg[0x3d], 5) ? color[1] : color[0]); // run
+ pocketc_draw_special(bitmap, RIGHT+8, DOWN+24, s_line, BIT(m_reg[0x3d], 6) ? color[1] : color[0]); // cal
+
+ pocketc_draw_special(bitmap, RIGHT+183, DOWN-10, s_e, BIT(m_reg[0x7c], 0) ? color[1] : color[0]);
+ pocketc_draw_special(bitmap, RIGHT+176, DOWN-10, s_m, BIT(m_reg[0x7c], 1) ? color[1] : color[0]);
+ pocketc_draw_special(bitmap, RIGHT+168, DOWN-10, s_braces, BIT(m_reg[0x7c], 2) ? color[1] : color[0]);
+ pocketc_draw_special(bitmap, RIGHT+138, DOWN-10, s_rad, BIT(m_reg[0x7c], 3) ? color[1] : color[0]);
+ pocketc_draw_special(bitmap, RIGHT+134, DOWN-10, s_g, BIT(m_reg[0x7c], 4) ? color[1] : color[0]);
+ pocketc_draw_special(bitmap, RIGHT+126, DOWN-10, s_de, BIT(m_reg[0x7c], 5) ? color[1] : color[0]);
+ pocketc_draw_special(bitmap, RIGHT+165, DOWN+24, s_line, BIT(m_reg[0x7c], 6) ? color[1] : color[0]); // print
+
return 0;
}
diff --git a/src/mame/video/pc1403.cpp b/src/mame/video/pc1403.cpp
index c38cea3b84c..d007dd4c82c 100644
--- a/src/mame/video/pc1403.cpp
+++ b/src/mame/video/pc1403.cpp
@@ -2,20 +2,23 @@
// copyright-holders:Peter Trauner
/*****************************************************************************
*
- * pc1403.c
- * portable sharp pc1403 video emulator interface
- * (sharp pocket computers)
+ * pc1403.cpp
+ * Portable Sharp PC1403 video emulator interface
+ * (Sharp pocket computers)
*
* Copyright (c) 2001 Peter Trauner, all rights reserved.
*
- * History of changes:
+ * Change Log:
* 21.07.2001 Several changes listed below were made by Mario Konegger
* (konegger@itp.tu-graz.ac.at)
- * Placed the grafical symbols onto the right place and added
- * some symbols, so the display is correct rebuit.
- * Added a strange behaviour of the display concerning the on/off
- * state and the BUSY-symbol, which I found out with experiments
- * with my own pc1403.
+ * Placed the graphical symbols in the right place and added
+ * some symbols, so the display is correct.
+ * Added an edge case of the display regarding the on/off
+ * state and the BUSY symbol, which was found out with testing
+ * on an actual PC1403.
+ *
+ * To Do: Convert to SVG rendering or an internal layout
+ *
*****************************************************************************/
#include "emu.h"
@@ -26,221 +29,216 @@
void pc1403_state::video_start()
{
- if (strcmp(machine().system().name, "pc1403h") == 0)
- {
- m_DOWN = 69;
- m_RIGHT = 155;
- }
- else
- {
- m_DOWN = 67;
- m_RIGHT = 152;
- }
+ m_down = 67;
+ m_right = 152;
+}
+
+void pc1403h_state::video_start()
+{
+ m_down = 69;
+ m_right = 155;
}
-READ8_MEMBER(pc1403_state::pc1403_lcd_read)
+READ8_MEMBER(pc1403_state::lcd_read)
{
return m_reg[offset];
}
-WRITE8_MEMBER(pc1403_state::pc1403_lcd_write)
+WRITE8_MEMBER(pc1403_state::lcd_write)
{
- m_reg[offset]=data;
+ m_reg[offset] = data;
}
-static const POCKETC_FIGURE line={ /* simple line */
+const char* const pc1403_state::s_line[5] = /* simple line */
+{
+ " ",
+ " ",
"11111",
"11111",
- "11111e"
+ "11111"
};
-static const POCKETC_FIGURE busy={
+
+const char* const pc1403_state::s_busy[5] =
+{
"11 1 1 11 1 1",
"1 1 1 1 1 1 1",
"11 1 1 1 1 1",
- "1 1 1 1 1 1",
- "11 1 11 1e"
-}, def={
+ "1 1 1 1 1 1 ",
+ "11 1 11 1 "
+};
+const char* const pc1403_state::s_def[5] =
+{
"11 111 111",
- "1 1 1 1",
- "1 1 111 11",
- "1 1 1 1",
- "11 111 1e"
-}, shift={
+ "1 1 1 1 ",
+ "1 1 111 11 ",
+ "1 1 1 1 ",
+ "11 111 1 "
+};
+const char* const pc1403_state::s_shift[5] =
+{
" 11 1 1 1 111 111",
- "1 1 1 1 1 1",
- " 1 111 1 11 1",
- " 1 1 1 1 1 1",
- "11 1 1 1 1 1e"
-}, hyp={
- "1 1 1 1 11",
+ "1 1 1 1 1 1 ",
+ " 1 111 1 11 1 ",
+ " 1 1 1 1 1 1 ",
+ "11 1 1 1 1 1 "
+};
+const char* const pc1403_state::s_hyp[5] =
+{
+ "1 1 1 1 11 ",
"1 1 1 1 1 1",
- "111 1 1 11",
- "1 1 1 1",
- "1 1 1 1e"
-}, de={
+ "111 1 1 11 ",
+ "1 1 1 1 ",
+ "1 1 1 1 "
+};
+const char* const pc1403_state::s_de[5] =
+{
"11 111",
- "1 1 1",
+ "1 1 1 ",
"1 1 111",
- "1 1 1",
- "11 111e"
-}, g={
+ "1 1 1 ",
+ "11 111"
+};
+const char* const pc1403_state::s_g[5] =
+{
" 11",
- "1",
+ "1 ",
"1 1",
"1 1",
- " 11e"
-}, rad={
- "11 1 11",
+ " 11"
+};
+const char* const pc1403_state::s_rad[5] =
+{
+ "11 1 11 ",
"1 1 1 1 1 1",
"11 111 1 1",
"1 1 1 1 1 1",
- "1 1 1 1 11e"
-}, braces={
- " 1 1",
+ "1 1 1 1 11 "
+};
+const char* const pc1403_state::s_braces[5] =
+{
+ " 1 1 ",
"1 1",
"1 1",
"1 1",
- " 1 1e"
-}, m={
+ " 1 1 "
+};
+const char* const pc1403_state::s_m[5] =
+{
"1 1",
"11 11",
"1 1 1",
"1 1",
- "1 1e"
-}, e={
+ "1 1"
+};
+const char* const pc1403_state::s_e[5] =
+{
"111",
- "1",
+ "1 ",
"111",
- "1",
- "111e"
-}, kana={ // katakana charset
+ "1 ",
+ "111"
+};
+const char* const pc1403_state::s_kana[5] = // katakana charset
+{
" 1 1 ",
" 11111 111",
" 1 1 1 ",
" 1 1 1 ",
- "1 1 1e"
-}, shoo={ // minor
+ "1 1 1 "
+};
+const char* const pc1403_state::s_shoo[5] = // minor
+{
" 1 ",
" 1 1 1 ",
"1 1 1",
" 1 ",
- " 1e"
-}, sml={
- " 11 1 1 1",
- "1 111 1",
- " 1 1 1 1",
- " 1 1 1 1",
- "11 1 1 111e"
+ " 1 "
+};
+const char* const pc1403_state::s_sml[5] =
+{
+ " 11 1 1 1 ",
+ "1 111 1 ",
+ " 1 1 1 1 ",
+ " 1 1 1 1 ",
+ "11 1 1 111"
};
-uint32_t pc1403_state::screen_update_pc1403(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
+uint32_t pc1403_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
- int x, y, i, j;
- int color[3];
+ const int contrast = m_dsw0->read() & 7;
+ int color[3] =
+ {
+ 7,
+ BIT(m_portc, 0) ? 8 : 7,
+ 8
+ };
bitmap.fill(11, cliprect);
- /* HJB: we cannot initialize array with values from other arrays, thus... */
- color[0] = 7; // pocketc_colortable[CONTRAST][0];
- color[2] = 8; // pocketc_colortable[CONTRAST][1];
- color[1] = (m_portc & 1) ? color[2] : color[0];
-
- if (m_portc & 1)
+ if (BIT(m_portc, 0))
{
- for (x=m_RIGHT, y=m_DOWN, i=0; i<6*5; x+=2) {
- for (j=0; j<5; j++, i++, x+=2)
- m_gfxdecode->gfx(0)->opaque(bitmap,cliprect, m_reg[i],CONTRAST,0,0,
- x,y);
- }
- for (i=9*5; i<12*5; x+=2)
- {
- for (j=0; j<5; j++, i++, x+=2)
- m_gfxdecode->gfx(0)->opaque(bitmap,cliprect, m_reg[i],CONTRAST,0,0,
- x,y);
- }
- for (i=6*5; i<9*5; x+=2)
- {
- for (j=0; j<5; j++, i++, x+=2)
- m_gfxdecode->gfx(0)->opaque(bitmap,cliprect, m_reg[i],CONTRAST,0,0,
- x,y);
- }
- for (i=0x7b-3*5; i>0x7b-6*5; x+=2)
- {
- for (j=0; j<5; j++, i--, x+=2)
- m_gfxdecode->gfx(0)->opaque(bitmap,cliprect, m_reg[i],CONTRAST,0,0,
- x,y);
- }
- for (i=0x7b; i>0x7b-3*5; x+=2)
- {
- for (j=0; j<5; j++, i--, x+=2)
- m_gfxdecode->gfx(0)->opaque(bitmap,cliprect, m_reg[i],CONTRAST,0,0,
- x,y);
- }
- for (i=0x7b-6*5; i>0x7b-12*5; x+=2)
- {
- for (j=0; j<5; j++, i--, x+=2)
- m_gfxdecode->gfx(0)->opaque(bitmap,cliprect, m_reg[i],CONTRAST,0,0,
- x,y);
- }
+ int x = m_right;
+ int y = m_down;
+ for (int i = 0; i < 6*5; x+=2)
+ for (int j = 0; j < 5; j++, i++, x+=2)
+ m_gfxdecode->gfx(0)->opaque(bitmap, cliprect, m_reg[i], contrast, 0, 0, x, y);
+
+ for (int i = 9*5; i < 12*5; x+=2)
+ for (int j = 0; j < 5; j++, i++, x+=2)
+ m_gfxdecode->gfx(0)->opaque(bitmap, cliprect, m_reg[i], contrast, 0, 0, x, y);
+
+ for (int i = 6*5; i < 9*5; x += 2)
+ for (int j = 0; j < 5; j++, i++, x+=2)
+ m_gfxdecode->gfx(0)->opaque(bitmap, cliprect, m_reg[i], contrast, 0, 0, x, y);
+
+ for (int i = 0x7b - 3*5; i > 0x7b - 6*5; x+=2)
+ for (int j = 0; j < 5; j++, i--, x+=2)
+ m_gfxdecode->gfx(0)->opaque(bitmap, cliprect, m_reg[i], contrast, 0, 0, x, y);
+
+ for (int i = 0x7b; i > 0x7b - 3*5; x += 2)
+ for (int j = 0; j < 5; j++, i--, x+=2)
+ m_gfxdecode->gfx(0)->opaque(bitmap, cliprect, m_reg[i], contrast, 0, 0, x, y);
+
+ for (int i = 0x7b - 6*5; i > 0x7b - 12*5; x += 2)
+ for (int j = 0; j < 5; j++, i--, x+=2)
+ m_gfxdecode->gfx(0)->opaque(bitmap, cliprect, m_reg[i], contrast, 0, 0, x, y);
}
- /* if display is off, busy is always visible? it seems to behave like that. */
- /* But if computer is off, busy is hidden. */
- if(!(m_portc&8))
- {
- if (m_portc&1)
- pocketc_draw_special(bitmap, m_RIGHT, m_DOWN-13, busy,
- m_reg[0x3d] & 1 ? color[2] : color[0]);
- else pocketc_draw_special(bitmap, m_RIGHT, m_DOWN-13, busy, color[2]);
+ /* If the display is off, busy is always visible. But if the computer is off, busy is hidden. */
+ if(!BIT(m_portc, 3))
+ {
+ if (BIT(m_portc, 0))
+ pocketc_draw_special(bitmap, m_right, m_down-13, s_busy, BIT(m_reg[0x3d], 0) ? color[2] : color[0]);
+ else
+ pocketc_draw_special(bitmap, m_right, m_down-13, s_busy, color[2]);
}
else
- pocketc_draw_special(bitmap, m_RIGHT, m_DOWN-13, busy, color[0]);
-
- pocketc_draw_special(bitmap, m_RIGHT+18, m_DOWN-13, def,
- m_reg[0x3d] & 0x02 ? color[1] : color[0]);
- pocketc_draw_special(bitmap, m_RIGHT+43, m_DOWN-13, shift,
- m_reg[0x3d] & 0x04 ? color[1] : color[0]);
- pocketc_draw_special(bitmap, m_RIGHT+63, m_DOWN-13, hyp,
- m_reg[0x3d] & 0x08 ? color[1] : color[0]);
-
- pocketc_draw_special(bitmap, m_RIGHT+155, m_DOWN-13, kana,
- m_reg[0x3c] & 0x01 ? color[1] : color[0]);
- pocketc_draw_special(bitmap, m_RIGHT+167, m_DOWN-13, shoo,
- m_reg[0x3c] & 0x02 ? color[1] : color[0]);
- pocketc_draw_special(bitmap, m_RIGHT+178, m_DOWN-13, sml,
- m_reg[0x3c] & 0x04 ? color[1] : color[0]);
-
- pocketc_draw_special(bitmap, m_RIGHT+191, m_DOWN-13, de,
- m_reg[0x7c] & 0x20 ? color[1] : color[0]);
- pocketc_draw_special(bitmap, m_RIGHT+199, m_DOWN-13, g,
- m_reg[0x7c] & 0x10 ? color[1] : color[0]);
- pocketc_draw_special(bitmap, m_RIGHT+203, m_DOWN-13, rad,
- m_reg[0x7c] & 0x08 ? color[1] : color[0]);
-
- pocketc_draw_special(bitmap, m_RIGHT+266, m_DOWN-13, braces,
- m_reg[0x7c] & 0x04 ? color[1] : color[0]);
- pocketc_draw_special(bitmap, m_RIGHT+274, m_DOWN-13, m,
- m_reg[0x7c] & 0x02 ? color[1] : color[0]);
- pocketc_draw_special(bitmap, m_RIGHT+281, m_DOWN-13, e,
- m_reg[0x7c] & 0x01 ? color[1] : color[0]);
-
- pocketc_draw_special(bitmap, m_RIGHT+10, m_DOWN+27, line /* empty */,
- m_reg[0x3c] & 0x40 ? color[1] : color[0]);
- pocketc_draw_special(bitmap, m_RIGHT+31, m_DOWN+27, line /*calc*/,
- m_reg[0x3d] & 0x40 ? color[1] : color[0]);
- pocketc_draw_special(bitmap, m_RIGHT+52, m_DOWN+27, line/*run*/,
- m_reg[0x3d] & 0x20 ? color[1] : color[0]);
- pocketc_draw_special(bitmap, m_RIGHT+73, m_DOWN+27, line/*prog*/,
- m_reg[0x3d] & 0x10 ? color[1] : color[0]);
- pocketc_draw_special(bitmap, m_RIGHT+94, m_DOWN+27, line /* empty */,
- m_reg[0x3c] & 0x20 ? color[1] : color[0]);
-
- pocketc_draw_special(bitmap, m_RIGHT+232, m_DOWN+27, line/*matrix*/,
- m_reg[0x3c] & 0x10 ? color[1] : color[0]);
- pocketc_draw_special(bitmap, m_RIGHT+253, m_DOWN+27, line/*stat*/,
- m_reg[0x3c] & 0x08 ? color[1] : color[0]);
- pocketc_draw_special(bitmap, m_RIGHT+274, m_DOWN+27, line/*print*/,
- m_reg[0x7c] & 0x40 ? color[1] : color[0]);
+ {
+ pocketc_draw_special(bitmap, m_right, m_down-13, s_busy, color[0]);
+ }
+
+ pocketc_draw_special(bitmap, m_right+155, m_down-13, s_kana, BIT(m_reg[0x3c], 0) ? color[1] : color[0]);
+ pocketc_draw_special(bitmap, m_right+167, m_down-13, s_shoo, BIT(m_reg[0x3c], 1) ? color[1] : color[0]);
+ pocketc_draw_special(bitmap, m_right+178, m_down-13, s_sml, BIT(m_reg[0x3c], 2) ? color[1] : color[0]);
+ pocketc_draw_special(bitmap, m_right+253, m_down+25, s_line, BIT(m_reg[0x3c], 3) ? color[1] : color[0]); // stat
+ pocketc_draw_special(bitmap, m_right+232, m_down+25, s_line, BIT(m_reg[0x3c], 4) ? color[1] : color[0]); // matrix
+ pocketc_draw_special(bitmap, m_right+94, m_down+25, s_line, BIT(m_reg[0x3c], 5) ? color[1] : color[0]); // empty
+ pocketc_draw_special(bitmap, m_right+10, m_down+25, s_line, BIT(m_reg[0x3c], 6) ? color[1] : color[0]); // empty
+
+ pocketc_draw_special(bitmap, m_right+18, m_down-13, s_def, BIT(m_reg[0x3d], 1) ? color[1] : color[0]);
+ pocketc_draw_special(bitmap, m_right+43, m_down-13, s_shift, BIT(m_reg[0x3d], 2) ? color[1] : color[0]);
+ pocketc_draw_special(bitmap, m_right+63, m_down-13, s_hyp, BIT(m_reg[0x3d], 3) ? color[1] : color[0]);
+ pocketc_draw_special(bitmap, m_right+73, m_down+25, s_line, BIT(m_reg[0x3d], 4) ? color[1] : color[0]); // prog
+ pocketc_draw_special(bitmap, m_right+52, m_down+25, s_line, BIT(m_reg[0x3d], 5) ? color[1] : color[0]); // run
+ pocketc_draw_special(bitmap, m_right+31, m_down+25, s_line, BIT(m_reg[0x3d], 6) ? color[1] : color[0]); // calc
+
+ pocketc_draw_special(bitmap, m_right+281, m_down-13, s_e, BIT(m_reg[0x7c], 0) ? color[1] : color[0]);
+ pocketc_draw_special(bitmap, m_right+274, m_down-13, s_m, BIT(m_reg[0x7c], 1) ? color[1] : color[0]);
+ pocketc_draw_special(bitmap, m_right+266, m_down-13, s_braces, BIT(m_reg[0x7c], 2) ? color[1] : color[0]);
+ pocketc_draw_special(bitmap, m_right+203, m_down-13, s_rad, BIT(m_reg[0x7c], 3) ? color[1] : color[0]);
+ pocketc_draw_special(bitmap, m_right+199, m_down-13, s_g, BIT(m_reg[0x7c], 4) ? color[1] : color[0]);
+ pocketc_draw_special(bitmap, m_right+191, m_down-13, s_de, BIT(m_reg[0x7c], 5) ? color[1] : color[0]);
+ pocketc_draw_special(bitmap, m_right+274, m_down+25, s_line, BIT(m_reg[0x7c], 6) ? color[1] : color[0]); // print
return 0;
}
diff --git a/src/mame/video/pocketc.cpp b/src/mame/video/pocketc.cpp
index 276b525d947..b93c2bda448 100644
--- a/src/mame/video/pocketc.cpp
+++ b/src/mame/video/pocketc.cpp
@@ -3,24 +3,20 @@
#include "emu.h"
#include "includes/pocketc.h"
-/* PC126x
- 24x2 5x7 space between char
- 2000 .. 203b, 2800 .. 283b
- 2040 .. 207b, 2840 .. 287b
- 203d: 0 BUSY, 1 PRINT, 3 JAPAN, 4 SMALL, 5 SHIFT, 6 DEF
- 207c: 1 DEF 1 RAD 2 GRAD 5 ERROR 6 FLAG */
+// TODO: Convert to SVG rendering or internal layout
-static const uint8_t pocketc_palette[] =
+const rgb_t pocketc_state::indirect_palette[] =
{
- 99,107,99,
- 94,111,103,
- 255,255,255,
- 255,255,255,
- 60, 66, 60,
- 0, 0, 0
+ rgb_t( 99, 107, 99),
+ rgb_t( 94, 111, 103),
+ rgb_t(255, 255, 255),
+ rgb_t(255, 255, 255),
+ rgb_t( 60, 66, 60),
+ rgb_t( 0, 0, 0)
};
-const unsigned short pocketc_state::pocketc_colortable[8][2] = {
+const int pocketc_state::colortable[8][2] =
+{
{ 5, 4 },
{ 5, 0 },
{ 5, 2 },
@@ -33,38 +29,20 @@ const unsigned short pocketc_state::pocketc_colortable[8][2] = {
PALETTE_INIT_MEMBER(pocketc_state, pocketc)
{
- uint8_t i=0, r, b, g, color_count = 6;
-
- while (color_count--)
- {
- r = pocketc_palette[i++]; g = pocketc_palette[i++]; b = pocketc_palette[i++];
- palette.set_indirect_color(5 - color_count, rgb_t(r, g, b));
- }
+ for (int i = 0; i < 6; i++)
+ palette.set_indirect_color(i, indirect_palette[i]);
- for( i = 0; i < 8; i++ )
+ for (int i = 0; i < 8; i++)
{
- palette.set_pen_indirect(i*2, pocketc_colortable[i][0]);
- palette.set_pen_indirect(i*2+1, pocketc_colortable[i][1]);
+ palette.set_pen_indirect(i*2, colortable[i][0]);
+ palette.set_pen_indirect(i*2+1, colortable[i][1]);
}
}
-
-/* Draw an indicator (DEG, SHIFT, etc) */
-void pocketc_state::pocketc_draw_special(bitmap_ind16 &bitmap, int x, int y, const POCKETC_FIGURE fig, int color)
+void pocketc_state::pocketc_draw_special(bitmap_ind16 &bitmap, int x, int y, const char* const *fig, int color)
{
- int i,j;
- for (i=0; fig[i]; i++, y++)
- {
- for (j=0; fig[i][j]!=0; j++)
- {
- switch(fig[i][j])
- {
- case '1':
- bitmap.pix16(y, x+j) = color;
- break;
- case 'e':
- return;
- }
- }
- }
+ for (int i = 0; i < 5; i++, y++)
+ for (int j = 0; fig[i][j]; j++)
+ if (fig[i][j] != ' ')
+ bitmap.pix16(y, x + j) = color;
}