#
# ZX Spectrum ULAplus SCR (Loading screen) exporter
# A Multipaint internal script
#

# Display file

# bitmap

FOR Y=0 TO 2
	FOR V=0 TO 7
		FOR E=0 TO 7
			FOR X=0 TO 31
				C=128
				L=0
				FOR B=0 TO 7
					P=V
					M=E*8
					P=P+M
					M=Y*64
					P=P+M

					A=1024
					M=P*256
					A=A+M
					M=X*8
					A=A+M

					A=A+B
					O=PEEK A
					M=C*O
					L=L+M
					C=C/2
				NEXT B
				L=255-L
				XBYTE L
			NEXT X
		NEXT E
	NEXT V
NEXT Y

# Attributes

FOR Y=0 TO 23
	FOR X=0 TO 31
		R = 0
		F = 0
		P = Y*256
		P = P+X
		P = P+65536
		L = PEEK P
		P = P+6144
		H = PEEK P

		C = L/16
		M = C*16
		I = L-M
		P = H-M

		IF I>7
			I=I-8
		ENDIF

		IF P>7
			P=P-8
		ENDIF

		IF C=0
			R=0
			F=0
		ENDIF

		IF C=1
			R=64
			F=0
		ENDIF

		IF C=2
			R=0
			F=128
		ENDIF

		IF C=3
			R=64
			F=128
		ENDIF

		A = P
		M = I*8
		A = A+M
		A = A+R
		A = A+F

		XBYTE A

	NEXT X
NEXT Y

# End of Display file

# ULAplus palette 

P = 256

FOR C=0 TO 63
	R = PEEK P
	P = P+1
	G = PEEK P
	P = P+1
	B = PEEK P
	P = P+1
	IF R=0
		r=0
	ENDIF
	IF R=36
		r=1
	ENDIF
	IF R=73
		r=2
	ENDIF
	IF R=109
		r=3
	ENDIF
	IF R=146
		r=4
	ENDIF
	IF R=182
		r=5
	ENDIF					
	IF R=219
		r=6
	ENDIF	
	IF R=255
		r=7
	ENDIF
	IF G=0
		g=0
	ENDIF
	IF G=36
		g=1
	ENDIF
	IF G=73
		g=2
	ENDIF
	IF G=109
		g=3
	ENDIF
	IF G=146
		g=4
	ENDIF
	IF G=182
		g=5
	ENDIF					
	IF G=219
		g=6
	ENDIF	
	IF G=255
		g=7
	ENDIF
	IF B=0
		b=0
	ENDIF
	IF B=109
		b=1
	ENDIF
	IF B=182
		b=2
	ENDIF
	IF B=255
		b=3
	ENDIF					
	A=g*32
	M=r*4
	A=A+M
	A=A+b
	XBYTE A
NEXT C

# Write to file

SAVE

