cturt / gameboy_ghidrasleigh Goto Github PK
View Code? Open in Web Editor NEWGhidra Processor support for Nintendo Game Boy
Ghidra Processor support for Nintendo Game Boy
Hey, I was going over a disassembly of Pokemon TCG, and noticed that a few of the opcodes were... somewhat off. I'll go ahead and list the ones I managed to find.
0xD9: Missing "RETI" instruction
0xE8: Uses one more byte than it should.
0xF8: Uses one more byte than it should.
Hey, cool project!
I get an error trying to use it though, not sure if I'm doing something wrong.
Created new project -> File -> Import File -> pick any GB rom, get error below:
Error importing file: Tetris.gb
ghidra.program.model.lang.CompilerSpecNotFoundException: Exception reading GameBoy:LE:16:default/default(GameBoy.cspec): unexpected attribute "baseinsize"
at ghidra.program.model.lang.BasicCompilerSpec.<init>(BasicCompilerSpec.java:145)
at ghidra.app.plugin.processors.sleigh.SleighLanguage.getCompilerSpecByID(SleighLanguage.java:1093)
at ghidra.app.util.opinion.BinaryLoader.loadProgram(BinaryLoader.java:276)
at ghidra.app.util.opinion.AbstractProgramLoader.load(AbstractProgramLoader.java:112)
at ghidra.plugin.importer.ImporterUtilities.importSingleFile(ImporterUtilities.java:401)
at ghidra.plugin.importer.ImporterDialog.lambda$okCallback$7(ImporterDialog.java:351)
at ghidra.util.task.TaskLauncher$1.run(TaskLauncher.java:90)
at ghidra.util.task.Task.monitoredRun(Task.java:126)
at ghidra.util.task.TaskRunner.lambda$startTaskThread$1(TaskRunner.java:94)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: com.sun.msv.verifier.ValidityViolation; lineNumber: 12; columnNumber: 91; unexpected attribute "baseinsize"
at com.sun.msv.verifier.Verifier.onError(Verifier.java:367)
at com.sun.msv.verifier.Verifier.onError(Verifier.java:363)
at com.sun.msv.verifier.Verifier.feedAttribute(Verifier.java:294)
at com.sun.msv.verifier.Verifier.startElement(Verifier.java:221)
at java.xml/com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(AbstractSAXParser.java:510)
at java.xml/com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(XMLNSDocumentScannerImpl.java:374)
at java.xml/com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2710)
at java.xml/com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:605)
at java.xml/com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:112)
at java.xml/com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:534)
at java.xml/com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:888)
at java.xml/com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:824)
at java.xml/com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141)
at java.xml/com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1216)
at java.xml/com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:635)
at org.iso_relax.verifier.impl.VerifierImpl.verify(VerifierImpl.java:121)
at ghidra.app.plugin.processors.sleigh.SleighLanguageValidator.validateSleighFile(SleighLanguageValidator.java:103)
at ghidra.app.plugin.processors.sleigh.SleighLanguageValidator.validateCspecFile(SleighLanguageValidator.java:81)
at ghidra.program.model.lang.BasicCompilerSpec.<init>(BasicCompilerSpec.java:109)
... 11 more
---------------------------------------------------
Build Date: 2019-Dec-18 1306 EST
Ghidra Version: 9.1.1
Java Home: D:\Program Files\Amazon Corretto\jdk11.0.6_10
JVM Version: Amazon.com Inc. 11.0.6
OS: Windows 7 6.1 amd64
That is to say, in the cases of "e0 00" and "f0 00", the parser treats it as "LD (0xFF00 + (0x0)),A" and "LD A,(0xFF00 + (0x0))", instead of going to (DAT_io_0000). If this could be fixed, possibly around the same time as removing the IO pointers for LDH operations, that would be wonderful.
So, I have three basic feature requests to improve this a great deal, though they can be grouped together.
Adjust handling of LDH instruction to point at ram:FFxx instead of io:00xx, since sometimes games will mix in regular LD instructions to that area.
Change autodetected writes to the 0000-7fff range to aim at io, instead of ram. This prevents autodetection from inserting useless references to those sections, because of commands to the MBC.
Implement some method of Bank switching, preferably using the writes to io to trigger this, being able to configure different modes for that, due to how different Memory Bank Controllers handle things. Honestly, I have no idea how to go about this, but this is essentially the golden grail. If you want to completely disassemble anything other than Tetris, you need some sort of method to deal with banks.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.