Trying to dump Yamaha SKW-01

صفحة 5/6
1 | 2 | 3 | 4 | | 6

بواسطة Manuel

Ascended (19466)

صورة Manuel

18-01-2023, 12:52

How can I test it, so how can I force it to produce symbols from the other parts of the ROM?

بواسطة Manuel

Ascended (19466)

صورة Manuel

18-01-2023, 14:00

i do see the program do reads from all 4. I assumed each 'port' has its own register to keep the address, is that right?

This is the draft code, commends, suggestions and especially corrections are most welcome:

YamahaSKW01::YamahaSKW01(const DeviceConfig& config)
	: MSXDevice(config)
	, Connector(MSXDevice::getPluggingController(), MSXDevice::getName() + " printerport",
	            std::make_unique())
	, mainRom(MSXDevice::getName() + " main"     , "rom", config, "main")
	, fontRom(MSXDevice::getName() + " kanjifont", "rom", config, "kanjifont")
	, dataRom(MSXDevice::getName() + " data"     , "rom", config, "data")
	, sram(MSXDevice::getName() + " SRAM", 0x800, config)
{
	if (mainRom.size() != 32 * 1024) {
		throw MSXException("Main ROM must be exactly 32kB in size.");
	}
	if (fontRom.size() != 128 * 1024) {
		throw MSXException("Font ROM must be exactly 128kB in size.");
	}
	if (dataRom.size() != 32 * 1024) {
		throw MSXException("Data ROM must be exactly 32kB in size.");
	}

	reset(EmuTime::dummy());
}

void YamahaSKW01::reset(EmuTime::param time)
{
	font0Address = 0;
	font1Address = 0;
	font2Address = 0;
	font3Address = 0;
	dataAddress = 0;

	writeData(0, time);    // TODO check this
	setStrobe(true, time); // TODO check this
}

byte YamahaSKW01::readMem(word address, EmuTime::param time)
{
	if (address == 0x7FC0) {
		return 0x01; // READY to read
	} else if (address == 0x7FC1) {
		std::cerr << "DEBUG: read font ROM from part 0\n";
		return fontRom[0x00000 + (font0Address & 0b0111'1111'1111'1111)];
	} else if (address == 0x7FC2) {
		return 0x01; // READY to read
	} else if (address == 0x7FC3) {
		std::cerr << "DEBUG: read font ROM from part 1\n";
		return fontRom[0x08000 + (font1Address & 0b0111'1111'1111'1111)];
	} else if (address == 0x7FC4) {
		return 0x01; // READY to read
	} else if (address == 0x7FC5) {
		std::cerr << "DEBUG: read font ROM from part 2\n";
		return fontRom[0x10000 + (font2Address & 0b0111'1111'1111'1111)];
	} else if (address == 0x7FC6) {
		return 0x01; // READY to read
	} else if (address == 0x7FC7) {
		std::cerr << "DEBUG: read font ROM from part 3\n";
		return fontRom[0x18000 + (font3Address & 0b0111'1111'1111'1111)];
	} else if (address == 0x7FCA || address == 0x7FCB) {
		if ((dataAddress & 0b1000'0000'0000'0000) == 0) {
			//std::cerr << "DEBUG: data ROM read access at 0x" << std::hex << int(dataAddress & 0x7fff) << "\n";
			return dataRom[dataAddress & 0b0111'1111'1111'1111];
		} else {
			//std::cerr << "DEBUG: SRAM read access at 0x" << std::hex << int(dataAddress & 0x7ff) << "\n";
			return sram[dataAddress & 0x7FF];
		}
	} else if (address == 0x7FCC) {
		// bit 1 = status / other bits always 1
		std::cerr << "DEBUG: get printer status\n";
		return getPluggedPrintDev().getStatus(time)
		       ? 0xFF : 0xFD;
	} else if (address < 0x8000) {
		return mainRom[address];
	} else {
		return 0xFF;
	}
}

void YamahaSKW01::writeMem(word address, byte value, EmuTime::param time)
{
	if (address == 0x7FC0) {
		font0Address = (font0Address & 0b1111'1111'0000'0000) + value;
	} else if (address == 0x7FC1) {
		font0Address = (font0Address & 0b0000'0000'1111'1111) + (value << 8);
	} else if (address == 0x7FC2) {
		font1Address = (font1Address & 0b1111'1111'0000'0000) + value;
	} else if (address == 0x7FC3) {
		font0Address = (font1Address & 0b0000'0000'1111'1111) + (value << 8);
	} else if (address == 0x7FC4) {
		font0Address = (font2Address & 0b1111'1111'0000'0000) + value;
	} else if (address == 0x7FC5) {
		font0Address = (font2Address & 0b0000'0000'1111'1111) + (value << 8);
	} else if (address == 0x7FC6) {
		font0Address = (font3Address & 0b1111'1111'0000'0000) + value;
	} else if (address == 0x7FC7) {
		font0Address = (font3Address & 0b0000'0000'1111'1111) + (value << 8);
	} else if (address == 0x7FC8) {
		dataAddress = (dataAddress & 0b1111'1111'0000'0000) + value;
	} else if (address == 0x7FC9) {
		dataAddress = (dataAddress & 0b0000'0000'1111'1111) + (value << 8);
	} else if (address == 0x7FCA || address == 0x7FCB) {
		if ((dataAddress & 0b1000'0000'0000'0000) != 0) {
			//std::cerr << "DEBUG: SRAM write access at 0x" << std::hex << int(dataAddress & 0x7ff) << "\n";
			sram.write(dataAddress & 0x7ff, value);
		}
	} else if (address == 0x7FCC) {
		std::cerr << "DEBUG: set strobe\n";
		setStrobe(value & 1, time);
	} else if (address == 0x7FCE) {
		std::cerr << "DEBUG: write data to printer\n";
		writeData(value, time);
	}
}

const byte* YamahaSKW01::getReadCacheLine(word start) const
{
	return nullptr; // TODO
	/*
	if ((start & CacheLine::HIGH) == (0xBFFF & CacheLine::HIGH)) {
		return nullptr;
	} else {
		return &dataRom[start - 0x4000];
	}*/
}

byte* YamahaSKW01::getWriteCacheLine(word start) const
{
	return nullptr; // TODO
	/*
	if ((start & CacheLine::HIGH) == (0xBFFF & CacheLine::HIGH)) {
		return nullptr;
	} else {
		return unmappedWrite.data();
	}*/
}

void YamahaSKW01::setStrobe(bool newStrobe, EmuTime::param time)
{
	if (newStrobe != strobe) {
		strobe = newStrobe;
		getPluggedPrintDev().setStrobe(strobe, time);
	}
}
void YamahaSKW01::writeData(uint8_t newData, EmuTime::param time)
{
	if (newData != data) {
		data = newData;
		getPluggedPrintDev().writeData(data, time);
	}
}

std::string_view YamahaSKW01::getDescription() const
{
	return MSXDevice::getName() + " printer port";
}

std::string_view YamahaSKW01::getClass() const
{
	return "Printer Port";
}

void YamahaSKW01::plug(Pluggable& dev, EmuTime::param time)
{
	Connector::plug(dev, time);
	getPluggedPrintDev().writeData(data, time);
	getPluggedPrintDev().setStrobe(strobe, time);
}

PrinterPortDevice& YamahaSKW01::getPluggedPrintDev() const
{
	return *checked_cast(&getPlugged());
}

template
void YamahaSKW01::serialize(Archive& ar, unsigned /*version*/)
{
	ar.template serializeBase(*this);
	ar.serialize("font0Address", font0Address,
	             "font1Address", font1Address,
	             "font2Address", font2Address,
	             "font3Address", font3Address,
	             "dataAddress" , dataAddress);
	ar.serialize("SRAM", sram);
	ar.serialize("strobe", strobe,
	             "data",   data);
	// TODO force writing data to port??
}
INSTANTIATE_SERIALIZE_METHODS(YamahaSKW01);
REGISTER_MSXDEVICE(YamahaSKW01, "YamahaSKW01");

} // namespace openmsx

بواسطة acet

Supporter (12)

صورة acet

18-01-2023, 16:15

YamahaSKW01::writeMem has a bug.

Some
font0Address =
should be
font1Address =
or
font2Address =
or
font3Address =

بواسطة Manuel

Ascended (19466)

صورة Manuel

18-01-2023, 17:03

Ah indeed, well spotted! Thanks! Anything else?

Bug fixed version at least shows kanji now in the print screen: https://youtu.be/92fW36VItUQ but still no idea how to input them myself.

بواسطة Manuel

Ascended (19466)

صورة Manuel

18-01-2023, 17:05

Also, the printer output seems nonsense.... I connected a standard MSX printer to it. The flow seems good:

DEBUG: get printer status
DEBUG: write data to printer
DEBUG: set strobe
DEBUG: set strobe
DEBUG: get printer status
DEBUG: write data to printer
DEBUG: set strobe
DEBUG: set strobe
DEBUG: get printer status
DEBUG: write data to printer
DEBUG: set strobe
DEBUG: set strobe
DEBUG: get printer status
DEBUG: write data to printer
DEBUG: set strobe
DEBUG: set strobe
DEBUG: get printer status
DEBUG: write data to printer
DEBUG: set strobe
DEBUG: set strobe

But output is just some gibberish...

بواسطة Manuel

Ascended (19466)

صورة Manuel

18-01-2023, 23:04

You can try it out yourself in openMSX 18.0-530-g3eb0001b3. Please let me know how it works for you all. If you have any ideas about the printer stuff, I'm very interested.

بواسطة acet

Supporter (12)

صورة acet

19-01-2023, 03:03

These hardware are expected to have similar specifications.

  • Sanyo KA-MAP-06
  • Yamaha SKW-05 (without printer port / fixed compatibility with disk )
  • National CF-SM003 (without printer port / MSX standard cartridge)

بواسطة sdsnatcher73

Prophet (3954)

صورة sdsnatcher73

19-01-2023, 09:24

So typing kanji is a little different from MSX-JE. It has a limited dictionary for individual characters only. You type the hiragana equivalent of the kanji character and press space to see all matching kanji. I am by no means any good in Japanese so I tried it with Nihongo (日本語 - Japanese language) and at first it would not show the character for ni. I used google translate and the base sound of the 日 character is actually hi. So certainly when I typed hi followed by space the right character was available.

بواسطة Manuel

Ascended (19466)

صورة Manuel

19-01-2023, 22:33

Any idea how to type spaces in text?

Also, I got the kanji to work, but after typing first some other texts, I couldn't get it to convert to kanji anymore... well, now I fiddled a bit more and it works again. There seem to be several modes...
How did you get it to produce the 'hon' 本 character?

بواسطة mars2000you

Enlighted (6482)

صورة mars2000you

19-01-2023, 23:45

By comparison with the infos we have about SKW-05, I think the 'special' SKW-01 rom with data contains a Kanji Dictionary.

And it should be present also on the National cartridge, as both products seem very similar. The question for which we don't have yet an answer: does Yamaha have made the National version or not?

صفحة 5/6
1 | 2 | 3 | 4 | | 6