/* make-hame.adpro
**
** $VER: make-hame.adpro 1.0.1 (1.10.92)
**
** This Arexx program is supplied for your convenience.  It can be used to
** create rendered data suitable for turning into HAM-E mode displayable
** (and savable) data.
**
** Example ARexx program for controlling MorphPlus/ADPro by ASDG Incorporated.
**
** Copyright © 1991-1992 ASDG Incorporated  All Rights Reserved
*/


ADDRESS "ADPro"
OPTIONS RESULTS

NL = '0A'X


/* Note how we started. */

PWIDTH
old_palette_mode = ADPRO_RESULT


/* Let user decide which mode we should work in */

string = "Current palette mode is:" old_palette_mode || NL || NL
string = string || "Hit OK to use ENHANCED mode." || NL
string = string || "Hit CANCEL to use NORMAL mode."

OKAY2 string

IF RC ~= 0 THEN DO
	PWIDTH "ENHANCED"
	IF RC ~= 0 THEN DO
		OKAY2 "Cannot switch into Enhanced Mode." || NL || "Continue?"
		IF RC = 0 THEN EXIT
	END
END
ELSE DO
	PWIDTH "NORMAL"
END


/* Let user decide between HAM and HAM8 */

rendering_mode = "HAM8"
colors_used    = 60

string =           "Hit OK to render in 8 bit-plane" || NL || "HAM mode (262,144) colors." || NL || NL
string = string || "Hit CANCEL to render  in 6 bit-" || NL || "plane HAM mode (4096 colors)." || NL || NL

OKAY2 string

IF RC = 0 THEN DO
	rendering_mode = "HAM"
	colors_used = 16
END


/* Set up the user's wishes. */

POFFSET 0
IF RC ~= 0 THEN DO
	OKAY1 "POFFSET failed:" || NL || RC ADPRO_RESULT
	EXIT
END

PTOTAL rendering_mode
IF RC ~= 0 THEN DO
	OKAY1 "PTOTAL failed:" || NL || RC ADPRO_RESULT 
	EXIT
END

PUSED colors_used
IF RC ~= 0 THEN DO
	OKAY1 "PUSED failed:" || NL || RC ADPRO_RESULT
	EXIT
END

RENDER_TYPE "CUST"
IF RC ~= 0 THEN DO
	OKAY1 "RENDER_TYPE failed:" || NL || RC ADPRO_RESULT
	EXIT
END

EXECUTE
IF RC ~= 0 THEN DO
	OKAY1 "EXECUTE failed:" || NL || RC ADPRO_RESULT
	EXIT
END

SFORMAT "HAME"
IF RC ~= 0 THEN DO
	OKAY1 "Could not select the HAME saver."
	EXIT
END


/* Display image for 4 seconds, you can change 
** the delay to what you want.
*/

SAVE "DONTCARE" "IMAGE" "DISPLAY" 200
IF RC ~= 0 THEN DO
	OKAY1 "HAME save failed." || NL || RC ADPRO_RESULT
	EXIT
END
