diff options
author | B. Watson <yalhcru@gmail.com> | 2016-02-22 19:00:53 -0500 |
---|---|---|
committer | B. Watson <yalhcru@gmail.com> | 2016-02-22 19:00:53 -0500 |
commit | 0bd18d930c2bc88eb4a4b31d19772c74fc4af06f (patch) | |
tree | e07e1636e225de1ad0086cd28016a86888c4eb69 /console.s | |
parent | b4bc2d9b75c7ecf39f26b717b88384b8a5a9f578 (diff) | |
download | taipan-0bd18d930c2bc88eb4a4b31d19772c74fc4af06f.tar.gz |
save 12 more bytes, 7368 free, document the hell out of console.s
Diffstat (limited to 'console.s')
-rw-r--r-- | console.s | 27 |
1 files changed, 26 insertions, 1 deletions
@@ -138,7 +138,32 @@ _rvs_off: ; ...or 5 bytes each. we have 5 of them, so 25 bytes. using fall-thru ; and the BIT trick, they condense down to 17 bytes. ; if you're not familiar with the "BIT trick" to skip a 2-byte instruction, - ; the stuff below looks like gibberish, sorry. + ; the stuff below looks like gibberish... here's a mini-tutorial: + + ;store1: + ; lda #1 + ; .byte $2c ; this is the opcode for BIT absolute + ;store2: + ; lda #2 + ; sta $0600 + ; rts + + ; if entered via "jsr store1", the above code fragment executes these + ; instructions: + ; lda #1 + ; bit $02A9 ; $A9 is the LDA immediate opcode, 02 is the #2 + ; sta $0600 + ; rts + + ; if entered via "jsr store2", it's + ; lda #2 + ; sta $0600 + ; rts + + ; the "bit $02a9' doesn't affect any registers other than the flags, + ; and the "sta $0600 : rts" part doesn't depend on any of the flags, + ; so the BIT is effectively a no-op that "masks" the 2-byte LDA #2 + ; instruction "hidden" as its operand. ; ", Taipan? " ; using fall-thru here saves 3 bytes (normally the last instruction |