Thursday, June 21, 2007

Even Odds


The great thing about coding, particularly in assembly, is that if one is out of their element with a particular operation or concept, there are usually several other directions to take to get the desired outcome. This is a maxim that has given great comfort to me in my efforts.

Apparently my desire to use a subtract operation has caused me to hit that thick wall separating my comprehension from many, many Z80 assembly concepts. I guess these operations use signed bytes, so half the time the pseudo number generator spits out values that this operation considers negative. Well, that's what it looked like while debugging.

Anyway, that's no good. So instead I used an addition and used the carry flag for my conditional jump. This worked like a charm. I set it to less than 1-10 odds so things aren't insane, gameplay-wise.

Oh, and here are DMEnduro's smoke tiles. Time to get this party started!

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.

Friday, June 8, 2007

Wednesday, June 6, 2007

The Battle of Eggplant Forest



Here's that video I promised. Sorry Google took so long to vet it.

I did try to fix the problem. First off, I should apologize to z80.info - their code is flawless. Well, their code plus a nice little CPIR operation that checks for duplicates. Food identities are updated in RAM plausibly randomly; they just don't match up with what's displayed. Except the first time. So something weird is going on.

Monday, June 4, 2007

Fish à l'Orange

I've finally updated the project (yes, life got really busy). All food items are now tile-based, and once every 8 vblanks each item gets 50-50 odds of remaining. You'll notice from the video* that this would make the game virtually unplayable, but that'll be a simple tweak.

What won't be such a simple tweak is how in tarnation all of those fishes, oranges, and eggplants get chosen. Weird. Well, it could be my code, or else the pseudorandom number generator subroutine I stole from www.z80.info . I'll have to check that out.


*As soon as Google determines it is of sufficient quality to upload to their stupid video thingy. Jerks