home *** CD-ROM | disk | FTP | other *** search
- ;-------T-------T------------------------T----------------------------------;
- ;Draw Pixel List (AGA)
- ;---------------------
- ;This demo demonstrates the usefulness of LISTs, by drawing a trail of
- ;pixels attached to the mouse. In the case of pixels there are special
- ;routines for drawing with lists, so the drawing is very fast.
- ;
- ;Press LMB to exit.
-
- INCDIR "INCLUDES:"
- INCLUDE "exec/exec_lib.i"
- INCLUDE "games/games_lib.i"
- INCLUDE "games/games.i"
-
- CALL MACRO
- jsr _LVO\1(a6)
- ENDM
-
- ;===========================================================================;
- ; INITIALISE DEMO
- ;===========================================================================;
-
- SECTION "DrawPixel",CODE
-
- Start: MOVEM.L A0-A6/D1-D7,-(SP)
- move.l ($4).w,a6
- lea GMS_Name(pc),a1
- moveq #$00,d0
- CALL OpenLibrary
- move.l d0,GMS_Base
- beq.s .Error_GMS
-
- move.l GMS_Base(pc),a6
- sub.l a0,a0
- CALL SetUserPrefs
-
- CALL AllocBlitter
- tst.w d0
- bne.s .Error_Blitter
-
- lea Screen(pc),a0
- CALL AddScreen
- tst.l d0
- bne.s .Error_Screen
-
- CALL ShowScreen
-
- bsr.s Main
-
- .ReturnToDOS
- move.l GMS_Base(pc),a6
- lea Screen(pc),a0
- CALL DeleteScreen
- .Error_Screen
- CALL FreeBlitter
- .Error_Blitter
- move.l GMS_Base(pc),a1
- move.l ($4).w,a6
- CALL CloseLibrary
- .Error_GMS
- MOVEM.L (SP)+,A0-A6/D1-D7
- moveq #$00,d0
- rts
-
- ;===========================================================================;
- ; MAIN LOOP
- ;===========================================================================;
-
- Main: CALL InitJoyPorts
-
- .loop lea Screen(pc),a0
- lea Mouse(pc),a2
- moveq #JPORT1,d0
- CALL ReadMouse
- btst #MB_LMB,d0
- bne.s .done
-
- move.w d0,d1
- ext.w d1
- add.w d1,2(a2)
- asr.w #8,d0
- add.w d0,(a2)
-
- .ChkLX tst.w (a2)
- bge.s .ChkRX
- clr.w (a2)
- .ChkRX cmp.w #319,(a2)
- ble.s .ChkTY
- move.w #319,(a2)
- .ChkTY tst.w 2(a2)
- bge.s .ChkBY
- clr.w 2(a2)
- .ChkBY cmp.w #255,2(a2)
- ble.s .Draw
- move.w #255,2(a2)
-
- .Draw lea MList(pc),a3 ;Shift the list up a place.
- moveq #32-1,d7
- .tloop move.l PXL_SIZEOF(a3),PXL_XCoord(a3)
- addq.w #PXL_SIZEOF,a3
- dbra d7,.tloop
-
- lea PixelList(pc),a1 ;a1 = Pixel list.
- moveq #BUFFER2,d0 ;d0 = Destination buffer.
- CALL DrawUCPixelList
-
- CALL WaitSVBL
- CALL SwapBuffers
- bra.s .loop
- .done rts
-
- ;===========================================================================;
- ; DATA
- ;===========================================================================;
-
- GMS_Name:
- dc.b "games.library",0
- even
- GMS_Base:
- dc.l 0
-
- Screen: dc.l GSV1,0 ;Structure version.
- dc.l 0,0,0 ;Screen memory pointers 1/2/3.
- dc.l 0 ;Screen link.
- dc.l .Palette ;Address of screen palette.
- dc.l 0 ;Address of rasterlist.
- dc.l 32 ;Amt of colours in palette.
- dc.w 320,256 ;Screen Width and Height.
- dc.w 320,320/8,256 ;Picture Width/8 and Height.
- dc.w 5 ;Amount of planes.
- dc.w 0,0 ;X/Y screen offset.
- dc.w 0,0 ;X/Y picture offset.
- dc.l DBLBUFFER ;Special attributes.
- dc.w LORES|COL24BIT ;Screen mode.
- dc.w INTERLEAVED ;Screen type
- even
-
- .Palette
- dc.l $000000,$101010,$202020,$303030,$404040,$505050,$606060,$707070
- dc.l $808080,$909090,$a0a0a0,$b0b0b0,$c0c0c0,$d0d0d0,$e0e0e0,$f0f0f0
- dc.l $000000,$101010,$202020,$303030,$404040,$505050,$606060,$707070
- dc.l $808080,$909090,$a0a0a0,$b0b0b0,$c0c0c0,$d0d0d0,$e0e0e0,$ffffff
-
- ;---------------------------------------------------------------------------;
-
- PixelList:
- dc.w 33,PXL_SIZEOF ;Amount of entries.
- MList: PIXEL 160,128,00 ;First pixel to draw (at back)
- PIXEL 160,128,00 ;X/Y/Colour
- PIXEL 160,128,01 ;..
- PIXEL 160,128,02 ;..
- PIXEL 160,128,03 ;..
- PIXEL 160,128,04 ;..
- PIXEL 160,128,05 ;..
- PIXEL 160,128,06 ;..
- PIXEL 160,128,07 ;..
- PIXEL 160,128,08 ;..
- PIXEL 160,128,09 ;..
- PIXEL 160,128,10 ;..
- PIXEL 160,128,11 ;..
- PIXEL 160,128,12 ;..
- PIXEL 160,128,13 ;..
- PIXEL 160,128,14 ;..
- PIXEL 160,128,15 ;..
- PIXEL 160,128,16 ;..
- PIXEL 160,128,17 ;..
- PIXEL 160,128,18 ;..
- PIXEL 160,128,19 ;..
- PIXEL 160,128,20 ;..
- PIXEL 160,128,21 ;..
- PIXEL 160,128,22 ;..
- PIXEL 160,128,23 ;..
- PIXEL 160,128,24 ;..
- PIXEL 160,128,25 ;..
- PIXEL 160,128,26 ;..
- PIXEL 160,128,27 ;..
- PIXEL 160,128,28 ;..
- PIXEL 160,128,29 ;..
- PIXEL 160,128,30 ;..
- Mouse: PIXEL 160,128,31 ;Last pixel to draw (in front)
-
-