Language…
13 users online:  Alex, anonimzwx, DasFueller, Dinkleberrg, Fawndue, gui, jobvd, MegaSonic1999, OEO6, skyekun, solgaleo35, Soul, ZachJamesGames - Guests: 118 - Bots: 328
Users: 55,635 (2,423 active)
Latest user: franklinbm15

$7FC0FC - ASM code to set/clear a specified bit

;Custom trigger to use
!CustomTrigger = $00
;^Only enter $00-$0F (0-15). This is what LM's CUSTOM trigger to use.
!ClearOrSet = 1
;^0 = clear (bit will be 0)
; 1 = set (bit will be 1)

;Don't touch, these calculates should it use $7FC0FC or $7FC0FD,
;as well as what bit in the byte to use.
!CustomTrigger_WhichByte #= !CustomTrigger/8 ;This will be 0 if using triggers $00-$07, otherwise 1 if $08-$0F
!CustomTrigger_BitToUse #= %00000001<<(!CustomTrigger%8)

;Code:
LDA $7FC0FC+!CustomTrigger_WhichByte ;\Write trigger bit.
if !ClearOrSet == 0
AND.b #!CustomTrigger_BitToUse^$FF
else
ORA.b #!CustomTrigger_BitToUse
endif
STA $7FC0FC+!CustomTrigger_WhichByte ;/