mirror of
https://github.com/a2-4am/4cade.git
synced 2024-09-28 18:55:36 +00:00
51 lines
2.2 KiB
Plaintext
51 lines
2.2 KiB
Plaintext
|
;license:MIT
|
||
|
;(c) 2019-2022 by 4am
|
||
|
;
|
||
|
|
||
|
!ifndef _FX_MACROS_COPYBIT_ {
|
||
|
|
||
|
!macro COPY_BIT .src1, .dest1, .copymasks {
|
||
|
lda (.src1),y
|
||
|
eor (.dest1),y ; merge source and destination bits
|
||
|
and .copymasks,x ; isolate the bits to replace, zero the rest
|
||
|
eor (.dest1),y ; unmerge source and destination bits, leaves 'to keep' destination bits intact
|
||
|
sta (.dest1),y ; write the result
|
||
|
}
|
||
|
|
||
|
!macro COPY_BIT_DITHER .src1, .dest1, .copymasks, .dithermaskptr {
|
||
|
lda (.src1),y
|
||
|
eor (.dest1),y ; merge source and destination bits
|
||
|
and .copymasks,x ; isolate the bits to replace, zero the rest
|
||
|
and (.dithermaskptr),y ; apply dither mask (if any)
|
||
|
eor (.dest1),y ; unmerge source and destination bits, leaves 'to keep' destination bits intact
|
||
|
sta (.dest1),y ; write the result
|
||
|
}
|
||
|
|
||
|
!macro COPY_BIT_ZP .src1, .dest1, .zpcopymask {
|
||
|
lda (.src1),y
|
||
|
eor (.dest1),y ; merge source and destination bits
|
||
|
and <.zpcopymask ; isolate the bits to replace, zero the rest
|
||
|
eor (.dest1),y ; unmerge source and destination bits, leaves 'to keep' destination bits intact
|
||
|
sta (.dest1),y ; write the result
|
||
|
}
|
||
|
|
||
|
!macro COPY_BIT_ZP_DITHER .src1, .dest1, .zpcopymask, .ditherptr {
|
||
|
lda (.src1),y
|
||
|
eor (.dest1),y ; merge source and destination bits
|
||
|
and <.zpcopymask ; isolate the bits to replace, zero the rest
|
||
|
and (.ditherptr), y ; apply dither mask (if any)
|
||
|
eor (.dest1),y ; unmerge source and destination bits, leaves 'to keep' destination bits intact
|
||
|
sta (.dest1),y ; write the result
|
||
|
}
|
||
|
|
||
|
!macro COPY_BIT_IMMEDIATE .copymask {
|
||
|
lda (src), y
|
||
|
eor (dst), y ; merge source and destination bits
|
||
|
and #.copymask ; isolate the bits to replace, zero the rest
|
||
|
eor (dst), y ; unmerge source and destination bits, leaves 'to keep' destination bits intact
|
||
|
sta (dst), y ; write the result
|
||
|
}
|
||
|
|
||
|
_FX_MACROS_COPYBIT_=*
|
||
|
}
|