Here's an example. You can't assemble it in ASM-One directly but it's short enough to get the jist of:
Code:
include customregisters.i
include macros.i
;-------------------------------------------------------------------------------
section code_p
Start moveq #-1, d0
moveq #-1, d1
moveq #0, d2
moveq #2, d3
jsr SetSystem
tst.b d4
beq .exit
bsr MousepointerTest
jsr RestoreSystem
.exit moveq #0, d0
rts
;-------------------------------------------------------------------------------
MousepointerTest lea $dff000, a6
bsr Setup
; Read the initial counter values to prevent the pointer
; from blinking around when we start
move.w joy0dat(a6), Mousecounters
.mainloop WaitFrame
bsr GetMousepos
bsr SetSpritepos
btst #6, $bfe001
bne .mainloop
rts
; This routine keeps track of the mouse counter values and uses them to
; to calculate how much the pointer has moved each image frame.
; We think of the screen as 1280*1024 units in order to get some precision, and
; divide these coordinates by 4 to obtain the pointer's position in screen
; pixel coordinates
GetMousepos ; Get the previous counter values and store the new ones
move.w Mousecounters(pc), d2
move.w joy0dat(a6), d1
move.w d1, Mousecounters
; Calculate X counter difference
move.b d1, d0
sub.b d2, d0
ext.w d0
; Calculate new X position and clamp against screen edges
add.w .mousepos(pc), d0
bpl .xok
moveq #0, d0
.xok cmp.w #319*4 + 3, d0
bls .calcy
move.w #319*4 + 3, d0
; Calculate Y difference
.calcy clr.b d2
sub.w d2, d1
asr.w #8, d1
; Calculate new Y position
add.w .mousepos+2(pc), d1
bpl .yok
moveq #0, d1
.yok cmp.w #255*4 + 3, d1
bls .posok
move.w #255*4 + 3, d1
.posok ; Store the new values and return pixel coordinates in D0-D1
movem.w d0-d1, .mousepos
lsr.w #2, d0
lsr.w #2, d1
rts
.mousepos dc.w 500, 500
Mousecounters dc.w 0
; Take pixel coordinates in D0-D1 and place sprite
SetSpritepos ; X 128 Y 44 will be the upper left corner in sprite
; coordinates. They correspond to the coordinates used for
; the display window minus 1 pixel in X
add.w #$80, d0
add.w #$2c, d1
; Get bit 0 of the X position and place in D2
moveq #0, d2
lsr.w #1, d0
addx.b d2, d2
; Check bit 8 of the Y start position and set in D2
btst #8, d1
beq .novstart
addq.b #4, d2
.novstart move.b d1, Sprite
; Add sprite height to get Y stop position and set in D2
addq.w #8, d1
btst #8, d1
beq .novstop
addq.b #2, d2
.novstop ; Write POS and CTL into sprite data
move.b d0, Sprite+1
move.b d1, Sprite+2
move.b d2, Sprite+3
rts
Setup move.w #bpl_1bpl | bpl_color, bplcon0(a6)
; Set video priorities to 7 so sprites appear in front of
; bitplanes
move.w #7<<3 | 7, bplcon2(a6)
; 320*256 large display starting at X $81 Y $2C
move.w #0, bplcon1(a6)
move.w #0, bpl1mod(a6)
move.w #$38, ddfstrt(a6)
move.w #$d0, ddfstop(a6)
move.w #$2c81, diwstrt(a6)
move.w #$2cc1, diwstop(a6)
move.w #$89a, color00(a6)
move.w #$eef, color01(a6)
move.w #$000, color17(a6)
move.w #$e48, color18(a6)
move.w #$fcd, color19(a6)
; Write the bitplane pointer into the copper program
move.l #Bitplane, d0
move.w d0, Bitplaneptr+4
swap d0
move.w d0, Bitplaneptr
; and the sprite pointers
lea .sprites(pc), a0
lea Spriteptrs, a1
moveq #8-1, d0
.setsprites move.w (a0)+, (a1)
move.w (a0)+, 4(a1)
addq.w #8, a1
dbf d0, .setsprites
; Set copper program pointer and load immediately
move.l #Copperprog, cop1lc(a6)
move.w d0, copjmp1(a6)
; Start all DMA
move.w #dma_set | dma_en | dma_bpl | dma_spr | dma_cop, dmacon(a6)
rts
.sprites dc.l Sprite
rept 7
dc.l BlankSprite
endr
;-------------------------------------------------------------------------------
section data_c
; Bitplane data for a 320*256 frame
Bitplane blk.b 40, %11111111
rept 254
dc.b %10000000
blk.b 38, %00000000
dc.b %00000001
endr
blk.b 40, %11111111
; 8*8 pixel sprite. The first two words are the POS and CTL
; control words which the sprite DMA will read and
; set automatically every frame, so are the last two words
; which we set to 0 to mark that the sprite is not to be
; redisplayed again further down the screen.
Sprite dc.w 0, 0
dc.w %1111111000000000, %0000000000000000
dc.w %1100000100000000, %0111111000000000
dc.w %1000000100000000, %0111111000000000
dc.w %1000001000000000, %0111110000000000
dc.w %1000010000000000, %0111100000000000
dc.w %1000100000000000, %0111000000000000
dc.w %1001000000000000, %0110000000000000
dc.w %0110000000000000, %0000000000000000
BlankSprite dc.w 0, 0
; We don't need to use the copper to display some sprites
; but it's convenient to delegate f.ex reseting bitplane
; and sprite pointers to it
Copperprog
Bitplaneptr = *+2 cmove 0, bpl1pth, 0, bpl1ptl
Spriteptrs = *+2 cmove 0, spr0pth, 0, spr0ptl
cmove 0, spr1pth, 0, spr1ptl
cmove 0, spr2pth, 0, spr2ptl
cmove 0, spr3pth, 0, spr3ptl
cmove 0, spr4pth, 0, spr4ptl
cmove 0, spr5pth, 0, spr5ptl
cmove 0, spr6pth, 0, spr6ptl
cmove 0, spr7pth, 0, spr7ptl
cend