NESDev and Strangulation Records messageboards
Forum Index | FAQ | New User | Login | Search

Previous ThreadView All ThreadsNext Thread**


SubjectWorkaround for lack of BIT #imm  
Posted byblargg
Posted on12/26/03 00:33 AM
From IP199.170.89.127  



Maybe this is already done; I had an idea for giving the BIT instruction a partial immediate mode by setting up 8 constants in zero-page, one for each bit in a byte, allowing a two-byte BIT instruction to test a particular bit of A (without modifying A).

	const_01 = $00
const_02 = $01
const_04 = $02
const_08 = $03
const_10 = $04
const_20 = $05
const_40 = $06
const_80 = $07

init_consts:
lda #$01
ldx #0
loop:
sta const_01,x
inx
asl a
bne loop

The constants could also be placed at the same adress as their value, so that the address could be used rather than the symbol, i.e. BIT $10, but this seems too convoluted for practical use.




Jump to

Memblers' homepage             Contact Me

Forums powered by WWWThreads Demo