Skip to content

Commit

Permalink
Small emulation bugfixes
Browse files Browse the repository at this point in the history
  • Loading branch information
ferris committed May 18, 2013
1 parent 50b221d commit 8ac0ad6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
8 changes: 4 additions & 4 deletions Chip8/Chip8.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -304,24 +304,24 @@ void Chip8::Update()
{
// LD B, Vx
char c = regs[x];
ram[iReg + 2] = c % 10;
ram[iReg + 1] = (c / 10) % 10;
ram[(iReg + 2) & 0xfff] = c % 10;
ram[(iReg + 1) & 0xfff] = (c / 10) % 10;
ram[iReg] = (c / 100) % 10;
}
break;

case 0x55:
{
// LD [I], Vx
for (int i = 0; i <= x; i++) ram[iReg + i] = regs[i];
for (int i = 0; i <= x; i++) ram[(iReg + i) & 0xfff] = regs[i];
iReg = (iReg + x + 1) & 0xfff;
}
break;

case 0x65:
{
// LD Vx, [I]
for (int i = 0; i <= x; i++) regs[i] = ram[iReg + i];
for (int i = 0; i <= x; i++) regs[i] = ram[(iReg + i) & 0xfff];
iReg = (iReg + x + 1) & 0xfff;
}
break;
Expand Down
3 changes: 1 addition & 2 deletions Main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ int Main(const List<String>& arguments)
auto fileLoadRomImage = MenuItem::Create("Load ROM Image...");
fileLoadRomImage->Click += [&]
{
// TODO: File filters
auto fileName = DialogWindow::OpenFile(window, "Load ROM Image");
if (fileName.Length())
{
Expand Down Expand Up @@ -190,7 +189,7 @@ int Main(const List<String>& arguments)
auto videoDriver = new GLVideoDriver(viewport);
chip8.SetVideoDriver(videoDriver);

if (arguments.Count()) loadAndStartRomImage(arguments[0]); // TODO: proper arg's
if (arguments.Count()) loadAndStartRomImage(arguments[0]);

while (running)
{
Expand Down

0 comments on commit 8ac0ad6

Please sign in to comment.