As the title says, I successfully used the blitter to display some sprites on screen without preshifting.
When the same program is run on the Falcon (a user of a real one kindly reported this problem, and I could reproduce on Hatari) it looks like the blitter does not shift the data according to the skew register byte at $ffff893d.
Interestingly, it seems to happen to sprites that are less than 16 pixels in width. I have a big sprite (a width of 64px) that is correctly shifted.
Do someone knows about this behaviour, and how to fix my code to make it work ?
Here is the relevant part of my code ("devpac-ish" assembly, I use vasm and hatari on linux)
Code: Select all
;
BlitterBase equ $ffff8a00
BlitterMiscReg1 equ $ffff8a3c
;
DoBlitAndWait macro
or.b #$80,BlitterMiscReg1.w
.waitFinish\@ bset.b #7,BlitterMiscReg1.w
nop
bne.s .waitFinish\@
endm
;
DoBlitBall macro
; - 1 address to the sprite data
; - 2 address to the start of memory screen to update
; - 3 shift to the right
; - 4 spare address register
; - 5 spare address register
; - 6 spare data register
; --
; \4 := blitter base
move.l #BlitterBase,\4
; -- Setup Source
; \5 := base + $20
lea $20(\4),\5
move.w #8,(\5)+ ; source x increment
move.w #0,(\5)+ ; source y increment
move.l \1,(\5)+ ; source address
; -- setup masks
; \6 := $f0000000 >> \3 = [endmask 1|endmask3]
move.l #$f0000000,\6
lsr.l \3,\6
; swap to put endmask1, swap again to put endmask3
swap \6
move.w \6,(\5)+
move.w #$ffff,(\5)+
swap \6
move.w \6,(\5)+
; -- setup Dest
move.w #8,(\5)+
move.w #152,(\5)+ ; 160 bytes - 1 * 8
move.l \2,(\5)+
; -- setup x/y counts
move.w #2,(\5)+
move.w #4,(\5)+
; -- Hop/op values
move.w #$0203,(\5)+ ; HOP = 2 (source), OP = 3 (source)
; -- set skew/shift registers
addq.l #1,\5
move.b \3,(\5)
; -- do the blit
DoBlitAndWait
endm
;
; -- use the blitter to display the ball
; -- a3 : start of the data of the ball
; -- a2 : start of the memory screen to update
; -- d1 : shift to do
; -- a1, a0, d0 : spare register.
ExecShowBall DoBlitBall a3,a2,d1,a1,a0,d0
addq.l #2,a3
addq.l #2,a2
DoBlitBall a3,a2,d1,a1,a0,d0
addq.l #2,a3
addq.l #2,a2
DoBlitBall a3,a2,d1,a1,a0,d0
addq.l #2,a3
addq.l #2,a2
DoBlitBall a3,a2,d1,a1,a0,d0
rts
;
; -- inside the display routine...
_Supexec #ExecShowBall ; call xbios(38)