CHAPTER 7
*** Change mouse pointer to cross shape
move.l #mdata,INTIN(a5)
dc.w MHide
dc.w MTrans
move.l #mdata+ 6,INTIN(a 5)
dc.w MShow
* address of mouse data block to INTIN
* hide the pointer
* change its shape
* make mouse show unconditional
* and show the mouse pointer
*** determine x and
move.w #304,d6
move.w
#184,d7
move.w
(a5),d0
cmp.w
#4,do
beg
narrow
add d6 ,d6
narrow:
cmp
#l,d0
bne short
add d7,d7
short:
*** set up sprite move
move.w
d6,d0
asr.w #l,d0
move.w
d0,a3
move.w #l,d4
move.w d4,d5
move.w d4,a4
sprite:
move.w
a3, do
move.w a4,dl
add.w d4 , dO
beq xchange
cmp d6 ,d0
bcs no_xchange
xchange:
eori.w #$FFFE,d4
no_xchange:
add.w
d5,dl
beq ychange
cmp
d7,dl
bcs no_ychange
ychange:
eori.w #$FFFE,d5
no_ychange:
move.w d0,a3
move.w
dl,a4
move.w
#37,-(sp)
trap #14
addq.1 #2, sp
lea savebuf,a2
dc.w
Undraw
lea
savebuf,a2
lea ssave,aO
move.w
a3 ,d0
move.w
a4 ,dl
dc.w
Draw
screen limits
* right edge - pointer width
* bottom edge - pointer height
* find number of bit planes in display
* is it low-res?
* yes, keep right limit
* no, double screen width
* is it high res?
* no, keep bottom limit
* yes, double screen height
initial x position = right limit
divided by 2.
save x position
initial x increment = l
initial y increment = l
initial y position = 1
get x position
get y position
increment x position
if at left, change directions
at right edge?
no, keep going
yes, change direction
increment y position
if at top, change directions
at bottom?
no, keep going
yes, change direction
save x position
save y position
wait for end of vertical blank
* use save buffer pointer,
* erase the current sprite
* use save buffer pointer,
* use the old mouse pointer shape
* get x position
* y position
* and draw sprite in new position
*** wait for mouse button press
move.w M0USE_BT(a5),d3
btst #1,d3
beg sprite
*** When right mouse button is pressed,
*** restore mouse pointer to original shape
* check button status
* is right button down?
* no, move sprite
move.l #psave,INTIN(a5)
dc.w MHide
dc.w MTrans
dc.w MShow
* address of saved mouse data to INTIN
162