Wednesday, June 20, 2007

Androids so do not dream of electric CP

Alright, last week I quashed a bug in my food display code, but was dismayed when I realized that I couldn't change the odds of food changing (down from 100% every single time). I kept debugging the code and it seemed like it should work... except... it didn't. I got my trusty pseudo random number generator (shout out, once again, to z80.info ) to generate a pseudo random number and then set up a CP operation with a value in the C register. Then I implemented a conditional jump depending on whether the sign flag was minus or plus. Everything except for that last bit seemed to work fine. You know the drill - I was crushed, was driven before my failed code, and audible were the lamentations of my women. Well, my wife did wonder why I was crying so much.

Skip ahead one week. I tried just using the zero flag instead. That worked fine (and obviously, with 1 in 256 odds, quite glacially). So my code worked fine. It was just me who was totally retarded. CP has no effect on the sign flag. Duh!

So I'll work on that. Clearly I need to go ahead and use a subtract operation.

Oh, and DMEnduro sent me some awesome smoke grafx. This was a week ago. Anyway, it looked so good in however many shades of gray that I decided to implement these as sprite animations. Pretty risky, what with that finicky, fussy VDP whining even more than I tend to, but life is about risk. I'll post the tiles later once I get this conditional jump all squared away.

No comments: