What's new

My PotatoChipAte

OP
glVertex3f

glVertex3f

Crap Cracker
In file included from c:\chipate\chip8cpu.c:2:
c:/chipate/Chip8.h:203: `DelayTimer' redeclared as different kind of symbol
c:/chipate/Chip8.h:7: previous declaration of `DelayTimer'
c:/chipate/Chip8.h: In function `DelayTimer':
c:/chipate/Chip8.h:204: warning: assignment makes integer from pointer without a cast
c:/chipate/Chip8.h: In function `SetDelayT':
c:/chipate/Chip8.h:221: invalid lvalue in assignment

Now.. I understood that when I made the DelayTimer an integer... but I changed it to an unsigned char and still get this... What am i doing wrong?
 

refraction

PCSX2 Coder
no

like this

case 0x0a:
{
int pos;
m_pKeyboard->update();
for(int i = 0; i <= 15; i++)
if (m_pKeyboard->m_cKey == true) pos = i; //Find out if a key has been pressed
else
pos = NULL;

if(pos!=NULL)
m_pMemory->setRegister((m_cpuContext.opcode&0x0F00)>>8, m_pKeyboard->m_cKey[pos]);
else
m_cpuContext.PC-=2;
}
break;


the else pos = NULL; makes it look like it might kill it, but it doesnt, it works fine :)
 
OP
glVertex3f

glVertex3f

Crap Cracker
hmm.. I couold be wrong... but I think wht I have is actually like that...

Code:
int KeyPress()
{
  if(bKeys[VK_NUMPAD0])  return 0;
  if(bKeys[VK_NUMPAD7])  return 1;
  if(bKeys[VK_NUMPAD8])  return 2;
  if(bKeys[VK_NUMPAD9])  return 3;
  if(bKeys[VK_NUMPAD4])  return 4;
  if(bKeys[VK_NUMPAD5])  return 5;
  if(bKeys[VK_NUMPAD6])  return 6;
  if(bKeys[VK_NUMPAD1])  return 7;
  if(bKeys[VK_NUMPAD2])  return 8;
  if(bKeys[VK_NUMPAD3])  return 9;
  if(bKeys[VK_DECIMAL])  return 10;
  if(bKeys[VK_RETURN])   return 11;
  if(bKeys[VK_ADD])      return 12;
  if(bKeys[VK_SUBTRACT]) return 13;
  if(bKeys[VK_MULTIPLY]) return 14;
  if(bKeys[VK_DIVIDE])   return 15;
  return 16;
}

void StoreKey()
{
  if(KeyPress() < 16)
  {
    GetRegValue = KeyPress();
    MemoryIndex += 2;
  }

  else MemoryIndex -= 2;
}

Is this still not right?
 

refraction

PCSX2 Coder
glVertex3f said:
In file included from c:\chipate\chip8cpu.c:2:
c:/chipate/Chip8.h:203: `DelayTimer' redeclared as different kind of symbol
c:/chipate/Chip8.h:7: previous declaration of `DelayTimer'
c:/chipate/Chip8.h: In function `DelayTimer':
c:/chipate/Chip8.h:204: warning: assignment makes integer from pointer without a cast
c:/chipate/Chip8.h: In function `SetDelayT':
c:/chipate/Chip8.h:221: invalid lvalue in assignment

Now.. I understood that when I made the DelayTimer an integer... but I changed it to an unsigned char and still get this... What am i doing wrong?

well Delaytimer is an unsigned char, cos its data straight from the register. try not to name the void and the variable with the same name, it could be getting confused :p.

can you show me the code for them parts of the file?
 
OP
glVertex3f

glVertex3f

Crap Cracker
OMG.. I cant believe I did that... lol :blush:

EDIT:
Ive Finished the OpCodes (I think) and um... still nothing...
I updated the ZIP on the first page.
 
Last edited:
OP
glVertex3f

glVertex3f

Crap Cracker
ok, Ive come to a conclusion...

this is not incrementing throught the Memory..

It loops the program.... but only passes the first instruction through the emulator.
 
Last edited:

Doomulation

?????????????????????????
Perhaps because you missed some ops.
Try to do a PC += 2 at the end of the cpu instead. Add PC += 2 to all skip ops when you skip the next op and PC -= 2 on the jump op so the PC isn't inremented.
 
OP
glVertex3f

glVertex3f

Crap Cracker
the first instruction is a '0x6xxx' and that calls the RegAssign_A() function...
at the end of the function is MemoryIndex+=2... shouldnt this work?

DOOM: Ill try that and see what happens. (And what opcodes am I missing?)
 

Doomulation

?????????????????????????
Well, duh, I can't help but to this time time.
n000000000000000000000000000b!!!!!!!!!!! :p :evil: :evil: :evil: :evil: :evil: :evil: :evil: :evil: :evil: :evil:
Okay I'm, done :D

You've got 3 problems:
1) You should be able to select rom to open (not just C:\Chip8\pong).
2) Don't try to execute the rom before you've opened it! Use a variable, say bLoaded AFTER loading the rom so that it runs the cpu.
3) In the cpu, you got this:

switch(opcode & 0xF000)

Remember that Binary AND only zeroes out the bits! The value would still be 0x6000. You're switching on 0x6.
To solve this, add three 0s after each op (ie case 0x6000) or change your switch to

switch( (opcode & 0xF000) >> 12 )

Be happy that I debugged it for you, n00b =) :evil: :evil: :evil: :evil:
 
Last edited:
OP
glVertex3f

glVertex3f

Crap Cracker
lol, dont you hate it when you do stuff like this...

1) I plan on doing this later :)
2)Just did that like 2 mins ago lol
3) OOOOOOPS

Just one of those days lol
 

refraction

PCSX2 Coder
alternative to doing the >>12 on the switch, just put 3 0's after the existing digits :p altho it takes longer, so you end up with

case 0x1000:

and so on.

but his way is good ;p
 

Doomulation

?????????????????????????
3) Yeah BIIIIIIIIIIG OOOOOOOOOOPS. But couldn't you find it through debugging? I mean, it's not really hard to find that, is it?

Refraction: I just told him he could add three 0s after! Lol, don't you read?! :icecream:
 
OP
glVertex3f

glVertex3f

Crap Cracker
I dont know how to debug... (If you mean by using the :debugger:)

In case you forgot im a n00b remember lol
I only started WInAPI/OpenGL like a month ago...

And I made you changes and A few dots randomly show up on the screen now
 

refraction

PCSX2 Coder
glVertex3f said:
oh lol, I thought he was referring to programming lol


what he was saying is learn how to debug, learn how to look at whats happening and realise why its not working :) it helps to know how C code works as well, try running a program in your head, look at what youve given it and follow what it should do, then realise why its not doing it, like with your switch case problem ;)
 

Top