home *** CD-ROM | disk | FTP | other *** search
- ;-------T-------T------------------------T----------------------------------;
- ;Random Plot
- ;-----------
- ;This is a graphical demonstration of the Random() functions. The default
- ;is to use FastRandom, but you can change it to SlowRandom if you look
- ;below.
- ;
- ;LMB exits.
-
- INCDIR "INCLUDES:"
- INCLUDE "exec/exec_lib.i"
- INCLUDE "games/games_lib.i"
- INCLUDE "games/games.i"
-
- Random = _LVOFastRandom ;_LVOFastRandom() or _LVOSlowRandom().
-
- CALL MACRO
- jsr _LVO\1(a6)
- ENDM
-
- SECTION "RandomPlot",CODE
-
- ;===========================================================================;
- ; INITIALISE DEMO
- ;===========================================================================;
-
- 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
- CALL InitJoyPorts
- 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: move.l GMS_Base(pc),a6
- lea Screen(pc),a0
- .loop moveq #JPORT1,d0
- CALL ReadMouse
- btst #MB_LMB,d0
- bne.s .done
-
- move.l GS_AmtColours(a0),d1 ;Get random colour.
- subq.l #1,d1
- jsr Random(a6) ;>> = Get random number.
- addq.l #1,d0
- move.l d0,d3 ;d3 = Colour to use.
-
- move.w GS_ScrWidth(a0),d1 ;Get random X.
- jsr Random(a6) ;>> = Get random number.
- move.w d0,d4 ;d4 = Store X to use.
-
- move.w GS_ScrHeight(a0),d1 ;Get random Y.
- jsr Random(a6) ;>> = Get random number.
- move.w d0,d2 ;d2 = Y to use.
- move.w d4,d1 ;d1 = Get back X.
-
- moveq #BUFFER1,d0
- CALL DrawUCPixel
- 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 1/2/3
- dc.l 0 ;Screen link.
- dc.l .Palette ;Address of palette.
- dc.l 0 ;Address of rasterlist.
- dc.l 32 ;Amount of colours in palette.
- dc.w 640,512 ;Screen Width, Height.
- dc.w 0,0,0 ;Picture Width, ByteWidth, Height.
- dc.w 5 ;Amount of planes
- dc.w 0,0 ;X/Y screen offsets.
- dc.w 0,0 ;X/Y picture offsets.
- dc.l 0 ;Special attributes.
- dc.w HIRES|COL12BIT|LACED ;Screen mode.
- dc.w ILBM ;Screen type
- even
-
- .Palette
- dc.w $000,$190,$FCB,$FA9,$D88,$965,$644,$211
- dc.w $406,$444,$FF0,$432,$CC0,$190,$501,$880
- dc.w $261,$271,$382,$492,$5A3,$5B4,$677,$6C4
- dc.w $788,$9AA,$BCC,$801,$901,$A02,$701,$601
-
-