Commit Graph

12 Commits

Author SHA1 Message Date
Paul XPS 577277cd2b Basic NES file header creation. PRG/CHR-ROM sizes are filled in based
on provided prg/chr rom input args for dumping.  Mirroring is sensed &
entered for fixed mirror mappers.  So this is basic iNES file format.

Still don't have automatic banktable locating, nor mapper detection.

But this provides a basic header that should work with most currently
supported NES mappers.  If the headers need tweaked, I recommend opening
in Mesen and using it's header modifcation tool.
2019-03-21 20:28:53 -05:00
Paul XPS e4debe5a13 Big update for firmware version v2.3.1
this is the verion getting flashed on all v2.0N NESmaker kits
v2.3.0 worked for basic functions, but was never shipped

Majority of effort revolved around testing mapper30 boards with the
smaller v2.0N INLretro with the NES connector alone for NESmaker kits.

added linear feedback shift register for test stream data generated
locally on the device.  I'm not 100% sure if this is any faster than
pushing the actual data via USB though.. :/  It's plenty fast on the
stm32 nearly instantaneous for 32KByte.  But the AVR takes a couple
sec..

Created "stuff" dictionary for things like that were I just want to add
small things and don't want to bother with a whole new dictionary.

Added file verification to the host with files.lua

Have some nes flash algos return post-written data so calling function
can decide if want to retry, fail, etc.

Changed host dictionary calls to assert instead of error because it
really shouldn't continue.  I didn't see an error when sending opcode to
wrong dict and caused head banging..

fwupdate permits bytes to be skipped, or force the update.  Found that
the fwupdater got assigned different addresses of ram depending on what
all other ram gets allocated to the main application

Some clean up of inlretro.lua

TODO:
host learn and keep track of the connected device.
Needed for ciccom right now, or knowing whether ciccom connection
is even present..
In the end maybe ciccom is better placed in firmware, but for small
transfers of only a few bytes it kinda makes sense to keep on the host.
Pinport gets quite messy with these made up pin names when really all I
want to do is toggle a specific pin on the NES connector.  So maybe some
double mappings would actually be okay, need to rethink that..

create different flash modes that either keep going, retry, or error
depending on the goal of the flash operation.  Fanout the return value
from flash algos to all of them.

have fwupdate assigned a specific area of ram so the ram pointer doesn't
change between builds.  Okay to ignore for now.

Realized can have STM32F070C6 devices execute bootloader by erasing all
the flash or perhaps even just the first word of flash according at
AN2606.  This wouldn't work for RB devices though.  This could be done
through the bootloader dict
2018-12-06 01:07:13 -06:00
beyondcoast 26f403d9f6 Change interface to process() for all NES mappers to make higher level scripts more flexible in using them, eliminate hardcoded prg,chr,ram sizes. Add CLI options to drive all this functionality directly. Note: Option letters are chosen somewhat arbitarily, next change will be to use argp so more descriptive flag names can be used ex: --nes_prg_rom_size_kb=16 in addition to single character shortnames. This will be important as console support expands. 2018-12-02 13:06:22 -06:00
Paul XPS e3d0ec434e Have the USB code effectively separated from the main application code!
Need to physically separate them now.  Then can focus on erasing &
flashing ourselves.

Added some speed checks to bnrom.lua script that I was testing usb code
with.  Was able to verify read/write speeds were no affected by changes
in this commit.  Did some testing against older firmware v2.2 though
there does seem to have been a slight slow down on write speeds.
Although, perhaps that's because of the nrom flash verifications that
are also included in this build (but not commited)..?
2018-11-27 23:26:26 -06:00
Paul XPS 7584bbeb70 Big update from past weeks' work. Most of the work involves converting
NES scripts to use new dump/flash methodology that MMC3 started.
Includes BNROM, UNROM, MMC1, and new scripts for FME7 & MMC4 (SOP flash).
Adding more general support to SNES with v2proto_hirom that script is
actually becoming more of a master script supporting both LoROM and
HiROM including flash, dump, and save backups.
SNES Rd/Wr now designate the state of /ROMSEL so have to manually
determine if access should be in /ROMSEL space of the SNES memory map or
not.  (ie all SNES cart memories are /ROMSEL space except HiROM SRAM).
2018-11-19 18:00:03 -06:00
Paul XPS 86e8d3d215 Big old first major commit since publicly releasing..
I made a commit earlier this week but messed things up by not pulling
from the master and things weren't updated...  Here's the notes from
that commit:

 Author: Paul XPS <paul@infiniteneslives.com>
 Date:   Tue Nov 6 22:45:52 2018 -0600

 Large commit biggest feature add is NES MMC3 support including Save RAM
 (aka WRAM/PRGRAM) support including dumping and writing save files.

 The MMC3 script & method of dumping/flashing is the most forward
 thinking script/firmware so far.  Finally starting to form a clear
 vision of how I want to handle flashing/dumping variations with mappers.
 Biggest thing is having the host handle the mapper init & banking
 control.  In the view of the firmware, it's only responsible for knowing
 how to flash a bank.  And dumping is even more generic with the host
 just telling what address range to read.  Things will get more complex
 with support of mappers with bus conflicts.  But ready to start
 converting these old hacked methods to be more like the MMC3 means.

 Have some early support for dumping gameboy using the snes script as the
 pinouts are nearly identical.  Along with testing of toggling between 3v
 GBA and 5v DMG.

 Have some early support for INLretro NES only version which uses a
 smaller mcu because it doesn't need to support large 16bit carts.  Still
 have to get this completed.

 Added support for CNROM, but I'm not sure if it's actually working.  Going
 to restart with NROM and start updating the currently supported
 mappers to be more like MMC3.

But this also includes some new updates from the second half of the week:

Started updating existing NES scripts to use new MMC3 methodology.  Got
NROM, CNROM, BNROM, & Color Dreams working.  On the host side only
needed to add nes.c functions for specific flash algos.  Able to delete
significant amounts of mapper specific code from flash.c

Got some basic SNES script support with new methodology for Catskull
elect 5v PLCC SNES LoROM board.  And INL SNES HI/LO-ROM 3v board as
well.  These don't yet use buffer writes, just single byte writes.

Also having issues with Mirroring test/sensing again.  Driving me crazy,
but don't really care about it at the moment and not sure what's wrong..
So just committing that broken for now.  Looking to remove this
functionality from the firmware side as the host should be controlling
most of this.

Looking to add SNES RAM & buffered writes.  Also need to test some of
the HIROM code as I just added it in there while I did the LOROM stuff..
2018-11-09 21:52:33 -06:00
Paul Black ASUS win7 9c57f1bdb3 Massively overdue commit of several months worth of random work.
Mostly adding support for mappers as I needed it for my own hardware
builds:
-MMC1
-mapper 30
-easy NSF (still need to update for mapper verilog fix)
-action53 (still need to update for mapper verilog fix)
-dual port board flashing
-colordreams, not sure if I actually got this working
-color ninja, just a special CPLD version of colordreams for ninja boards

Just started working on SNES code.  slowly getting things up and working
outside of main inlretro.lua script similar to how NES has been handling
everything with it's own script.  Able to flash v3 boards fine.  v1 boards
flash without errors, but still having some mapping problems where it
verifies but won't boot.  v2 prototype flashes most bytes but not all,
seems v2 boards are much slower to output valid data..  But that may just
be the manufacturer ID codes..?

TODO next:
-bootloader dictionary that jumps to bootloader so don't have to manually
close jumper on the board.
-turn on the watchdog timer for stm32
-create some sort of host timeout so reset button on programmer isn't as
useful
-allow firmware programing algos to be uploaded and executed from SRAM for
faster code that also doesn't require specific firmware builds to support
new mapers.
-Finish JTAG to simplify programing NES & SNES CPLDs
-Sort out swim issue with stm8s001 CICs
-add SWIM support for avr
2018-07-08 20:23:44 -05:00
Paul Black ASUS win7 3e2bcea7e8 Added quick support to flash HH85 on BNROM.
Dumped/flashed MMX on SNES v3 boards.
created discrete_exp0_mapper_wr to try and write to mapper but not flash
for discrete boards but doesn't seem to work for some reason so commented
out for now.
2018-04-12 11:21:04 -05:00
Paul Black ASUS win7 f7201f44b7 Have UxROM dumping, erasing, and flashing working now.
Also the current build assumes that the mcu is able to over drive the
PRG-ROM output to select bank zero for initial bank table writting.
Seems to work, but may need to come up with write that applies to mapper
only and doesn't enable the PRG-ROM by keeping EXP0 low.

Need to work on having the scripts find the bank table.
2018-03-18 14:39:45 -05:00
Paul Black ASUS win7 223007187b Have BNROM, and action53 working in PLCC and TSSOP.
Also added swim reading of stack bottom for CICOp signature.
Starting to add scripts for different mappers.
Need to clean things up quite a bit as everything was a bit of a hack just
so I could start building lizards and A53.
Need to add back NROM, and add UNROM as well.
Need to have program find bank table for itself both in the program and in
a cartridge.
Having problems with SWIM on new discrete NES boards for some reason.
Some boards are flakey and I march right in and start writting to config
bytes which will brick the device if communications are failing (and
there's no reset pin...)  as is with the stm8s001
2018-03-17 21:56:24 -05:00
Paul Black ASUS win7 c208924e45 Have BNROM 512KB PRG-ROM working for dumping and flashing.
Realizing much of my problems with discrete boards on original kazzos was
that I completely ignored the fact that most discretes are subject to bus
conflicts.  This makes writes to the mapper bank selecting uber flakey...
Created routine in bnrom.lua script to start flash operation by writing
the bank table to where Lizard puts it.  Need to write routine to find the
bank table in a provided rom for flashing.  And dumping needs to find the
bank table prior to making mapper writes and then use it for bank
switching!

Tested and working on AVR, stm adapter, and inl6
Lizard 512KB flash/dump:
AVR decrepit old firmware & app: 7.9KBps flash
AVR new firmware and app (this build) F:12.1KBps D:14.6KBps
STM adapter: F:31KBps D:114KBps
INL6: F:40KBps D:120KBps
2018-02-15 14:34:52 -06:00
Paul Black ASUS win7 9d35ad0c0f Getting closer to supporting various mappers.
Modified flash/dump scripts to be more generic accepting mapper/memory
args and file names.  Then they only handle the buffer and file
operations.
Created scripts/nes folder for holding all mapper scripts.  Currently only
nrom.lua is working and verified with inlretro6.  Found issue where the
very first byte read from PRG-ROM was garbage.  Narrowed it down to lower
address byte not settling in time, added NOP and resolved issue.
Still need to test on original kazzo and stm adapter, planning to do that
after this commit.
Next task is to get BNROM working so I can start getting to work on lizard
builds while taking advantage of speed boost!
2018-02-15 11:20:24 -06:00