#
# Commodore Plus/4 Botticelli hires exporter
# A Multipaint internal script
#
# Thanks to KiCHY
#

XREM "Botticelli hires header"

XBYTE 0,120

XREM "Luminance"

FOR Y=0 TO 24
	FOR X=0 TO 39
		P = Y*320
		P = P+X
		P = P+65536
		L = PEEK P
		P = P+8000
		H = PEEK P

		C = H
		R = C-1
		R = R/15
		H = R

		C = L
		R = C-1
		R = R/15
		L = R

		M = H*16
		A = M+L

		XBYTE A
	NEXT X
NEXT Y

XREM "Padding"

FOR I=0 TO 23
	XBYTE 0
NEXT I

XREM "Color"

FOR Y=0 TO 24
	FOR X=0 TO 39
		P = Y*320
		P = P+X
		P = P+65536
		H = PEEK P
		P = P+8000
		L = PEEK P

		C = H
		R = C-1
		R = R/15
		R = R*15
		H = C-R

		C = L
		R = C-1
		R = R/15
		R = R*15
		L = C-R

		M = H*16
		A = M+L
		XBYTE A
	NEXT X
NEXT Y

XREM "Padding"

FOR I=0 TO 23
	XBYTE 0
NEXT I

XREM "Bitmap"

FOR Y=0 TO 24
	FOR X=0 TO 39
		FOR V=0 TO 7
			C=128
			L=0
			FOR B=0 TO 7
				P=V*320
				P=P+B
				M=X*8
				P=P+M
				M=Y*2560
				P=P+M
				P=P+1024
				O=PEEK P
				M=C*O
				L=L+M
				C=C/2
			NEXT B
			XBYTE L
		NEXT V
	NEXT X
NEXT Y

# Write to file (10050 bytes)

SAVE
