Subject: [stella] Combat programming From: jimn8@xxxxxxxxxx (Jim Nitchals) Date: Mon, 3 Mar 1997 16:31:58 -0800 (PST) |
While it was well designed, I noticed a few inefficiencies. I offer them not as criticism of Combat, but as little hints on building better 6502 code: lda TheScore,X and #$F0 lsr lsr sta Temp1 ; * 4 lsr lsr clc adc Temp1 ; * 5 The clc isn't needed because the least significant bit is already 0 from the and #$F0 instruction. There's an RTS instruction at $F507 that didn't need to be there - there were other RTS's that could've been branched to. Near $F37B, there's code that reads: lda GameModeInformation bmi @not_invisible ; planes/jets are never invisible and #1 beq @not_invisible ; invisibility bit set? The and #1/beq is less efficient space-wise than an lsr followed by a bcc in this case, because the code doesn't need to preserve the accumulator or the carry flag (if you read the rest of the code, you can see that.) Last, there's definitely code in there to flash an LED wired to bit 4 of port B when the game is over. Presumably Atari ditched the LED to save money. Overall, Combat *IS* an example of really good programming. There's very little wasted code, and what's there does a lot for being only 2K. There should be plenty of time left during vblank to do AI for a one player mode. Does the computer get to cheat during invisible tank mode and know where the player is, though? ;) - Jim -- To unsubscribe, send the word UNSUBSCRIBE in the body of a message to stella-request@xxxxxxxxxxx
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[stella] Re: POLL, Lost In The Zone | Thread | Re: [stella] Combat programming, jvmatthe |
Re: [stella] POLL, Nick S Bensema | Date | Re: [stella] POLL, Nick S Bensema |
Month |