JMarlin / nesii

0 stars 0 forks source link

[NES II] Load and execute an Apple DOS 3.3 bin format executable #7

Closed JMarlin closed 4 months ago

JMarlin commented 4 months ago

Description

Now that we have a mechanism for arbitrary floppy seeking and the ability to read through the disk catalog, it should be possible to create a subroutine that can look up and load the tracks and sectors for an individual file. Since Apple DOS defines the binary format as very simply being the load address and size of the payload followed by the payload data, it should be possible to use the Apple II to assemble binary files and then load and execute them on the NES.

This would be a powerful first step to many things, including DOS-based NES game execution and the creation of a self-hosted editor, assembler, and other such utilities.

Acceptance Criteria

JMarlin commented 4 months ago

Started reorganizing to cleanly separate logical layers

JMarlin commented 4 months ago

Did a nice reorg of the build setup today so that NOS can optionally be built into the BIOS ROM image (and jumped to directly instead of the BIOS trying to load the bootsector) so that we can build and test NOS code without having to constantly write floppies.

JMarlin commented 4 months ago

Got a wild hair and ended up getting a mechanism for handing args to subcommands and an echo command to demonstrate it. Will need this in order to pass a file name to the run command.

JMarlin commented 4 months ago

Just making a note that I did check and confirm that find file is working with support for spaces as potential match terminators

JMarlin commented 4 months ago

Implemented open and read byte FS calls that basically seem to work. Read byte does not yet support chaining into the next T/S list sector, which we're definitely going to need for loading NES games.

We should probably implement the 'keep reading until the floppy data latch changes' method of waiting for the floppy motor at some point since right now we always wait a little over a second after we turn the floppy motor on just in case.

JMarlin commented 4 months ago

In the interest of making the fully fleshed-out follow-the-whole-T/S-list-chain version of the file read code a little easier to implement, started modifying the code today to operate on the basis of an 'open file info' structure which includes information about what the root T/S list sector for the file is, what the currently loaded T/S list sector is, which T/S is currently loaded into the data buffer, &c.

JMarlin commented 4 months ago

Large file loading now works confirmed up to 16k, now I just need to add a jsr to the entry point and this story is functionally done. Next step is to open an issue for loading and executing 32k NES games off of the FS.

JMarlin commented 4 months ago

Run command working all day long, need to merge and we're done