you know, brian, if you wanted to poke at it, you could learn this stuff pretty easy if you wanted
im still way behind, but you can figure a lot out just reading through the instruction set. it's all just a bunch of addressing and simple instructions, very similar to the ones that are spit out of your c code when you compile it.
there's an A and B register (8 bits each), and a D register that is just A and B together making a single 16 bit register, and a few others, X, Y, whatever.
these are for stupid fast temporary working storage of stuff, you have to load a memory address's contents into them, then operate on that register.
you just have to watch out for this special persistent set of bits called 'condition bits', which may or may not be changed or set by the results of practically any operation. they're whats used for branching.
the mnemonics of the disassembly is pretty englishy, ldaB is LoaDAddressB, cmpB is CoMPare to B, bcs is Branch if Carry bit Set, bne is Branch if Not Equal to zero
http://www.ele.uri.edu/Courses/ele20...ons/index.html
so just for example (but i'll probably screw it up)
Code:
E2B6 F6 1D 28 @3 ldaB L1D28 ; the B register now contains whatever is in address @ 1D28
E2B9 F1 24 8F cmpB L248F ; compare B to memory address @ 248F (sets the condition register)
E2BC 25 0E bcs @6 ; if carry was set (meaning B was >= 248F) jump 14 bytes ahead
E2BE F6 1D 29 ldaB L1D29 ; B = address @ 1D29; but also sets the 'if zero' register
E2C1 26 04 bne @4 ; if B != 0, then jump 4 bytes ahead
E2C3 86 02 ldaA #$02 ; the A register now contains 0x02 (a static value)
so in c that would be like (pretending stuff like L1D28 is #define'd memory, which it is, ram is stored in all the low bytes):
Code:
char A,B;
B = L1D28;
if(B >= L248F) {
goto //fourteen_bytes_ahead;
};
B = L1D29;
if(B != 0) goto //four_bytes_ahead;
A = 0x02;
and obviously once you've jumped, A and B still equal whatever they did when they left, there's no actual blocks of code, braces, or 'scope of variables'...
Bookmarks