EasyManua.ls Logo

Commodore Amiga A2000 - Sprite Display Example

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...
SPRITE DISPLAY EXAMPLE
This example displays the spaceship sprite at location V = 65, H = 128. Remember to
include the file "hw_examples.i", located in Appendix J.
; First, we set up a single bit-plane.
;
LEA CUSTOM,a0 ; Point a0 at custom chips
MOVE.W #$1200,BPLCON0(a0) ; 1 bit-plane color is on
MOVE.W #$0000,BPL1MOD(a0) ; Modulo = 0
MOVE.W #$0000,BPLCON1(a0) ; Horizontal scroll value = 0
MOVE.W #$0024,BPLCON2(a0) ; Sprites have priority over playfields
MOVE.W #$0038,DDFSTRT(a0) ; Set data-fetch alert
MOVE.W #$00D0,DDFSTOP(a0) ; Set data-fetch stop
; Display window definitions.
MOVE.W #$2C81,DIWSTRT(a0) ; Set display window start
; Vertical start in high byte.
; Horizontal start * 2 in low byte.
MOVE.W #$F4C1,DIWSTOP(a0) ; Set display window stop
; Vertical stop in high byte.
; Horizontal stop * 2 in low byte.
;
; Set up color registers.
;
MOVE.W #$0008,COLOR00(a0) ; Background color = dark blue
MOVE.W #$0000,COLOR01(a0) ; Foreground color = black
MOVE.W #$0FF0,COLOR17(a0) ; Color 17 = yellow
MOVE.W #$00FF,COLOR18(a0) ; Color 18 = cyan
MOVE.W #$0FOF,COLORl9(a0) ; Color 19 = magenta
;
; Move Copper list to $20000.
;
MOVE.L #$20000,a1 ; Point A1 at Copper list destination
LEA COPPERL(pc),a2 ; Point A2 at Copper list source
CLOOP:
MOVE.L (a2),(a1)+ ; Move a long word
CMP.L #$FFFFFFFE,(a2)+ ; Check for end of list
BNE CLOOP ; Loop until entire list is moved
;
; Move sprite to $25000.
;
MOVE.L #$25000,a1 ; Point A1 at sprite destination
LEA SPRITE(pc),a2 ; Point A2 at sprite source
SPRLOOP:
MOVE.L (a2),(a1)+ ; Move a long word
CMP.L #$00000000,(a2)+ ; Check for end of sprite
BNE SPRLOOP ; Loop until entire sprite is moved
;
; Now we write a dummy sprite to $30000, since all eight sprites are
; activated
; at the same time and we're only going to use one. The remaining sprites
; will point to this dummy sprite data.
;
MOVE.L #$00000000,$30000 ; Write it
;
; Point Copper at Copper list.
- 108 Sprite Hardware -

Table of Contents

Other manuals for Commodore Amiga A2000

Related product manuals