Newsgroups: alt.sys.amiga.demos
From: comradej@althera.demon.co.uk (comradej)
Subject: Source Code
Date: Fri, 1 Jan 1993 12:16:21 +0000

R:930101/1216z 3037@demon.co.uk

Seeing as amiga.physik.unizh.ch is unavailable at the moment, here
is some working 68000 setup code for all you coders... Read
howtocode3.txt for more information (howtocode4.txt coming soon....)

*
* Startup.asm  - A working tested version of startup from Howtocode3.txt
*
* CJ - 31/12/92 (Happy new year) [comradej@althera.demon.co.uk]
*
* This code sets up one of two copperlists (one for PAL and one for NTSC)
* machines. It shows something to celebrate 3(?) years since the Berlin
* wall came down :-) Press left mouse button to return to normality.
* Tested on Amiga 3000 (ECS/V39 Kickstart) and Amiga 1200 (AGA/V39)
* Read Howtocode3.txt for information on this source!
*


                opt	l-                      ; auto link

                section mycode,code            ; need not be in chipram

		incdir "include:"
                include "exec/types.i"
                include "exec/funcdef.i"       ; keep code simple and
                include "exec/exec_lib.i"      ; easy to read - use
                include "graphics/gfxbase.i"   ; the includes!
                include "graphics/graphics_lib.i"

                include "misc/easystart.i"     ; Allows startup from
                                               ; icon


StartCopper:
                move.l  4.w,a6          ; get ExecBase
		lea	gfxname,a1	; graphics name
                moveq	#0,d0		; any version
		jsr	_LVOOpenLibrary(a6)
		tst.l	d0
		beq     End     	; failed to open? Then quit
		move.l  d0,gfxbase
		move.l	d0,a6
		move.l  gb_ActiView(a6),wbview
					; store current view address
                                        ; gb_ActiView = 32

                move.w	#0,a1		; clears full long-word
		jsr 	_LVOLoadView(a6) ; Flush View to nothing
                jsr	_LVOWaitTOF(a6) ; Wait once
		jsr	_LVOWaitTOF(a6) ; Wait again.

        	move.w	$dff07c,d0
		cmp.b	#$f8,d0
		bne.s	.notaga

		move.w  #0,$dff1fc	; reset sprites (fix V39 bug)

notaga
                			; Now you can hit the copper!
		move.l	4.w,a6
                jsr	_LVOForbid(a6)  ; Suspend multitasking!


                cmp.b	#50,VBlankFrequency(a6) ; Am I *running* PAL?
		bne.s	.ntsc

		move.l	#mycopper,$dff080 	; bang it straight in.
                bra.s	.lp

ntsc   	move.l	#mycopperntsc,$dff080


lp     	btst	#6,$bfe001
        	bne.s	.lp


CloseDown:	move.l	4.w,a6
        	jsr	_LVOPermit(a6)	 ; Enable multitasking

		move.l	wbview,a1
		move.l	gfxbase,a6
		jsr	_LVOLoadView(a6) ; Fix view

		move.l	gb_copinit(a6),$dff080	 ; Kick it into life
                                      		 ; copinit = 36
		move.l	a6,a1
        	move.l	4.w,a6
		jsr	_LVOCloseLibrary(a6) ; EVERYONE FORGETS THIS!!!!

End:		rts

		section mydata,data_c	; keep data & code seperate!

mycopper        dc.w    $100,$0200	; otherwise no display!
                dc.w	$180,$00
                dc.w    $8107,$fffe     ; wait for $8107,$fffe
                dc.w    $180,$f00       ; background red
		dc.w	$d607,$fffe	; wait for $d607,$fffe
		dc.w	$180,$ff0       ; background yellow
                dc.w    $ffff,$fffe
                dc.w    $ffff,$fffe     ; Copper end

mycopperntsc    dc.w    $100,$0200	; otherwise no display!
                dc.w	$180,$00
                dc.w    $6e07,$fffe     ; wait for $6e07,$fffe
                dc.w    $180,$f00       ; background red
		dc.w	$b007,$fffe	; wait for $b007,$fffe
		dc.w	$180,$ff0       ; background yellow
                dc.w    $ffff,$fffe
                dc.w    $ffff,$fffe     ; Copper end 


wbview  	dc.l    0
gfxbase 	dc.l	0
gfxname 	dc.b    "graphics.library",0



CJ
+------------------------------------------------------------------+
| comradej@althera.demon.co.uk                                     |
+------------------------------------------------------------------+
| Comrade J of Share and Enjoy (Retired). Ex-Demo Hacker and 68000 |
| maniac. Author of Amazing Tunes I, Amazing Tunes II and Amazing  |
| Tunes CDTV, the first Amiga CD-ROM demo ever with 1000 modules!  |
+------------------------------------------------------------------+
| ps. No. I don't want to join your group.                         |
+------------------------------------------------------------------+

Newsgroups: alt.sys.amiga.demos