;-------------------------------------------------------------------------- MACHINE 68020 ; My start up. Should be compatible with Morbid's. ; Just so I dont have to reboot if it hangs :-) SECTION Start,CODE Start LEA DB,A5 MOVE.W #4,A6 ; AbsExecBase MOVE.L (A6),A6 MOVE.L $114(A6),A2 ; ThisTask MOVE.L A2,Process-DB(A5) TST.L $AC(A2) ; pr_CLI BNE.B 1$ LEA $5C(A2),A0 ; pr_MsgPort JSR -$180(A6) ; WaitPort LEA $5C(A2),A0 ; pr_MsgPort JSR -$174(A6) ; GetMsg MOVE.L D0,WBMessage-DB(A5) 1$ MOVE.L A6,ExecBase-DB(A5) MOVEQ #0,D0 LEA GfxName(PC),A1 JSR -$228(A6) ; OpenLibrary MOVE.L D0,GfxBase-DB(A5) BEQ 6$ MOVEQ #0,D0 LEA IntuiName(PC),A1 JSR -$228(A6) ; OpenLibrary MOVE.L D0,IntuiBase-DB(A5) BEQ 5$ MOVEQ #-1,D0 MOVE.L Process-DB(A5),A1 JSR -$12C(A6) ; SetTaskPri MOVE.L D0,OldPri-DB(A5) LEA NewScreen(PC),A0 MOVE.L IntuiBase-DB(A5),A6 JSR -$C6(A6) ; OpenScreen MOVE.L D0,Screen-DB(A5) BEQ.B 4$ MOVE.L D0,A1 MOVE.L $58(A1),A0 ; sc_Rastport.rp_BitMap MOVE.L 8(A0),Plane-DB(A5) ; bm_Planes LEA NewWindow(PC),A0 MOVE.L A1,$1E(A0) ; nw_Screen JSR -$CC(A6) ; OpenWindow MOVE.L D0,Window-DB(A5) BEQ.B 3$ JSR Starfield_init 2$ MOVE.L GfxBase-DB(A5),A6 JSR -$10E(A6) ; WaitTOF MOVE.L Plane-DB(A5),A0 JSR Starfield MOVE.L Window-DB(A5),A0 MOVE.L $56(A0),A0 ; wd_UserPort MOVE.L ExecBase-DB(A5),A6 JSR -$174(A6) ; GetMsg TST.L D0 BEQ.B 2$ MOVE.L D0,A1 JSR -$17A(A6) ; ReplyMsg MOVE.L Window-DB(A5),A0 MOVE.L IntuiBase-DB(A5),A6 JSR -$48(A6) ; CloseWindow 3$ MOVE.L Screen-DB(A5),A0 JSR -$42(A6) ; CloseScreen 4$ MOVE.L OldPri-DB(A5),D0 MOVE.L Process-DB(A5),A1 MOVE.L ExecBase-DB(A5),A6 JSR -$12C(A6) ; SetTaskPri MOVE.L IntuiBase-DB(A5),A1 JSR -$19E(A6) ; CloseLibrary 5$ MOVE.L GfxBase-DB(A5),A1 JSR -$19E(A6) ; CloseLibrary 6$ MOVE.L WBMessage-DB(A5),D2 BEQ.B 7$ JSR -$84(A6) ; Forbid MOVE.L D2,A1 JSR -$17A(A6) ; ReplyMsg 7$ MOVEQ #0,D0 RTS NewScreen: DC.W 0 ; LeftEdge DC.W 0 ; TopEdge DC.W 320 ; Width DC.W 256 ; Height DC.W 1 ; Depth DC.B 0,1 ; DetailPen,BlockPen DC.W 0 ; ViewModes DC.W $400F ; Type = AUTOSCROLL!CUSTOMSCREEN DC.L 0 ; Font DC.L Name ; DefaultTitle DC.L 0 ; Gadgets DC.L 0 ; CustomBitMap NewWindow: DC.W 0 ; LeftEdge DC.W 0 ; TopEdge DC.W 320 ; Width DC.W 256 ; Height DC.B 0,0 ; DetailPen,BlockPen DC.L 8 ; IDCMPFlags = MOUSEBUTTONS DC.L $31940 ; Flags = NOCAREREFRESH!RMBTRAP!ACTIVATE!BORDERLESS!BACKDROP!SIMPLEREFRESH DC.L 0 ; FirstGadget DC.L 0 ; CheckMark DC.L 0 ; Title DC.L 0 ; Screen DC.L 0 ; Bitmap DC.W 0,0,0,0 ; MinWidth,MinHeight,MaxWidth,MaxHeight DC.W 15 ; Type = CUSTOMSCREEN GfxName DC.B "graphics.library",0 IntuiName DC.B "intuition.library",0 Name DC.B "#AmyCoders - Starfield - By Dave",0 SECTION Vars,BSS DB Process DS.L 1 WBMessage DS.L 1 ExecBase DS.L 1 GfxBase DS.L 1 IntuiBase DS.L 1 OldPri DS.L 1 Screen DS.L 1 Window DS.L 1 Plane DS.L 1 ;-------------------------------------------------------------------------- ; The starfield code. 86 bytes non double buffer! 78 bytes double buffer! SECTION Competition,CODE DOUBLEBUFFER EQU 0 ; Set to 1 for morbids code NUMSTARS EQU 512 STARSPEED EQU 5 Starfield_init: MOVEQ #0,D7 ; Random number seed RTS ; Entry: A0-Plane Starfield: LEA Array,A1 ; Star data MOVE.W #320,D6 ; A handy constant MOVE.W #NUMSTARS-1,D0 ; Number of stars 1$ SUBQ.W #STARSPEED,(A1) ; Z pos MOVEM.W (A1)+,D1-D3 ; Z pos, X, Y pos BLE.B 2$ DIVS.W D1,D2 DIVS.W D1,D3 ADD.W #160,D2 ; X origin ADD.W #128,D3 ; Y origin CMP.W D6,D2 BCC.B 2$ ; Make a new star if it went off horizontal CMP.W #256,D3 BCC.B 2$ ; Make a new star if it went off vertical MULU.W D6,D3 EXT.L D2 ADD.L D3,D2 IFEQ DOUBLEBUFFER MOVE.L (A1),D3 MOVE.L D2,(A1)+ BFCHG (A0){D2:1} ; Plot the star BFCHG (A0){D3:1} ; Remove the old one ENDC IFNE DOUBLEBUFFER BFSET (A0){D2:1} ; Plot the star ENDC DBF D0,1$ RTS 2$ MOVE.L D7,D1 ; Generate a random number ROL.L #5,D7 SUB.L D1,D7 ADDQ.L #1,D7 MOVE.L D7,-(A1) ; New X,Y pos MOVE.W D6,-(A1) ; New Z pos BRA.B 1$ SECTION Array,BSS Array: DS.W NUMSTARS*3 IFEQ DOUBLEBUFFER DS.L NUMSTARS ENDC .