RISKY MSX Cart - Proof of concept.

Home for the Terriblefire MSX clone

Moderators: terriblefire, Terriblefire Moderator

User avatar
arkadiusz.makarenko
Moderator Team
Moderator Team
Posts: 1251
Joined: Wed Jun 19, 2019 7:36 am
Location: Edinburgh

RISKY MSX Cart - Proof of concept.

Post by arkadiusz.makarenko »

I have started working on new project. After series of USB HID devices I had to change domain a little. As thanks to @terriblefire I own TFMSX, I decided to work on something targeting this platform. So I came up with idea to emulate EPROMs using RISC V chips.

RISKYMSXCart.png
RISKYMSXCart.png (117.05 KiB) Viewed 1005 times

Stephen shared with me PCB cart design, which was a basis of my PCB.
I picked up CH32V307V, It is RISC V chip, with 256K of flash and 64k RAM for prototype. General purpose chip with quite nice price tag of £3. I believe that cheaper version for £1.6 (CH32V303V) will be suitable as well.
My main goal was to emulate EPROM in any way possible. I managed to achieve this last night when I managed to load something.
Today I managed to optimise code to a level that I was able to load first 32k game out of it.

My next goal is to enable USB Flash support. Initially hardcoded with fixed filename loading to flash after pressing a button, next I will need to work on two way communication and MSX software to list files from USB flash drive and allow picking up file to copy to cart.

A big thank you to @NYYRIKKI for helping me understand MSX in general and pointed me to C library which will be great basis for my MSX software.

PXL_20241213_002547038.MP.jpg
PXL_20241213_002547038.MP.jpg (220.54 KiB) Viewed 1005 times
Do not trust people. They are capable of greatness.
~ Stanislaw Lem
Maximilian
Posts: 320
Joined: Thu Feb 28, 2019 5:02 pm

Re: RISKY MSX Cart - Proof of concept.

Post by Maximilian »

Nice work!!! :D
terriblefire
Moderator Team
Moderator Team
Posts: 5587
Joined: Mon Aug 28, 2017 10:56 pm
Location: Glasgow, UK

Re: RISKY MSX Cart - Proof of concept.

Post by terriblefire »

Outstanding work
———
"It is not necessarily a supply voltage at no load, but the amount of current it can provide when touched that
indicates how much hurting you shall receive."
User avatar
arkadiusz.makarenko
Moderator Team
Moderator Team
Posts: 1251
Joined: Wed Jun 19, 2019 7:36 am
Location: Edinburgh

Re: RISKY MSX Cart - Proof of concept.

Post by arkadiusz.makarenko »

I can't make USB FS to work, at least in the Host mode. Need to check again if those chips even can work as host without oscillator. I assumed that they can as they are very similar to v203s, but I think I was wong. Or I need to configure clock differently.
Anyway there is still a lot of work I can do on this prototype like writes, memory mappers, SSC and few other things.
It will be at least a month before I will be able to respin new PCB.
Do not trust people. They are capable of greatness.
~ Stanislaw Lem
User avatar
arkadiusz.makarenko
Moderator Team
Moderator Team
Posts: 1251
Joined: Wed Jun 19, 2019 7:36 am
Location: Edinburgh

Re: RISKY MSX Cart - Proof of concept.

Post by arkadiusz.makarenko »

YEY! It was USB FS clock configuration.
Long story short, V307 clock tree is far more complex, and requires different config for HSE and HSI clocks... If I went for cheap V303 I woudn't have this issue :)

I have USB working now
Do not trust people. They are capable of greatness.
~ Stanislaw Lem
User avatar
arkadiusz.makarenko
Moderator Team
Moderator Team
Posts: 1251
Joined: Wed Jun 19, 2019 7:36 am
Location: Edinburgh

Re: RISKY MSX Cart - Proof of concept.

Post by arkadiusz.makarenko »

Next milestone reached.
I can flash rom cart from USB, to chip memory, and run it from the chip.
At the moment only once, but still quite a progress.
Next step: tidy up.

Todo
Figure out how to support writes
Implement Konami MegaROMs without SCC
Do not trust people. They are capable of greatness.
~ Stanislaw Lem
User avatar
arkadiusz.makarenko
Moderator Team
Moderator Team
Posts: 1251
Joined: Wed Jun 19, 2019 7:36 am
Location: Edinburgh

Re: RISKY MSX Cart - Proof of concept.

Post by arkadiusz.makarenko »

After a little bit of a battle with timings on reads, I managed to implement Konami without SCC ROM mapper.
Next steps:
Control MSX reset
Reconfigure chip to support 288K Flash + 32k RAM, instead of 256K flash + 64RAM
Configure Fash Enhanced Read Mode
Konami with SCC mapper
ASCII 8k mapper
ASCII 16k mapper



MSX software to select cart to flash.
- List files from usb (first 20?)
- request load
- select mapper
Abandoned

OR

mapper Autodetection ...
Manual mapper config based on extension

Try to move to IRQ approach. It is to release resources for SCC.

Add support for NEO Mappers.
https://aoineko.org/msxgl/index.php?title=NEO_mapper

New PCB with connected DAC and possibly some control lines moved to different gpio port ( to reduce needed reads from gpio - savings precious nanoseconds) - Some small touches like a button or two and connecting DACs
SCC emulation:
- don't know where even start...
Do not trust people. They are capable of greatness.
~ Stanislaw Lem
terriblefire
Moderator Team
Moderator Team
Posts: 5587
Joined: Mon Aug 28, 2017 10:56 pm
Location: Glasgow, UK

Re: RISKY MSX Cart - Proof of concept.

Post by terriblefire »

arkadiusz.makarenko wrote: Mon Dec 16, 2024 2:45 pm SCC emulation:
- don't know where even start...
For SCC emulation i would start by implementing the 32 byte wave buffers and getting the ARM to play them with the DAC. possibly look at what emulators do in terms of interpolating that buffer up to something that the DAC can handle. Dont bother with volume control etc for now just try to get some sound out of it. I would expect it to look very similar to what is in an emulator.

SCC implementation.

https://github.com/libretro/fmsx-libret ... ULib/SCC.c

So really all you need to implement is SetWave (to interpolate/interpret the wave forms to your DAC) and SetSound (set the remaining sound attributes).
———
"It is not necessarily a supply voltage at no load, but the amount of current it can provide when touched that
indicates how much hurting you shall receive."
User avatar
arkadiusz.makarenko
Moderator Team
Moderator Team
Posts: 1251
Joined: Wed Jun 19, 2019 7:36 am
Location: Edinburgh

Re: RISKY MSX Cart - Proof of concept.

Post by arkadiusz.makarenko »

terriblefire wrote: Tue Dec 17, 2024 2:31 pm
arkadiusz.makarenko wrote: Mon Dec 16, 2024 2:45 pm SCC emulation:
- don't know where even start...
For SCC emulation i would start by implementing the 32 byte wave buffers and getting the ARM to play them with the DAC. possibly look at what emulators do in terms of interpolating that buffer up to something that the DAC can handle. Dont bother with volume control etc for now just try to get some sound out of it. I would expect it to look very similar to what is in an emulator.

SCC implementation.

https://github.com/libretro/fmsx-libret ... ULib/SCC.c

So really all you need to implement is SetWave (to interpolate/interpret the wave forms to your DAC) and SetSound (set the remaining sound attributes).
After reviewing this code, now I am 100% certain that I don't have enough processing power on this chip left to do this level of calculations. Maybe with some kind of additional WAIT states (?) , but impossible in normal write cycle

Saying this, I already started looking at STM32H745
It is £15 dual ARM core 480Mhz. This would manage, but it is far more complex, and would force me to learn new usb lib.
It has massive flash, massive amount of ram, and D/A Converters. I think I have Dev board with this chip, so I can do some tests before designing new PCB.
Do not trust people. They are capable of greatness.
~ Stanislaw Lem
terriblefire
Moderator Team
Moderator Team
Posts: 5587
Joined: Mon Aug 28, 2017 10:56 pm
Location: Glasgow, UK

Re: RISKY MSX Cart - Proof of concept.

Post by terriblefire »

arkadiusz.makarenko wrote: Tue Dec 17, 2024 8:03 pm After reviewing this code, now I am 100% certain that I don't have enough processing power on this chip left to do this level of calculations. Maybe with some kind of additional WAIT states (?) , but impossible in normal write cycle

Saying this, I already started looking at STM32H745
It is £15 dual ARM core 480Mhz. This would manage, but it is far more complex, and would force me to learn new usb lib.
It has massive flash, massive amount of ram, and D/A Converters. I think I have Dev board with this chip, so I can do some tests before designing new PCB.
I dont think you need to do these calculations inside a bus cycle. Just be complete by the next or next plus 1 top of frame. Remember this is an audio device and our hearing would never tell the difference.
———
"It is not necessarily a supply voltage at no load, but the amount of current it can provide when touched that
indicates how much hurting you shall receive."
Post Reply

Return to “TFMSX”