Next Generation Emulation banner

1 - 12 of 12 Posts

·
Emu Author
Joined
·
613 Posts
Discussion Starter #1
this is related to the emulator i am working on, would it be better to check flags on every opcode and set them when needed or only check flags against a current result when an opcode requires such a check? reason i ask is i think my bugs might be a result of bad flag settings.
 

·
Level 9998
Joined
·
9,384 Posts
Bugs are always because of bad flags or bad calculations. :p

But you should follow the specs of the processor. If an operation requires you to set flags and the likes, then you're better off setting them only then. Also note that some operations would reset a flag before it does anything, but due to technical problems, you can't really "catch" that change in a split second and the change is not documented.
 

·
Emu Author
Joined
·
613 Posts
Discussion Starter #3
well should i reset flags for opcodes that do not affect any? as currently i do not so i am thinking that might be causing the bugs?
 

·
Level 9998
Joined
·
9,384 Posts
Mmm... depending on the flags? There are some "sneaky bastards" in flags that get switched behind your back and documents won't say it because they are... sneaky. But if the operation does not specify you to do so, then I guess... leave the flags alone.

Try looking closer at the arithmetic operations. They are the ones most likely to set or reset an extra flag.

For instance, when you are doing an addition, obviously you will never have the Zero Flag set on some CPU because an addition never goes to Zero. (well, lest you're adding 0 to 0 but that's kinda weird? I haven't seen a system that does that) So in most cases, the Zero flag is automatically unset in an addition operation.
 

·
Emu Author
Joined
·
613 Posts
Discussion Starter #5
hey do you think if i can not quite figure out where this bug is, if i could send it to you and see if you can find anything?
 

·
Emu Author
Joined
·
613 Posts
Discussion Starter #7
well i am getting ready to switch my cpu method to another method that i saw in hap's version of space invaders and see if it works any better.
 

·
Emu Author
Joined
·
613 Posts
Discussion Starter #9
i think the one thing i am having a hard time with is setting flags correctly. if an opcode does not necessarily change the flag, should i still reset those unaffected? i know my methods that determine if flags need to be set are correct, its mainly just the matter of when as i am also sure that the functionality of my opcodes seems to be fine as well. but yea, after say a conditional jump that checks for the carry flag, would i reset the status word back to default or leave it how it is? i think things like that are more than likely whats wrong but just unsure since the documentation does not go into much detail on what happens after stuff like that.
 

·
Emu Author
Joined
·
613 Posts
Discussion Starter #10 (Edited)
well i found out that part of the problem at least seems to be how many cycles are running, if i combined my 2 cycle sets into one it showed a lot more of my screen but at the same time is broke input even though it was going into my vblank area to check input, it just never showed any sign of accepting it and making changes to the screen to show input was accepted.

but when i separated and put them in 2 separated sets of cycles, it seemed to only show was happened in the last set, so there is a bug thats causing that somewhere it'd seem. but its a start, if i get it to do to many cycles it than starts showing parts of the demo in the opening screen before its supposed to which bugs the game and wont go anywhere. so it seems i have that to fix but it shows that my method with my cpu may not be so bugged after all just my method of timing the cpu :).
 

·
Emu Author
Joined
·
613 Posts
Discussion Starter #11
i found a bug that could have caused some of the issues but than the emulator showed a screen that said tilt, would you by chance know why it would say that? plus by going over a print out of the program counter as the emulator processed the rom i believe it indeed pointed at the problem of flags not being set right so i am going to be rewriting that part for sure now that i know its that and hoping that might fix some other errors.

wish me luck.
 

·
Emu Author
Joined
·
613 Posts
Discussion Starter #12
after a bit of tedious work i have great news, and i will show it with a pic, bugs are still in the cpu but this is great progress if i do say so myself.

it messes up when it goes to load the demo but this is a good start for my space invaders emulator and shows i am on the right path again.
 
1 - 12 of 12 Posts
Top