; Assemble this programm using the devpac assembler.
; This source might me a bit to difficult for beginners.
; Some parts were copied directly out of kickstart 1.2
; so that they will have less comments.
; I hope you enjoy this source 
; Programming done by SPY of SENSOR 

Main
	       MOVEA.L   $4,A6		;execbase in a6
               MOVEA.L   300(A6),A2	;^ resident modules
Find
               MOVE.L    (A2)+,D0	;find first free one
               BEQ.S     Found
               BGT.S     IetsGevonden	;this one containes something
               BCLR.L    #31,D0		;clear signbit 
               MOVEA.L   D0,A2			
               BRA.S     Find		;get pointer on next one 
IetsGevonden	
               MOVEA.L   D0,A1	
               LEA.L     StrapName(PC),A0  ;^ strapname 
               MOVEA.L   14(A1),A1	   ;name of resident prog 
Same	
               CMPM.B    (A0)+,(A1)+	;is it the strap routine
               BNE.S     Find		;no ?  continue the search
               TST.B     -1(A0)		;did i reach the end of the name
               BNE.S     Same 		;no ? continue comparing
               MOVEA.L   D0,A1		;adres in a0
               LEA.L     Message(PC),A0	;^ our message 
               MOVEA.L   18(A1),A1	;^ current message 
Vergelijk2	
               CMPM.B    (A0)+,(A1)+	;is it ours ?
               BNE.S     Find		;no continue search
               TST.B     -1(A0)		;did i reach the end of the message
               BNE.S     Vergelijk2	;no ? keep on comparing
               LEA.L     Message(PC),A2	;if it is our message
               BRA       ExitIt		;display it and exit
Found
               MOVE.L    #Einde-Structure,D0	;make our strap resident
               ADDI.L    #EindeStrap-Einde,D0	;first calculate length
               MOVE.L    #$00010000,D1		;chip memory
               JSR       -198(A6)		;Allocate memory
               TST.L     D0			;something wrong ?
               BNE       AllocOk		;no
               LEA.L     NoMemory(PC),A2	;yes give warning and exit
               BRA       ExitIt	
AllocOk	
               MOVE.L    D0,D1			;address of allocated memory
               MOVEA.L   D0,A1		
               LEA.L     Structure(PC),A0	;address structure 
               MOVE.L    #Einde-Structure,D0	;length 
               LSR.L     #2,D0			;/4 :  bytes/4=longwords
               SUBQ.W    #1,D0		
Copier1
               MOVE.L    (A0)+,(A1)+		; copy our structure
               DBF       D0,Copier1		; 
               MOVEA.L   A1,A2			; save address

               MOVE.L    #EindeStrap-Einde,D0	;our strap
Copier2
               MOVE.L    (A0)+,(A1)+		;copy 
               DBF       D0,Copier2

               MOVE.L    D1,D2			  ;address of alloced mem
               ADDI.L    #StrapName-Structure,D2  ; ^ strapnaam
               MOVE.L    D1,D3			  ;address in d3
               ADDI.L    #Message-Structure,D3	  ; ^ message
               MOVE.L    D1,D4			  ;address in d4
               ADDI.L    #Structure2-Structure,D4 ; ^structure2
               MOVE.L    A2,D5			  ;address second part
               ADDI.L    #StrapBegin-DName,D5	  ;^start own strap
               MOVEA.L   D1,A0			  ;address alloced mem

					;init structure
               MOVE.L    D1,2(A0)	;   ^Begin
               MOVE.L    A1,6(A0)	;   ^End
               MOVE.L    D2,14(A0)	;   ^Name  (strap)
               MOVE.L    D3,18(A0)	;   ^Message
               MOVE.L    D5,22(A0)	;   ^Begin own strap
               MOVEA.L   D4,A0		;^structure2
					;init structure2
               MOVE.L    D3,10(A0)	;   ^Message
               MOVE.L    D1,16(A0)	;   ^Begin
               SUBA.L    D1,A1		;End - Begin = Length
               MOVE.L    A1,20(A0)	;   Length in structure   	
               MOVE.L    D1,24(A0)	;   ^Begin
               MOVE.L    546(A6),D0	;KickMemPointer
               TST.L     D0		;is it zero ?
               BEQ       MakeRes	;yes maak programm resident
               MOVE.L    D0,(A0)	;   ^next resident prg
MakeRes
               MOVE.L    A0,546(A6)	;^resident structuur
               MOVE.L    550(A6),D0	;KickTagPointer
               TST.L     D0		; is it zero ?
               BEQ       ResOk		
               BSET.L    #31,D0		; set sign bit
               MOVE.L    D0,28(A0)	; put it in structuur
ResOk
               MOVE.L    A0,550(A6)	     ;^structuur in KickTagPointer
               ADDI.L    #$00000018,550(A6)  ;+24 = ^Begin Prg
               JSR       -612(A6)	     ;calculate checksum
               MOVE.L    D0,554(A6)	     ;put it in KickCheckSum
               ADDQ.B    #1,295(A6)	     ;task counter

 
               LEA.L     $00DFF000,A4	; prepare for reset
               MOVE.W    #32767,D0	;$7fff
               MOVE.W    D0,154(A4)
               MOVE.W    D0,156(A4)
               MOVE.W    D0,150(A4)
               JSR       -150(A6)	;go to SuperState
               JMP       $00FC00D2	;Reset
ExitIt
               LEA.L     DosName(PC),A1	;^ dosname
               MOVEQ.L   #33,D0		;version
               JSR       -552(A6)	;open dos library
               TST.L     D0
               BEQ       DosError	
               MOVEA.L   D0,A6		;dosbase in a6
               JSR       -60(A6)	;current ouput  (screen)
               MOVE.L    D0,D1		
               MOVE.L    A2,D2		;^text in d2
ZoekEinde
               TST.B     (A2)+		;find end of text
               BNE.S     ZoekEinde
               MOVE.L    A2,D3		;end in d3
               SUB.L     D2,D3		;calculate length
               JSR       -48(A6)	; print text on current output
               MOVEA.L   A6,A1		; dosbase in a1
               MOVEA.L   $4,A6
               JSR       -414(A6)	;close dos library
DosError
               RTS       		;exit





DosName

		DC.B 'dos.library',0
NoMemory
		DC.B 'Not enough memory !!',10,0
		cnop 0,4

Structure
		DC.W $4AFC,0,0,0,0,$122,$10C4,0,0,0,0,0,0
StrapName
		DC.B 'strap',0



Message
		DC.B $9B,$33,$33,$6d
		DC.B 'By Spy From Sensor  !!',$9b,$30,$3b,$33,$31,$6d,10,0

		cnop 0,4

Structure2	DC.W 0,0,0,0,$1000,0,0,1,0,0,0,0,0,0,0,0                                 


; this is the beginning of our own strap !

Own            MOVEA.L   A4,A0		  ;^bootblock in a0
               ADDA.W    #12,A0		  ; add 12  ^beginning of code
               LEA.L     BootStart(PC),A1 ;^standard bootblock 
               MOVEQ.L   #8,D1
Compare
               CMPM.L    (A0)+,(A1)+	  ;compare with standaard
               BNE       NotStandard
               DBF       D1,Compare
               LEA.L     44(A5),A1	  ;is it a standard
               JSR       12(A4)		  ;execute it
GeefOk
               MOVE.W    #$00f0,$00DFF180 ;give green screen
               MOVE.W    #$00f0,$00DFF182 ;  "    "     "
               RTS       		  ;go back to where you came
					  ;from !
NotStandard
               MOVEM.L   D2/A2-A3,-(A7)	  ;it wasn't a standard bootblock
               LEA.L     IntName(PC),A1	  ;^intuition name
               MOVEQ.L   #0,D0
               JSR       -552(A6)	  ;open intuition library
               TST.L     D0
               BEQ       LibraryError
               MOVEA.L   D0,A2
     
               MOVE.L    #1940,D0	;length
               MOVE.L    #$00010000,D1	;chipmem wanted
               JSR       -198(A6)	;allocmem
               TST.L     D0
               BEQ       AllocError
               MOVEA.L   D0,A1		;mempointer in a1
               MOVEA.L   D0,A3		;  "    "    " a3
               MOVEA.L   A6,A0		; execbase in a0

;----------------------------------------------------------------------
	       MOVE.L    -454(A6),(A1)+	;save some adresses to check
	       MOVE.L    148(A6),(A1)+  ;later on possible virusses

               MOVE.L    #$44,D0
Copier5
               MOVE.L    (A0)+,(A1)+	;copy execbase to check for 
               DBF       D0,Copier5	;any alterations

               MOVE.L    546(A6),(A1)+	;save some more adresses
               MOVE.L    550(A6),(A1)+
               MOVE.L    554(A6),(A1)+
;----------------------------------------------------------------------
               MOVEM.L   D2/A2-A3,-(A7)	;save registers
               LEA.L     44(A5),A1

Subroutine     jsr       12(a4)     	;execute bootblock

               MOVEM.L   (A7)+,D2/A2-A3
               MOVEM.L   D0/A0,-(A7)
               MOVEA.L   A6,A0
               MOVEA.L   A3,A1

;------------------------------------------------------------------

               MOVE.L    (A1)+,D0	;move saved value ib d0
               CMP.L     -454(A6),D0	;is it still the same
               BNE       CrackRight	;no possible crackright virus
               MOVE.L    (A1)+,D0	;again
               CMP.L     148(A6),D0
               BNE       CrackRight	;possible crackright virus

               MOVE.L    #$44,D0	;now compare the execbase
COMPAREOLD
               CMPM.L    (A0)+,(A1)+
               BNE       SomethingChanged  ;did something change
               DBF       D0,COMPAREOLD	   
               MOVE.L    (A1)+,D0	   ;some extra checking
               CMP.L     546(A6),D0	   ;of the resident pointers
               BNE       SomethingChanged
               MOVE.L    (A1)+,D0
               CMP.L     550(A6),D0
               BNE       SomethingChanged
               MOVE.L    (A1)+,D0
               CMP.L     554(A6),D0
               BNE       SomethingChanged

;------------------------------------------------------------------

NothingChanged

               MOVE.L    #1940,D0	; ok nothing changed
               MOVEA.L   A3,A1		;mempointer in a1
               JSR       -210(A6)	;Free Memory
               MOVEA.L   A2,A1
               JSR       -414(A6)	;close intuition library
               MOVEM.L   (A7)+,D0/A0
               MOVEM.L   (A7)+,D2/A2-A3
               MOVE.W    #$0f00,$00DFF180   ;give red screen
               MOVE.W    #$0f00,$00DFF182   ;  "   "     "
	
               CLR.L d0
               RTS       		    ;go back

SomethingChanged

               MOVEA.L   $4,A6	   ;something did change !
               JSR       -132(A6)	   ;forbid multitasking
               MOVE.W    #$4000,$00DFF09A  ;stop dma
               MOVE.W    #$0200,$00DFF096  ;stop interrupts
               MOVEA.L   A3,A0	      	   ;mempointer in a0
               MOVE.L    $4,A1	   ;execbase in a1

;------------------------------------------------------------------
               MOVE.L    (A0)+,-454(A6)	   ;copy the entire execbase
	       MOVE.L    (A0)+,148(a6)	   ;back as it was !

               MOVE.L    #$44,D0
Copier6
               MOVE.L    (A0)+,(A1)+	   ;restore old execbase
               DBF       D0,Copier6

               MOVE.L    (A0)+,546(A6)
               MOVE.L    (A0)+,550(A6)
               MOVE.L    (A0)+,554(A6)
	       		

;------------------------------------------------------------------
               MOVE.W    #$8200,$00DFF096  ;start interrupts
               MOVE.W    #$c000,$00DFF09A  ;start dma
               JSR       -138(A6)	   ;permit multitasking

               CLR.L     D0
               LEA.L     Warning3(PC),A0   ;^virus warning
               MOVEQ.L   #60,D1
               MOVEA.L   A2,A6
               JSR       -90(A6)	;give virus-warning
	       MOVE.L    $4,A6	        ;execbase in a6
               BRA       NothingChanged


CrackRight
               LEA.L     Warning4(PC),A0 ;crackright warning !
               MOVEQ.L   #60,D1
               MOVEA.L   A2,A6
               JSR       -90(A6)	;give warning
	       MOVE.L    $4,A6	        ;execbase in a6

	       MOVE.L    #354234,82(a6)	;scramble exec checksum 
               LEA.L     $00DFF000,A4	;prepare for reset
               MOVE.W    #32767,D0	;when the checksum is 
               MOVE.W    D0,154(A4)	;scrambled the entire execbase
               MOVE.W    D0,156(A4)	;is recalculated and cleaned up
               MOVE.W    D0,150(A4)	;so that all virusses will be killed
               JSR       -150(A6)	;go to superstate
               JMP       $00FC00D2	;reset


AllocError
               MOVEA.L   A2,A1		
               JSR       -414(A6)	;close intuition library
LibraryError
               MOVEM.L   (A7)+,D2/A2-A3
               MOVEQ.L   #-1,D0		;error in d0
               RTS       

;	      	DC.W -1

BootStart
                LEA.L     DosName2(PC),A1 	;standard bootblock
                JSR       -96(A6)
                TST.L     D0
                BEQ.S     BootError
                MOVEA.L   D0,A0
                MOVEA.L   22(A0),A0
                MOVEQ.L   #0,D0
BootExit
                RTS       
BootError
                MOVEQ.L   #-1,D0
                BRA.S     BootExit
DosName2
		DC.B 'dos.library',0

		DC.W 0
IntName
		DC.B 'intuition.library',0

		CNOP 0,2

Warning3
	dc.b 0,28,20
	dc.b  'Listen carefully !   A virus attempted to enter system !!!',0,1
	dc.b 0,28,32
	dc.b  ' It is killed in memory, but you must kill it on disk !!! ',0,1
	dc.b 0,28,44
	dc.b  'Programming by SPY and Graphix by GEMINI.  (C) by SENSOR !',0,0


Warning4
	dc.b 0,28,20
	dc.b  'Listen carefully !   The CrackRight Virus entered system !',0,1
	dc.b 0,28,32
	dc.b  'To make sure your system is clean I perform a TOTAL RESET.',0,1
	dc.b 0,28,44
	dc.b  'Programming by SPY and Graphix by GEMINI.  (C) by SENSOR !',0,0


		cnop 0,4
Einde

DName           dc.b     'DOS',$00
DeviceName      dc.b     'trackdisk.device',$00,$00

StrapBegin
	 movem.l d2-d3/a3-a5,-(a7)	;here starts the real strap
	 moveq #0,d3			;routine, i copied it out
	 suba.l a4,a4			;of kickstart 1.2 to 
	 lea First(pc),a3		;make sure it works on every
	 link a5,#-126			;amiga even with kickstart 1.3
	 suba.l #$7e,a5			;i can't explane to much about
					;this because i didn't code it
  	 move.l a6,0(a5)		;execbase in 0(a5)
	 move.l d3,4(a5)
	 move.l #$488,d0		;size
	 move.l #$10002,d1		;chip + clear
         jsr      -$00c6(a6)		;allocmem
         tst.l    d0
         bne.s    NoAlloc1
         movem.l  d7/a5-a6,-(a7)
         move.l   #$30010000,d7		;alert nummer in d7
         movea.l  ($0004).w,a6
         jsr      -$006c(a6)		;alert
         movem.l  (a7)+,d7/a5-a6
         bra     CloseUp4		;exit dit programma

NoAlloc1 movea.l  d0,a4
         lea      StrapName(pc),a0	;^Strapnaam
         move.l   a0,$0036(a5)
         move.l   a0,$0066(a5)
         suba.l   a1,a1			;0 = no preference  any task
         jsr      -$0126(a6)		;findtask 
         move.l   d0,$006c(a5)	        ;task pointer in $6c(a5)
         move.b   #$00,$006a(a5)
         lea      $0070(a5),a0
         move.l   a0,(a0)
         addq.l   #$4,(a0)
         clr.l    $0004(a0)
         move.l   a0,$0008(a0)
         moveq    #-$01,d0		;-1 = no preference
         jsr      -$014a(a6)		;allocsignal
         move.b   d0,$006b(a5)		;signal pointre in $6b(a5)
         bpl.s    Signal1		;als het goed is gegaan
         movem.l  d7/a5-a6,-(a7)
         move.l   #$30070000,d7		;alert nummer
         movea.l  ($0004).w,a6		
         jsr      -$006c(a6)		;alert
         movem.l  (a7)+,d7/a5-a6
         bra    CloseUp3

Signal1  lea      $005c(a5),a0
         move.l   a0,$003a(a5)
         lea      DeviceName(pc),a0	;trackdisk.device
         lea      $002c(a5),a1		;IO request block
         moveq    #$00,d0		;unit number
         moveq    #$00,d1		;flags
         jsr      -$01bc(a6)		;opendevice
         tst.l    d0
         beq.s    DeviceOk1
         movem.l  d7/a5-a6,-(a7)
         move.l   #$30048014,d7
         movea.l  ($0004).w,a6
         jsr      -$006c(a6)		;alert
         movem.l  (a7)+,d7/a5-a6
         bra    CloseUp2

DeviceOk1 
         move.w   #$0100,$00dff096
         lea      $002c(a5),a1		;IO request block
         move.w   #$0005,$001c(a1)	;cmd clear
         jsr      -$01c8(a6)	;doio
         tst.l    d0
         bne    WaitDisk4
         lea      $002c(a5),a1		;IO request block
         move.w   #$000d,$001c(a1)	;cmd change number
         jsr      -$01c8(a6)		;doio
         tst.l    d0
         bne    WaitDisk4
         move.l   $004c(a5),d2
         lea      $002c(a5),a1		;IO request block
         move.w   #$0002,$001c(a1)	;cmd read
         move.l   #$00000400,$0024(a1)	;length
         move.l   a4,$0028(a1)		;^data space
         move.l   #$00000000,$002c(a1)	;from block 0
         jsr      -$01c8(a6)		;doio
         tst.l    d0
         bne.s    BootCheckError
         move.l   (a4),d0		;first four bytes 
         cmp.l    DName(pc),d0		;does it equal 'DOS',0
         bne.s    BootCheckError	;no don't execute 
         movea.l  a4,a0			;^data space
         move.w   #$00ff,d1		;+1*4 = $400 = 1024 = bootblock
         moveq    #$00,d0		
CheckLoop
         add.l    (a0)+,d0		;calculate checksum o.t boot
         bcc.s    CheckLoop2		;if it is  correct then  
         addq.l   #$1,d0		;execute it otherwise don't
CheckLoop2
         dbf      d1,CheckLoop
         not.l    d0
         bne.s    BootCheckError
	 jsr Own(PC)			;execute bootcheck routine
         tst.l    d0			;everithing went ok ? 
         beq.s    EveryThingOk		;yes
         move.l   d0,-(a7)
         movea.l  a7,a1
         movem.l  d7/a5-a6,-(a7)
         move.l   #$30000001,d7		;alert nummer
         lea      (a1),a5
         movea.l  ($0004).w,a6
         jsr      -$006c(a6)	;alert
         movem.l  (a7)+,d7/a5-a6
         addq.l   #$4,a7
         bra    CloseUp

EveryThingOk
         movea.l  a0,a3
         bra    CloseUp

BootCheckError      
	 move.l   $0004(a5),d0		;is drawing already visible
         bne.s    WaitDisk1		; yes 
         bsr    OpenGfx			; no, do some graphics
WaitDisk1
         move.w   #-$7f00,$00dff096	;interrupts off
         lea      $002c(a5),a1		;IO request block
         move.w   #$0009,$001c(a1)	;motor off
         clr.l    $0024(a1)
         jsr      -$01c8(a6)		;doio
         tst.l    d0
         bne.s    WaitDisk4
WaitDisk2      
	 lea      $002c(a5),a1		;IO request block
         move.w   #$000d,$001c(a1)	;number of changes
         jsr      -$01c8(a6)	;doio
         tst.l    d0
         bne.s    WaitDisk4

	 move.b $bfec01,d0		;check keys
	 not d0
	 ror.b #1,d0
	 cmp.b #$59,d0			; was it F10 ?
	 beq WowIt 			; clear from memory


NaKey
         cmp.l    $004c(a5),d2
         beq.s    WaitDisk2
				;when disk is inserted do this
DiskInserted      
	 lea      $002c(a5),a1		;IO request block
         move.w   #$000e,$001c(a1)	;disk changed 
         jsr      -$01c8(a6)		;doio
         tst.l    d0
         bne.s    WaitDisk4
         tst.l    $004c(a5)
         bne.s    DiskInserted
         bra    DeviceOk1

WaitDisk3      
	 lea      $002c(a5),a1		;IO request block
         move.w   #$000d,$001c(a1)	;number changes
         jsr      -$01c8(a6)	    	;doio
         bra      BootCheckError

WaitDisk4
         cmpi.b   #$1d,$004b(a5)
         beq.s    WaitDisk3
         pea      ($0000).w
         move.w   $0048(a5),$0002(a7)
         pea      ($0000).w
         move.b   $004b(a5),$0003(a7)
         movea.l  a7,a1
         movem.l  d7/a5-a6,-(a7)
         move.l   #$30068014,d7
         lea      (a1),a5
         movea.l   ($0004).w,a6
         jsr      -$006c(a6)	;alert
         movem.l  (a7)+,d7/a5-a6
         addq.l   #$8,a7
CloseUp
         bsr    CloseGfx
         move.w   #-$7f00,$00dff096
         lea      $002c(a5),a1		;task in a1
         jsr      -$01c2(a6)		;set task priority
CloseUp2
         moveq    #$00,d0
         move.b   $000f(a5),d0		;signal nummer
         jsr      -$0150(a6)		;freesignal
CloseUp3
         movea.l  a4,a1			;membase in a1
         move.l   #$00000488,d0		;lengte
         jsr      -$00d2(a6)		;freemem
CloseUp4
         adda.l   #$0000007e,a5
         unlk     a5
         movea.l  a3,a0
         movem.l  (a7)+,d2-d3/a3-a5
         jmp      (a0)

WowIt					;F10
	       MOVE.L    #354234,82(a6)	;scramble exec checksum 
               LEA.L     $00DFF000,A4	;prepare for reset
               MOVE.W    #32767,D0
               MOVE.W    D0,154(A4)
               MOVE.W    D0,156(A4)
               MOVE.W    D0,150(A4)
               JSR       -150(A6)	;go to superstate
               JMP       $00FC00D2	;reset


First    dc.b     'Nu'
GfxName  dc.b     'graphics.library',$00
         dc.b     $00
Colors20 dc.b     $0f,$ff,$0f,$ff,$0f,$ff	;colors 20x
         dc.b     $0f,$ff,$0f,$ff,$0f,$ff
         dc.b     $0f,$ff,$0f,$ff,$0f,$ff
         dc.b     $0f,$ff,$0f,$ff,$0f,$ff
         dc.b     $0f,$ff,$0f,$ff,$0f,$ff
         dc.b     $0f,$ff,$0f,$ff,$0f,$ff
         dc.b     $0f,$ff,$0f,$ff
Colors4  dc.b     $00,$00,$0f,$00,$00,$0f	;colors 4x
         dc.b     $0f,$ff

OpenGfx  lea      GfxName(pc),a1	;open graphics library 
         moveq    #$00,d0
         jsr      -$0228(a6)		;openlibrary
         move.l   d0,$0004(a5)
         bne.s    AllocGfx		;no error
         movem.l  d7/a5-a6,-(a7)
         move.l   #$30038002,d7
         move.l   4,a6
         jsr      -$006c(a6)	;alert
         movem.l  (a7)+,d7/a5-a6
         rts      

AllocGfx movem.l  d2-d5/a2-a3/a6,-(a7)
         movea.l  $0000(a5),a6		;execbase in a6
         move.l   #$00005e9a,d0		;length
         move.l   #$00010003,d1		;chipmem+public+clear
         jsr      -$00c6(a6)		;allocmem
         tst.l    d0
         bne    AllocGfxOk
         movem.l  d7/a5-a6,-(a7)
         move.l   #$30010000,d7
         move.l   4,a6
         jsr      -$006c(a6)		;alert
         movem.l  (a7)+,d7/a5-a6
         movem.l  (a7)+,d2-d5/a2-a3/a6
         rts      

AllocGfxOk
         move.l   d0,$0008(a5)		;membase in 8(a5) ^viewport
         addi.l   #$00000028,d0		
         move.l   d0,$000c(a5)		;^view
         addi.l   #$00000012,d0
         move.l   d0,$0010(a5)		;^rastport structuur
         addi.l   #$00000064,d0
         move.l   d0,$0014(a5)		;^tmp rastport structuur
         addi.l   #$00000008,d0
         move.l   d0,$0018(a5)		;?
         addi.l   #$0000000c,d0
         move.l   d0,$001c(a5)		;^bitmap structuur
         addi.l   #$00000028,d0
         move.l   d0,$0020(a5)		;^plane 1
         move.l   #$00001f40,d1		;length*height  200*40
         add.l    d1,d0
         move.l   d0,$0024(a5)		;^plane 2
         add.l    d1,d0
         move.l   d0,$0028(a5)		;^plane 3 (not used !)
         movea.l  $0004(a5),a6		;gfxbase in a6
         movea.l  $0008(a5),a0		;^viewport in a0
         jsr      -$00cc(a6)		;init viewport
         movea.l  $000c(a5),a1		;^view
         jsr      -$0168(a6)		;initview
         movea.l  $001c(a5),a0		;^bitmap
         moveq    #$02,d0		;2 planes
         move.l   #$00000140,d1		;length 320
         move.l   #$000000c8,d2		;height 200
         jsr      -$0186(a6)		;initbitmap
         movea.l  $001c(a5),a0		;^bitmap structuur
         move.l   $0020(a5),$0008(a0)	;plane 1
         move.l   $0024(a5),$000c(a0)	;plane 2
         movea.l  $0010(a5),a1		;^rastport structuur
         jsr      -$00c6(a6)		;initrastport
         movea.l  $0014(a5),a0		;^tmp rastport structuur
         movea.l  $0028(a5),a1		;plane 2 as data space
         move.l   #$00001f40,d0		;size 
         jsr      -$01d4(a6)		;init tmp rastport
         movea.l  $0018(a5),a0		
         move.l   $001c(a5),$0004(a0)	;^bitmap
         movea.l  $0010(a5),a0
         move.l   $001c(a5),$0004(a0)
         move.l   $0014(a5),$000c(a0)
         movea.l  $0008(a5),a0		;^viewport
         move.w   #$00c8,$001a(a0)	;height 200
         move.w   #$0140,$0018(a0)	;length 320
         move.l   $0018(a5),$0024(a0)
         clr.w    $0020(a0)
         movea.l  $000c(a5),a3		;^view
         move.l   $0008(a5),$0000(a3)	;^viewport
         movea.l  a3,a0
         movea.l  $0008(a5),a1		;^viewport
         jsr      -$00d8(a6)		;makeviewport
         movea.l  a3,a1			;view
         jsr      -$00d2(a6)		;mrgcopper
         movea.l  a3,a1
         jsr      -$00de(a6)		;loadview  activate new copper
         movea.l  $0008(a5),a0		;viewport
         lea      Colors20(pc),a1
         moveq    #$14,d0		;20 kleuren wit
         jsr      -$00c0(a6)		;loadrgb
         movea.l  $0010(a5),a3		;^rastport structuur

         lea      Part1(pc),a1		;picture part 1
         movea.l  $0020(a5),a2		;^plane 1
         adda.l   #$000007f8,a2		; plane1 +2040  = 51 lines *40 bytes
         move.l   #$000003e7,d0		;number of (bytes-1) / 4
CopyPart1      
 	 move.l   (a1)+,(a2)+
         dbf      d0,CopyPart1		;copy plane1

         lea      Part2(pc),a1		; the same goes for plane 2 
         movea.l  $0024(a5),a2
         adda.l   #$000007f8,a2
         move.l   #$000003e7,d0
CopyPart2      
	 move.l   (a1)+,(a2)+
         dbf      d0,CopyPart2

SetColors
         movea.l  $0008(a5),a0		;viewport
         lea      Colors4(pc),a1	;colors 4x
         moveq    #$04,d0		;4 colors
         jsr      -$00c0(a6)		;loadrgb4
         jsr      -$010e(a6)		;waitof
         movem.l  (a7)+,d2-d5/a2-a3/a6
         rts      

CloseGfx move.l   a6,-(a7)		;close graphics library
         tst.l    $0004(a5)	
         beq.s    CloseGfx3
         tst.l    $0008(a5)
         beq.s    CloseGfx2
         move.w   #$0100,$00dff096
         movea.l  $0004(a5),a6		;gfxbase in a1
         suba.l   a1,a1
         jsr      -$00de(a6)		;loadview
         movea.l  $0008(a5),a0
         jsr      -$021c(a6)		;freevportcoplist
         movea.l  $0000(a5),a6		;execbase in a6
         movea.l  $0008(a5),a1		;membase in a1
         move.l   #$00005e9a,d0		;length
         jsr      -$00d2(a6)		;freemem
CloseGfx2
         movea.l  $0000(a5),a6		;execbase in a6
         movea.l  $0004(a5),a1		;gfxbase in a1
         jsr      -$019e(a6)		;close library
CloseGfx3
         movea.l  (a7)+,a6
         rts      


	include df1:picture.inc	;this part is the picture
				;that appears on your screen when
				;you reset 
;Part1
;	incbin df1:part1
;Part2
;	incbin df1:part2


EindeStrap:

	;the picture that is included can be changed as follows:

	;it is a picture of 100 lines 
	;it consists of two parts both of them have a label
	;(Part1 and Part2)
	;you make your own picture using dpaint (use upper 100 lines to
	;draw ).
	;change it into raw format using iff converter or pixmate etc.
	;load cmon or some other monitor programm.
	;load your picture at adress $50000.
	;save part one and part two as follows (this example uses CMON)
  
	;S df1:part1 50000 50fa0
	;S df1:part2 51f40 52ee0

	;now change the part where i include the picture into

	;	Part1
	;		incbin df1:part1
	;	Part2
	;		incbin df1:part2
	
; well that's all folks !
; hope you enjoy this program  the original is called SERVER !
; Greetings from SPY of SENSOR    31-09-1989 
 








