OneChipMSX Initial Program Loader

Por robinsonb5

Supporter (10)

Imagen del robinsonb5

10-08-2014, 12:54

Hi Smile

I've been looking at the DE1 port of the OneChipMSX over the last couple of days with a view to porting it to a couple of other FPGA boards, including the Turbo Chameleon 64. From what I've seen so far it won't be too much of a problem, the biggest complication is that there's no EPCS device on-board. There is a completely different flash chip, and some communication with an oboard µC is necessary to find the coorrect base address, so to get this working I'm going to need to rewrite the Initial Program Loader.

Therefore yesterday and today I've been mentally mapping out the project and figuring out what happens where, and started adding some detailed annotations to the only copy of the ipl.asm source I could find.
(This is actually my first exposure to Z80 assembler, and I have to say I'm blown away by the code density and elegance of the instruction set!)

Anyhow, I've just been reading the following code:

XF137:	CALL	SDRESET
	POP	BC
	POP	DE
	POP	HL
	RET	C

SECLOAD:	
	PUSH	HL
	PUSH	DE
	PUSH	BC		; Save registers
	LD	B,51H		; Attempt a read
	LD	HL,4000H
	CALL	SNDCMD
	JR	C,XF137		; Read failed - reset card.
	POP	BC
	POP	DE
	POP	HL
....

The first read to the card will fail because it hasn't been initialised yet, so the firmware then resets the card, but as far as I can see, doesn't then attempt the read again and falls back immediately to EPCS booting. So loading the BIOS from SD card will only work if the card's already initialised? Or have I misunderstood something here?

Login sesión o register para postear comentarios

Por Guillian

Prophet (3337)

Imagen del Guillian

11-08-2014, 10:09

Actually it tries to read again after initializing the card in SPI mode.
The "RET C" checks if there was an error in the initialization process (carry flag set) and returns or continues depending on that.

Por robinsonb5

Supporter (10)

Imagen del robinsonb5

11-08-2014, 13:28

Ah - thank you! I'd missed the fact that RET C was conditional - makes more sense now.

Por robinsonb5

Supporter (10)

Imagen del robinsonb5

22-09-2014, 19:43

I've had a lot of fun and learned a lot in the process, but I've now got a version of the OneChipMSX core working nicely on the Turbo Chameleon 64 - complete with an on-screen display menu to replace the DIP switches.

It runs on the DE1 too, and It should be a simple matter to port this to other comparable FPGA platforms (15,000-ish LEs, SDRAM, SD-card, PS/2 keyboard) since the dependency on the EPCS flash is removed, and the SD Bootstrap is now a bit more forgiving.

More information here: http://retroramblings.net/?page_id=917
Full source on github, here: https://github.com/robinsonb5/OneChipMSX

As an MSX newcomer, I'm finding it to be a really interesting platform!

Por KdL

Paragon (1325)

Imagen del KdL

22-09-2014, 21:40

hi robinsonb5, you can check my ocm-pld 3.2.2 for a commented variant of code:

website --> http://www.webalice.it/gnogni/
folder --> 20140727 OCM-PLD v3.2.2 by KdL.7z\esemsx3\src\peripheral\asm_iplrom
file --> iplrom_320k.asm

Por robinsonb5

Supporter (10)

Imagen del robinsonb5

23-09-2014, 00:19

KdL wrote:

hi robinsonb5, you can check my ocm-pld 3.2.2 for a commented variant of code:

Thank you for that - most enlightening.

In my variant I've actually stripped the IPL down to the very bare minimum - it merely receives the BIOS from a newly-added control module which handles loading it from SD card. (This project has been an excuse to build that module - I plan to use it in other cores too!) This avoids the first-file-on-the-card limitation, and also means the BIOS can be loaded from SDHC and FAT32 cards - though obviously only booting into BASIC.

Por _ThEcRoW

Expert (84)

Imagen del _ThEcRoW

05-10-2014, 15:10

Is this core implementing a msx2+?