All Right.

I have one tile line (ie, 8 pixels from a tile) in 2 registers (for example, R1 and R2), and I want to put them in FrameBuffer (the address where I want to put them is, let's say, in R8).

This is needed if I intend to do some scrolling.

Here's how I can do, depending on the addresse modulo :

Modulo 0
Code: Select all

```
R1 0123
R2 4567
R8 0123
R9 4567
ADD #8,R8
MOV.L R2,@-R8
MOV.L R1,@R8 ; 3 cycles (2 Writes)
```

Modulo 1
Code: Select all

```
R1 0123
R2 4567
R8 X012
R9 3456
R10 7XXX
ADD #8,R8
MOV.B R2,@R8 ; R10 = 7XXX
SHLR8 R2 ; R2 = -456
MOV.L R2,@-R8 ; R9 = -456
MOV.B R1,@R8 ; R9 = 3456
SHLR8 R1 ; R1 = -012
MOV.W R1,@-R8 ; R8 = XX12
SHLR16 R1 ; R1 = ---0
MOV.B R1,@-R8 ; R8 = X012 9 cycles (5 Write)
```

Modulo 2
Code: Select all

```
R1 0123
R2 4567
R8 XX01
R9 2345
R10 67XX
ADD #8,R8
MOV.W R2,@R8 ; R10 = 67XX
XTRCT R1,R2 ; R2 = 2345
MOV.L R2,@-R8 ; R9 = 2345
SHLR16 R1 ; R1 = --01
MOV.W R1,@-R8 ; R8 = XX01 6 cycles (3 Write)
```

Modulo 3 (this one is a bitch)

Code: Select all

```
R1 0123
R2 4567
R8 XXX0
R9 1234
R10 567X
ADD #10,R8
MOV.B R2,@R8 ; R10 = XX7X
SHLR8 R2 ; R2 = -456
MOV.W R2,@-R8 ; R10 = 567X
SHLR16 R2 ; R2 = ---4
MOV.B R2,@-R8 ; R9 = XXX4
MOV.B R1,@-R8 ; R9 = XX34
SHLR8 R1 ; R1 = -012
MOV.W R1,@-R8 ; R9 = 1234
SHLR16 R1 ; R1 = ---0
MOV.B R1,@-R8 ; R8 = XXX0 11 cycles (6 Write)
```

for modulo between 4 and 7, we just got to change the first offset.

We here have ~70k CPU cycles and ~40k FB access.