mirror of
https://github.com/holub/mame
synced 2025-04-20 23:42:22 +03:00
pc6001.cpp: Major rework of PC-6001mk2SR (#8626)
* Added a PC-6001 cartridge software list XML, and hooked up to the driver; * Fixed a regression bug with machine_reset fn where PC-6001mkII was implicitly overriding its memory model when a cart was inserted, causing being stuck at POST; * Improved irq handling and removed a couple kludges, fixing hangs caused by multiple irqs being fired at the same time; * Added PC-6601SR "Mr. PC", and improved the specific SR video mode already used by PC-6001mk2SR; * Refactored PC-6001mkIISR / PC-6601SR memory model to use address_map_device, allowing BIOS booting and .cas loading in mode 6. Replace AY8910 with YM2203; * Add keyboard inputs F1-F10, and fixed the specific irq vector dispatch; * Add preliminary FDC internal/external interface. Hooked up PC80S31 to external i/f as a proof of concept; * Fixed timer enable (fixes Yakyukyo and Punchball Mario boots), and fixed different timer resolution with PC-6001mk2SR so that cursor blinking happens at the right frequency; New machines marked as NOT_WORKING ---------------------------------- PC-6601SR "Mr. PC" [anonymous] New NOT_WORKING software list additions --------------------------------------- pc6001_cart.xml: Tutankham [HardcoreHubz, cyberat2600, Gaming Alexandria]
This commit is contained in:
parent
fbb2381f9e
commit
5b3335f88c
159
hash/pc6001_cart.xml
Normal file
159
hash/pc6001_cart.xml
Normal file
@ -0,0 +1,159 @@
|
||||
<?xml version="1.0"?>
|
||||
<!DOCTYPE softwarelist SYSTEM "softwarelist.dtd">
|
||||
<!--
|
||||
license:CC0
|
||||
-->
|
||||
<softwarelist name="pc6001_cart" description="NEC PC-6001 cartridges">
|
||||
|
||||
<!-- Official Games -->
|
||||
|
||||
<software name="canyoncl" supported="yes">
|
||||
<description>Canyon Climber</description>
|
||||
<year>1982</year>
|
||||
<!-- "licensed to NEC" -->
|
||||
<publisher>Datasoft</publisher>
|
||||
<part name="cart" interface="pc6001_cart">
|
||||
<dataarea name="rom" size="16384">
|
||||
<rom name="canyon climber.bin" size="16384" crc="c92870fe" sha1="7d0e44b19a7c59b92f297735fc69b415081843ac"/>
|
||||
</dataarea>
|
||||
</part>
|
||||
</software>
|
||||
|
||||
<!-- Doesn't boot -->
|
||||
<software name="crowman" supported="no">
|
||||
<description>The Curse of Crowley Manor</description>
|
||||
<year>19??</year>
|
||||
<publisher><unknown></publisher>
|
||||
<part name="cart" interface="pc6001_cart">
|
||||
<dataarea name="rom" size="16384">
|
||||
<rom name="the curse of crowley manor.bin" size="16384" crc="592c54af" sha1="c0e2155181a20d3c963ee9151a3eabab4765ffd9"/>
|
||||
</dataarea>
|
||||
</part>
|
||||
</software>
|
||||
|
||||
<!-- Has missing text (uses raster effect) -->
|
||||
<software name="tutankhm" supported="partial">
|
||||
<description>Tutankham</description>
|
||||
<year>1982</year>
|
||||
<publisher>Konami</publisher>
|
||||
<info name="alt_title" value="ツタンカーム"/>
|
||||
|
||||
<part name="cart" interface="pc6001_cart">
|
||||
<dataarea name="rom" size="4096">
|
||||
<rom name="510t.12" size="4096" crc="7a114d77" sha1="d0920e7d9d2a26530037350bf8399494ab0df0c5"/>
|
||||
</dataarea>
|
||||
</part>
|
||||
</software>
|
||||
|
||||
<!-- Homebrew Games -->
|
||||
|
||||
<!-- both these dumps aren't valid ROM sizes -->
|
||||
<software name="moonraid" supported="yes">
|
||||
<description>Moon Raiders</description>
|
||||
<year>2010</year>
|
||||
<!-- Developed by XYZ, author: mosesu -->
|
||||
<publisher><homebrew></publisher>
|
||||
<info name="alt_title" value="ムーンレイダース"/>
|
||||
|
||||
<part name="cart" interface="pc6001_cart">
|
||||
<dataarea name="rom" size="16079">
|
||||
<rom name="mr.bin" size="16079" crc="51ac06d8" sha1="736c7c72bb632a3bc26ed2e081a53d30b99cee2b" status="baddump"/>
|
||||
</dataarea>
|
||||
</part>
|
||||
</software>
|
||||
|
||||
<software name="moonraida" cloneof="moonraid" supported="yes">
|
||||
<!-- sports older website on title screen -->
|
||||
<description>Moon Raiders (older)</description>
|
||||
<year>2010</year>
|
||||
<!-- Developed by XYZ, author: mosesu -->
|
||||
<publisher><homebrew></publisher>
|
||||
<info name="alt_title" value="ムーンレイダース"/>
|
||||
|
||||
<part name="cart" interface="pc6001_cart">
|
||||
<dataarea name="rom" size="16106">
|
||||
<rom name="moon raiders.bin" size="16106" crc="997a98ce" sha1="3b79342d24b87af70e9c4d3ad112153c6c02045a" status="baddump"/>
|
||||
</dataarea>
|
||||
</part>
|
||||
</software>
|
||||
|
||||
<!-- Too slow during gameplay -->
|
||||
<software name="dawnpat" supported="no">
|
||||
<!-- VZ200 port -->
|
||||
<description>Dawn Patrol (beta)</description>
|
||||
<year>2012</year>
|
||||
<!-- Developed by fuzzballj -->
|
||||
<publisher><homebrew></publisher>
|
||||
<part name="cart" interface="pc6001_cart">
|
||||
<dataarea name="rom" size="11829">
|
||||
<rom name="dawn.bin" size="11829" crc="17f5a534" sha1="bd2a1bb78ae25e4f0f189bdcb963ba8e4038228d" status="baddump"/>
|
||||
</dataarea>
|
||||
</part>
|
||||
</software>
|
||||
|
||||
<!-- Operating Systems -->
|
||||
|
||||
<!-- TODO: checkout which extra commands it introduces -->
|
||||
<software name="n60basic">
|
||||
<description>N60 Extended BASIC</description>
|
||||
<year>1981</year>
|
||||
<publisher>NEC / Microsoft</publisher>
|
||||
<part name="cart" interface="pc6001_cart">
|
||||
<dataarea name="rom" size="8192">
|
||||
<rom name="[os] n60 extended basic.bin" size="8192" crc="26a33482" sha1="9034860224856033717a6d1157b469e61ff4467a"/>
|
||||
</dataarea>
|
||||
</part>
|
||||
</software>
|
||||
|
||||
<!-- Utilities -->
|
||||
|
||||
<!-- TODO: how to actually draw? Missing key? -->
|
||||
<software name="micropai" supported="no">
|
||||
<!-- Stylized with double hyphen in the middle on title screen -->
|
||||
<description>Micro-Painter</description>
|
||||
<year>1982</year>
|
||||
<publisher>Datasoft</publisher>
|
||||
<!-- author: James Garon -->
|
||||
<part name="cart" interface="pc6001_cart">
|
||||
<dataarea name="rom" size="8192">
|
||||
<rom name="[utility] micro-painter.bin" size="8192" crc="95537612" sha1="2c75af086e57f4cdf68d6349505d6cfe13a0c510"/>
|
||||
</dataarea>
|
||||
</part>
|
||||
</software>
|
||||
|
||||
<!-- Doesn't boot -->
|
||||
<software name="musedit" supported="no">
|
||||
<description>Music Editor</description>
|
||||
<year>19??</year>
|
||||
<publisher><unknown></publisher>
|
||||
<part name="cart" interface="pc6001_cart">
|
||||
<dataarea name="rom" size="8192">
|
||||
<rom name="[utility] music editor.bin" size="8192" crc="5bad1bca" sha1="1b41fc82f9b59c30fadb8d40d326145dd76a0bd2"/>
|
||||
</dataarea>
|
||||
</part>
|
||||
</software>
|
||||
|
||||
<!-- TODO: not sure what this is supposed to do -->
|
||||
<software name="electpen">
|
||||
<description>The Electric Pencil (v2.0R)</description>
|
||||
<year>1982</year>
|
||||
<publisher>Racet Computes</publisher>
|
||||
<part name="cart" interface="pc6001_cart">
|
||||
<dataarea name="rom" size="16384">
|
||||
<rom name="[utility] the electric pencil (32kb).bin" size="16384" crc="31237eb5" sha1="7a46de43d30f5f5d05cc99bd1159d3a00238cf90"/>
|
||||
</dataarea>
|
||||
</part>
|
||||
</software>
|
||||
|
||||
<!-- White screen, pings AY8910 registers with custom writes -->
|
||||
<software name="touchpan" supported="no">
|
||||
<description>Touch Panel Utility</description>
|
||||
<year>19??</year>
|
||||
<publisher><unknown></publisher>
|
||||
<part name="cart" interface="pc6001_cart">
|
||||
<dataarea name="rom" size="4096">
|
||||
<rom name="[Utility] Touch Panel (ROM cart).bin" size="4096" crc="50a31175" sha1="9c18b6fad8acdd438d63b144a21c4405e7ae8f15"/>
|
||||
</dataarea>
|
||||
</part>
|
||||
</software>
|
||||
</softwarelist>
|
File diff suppressed because it is too large
Load Diff
@ -8,8 +8,6 @@
|
||||
|
||||
TODO:
|
||||
- implement proper i8214 routing, and add irq latch mechanism;
|
||||
- Fix up Floppy Terminal Count 0 / 1 writes properly, Castle Excellent (and presumably other
|
||||
games) is very picky about it.
|
||||
- implement proper upd3301 / i8257 text support (currently hacked around);
|
||||
- Add limits for extend work RAM;
|
||||
- waitstates;
|
||||
@ -18,7 +16,7 @@
|
||||
- refactor memory banking to use address maps;
|
||||
- video;
|
||||
- double check dipswitches;
|
||||
- move PC80S31K to device, needed by PC-6601SR, PC-88VA, (vanilla & optional) PC-9801.
|
||||
- move PC80S31K to device, needed by PC-6601SR, PC-88VA, (vanilla & optional) PC-9801. (in progress)
|
||||
Also notice that there are common points with SPC-1000 and TF-20 FDDs;
|
||||
- backport/merge what is portable to PC-8001;
|
||||
- implement bus slot mechanism for NEC boards ("PC-8800-**"), HAL PCG-8100 & GSX8800,
|
||||
|
@ -7,13 +7,19 @@
|
||||
|
||||
|
||||
#include "cpu/z80/z80.h"
|
||||
#include "formats/dsk_dsk.h"
|
||||
#include "formats/msx_dsk.h"
|
||||
#include "imagedev/cassette.h"
|
||||
#include "imagedev/floppy.h"
|
||||
#include "machine/bankdev.h"
|
||||
#include "machine/i8251.h"
|
||||
#include "machine/i8255.h"
|
||||
#include "machine/pc80s31k.h"
|
||||
#include "machine/timer.h"
|
||||
#include "machine/upd765.h"
|
||||
#include "sound/ay8910.h"
|
||||
#include "sound/upd7752.h"
|
||||
//#include "sound/ymopn.h"
|
||||
#include "sound/ymopn.h"
|
||||
#include "video/mc6847.h"
|
||||
|
||||
#include "bus/generic/slot.h"
|
||||
@ -28,24 +34,26 @@
|
||||
class pc6001_state : public driver_device
|
||||
{
|
||||
public:
|
||||
pc6001_state(const machine_config &mconfig, device_type type, const char *tag) :
|
||||
driver_device(mconfig, type, tag),
|
||||
m_ppi(*this, "ppi8255"),
|
||||
m_ram(*this, "ram"),
|
||||
m_maincpu(*this, "maincpu"),
|
||||
m_screen(*this, "screen"),
|
||||
m_cassette(*this, "cassette"),
|
||||
m_cas_hack(*this, "cas_hack"),
|
||||
m_cart(*this, "cartslot"),
|
||||
m_region_maincpu(*this, "maincpu"),
|
||||
m_region_gfx1(*this, "gfx1"),
|
||||
m_io_mode4_dsw(*this, "MODE4_DSW"),
|
||||
m_io_p1(*this, "P1"),
|
||||
m_io_p2(*this, "P2"),
|
||||
m_io_keys(*this, "key%u", 1U),
|
||||
m_io_key_modifiers(*this, "key_modifiers"),
|
||||
m_bank1(*this, "bank1"),
|
||||
m_palette(*this, "palette")
|
||||
pc6001_state(const machine_config &mconfig, device_type type, const char *tag)
|
||||
: driver_device(mconfig, type, tag)
|
||||
, m_ppi(*this, "ppi8255")
|
||||
, m_ram(*this, "ram")
|
||||
, m_maincpu(*this, "maincpu")
|
||||
, m_screen(*this, "screen")
|
||||
, m_cassette(*this, "cassette")
|
||||
, m_cas_hack(*this, "cas_hack")
|
||||
, m_cart(*this, "cartslot")
|
||||
, m_ay(*this, "aysnd")
|
||||
, m_region_maincpu(*this, "maincpu")
|
||||
, m_region_gfx1(*this, "gfx1")
|
||||
, m_io_mode4_dsw(*this, "MODE4_DSW")
|
||||
, m_io_p1(*this, "P1")
|
||||
, m_io_p2(*this, "P2")
|
||||
, m_io_keys(*this, "key%u", 1U)
|
||||
, m_io_fn_keys(*this, "key_fn")
|
||||
, m_io_key_modifiers(*this, "key_modifiers")
|
||||
, m_bank1(*this, "bank1")
|
||||
, m_palette(*this, "palette")
|
||||
{ }
|
||||
|
||||
void system_latch_w(uint8_t data);
|
||||
@ -54,10 +62,11 @@ public:
|
||||
|
||||
void pc6001_palette(palette_device &palette) const;
|
||||
|
||||
uint32_t screen_update_pc6001(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
|
||||
virtual uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
|
||||
|
||||
INTERRUPT_GEN_MEMBER(vrtc_irq);
|
||||
// INTERRUPT_GEN_MEMBER(vrtc_irq);
|
||||
TIMER_CALLBACK_MEMBER(audio_callback);
|
||||
TIMER_CALLBACK_MEMBER(sub_trig_callback);
|
||||
TIMER_DEVICE_CALLBACK_MEMBER(cassette_callback);
|
||||
TIMER_DEVICE_CALLBACK_MEMBER(keyboard_callback);
|
||||
|
||||
@ -68,11 +77,7 @@ public:
|
||||
void ppi_portc_w(uint8_t data);
|
||||
uint8_t ppi_portc_r();
|
||||
|
||||
IRQ_CALLBACK_MEMBER(irq_callback);
|
||||
|
||||
void pc6001(machine_config &config);
|
||||
void pc6001_io(address_map &map);
|
||||
void pc6001_map(address_map &map);
|
||||
protected:
|
||||
required_device<i8255_device> m_ppi;
|
||||
optional_shared_ptr<uint8_t> m_ram;
|
||||
@ -81,14 +86,16 @@ protected:
|
||||
optional_device<cassette_image_device> m_cassette;
|
||||
optional_device<generic_slot_device> m_cas_hack;
|
||||
required_device<generic_slot_device> m_cart;
|
||||
required_memory_region m_region_maincpu;
|
||||
optional_device<ay8910_device> m_ay;
|
||||
optional_memory_region m_region_maincpu;
|
||||
required_memory_region m_region_gfx1;
|
||||
required_ioport m_io_mode4_dsw;
|
||||
required_ioport m_io_p1;
|
||||
required_ioport m_io_p2;
|
||||
required_ioport_array<3> m_io_keys;
|
||||
required_ioport m_io_fn_keys;
|
||||
required_ioport m_io_key_modifiers;
|
||||
required_memory_bank m_bank1;
|
||||
optional_memory_bank m_bank1;
|
||||
required_device<palette_device> m_palette;
|
||||
|
||||
memory_region *m_cart_rom;
|
||||
@ -97,16 +104,24 @@ protected:
|
||||
|
||||
virtual void machine_start() override;
|
||||
virtual void machine_reset() override;
|
||||
|
||||
void default_cartridge_reset();
|
||||
void default_cassette_hack_reset();
|
||||
void default_keyboard_hle_reset();
|
||||
void irq_reset(u8 timer_default_setting);
|
||||
|
||||
virtual void video_start() override;
|
||||
|
||||
void pc6001_map(address_map &map);
|
||||
void pc6001_io(address_map &map);
|
||||
|
||||
// i/o functions
|
||||
uint8_t check_joy_press();
|
||||
uint8_t check_keyboard_press();
|
||||
inline void cassette_latch_control(bool new_state);
|
||||
inline void ppi_control_hack_w(uint8_t data);
|
||||
inline void set_timer_divider(uint8_t data);
|
||||
inline void set_timer_divider();
|
||||
inline void set_videoram_bank(uint32_t offs);
|
||||
inline void set_maincpu_irq_line(uint8_t vector_num);
|
||||
|
||||
// video functions
|
||||
void draw_gfx_mode4(bitmap_ind16 &bitmap,const rectangle &cliprect,int attr);
|
||||
@ -119,14 +134,13 @@ protected:
|
||||
emu_timer *m_timer_irq_timer;
|
||||
uint8_t *m_video_base;
|
||||
std::unique_ptr<uint8_t[]> m_video_ram;
|
||||
uint8_t m_irq_vector;
|
||||
uint8_t m_cas_switch;
|
||||
uint8_t m_sys_latch;
|
||||
uint32_t m_cas_offset;
|
||||
uint32_t m_cas_maxsize;
|
||||
uint8_t m_bank_opt;
|
||||
uint8_t m_timer_irq_mask;
|
||||
uint8_t m_timer_irq_mask2;
|
||||
bool m_timer_enable;
|
||||
bool m_timer_irq_mask;
|
||||
uint8_t m_port_c_8255;
|
||||
uint8_t m_cur_keycode;
|
||||
|
||||
@ -134,22 +148,52 @@ private:
|
||||
uint32_t m_old_key1;
|
||||
uint32_t m_old_key2;
|
||||
uint32_t m_old_key3;
|
||||
u8 m_old_key_fn;
|
||||
|
||||
emu_timer *m_sub_trig_timer;
|
||||
|
||||
// IRQ model
|
||||
protected:
|
||||
// vanilla PC-6001 just maps sub CPU and Timer IRQs, mapping is otherwise confirmed by $b8-$bf vector setups in SR machines
|
||||
enum{
|
||||
SUB_CPU_IRQ = 0,
|
||||
JOYSTICK_IRQ,
|
||||
TIMER_IRQ,
|
||||
VOICE_IRQ,
|
||||
VRTC_IRQ,
|
||||
RS232_IRQ,
|
||||
PRINTER_IRQ,
|
||||
EXT_IRQ
|
||||
};
|
||||
|
||||
u8 timer_ack();
|
||||
u8 joystick_ack();
|
||||
u8 sub_ack();
|
||||
virtual u8 vrtc_ack();
|
||||
void set_irq_level(int which);
|
||||
void set_subcpu_irq_vector(u8 vector_num);
|
||||
IRQ_CALLBACK_MEMBER(irq_callback);
|
||||
|
||||
virtual u8 get_timer_base_divider();
|
||||
|
||||
private:
|
||||
u8 m_irq_pending;
|
||||
u8 m_sub_vector;
|
||||
};
|
||||
|
||||
|
||||
class pc6001mk2_state : public pc6001_state
|
||||
{
|
||||
public:
|
||||
pc6001mk2_state(const machine_config &mconfig, device_type type, const char *tag) :
|
||||
pc6001_state(mconfig, type, tag),
|
||||
m_bank2(*this, "bank2"),
|
||||
m_bank3(*this, "bank3"),
|
||||
m_bank4(*this, "bank4"),
|
||||
m_bank5(*this, "bank5"),
|
||||
m_bank6(*this, "bank6"),
|
||||
m_bank7(*this, "bank7"),
|
||||
m_bank8(*this, "bank8")
|
||||
pc6001mk2_state(const machine_config &mconfig, device_type type, const char *tag)
|
||||
: pc6001_state(mconfig, type, tag)
|
||||
, m_bank2(*this, "bank2")
|
||||
, m_bank3(*this, "bank3")
|
||||
, m_bank4(*this, "bank4")
|
||||
, m_bank5(*this, "bank5")
|
||||
, m_bank6(*this, "bank6")
|
||||
, m_bank7(*this, "bank7")
|
||||
, m_bank8(*this, "bank8")
|
||||
{ }
|
||||
|
||||
uint8_t mk2_bank_r0_r();
|
||||
@ -178,25 +222,28 @@ public:
|
||||
void pc6001mk2_palette(palette_device &palette) const;
|
||||
void pc6001mk2(machine_config &config);
|
||||
|
||||
uint32_t screen_update_pc6001mk2(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
|
||||
virtual uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) override;
|
||||
|
||||
void pc6001mk2_io(address_map &map);
|
||||
void pc6001mk2_map(address_map &map);
|
||||
protected:
|
||||
void pc6001mk2_map(address_map &map);
|
||||
void pc6001mk2_io(address_map &map);
|
||||
|
||||
uint8_t m_bgcol_bank;
|
||||
uint8_t m_gfx_bank_on;
|
||||
required_memory_bank m_bank2;
|
||||
required_memory_bank m_bank3;
|
||||
required_memory_bank m_bank4;
|
||||
required_memory_bank m_bank5;
|
||||
required_memory_bank m_bank6;
|
||||
required_memory_bank m_bank7;
|
||||
required_memory_bank m_bank8;
|
||||
inline void refresh_crtc_params();
|
||||
optional_memory_bank m_bank2;
|
||||
optional_memory_bank m_bank3;
|
||||
optional_memory_bank m_bank4;
|
||||
optional_memory_bank m_bank5;
|
||||
optional_memory_bank m_bank6;
|
||||
optional_memory_bank m_bank7;
|
||||
optional_memory_bank m_bank8;
|
||||
virtual void refresh_crtc_params();
|
||||
|
||||
virtual void video_start() override;
|
||||
virtual void machine_reset() override;
|
||||
|
||||
virtual u8 vrtc_ack() override;
|
||||
|
||||
private:
|
||||
uint8_t m_bank_r0;
|
||||
uint8_t m_bank_r1;
|
||||
@ -213,79 +260,113 @@ private:
|
||||
class pc6601_state : public pc6001mk2_state
|
||||
{
|
||||
public:
|
||||
pc6601_state(const machine_config &mconfig, device_type type, const char *tag) :
|
||||
pc6001mk2_state(mconfig, type, tag)
|
||||
pc6601_state(const machine_config &mconfig, device_type type, const char *tag)
|
||||
: pc6001mk2_state(mconfig, type, tag)
|
||||
, m_fdc(*this, "fdc")
|
||||
, m_floppy(*this, "fdc:0")
|
||||
, m_pc80s31(*this, "pc80s31")
|
||||
, m_fdc_intf_view(*this, "fdc_intf")
|
||||
{ }
|
||||
|
||||
uint8_t fdc_r();
|
||||
void fdc_w(uint8_t data);
|
||||
|
||||
void pc6601(machine_config &config);
|
||||
|
||||
protected:
|
||||
virtual void machine_start() override;
|
||||
|
||||
void pc6601_io(address_map &map);
|
||||
|
||||
void pc6601_fdc_io(address_map &map);
|
||||
void pc6601_fdc_config(machine_config &config);
|
||||
static void floppy_formats(format_registration &fr);
|
||||
|
||||
required_device<upd765a_device> m_fdc;
|
||||
required_device<floppy_connector> m_floppy;
|
||||
required_device<pc80s31_device> m_pc80s31;
|
||||
memory_view m_fdc_intf_view;
|
||||
|
||||
u8 fdc_mon_r();
|
||||
void fdc_mon_w(u8 data);
|
||||
void fdc_sel_w(u8 data);
|
||||
};
|
||||
|
||||
class pc6001sr_state : public pc6601_state
|
||||
class pc6001mk2sr_state : public pc6601_state
|
||||
{
|
||||
public:
|
||||
pc6001sr_state(const machine_config &mconfig, device_type type, const char *tag) :
|
||||
pc6601_state(mconfig, type, tag),
|
||||
m_sr_irq_vectors(*this, "irq_vectors")
|
||||
pc6001mk2sr_state(const machine_config &mconfig, device_type type, const char *tag)
|
||||
: pc6601_state(mconfig, type, tag)
|
||||
, m_sr_bank(*this, "sr_bank_%u", 1U)
|
||||
, m_sr_irq_vectors(*this, "irq_vectors")
|
||||
// , m_gvram_view(*this, "gvram_view")
|
||||
, m_sr_scrollx(*this, "sr_scrollx")
|
||||
, m_sr_scrolly(*this, "sr_scrolly")
|
||||
, m_ym(*this, "ymsnd")
|
||||
{ }
|
||||
|
||||
void pc6001sr(machine_config &config);
|
||||
void pc6001mk2sr(machine_config &config);
|
||||
|
||||
protected:
|
||||
virtual void video_start() override;
|
||||
virtual void machine_reset() override;
|
||||
|
||||
void pc6001mk2sr_map(address_map &map);
|
||||
void sr_banked_map(address_map &map);
|
||||
void pc6001mk2sr_io(address_map &map);
|
||||
|
||||
virtual u8 vrtc_ack() override;
|
||||
virtual u8 get_timer_base_divider() override;
|
||||
|
||||
private:
|
||||
uint8_t m_sr_bank_r[8];
|
||||
uint8_t m_sr_bank_w[8];
|
||||
uint8_t m_kludge;
|
||||
required_device_array<address_map_bank_device, 16> m_sr_bank;
|
||||
required_shared_ptr<u8> m_sr_irq_vectors;
|
||||
required_shared_ptr<u8> m_sr_scrollx;
|
||||
required_shared_ptr<u8> m_sr_scrolly;
|
||||
required_device<ym2203_device> m_ym;
|
||||
|
||||
u8 m_sr_bank_reg[16];
|
||||
bool m_sr_text_mode;
|
||||
uint8_t m_sr_text_rows;
|
||||
std::unique_ptr<uint8_t []> m_gvram;
|
||||
uint8_t m_bitmap_yoffs,m_bitmap_xoffs;
|
||||
u8 m_sr_text_rows;
|
||||
std::unique_ptr<u8 []> m_gvram;
|
||||
u8 m_bitmap_yoffs, m_bitmap_xoffs;
|
||||
u8 m_width80;
|
||||
|
||||
enum{
|
||||
SUB_CPU_IRQ = 0,
|
||||
JOYSTICK_IRQ,
|
||||
TIMER_IRQ,
|
||||
VOICE_IRQ,
|
||||
VRTC_IRQ,
|
||||
RS232_IRQ,
|
||||
PRINTER_IRQ,
|
||||
EXT_IRQ
|
||||
};
|
||||
// memory_view m_gvram_view;
|
||||
|
||||
required_shared_ptr<uint8_t> m_sr_irq_vectors;
|
||||
virtual u8 hw_rev_r();
|
||||
u8 sr_bank_reg_r(offs_t offset);
|
||||
void sr_bank_reg_w(offs_t offset, u8 data);
|
||||
|
||||
uint8_t hw_rev_r();
|
||||
uint8_t sr_bank_rn_r(offs_t offset);
|
||||
void sr_bank_rn_w(offs_t offset, uint8_t data);
|
||||
uint8_t sr_bank_wn_r(offs_t offset);
|
||||
void sr_bank_wn_w(offs_t offset, uint8_t data);
|
||||
void sr_work_ram0_w(offs_t offset, uint8_t data);
|
||||
void sr_work_ram1_w(offs_t offset, uint8_t data);
|
||||
void sr_work_ram2_w(offs_t offset, uint8_t data);
|
||||
void sr_work_ram3_w(offs_t offset, uint8_t data);
|
||||
void sr_work_ram4_w(offs_t offset, uint8_t data);
|
||||
void sr_work_ram5_w(offs_t offset, uint8_t data);
|
||||
void sr_work_ram6_w(offs_t offset, uint8_t data);
|
||||
void sr_work_ram7_w(offs_t offset, uint8_t data);
|
||||
void sr_mode_w(uint8_t data);
|
||||
void sr_vram_bank_w(uint8_t data);
|
||||
void sr_system_latch_w(uint8_t data);
|
||||
void necsr_ppi8255_w(offs_t offset, uint8_t data);
|
||||
void sr_bitmap_yoffs_w(uint8_t data);
|
||||
void sr_bitmap_xoffs_w(uint8_t data);
|
||||
void sr_mode_w(u8 data);
|
||||
void sr_vram_bank_w(u8 data);
|
||||
void sr_system_latch_w(u8 data);
|
||||
void necsr_ppi8255_w(offs_t offset, u8 data);
|
||||
|
||||
virtual void refresh_crtc_params() override;
|
||||
void sr_bitmap_yoffs_w(u8 data);
|
||||
void sr_bitmap_xoffs_w(u8 data);
|
||||
void refresh_gvram_access(bool is_write);
|
||||
u8 work_ram_r(offs_t offset);
|
||||
void work_ram_w(offs_t offset, u8 data);
|
||||
u8 sr_gvram_r(offs_t offset);
|
||||
void sr_gvram_w(offs_t offset, u8 data);
|
||||
void crt_mode_w(u8 data);
|
||||
|
||||
INTERRUPT_GEN_MEMBER(sr_vrtc_irq);
|
||||
|
||||
uint32_t screen_update_pc6001sr(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
|
||||
virtual uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) override;
|
||||
|
||||
void pc6001sr_io(address_map &map);
|
||||
void pc6001sr_map(address_map &map);
|
||||
};
|
||||
|
||||
class pc6601sr_state : public pc6001mk2sr_state
|
||||
{
|
||||
public:
|
||||
pc6601sr_state(const machine_config &mconfig, device_type type, const char *tag)
|
||||
: pc6001mk2sr_state(mconfig, type, tag)
|
||||
{ }
|
||||
|
||||
void pc6601sr(machine_config &config);
|
||||
|
||||
private:
|
||||
virtual u8 hw_rev_r() override;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -33853,8 +33853,9 @@ pc4 //
|
||||
pc6001 //
|
||||
pc6001a //
|
||||
pc6001mk2 //
|
||||
pc6001sr //
|
||||
pc6601 //
|
||||
pc6001mk2sr //
|
||||
pc6601sr //
|
||||
|
||||
@source:pc8001.cpp
|
||||
pc8001 // 1979
|
||||
|
@ -126,7 +126,7 @@ void pc6001mk2_state::video_start()
|
||||
// ...
|
||||
}
|
||||
|
||||
void pc6001sr_state::video_start()
|
||||
void pc6001mk2sr_state::video_start()
|
||||
{
|
||||
// m_video_ram = std::make_unique<uint8_t[]>(0x4000);
|
||||
m_gvram = std::make_unique<uint8_t []>(320*256*8); // TODO: size
|
||||
@ -134,7 +134,6 @@ void pc6001sr_state::video_start()
|
||||
save_pointer(NAME(m_gvram), 320*256*8);
|
||||
}
|
||||
|
||||
/* this is known as gfx mode 4 */
|
||||
void pc6001_state::draw_gfx_mode4(bitmap_ind16 &bitmap,const rectangle &cliprect,int attr)
|
||||
{
|
||||
static const uint8_t pen_gattr[4][4] = {
|
||||
@ -291,7 +290,6 @@ void pc6001_state::draw_tile_text(bitmap_ind16 &bitmap,const rectangle &cliprect
|
||||
color = pen ? (fgcol+0) : (fgcol+1);
|
||||
else
|
||||
color = pen ? (fgcol+1) : (fgcol+0);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -368,14 +366,14 @@ void pc6001_state::pc6001_screen_draw(bitmap_ind16 &bitmap,const rectangle &clip
|
||||
}
|
||||
}
|
||||
|
||||
uint32_t pc6001_state::screen_update_pc6001(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
|
||||
uint32_t pc6001_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
|
||||
{
|
||||
pc6001_screen_draw(bitmap,cliprect,1);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint32_t pc6001mk2_state::screen_update_pc6001mk2(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
|
||||
uint32_t pc6001mk2_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
|
||||
{
|
||||
/* note: bitmap mode have priority over everything else, check American Truck */
|
||||
if(m_exgfx_bitmap_mode)
|
||||
@ -510,7 +508,7 @@ uint32_t pc6001mk2_state::screen_update_pc6001mk2(screen_device &screen, bitmap_
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint32_t pc6001sr_state::screen_update_pc6001sr(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
|
||||
uint32_t pc6001mk2sr_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
|
||||
{
|
||||
uint8_t const *const gfx_data = m_region_gfx1->base();
|
||||
|
||||
@ -518,54 +516,69 @@ uint32_t pc6001sr_state::screen_update_pc6001sr(screen_device &screen, bitmap_in
|
||||
|
||||
if(m_sr_text_mode == true) // text mode
|
||||
{
|
||||
for(int y=0;y<m_sr_text_rows;y++)
|
||||
const u8 text_cols = (m_width80 + 1) * 40;
|
||||
|
||||
for(int y = 0; y < m_sr_text_rows; y++)
|
||||
{
|
||||
for(int x=0;x<40;x++)
|
||||
for(int x = 0; x < text_cols; x++)
|
||||
{
|
||||
int tile = m_video_base[(x+(y*40))*2+0];
|
||||
int attr = m_video_base[(x+(y*40))*2+1];
|
||||
int tile = m_video_base[(x + (y * text_cols)) * 2 + 0];
|
||||
int attr = m_video_base[(x + (y * text_cols)) * 2 + 1];
|
||||
tile += ((attr & 0x80) << 1);
|
||||
|
||||
for(int yi=0;yi<12;yi++)
|
||||
for(int yi = 0; yi < 12; yi++)
|
||||
{
|
||||
for(int xi=0;xi<8;xi++)
|
||||
int res_y = y * 12 + yi;
|
||||
|
||||
for(int xi = 0; xi < 8; xi++)
|
||||
{
|
||||
int pen = gfx_data[(tile*0x10)+yi]>>(7-xi) & 1;
|
||||
int res_x = x * 8 + xi;
|
||||
|
||||
int pen = gfx_data[(tile * 0x10) + yi] >> (7 - xi) & 1;
|
||||
|
||||
int fgcol = (attr & 0x0f) + 0x10;
|
||||
int bgcol = ((attr & 0x70) >> 4) + 0x10 + ((m_bgcol_bank & 2) << 2);
|
||||
// TODO: definitely wants bright colors for N66SR BASIC, but quite won't work for "PC-6*01 World" screens
|
||||
// (can't pinpoint banking on this HW, or maybe it's side effect of CLUT?)
|
||||
int bgcol = ((attr & 0x70) >> 4) + 0x18; //+ m_bgcol_bank;
|
||||
|
||||
int color = pen ? fgcol : bgcol;
|
||||
|
||||
if (cliprect.contains(x*8+xi, y*12+yi))
|
||||
bitmap.pix(((y*12+yi)), (x*8+xi)) = m_palette->pen(color);
|
||||
if (cliprect.contains(res_x, res_y))
|
||||
bitmap.pix(res_y, res_x) = m_palette->pen(color);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else //4bpp bitmap mode (TODO)
|
||||
else
|
||||
{
|
||||
for(int y=0;y<200;y++)
|
||||
//4bpp bitmap mode
|
||||
const u32 scroll_x = (m_sr_scrollx[0]) + (m_sr_scrollx[1] << 8);
|
||||
const u32 scroll_y = m_sr_scrolly[0];
|
||||
const int x_pitch = 320;
|
||||
const int y_pitch = 204;
|
||||
|
||||
//popmessage("%04x %02x", scroll_x, scroll_y);
|
||||
|
||||
for(int y = cliprect.min_y; y <= cliprect.max_y; y++)
|
||||
{
|
||||
for(int x=0;x<320;x+=2)
|
||||
for(int x = cliprect.min_x; x <= cliprect.max_x; x++)
|
||||
{
|
||||
uint32_t vram_addr;
|
||||
|
||||
if(x >= 256)
|
||||
vram_addr = 0x1a00 + (x-256)+y*64;
|
||||
else
|
||||
vram_addr = x+y*256;
|
||||
// The Jp emulators maps this for the rightmost X > 256, but it doesn't seem to be the case?
|
||||
// vram_addr = 0x1a00 + (x-256)+y*64;
|
||||
|
||||
int color;
|
||||
// TODO: scrolling is preliminary, based off how Pakuridius sets VRAM and scroll regs
|
||||
// It seems to wraparound at 320x204
|
||||
// Title screen scrolling usage is quite jerky, but it sorta makes sense on gameplay ...
|
||||
vram_addr = ((x + scroll_x) % x_pitch) + ((y + scroll_y) % y_pitch) * x_pitch;
|
||||
|
||||
color = (m_gvram[vram_addr] & 0xf0) >> 4;
|
||||
if (cliprect.contains(x, y+0))
|
||||
bitmap.pix((y+0), (x+0)) = m_palette->pen(color+0x10);
|
||||
|
||||
color = (m_gvram[vram_addr] & 0x0f);
|
||||
if (cliprect.contains(x+1, y+0))
|
||||
bitmap.pix((y+0), (x+1)) = m_palette->pen(color+0x10);
|
||||
// wants RGB -> BRG rotation
|
||||
// (is it using a different palette bank?)
|
||||
u8 color = bitswap<4>(m_gvram[vram_addr] & 0x0f, 3, 0, 2, 1) + 0x10;
|
||||
if (cliprect.contains(x, y))
|
||||
bitmap.pix(y, x) = m_palette->pen(color);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user