What's new

probs with c64 emu...

Sephiroth87

New member
hi there!
i'm writing my personal c64 emu, and 've almost completed cpu emulation (few opcodes missing...)
howewer, when running the kernal, i get stucked at this line...

FF5E AD 12 D0 LDA $D012
FF61 D0 FB BNE $FF5E

obviously, if something outside the kernal doesn't change $D012, it'll loop forever...

am i missing something???

plz help me!!!
 
OP
S

Sephiroth87

New member
ya, but i dunno if it can be changed outside the kernal, i mean, the loop itself doesn't change the value, so there most be something else i can't figure out....
 

Cyberman

Moderator
Moderator
Sephiroth87 said:
hi there!
i'm writing my personal c64 emu, and 've almost completed cpu emulation (few opcodes missing...)
howewer, when running the kernal, i get stucked at this line...

FF5E AD 12 D0 LDA $D012
FF61 D0 FB BNE $FF5E

obviously, if something outside the kernal doesn't change $D012, it'll loop forever...

am i missing something???

plz help me!!!
Have you looked at the C64's hardware map? It might be a hardware register that goes to zero when something is completeled. There is also the possibility it is waiting for an interrupt to change that location. If you haven't implemented interrupts it will never exit obviously if that is the case.

Cyb
 

bcrew1375

New member
That's what I said. It IS a hardware register, unless the doc I was looking at was wrong :p. Things are still happening during that loop. I'd think on just about any system the hardware registers would work independantly of the software.
 

Cyberman

Moderator
Moderator
Sephiroth87 said:
i hoped not to implement interrupts for the first time, but, i see i can't go on without them :(
Been there :) I implemented a 68hc12 emulator and ran into that problem. GEEE why isn't this program exiting this loop. Simple the system used a 60 cycle timer in a wait loop. So if the interrupts were function it sat there forever :)

Cyb
 
OP
S

Sephiroth87

New member
howewer i've found out what it's, it simply keep trace of the line currently refreshed...

now the problem is how to implement it :p
 

Cyberman

Moderator
Moderator
Sephiroth87 said:
howewer i've found out what it's, it simply keep trace of the line currently refreshed...

now the problem is how to implement it :p
Don't you mean track? So it's looking at the horizontal scan line to know if it's greater than one. You should be able to implement it by looking at the CRT controller hardware since this is what generates this. Essentially you have to update 157** times per second. Depending if you are implement PAL or NTSC emulation :)

Cyb
 
OP
S

Sephiroth87

New member
well, but the things is that i've to refresh the screen and emulating the cpu at the same time, and i don't think that would be possible in an emu...
howewer, in another forum, they told me...
When emulating, things that would be literally simultaneous on real hardware might be sequential on the emulator. You don't literally have to refresh the screen and emulate the CPU at the same time. You could pause CPU emulation after a certain number of cycles (emulated cycles, not DS ones), then run the refresh stuff, then resume the CPU.
but like this, imho, it would be useless, coz everytime i acces the register, it'll have ever the same value...
 

Cyberman

Moderator
Moderator
Sephiroth87 said:
well, but the things is that i've to refresh the screen and emulating the cpu at the same time, and i don't think that would be possible in an emu...
howewer, in another forum, they told me...

but like this, imho, it would be useless, coz everytime i acces the register, it'll have ever the same value...
You need to update the register as you update the display. You can also fake it if you like. However there are some effects on the GBA for example that use the horizontal interrupt to change the display. One example is the fake 3d world view in some games. They use a scaleable rotatable background with tiles in it and update the scale as things progress down the screen. This gives depth to the visual.
 

Top