FR3TO1
.Page
;++
; FR3TO1 will take three bytes and create one composite byte from them.
;
; Input register usage:
; A := >CCCCCCCC<
; X := >BBBBBBBB<
; Y := >AAAAAAAA<
;
; Output register usage:
; A := >00AABBCC< == Nibblized
;--
FR3TO1 .Equ * ; From three to one routine
Lsr A ; Ignore low six bits of "A" as they
Lsa A ; will get shifted out and lost
Sta Temp1 ; >00CCxxxx<
Txa
And #0C0 ; Clear low bits
Ora Temp1 ; >BBCCxxxx<
Lsr A
Lsr A
Sta Temp1 ; >00BBCCxx<
Tya
And #0C0 ; Clear low bits
Ora Temp! ; >AABBCCxx<
Lsr A
Lsr A ; >00AABBCC<
Tax
Lda Nibl,X ; Nibblize the new composite byte
Rts