writing to flashrom (2MB rom) and support for emulators

Pagina 5/8
1 | 2 | 3 | 4 | | 6 | 7 | 8

Van Manuel

Ascended (16851)

afbeelding van Manuel

03-05-2020, 19:08

@daemos: openMSX doesn't emulate any speed restrictions on writing to the hardware. I don't know if there are any, but you could try to slow things down a bit and see if it matters.
Still, are you sure you want to write to MegaFlashROM cartridges? I still don't see how that is practically usable by someone who owns such a cartridge and also want to use it for other things than one game.

Van norakomi

Paragon (1084)

afbeelding van norakomi

03-05-2020, 19:22

Quote:

And at the moment, the hardware seems to be not capable of partly making the flash read/write and partly making it readonly. That doesn't have to be a problem (as Grauw also pointed out), but I do need to know this is indeed the thing you're going to use.

I asked the person who we buy the cartridges from, and indeed he said that it's not possible to partly protect the cartridges.
Meaning we leave the entire card flashable write enable.
For Deva this means, the cartridge will be dedicated only to Deva. Flashing will be possible onto the cartridge,
and as Grauw pointed out, if bugs are found, the cart can be easily modified this way.
For SMW we might use 2 different types of saving data. to flashrom and to fmpac sram...

Van max_iwamoto

Champion (487)

afbeelding van max_iwamoto

03-05-2020, 20:10

Manuel wrote:

@max_iwamoto: does it also support the PAC (so, the plain PAC, without FM-).

Yes, it supports PAC. PAC & FMPAC work in the same way for data save/load. FMPAC adding music, etc...

Van Manuel

Ascended (16851)

afbeelding van Manuel

03-05-2020, 20:57

@norakomi: OK, so I'll try to create emulation for a 2MB flash ROM cartridge, which is fully flashable and has 32 blocks of 64kB and has the Konami mapper. Is that correct?

@max_iwamoto: good. Although I didn't see it in your code when I quickly looked through it, it could have been possible you were using an FM-PAC detection routine Smile But, I shouldn't have asked. You clearly know what you're doing.

Van Daemos

Paragon (1713)

afbeelding van Daemos

03-05-2020, 21:31

Quote:

@daemos: openMSX doesn't emulate any speed restrictions on writing to the hardware. I don't know if there are any, but you could try to slow things down a bit and see if it matters.
Still, are you sure you want to write to MegaFlashROM cartridges? I still don't see how that is practically usable by someone who owns such a cartridge and also want to use it for other things than one game.

good points. Well there are some pros and cons when writing to the flashrom. The pro is offcourse that the game will be extremely reliable in its saves. If you own a flashrom you can save simple as that. the cons are that the flashrom gets more to chew up although saving only happens at rare moments so thats not a big problem. Reflashing the cartridge means loosing your game progress that sucks. Then on the other hand. What if.... this project finds its way onto a cartridge because someone has the guts to bring it to the public. You never know.

But to be honest. I will decide what to do after I finish the whole thing for now I find that I have a new challenge at hand and simply want to find out how this flashrom thing actually works. Got it to work in the emulator so I am super close to answers I now have a little personal battle with my megaflashrom Wink

@max_imawoto

Thank you for sharing this sram code. My appreciation is truly immense. Will implement this support thank you.

Van max_iwamoto

Champion (487)

afbeelding van max_iwamoto

04-05-2020, 01:38

Manuel wrote:

@max_iwamoto: good. Although I didn't see it in your code when I quickly looked through it, it could have been possible you were using an FM-PAC detection routine Smile But, I shouldn't have asked. You clearly know what you're doing.

I think asking is always better Wink Indeed calling it FMPAC was a bit misleading. Probably because it was modified from FMPAC detection routine to be used for detecting SRAM part. But it was done long ago, hard to remember exact details now...

Here is the part to detect MSX MUSIC and MSX AUDIO. Please also note that if you using it in Turbo R that already have MSX MUSIC inside and then you have FMPAC with MSX MUSIC, you would want to enable direct port access.

CHIP variable will show what audio presented in the system, you may change "ID" for it based on what player you using. In this version I used MoonBlaster. To pass CHIP variable to it you need to "DEC A" and write to player variable called "CHIPS".

So it will be as follows: 0, 1, 2. (msx-audio, msx-music, both - stereo)

There is only one part left - how to load drum data to MSX-AUDIO RAM. I can post it as well if needed.


...

	CALL	SCANSLT            ; check for FMPAC
	CALL	CHK_AUD            ; check if MSX-AUDIO present

	LD	A,00h              ; variable that shows what
CHIP:	EQU	$ - 1              ; AUDIO present in the system
        DEC     A
        LD      (CHIPS),A
...

CHK_AUD:
	IN	A,(C0h)
	CP	FFh
	RET	Z
	LD	HL,CHIP
	INC	(HL)

	%if	(MUS_VER == "1")

	CALL	LD_DRUM

	%endif

	RET

SCANSLT:
	XOR	A		; start from slot 0
	LD	HL,FCC1h
.loop:
	LD	C,(HL)
	OR	C
.loop2:
	EXX

	PUSH	AF

	LD	H,40h
	CALL	ENASLT

	CALL	CHK_FM

	POP	AF

	EXX

	ADD	A,%00000100	; increase subslot number
	LD	C,A		; C = new slot + subslot
	BIT	7,A		; check if slot expanded
	JR	Z,.next		; if not expanded go for next slot
	AND	%00001100	; check if already checked all subslots
	LD	A,C
	JR	NZ,.loop2	; still some subslots left
.next:
	INC	HL
	LD	A,C
	INC	A
	AND	%00000011
	RET	Z		; return if all slots & subslots are checked!
;
	JR	.loop

CHK_FM:
	LD	HL,.fm_txt + 03h
	LD	DE,401Ch + 03h
	CALL	.search		; search for "OPLL"
	RET	NZ

	LD	A,02h		; MSX-MUSIC found
	LD	(CHIP),A

	CALL	.search		; DE = 4018h + 03h , HL = "L" of "APRL"
	RET	Z		; return if found built-in MSX-MUSIC

	LD	HL,.fmsram + 03h
	LD	DE,4018h + 03h
	CALL	.search		; search for "PAC2"
	RET	NZ

	LD	HL,7FF6h	; enable direct port use of FM-PAC
	LD	A,(HL)
	OR	01h
	LD	(HL),A
	RET

.search:
	LD	B,04h
.s_comp:
	LD	A,(DE)
	CP	(HL)
	RET	NZ
	DEC	HL
	DEC	DE
	DJNZ	.s_comp
	RET

.fmsram:
	DB	"PAC2"

.fm2txt:
	DB	"APRL"

.fm_txt:
	DB	"OPLL"

Van norakomi

Paragon (1084)

afbeelding van norakomi

04-05-2020, 07:56

Quote:

@norakomi: OK, so I'll try to create emulation for a 2MB flash ROM cartridge, which is fully flashable and has 32 blocks of 64kB and has the Konami mapper. Is that correct?

Correct !!!!! Running Naked in a Field of Flowers Running Naked in a Field of Flowers

Van norakomi

Paragon (1084)

afbeelding van norakomi

08-05-2020, 10:56

@Manuel Any luck implementing the rom type ! I'm eager to start testing !

Van Manuel

Ascended (16851)

afbeelding van Manuel

08-05-2020, 21:38

No, I need to get information from the designer... I asked Alexey and apparently he didn't get a reply yet.
This is the same information you also need to be able to program the cartridge to flash stuff.

Van norakomi

Paragon (1084)

afbeelding van norakomi

08-05-2020, 22:50

Ok, let's wait for the reply then !
Thanks for the update

Pagina 5/8
1 | 2 | 3 | 4 | | 6 | 7 | 8