I'm excited to announce two big things! First, the emulator can now play most Game Boy games with minimal issues! Secondly, the emulator is now open source on github! Go check it out at the following link,
Github Repository: https://github.com/Salgat/GameBoyEmulator-GBS
Above are some screenshots of the emulator in action (The Legend of Zelda: Link's Awakening, Pokemon Red, and Super Mario Land 2: 6 Golden Coins). As of now two apparent issues occur: First, upon first starting the game, graphical glitches occur. Second, the timing is off which is most obvious with the scanline, which is out of sync and causes a slight graphical glitch. While the instruction test ROM works fine, the instruction timing ROM fails.
Additionally, even basic interface features are missing. The big issue that was holding me up for the past week was an issue where some games would randomly crash when trying to load a new section of the game. When checking the logger for my emulator and comparing the assembly instructions and memory state against BGB's emulator output, I was finding that the ROM was reading from the wrong memory bank. Unfortunately, nothing in the memory bank controller code looked wrong. I ended up having to log the entire output of the emulator up to the point of the crash, which included the register data, program counter, and some other relevant data, and stepping through BGB's emulator, instruction by instruction, until I could find the discrepancy which took about an hour to do. Eventually, I saw a point where the vertical blanking interrupt vector would trigger and set the wrong memory bank. It was only for a few instructions and not something I expected, but when the LCD is disabled, the current horizontal line stops incrementing. This isn't in any of the documentation I came across, so I'm guessing it's just assumed that you would know this. Unfortunately, I didn't make the assumption but thankfully the problem is now fixed.
While there is still a lot more work to be done (including adding more memory controller support), I'm glad to say that the emulator works on most of the games and works well! It's awesome seeing my favorite games from my childhood running in my own homegrown emulator.
Showing posts with label gameboy. Show all posts
Showing posts with label gameboy. Show all posts
Sunday, July 5, 2015
Sunday, June 28, 2015
Game Boy Emulator Update
Tetris running on the emulator, showing the graphical glitch it has with sprites. |
On week 3 of this project, and am excited to say that the Game Boy Emulator can now play *some* games! As of now it is only failing for the "HALT" instruction, with all other instructions passing Blargg's CPU instruction tests. Additionally, rendering of the background, window (untested), and sprites are implemented. The above picture shows the one problem with sprite rendering for now: Sprites do not render on the bottom 16 pixels of the screen and worse yet they sometimes render a bit funny. With the current progress of the emulator, you are able to play Tetris, which is pretty awesome considering this is not just my first game that works on the emulator, but was also the first game I received when my Dad gave me my Game Boy over 15 years ago.
Monday, June 22, 2015
New Project: Game Boy Emulator
Game Boy Emulator running a "test rom" which tests instructions to see which work |
Over the past week I started one last big project in my spree to test out what I can do these past few months. As seen in the above screenshot, I've been working on a Game Boy emulator! As with my past projects, the only dependency is SFML which I use for rendering (I'm thinking about splitting up the project into two to remove the SFML dependency, since the SFML code is literally a few dozen lines).
The project has been pretty smooth so far and I'm able to run very basic ROMs but am still a ways off from running full fledged games. Probably the most difficult part of setting up the emulator is that you need quite a lot already established to run even the most basic ROMs, and on top of that I had to manually implement over 400 instructions for the modified Z80 processor being emulated, which took 3 days of grunt coding to finish. Thankfully, I was able to use Imran Nazar's jsGB emulator as a base off which I implemented the instructions. Unfortunately, while a good reference, I had to use another reference to go over every instruction and correct mistakes I found, which were quite a few and a bit frustrating (and I'm still not sure I caught all the mistakes).
At least for me, it's almost guaranteed that writing hundreds of instructions will result in some typos and mistakes, which is where test roms come into play. Thankfully, there exists an entire suite of test ROMs that test all the instructions and features of the Game Boy to see if it is compliant. I've been using the BGB emulator's debugger as a base to compare my emulator to. I go through each instruction and make sure they, and the registers, match BGB's.
On GitHub there is a private repository for this project setup, and hopefully in the next few weeks I can make it public. This project really takes me back because the Game Boy is my all time favorite console, and it's really fun to be able to implement my own take on it.
Wednesday, April 1, 2009
1 Month Left!
One month left of school! Just finished the Linear Algebra test covering eigens. I feel I did good, but I goofed up on the last problem. I made the foolish assumption to rely on my calculator. I used rref on a matrix with a variable, and since the rref function for the 89 runs it symbolically, it did not care about the fact that one of the row operations it made would be undefined at h=6. Lesson learned, never go beyond reduced echelon form (ref) using the calculator.
In other news, I've been messing around with Gameboy assembly. I decided to pick a very simple commercial platform to work with, just for the sake of learning (and fun!). The gameboy architecture is very simple and easy to work with, and after scouring the four corners of the internet through mountains of dead hyperlinks, I gathered up the necessary resources to both compile assembly into a gameboy ROM and even found a nice tile editor that outputs to Gameboy format. Since this is the original one, all I have to worry about is pixelated images with 4 colors. I don't intend to delve too deep into it all, just make a simple game to learn a bit about it. The Z80 like architecture is very familiar looking and has some interesting changes for use with the Gameboy. I chose to stay away from C simply because the libraries out there were next to non-existent and I wanted as much control and experience with the raw hardware as possible. As of now I have just a sprite that moves around the screen with arrow keys, but we'll see what I come up with in the future.
In other news, I've been messing around with Gameboy assembly. I decided to pick a very simple commercial platform to work with, just for the sake of learning (and fun!). The gameboy architecture is very simple and easy to work with, and after scouring the four corners of the internet through mountains of dead hyperlinks, I gathered up the necessary resources to both compile assembly into a gameboy ROM and even found a nice tile editor that outputs to Gameboy format. Since this is the original one, all I have to worry about is pixelated images with 4 colors. I don't intend to delve too deep into it all, just make a simple game to learn a bit about it. The Z80 like architecture is very familiar looking and has some interesting changes for use with the Gameboy. I chose to stay away from C simply because the libraries out there were next to non-existent and I wanted as much control and experience with the raw hardware as possible. As of now I have just a sprite that moves around the screen with arrow keys, but we'll see what I come up with in the future.
Labels:
assembly,
gameboy,
linear algebra,
programming,
school
Subscribe to:
Posts (Atom)