
AbsExecBase:  equ  4   ; the only absolute address !
Level3Int:  equ  $6c
ScrPlane:  equ  $40000  ; $35000
SndBuffer:  equ  $45000
BPlane1:  equ  SndBuffer+MaxSndLen ; BPLANE MUST LAST DATA SEGMENT
BPlane2:  equ  BPlane1+3440 ; 3440 = 80Bytes ; 43rows
PField1:  equ  BPlane2+4000
MusicBuffer: equ  PField1+7000

; AMIGA Hardware Addresses
JOY0DAT:   equ  $dff00a
INTREQR:   equ  $dff01e  ; Interrupt request read
DMACON:   equ  $dff096
INTENA:   equ  $dff09a
INTREQ:   equ  $dff09c
AUD0LC:   equ  $dff0a0
AUD0LEN:   equ  $dff0a4
AUD0PER:   equ  $dff0a6
AUD0VOL:   equ  $dff0a8
AUD1LC:   equ  $dff0b0
AUD1LEN:   equ  $dff0b4
AUD1PER:   equ  $dff0b6
AUD1VOL:   equ  $dff0b8

; Exec Library Vector Offsets
Alert:   equ  -108
Permit:   equ  -138
Forbid:  equ  -132
OpenLibrary:  equ  -408
CloseLibrary: equ  -414

; Graphics Library Vector Offsets
Text:   equ  -60
SetFont:   equ  -66
CloseFont:  equ  -78
InitRastPort: equ  -198
InitBitMap:  equ  -390
SetDrMd:   equ  -354
SetAPen:   equ  -342
MovePen:   equ  -240

;  CODE
;
; setup the new copper list (will be performed in next VBlank)
;
   move.l AbsExecBase,a6
   jsr  Forbid(a6)   ; stop multitasking

   move.l GfxBase,a0
   add.l #$32,a0    ; point to LOFlist in GfxBase

   move.w #$0080,DMACON  ; stop Copper DMA
   move.l (a0),OldCopper  ; pointer to old copper list
   move.l #CopList,(a0)  ; my own Coppers..
   move.w #$8080,DMACON  ; 
;
;  Blitter tests
;
mvrt:
   move.b $bfe001,d0   ; wait until mouse button
   and.l #$40,d0
   bne  mvrt  
;
;  reset all resources used!
;
   move.l GfxBase,a0
   add.l #$32,a0    ; point to LOFlist in GfxBase

   move.w #$0080,DMACON  ; stop Copper and Sound
   move.l OldCopper,(a0)  ; restore pointer
   move.w #$8080,DMACON  ; start again ...

   move.l AbsExecBase,a6
   jsr  Permit(a6)   ; restart multitasking
;
;  Ready to give system back
;
   move.l GfxBase,a1
   jsr  CloseLibrary(a6)
   move.l initialSP,sp
   clr.l d0     ; E.T. phone home!!
   ILLEGAL
   rts
;
;  Display System ALERT
;
NoGfx:  move.l #$30000!$8002,d7 ; AG_OpenLib!AO_GfxLib
DoAlert: jsr  Alert(a6)
   move.l initialSP,sp
   rts       ; try to escape (without hope!)

GfxName: DC.B 'graphics.library',0
   even

;  -------------------------------------
;  DISPLAY COPROCCESSOR INSTRUCTION LIST
;  -------------------------------------
;
CopList:
  DC.W $008e,$2c81    ; DIW Start (3781)
  DC.W $0090,$f4c1    ; DIW Stop (f6d1)
  DC.W $0092,$38  ; DDF Start FETCH 22 WORDS ($28)
  DC.W $0094,$d0  ; DDF Stop ($d8)
  DC.W $00e0,BPlane1/$10000,$00e2
LP1: DC.W [BPlane1&$ffff]
  DC.W $0108,00  ; modulo odd planes (34)
  DC.W $0100,$1200  ; 1 BitPlanes
  DC.W $0102,$0000
  DC.W $0180,$000  ; Background color
  DC.W $0182,$f00

  DC.W $0120,$000 
  DC.W $0122,$000  
;
; End of Copper List
;
  DC.W $ffff,$fffe

  DATA
GfxBase: blk.l 1,0
initialSP: blk.l 1,0
OldCopper: blk.l 1,0
