table = $c000 ;page aligned seed .byte $00,$00 .byte $02,$05 .byte $0c,$1f reduce pla adc seed,y sec next pha ldy #5 txa sta shift+4 shift ror shift+4 sbx #$00 bcs reduce tax dey bpl shift pla store sbc #$1f sta table lsr store+3 bcc store enter dec *+4 lda #$00 sta store+3 asl a tax lda #$00 bcs next ; sta table ;do whatever makes most sense for log(0) rts
toggle = $ea ;zeropage address must correspond to a harmless single-byte opcode lda #%00010000 sta toggle . . . ldx #%00000100 loop txa asl $dd00 ;=> %00010000 (lower ATN) bpl *+3 eor toggle ror stx $dd00 asl $dd00 ;=> %00001000 (raise ATN) bpl *+3 eor toggle ror asl $dd00 ;=> %00010000 (lower ATN) bpl *+3 eor toggle ror stx $dd00 asl $dd00 ;=> %00001000 (raise ATN) bpl *+3 eor toggle ror sta sector,y iny bne loop