JMarlin / nesii

0 stars 0 forks source link

[NES II] Boot from a floppy #4

Closed JMarlin closed 3 months ago

JMarlin commented 3 months ago

Description

3 is closed, and my friend that means we can pull in sectors now. Well, at least the first sector. But that's good enough to pull boot code!

This item is for fleshing out my ability to boot from a floppy and setting up a toolchain around it so that I can get some kind of neato NES DOS going down the line.

Acceptance criteria

JMarlin commented 3 months ago

Tested writing a modified disk via ADT on the IIgs and reading it back on the NES. Works like a charm. Updated the code to have a boot jump, haven't tested it yet. Here we goooooo

JMarlin commented 3 months ago

Haven't updated in about a week because AiO inc got me chucked off on another sidequest for the last couple of days. I reconfigured the hardware slightly so that now we have the following mapping modes:

Mode 0

0x8000-0xBFFF --> SRAM 0x0000-0x3FFF
0xC000-0xCFFF --> Slot select area
0xD000-0xDFFF --> Write here to change mode
0xE000-0xFFFF --> ROM 0x6000-0x7FFF
Cart mirroring: H

Mode 1

0x8000-0xFFFF --> SRAM 0x0000-0x7FFF
Cart mirroring: H

Mode 2

0x8000-0xBFFF --> SRAM 0x4000-0x7FFF
0xC000-0xCFFF --> Slot select area
0xD000-0xDFFF --> Write here to change mode
0xE000-0xFFFF --> ROM 0x6000-0x7FFF
Cart mirroring: H

Mode 3

0x8000-0xFFFF --> SRAM 0x0000-0x7FFF
Cart mirroring: V

With this hardware configuration I was then able to write a script that accepts an iNES-format ROM and, if it's compatible (no more than 32K PRG and 8K CHR), convert it into a self-booting .DSK image that copies the low 16K of PRG from the disk to the first SRAM bank, swaps the SRAM bank, copies the next 16K of PRG to it, then copies the 8K of CHR to the CHR-RAM and finally switches the cart mode to 1 or 3 depending on the required mirroring and jumps indirect to the reset vector in PRG RAM.

So, yeah. It can boot basic NES games off floppy now. I guess that means I can close out this issue and open one up for implementing NOS (NES [disk] Operating System).