The following code is the 'correct' version of what you tried to do.
I would never write it like this, too many important parts are missing
For the old farts, don't look at me badly, I just got the code and "fixed" it
Code:
_LVODisable equ -120
_LVOEnable equ -126
_LVOOldOpenLibrary equ -408
_LVOCloseLibrary equ -414
_LVOWaitTOF equ -270
SECTION code,CODE_C
lea $dff000,a2
move.l $4.w,a6 ; Open graphics.library.
lea graphics_lib(pc),a1
jsr _LVOOldOpenLibrary(a6)
move.l d0,a5 ; graphics.library handle stored in a5.
jsr _LVODisable(a6)
lea copperlist(pc),a0
move.l a0,$80(a2)
move.w #$8000,d0
or.w 2(a2),d0 ; Old DMA flags in d0.
move.w #$7fff,$96(a2)
move.w #$8380,$96(a2)
WaitForLMB:
btst #6,$bfe001
bne.b WaitForLMB
Exit: move.w #$7fff,$96(a2)
move.l 38(a5),$80(a2) ; Restore old Copper settings.
move.w d0,$96(a2) ; Restore old DMA flags.
jsr _LVOEnable(a6)
move.l a5,a1
jsr _LVOCloseLibrary(a6)
moveq #0,d0 ; Exit.
rts
graphics_lib: dc.b "graphics.library",0
even
copperlist:
dc.w $e0,$0007
dc.w $e2,$c080
dc.w $e4,$0007
dc.w $e6,$dfc0
dc.w $108,$0000
dc.w $10a,$0000
dc.w $100,$2200
dc.w $102,$0000
dc.w $104,$0010
dc.w $8e,$2c81
dc.w $90,$2cc1
dc.w $92,$0038
dc.w $94,$00d0
dc.w $180,$0000
dc.w $182,$0080
dc.w $184,$00f0
dc.w $186,$0fff
dc.w $ffff,$fffe