*****************************************
*	color converter			*
*	takes sensible color format	*
*	ie:	1,2,3,4-a,b,c,d,e,f	*
*	and turns it into the ste's 	*
*	stupid format			*
*	ie:	0,8,1,9,2,a,3,b,....	*
*****************************************
converter:
	lea	p1,a0
	lea	p1end,a6	;for cmp for end
	lea	redcolors,a2
	lea	greencolors,a3
	lea	bluecolors,a4
	lea	palc,a1		;where the new pal goes
conloop:
	moveq	#0,d0		;for construction
	moveq	#0,d1
	moveq	#0,d2
	moveq	#0,d3
	moveq	#0,d4
	move.w	(a0)+,d1	;get the color
	move.w	d1,d2		;copy it
	move.w	d2,d3
	and.w	#$0f00,d1	;isolate the red
	lsr.w	#8,d1		;now use it to index
	add.w	d1,d1
	or.w	(a2,d1.w),d0
	and.w	#$00f0,d2	;isolate the red
	lsr.w	#4,d2
	add.w	d2,d2
	or.w	(a3,d2.w),d0
	and.w	#$000f,d3	;isolate the red
	add.w	d3,d3
	or.w	(a4,d3.w),d0
	move.w	d0,(a1)+
	cmp.l	a6,a0
	blt	conloop
illegal
redcolors:
	dc.w	$0000,$0800,$0100,$0900,$0200,$0a00,$0300,$0b00
	dc.w	$0400,$0c00,$0500,$0d00,$0600,$0e00,$0700,$0f00
greencolors:
	dc.w	$0000,$0080,$0010,$0090,$0020,$00a0,$0030,$00b0
	dc.w	$0040,$00c0,$0050,$00d0,$0060,$00e0,$0070,$00f0
bluecolors:
	dc.w	$0000,$0008,$0001,$0009,$0002,$000a,$0003,$000b
	dc.w	$0004,$000c,$0005,$000d,$0006,$000e,$0007,$000f



p1:
	dc.w	$0300,$0300,$0300,$0310,$0310,$0440
	dc.w	$0130,$0130,$0030,$0030,$0030
	dc.w	$0030,$0030,$0031,$0031,$0033
	dc.w	$0133,$0133,$0222,$0222,$0211

	dc.w	$0500,$0500,$0500,$0510,$0520,$0550
	dc.w	$0250,$0150,$0050,$0050,$0050
	dc.w	$0050,$0050,$0051,$0052,$0055
	dc.w	$0144,$0233,$0322,$0411,$0511

	dc.w	$0600,$0600,$0600,$0610,$0630,$0660
	dc.w	$0360,$0160,$0060,$0060,$0060
	dc.w	$0060,$0060,$0061,$0063,$0066
	dc.w	$0155,$0244,$0333,$0422,$0511

	dc.w	$0700,$0700,$0700,$0710,$0740,$0770
	dc.w	$0470,$0170,$0070,$0070,$0070
	dc.w	$0070,$0070,$0071,$0074,$0077
	dc.w	$0166,$0255,$0333,$0522,$0611

	dc.w	$0900,$0900,$0910,$0930,$0960,$0990
	dc.w	$0690,$0390,$0190,$0090,$0090
	dc.w	$0090,$0091,$0093,$0096,$0099
	dc.w	$0199,$0366,$0555,$0633,$0911

	dc.w	$0b00,$0b00,$0b20,$0b50,$0b80,$0bb0
	dc.w	$08b0,$05b0,$02b0,$00b0,$00b0
	dc.w	$00b0,$00b2,$00b5,$00b8,$00bb
	dc.w	$00bb,$0255,$0522,$0911,$0b00



	dc.w	$0d22,$0d32,$0d62,$0d92,$0dd2,$0dd2
	dc.w	$0cd2,$09d2,$06d2,$03d2,$02d2
	dc.w	$02d3,$02d6,$02d9,$02dc,$02dd
	dc.w	$04dd,$0799,$0977,$0c44,$0d22


	dc.w	$0e33,$0e53,$0e83,$0eb3,$0ee3,$0ee3
	dc.w	$0ee3,$0be3,$07e3,$05e3,$03e3
	dc.w	$03e5,$03e8,$03eb,$03ee,$03ee
	dc.w	$05ee,$08aa,$0a88,$0d55,$0e33

	dc.w	$0f55,$0f85,$0fb5,$0fe5,$0ff5,$0ff5
	dc.w	$0ff5,$0ef5,$0bf5,$08f5,$05f5
	dc.w	$05f8,$05fb,$05fe,$05ff,$05ff
	dc.w	$05ff,$03ee,$06bb,$0988,$0f55

*	dc.w	$05ff,$05ef,$05bf,$058f,$055f
*	dc.w	$085f,$0b5f,$0e5f,$0f5f,$0f5f
*	dc.w	$0f5f,$0f5e,$0f5b,$0f58


*****************
*	dc.w	$03ee,$0699,$0966,$0e33,$0f00
*
****************


p1end:

*	original
	dc.w	$0f00,$0f30,$0f60,$0f90,$0fc0,$0ff0
	dc.w	$0cf0,$09f0,$06f0,$03f0,$00f0
	dc.w	$00f3,$00f6,$00f9,$00fc,$00ff
	dc.w	$00cf,$009f,$006f,$003f,$000f
	dc.w	$030f,$060f,$090f,$0c0f,$0f0f
	dc.w	$0f3c,$0f69,$0f96,$0fc3,$0ff0
	dc.w	$0cf3,$09f6,$06f9,$03fc,$00ff
	dc.w	$03cc,$0699,$0966,$0c33

palc:
	blk.w	9*21,0

pt:
	dc.w	$1234


*	0,8,1,9,2,a,3,b,4,c,5,d,6,e,7,f
palette:
*	red to yellow
	dc.w	$0f00,$0000,$0000,$0f90,$0f20,$0fa0,$0f30,$0fb0
	dc.w	$0f40,$0fc0,$0f50,$0fd0,$0f60,$0fe0,$0f70,$0ff0
*	yellow to green
	dc.w	$0ff0,$07f0,$0ef0,$06f0,$0df0,$05f0,$0cf0,$04f0
	dc.w	$0bf0,$03f0,$0af0,$02f0,$09f0,$01f0,$08f0,$00f0
*	green to cyan
	dc.w	$00f0,$00f8,$00f1,$00f9,$00f2,$00fa,$00f3,$00fb
	dc.w	$00f4,$00fc,$00f5,$00fd,$00f6,$00fe,$00f7,$00ff
*	cyan to blue
	dc.w	$000f,$000f,$000f,$000f,$000f,$000f,$000f,$000f
	dc.w	$000f,$000f,$000f,$000f,$000f,$000f,$000f,$000f
