So I started with a program that displays the following image:

I added an IRQ, which triggers at scanline 120, containing the following code:

Code: Select all

```
COW:
LDA #$00
STA $2001 ;Disable rendering
LDA $2002
LDA #$3F
STA $2006
LDA #$00
STA $2006
LDA #$16
STA $2007 ;Change Main Background color
LDA #%00011110 ;Enable sprites, Enable backgrounds
STA $2001
LDA #$01
STA $E000 ;Disable IRQ
RTI
```

Code: Select all

```
LDA $2002
LDA #$3F
STA $2006
LDA #$00
STA $2006
LDA #$21
STA $2007
```

Now, I knew there were going to be problems. And it turns out that writing to $2006 messes with the scroll register. So I changed the IRQ code a bit and wrote to $2005, hoping to move the screen to where it should be:

Code: Select all

```
COW:
LDA #$00
STA $2001 ;Disable rendering
LDA $2002
LDA #$3F
STA $2006
LDA #$00
STA $2006
LDA #$16
STA $2007 ;Change Main Background color
LDA #%00011110 ;Enable sprites, Enable backgrounds
STA $2001
LDA #$00
STA $2005
LDA #$78 ;Set Y Scroll position to 120
STA $2005
LDA #$01
STA $E000 ;Disable IRQ
RTI
```

Code: Select all

```
LDA #%00011110 ;Enable sprites, Enable backgrounds
STA $2001
LDA #$00
STA $2006
STA $2006
```

I decided to see what would happen if I put in a higher value on the second write to $2006

Code: Select all

```
LDA #%00011110 ;Enable sprites, Enable backgrounds
STA $2001
LDA #$00
STA $2006
LDA #$78
STA $2006
```

So, can somebody tell me what is the right way to go about this? How do I fix these problems?

Thanks!