diff options
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 |