
*
* Example listing to set-up and display a five bitplane image.
* John Kennedy, Amiga Computing, 15th March 1990.
*

* Put code and data in CHIP MEMORY!

 section fiveplaneprog,code_c

* Define the registers used

OpenLib equ -552
CloseLib equ -414
diwstrt equ $8e
diwstop equ $90
ddfstrt equ $92
ddfstop equ $94
bplcon0 equ $100
bplcon1 equ $102
bpl1pth equ $e0
bpl1ptl equ $e2
bpl2pth equ $e4
bpl2ptl equ $e6
bpl3pth equ $e8
bpl3ptl equ $ea
bpl4pth equ $ec
bpl4ptl equ $ee
bpl5pth equ $f0
bpl5ptl equ $f2

* Insert the addresses of the five bitplanes into the
* copper list.

        move.l #screen,d0
        move.w d0,pl1l
        swap d0
        move.w d0,pl1h

        move.l #screen+10240,d0
        move.w d0,pl2l
        swap d0
        move.w d0,pl2h

        move.l #screen+20480,d0
        move.w d0,pl3l
        swap d0
        move.w d0,pl3h

        move.l #screen+30720,d0
        move.w d0,pl4l
        swap d0
        move.w d0,pl4h

        move.l #screen+40960,d0
        move.w d0,pl5l
        swap d0
        move.w d0,pl5h

        move.l 4.w,a6
        lea gfxname(PC),a1
        moveq #0,d0
        jsr OpenLib(a6)
        move.l d0,a1
        move.l 38(a1),old
        move.l 4.w,a6
        jsr CloseLib(a6)

* Activate new, improved copper list

        move.l #new,$dff080

* Wait until mouse button pressed

loop:
        btst #6,$bfe001
        bne.s loop

* Put old list back

        move.l old,$dff080
        rts

* The New Copper list

new:

* Screen start/stop and other boring data

        dc.w diwstrt,$2c81
        dc.w diwstop,$2cc1
        dc.w ddfstrt,$0038
        dc.w ddfstop,$00d0
        dc.w bplcon0,$5000
        dc.w bplcon1,0

* Bitplane pointers, one for each plane. ZZzzz

        dc.w bpl1pth
pl1h:   dc.w 0

        dc.w bpl1ptl
pl1l:   dc.w 0

        dc.w bpl2pth
pl2h:   dc.w 0

        dc.w bpl2ptl
pl2l:   dc.w 0

        dc.w bpl3pth
pl3h:   dc.w 0

        dc.w bpl3ptl
pl3l:   dc.w 0

        dc.w bpl4pth
pl4h:   dc.w 0

        dc.w bpl4ptl
pl4l:   dc.w 0

        dc.w bpl5pth
pl5h:   dc.w 0

        dc.w bpl5ptl
pl5l:   dc.w 0

* End of copper list *

        dc.w $ffff,$fffe

* Somewhere to keep old copper list *

old:    dc.l 0

* Library name *

gfxname:
        dc.b "graphics.library",0

* Example screen data

screen: dcb.b 10240,240
        dcb.b 10240,85
        dcb.b 10240,255
        dcb.b 10240,170
        dcb.b 10240,129

* This is where you would put your screen data, for instance:
*
* screen: incbin "mypic.bitmap"
*
* Notice that no use is made of the extra colour data in this example.
