lda $d012 sbc #$03 ;no need for sec and #%00000111 ora #%00011000 sta $d011
lda $d012
and #%00000111 ora #%00011000
sta $d012
lda $d012 and #%00000111 eor #%00011100 sta $d011