#
# Commodore 64 ART (Art Studio) hires importer
# A Multipaint internal script
#
# input file

LOAD

# Error checking

A = LENGTH

IF A<9002
	ALERT 1
	STOP
ENDIF
IF A>9010
	ALERT 1
	STOP
ENDIF

# header

READ A
READ A

# bitmap

P=1024

FOR Y=0 TO 24
	FOR X=0 TO 39
		FOR V=0 TO 7
			READ L
			C=128
			P=1024+X*8+Y*2560+V*320
			FOR B=0 TO 7
				A=L&C				
				IF A=0
					POKE P,1
				ENDIF
				IF A<>0
					POKE P,0
				ENDIF
				P=P+1
				C=C/2
			NEXT B
		NEXT V
	NEXT X
NEXT Y

# color RAM

FOR Y=0 TO 24
	FOR X=0 TO 39
		READ A
		H=A&$F0
		L=A&$0F
		H=H/16
		P=65536+X+Y*320
		J=65536+X+Y*320+8000
		FOR V=0 TO 7
			POKE P,L
			POKE J,H
			P=P+40
			J=J+40
		NEXT V
	NEXT X
NEXT Y

# Border

READ B
POKE 0,B

REFRESH

