- lda $d012 sbc #$31 bcc + clc and #$07 beq - + lda #%00001011 sta $dd00 nop eor #%00001000 sta $dd00 lda #$ff eor $dd00 lsr lsr eor $dd00 lsr lsr eor $dd00 lsr asr #$fe ;lets carry be cleared after lsr! eor $dd00
!align 255,0 bin2ser !byte %1111, %0111, %1101, %0101, %1011, %0011, %1001, %0001 !byte %1110, %0110, %1100, %0100, %1010, %0010, %1000, %0000 ldx #$0f sbx #$00 lsr lsr lsr lsr sta .y1+1 ;keep y free lda bin2ser,x - ldx $1800 bpl - sta $1800 asl and #$0f sta $1800 .y1 lda bin2ser sta $1800 asl and #$0f sta $1800
... lda #%00001011 sta $dd00 nop eor #%00001000 sta $dd00 lda #$ff eor $dd00 lsr lsr eor $dd00 lsr lsr eor $dd00 lsr asr #$fe ;lets carry be cleared after lsr! eor $dd00 tay lda #$ff eor $dd00 lsr lsr eor $dd00 lsr lsr eor $dd00 lsr asr #$fe ;lets carry be cleared after lsr! eor $dd00 ... ; 1st byte on Y, 2nd byte in A
!align 255,0 bin2ser !byte %1111, %0111, %1101, %0101, %1011, %0011, %1001, %0001 !byte %1110, %0110, %1100, %0100, %1010, %0010, %1000, %0000 ... lda val1 ldx #$0f sbx #$00 stx .y0+1 lsr lsr lsr lsr sta .y1+1 lda val2 ldx #$0f sbx #$00 stx .y2+1 lsr lsr lsr lsr sta .y3+1 .y0 lda bin2ser - ldx $1800 bpl - sta $1800 asl and #$0f sta $1800 .y1 lda bin2ser sta $1800 asl and #$0f sta $1800 .y2 lda bin2ser sta $1800 ; (*) asl and #$0f sta $1800 ; (*) .y3 lda bin2ser sta $1800 ; (*) asl and #$0f sta $1800 ...
... lda #%00001011 sta $dd00 nop eor #%00001000 sta $dd00 nop lda $dd00 ; c=x A=hf000011 lsr ; c=1 A=0hf00001 ora $dd00 ; c=1 A=gef00011 (h must be 0!) lsr ; c=1 A=0gef0001 ldx $dd00 ; X = db000000 lsr ; c=1 A=00gef000 ora $dd00 ; c=0 A=cagef000 ora table,x ; Translation table only for moving X on lower bits ...
... ldx #$0f ; 2 - abcdefgh sbx #$00 ; 2 X = 0000efgh lsr ; 2 lsr ; 2 lsr ; 2 tay ; 2 Y = 000abcde txa ; 2 asl ; 2 ldx #%00001010 ; 2 A = 000efgh0 => 0000C0D0 loop bit $1800 bpl loop sax $1800 ; 4 fh lsr ; 2 sax $1800 ; 4 eg tya ; 2 sax $1800 ; 4 bd lsr ; 2 sax $1800 ; 4 ac ...
ora table,x tax lda descramble,x
... ldx #$0f ; 2 - abcdefgh sbx #$00 ; 2 X = 0000efgh lsr ; 2 lsr ; 2 lsr ; 2 tay ; 2 Y = 000abcde txa ; 2 A = 0000efgh ldx #%00001010 ; 2 X mask 0000C0D0 loop bit $1800 bpl loop sax $1800 ; 4 save (eg) asl ; 2 A=000efgh0 sax $1800 ; 4 save (fh) tya ; 2 A=000abcde sax $1800 ; 4 save (bd) lsr ; 2 A=0000abcd sax $1800 ; 4 save (ac) ...
... lda #%00001011 sta $dd00 nop eor #%00001000 sta $dd00 nop lda $dd00 ;4 A=ge000011 lsr ;2 A=0ge00001 ldx $dd00 ;4 X=hf000011 lsr ;2 A=00ge0000 ora $dd00 ;4 A=dbge0011 lsr ;2 A=0dbge001 ora $dd00 ;4 A=cdbge011 ora table,x ;4 A=cdbgehf1 (table move bits 7,6 to 2,^1) ...