Committing working build that was used for flashing STM8 SNES v3.1

boards for SF2 builds.  Not necessarily the most clean, but it was
stable and worked well.

Need to get swim comms working on other board designs.
Need to come up with better swim activation with more exact timing.
Still need to implement swim comms on avr, hopefully that doesn't prove
to be too much of a PITA...  Not looking forward to that.  Can probably
only handle low speed, and faking pullup may not work as well without
time on it's side @ 16Mhz...
This commit is contained in:
Paul blue asus 2017-12-20 09:28:01 -06:00
parent b7364b964c
commit 535b45be27
16 changed files with 2061 additions and 1718 deletions

Binary file not shown.

View File

@ -1,4 +1,4 @@
:100000000C9476000C94560C0C9493000C94930072
:100000000C9476000C94950D0C9493000C94930032
:100010000C9493000C9493000C9493000C94930014
:100020000C9493000C9493000C9493000C94930004
:100030000C9493000C9493000C9493000C949300F4
@ -13,10 +13,10 @@
:1000C00049006E00660069006E00690074006500FA
:1000D0004E00650073004C006900760065007300F7
:1000E0002E0063006F006D000403090411241FBE7D
:1000F000CFEFD4E0DEBFCDBF11E0A0E0B1E0E8E299
:10010000FBE102C005900D92A630B107D9F723E0BC
:10011000A6E0B1E001C01D92A83AB207E1F70E9443
:100120006A0D0C94920D0C9400000F931F93CF93C3
:1000F000CFEFD4E0DEBFCDBF11E0A0E0B1E0E6EA93
:10010000FDE102C005900D92A630B107D9F723E0BA
:10011000A6E0B1E001C01D92AD3AB207E1F70E943E
:10012000A90E0C94D10E0C9400000F931F93CF9343
:10013000DF93EC01FB01D9010091470110914801C7
:10014000888187FF09C08E818C93442399F00481B4
:10015000158180E883831DC08FEF8C938E818093FF
@ -29,13 +29,13 @@
:1001C0006303F09164030480F581E02D8D818183C8
:1001D000E0916303F091640387818E5F8783C80198
:1001E000DF91CF911F910F910895803D11F41C92E2
:1001F000CCCF8FEF8C9380E10E943F07C6CFE09178
:1001F000CCCF8FEF8C9380E10E947A07C6CFE0913D
:100200002001F09121018381811106C0F0936403E4
:10021000E093630380E9B8CF883969F7E8CFE3E575
:10022000F1E08FEF819391E0E336F907D9F78093FE
:10023000460180932501809345018093240180939A
:10024000360180931301809335018093120181E080
:100250000C943F07CF93DF93FC0150E0CA01820F5B
:100250000C947A07CF93DF93FC0150E0CA01820F20
:10026000911D4197E4F52223E1F183818F3FD9F578
:1002700082818F3FD1F5DA01AD5ABE4FED0180E0AA
:1002800099919F3FA1F58F5F2813FACF6283138264
@ -83,355 +83,395 @@
:10052000920769F021E08232920761F021E0833383
:10053000920759F021E08031920769F7DBCF82E220
:1005400091E0089583E391E0089580E191E00895BA
:100550001F93CF93DF930E944507823D09F071C03E
:100550001F93CF93DF930E948007823D09F071C003
:100560000E9459028093060183E491E09093210157
:10057000809320010E944507823DA1F4D09106019D
:10057000809320010E948007823DA1F4D091060162
:100580008091200190912101C1E0CD1708F45FC056
:10059000909321018093200120E8FC01238380EDCA
:1005A0000E943F070E944507823F41F480EF0E946E
:1005B0003F07E0912001F091210113820E9445073D
:1005A0000E947A070E948007823F41F480EF0E94F8
:1005B0007A07E0912001F091210113820E948007C7
:1005C000C82F803DE1F48091200190912101FC0130
:1005D00023812038A1F4609106010E94700290935B
:1005E000210180932001FC011782C3830E944003F4
:1005E000210180932001FC011782C3830E943F03F5
:1005F000E0912001F0912101882371F183830E9411
:100600004507182F803FC9F4C0912001D0912101E6
:100600008007182F803FC9F4C0912001D0912101AB
:100610008B81883991F460910601CE010E947002AD
:100620009093210180932001FC0113821B83CE0152
:100630000E94D2048823D1F08B83DF91CF911F9148
:1006400008950E944507823F09F094CF89CF6D2F0E
:100650000E947002CF5F99CF88ED838320858081CF
:100660009181820F911D91838083C9CF84EF8B8309
:10067000288588819981820F911D99838883DDCF98
:100680000F93CF93DF93EC01688179818985823163
:1006900011F130F4803169F08131A1F083EC05C0B3
:1006A0008331D9F08431D1F780E0DF91CF910F9180
:1006B000089560680FEF2E814A818C819D810E9490
:1006C000AE0607C00FEF2E814A818C819D810E946A
:1006D000E5068F83E9CF6066EDCF8FEF84B9CB015C
:1006E000880F892F881F990B919585B95F9A5F981C
:1006F00014B860680FEF2E814A818C819D810E9421
:10070000720AE7CF7F928F929F92AF92BF92CF9261
:10071000DF92EF92FF920F931F93CF93DF936A01C3
:100720005901DA011796CC91D0E0E62EF12CFE2C7F
:10073000EE24D60116968C91169790E08C179D07A3
:1007400088F41796CC9380E0DF91CF911F910F91A1
:10075000FF90EF90DF90CF90BF90AF909F908F90E1
:100760007F9008956AEA85E595E5F501099565E5C7
:100770008AEA9AE2F501099560EA85E595E5F501D1
:100780000995CE0199274C018E289F28D6011496F1
:10079000ED91FC911597E80FF91F6081C401F501F7
:1007A00009950E94370BC401F8010995782EC40100
:1007B000F80109957812F5CF2196BBCF7F928F92E1
:1007C0009F92AF92BF92CF92DF92EF92FF920F93E0
:1007D0001F93CF93DF936A015901DA011796CC91E9
:1007E000D0E0E62EF12CFE2CEE24D60116968C914C
:1007F000169790E08C179D0788F41796CC9380E0AD
:10080000DF91CF911F910F91FF90EF90DF90CF90EC
:10081000BF90AF909F908F907F9008956AEA85E592
:1008200095E1F501099565E58AEA9AE0F5010995F2
:1008300060EA85E595E1F5010995CE0199274C011E
:100840008E289F28D6011496ED91FC911597E80FFC
:10085000F91F6081C401F50109950E94370BC4019D
:10086000F8010995782EC401F80109957812F5CFA1
:100870002196BBCF4F925F927F928F929F92AF92C1
:100630000E94E5048823C9F08B83DF91CF911F913D
:1006400008950E948007823F09F094CF89CF6D2FD3
:100650000E947002CF5F99CF208580819181820FA7
:10066000911D9183808388EDC9CF84EF8B8328858A
:1006700088819981820F911D99838883DECF0F93A2
:10068000CF93DF93EC01688179818985823111F103
:1006900030F4803169F08131A1F083EC05C0833101
:1006A000D9F08431D1F780E0DF91CF910F91089597
:1006B00060680FEF2E814A818C819D810E94E9063E
:1006C00007C00FEF2E814A818C819D810E942007F7
:1006D0008F83E9CF6066EDCF8FEF84B9CB01880FB0
:1006E000892F881F990B919585B95F9A5F9814B8E7
:1006F00060680FEF2E814A818C819D810E94AD0A36
:10070000E7CF7F928F929F92AF92BF92CF92DF926C
:10071000EF92FF920F931F93CF93DF936A015901DA
:10072000DA011796CC91D0E0E62EF12CFE2CEE24C7
:10073000D60116968C91169790E08C179D0788F439
:100740001796CC9380E0DF91CF911F910F91FF908E
:10075000EF90DF90CF90BF90AF909F908F907F9061
:1007600008956AEA85E595E5F501099565E58AEA62
:100770009AE2F501099560EA85E595E5F5010995A7
:10078000CE0199274C018E289F28D6011496ED9111
:10079000FC911597E80FF91F6081C401F5010995D7
:1007A0000E94760CC401F8010995782EC401F80165
:1007B00009957812F5CF2196BBCF7F928F929F92A9
:1007C000AF92BF92CF92DF92EF92FF920F931F935F
:1007D000CF93DF936A015901DA011796CC91D0E0EB
:1007E000E62EF12CFE2CEE24D60116968C9116974F
:1007F00090E08C179D0788F41796CC9380E0DF91EA
:10080000CF911F910F91FF90EF90DF90CF90BF900D
:10081000AF909F908F907F9008956AEA85E595E16B
:10082000F501099565E58AEA9AE0F501099560EA1E
:1008300085E595E1F5010995CE0199274C018E28B2
:100840009F28D6011496ED91FC911597E80FF91F9A
:100850006081C401F50109950E94760CC401F8017C
:100860000995782EC401F80109957812F5CF2196E3
:10087000BBCF4F925F926F927F928F929F92AF9277
:10088000BF92CF92DF92EF92FF920F931F93CF937D
:10089000DF93A62E6A01E901DA011796EC90F12C9C
:1008A000A89558986AEA8AEA9AE0F901099565E5F7
:1008B00085E595E0FE01099560E28AEA9AE0FE018D
:1008C0000995B12CBA2CAA24D60116968C911697AC
:1008D00090E08E159F0518F51796EC9260E980E080
:1008E00090E0FE01099560E080E090E0FE0109954E
:1008F00060EF80E090E0FE010995589A80E0DF917A
:10090000CF911F910F91FF90EF90DF90CF90BF900C
:10091000AF909F908F907F905F904F90089580EA66
:100920000E94650A2701552442018A289B28D60186
:100930001496ED91FC911597E40DF51D6081C401AD
:10094000FE010995589AA8950E94370BC401F80139
:100950000995782E5898D6011496ED91FC9115972B
:10096000E40DF51D8081781639F0589AC401F8011C
:1009700009955898781204C0FFEFEF1AFF0AA4CF28
:100980000000000000000000000000000000000067
:100990000000000000000000589AC401F801099509
:1009A000782EE4CF0F931F93AC01FC01608171811D
:1009B0009185923159F030F4903161F0913199F094
:1009C00083EC05C09331B9F09431D1F780E01F91E9
:1009D0000F910895606809EE15E02AED35E080E09A
:1009E0000E948203F3CF01E116E025E236E080E0C9
:1009F0000E94DE03EBCF8FEF84B9CB01880F892FE4
:100A0000881F990B919585B95F9A5F9814B86068B3
:100A100002E21AE023E33AE080E00E943A04D6CFF3
:100A200014B88FEF85B93F9A479881B911B882B948
:100A300014B885B914B885B93898409A3998419A4C
:100A40003A98429A3C98449A3D98459A3E98469ADC
:100A500053985B9A55985D9A3B98439A3F98479A6A
:100A600057985F9A509858985198599A08950E94AB
:100A70001005399A419A389A40983A9A429A3C9A83
:100A8000449A3D9A459A14B88FEF85B914B885B940
:100A900014B885B93F9A479881B912B884B915B886
:100AA000479A479814B808950E941005399A419AB8
:100AB0003C9A449A3D9A459A509A589A14B88FEFA6
:100AC00085B914B885B914B885B93F9A479881B9E2
:100AD00012B884B915B8479A479814B814B885B9AC
:100AE000579A5F9884B915B85F9A5F9814B80895BB
:100AF0005898509A000089B15098589880FD22C0AB
:100B00005098589A59B149B1000039B1000000001D
:100B100029B100000000000099B1000000000000B1
:100B2000000089B15098589850FD0EC040FD0EC08D
:100B300030FD0EC020FD0EC090FD0EC080FD0EC029
:100B400080EE089580EF089580E0089581E0089593
:100B500083E0089586E008958AE008958FE008957F
:100B60000F931F93CF93DF931F92CDB7DEB7890109
:100B7000813089F030F0823091F0803899F086E948
:100B800004C089830E94100589810F90DF91CF9165
:100B90001F910F9108950E94370580E0F6CF0E94C3
:100BA0005405FBCF81E0F90180830E947805F801AC
:100BB0008183F3CF82B98FEF84B995B9479A47986B
:100BC00014B884B965B9509A58985098589A14B87E
:100BD000089582B92FEF24B995B9479A479814B868
:100BE000409A97FD4198000000000000000083B18A
:100BF0004098419A08955098589882B92FEF24B997
:100C000095B9479A479814B8429824B965B9409A5B
:100C100097FD4198000000004098419A429A14B80C
:100C20000895811520E2920708F4906882B98FEF49
:100C300084B995B9479A479814B8449800000000C1
:100C40000000000083B1449A0895811520E29207C4
:100C500008F4906882B98FEF84B995B9479A47989C
:100C600014B884B965B9000045980000459A14B8D5
:100C700008958FEF84B994E095B9479A479814B8CE
:100C800029B1207230E084B988E085B9479A479845
:100C900014B889B1807290E041E02115310509F066
:100CA00040E061E0009709F060E0442311F0611139
:100CB00016C051E0232B09F450E021E0892B09F400
:100CC00020E0552311F021110CC0662311F05111C1
:100CD0000AC0442311F0211108C08FEF089580E16C
:100CE000089581E1089582E1089583E108950F93C5
:100CF0001F93CF93C82FCA018901C23001F130F48C
:100D0000CC2391F0C130B9F0C0EA10C0C238D1F0A4
:100D1000C338F1F0C138C1F721E0F80120830E9407
:100D2000E905F801818309C00E94DA058C2FCF9173
:100D30001F910F9108950E942506C0E0F7CF0E94F1
:100D4000FB05FBCF21E0F80120830E941106E9CFCB
:100D500081E0F90180830E943906E3CFEF92FF9290
:100D60000F93CF93DF9300D01F92CDB7DEB77C01F6
:100D70008FEF84B965B9479A479814B8409A67FDD0
:100D8000419842B980E0011117C00000000093B102
:100D9000F701E80FF11D90834F5F42B98F5F28176D
:100DA00090F74098419A0F900F900F90DF91CF915C
:100DB0000F91FF90EF9008952B834A8389830E94BF
:100DC000370B89814A812B81E2CFEF92FF920F93FB
:100DD000CF93DF9300D01F92CDB7DEB77C01603296
:100DE00008F460688FEF84B965B9479A479814B8DA
:100DF000449842B980E0011116C00000000093B190
:100E0000F701E80FF11D90834F5F42B98F5F2817FC
:100E100090F7449A0F900F900F90DF91CF910F9120
:100E2000FF90EF9008952B834A8389830E94370BAC
:100E300089814A812B81E3CFCF93DF93FB01DC01D2
:100E400012962C91222329F0203479F082ED8083B0
:100E500008C01082A0910201B0910301EC018C81C5
:100E60008C93CF01DF91CF910895108281E081832F
:100E7000A0910201B09103018C918283F2CFE091A5
:100E80000201F091030180830895E0910201F09145
:100E90000301808108950F931F93D901082F10E05B
:100EA0000831110508F0C2C2F801E75AF84F0C9456
:100EB0008C0D93077107CE0729087508C1080D0925
:100EC000B809BD09C209C509C909CC09D409DC0999
:100ED000E009E309E709F009F709FB09030A0A0A2F
:100EE0000E0A4631510508F0A3C2FA01E658F84F40
:100EF0000C948C0D900796079A079E07A207A607E9
:100F0000AA07AE07B207B607BA07BE07C207C607E9
:100F1000180A180A180A180A180A180A180ACA0712
:100F20003898409A80E01F910F9108953998419A1E
:100F300080E0F9CF3A98429A80E0F5CF3B98439A07
:100F400080E0F1CF3C98449A80E0EDCF3D98459AFF
:100F500080E0E9CF3E98469A80E0E5CF3F98479AF7
:100F600080E0E1CF5098589A80E0DDCF5198599AAF
:100F700080E0D9CF53985B9A80E0D5CF55985D9AA1
:100F800080E0D1CF56985E9A80E0CDCF57985F9A97
:100F900080E0C9CF5098589A80E0C5CF46315105BE
:100FA00008F048C2FA01E952F84F0C948C0DED0795
:100FB000F107F507F907FD070108050809080D08FD
:100FC0001108150819081D0821081A0A1A0A1A0A10
:100FD0001A0A1A0A1A0A1A0A25083898409880E04C
:100FE000A2CF3998419880E09ECF3A98429880E00D
:100FF0009ACF3B98439880E096CF3C98449880E005
:1010000092CF3D98459880E08ECF3E98469880E0FC
:101010008ACF3F98479880E086CF5098589880E0D4
:1010200082CF5198599880E07ECF53985B9880E0AA
:101030007ACF55985D9880E076CF56985E9880E09C
:1010400072CF57985F9880E06ECF5098589880E0A4
:101050006ACF4631510508F0EFC1FA01EE5CF74F57
:101060000C948C0D48084B084E085108540857083A
:101070005A085D0860086308660869086C086F080C
:101080001C0A1C0A1C0A1C0A1C0A1C0A1C0A7208DC
:10109000389A80E048CF399A80E045CF3A9A80E08C
:1010A00042CF3B9A80E03FCF3C9A80E03CCF3D9AD4
:1010B00080E039CF3E9A80E036CF3F9A80E033CF50
:1010C000509A80E030CF519A80E02DCF539A80E043
:1010D0002ACF559A80E027CF569A80E024CF579A9E
:1010E00080E021CF509A80E01ECF4631510508F0B4
:1010F000A5C1FA01E258F74F0C948C0D940897089B
:101100009A089D08A008A308A608A908AC08AF087B
:10111000B208B508B808BB081E0A1E0A1E0A1E0A35
:101120001E0A1E0A1E0ABE08409880E0FCCE4198A6
:1011300080E0F9CE429880E0F6CE439880E0F3CE8E
:10114000449880E0F0CE459880E0EDCE469880E06F
:10115000EACE479880E0E7CE589880E0E4CE5998F0
:1011600080E0E1CE5B9880E0DECE5D9880E0DBCE73
:101170005E9880E0D8CE5F9880E0D5CE589880E029
:10118000D2CE4631510508F05BC1FA01E653F74F64
:101190000C948C0DE008E308E608E908EC08EF0879
:1011A000F208F508F808FB08FE0801090409070918
:1011B000200A200A200A200A200A200A200A0A09F6
:1011C000409A80E0B0CE419A80E0ADCE429A80E075
:1011D000AACE439A80E0A7CE449A80E0A4CE459A56
:1011E00080E0A1CE469A80E09ECE479A80E09BCEDA
:1011F000589A80E098CE599A80E095CE5B9A80E02C
:1012000092CE5D9A80E08FCE5E9A80E08CCE5F9A1F
:1012100080E089CE589A80E086CE82E08C93463179
:10122000510508F0A2C0FA01E85EF64F0C948C0D4F
:101230002E0937094009490952095B0964096D09FA
:1012400076097F09880991099A09A309B509B509A1
:10125000B509B509B509B509B509AC0986B18170FB
:1012600011968C93119712961C9280E05CCE86B1F9
:10127000827090E012969C938E93119780E053CEEB
:1012800086B1847090E012969C938E93119780E0C3
:101290004ACE86B1887090E012969C938E931197F7
:1012A00080E041CE86B1807190E012969C938E933F
:1012B000119780E038CE86B1807290E012969C93B0
:1012C0008E93119780E02FCE86B1807490E01296B5
:1012D0009C938E93119780E026CE86B1807890E023
:1012E00012969C938E93119780E01DCE89B18170E8
:1012F00011968C93119712961C9280E014CE89B1AE
:10130000827090E012969C938E93119780E00BCEA2
:1013100089B1887090E012969C938E93119780E02B
:1013200002CE89B1807290E012969C938E931197B1
:1013300080E0F9CD89B1807490E012969C938E93F1
:10134000119780E0F0CD89B1807890E012969C935F
:101350008E93119780E0E7CD89B1817011968C93BF
:10136000119712961C9280E0DECD1C928DE8DBCDA9
:1013700014B88FEF85B980E0D6CD14B88FEF85B95A
:1013800080E0D1CD14B880E0CECD8FEF84B980E07D
:10139000CACD45B980E0C7CD83B111968C93119722
:1013A00081E08C9380E0BFCD14B88FEF85B93F9A70
:1013B000479881B980E0B7CD8FEF82B980E0B3CD97
:1013C00011B880E0B0CD8FEF81B980E0ACCD42B9EB
:1013D0008FEF84B955B9479A479814B880E0A3CDE8
:1013E00014B88FEF85B9579A5F9880E09CCD5798D5
:1013F0005F9A80E098CD8FEF84B945B95F9A5F9886
:1014000014B880E090CD14B88FEF85B9579A5F98E3
:1014100080E089CD57985F9A80E085CD8FEF84B9C1
:1014200045B95F9A5F9814B880E07DCD8CE87BCD9C
:101430008DE879CD8DE877CD8DE875CD8DE873CDCC
:101440008DE871CD82B98FEF84B995B9479A4798E5
:1014500014B841984498000000000000000083B1D7
:10146000449A419A089582B98FEF84B995B9479A01
:10147000479814B884B965B94598419800000000B0
:1014800000000000459A419A14B80895CF93DF9365
:10149000952FE901813099F020F0823059F08AEAE5
:1014A00006C09FEF94B945B95F9A5F9814B8DF9171
:1014B000CF910895842F0E94330A80E0F8CF88836B
:1014C000842F0E94220A8983F8CF9FEF94B985B9AF
:1014D000459841980000000000000000459A419A9C
:1014E00014B80895EF92FF920F93CF93DF9300D03B
:1014F0001F92CDB7DEB77C018FEF84B965B9479AEB
:10150000479814B84498419842B980E0011119C035
:10151000000000000000000093B1F701E80FF11D8A
:1015200090834F5F42B98F5F281780F7449A419AA2
:101530000F900F900F90DF91CF910F91FF90EF9050
:1015400008952B834A8389830E94370B0000000093
:10155000000089814A812B81DFCFCF93DF931F92D7
:10156000CDB7DEB7FC018FEF809307011092080121
:1015700087E091E090938D0380938C03868189832B
:101580008181833049F130F4813091F08230D9F09B
:1015900080E816C0853091F140F18730C9F7AE017F
:1015A0004F5F5F4F67E071E0CF010E941C072EC0C4
:1015B0004481558128E031E0638182810E944B079C
:1015C0008093070127C04481558128E031E0638181
:1015D00082810E94B005F4CF4481558128E031E03A
:1015E000638182810E947706EBCF4481558128E098
:1015F00031E0638182810E94460AE2CFAE014F5FF3
:101600005F4F67E071E0CF010E94790190938D03F5
:1016100080938C0389810F90DF91CF910895E091A1
:101620006303F0916403278144815581322F360F83
:10163000231312C0E0916303F09164038781860F46
:10164000878380913201861B8093320181110DC006
:1016500088E9838381E00895FC017191CF01FA014B
:10166000E20FF11D70832F5FE3CF80E00895CF93E9
:10167000DF9360918E03635067FD91C080918B036F
:10168000CCE0D0E0C81BD109CE56DC4F80918A0354
:101690008D3209F0CFC0683009F07FC083EC8093B1
:1016A0007E038AE58093050110920F018881807680
:1016B00079F0CE010E94AD0A8F3F09F466C09F8188
:1016C000911169C09E81981708F065C0892F63C089
:1016D0002A8110928703998191110AC01092880380
:1016E00027E833E082E030938D0320938C03E7CF2B
:1016F000953029F420938F0327E833E0F4CF963018
:1017000099F59B81913059F48EE890E090938D0388
:1017100080938C0382E190E490930F01D0CF9230BC
:1017200019F48CE790E0F2CF9330A9F7211108C0AB
:1017300088EE90E090938D0380938C0384E0EBCF50
:10174000213041F48EEB90E090938D0380938C03D5
:101750008AE2E1CF2230F9F680EA90E090938D039F
:1017600080938C038EE1D7CF983059F0993019F4DB
:1017700020939103C1CF81E09A3009F4BDCF80E07E
:10178000BBCF21E933E081E0AECF988197FD8E8118
:1017900090E890930F018093040110928E03809142
:1017A000050184FF3AC0809104018F3FB1F1C82F39
:1017B000893008F0C8E08C1B8093040180917E037F
:1017C00098E8892780937E03CC23D1F080918C0305
:1017D00090918D0320910F0126FF3FC0AFE7B3E04A
:1017E000FC012C2F34913D9331962150D9F701966D
:1017F0002FEF2C0F820F911D90938D0380938C03FC
:101800006C2F8FE793E00E94520CCC5FCC3019F024
:101810008FEF80930401C093050184E199B1947125
:1018200031F48150D9F710928F0310928903DF9120
:10183000CF91089580910F0187FFAFCFCE010E9415
:101840000F0B8F3F21F48EE180930501A6CF8823F3
:1018500009F4A3CF10920401A0CFEFE7F3E0DC017D
:101860002C2F3D9131932150E1F7C1CFE9E6F0E013
:10187000808182608083E89A0895A82FB92F80E044
:1018800090E041E050EA609530E009C02D91822758
:101890009795879510F084279527305EC8F36F5F82
:1018A000A8F30895EADF8D939D930895CF93CFB762
:1018B000CF93DF93C3954C9BE9F74C9B0BC04C9B9C
:1018C00009C04C9B07C04C9B05C04C9B03C04C9B64
:1018D00001C089C06F93C0918B03DD27CE56DC4FCA
:1018E0002F9365E54C9B03C02F916F91E6CF0F932B
:1018F0001F934F9320E040E15F9309B1047104FB13
:1019000027F93F9350E03BE039C0147140642F77D2
:10191000012F5F5F1EC0406819B114712F775250BC
:101920001FC0406409B12F770471D1F15F5F00C01F
:1019300023C0406219B12F77147191F15F5F00C02D
:1019400025C004711027515012F45D5F0000115042
:1019500027952C3F19B1C8F614710127015027951E
:101960002C3FC8F64227499309B1047110274F73E1
:10197000115027952C3FA8F64695469519B114713C
:1019800079F00127015027952C3F98F66B5A60F3A8
:10199000315009B1B0F600C011E01CBB002717C0E0
:1019A0003B503195C31BD04011E01CBB0881033C68
:1019B000F9F00B34E9F0209189031981110F12130A
:1019C000EDCF093651F10D3211F0013E39F7009398
:1019D00090033F915F914F911F910F912F916F91C4
:1019E000CCB3C0FD67CFDF91CF91CFBFCF9118951A
:1019F00020919003222369F310918E03112339F56E
:101A000034303AF130938E0320938A0310918B0384
:101A10003BE0311B30938B031CC000918E030130DF
:101A2000B4F40AE53091050134FD14C000930501BA
:101A3000CEE7D3E013C0052710E000C000000BB9CB
:101A40001AC0052710E0221F1DC010E021C04AE582
:101A500002C032ED432FC4E1D0E032E01AB114618C
:101A60005C9A0BB11AB954E120E865E320FF052721
:101A70000BB9279517951C3FF0F66695B8F7B1F7A7
:101A800020FF05270BB9279517951C3FD0F6279502
:101A9000179517FF052700001C3F0BB9B0F62991D9
:101AA0003A9519F70B7E10918F03110FC651D04054
:101AB0000BB911F01093890311E01CBB00611AB13E
:101AC0001B7E402F4B7E54E05A95F1F70BB91AB9A3
:101AD0004BB97FCF9EE088E10FB6F894A89580932C
:101AE00060000FBE909360000E94360C549A80E014
:101AF000815051F4549878940E941005A8950E9442
:101B0000370B0E94A802FACFA895EFE9FFE03197C2
:101B1000F1F700C00000ECCFEE0FFF1F0590F4912D
:081B2000E02D0994F894FFCFB9
:061B280063016503FF5A92
:10089000DF93662E7A01E901DA0117965C90852CC8
:1008A000912CA89558986AEA8AEA9AE0F901099584
:1008B00065E585E595E0FE01099560E28AEA9AE042
:1008C000FE010995712C762C6624D70116968C9121
:1008D000169790E08815990520F517965C9260E9C7
:1008E00080E090E0FE01099560E080E090E0FE018C
:1008F000099560EF80E090E0FE010995589A80E04C
:10090000DF91CF911F910F91FF90EF90DF90CF90EB
:10091000BF90AF909F908F907F906F905F904F901F
:10092000089580EA0E94A00AC52CD12C5601A62861
:10093000B728D7011496ED91FC911597EC0DFD1D8C
:100940006081C501FE010995589AA8950E94760C10
:10095000C501F80109955898D7011496ED91FC91BD
:100960001597EC0DFD1D4080841541F0589A482ED6
:10097000C501F80109955898481213C0D70114967B
:100980008D919C911597C80ED91EF6018081481251
:1009900019C05394FFEF8F1A9F0A5198599A59988A
:1009A00094CF0000000000000000000000000000E4
:1009B00000000000000000000000589AC501F80186
:1009C0000995D5CF519A599A80CF0F931F93AC01B7
:1009D000FC01608171819185923159F030F4903140
:1009E00061F0913199F083EC05C09331B9F0943105
:1009F000D1F780E01F910F910895606804E216E03E
:100A000025E136E080E00E948103F3CF0CE416E09C
:100A100020E636E080E00E94DD03EBCF8FEF84B963
:100A2000CB01880F892F881F990B919585B95F9A03
:100A30005F9814B860680DE51AE02EE63AE080E0B1
:100A40000E943904D6CF14B88FEF85B93F9A4798E2
:100A500081B911B882B914B885B914B885B9389874
:100A6000409A3998419A3A98429A3C98449A3D98CB
:100A7000459A3E98469A53985B9A55985D9A3B984A
:100A8000439A3F98479A57985F9A50985898519828
:100A9000599A08950E942305399A419A389A4098A4
:100AA0003A9A429A3C9A449A3D9A459A14B88FEFE2
:100AB00085B914B885B914B885B93F9A479881B9F2
:100AC00012B884B915B8479A479814B808950E9487
:100AD0002305399A419A3C9A449A3D9A459A589AE4
:100AE000509A14B88FEF85B914B885B914B885B980
:100AF0003F9A479881B912B884B915B8479A479870
:100B000014B814B885B9579A5F9884B915B85F9A24
:100B10005F9814B80895823031F0833011F081303D
:100B2000A1F480E008955098589A88E08093820359
:100B300089E290E0909381038093800381E090E0CC
:100B400090937F0380937E03ECCF87E908955898B4
:100B5000509A000089B15098589880FD22C0509852
:100B6000589A59B149B1000039B10000000029B1CB
:100B700000000000000099B100000000000000002B
:100B800089B15098589850FD0EC040FD0EC030FD00
:100B90000EC020FD0EC090FD0EC080FD0EC080EE88
:100BA000089580EF089580E0089581E0089583E03E
:100BB000089586E008958AE008958FE008950F93E0
:100BC0001F93CF93DF931F92CDB7DEB78901823099
:100BD00009F130F4882381F08130C1F086E910C03A
:100BE0008330D9F08038D1F781E0F90180830E9409
:100BF000A705F80181830CC089830E9423058981A0
:100C00000F90DF91CF911F910F9108950E944A0597
:100C100080E0F6CF0E946705FBCF842F0F90DF9115
:100C2000CF911F910F910C948B0582B98FEF84B9EE
:100C300095B9479A479814B884B965B9509A5898A5
:100C40005098589A14B8089582B92FEF24B995B9DD
:100C5000479A479814B8409A97FD419800000000C1
:100C60000000000083B14098419A08955098589828
:100C700082B92FEF24B995B9479A479814B842988A
:100C800024B965B9409A97FD41980000000040984A
:100C9000419A429A14B80895811520E2920708F407
:100CA000906882B98FEF84B995B9479A479814B87C
:100CB0004498000000000000000083B1449A0895A9
:100CC000811520E2920708F4906882B98FEF84B909
:100CD00095B9479A479814B884B965B90000459802
:100CE0000000459A14B808958FEF84B994E095B93F
:100CF000479A479814B829B1207230E084B988E047
:100D000085B9479A479814B889B1807290E041E05C
:100D10002115310509F040E061E0009709F060E03D
:100D2000442311F0611116C051E0232B09F450E067
:100D300021E0892B09F420E0552311F021110CC08A
:100D4000662311F051110AC0442311F0211108C08B
:100D50008FEF089580E1089581E1089582E108957B
:100D600083E108950F931F93CF93C82FCA01890180
:100D7000C23001F130F4CC2391F0C130B9F0C0EAB7
:100D800010C0C238D1F0C338F1F0C138C1F721E04A
:100D9000F80120830E942406F801818309C00E9483
:100DA00015068C2FCF911F910F9108950E94600618
:100DB000C0E0F7CF0E943606FBCF21E0F801208388
:100DC0000E944C06E9CF81E0F90180830E947406FD
:100DD000E3CFEF92FF920F93CF93DF9300D01F9258
:100DE000CDB7DEB77C018FEF84B965B9479A4798D4
:100DF00014B8409A67FD419842B980E0011117C0CC
:100E00000000000093B1F701E80FF11D90834F5FE0
:100E100042B98F5F281790F74098419A0F900F9032
:100E20000F90DF91CF910F91FF90EF9008952B835A
:100E30004A8389830E94760C89814A812B81E2CF83
:100E4000EF92FF920F93CF93DF9300D01F92CDB715
:100E5000DEB77C01603208F460688FEF84B965B951
:100E6000479A479814B8449842B980E0011116C0D7
:100E70000000000093B1F701E80FF11D90834F5F70
:100E800042B98F5F281790F7449A0F900F900F90F8
:100E9000DF91CF910F91FF90EF9008952B834A83BC
:100EA00089830E94760C89814A812B81E3CFCF937D
:100EB000DF93FB01DC0112962C91222329F02034D0
:100EC00079F082ED808308C01082A0910201B09178
:100ED0000301EC018C818C93CF01DF91CF910895B8
:100EE000108281E08183A0910201B09103018C9175
:100EF0008283F2CFE0910201F09103018083089593
:100F0000E0910201F0910301808108950F931F93F6
:100F1000D901082F10E00831110508F0C2C2F8010C
:100F2000EC56F84F0C94CB0ECE07AC0709086408BA
:100F3000B008FC084809F309F809FD09000A040A89
:100F4000070A0F0A170A1B0A1E0A220A2B0A320A6C
:100F5000360A3E0A450A490A4631510508F0A3C23D
:100F6000FA01EB54F84F0C94CB0ECB07D107D50701
:100F7000D907DD07E107E507E907ED07F107F50701
:100F8000F907FD070108530A530A530A530A530A83
:100F9000530A530A05083898409A80E01F910F9130
:100FA00008953998419A80E0F9CF3A98429A80E0C2
:100FB000F5CF3B98439A80E0F1CF3C98449A80E08B
:100FC000EDCF3D98459A80E0E9CF3E98469A80E083
:100FD000E5CF3F98479A80E0E1CF5098589A80E05B
:100FE000DDCF5198599A80E0D9CF53985B9A80E031
:100FF000D5CF55985D9A80E0D1CF56985E9A80E023
:10100000CDCF57985F9A80E0C9CF5098589A80E02A
:10101000C5CF4631510508F048C2FA01EE5EF74FE0
:101020000C94CB0E28082C083008340838083C08EB
:101030004008440848084C085008540858085C0800
:10104000550A550A550A550A550A550A550A60089F
:101050003898409880E0A2CF3998419880E09ECFA0
:101060003A98429880E09ACF3B98439880E096CF98
:101070003C98449880E092CF3D98459880E08ECF90
:101080003E98469880E08ACF3F98479880E086CF88
:101090005098589880E082CF5198599880E07ECF40
:1010A00053985B9880E07ACF55985D9880E076CF32
:1010B00056985E9880E072CF57985F9880E06ECF28
:1010C0005098589880E06ACF4631510508F0EFC13A
:1010D000FA01E359F74F0C94CB0E83088608890870
:1010E0008C088F089208950898089B089E08A1080C
:1010F000A408A708AA08570A570A570A570A570AFE
:10110000570A570AAD08389A80E048CF399A80E0EC
:1011100045CF3A9A80E042CF3B9A80E03FCF3C9A5D
:1011200080E03CCF3D9A80E039CF3E9A80E036CFD8
:101130003F9A80E033CF509A80E030CF519A80E0E0
:101140002DCF539A80E02ACF559A80E027CF569A28
:1011500080E024CF579A80E021CF509A80E01ECFC4
:101160004631510508F0A5C1FA01E754F74F0C9438
:10117000CB0ECF08D208D508D808DB08DE08E10876
:10118000E408E708EA08ED08F008F308F608590A49
:10119000590A590A590A590A590A590AF908409824
:1011A00080E0FCCE419880E0F9CE429880E0F6CE17
:1011B000439880E0F3CE449880E0F0CE459880E0FC
:1011C000EDCE469880E0EACE479880E0E7CE58988A
:1011D00080E0E4CE599880E0E1CE5B9880E0DECEFE
:1011E0005D9880E0DBCE5E9880E0D8CE5F9880E0AE
:1011F000D5CE589880E0D2CE4631510508F05BC17B
:10120000FA01EB5FF64F0C94CB0E1B091E09210966
:10121000240927092A092D09300933093609390912
:101220003C093F0942095B0A5B0A5B0A5B0A5B0AED
:101230005B0A5B0A4509409A80E0B0CE419A80E0A3
:10124000ADCE429A80E0AACE439A80E0A7CE449ADF
:1012500080E0A4CE459A80E0A1CE469A80E09ECE62
:10126000479A80E09BCE589A80E098CE599A80E0C9
:1012700095CE5B9A80E092CE5D9A80E08FCE5E9AAA
:1012800080E08CCE5F9A80E089CE589A80E086CE4E
:1012900082E08C934631510508F0A2C0FA01ED5A64
:1012A000F64F0C94CB0E690972097B0984098D09EC
:1012B00096099F09A809B109BA09C309CC09D5093A
:1012C000DE09F009F009F009F009F009F009F00968
:1012D000E70986B1817011968C93119712961C9232
:1012E00080E05CCE86B1827090E012969C938E93E3
:1012F000119780E053CE86B1847090E012969C9353
:101300008E93119780E04ACE86B1887090E0129655
:101310009C938E93119780E041CE86B1807190E0CE
:1013200012969C938E93119780E038CE86B180728E
:1013300090E012969C938E93119780E02FCE86B109
:10134000807490E012969C938E93119780E026CE45
:1013500086B1807890E012969C938E93119780E0EE
:101360001DCE89B1817011968C93119712961C92A3
:1013700080E014CE89B1827090E012969C938E9397
:10138000119780E00BCE89B1887090E012969C9303
:101390008E93119780E002CE89B1807290E0129610
:1013A0009C938E93119780E0F9CD89B1807490E081
:1013B00012969C938E93119780E0F0CD89B180783E
:1013C00090E012969C938E93119780E0E7CD89B1BF
:1013D000817011968C93119712961C9280E0DECD4D
:1013E0001C928DE8DBCD14B88FEF85B980E0D6CDA7
:1013F00014B88FEF85B980E0D1CD14B880E0CECDA0
:101400008FEF84B980E0CACD45B980E0C7CD83B104
:1014100011968C93119781E08C9380E0BFCD14B826
:101420008FEF85B93F9A479881B980E0B7CD8FEFAC
:1014300082B980E0B3CD11B880E0B0CD8FEF81B933
:1014400080E0ACCD42B98FEF84B955B9479A47983F
:1014500014B880E0A3CD14B88FEF85B9579A5F9880
:1014600080E09CCD57985F9A80E098CD8FEF84B94B
:1014700045B95F9A5F9814B880E090CD14B88FEFAB
:1014800085B9579A5F9880E089CD57985F9A80E038
:1014900085CD8FEF84B945B95F9A5F9814B880E025
:1014A0007DCD8CE87BCD8DE879CD8DE877CD8DE84D
:1014B00075CD8DE873CD8DE871CD82B98FEF84B98C
:1014C00095B9479A479814B841984498000000008D
:1014D0000000000083B1449A419A089582B98FEFC9
:1014E00084B995B9479A479814B884B965B94598AD
:1014F00041980000000000000000459A419A14B88D
:101500000895CF93DF93952FE901813099F020F072
:10151000823059F08AEA06C09FEF94B945B95F9AC4
:101520005F9814B8DF91CF910895842F0E946E0ABE
:1015300080E0F8CF8883842F0E945D0A8983F8CFEA
:101540009FEF94B985B945984198000000000000CC
:101550000000459A419A14B80895EF92FF920F93B4
:10156000CF93DF9300D01F92CDB7DEB77C018FEF12
:1015700084B965B9479A479814B84498419842B9D4
:1015800080E0011119C0000000000000000093B1CC
:10159000F701E80FF11D90834F5F42B98F5F281765
:1015A00080F7449A419A0F900F900F90DF91CF915E
:1015B0000F91FF90EF9008952B834A8389830E94B7
:1015C000760C00000000000089814A812B81DFCF6A
:1015D00020E030E02817390709F4089500000000E2
:1015E0002F5F3F4FF7CFCF93DF934091820350E0BF
:1015F00020E030E060E084E00E94860780E190E037
:101600000E94E80A4091820350E020E030E060E070
:1016100085E00E948607C4E0D0E04091820350E05C
:1016200020E030E060E084E00E9486078EEC92E0EB
:101630000E94E80A4091820350E020E030E060E040
:1016400085E00E948607219741F7C4E0D0E084E658
:1016500091E00E94E80A4091820350E020E030E0EF
:1016600060E084E00E94860783E691E00E94E80A39
:101670004091820350E020E030E060E085E00E948D
:101680008607219721F7DF91CF910895409182033A
:1016900050E020E030E060E084E00E94860780E1D6
:1016A00090E00E94E80A4091820350E020E030E0A0
:1016B00060E085E00C94860781E00895482F90E073
:1016C000982F882720E0411103C0211180680895D8
:1016D00020953FEF340F4323F6CF80E090E008954C
:1016E0001F93CF93DF931F92CDB7DEB7182F892FAB
:1016F00069830E945E0B812F0E945E0B6981862F99
:101700000E945E0B81E00F90DF91CF911F910895B1
:101710000F931F93CF93DF931F92CDB7DEB789014D
:10172000823009F130F4882381F08130C1F082E801
:1017300010C08131E9F08132D1F781E0F901808375
:10174000CA010E94700BF80111C089830E94F30A3C
:1017500089810F90DF91CF911F910F9108950E9481
:10176000460B80E0F6CF81E0F90180838183F9CFD9
:1017700082E0F901808312821182F3CFCF93DF934D
:101780001F92CDB7DEB7DC018FEF80930701109277
:10179000080187E091E0909392038093910316965D
:1017A0008C91169789831196EC9111974E2F50E0EA
:1017B000FA013197E830F10508F06EC0EE51F44FB0
:1017C0000C94CB0EEA0BFA0B080C160C320C4C0CDA
:1017D000430C240C14964D915C91159728E031E050
:1017E00013966C91139712968C910E9486078093A2
:1017F000070144C014964D915C91159728E031E0A3
:1018000013966C91139712968C910E94DF05EFCF7F
:1018100014964D915C91159728E031E013966C91E8
:10182000139712968C910E94B206E1CF14964D91B7
:101830005C91159728E031E013966C9113971296FE
:101840008C910E94810AD3CF14964D915C9115978B
:1018500028E031E013966C91139712968C910E94B8
:10186000880BC5CFAE014F5F5F4F67E071E0CD01E0
:101870000E947901909392038093910389810F9044
:10188000DF91CF910895AE014F5F5F4F67E071E048
:10189000CD010E945707EECF80E8A9CFE091630306
:1018A000F0916403278144815581322F360F231331
:1018B00012C0E0916303F09164038781860F8783F0
:1018C00080913201861B8093320181110DC088E91D
:1018D000838381E00895FC017191CF01FA01E20F49
:1018E000F11D70832F5FE3CF80E00895CF93DF93E6
:1018F00060919303635067FD91C080919003CCE0A9
:10190000D0E0C81BD109C956DC4F80918F038D32BE
:1019100009F0CFC0683009F07FC083EC8093830367
:101920008AE58093050110920F018881807679F015
:10193000CE010E94BE0B8F3F09F466C09F819111BA
:1019400069C09E81981708F065C0892F63C02A81FD
:1019500010928C03998191110AC010928D032CE88A
:1019600033E082E03093920320939103E7CF9530E8
:1019700029F4209394032CE833E0F4CF963099F5C2
:101980009B81913059F48EE890E09093920380937C
:10199000910382E190E490930F01D0CF923019F43B
:1019A0008CE790E0F2CF9330A9F7211108C088EEC0
:1019B00090E0909392038093910384E0EBCF2130E9
:1019C00041F48EEB90E090939203809391038AE22E
:1019D000E1CF2230F9F680EA90E090939203809371
:1019E00091038EE1D7CF983059F0993019F42093B4
:1019F0009603C1CF81E09A3009F4BDCF80E0BBCF20
:101A000026E933E081E0AECF988197FD8E8190E8A2
:101A100090930F018093040110929303809105012C
:101A200084FF3AC0809104018F3FB1F1C82F893003
:101A300008F0C8E08C1B809304018091830398E830
:101A4000892780938303CC23D1F0809191039091D7
:101A5000920320910F0126FF3FC0A4E8B3E0FC01F0
:101A60002C2F34913D9331962150D9F701962FEFC9
:101A70002C0F820F911D90939203809391036C2FF2
:101A800084E893E00E94910DCC5FCC3019F08FEF89
:101A900080930401C093050184E199B1947131F4FC
:101AA0008150D9F71092940310928E03DF91CF9159
:101AB000089580910F0187FFAFCFCE010E944E0C99
:101AC0008F3F21F48EE180930501A6CF882309F48E
:101AD000A3CF10920401A0CFE4E8F3E0DC012C2FA7
:101AE0003D9131932150E1F7C1CFE9E6F0E08081EB
:101AF00082608083E89A0895A82FB92F80E090E053
:101B000041E050EA609530E009C02D918227979519
:101B1000879510F084279527305EC8F36F5FA8F390
:101B20000895EADF8D939D930895CF93CFB7CF9318
:101B3000DF93C3954C9BE9F74C9B0BC04C9B09C0B2
:101B40004C9B07C04C9B05C04C9B03C04C9B01C0E9
:101B500089C06F93C0919003DD27C956DC4F2F9346
:101B600065E54C9B03C02F916F91E6CF0F931F93B8
:101B70004F9320E040E15F9309B1047104FB27F922
:101B80003F9350E03BE039C0147140642F77012F40
:101B90005F5F1EC0406819B114712F7752501FC08B
:101BA000406409B12F770471D1F15F5F00C023C099
:101BB000406219B12F77147191F15F5F00C025C0A9
:101BC00004711027515012F45D5F000011502795E9
:101BD0002C3F19B1C8F614710127015027952C3FED
:101BE000C8F64227499309B1047110274F73115069
:101BF00027952C3FA8F64695469519B1147179F0B2
:101C00000127015027952C3F98F66B5A60F331500D
:101C100009B1B0F600C011E01CBB002717C03B5053
:101C20003195C31BD04011E01CBB0881033CF9F087
:101C30000B34E9F020918E031981110F1213EDCFAF
:101C4000093651F10D3211F0013E39F70093950339
:101C50003F915F914F911F910F912F916F91CCB355
:101C6000C0FD67CFDF91CF91CFBFCF911895209165
:101C70009503222369F310919303112339F534302E
:101C80003AF13093930320938F03109190033BE03C
:101C9000311B309390031CC0009193030130B4F4C6
:101CA0000AE53091050134FD14C000930501C3E835
:101CB000D3E013C0052710E000C000000BB91AC024
:101CC000052710E0221F1DC010E021C04AE502C018
:101CD00032ED432FC4E1D0E032E01AB114615C9AD6
:101CE0000BB11AB954E120E865E320FF05270BB9D1
:101CF000279517951C3FF0F66695B8F7B1F720FFCA
:101D000005270BB9279517951C3FD0F627951795F2
:101D100017FF052700001C3F0BB9B0F629913A9533
:101D200019F70B7E10919403110FC651D0400BB9D7
:101D300011F010938E0311E01CBB00611AB11B7EE1
:101D4000402F4B7E54E05A95F1F70BB91AB94BB9B5
:101D50007FCF9EE088E10FB6F894A895809360004D
:101D60000FBE909360000E94750D549A80E08150E0
:101D700051F4549878940E942305A8950E94760CFB
:101D80000E94A802FACFA895EFE9FFE03197F1F79A
:101D900000C00000ECCFEE0FFF1F0590F491E02D86
:061DA0000994F894FFCF46
:061DA60063016503FF5A12
:00000001FF

Binary file not shown.

Binary file not shown.

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -106,6 +106,10 @@ speed_dir:
//;mov speed, #4 //;4 = 1.25usec bit time delay variable
//;mov speed, #22
//;TODO should probably disable interrupts while transferring data via SWIM as it's timing sensitive
//; haven't touched this code in awhile and can't get myself to make this update right now..
//; may want something similar when entering swim activation
//; set pushpull and opendrain to values we can write to otyper register
//; to quickly change direction of the SWIM pin only
ldr pushpull, [swim_base, #OTYPER]

View File

@ -105,6 +105,11 @@ uint8_t write_page_chr( uint8_t bank, uint8_t addrH, buffer *buff, write_funcptr
}
//#define PRGM_MODE() swim_wotf(SWIM_HS, 0x500F, 0x40)
//#define PLAY_MODE() swim_wotf(SWIM_HS, 0x500F, 0x00)
#define PRGM_MODE() EXP0_LO()
#define PLAY_MODE() EXP0_HI()
uint8_t write_page_snes( uint8_t bank, uint8_t addrH, buffer *buff, write_funcptr wr_func, read_funcptr rd_func )
{
uint16_t cur = buff->cur_byte;
@ -119,7 +124,19 @@ uint8_t write_page_snes( uint8_t bank, uint8_t addrH, buffer *buff, write_funcpt
//set to program mode for first entry
EXP0_LO();
//EXP0_LO();
//swim_wotf(SWIM_HS, 0x500F, 0x40)
PRGM_MODE();
//; TODO I don't think all these NOPs are actually needed, but they work and don't seem to significantly affect program time on stm32
NOP();
NOP();
NOP();
NOP();
NOP();
NOP();
NOP();
NOP();
//enter unlock bypass mode
wr_func( 0x0AAA, 0xAA );
@ -161,7 +178,16 @@ uint8_t write_page_snes( uint8_t bank, uint8_t addrH, buffer *buff, write_funcpt
//and optimizing flash routine to get time down.
//exit program mode
EXP0_HI();
// EXP0_HI();
PLAY_MODE();
NOP();
NOP();
NOP();
NOP();
NOP();
NOP();
NOP();
NOP();
//pre-fetch next byte of data
//cur_data = buff->data[n+1];
#ifdef AVR_CORE
@ -183,21 +209,66 @@ uint8_t write_page_snes( uint8_t bank, uint8_t addrH, buffer *buff, write_funcpt
usbPoll();
read = rd_func((addrH<<8)|n);
//prepare for upcoming write cycle, or allow for a polling read
EXP0_LO();
//EXP0_LO();
PRGM_MODE();
NOP();
NOP();
NOP();
NOP();
NOP();
NOP();
NOP();
NOP();
//First check if already outputting final data
if (read != buff->data[n] ) {
//if not, lets see if toggle is occuring
EXP0_HI();
//EXP0_HI();
PLAY_MODE();
NOP();
NOP();
NOP();
NOP();
NOP();
NOP();
NOP();
NOP();
while( read != rd_func((addrH<<8)|n) ){
EXP0_LO();
//EXP0_LO();
PRGM_MODE();
NOP(); NOP(); NOP(); NOP();
NOP(); NOP(); NOP(); NOP();
NOP(); NOP(); NOP(); NOP();
EXP0_HI();
NOP();
NOP();
NOP();
NOP();
NOP();
NOP();
NOP();
NOP();
//EXP0_HI();
PLAY_MODE();
NOP();
NOP();
NOP();
NOP();
NOP();
NOP();
NOP();
NOP();
read = rd_func((addrH<<8)|n);
}
//prepare for upcoming write cycle
EXP0_LO();
//EXP0_LO();
PRGM_MODE();
NOP();
NOP();
NOP();
NOP();
NOP();
NOP();
NOP();
NOP();
}
// //IDK why, but AVR will exit early sometimes
@ -236,7 +307,8 @@ uint8_t write_page_snes( uint8_t bank, uint8_t addrH, buffer *buff, write_funcpt
wr_func( 0x0000, 0xF0 );
//exit program mode
EXP0_HI();
//EXP0_HI();
PLAY_MODE();
return SUCCESS;

View File

@ -4,6 +4,7 @@
#include "pinport.h"
#include "types.h"
#include "nes.h"
#include "swim.h"
#include "shared_dictionaries.h"
#include "shared_errors.h"

View File

@ -181,6 +181,7 @@ void snes_init()
//disable SRAM and put cart in PLAY mode
EXP0_HI();
EXP0_OP();
//if SWIM is active, EXP0 must be set to pullup prior to SWIM transfers
//other control pins are inputs or unused, leave as IP pullup from reset

View File

@ -5,6 +5,7 @@ local dump = {}
-- import required modules
local dict = require "scripts.app.dict"
local buffers = require "scripts.app.buffers"
local snes = require "scripts.app.snes"
-- file constants
@ -246,9 +247,12 @@ local function dump_snes( file, mapping, debug )
if debug then print("dumping cart") end
--start with reset and init
dict.io("IO_RESET")
--dict.io("IO_RESET")
dict.io("SNES_INIT")
--set cart in play mode
snes.play_mode()
--setup buffers and manager
dict.operation("SET_OPERATION", op_buffer["RESET"] )
--reset buffers first
@ -319,10 +323,12 @@ local function dump_snes( file, mapping, debug )
file:write( dict.buffer_payload_in( buff_size ))
-- print("dumped page:", i)
if ( (i % (1024*1024/buff_size/16)) == 0) then
--if ( (i % (1024*1024/buff_size/16)) == 0) then
if ( (i % (4*2024*1024/buff_size/16)) == 0) then
local tdelta = os.clock() - tlast
print("time delta:", tdelta, "seconds, speed:", (1024/16/tdelta), "KBps");
print("dumped part:", i/1024, "of 16 \n")
--print("dumped part:", i/1024, "of 16 \n")
print("dumped part:", i/(4*1024), "of 4 \n")
tlast = os.clock();
end
end
@ -354,7 +360,7 @@ local function dump_snes( file, mapping, debug )
--reset io at end
dict.operation("SET_OPERATION", op_buffer["RESET"] )
dict.buffer("RAW_BUFFER_RESET")
dict.io("IO_RESET")
-- dict.io("IO_RESET")
return true
end

View File

@ -4,6 +4,8 @@ local erase = {}
-- import required modules
local dict = require "scripts.app.dict"
--local swim = require "scripts.app.swim"
local snes = require "scripts.app.snes"
-- file constants
@ -61,14 +63,14 @@ local function erase_snes(debug)
print("erasing SNES takes about 30sec");
dict.io("IO_RESET")
-- dict.io("IO_RESET")
dict.io("SNES_INIT")
--WR $AAA:AA $555:55 $AAA:AA
dict.snes("SNES_SET_BANK", 0x00)
--put cart in program mode
dict.pinport("CTL_SET_LO", "SNES_RST")
snes.prgm_mode()
dict.snes("SNES_ROM_WR", 0x0AAA, 0xAA)
dict.snes("SNES_ROM_WR", 0x0555, 0x55)
@ -78,7 +80,7 @@ local function erase_snes(debug)
dict.snes("SNES_ROM_WR", 0x0AAA, 0x10)
--exit program mode
dict.pinport("CTL_SET_HI", "SNES_RST")
snes.play_mode()
rv = dict.snes("SNES_ROM_RD", 0x0000)
@ -92,13 +94,16 @@ local function erase_snes(debug)
print(i, " done erasing snes.\n");
--put cart in program mode
dict.pinport("CTL_SET_LO", "SNES_RST")
-- swim.start()
snes.prgm_mode()
--reset flash
dict.snes("SNES_ROM_WR", 0x0000, 0xF0)
--return to PLAY mode
dict.pinport("CTL_SET_HI", "SNES_RST")
print("erase play")
snes.play_mode()
print("erase play")
end

View File

@ -5,6 +5,7 @@ local flash = {}
-- import required modules
local dict = require "scripts.app.dict"
local buffers = require "scripts.app.buffers"
local snes = require "scripts.app.snes"
-- file constants
@ -390,7 +391,7 @@ local function flash_snes( file, debug )
if debug then print("flashing cart") end
-- //start with reset and init
dict.io("IO_RESET")
-- dict.io("IO_RESET")
dict.io("SNES_INIT")
-- //start operation at reset
@ -420,7 +421,7 @@ local function flash_snes( file, debug )
dict.buffer("SET_MAP_N_MAPVAR", (op_buffer["LOROM"]<<8 | op_buffer["NOVAR"]), buff1 )
--set cart in program mode
dict.pinport("CTL_SET_LO", "SNES_RST")
snes.prgm_mode()
print("\n\nsetting operation STARTFLASH");
-- //inform buffer manager to start dumping operation now that buffers are initialized
@ -451,10 +452,15 @@ local function flash_snes( file, debug )
if ( i == 2048*1024/buff_size) then break end
-- if ( i == 32*1024/buff_size) then break end
i = i + 1
if ( (i % (2048*1024/buff_size/16)) == 0) then
-- if ( (i % (2048*1024/buff_size/16)) == 0) then
-- local tdelta = os.clock() - tlast
-- print("time delta:", tdelta, "seconds, speed:", (2048/16/tdelta), "KBps");
-- print("flashed part:", i/512, "of 16 \n")
-- tlast = os.clock();
if ( (i % (4*2048*1024/buff_size/16)) == 0) then
local tdelta = os.clock() - tlast
print("time delta:", tdelta, "seconds, speed:", (2048/16/tdelta), "KBps");
print("flashed part:", i/512, "of 16 \n")
print("time delta:", tdelta, "seconds, speed:", (4*2048/16/tdelta), "KBps");
print("flashed part:", i/(4*512), "of 4 \n")
tlast = os.clock();
end
end
@ -480,10 +486,10 @@ local function flash_snes( file, debug )
dict.operation("SET_OPERATION", op_buffer["RESET"] )
--set cart in play mode
dict.pinport("CTL_SET_HI", "SNES_RST")
snes.play_mode()
dict.buffer("RAW_BUFFER_RESET")
dict.io("IO_RESET")
-- dict.io("IO_RESET")
end

View File

@ -4,13 +4,38 @@ local snes = {}
-- import required modules
local dict = require "scripts.app.dict"
local swim = require "scripts.app.swim"
-- file constants
local RESET_VECT_HI = 0xFFFD
local RESET_VECT_LO = 0xFFFC
-- global variables so other modules can use them
snes_swimcart = nil
-- local functions
local function prgm_mode(debug)
if debug then print("going to program mode, swim:", snes_swimcart) end
if snes_swimcart then
print("ERROR cart got set to swim mode somehow!!!")
-- swim.snes_v3_prgm(debug)
else
dict.pinport("CTL_SET_LO", "SNES_RST")
end
end
local function play_mode(debug)
if debug then print("going to play mode, swim:", snes_swimcart) end
if snes_swimcart then
-- swim.snes_v3_play(debug)
print("ERROR cart got set to swim mode somehow!!!")
else
dict.pinport("CTL_SET_HI", "SNES_RST")
end
end
-- Desc:read reset vector from passed in bank
-- Pre: snes_init() been called to setup i/o
-- Post:Address left on bus memories disabled
@ -18,7 +43,7 @@ local RESET_VECT_LO = 0xFFFC
local function read_reset_vector( bank, debug )
--ensure cart is in play mode
dict.pinport("CTL_SET_HI", "SNES_RST")
play_mode()
--first set SNES bank A16-23
dict.snes("SNES_SET_BANK", bank)
@ -49,14 +74,15 @@ local function read_flashID( debug )
dict.snes("SNES_SET_BANK", 0x00)
--put cart in program mode
dict.pinport("CTL_SET_LO", "SNES_RST")
--v3.0 boards don't use EXP0 for program mode, must use SWIM via CIC
prgm_mode()
dict.snes("SNES_ROM_WR", 0x0AAA, 0xAA)
dict.snes("SNES_ROM_WR", 0x0555, 0x55)
dict.snes("SNES_ROM_WR", 0x0AAA, 0x90)
--exit program mode
dict.pinport("CTL_SET_HI", "SNES_RST")
play_mode()
--read manf ID
local manf_id = dict.snes("SNES_ROM_RD", 0x0000)
@ -71,14 +97,13 @@ local function read_flashID( debug )
if debug then print("attempted read SNES boot sect ID:", string.format("%X", boot_sect)) end
--put cart in program mode
dict.pinport("CTL_SET_LO", "SNES_RST")
prgm_mode()
--exit software
dict.snes("SNES_ROM_WR", 0x0000, 0xF0)
--exit program mode
dict.pinport("CTL_SET_HI", "SNES_RST")
play_mode()
--return true if detected flash chip
if (manf_id == 0x01 and prod_id == 0x49) then
@ -89,8 +114,6 @@ local function read_flashID( debug )
end
-- global variables so other modules can use them
-- call functions desired to run when script is called/imported
@ -98,6 +121,8 @@ end
-- functions other modules are able to call
snes.read_reset_vector = read_reset_vector
snes.read_flashID = read_flashID
snes.prgm_mode = prgm_mode
snes.play_mode = play_mode
-- return the module's table
return snes

View File

@ -27,6 +27,7 @@ ECODE.HERR = 0x09
local cur_CSR = 0x00
local SWIM_CSR = 0x7F80
local DEF_MAX_NAK = 8
-- local functions
local function get_key_for_value( t, value )
@ -38,12 +39,12 @@ local function get_key_for_value( t, value )
return nil
end
local function system_reset()
local function system_reset( debug )
--TODO if cur_CSR has bit 2 set, SWIM must be reactivated
if dict.swim("SWIM_SRST") ~= ECODE.ACK then
print("ERROR unable to reset STM8 core")
if debug then print("ERROR unable to reset STM8 core") end
else
-- print("reset stm8 core")
end
@ -58,6 +59,7 @@ local function reset_swim()
dict.swim("WOTF", SWIM_CSR, cur_CSR)
end
local function rotf(addr, hspeed, debug)
local result = ECODE.NAK
@ -93,39 +95,60 @@ local function rotf(addr, hspeed, debug)
return result, data
end
local function wotf(addr, data, hspeed, debug)
local function wotf(addr, data, hspeed, debug, maxnaks)
local result = ECODE.NAK
local tries = 8
local tries = DEF_MAX_NAK
local resets = 3
--allow calling function to increase max allowed NAKs
if maxnaks then
tries = maxnaks
end
local opcode = "WOTF"
if hspeed then
opcode = "WOTF_HS"
end
while result ~= "ACK" and tries > 0 do
while result ~= "ACK" and tries >= 0 do
result = dict.swim(opcode, addr, data)
result = get_key_for_value( ECODE, result)
if debug then print("wotf", string.format(" %X: %X, result ", addr, data), result) end
if result == "NORESP" then
reset_swim()
end
if tries == 0 then
print("ERROR max tries exceeded")
tries = tries - 1
if tries < 0 then
print("ERROR max tries exceeded, resetting stm8")
reset_swim()
resets = resets - 1
if resets > 0 then
tries = 5
print(" FAIL! max resets exceeded!!!!!")
end
end
tries = tries - 1
end
--return the result of the final transfer
return result
end
local function stop_and_reset()
--switch to low speed if was in high
dict.swim("SWIM_RESET")
--set bit 2 so SWIM module is also reset on system reset
cur_CSR = 0xA4
-- wotf(SWIM_CSR, cur_CSR)
--must rewrite current value of SWIM_CSR register as HIGHSPEED is cleared during SWIM RESET
wotf(SWIM_CSR, cur_CSR)
--print("resetting SWIM")
dict.swim("SWIM_SRST")
end
local function unlock_eeprom(hspeed)
--Write 0xAE then 56h in
--FLASH_DUKR (0x00 5064)(1)(2)
@ -195,53 +218,54 @@ local function swim_test()
-- print("rotf :", string.format("%X %X", dict.swim("ROTF_HS", 0x4000)))
--
-- --need to unlock the eeprom first!
unlock_eeprom(true)
-- --Write 0xAE then 56h in
-- --FLASH_DUKR (0x00 5064)(1)(2)
-- print("wotf :", dict.swim("WOTF_HS", 0x5064, 0xAE))
-- print("wotf :", dict.swim("WOTF_HS", 0x5064, 0x56))
-- unlock_eeprom(true)
---- --Write 0xAE then 56h in
---- --FLASH_DUKR (0x00 5064)(1)(2)
---- print("wotf :", dict.swim("WOTF_HS", 0x5064, 0xAE))
---- print("wotf :", dict.swim("WOTF_HS", 0x5064, 0x56))
---- --write data
-- rotf(0x4000, true)
-- wotf(0x4000, 0xDE, true)
-- wotf(0x4001, 0xAD, true)
-- wotf(0x4002, 0xBE, true)
-- wotf(0x4003, 0xEF, true)
---- print("wotf :", dict.swim("WOTF_HS", 0x4000, 0x00))
----
---- --lock eeprom
---- --Reset bit 3 (DUL)
-- lock_flash_eeprom(true)
---- --in FLASH_IAPSR (0x00 505F)
---- print("wotf :", dict.swim("WOTF_HS", 0x505F, 0x00))
----
---- print("rotf :", string.format("%X %X", dict.swim("ROTF_HS", 0x4000)))
-- rotf(0x4000, true)
-- rotf(0x4001, true)
-- rotf(0x4002, true)
-- rotf(0x4003, true)
--
----read then write to flash
---- print("rotf :", string.format("%X %X", dict.swim("ROTF_HS", 0x8028)))
--
-- --need to unlock the flash first!
-- unlock_flash(true)
-- --write data
rotf(0x4000, true)
wotf(0x4000, 0xDE, true)
wotf(0x4001, 0xAD, true)
wotf(0x4002, 0xBE, true)
wotf(0x4003, 0xEF, true)
-- print("wotf :", dict.swim("WOTF_HS", 0x4000, 0x00))
-- print("WRITE DATA")
-- local byte_addr = 0x8028
-- local data = 0xFF
-- while byte_addr < 0x8030 do
-- wotf(byte_addr, data, true, true)
--
-- byte_addr = byte_addr + 1
---- data = data + 0x11
--
-- --lock eeprom
-- --Reset bit 3 (DUL)
lock_flash_eeprom(true)
-- --in FLASH_IAPSR (0x00 505F)
-- print("wotf :", dict.swim("WOTF_HS", 0x505F, 0x00))
--
-- print("rotf :", string.format("%X %X", dict.swim("ROTF_HS", 0x4000)))
rotf(0x4000, true)
rotf(0x4001, true)
rotf(0x4002, true)
rotf(0x4003, true)
-- end
-- --lock flash/eeprom
-- lock_flash_eeprom(true)
-- --read it back
--read then write to flash
-- print("rotf :", string.format("%X %X", dict.swim("ROTF_HS", 0x8028)))
--need to unlock the flash first!
unlock_flash(true)
--write data
print("WRITE DATA")
local byte_addr = 0x8028
local data = 0xFF
while byte_addr < 0x8030 do
wotf(byte_addr, data, true, true)
byte_addr = byte_addr + 1
-- data = data + 0x11
end
--lock flash/eeprom
lock_flash_eeprom(true)
--read it back
print("READ BACK DATA")
local byte_addr = 0x8028
while byte_addr < 0x8030 do
local byte_addr = 0x0200
while byte_addr < 0x0280 do
rotf(byte_addr, true, true)
byte_addr = byte_addr + 1
@ -275,12 +299,12 @@ local function swim_test()
--indicate to logic analyzer that test sequence above is complete
-- dict.pinport("CTL_SET_LO", "EXP0")
dict.io("IO_RESET")
-- dict.io("IO_RESET")
end
local function start()
local function start( debug )
dict.io("IO_RESET")
@ -297,7 +321,7 @@ local function start()
--bit 7: masks internal reset sources (like WDT..?)
cur_CSR = 0xA0
if wotf(SWIM_CSR, cur_CSR) == "ACK" then
print("Successfully established SWIM comms")
if debug then print("Successfully established SWIM comms") end
else
print("Unable to establish SWIM comms")
return false
@ -315,7 +339,7 @@ local function start()
--reset the STM8 core
-- dict.swim("SWIM_SRST")
system_reset()
system_reset( true )
--the STM8 core is now stalled @ reset vector
--can read/write to any address on STM8 core
@ -323,6 +347,8 @@ local function start()
--bit 2: SWIM is reset (exits active mode) when chip reset
--this forces successful SWIM entry on each execution of script
--TODO if this bit is enabled bunch of other code here needs updated to re-establish SWIM
--via this routine when system is reset
-- cur_CSR = cur_CSR | 0x04
-- wotf(SWIM_CSR, cur_CSR)
@ -341,8 +367,84 @@ local function printCSR()
print(cur_CSR)
end
local function write_optn_bytes(debug)
local function disable_ROP_erase(debug)
local toprint = nil-- debug
local maxnak = 20
if debug then print("disabling ROP and erasing STM8 CIC") end
unlock_eeprom(true)
--FLASH_CR2 and FLASH_NCR2 must be enabled to permit option byte writing
--DEF_8BIT_REG_AT(FLASH_CR2,0x505b); default 0x00
--DEF_8BIT_REG_AT(FLASH_NCR2,0x505c); default 0xFF
--BIT 7: OPT/NOPT
if debug then print("enabling optn byte writes") end
wotf(0x505B, 0x80, true, toprint, maxnak)
wotf(0x505C, 0x7F, true, toprint, maxnak)
--enable READ OUT PROTECTION
--0x4800 Read-out protection (ROP)
--0x00 by default, set to 0xAA to prevent reading out flash & eeprom
if debug then print("reading ROP byte") end
if debug then rotf(0x4800, true, debug) end
if debug then print("clearing ROP byte") end
wotf(0x4800, 0x00, true, toprint, maxnak)
--after clearing ROP, system must be reset
--getting error that option bytes aren't complimentary
--seems they get completely erased and we should now flash them
--to be complimentary
--go ahead and write proper "erased" complimentary data prior to system reset
--option bytes seem to take awhile to write, increase max
if debug then print("writing compliment option bytes") end
--ROP wotf(0x4800, 0x00, true, toprint)
wotf(0x4801, 0x00, true, toprint, maxnak)
wotf(0x4802, 0xFF, true, toprint, maxnak)
wotf(0x4803, 0x00, true, toprint, maxnak)
wotf(0x4804, 0xFF, true, toprint, maxnak)
wotf(0x4805, 0x00, true, toprint, maxnak)
wotf(0x4806, 0xFF, true, toprint, maxnak)
wotf(0x4807, 0x00, true, toprint, maxnak)
wotf(0x4808, 0xFF, true, toprint, maxnak)
wotf(0x4809, 0x00, true, toprint, maxnak)
wotf(0x480A, 0xFF, true, toprint, maxnak)
--disable option byte writing
if debug then print("disabling option byte writting") end
wotf(0x505B, 0x00, true, toprint, maxnak)
wotf(0x505C, 0xFF, true, toprint, maxnak)
if debug then print("locking eeprom") end
lock_flash_eeprom(true)
-- if debug then print("read back option bytes")
-- rotf(0x4800, true, true)
-- rotf(0x4801, true, true)
-- rotf(0x4802, true, true)
-- rotf(0x4803, true, true)
-- rotf(0x4804, true, true)
-- rotf(0x4805, true, true)
-- rotf(0x4806, true, true)
-- rotf(0x4807, true, true)
-- rotf(0x4808, true, true)
-- rotf(0x4809, true, true)
-- rotf(0x480A, true, true)
-- end
--need to reset the chip to reload option bytes
--after clearing ROP, system must be reset
if debug then print("resetting STM8") end
system_reset( false )
--TODO swim may need re-established if SWIM_CSR RST bit is set
-- start()
if debug then print("done erasing chip, ROP disabled") end
end
local function write_optn_bytes(rop, debug)
local maxnak = 20
local toprint = nil--debug
if debug then print("programming option bytes") end
unlock_eeprom(true)
@ -351,8 +453,8 @@ local function write_optn_bytes(debug)
--DEF_8BIT_REG_AT(FLASH_CR2,0x505b); default 0x00
--DEF_8BIT_REG_AT(FLASH_NCR2,0x505c); default 0xFF
--BIT 7: OPT/NOPT
wotf(0x505B, 0x80, true, toprint)
wotf(0x505C, 0x7F, true, toprint)
wotf(0x505B, 0x80, true, toprint, maxnak)
wotf(0x505C, 0x7F, true, toprint, maxnak)
--need to enable AFR0 for TIM1 timer input pins
--AFR0 Alternate function remapping option 0(2)
@ -363,12 +465,24 @@ local function write_optn_bytes(debug)
-- OPT2 AFR7 AFR6 AFR5 AFR4 AFR3 AFR2 AFR1 AFR0 0x00
--0x4804 NOPT2 NAFR7 NAFR6 NAFR5 NAFR4 NAFR3 NAFR2 NAFR1 NAFR0 0xFF
if debug then print("ENABLING AFR0 for TIM1") end
wotf(0x4803, 0x01, true, toprint)
wotf(0x4804, 0xFE, true, toprint)
wotf(0x4803, 0x01, true, toprint, maxnak)
wotf(0x4804, 0xFE, true, toprint, maxnak)
print("optn byte write enabled")
--enable READ OUT PROTECTION
--0x4800 Read-out protection (ROP)
--0x00 by default, set to 0xAA to prevent reading out flash & eeprom
if rop then
wotf(0x4800, 0xAA, true, toprint, maxnak)
print("Read out Protection enabled")
else
print("Read out Protection isn't enabled, CIC code can be stolen!")
end
--disable option byte writing
wotf(0x505B, 0x00, true, toprint)
wotf(0x505C, 0xFF, true, toprint)
wotf(0x505B, 0x00, true, toprint, maxnak)
wotf(0x505C, 0xFF, true, toprint, maxnak)
print("optn byte write disabled")
lock_flash_eeprom(true)
if debug then print("done with option byte programming") end
@ -405,6 +519,33 @@ local function write_flash(file, debug)
lock_flash_eeprom(true)
end
local function snes_v3_prgm(debug)
--dict.pinport("CTL_IP_PU", "SNES_RST")
--reset_swim()
-- print("curCSR", cur_CSR)
--start()
-- print("curCSR", cur_CSR)
--SNES v3 boards route Flash /OE to STM8 pin 3 PD6
--(PD_ODR,0x500f);
--(PD_IDR,0x5010);
--(PD_DDR,0x5011);
--(PD_CR1,0x5012);
--(PD_CR2,0x5013);
wotf(0x5012, 0x40, true, debug) --PD6 is input with pullup, if changed to output via DDR it will be push pull
wotf(0x5011, 0x40, true, debug) --PD6 is push-pull output now
wotf(0x500F, 0x40, true, debug) --PD6 high, program mode
end
local function snes_v3_play(debug)
--dict.pinport("CTL_IP_PU", "SNES_RST")
--reset_swim()
--start()
wotf(0x5012, 0x40, true, debug) --PD6 is input with pullup, if changed to output via DDR it will be push pull
wotf(0x5011, 0x40, true, debug) --PD6 is push-pull output now
wotf(0x500F, 0x00, true, debug) --PD6 low, play mode
end
-- global variables so other modules can use them
@ -416,9 +557,14 @@ end
swim.start = start
swim.write_flash = write_flash
swim.write_optn_bytes = write_optn_bytes
swim.disable_ROP_erase = disable_ROP_erase
swim.printCSR = printCSR
swim.wotf = wotf
swim.rotf = rotf
swim.swim_test = swim_test
swim.snes_v3_prgm = snes_v3_prgm
swim.snes_v3_play = snes_v3_play
swim.stop_and_reset = stop_and_reset
-- return the module's table
return swim

View File

@ -39,8 +39,8 @@ function main ()
-- debug = true
-- rv = cart.detect(debug)
-- local force_cart = true
-- cart_console = "SNES"
local force_cart = true
cart_console = "SNES"
if (force_cart or cart.detect_console(true)) then
if cart_console == "NES" or cart_console == "Famicom" then
@ -100,14 +100,17 @@ function main ()
elseif cart_console == "SNES" then
if swim.start() then
snes_swimcart = nil
if swim.start(true) then
--SWIM is now established and running at HIGH SPEED
--swim.printCSR()
snes_swimcart = false --don't want to use SWIM pin to control flash /OE, use SNES RESET (EXP0) instead
--check if ROP set, allow clearing ROP and erasing CIC
--blindly erase STM8 CIC for now by disabling ROP
swim.disable_ROP_erase(true)
--open CIC file
local cic_file = assert(io.open("SNESCIC.bin", "rb"))
local cic_file = assert(io.open("SNESCIC_flashmode.bin", "rb"))
--write CIC file
swim.write_flash( cic_file )
@ -115,15 +118,12 @@ function main ()
--close CIC file
assert(cic_file:close())
--write option bytes
swim.write_optn_bytes( true )
--set ROP byte
-- reset STM8 CIC and end SWIM comms to it can execute what we just flashed
swim.stop_and_reset()
else
print("ERROR problem with STM8 CIC")
end
dict.io("IO_RESET")
dict.io("SNES_INIT")
@ -143,17 +143,16 @@ function main ()
if snes.read_reset_vector(0, true) ~= 0xFFFF then
erase.erase_snes( false )
end
if snes.read_reset_vector(1, true) ~= 0xFFFF then
if snes.read_reset_vector( 1, true) ~= 0xFFFF then
erase.erase_snes( false )
end
if snes.read_reset_vector(20, true) ~= 0xFFFF then
if snes.read_reset_vector( 20, true) ~= 0xFFFF then
erase.erase_snes( false )
end
if snes.read_reset_vector(63, true) ~= 0xFFFF then
if snes.read_reset_vector( 63, true) ~= 0xFFFF then
erase.erase_snes( false )
end
--FLASHING:
--erase cart
-- erase.erase_snes( false )
@ -173,19 +172,50 @@ function main ()
--close file
assert(file:close())
--DUMPING:
--create new file
local file
file = assert(io.open("snesdump.bin", "wb"))
--dump cart into file
dump.dump_snes( file, snes_mapping, true )
--flash final CIC code
if swim.start(true) then
--SWIM is now established and running at HIGH SPEED
--swim.printCSR()
snes_swimcart = false
--print("main swimcart", snes_swimcart)
--close file
assert(file:close())
--check if ROP set, allow clearing ROP and erasing CIC
--blindly erase STM8 CIC for now by disabling ROP
-- swim.disable_ROP_erase(true)
--open CIC file
local cic_file = assert(io.open("SNESCIC.bin", "rb"))
--write CIC file
swim.write_flash( cic_file )
--close CIC file
assert(cic_file:close())
--write option bytes
-- enable ROP, debug
swim.write_optn_bytes( true, true )
-- reset STM8 CIC and end SWIM comms to it can execute what we just flashed
swim.stop_and_reset()
else
print("ERROR problem with STM8 CIC")
end
-- --DUMPING:
-- --create new file
-- local file
-- file = assert(io.open("snesdump.bin", "wb"))
-- --dump cart into file
-- -- swim.start()
-- dump.dump_snes( file, snes_mapping, true )
--
-- --close file
-- assert(file:close())
--trick to do this at end while debugging so don't have to wait for it before starting
erase.erase_snes( false )
-- erase.erase_snes( false )
dict.io("IO_RESET")