Skip to content

Commit

Permalink
address feedback from Angelo Salese
Browse files Browse the repository at this point in the history
  • Loading branch information
felipesanches committed Jan 1, 2024
1 parent 1a01834 commit fb40164
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 46 deletions.
2 changes: 2 additions & 0 deletions src/devices/bus/technics/hdae5000.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ namespace {
class hdae5000_device : public device_t, public kn5000_extension_interface
{
public:
static constexpr feature_type unemulated_features() { return feature::DISK | feature::SOUND; }

hdae5000_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);

virtual void rom_map(address_map &map) override;
Expand Down
50 changes: 24 additions & 26 deletions src/mame/technics/kn1500.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,14 @@ class kn1500_state : public driver_device
required_device<upd765a_device> m_fdc;
required_device<hd44780_device> m_lcdc;

HD44780_PIXEL_UPDATE(kn1500_pixel_update);
void kn1500_palette(palette_device &palette) const;
void kn1500_tlcs900_porta_w(offs_t offset, uint8_t data);
void kn1500_tlcs900_portb_w(offs_t offset, uint8_t data);
void kn1500_tlcs900_port5_w(offs_t offset, uint8_t data);
void kn1500_tlcs900_port6_w(offs_t offset, uint8_t data);
void kn1500_tlcs900_port7_w(offs_t offset, uint8_t data);
void kn1500_mem(address_map &map);
HD44780_PIXEL_UPDATE(pixel_update);
void palette_init(palette_device &palette) const;
void maincpu_porta_w(offs_t offset, uint8_t data);
void maincpu_portb_w(offs_t offset, uint8_t data);
void maincpu_port5_w(offs_t offset, uint8_t data);
void maincpu_port6_w(offs_t offset, uint8_t data);
void maincpu_port7_w(offs_t offset, uint8_t data);
void maincpu_mem(address_map &map);
uint16_t dsp_lcd_r(offs_t offset);
void dsp_lcd_w(offs_t offset, uint16_t data);
uint16_t tone_generator_r(offs_t offset);
Expand All @@ -59,7 +59,7 @@ class kn1500_state : public driver_device
uint8_t m_dsp_lcd_byte; // latch for data sent to DSP or Liquid Crystal
};

void kn1500_state::kn1500_mem(address_map &map)
void kn1500_state::maincpu_mem(address_map &map)
{
map(0x000000, 0x77ffff).ram(); //~CS3: MSAR3=00 MAMR3=0f
// map(0x000080, 0x07ffff).ram(); //~CS3: MSAR3=00 MAMR3=0f
Expand All @@ -80,8 +80,6 @@ void kn1500_state::kn1500_mem(address_map &map)
//[:maincpu] ':maincpu' (FA049F): unmapped program memory write to DFF83A = 3200 & FF00
//[:maincpu] ':maincpu' (FA0484): unmapped program memory write to DFF83C = 005A & 00FF
//[:maincpu] ':maincpu' (FA048F): unmapped program memory write to DFF83C = 0000 & 00FF


}

static void kn1500_floppies(device_slot_interface &device)
Expand All @@ -102,15 +100,15 @@ static INPUT_PORTS_START(kn1500)
INPUT_PORTS_END


void kn1500_state::kn1500_tlcs900_porta_w(offs_t offset, uint8_t data)
void kn1500_state::maincpu_porta_w(offs_t offset, uint8_t data)
{
//int DSPRDY = BIT(data, 1);
//int ? = BIT(data, 2);
//int FDMOT = BIT(data, 3);
}


void kn1500_state::kn1500_tlcs900_portb_w(offs_t offset, uint8_t data)
void kn1500_state::maincpu_portb_w(offs_t offset, uint8_t data)
{
//int ? = BIT(data, 0);
//int FDINT = BIT(data, 1);
Expand All @@ -122,19 +120,19 @@ void kn1500_state::kn1500_tlcs900_portb_w(offs_t offset, uint8_t data)
//int ? = BIT(data, 7);
}

void kn1500_state::kn1500_tlcs900_port5_w(offs_t offset, uint8_t data)
void kn1500_state::maincpu_port5_w(offs_t offset, uint8_t data)
{
logerror("port5_w: %02X\n", data);
m_mute = BIT(data, 3);
}

void kn1500_state::kn1500_tlcs900_port6_w(offs_t offset, uint8_t data)
void kn1500_state::maincpu_port6_w(offs_t offset, uint8_t data)
{
logerror("port6_w: %02X\n", data);
m_nreset = BIT(data, 5);
}

void kn1500_state::kn1500_tlcs900_port7_w(offs_t offset, uint8_t data)
void kn1500_state::maincpu_port7_w(offs_t offset, uint8_t data)
{
uint8_t value;
logerror("port7_w (LCD/DSP): %02X\n", data);
Expand Down Expand Up @@ -196,7 +194,7 @@ void kn1500_state::tone_generator_w(offs_t offset, uint16_t data){
}


void kn1500_state::kn1500_palette(palette_device &palette) const
void kn1500_state::palette_init(palette_device &palette) const
{
palette.set_pen_color(0, rgb_t(138, 146, 188));
palette.set_pen_color(1, rgb_t(92, 83, 128));
Expand All @@ -217,7 +215,7 @@ static GFXDECODE_START( gfx_kn1500 )
GFXDECODE_ENTRY( "hd44780:cgrom", 0x0000, prot_charlayout, 0, 1 )
GFXDECODE_END

HD44780_PIXEL_UPDATE(kn1500_state::kn1500_pixel_update)
HD44780_PIXEL_UPDATE(kn1500_state::pixel_update)
{
if ( pos < 16 && line==0 )
{
Expand All @@ -234,12 +232,12 @@ void kn1500_state::kn1500(machine_config &config)
{
TMP95C061(config, m_maincpu, 24_MHz_XTAL); // TMP95C061AF
m_maincpu->set_am8_16(0);
m_maincpu->set_addrmap(AS_PROGRAM, &kn1500_state::kn1500_mem);
m_maincpu->porta_write().set(FUNC(kn1500_state::kn1500_tlcs900_porta_w));
m_maincpu->portb_write().set(FUNC(kn1500_state::kn1500_tlcs900_portb_w));
m_maincpu->port5_write().set(FUNC(kn1500_state::kn1500_tlcs900_port5_w));
m_maincpu->port6_write().set(FUNC(kn1500_state::kn1500_tlcs900_port6_w));
m_maincpu->port7_write().set(FUNC(kn1500_state::kn1500_tlcs900_port7_w));
m_maincpu->set_addrmap(AS_PROGRAM, &kn1500_state::maincpu_mem);
m_maincpu->porta_write().set(FUNC(kn1500_state::maincpu_porta_w));
m_maincpu->portb_write().set(FUNC(kn1500_state::maincpu_portb_w));
m_maincpu->port5_write().set(FUNC(kn1500_state::maincpu_port5_w));
m_maincpu->port6_write().set(FUNC(kn1500_state::maincpu_port6_w));
m_maincpu->port7_write().set(FUNC(kn1500_state::maincpu_port7_w));

UPD765A(config, m_fdc, 24'000'000, true, true); // actual controller is UPD72070GF3BE at IC4
m_fdc->drq_wr_callback().set([this](int state){ m_maincpu->set_input_line(TLCS900_INT7, state); });
Expand All @@ -255,12 +253,12 @@ void kn1500_state::kn1500(machine_config &config)
screen.set_visarea(0, 6*16-1, 0, 9*2-1);
screen.set_palette("palette");

PALETTE(config, "palette", FUNC(kn1500_state::kn1500_palette), 2);
PALETTE(config, "palette", FUNC(kn1500_state::palette_init), 2);
GFXDECODE(config, "gfxdecode", "palette", gfx_kn1500);

HD44780(config, m_lcdc, 250'000); // TODO: clock not measured, datasheet typical clock used
m_lcdc->set_lcd_size(2, 16);
m_lcdc->set_pixel_update_cb(FUNC(kn1500_state::kn1500_pixel_update));
m_lcdc->set_pixel_update_cb(FUNC(kn1500_state::pixel_update));


/* sound hardware */
Expand Down
50 changes: 30 additions & 20 deletions src/mame/technics/kn5000.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class kn5000_state : public driver_device
, m_maincpu(*this, "maincpu")
, m_subcpu(*this, "subcpu")
, m_fdc(*this, "fdc")
, m_CHECKING_DEVICE_LED_CN11(*this, "checking_device_led_cn11")
, m_checking_device_led_cn11(*this, "checking_device_led_cn11")
, m_extension(*this, "extension")
{ }

Expand All @@ -38,17 +38,17 @@ class kn5000_state : public driver_device
required_device<tmp94c241_device> m_maincpu;
required_device<tmp94c241_device> m_subcpu;
required_device<upd72067_device> m_fdc;
required_device<beep_device> m_CHECKING_DEVICE_LED_CN11;
required_device<beep_device> m_checking_device_led_cn11;
required_device<kn5000_extension_device> m_extension;

virtual void machine_reset() override;

// void kn5000_tlcs900_portb_w(offs_t offset, uint8_t data);
// void kn5000_tlcs900_port5_w(offs_t offset, uint8_t data);
// void kn5000_tlcs900_port6_w(offs_t offset, uint8_t data);
// void kn5000_tlcs900_port7_w(offs_t offset, uint8_t data);
void kn5000_maincpu_mem(address_map &map);
void kn5000_subcpu_mem(address_map &map);
// void maincpu_portb_w(offs_t offset, uint8_t data);
// void maincpu_port5_w(offs_t offset, uint8_t data);
// void maincpu_port6_w(offs_t offset, uint8_t data);
// void maincpu_port7_w(offs_t offset, uint8_t data);
void maincpu_mem(address_map &map);
void subcpu_mem(address_map &map);
// uint16_t tone_generator_r(offs_t offset);
// void tone_generator_w(offs_t offset, uint16_t data);
};
Expand All @@ -66,7 +66,7 @@ MSAR5: 0x00 MAMR5: 0xff start: 0x000000 mask: 0x7fffff (8MByte)
CS5: rhythm data at A22=1 (0x400000) (4MB)
*/

void kn5000_state::kn5000_maincpu_mem(address_map &map)
void kn5000_state::maincpu_mem(address_map &map)
{
map(0x000000, 0x0fffff).ram(); // 1Mbyte = 2 * 4Mbit DRAMs @ IC9, IC10 (CS3)
//FIXME: map(0x110000, 0x11ffff).m(m_fdc, FUNC(upd765a_device::map)); // Floppy Controller @ IC208
Expand All @@ -82,7 +82,7 @@ void kn5000_state::kn5000_maincpu_mem(address_map &map)
map(0xe00000, 0xffffff).mask(0x1fffff).rom().region("program", 0); //2 * 8MBit FLASH ROMs @ IC4, IC6
}

void kn5000_state::kn5000_subcpu_mem(address_map &map)
void kn5000_state::subcpu_mem(address_map &map)
{
//map(0x??0000, 0x??ffff).r("to_subcpu_latch", FUNC(generic_latch_8_device::read)); // @ IC22
//map(0x??0000, 0x??ffff).w("to_maincpu_latch", FUNC(generic_latch_8_device::write)); // @ IC23
Expand Down Expand Up @@ -116,19 +116,19 @@ static INPUT_PORTS_START(kn5000)
PORT_DIPSETTING( 0x01, DEF_STR(Off))
INPUT_PORTS_END

//void kn5000_state::kn5000_tlcs900_portb_w(offs_t offset, uint8_t data)
//void kn5000_state::maincpu_portb_w(offs_t offset, uint8_t data)
//{
//}

//void kn5000_state::kn5000_tlcs900_port5_w(offs_t offset, uint8_t data)
//void kn5000_state::maincpu_port5_w(offs_t offset, uint8_t data)
//{
//}

//void kn5000_state::kn5000_tlcs900_port6_w(offs_t offset, uint8_t data)
//void kn5000_state::maincpu_port6_w(offs_t offset, uint8_t data)
//{
//}

//void kn5000_state::kn5000_tlcs900_port7_w(offs_t offset, uint8_t data)
//void kn5000_state::maincpu_port7_w(offs_t offset, uint8_t data)
//{
//}

Expand All @@ -144,14 +144,14 @@ INPUT_PORTS_END
void kn5000_state::machine_reset()
{
/* Setup beep */
m_CHECKING_DEVICE_LED_CN11->set_state(0);
m_checking_device_led_cn11->set_state(0);
}

void kn5000_state::kn5000(machine_config &config)
{
TMP94C241(config, m_maincpu, 8_MHz_XTAL); // TMP94C241F @ IC5
// Address bus is set to 32 bits by the pins AM1=+5v and AM0=GND
m_maincpu->set_addrmap(AS_PROGRAM, &kn5000_state::kn5000_maincpu_mem);
m_maincpu->set_addrmap(AS_PROGRAM, &kn5000_state::maincpu_mem);
// Interrupt 0: CLK on "to_maincpu_latch"
// Interrupt 4: FDCINT
// Interrupt 5: FDCIRQ
Expand All @@ -162,7 +162,7 @@ void kn5000_state::kn5000(machine_config &config)
// ~NMI: SNS
// TC0: FDCTC
//
// m_maincpu->port?_write().set(FUNC(kn5000_state::kn5000_tlcs900_port?_w));
// m_maincpu->port?_write().set(FUNC(kn5000_state::maincpu_port?_w));
//

// PORT 7:
Expand All @@ -180,7 +180,7 @@ void kn5000_state::kn5000(machine_config &config)
// bit 0 (input) = "check terminal" switch
// bit 1 (output) = "check terminal" LED
m_maincpu->portc_read().set([this] { return ioport("CN11")->read(); });
m_maincpu->portc_write().set([this] (u8 data) { m_CHECKING_DEVICE_LED_CN11->set_state(BIT(data, 1) == 0); });
m_maincpu->portc_write().set([this] (u8 data) { m_checking_device_led_cn11->set_state(BIT(data, 1) == 0); });

// PORT D:
// bit 0 (output) = FDCRST
Expand Down Expand Up @@ -232,7 +232,7 @@ void kn5000_state::kn5000(machine_config &config)

TMP94C241(config, m_subcpu, 10_MHz_XTAL); // TMP94C241F @ IC27
// Address bus is set to 8 bits by the pins AM1=GND and AM0=GND
m_subcpu->set_addrmap(AS_PROGRAM, &kn5000_state::kn5000_subcpu_mem);
m_subcpu->set_addrmap(AS_PROGRAM, &kn5000_state::subcpu_mem);
// Interrupt 0: CLK on "to_subcpu_latch"

GENERIC_LATCH_8(config, "to_maincpu_latch"); // @ IC23
Expand Down Expand Up @@ -272,15 +272,25 @@ void kn5000_state::kn5000(machine_config &config)
vga.set_vram_size(0x100000);

// This is a quick hack to beep whenever the checking device LED is on
// (just because I find it easier to quickly use a CHECKING_DEVICE_LED_CN11 here for debugging)
// (just because I find it more convenient to listen to the beeps while debugging the driver)
SPEAKER(config, "mono").front_center();
BEEP(config, "checking_device_led_cn11", 12_MHz_XTAL / 3200).add_route(ALL_OUTPUTS, "mono", 0.05);
}

ROM_START(kn5000)
ROM_REGION16_LE(0x200000, "program" , 0) // main cpu
ROM_DEFAULT_BIOS("v10")

// FIXME: These are actually stored in a couple flash rom chips IC6 (even) and IC4 (odd)
//
// Note: These ROMs were extracted from the system update floppies which were
// compressed using a variant of LZSS. There may still be problems with the
// unpacking of the ROM contents. Especially in the lowest 4kbyte window.
// Once we get a proper dump of the boot rom, we may have a better idea of
// the decompression algorithm and then we may need to update this ROM set.
//
// More info at:
// https://github.com/felipesanches/kn5000_homebrew/blob/main/kn5000_extract.py

ROM_SYSTEM_BIOS(0, "v10", "Version 10 - August 2nd, 1999")
ROMX_LOAD("kn5000_v10_program.rom", 0x00000, 0x200000, CRC(8f53027e) SHA1(57ebaa13ea6b3d5c67456b16335f06465a29fb0c), ROM_BIOS(0))
Expand Down

0 comments on commit fb40164

Please sign in to comment.