2023-10-26 19:51:20 +02:00
|
|
|
.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
|
2023-11-01 13:13:23 +01:00
|
|
|
|
|
|
|
|
|
|
|
;_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
|