EasyManua.ls Logo

Commodore Amiga A2000 - Creating Additional Sprites

Commodore Amiga A2000
380 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
; MOVE.W INTREQR(a0),d6 ; Read interrupt request word
; AND.W #$0020,d6 ; Mask off all but vertical blank bit
; BEQ VLOOP ; Loop until bit is a 1
; MOVE.W #$0020,INTREQ(a0) ; Vertical bit is on, so reset it
;Please note that this will only work if you have turned OFF the Vertical
;blanking interrupt enable (not recommended for long periods).
ADD.B d4,d2 ; Increment horizontal value
SUBQ.B #1,d0 ; Decrement horizontal counter
BNE L1
MOVE.B #151,d0 ; Count exhausted, reset to 151
EOR.B #$FE,d4 ; Negate the increment value
L1:
MOVE.B d2,$25001 ; Write new HSTART value to sprite
ADD.B d5,d3 ; Increment vertical value
SBQ.B #1,d1 ; Decrement vertical counter
BNE L2
MOVE.B #194,d1 ; Count exhausted, reset to 194
EOR.B #$FE,d5 ; Negate the increment value
L2:
MOVE.B d3,$25000 ; Write new VSTART value to sprite
MOVE.B d3,d6 ; Must now calculate new VSTOP
ADD.B #6,d6 ; VSTOP always VSTART+6 for spaceship
MOVE.B d6,$25002 ; Write new VSTOP to sprite
BRA VLOOP ; Loop forever
CREATING ADDITIONAL SPRITES
To use additional sprites, you must create a data structure for each one and arrange the
display as shown in the previous section, naming the pointers SPR1PTH and SPR1PTL for
sprite DMA channel 1, SPR2PTH and SPR2PTL for sprite DMA channel 2, and so on.
NOTE
When you enable sprite DMA for one sprite, you enable DMA for all the sprites and place
them all in automatic mode. Thus, you do not need to repeat this step when using
additional sprite DMA channels.
Once the sprite DMA channels are enabled, all eight sprite pointers must be initialized to
either a real sprite or a safe null sprite. An uninitialized sprite could cause spurious sprite
video to appear.
Remember that some sprites can become unusable when additional DMA cycles are
allocated to displaying the screen, for example when an extra wide display or horizontal
scrolling is enabled (see Figure 6-9: DMA Time Slot Allocation).
Also, recall that each pair of sprites takes its color from different color registers, as shown
in Table 4-3.
- Sprite hardware 111 -

Table of Contents

Other manuals for Commodore Amiga A2000

Related product manuals