34 lines
1.1 KiB
Plaintext
34 lines
1.1 KiB
Plaintext
.ifndef INCLUDE_UTILITY
|
|
INCLUDE_UTILITY = 1
|
|
|
|
.macpack longbranch ; jeq, jge...
|
|
|
|
;********************************************************************************
|
|
; @macro Update a byte in memory using a mask
|
|
; @param orignal Address of the byte to update
|
|
; @param new New value
|
|
; @param mask Mask of the bits to affect by the new value
|
|
; @details
|
|
; xor new with original -> only bits that need to flip are 1
|
|
; and result with mask -> only selected bits that need to flip stay 1
|
|
; xor result with original -> flips selected bits
|
|
;********************************************************************************
|
|
.macro UT_update_with_mask original,new,mask
|
|
lda #new
|
|
eor original
|
|
and #mask
|
|
eor original
|
|
sta original
|
|
.endmacro
|
|
.endif
|
|
|
|
|
|
;_n_genlabel .set 0
|
|
;;********************************************************************************
|
|
;; @macro Generate a unique label
|
|
;;********************************************************************************
|
|
;.macro genlabel
|
|
; .ident(.sprintf("generated_label%04X", _n_genlabel))
|
|
; _n_genlabel .set _n_genlabel + 1
|
|
;.endmacro
|