Log in

No account? Create an account
I wish I knew earlier - Blather, Rinse, Repeat
April 9th, 2009
02:11 pm


Previous Entry Share Next Entry
I wish I knew earlier
From Assembly Language for the Applesoft Programmer by C. W. Finley, Jr. and Roy E. Myers:

If an indirect jump does lie across a page boundary, a jump is performed and the results are predictable. See if you can figure it out. This is rumored to be a "technique" used by "master" game programmers to "disguise" their code.

I find the heavy use of scare quotes charming, and I suspect I know what the predictable behavior alluded to here is.

I find it particularly interesting to stretch my brain to try to imagine a time when disassembling machine code was a thing that people had to guard against.

(4 comments | Leave a comment)

[User Picture]
Date:April 9th, 2009 11:10 pm (UTC)
Also popular, inserting the opcode for the "bit" instruction, both to obfuscate but also to allow if/then/else blocks to not have to jump over the else; the extra bit opcode just "swallows" the next couple bytes.
[User Picture]
Date:April 10th, 2009 12:38 am (UTC)
Hm, I won't get to BIT until page 102.

I just discovered that the 6502 doesn't have a multiply instruction. Sweet.
[User Picture]
Date:April 10th, 2009 01:31 am (UTC)
Shameless (non-commercial) self-promotion:

It's C64 oriented rather than A2, but there's a cheesy 6502 disassembler in there (written in Python.)
[User Picture]
Date:April 10th, 2009 01:54 am (UTC)
I love Python.

I'll check out c64-utils, and certainly keep the link around as I thrash around in 6502space.

I'm toying with the notion of writing a Mandelbrot set renderer, which I've done any number of times already. I'm skimmed around in the book for the memory layout of the "high res" graphics mode and the firmware subroutines for floating point math.

Another project after that, if I'm still feeling retro-ish, would be to write an Applesoft (that is, Microsoft) BASIC interpreter in Python. I've got a few books of old BASIC computer games, and I suspect there's some value in revisiting these old haunts, even if there's not a lot of gameplay for modern users.

I've found it curious that writing code for a single-tasking BASIC interpreter to be a very different feeling, even now, than writing for a windowed environment - I guess it's all down to having imperative control over everything that's going on in the system. Maybe it's just some nostalgia masquerading as the awesome power of the entire machine.
My Website Powered by LiveJournal.com