EasyManua.ls Logo

Atari ST series - Page 169

Atari ST series
420 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...
Line A Routines
nal value afterwards). The current x and y positions of the
mouse pointer are stored in GCURX (offset — 602) and
GCURY (offset —600). The mouse button status is contained
in MOUSE
__
BT (-596). Bit 0 covers the left button status,
while bit one covers the right button. A 1 bit indicates that
the button is currently pressed.
Program 7-5 demonstrates the use of both sprites and
the mouse pointer. It copies the pointer arrow shape to a
sprite, and bounces the sprite around the screen until you
press the right mouse button. It also changes the shape of
the mouse pointer to a cross and changes it back when you
press the button.
Program 7-5. MOUSPRIT.S
* *
* MOUSPRIT.S — Demonstrates use of the line A *
* mouse pointer and sprite calls. *
* *
★ *
*** Variable table offsets
MOUSE_BT = -596 * offset for mouse button status variable
M_POS_HX = -856 * offset for start of mouse pointer sprite data
INTIN = $08
*** Function Equates
Init = $a000
MShow = $a009
MHide = $a00a
MTrans = $a00b
Undraw = $aOOc
Draw = $a00d
*** Program starts here
.text
dc.w Init * get base address of variable table
move.l a0,a5 * save base address,
* * in case other calls destroy AO
*** save old mouse pointer sprite data
*** both in sprite format, and pointer format
*** (pointers use separate data planes, sprites interleave them)
move.w
#4,dO
*
save 5 words of mouse data
lea
M_POS_HX(a5),al
*
get starting address to save
lea
psave,a2
*
start address of pointer save area
lea
ssave,a4
*
& start address of sprite save area
savhead:
move.w
(al),(a4)+
*
move 5 word header to both buffers
move.w
(al)+,(a2)+
*
(header is same for sprites & pointers)
dbra do,savhead
move.w #15,dO
dbra
psave+42,a3
lea
savdata:
move (al),(a4)+
move.w (al)+,(a2)+
move.w (al),(a4)+
move.w (al)+,(a3)+
dO,savdata
* save 32 words of mouse data
* even words in sprite format
* even words in pointer format
* odd words in sprite format
* odd words in pointer format
161

Related product manuals