View unanswered posts | View active topics
Board index » 6502.org Users Forum » Programming
All times are UTC
| Author | Message |
|---|---|
| BigEd |
Post subject: Using BIT to skip 2 bytes Post Posted: Sun Aug 15, 2010 5:14 pm
|
|
Offline
Joined: Thu Dec 11, 2008 1:28 pm Posts: 11339 Location: England |
There's an interesting trick in the code Daryl added to Microchess:
Code: AND #01ドル ; is board square white or blk? BNE Pout25 ; black, print space LDA #"*" ; white, print * .BYTE 2ドルc ; used to skip over LDA #20ドル Pout25 LDA #20ドル ; ASCII space JSR syschout ; print one ASCII CHR - space If the branch is not taken, the 6502 will execute Code: AND #01ドル ; is board square white or blk?
BNE Pout25 ; black, print space LDA #"*" ; white, print * BIT 20ドルA9 ; almost a NOP Pout25 JSR syschout ; print one ASCII CHR - space so this is a compact way to skip over the branch-taken code without a second branch. It might be a bit of a challenge to a disassembler, or some types of emulator. |
Board index » 6502.org Users Forum » Programming
All times are UTC
Users browsing this forum: No registered users and 2 guests