;license:MIT ;(c) 2021 by 4am ; !cpu 6502 !to "build/FX.INDEXED/SHR.IRIS",plain *=$A000 mirror_cols = $126 ; $A0 bytes but clobbers $20 bytes before shrlo = $201 ; $C8 bytes CoordinatesFileCopy = $2C8; $11 bytes shrhi = $301 ; $C8 bytes coords = $9F00 ; $1F40 bytes mirror_rows = $BE40 ; $C0 bytes !macro BUILD_MIRROR_COLS .mirror_cols { ; build lookup table to get $9F-y for y in $00..$9F ; X=0 } !source "src/constants.a" !source "src/macros.a" !source "src/fx/fx.shr.common.a" start ldx #$C0 ldy #$00 - tya sta mirror_cols-$21, x sta mirror_rows-1, x iny dex bne - +BUILD_SHR_LOOKUP_TABLES shrlo, shrhi ;X=0 +COPY_SCB_AND_PALETTES ;WRITEAUXMEM active +WRITE_MAIN ;X=0 - lda start, x sta $9D00, x lda start+$100, x sta $9E00, x inx bne - jmp stage2 !pseudopc *-$300 { CoordinatesFile !byte 16 !text "FX/SHR.IRIS.DATA" stage2 ldx #(stage2-CoordinatesFile) ; LOAD_FILE_AT macro destroys pathname - lda CoordinatesFile, x ; so we need to make a copy sta CoordinatesFileCopy, x dex bpl - +READ_RAM2_WRITE_RAM2 +LOAD_FILE_AT CoordinatesFileCopy, coords ;WRITEMAINMEM active after LOAD_FILE_AT macro ldx #(endzp-startzp) ; copy loop code to zero page - lda startzp-1, x sta $FF, x dex bne - +WRITE_AUX jsr InputLoop +WRITE_MAIN ldx #$00 - lda $9D00, x ; copy main code back to $A000 sta start, x ; so it can be called again if necessary lda $9E00, x sta start+$100, x inx bne - +READ_RAM1_WRITE_RAM1 startzp !pseudopc 0 { exit rts ; also terminates stage2 code InputLoop ldy #0 input ldx coords, y ; first value: SHR row (only 0..99 will be in input array) bmi exit ; if > 127 then we're done inc