Okay, chaps, settle down. Today's lesson is a bit different. It turns out that the government is enforcing standardized testing, and that means that all you little idiots will fail. Which won't look good for me, unlike those neatly "curved" grade reports I've been handing in for the past five years. So, today, I'm going to teach you to cheat, lie, and steal your way into the next grade.
What this cheat does is to keep resetting the player's line counter, every time lines are given. A disadvantage is that - to make some space for the code - teachers always give a flat 900 lines now. But that just means that you score more when the bully and the swot get lines!:)
Notice how the lines given are basically random? There's one routine to deal with that. Here's the relevant code, with my comments.
Addr Hex Assembly Comments 1de9 AD 1B D4 LDA $D41B SID chip register for noise - random. 1dec 29 0F AND #$0F Make it a number from 0 to 15. 1dee 18 CLC Clear carry (before adding). 1def 69 03 ADC #$03 Add 3. (Now 3 to 18.) 1df1 85 57 STA $57 Put a copy aside for a moment.... 1df3 0A ASL A Double it. (Now 6 to 36.) 1df4 0A ASL A Double it. (Now 12 to 72.) 1df5 18 CLC Clear carry (before adding). 1df6 65 57 ADC $57 Add to original. (Now 15 to 90.) 1df8 85 85 STA $85 Put it away for later use.
So it grabs a nice random number from here, cuts it down a bit, then basically multiplies by 5. Lines seem to be handed out in tens, so this range from 15 to 90 becomes 150 to 900 lines.
Well, that can be improved upon. If you have VICE, fire up the ML monitor and punch in - without quotes - "> 1DE9 A9 00 85 7E 85 7F A9 12". This patches the code into:
Addr Hex Assembly Comments 1de9 A9 00 LDA #$00 Zero. 1deb 85 7E STA $7E Which is what your lines... 1ded 85 7F STA $7F now are. 1def A9 12 LDA #$12 Load decimal 18 in. 1df1 85 57 STA $57 Put a copy aside for a moment.... 1df3 0A ASL A Double it. 36. 1df4 0A ASL A Double it. 72. 1df5 18 CLC Clear carry (before adding). 1df6 65 57 ADC $57 Add to original. 90. 1df8 85 85 STA $85 Put it away for later use.
While it means you get 900 lines whenever you do something wrong, it also means that all your lines previous (stored in $7E and $7F) are wiped out. So the worst your counter is at is 900 lines!
Pokes for same. (Untested!) POKE 7657, 169: POKE 7658, 0: POKE 7659, 133: POKE 7660, 126: POKE 7661, 133: POKE 7662, 127: POKE 7663, 169: POKE 7664, 18
Remember, the pokes won't work if the program uncompresses itself before running. Unless you have something fancy that can poke around after the program starts.
There's another, more general-purpose random number generator:
Addr Hex Assembly Ac Xr Yr Flags 3B7A AD1BD4 LDA D41B D41B:D4 D4 00 1F Nv1Bdizc 3B7D 293F AND #3F 14 00 1F nv1Bdizc
But changing this one paralyzes the teachers! I suppose it might come in handy at times, but they're needed to bounce slingshot bullets off of.:)
For more fun, use a hex editor on a state-save (or use the VICE monitor's "i" command) to look at the early part of the binary. (Around hex 80.) You should see a string of four letters and four numbers. The letters are the password for the safe. The numbers are Mr. Creak's year of birth. You still need to change all the shields before you can open the safe, though.