View Full Version : probs with c64 emu...
Sephiroth87
July 25th, 2005, 12:39
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!!!
bcrew1375
July 25th, 2005, 20:58
I'm not familiar with C64, but perhaps its some kind of I/O register? Maybe it changes on its own?
Ah, looked up some information. It seems $D012 is the raster read/write register. Isn't that the current line being drawn? Anyway, here's the info: http://nocash.emubase.de/pagezero.htm#c64iomap
Sephiroth87
July 25th, 2005, 21:38
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
July 26th, 2005, 00:35
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
July 26th, 2005, 05:15
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.
Sephiroth87
July 26th, 2005, 07:17
i hoped not to implement interrupts for the first time, but, i see i can't go on without them :(
Cyberman
July 26th, 2005, 14:41
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
Sephiroth87
July 30th, 2005, 10:44
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
August 1st, 2005, 02:07
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
Sephiroth87
August 1st, 2005, 08:11
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
August 1st, 2005, 19:47
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.
Powered by vBulletin® Version 4.1.11 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.