idc scripts
authornotaz <notasas@gmail.com>
Sun, 22 Oct 2017 16:38:56 +0000 (19:38 +0300)
committernotaz <notasas@gmail.com>
Sun, 22 Oct 2017 16:38:56 +0000 (19:38 +0300)
just not to lose them

idc/mida.idc [new file with mode: 0755]
idc/mida_s68k.idc [new file with mode: 0755]

diff --git a/idc/mida.idc b/idc/mida.idc
new file mode 100755 (executable)
index 0000000..1894ff1
--- /dev/null
@@ -0,0 +1,253 @@
+//\r
+//     IDC File to disassemble Sega Genesis/Megadrive rom\r
+//     by Kaneda\r
+//\r
+//     Useage:\r
+//       launch IDA with "idag -a -p68000 -Smida.idc"\r
+//       Select your .bin file\r
+//       Press OK to the 2 dialog boxes following\r
+//\r
+//     0.1 (12 Nov 2004 ): Initial release\r
+//  0.2 (01 Jun 2005 ): Support for start adress <0x200 (skip header)\r
+//\r
+//     Update on http://www.consoledev.fr.st\r
+//\r
+\r
+#include <idc.idc>\r
+\r
+//-------------------------------------------------------------------------\r
+static CW(off,name,cmt) {\r
+  auto x;\r
+  x = off;\r
+  MakeWord(x);\r
+  MakeName(x,name);\r
+  MakeRptCmt(x,cmt);\r
+}\r
+\r
+//-------------------------------------------------------------------------\r
+static CD(off,name,cmt) {\r
+  auto x;\r
+  x = off;\r
+  MakeDword(x);\r
+  MakeName(x,name);\r
+  MakeRptCmt(x,cmt);\r
+}\r
+\r
+//-------------------------------------------------------------------------\r
+static CB(off,name,cmt) {\r
+  auto x;\r
+  x = off;\r
+  MakeByte(x);\r
+  MakeName(x,name);\r
+  MakeRptCmt(x,cmt);\r
+}\r
+\r
+static CS(off,end,name,cmt) {\r
+  auto x;\r
+  x = off;\r
+  MakeStr(x, end);\r
+  MakeName(x,name);\r
+  MakeRptCmt(x,cmt);\r
+}\r
+\r
+static mdVector(  ) {\r
+auto i, addr;\r
+\r
+CD(0x00, "initStack", "Initial Stack");\r
+CD(0x04, "startAddress", "Start Address");\r
+CD(0x08, "", "Bus Error");\r
+CD(0x0C, "", "Address Error");\r
+CD(0x10, "", "Illegal instruction");\r
+CD(0x14, "", "Zero Divide");\r
+CD(0x18, "", "CHK instruction");\r
+CD(0x1C, "", "TRAPV instruction");\r
+CD(0x20, "", "Privilege Violation");\r
+CD(0x24, "", "Trace");\r
+CD(0x28, "", "Line 1010 Emulator");\r
+CD(0x2C, "", "Line 1111 Emulator");\r
+CD(0x30, "", "Reserved");\r
+CD(0x34, "", "Reserved");\r
+CD(0x38, "", "Reserved");\r
+CD(0x3C, "", "Unitialized Interrrupt");\r
+CD(0x40, "", "Reserved");\r
+CD(0x44, "", "Reserved");\r
+CD(0x48, "", "Reserved");\r
+CD(0x4C, "", "Reserved");\r
+CD(0x50, "", "Reserved");\r
+CD(0x54, "", "Reserved");\r
+CD(0x58, "", "Reserved");\r
+CD(0x5C, "", "Reserved");\r
+CD(0x60, "", "Spurious Interrupt");\r
+CD(0x64, "", "Level 1 interrupt");\r
+CD(0x68, "", "Level 2/External  interrupt");\r
+CD(0x6C, "", "Level 3 interrupt");\r
+CD(0x70, "", "Level 4/Horizontal interrupt");\r
+CD(0x74, "", "Level 5 interrupt");\r
+CD(0x78, "", "Level 6/Vertical interrupt");\r
+CD(0x7C,"", "Level 7 interrupt");\r
+\r
+i=0x80;\r
+while (i <= 0xBC){\r
+  CD(i,"", "Trap");\r
+  i = i+1;\r
+}\r
+\r
+i=0xC0;\r
+while (i <= 0xFF){\r
+  CD(i,"", "Reserved");\r
+  i = i+1;\r
+  }\r
+\r
+for ( i=0x08; i< 0x200; i=i+4 ) {\r
+  addr = Dword( i );\r
+  MakeCode(addr);\r
+  }\r
+}\r
+\r
+static mdHeader( ) {\r
+auto addr;\r
+\r
+addr =  Dword( 0x04 );\r
+if (addr < 0x200)\r
+{\r
+       Warning("Start address unusual");\r
+    return;\r
+}\r
+CS(0x100,0x110,"","");\r
+ CS(0x110,0x120,"","");\r
+ CS(0x120,0x130,"","");\r
+ CS(0x130,0x140,"","");\r
+ CS(0x140,0x150,"","");\r
+ CS(0x150,0x160,"","");\r
+ CS(0x160,0x170,"","");\r
+ CS(0x170,0x180,"","");\r
+ CS(0x180,0x18D,"","Serial Number");\r
+ CW(0x18E, "CheckSum","");\r
+ CS(0x190,0x1A0,"","");\r
+ CD(0x1A0, "RomStartAdr", "Rom Start Adress");\r
+ CD(0x1A4, "RomEndAdr", "Rom End Adress");\r
+ CD(0x1A8, "RamStartAdr", "Ram Start Adress");\r
+ CD(0x1AC, "RamEndAdr", "Ram End Adress");\r
+ CS(0x1B0, 0x1BC, "", "SRam data");\r
+ CS(0x1BC, 0x1C8, "", "Modem data");\r
+ CS(0x1C8, 0x1DC, "", "Memo");\r
+ CS(0x1DC, 0x1F0, "", "");\r
+ CS(0x1F0, 0x200, "Country", "Countries codes");\r
+ }\r
\r
+static mdAddress( ){\r
+ CD(0xC00000, "VDP_Data","");\r
+ CD(0xC00004, "VDP_Control",""); \r
+ CD(0xC00008, "HV_Counter",""); \r
+ CB(0xC00011, "PSG",""); \r
+\r
+ CW(0xA10001, "HW_Info","7-MODE  (R)  0: Domestic Model\n"\r
+                       "             1: Overseas Model\n"\r
+                       "6-VMOD  (R)  0: NTSC CPU clock 7.67 MHz\n"\r
+                        "             1: PAL CPU clock 7.60 MHz\n"\r
+                        "5-DISK  (R)  0: FDD unit connected\n"\r
+                       "             1: FDD unit not connected\n"\r
+                       "4-RSV   (R)  Currently not used\n"\r
+                       "3-0 VER (R)  MEGA DRIVE version ($0 to $F)");\r
+\r
+ CW(0xA10003,"DATA1",  "PD7 (RW)\n"\r
+                       "PD6 (RW) TH\n"\r
+                       "PD5 (RW) TR\n"\r
+                       "PD4 (RW) TL\n"\r
+                       "PD3 (RW) RIGHT\n"\r
+                       "PD2 (RW) LEFT\n"\r
+                       "PD1 (RW) DOWN\n"\r
+                       "PDO (RW) UP\n" );\r
+ CW(0xA10005,"DATA2","");\r
+ CW(0xA10007,"DATA3","");\r
+ CW(0xA10009,"CTRL1",  "INT (RW) 0: TH-INT PROHIBITED\n"\r
+                       "         1: TH-INT ALLOWED\n"\r
+                       "PC6 (RW) 0: PD6 INPUT MODE\n"\r
+                       "         1: OUTPUT MODE\n"\r
+                       "PC5 (RW) 0: PD5 INPUT MODE\n"\r
+                       "         1: OUTPUT MODE\n"\r
+                       "PC4 (RW) 0: PD4 INPUT MODE\n"\r
+                       "         1: OUTPUT MODE\n"\r
+                       "PC3 (RW) 0: PD3 INPUT MODE\n"\r
+                       "         1: OUTPUT MODE\n"\r
+                       "PC2 (RW) 0: PD2 INPUT MODE\n"\r
+                       "         1: OUTPUT MODE\n"\r
+                       "PC1 (RW) 0: PD1 INPUT MODE\n"\r
+                       "         1: OUTPUT MODE\n"\r
+                       "PCO (RW) 0: PDO INPUT MODE\n"\r
+                       "         1: OUTPUT MODE");\r
+ CW(0xA1000B,"CTRL2","");\r
+ CW(0xA1000D,"CTRL3","");\r
+ CW(0xA1000F,"TxDATA1","");\r
+ CW(0xA10011,"RxDATA1","");\r
+ CW(0xA10013,"SCTRL1","");\r
+ CW(0xA10015,"TxDATA2","");\r
+ CW(0xA10017,"RxDATA2","");\r
+ CW(0xA10019,"SCTRL2","");\r
+ CW(0xA1001B,"TxDATA3","");\r
+ CW(0xA1001D,"RxDATA3","");\r
+ CW(0xA1001F,"SCTRL3","");\r
+\r
+ CW(0xA11000,"MemMode",        "D8 ( W)   0: ROM MODE\n"\r
+                        "          1: D-RAM MODE");\r
\r
+ CW(0xA11100,"Z80BusReq","D8 ( W)   0: BUSREQ CANCEL\n"\r
+                         "          1: BUSREQ REQUEST\n"\r
+                         "   ( R)   0: CPU FUNCTION STOP ACCESSIBLE\n"\r
+                         "          1: FUNCTIONING");\r
+ CW(0xA11200,"Z80BusReset","D8 ( W)   0: RESET REQUEST\n"\r
+                           "          1: RESET CANCEL"); \r
+}\r
\r
+//-------------------------------------------------------------------------\r
+static main() {\r
+  auto addr;\r
+  \r
+  SetPrcsr( "68000");\r
+\r
+  SegCreate(0x000000,0x3FFFFF,0,1,0,2);\r
+  SegRename(0x000000,"ROM");\r
+\r
+  SegCreate(0xA00000,0xA0FFFF,0,1,0,2);\r
+  SegRename(0xA00000,"Z80");\r
+\r
+  SegCreate(0xA10000,0xA10FFF,0,1,0,2);\r
+  SegRename(0xA10000,"IO");\r
+\r
+  SegCreate(0xA11000,0xA11FFF,0,1,0,2);\r
+  SegRename(0xA11000,"Control");\r
+\r
+  SegCreate(0xC00000,0xDFFFFF,0,1,0,2);\r
+  SegRename(0xC00000,"VDP");\r
+\r
+  SegCreate(0xFF0000,0xFFFFFF,0,1,0,2);\r
+  SegRename(0xFF0000,"RAM");\r
+  \r
+  mdVector( );\r
+  mdHeader( );\r
+  mdAddress( );\r
\r
+  addr =  Dword( 0x04 );\r
+  MakeName(addr,"main");\r
+  //MakeCode(addr);\r
+  MakeFunction(addr,BADADDR);\r
+   Wait( );\r
+   \r
+  addr =  Dword( 0x68 );\r
+  MakeName(addr,"EInt");\r
+  //MakeCode(addr);\r
+  MakeFunction(addr,BADADDR);\r
+  Wait( ); \r
+  \r
+  addr =  Dword( 0x70 );\r
+  MakeName(addr,"HInt");\r
+  //MakeCode(addr);\r
+  MakeFunction(addr,BADADDR);\r
+  Wait( ); \r
+\r
+  addr =  Dword( 0x78 );\r
+  MakeName(addr,"VInt");\r
+  //MakeCode(addr);\r
+  MakeFunction(addr,BADADDR);\r
+  Wait( );  \r
+}\r
diff --git a/idc/mida_s68k.idc b/idc/mida_s68k.idc
new file mode 100755 (executable)
index 0000000..80a9767
--- /dev/null
@@ -0,0 +1,178 @@
+//\r
+//     IDC File to disassemble Sega Genesis/Megadrive rom\r
+//     by Kaneda\r
+//\r
+//     Useage:\r
+//       launch IDA with "idag -a -p68000 -Smida.idc"\r
+//       Select your .bin file\r
+//       Press OK to the 2 dialog boxes following\r
+//\r
+//     0.1 (12 Nov 2004 ): Initial release\r
+//  0.2 (01 Jun 2005 ): Support for start adress <0x200 (skip header)\r
+//\r
+//     Update on http://www.consoledev.fr.st\r
+//\r
+\r
+#include <idc.idc>\r
+\r
+//-------------------------------------------------------------------------\r
+static CW(off,name,cmt) {\r
+  auto x;\r
+  x = off;\r
+  MakeWord(x);\r
+  MakeName(x,name);\r
+  MakeRptCmt(x,cmt);\r
+}\r
+\r
+//-------------------------------------------------------------------------\r
+static CD(off,name,cmt) {\r
+  auto x;\r
+  x = off;\r
+  MakeDword(x);\r
+  MakeName(x,name);\r
+  MakeRptCmt(x,cmt);\r
+}\r
+\r
+//-------------------------------------------------------------------------\r
+static CB(off,name,cmt) {\r
+  auto x;\r
+  x = off;\r
+  MakeByte(x);\r
+  MakeName(x,name);\r
+  MakeRptCmt(x,cmt);\r
+}\r
+\r
+static CS(off,end,name,cmt) {\r
+  auto x;\r
+  x = off;\r
+  MakeStr(x, end);\r
+  MakeName(x,name);\r
+  MakeRptCmt(x,cmt);\r
+}\r
+\r
+static mdVector(  ) {\r
+auto i, addr;\r
+\r
+CD(0x00, "initStack", "Initial Stack");\r
+CD(0x04, "startAddress", "Start Address");\r
+CD(0x08, "", "Bus Error");\r
+CD(0x0C, "", "Address Error");\r
+CD(0x10, "", "Illegal instruction");\r
+CD(0x14, "", "Zero Divide");\r
+CD(0x18, "", "CHK instruction");\r
+CD(0x1C, "", "TRAPV instruction");\r
+CD(0x20, "", "Privilege Violation");\r
+CD(0x24, "", "Trace");\r
+CD(0x28, "", "Line 1010 Emulator");\r
+CD(0x2C, "", "Line 1111 Emulator");\r
+CD(0x30, "", "Reserved");\r
+CD(0x34, "", "Reserved");\r
+CD(0x38, "", "Reserved");\r
+CD(0x3C, "", "Unitialized Interrrupt");\r
+CD(0x40, "", "Reserved");\r
+CD(0x44, "", "Reserved");\r
+CD(0x48, "", "Reserved");\r
+CD(0x4C, "", "Reserved");\r
+CD(0x50, "", "Reserved");\r
+CD(0x54, "", "Reserved");\r
+CD(0x58, "", "Reserved");\r
+CD(0x5C, "", "Reserved");\r
+CD(0x60, "", "Spurious Interrupt");\r
+CD(0x64, "", "Level 1/gfx interrupt");\r
+CD(0x68, "", "Level 2/md interrupt");\r
+CD(0x6C, "", "Level 3/timer interrupt");\r
+CD(0x70, "", "Level 4/cdd interrupt");\r
+CD(0x74, "", "Level 5/cdc interrupt");\r
+CD(0x78, "", "Level 6/subcode interrupt");\r
+CD(0x7C, "", "Level 7 interrupt");\r
+\r
+i=0x80;\r
+while (i <= 0xBC){\r
+  CD(i,"", "Trap");\r
+  i = i+1;\r
+}\r
+\r
+i=0xC0;\r
+while (i <= 0xFF){\r
+  CD(i,"", "Reserved");\r
+  i = i+1;\r
+  }\r
+\r
+for ( i=0x08; i< 0x200; i=i+4 ) {\r
+  addr = Dword( i );\r
+  MakeCode(addr);\r
+  }\r
+}\r
+\r
+static mdHeader( ) {\r
+auto addr;\r
+\r
+addr =  Dword( 0x04 );\r
+if (addr < 0x200)\r
+{\r
+       Warning("Start address unusual");\r
+    return;\r
+}\r
+CS(0x100,0x110,"","");\r
+ CS(0x110,0x120,"","");\r
+ CS(0x120,0x130,"","");\r
+ CS(0x130,0x140,"","");\r
+ CS(0x140,0x150,"","");\r
+ CS(0x150,0x160,"","");\r
+ CS(0x160,0x170,"","");\r
+ CS(0x170,0x180,"","");\r
+ CS(0x180,0x18D,"","Serial Number");\r
+ CW(0x18E, "CheckSum","");\r
+ CS(0x190,0x1A0,"","");\r
+ CD(0x1A0, "RomStartAdr", "Rom Start Adress");\r
+ CD(0x1A4, "RomEndAdr", "Rom End Adress");\r
+ CD(0x1A8, "RamStartAdr", "Ram Start Adress");\r
+ CD(0x1AC, "RamEndAdr", "Ram End Adress");\r
+ CS(0x1B0, 0x1BC, "", "SRam data");\r
+ CS(0x1BC, 0x1C8, "", "Modem data");\r
+ CS(0x1C8, 0x1DC, "", "Memo");\r
+ CS(0x1DC, 0x1F0, "", "");\r
+ CS(0x1F0, 0x200, "Country", "Countries codes");\r
+ }\r
\r
+static mdAddress( ){\r
+ // CD(0xC00000, "VDP_Data","");\r
+}\r
\r
+//-------------------------------------------------------------------------\r
+static MakeIrq(addr,name) {\r
+  MakeName(addr,name);\r
+  //MakeCode(addr);\r
+  MakeFunction(addr,BADADDR);\r
+   Wait( );\r
+}\r
+\r
+static main() {\r
+  auto addr;\r
+  \r
+  SetPrcsr( "68000");\r
+\r
+  SegCreate(0x000000,0x07FFFF,0,1,0,2);\r
+  SegRename(0x000000,"prg_ram");\r
+\r
+  SegCreate(0xFE0000,0xFE3FFF,0,1,0,2);\r
+  SegRename(0xFE0000,"bram");\r
+\r
+  SegCreate(0xFF0000,0xFF3FFF,0,1,0,2);\r
+  SegRename(0xFF0000,"pcm");\r
+\r
+  SegCreate(0xFF8000,0xFF81FF,0,1,0,2);\r
+  SegRename(0xFF8000,"regs");\r
+  \r
+  mdVector( );\r
+  mdHeader( );\r
+  mdAddress( );\r
+\r
+  MakeIrq(Dword(0x04), "main");\r
+  MakeIrq(Dword(0x64), "gfx_irq");\r
+  MakeIrq(Dword(0x68), "md_irq");\r
+  MakeIrq(Dword(0x6c), "timer_irq");\r
+  MakeIrq(Dword(0x70), "cdd_irq");\r
+  MakeIrq(Dword(0x74), "cdc_irq");\r
+  MakeIrq(Dword(0x78), "subcode_irq");\r
+}\r