;license:MIT ;(c) 2017-2020 by qkumba/4am/John Brooks !cpu 6502 !to "build/FX.INDEXED/DHGR.FIZZLE2BIT",plain *=$6000 addrs = $6100 ; [256 bytes, page-aligned, duplicated in auxmem] copymasks = $6200 ; [256 bytes, page-aligned, duplicated in auxmem] !source "src/fx/macros.a" +COPY_TO_0 start, end ;X=0 ;A=3 -- ldy #$40 ; create identical copymask tables in main and aux memory ora #%10000000 - sta copymasks, x sta WRITEAUXMEM sta copymasks, x sta WRITEMAINMEM inx dey bne - asl asl bne -- clc -- ldy #$20 ; create identical address tables in main and aux memory tya - sta addrs, x sta WRITEAUXMEM sta addrs, x sta WRITEMAINMEM eor #$A0 sta addrs+1, x sta WRITEAUXMEM sta addrs+1, x sta WRITEMAINMEM eor #$A0 adc #1 inx inx dey bne - txa bne -- jmp copyaux ; exit via LFSR code on zero page start !pseudopc 0 { !byte %00000011 ;Y=0 on entry to copyaux copyaux sta READAUXMEM ; copy $4000/aux to $8000/main ldx #$20 a lda $4000, y b sta $8000, y iny bne a inc a+2 inc b+2 dex bne a sta READMAINMEM sta $C001 ; 80STORE mode ; X,Y=0 on entry to LFSR loop txa loop1 eor #$B4 ; LFSR form 0xB400 with period 65535 tax ; X is LFSR high byte, Y is LFSR low byte loop2 lda addrs, x ; which means X is the index into the base address lookup table bmi aux ; and Y is the offset from the base address sta $C054 ; switch $2000 access to main memory sta