diff --git a/host/scripts/app/nes.lua b/host/scripts/app/nes.lua index d39ee37..3e4f3ff 100644 --- a/host/scripts/app/nes.lua +++ b/host/scripts/app/nes.lua @@ -141,6 +141,31 @@ local function detect_mapper_mirroring (debug) -- //fme7 and many other ASIC mappers -- -- //none of ASIC mappers passed, assume fixed/discrete style mirroring + + dict.pinport("ADDR_SET", 0x0800) + local readH = dict.pinport("CTL_RD", "CIA10") + dict.pinport("ADDR_SET", 0x0400) + local readV = dict.pinport("CTL_RD", "CIA10") + + --print(readH, readV) + + ---[[ + if readV == 0 and readH == 0 then + if debug then print("1screen A mirroring sensed") end + return "1SCNA" + elseif readV ~= 0 and readH ~= 0 then + if debug then print("1screen B mirroring sensed") end + return "1SCNB" + elseif readV ~= 0 and readH == 0 then + if debug then print("vertical mirroring sensed") end + return "VERT" + elseif readV == 0 and readH ~= 0 then + if debug then print("horizontal mirroring sensed") end + return "HORIZ" + end + --]] + + --[[ rv = dict.nes("CIRAM_A10_MIRROR") if (rv == op_nes["MIR_VERT"]) then if debug then print("vertical mirroring sensed") end @@ -155,11 +180,17 @@ local function detect_mapper_mirroring (debug) if debug then print("1screen B mirroring sensed") end return "1SCNB" end + --]] -- Rtn: VERT/HORIZ/1SCNA/1SCNB return nil end + +-- verify the ciccom software mirroring switch is working properly +local function test_cic_soft_switch (debug) +end + -- Desc:CHR-ROM flash manf/prod ID sense test -- Only senses SST flash ID's -- Does not make CHR bank writes so A14-A13 must be made valid outside of this funciton @@ -310,6 +341,7 @@ nes.jumper_ciramce_ppuA13n = jumper_ciramce_ppuA13n nes.ciramce_inv_ppuA13 = ciramce_inv_ppuA13 nes.jumper_famicom_sound = jumper_famicom_sound nes.detect_mapper_mirroring = detect_mapper_mirroring +nes.test_cic_soft_switch = test_cic_soft_switch nes.ppu_ram_sense = ppu_ram_sense nes.read_flashID_chrrom_8K = read_flashID_chrrom_8K nes.read_flashID_prgrom_exp0 = read_flashID_prgrom_exp0 diff --git a/host/scripts/inlretro.lua b/host/scripts/inlretro.lua index 10be91c..172ce3b 100644 --- a/host/scripts/inlretro.lua +++ b/host/scripts/inlretro.lua @@ -1,5 +1,36 @@ -- main script that runs application logic and flow +-- ===================================================== +-- USER NOTES +-- ===================================================== +-- 1- set 'curcart' to point to desired mapper script (around line 60 currently) +-- 2- set 'cart_console' to the currently inserted cartridge (arond line 80 currently) +-- this will control flow of the script later on which is the +-- location of what you'll need to modify in the next step. +-- 3- call curcart.process function to actually run something: +-- Here are a few NES NROM examples: +-- +-- --NROM test & dump to dump.bin file +-- curcart.process( true, true, false, false, false, "ignore/dump.bin", nil, nil) +-- +-- --NROM test, erase, & flash flash.bin file +-- curcart.process( true, false, true, true, false, nil, "ignore/flash.bin", nil) +-- +-- --NROM test, dump (to dump.bin), then erase. Next flash flash.bin, lastly dump again to verify.bin +-- curcart.process( true, true, true, true, true, "ignore/dump.bin", "ignore/flash.bin, "ignore/verify.bin) +-- +-- Here is the nrom.process function definition: +-- local function process( test, read, erase, program, verify, dumpfile, flashfile, verifyfile) +-- arg 1 - test: this will run some tests on the cart to help determine things like mirroring & flash type +-- arg 2 - read: this will dump the rom memories on the cartridge to 'dumpfile', (done before subequent steps) +-- *The remaining args are only for flash boards purchased from our site: +-- arg 3 - erase: this will erase flash roms on the cartridge +-- arg 4 - program: this will write 'flashfile' to the cartridge +-- arg 5 - verify: this will dump the memories to 'verifyfile', just like read could/did, but done last. +-- arg 6,7,8 files: The relative path of where the files can be found/created from steps above. +-- You don't have to set unused file names to nil, that was just done for the examples. +-- +-- ===================================================== -- initial function called from C main @@ -26,6 +57,10 @@ function main () -- local crc32 = require "scripts.app.crc32" +-- ===================================================== +-- USERS: set curcart to point to the mapper script you would like to use here. +-- The -- comments out a line, so you can add/remove the -- to select/deselect mapper scripts +-- ===================================================== --cart/mapper specific scripts --local curcart = require "scripts.nes.nrom" --local curcart = require "scripts.nes.mmc1" @@ -40,6 +75,17 @@ function main () --local curcart = require "scripts.nes.easyNSF" --local curcart = require "scripts.nes.dualport" --local curcart = require "scripts.snes.v3" + +-- ===================================================== +-- USERS: set cart_console to the to point to the mapper script you would like to use here. +-- ===================================================== + local cart_console = "NES" --includes Famicom + --local cart_console = "SNES" + --local cart_console = "SEGA" + --local cart_console = "N64" + --local cart_console = "DMG" + --local cart_console = "GBA" + --local cart_console = "SMS" local rv -- rv = dict.pinport( "DATA_SET", 0xAA ) @@ -97,7 +143,6 @@ function main () --PROCESS USER ARGS ON WHAT IS TO BE DONE WITH CART local force_cart = true - cart_console = "NES" if (force_cart or cart.detect_console(true)) then if cart_console == "NES" or cart_console == "Famicom" then @@ -179,7 +224,7 @@ function main () --]] - ---[[ + --[[ ciccom.start() @@ -464,7 +509,7 @@ function main () dict.io("IO_RESET") - elseif cart_console == "SegaGen" then + elseif cart_console == "SEGA" then elseif cart_console == "N64" then