6502-OS/utility.h65

35 lines
1.1 KiB
Plaintext
Raw Normal View History

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
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
2023-11-09 12:09:06 +01:00
.endif