[comp.sys.atari.st] Screen Resolution Simulator

lewis@TSCA.ISTC.SRI.COM (12/18/86)

It's time for a public domain program to allow running any program
on any physical resolution monitor. There have been several complaints
about programs which don't run on monochrome, which have been answered
with some wonderful games which only run on monochrome, leaving those
with color systems grumbling. Wouldn't it be great if the resolution
required for any program could be simulated? I would like to start
a discussion on this subject.

I will open the discussion with my proposal (though I do not yet
have the means of testing the ideas).

The scheme operates as a memory resident program or accessory, and
hopefully is consistent with the SET-PREFERENCES menu. 

-Mark Lewis

	WARNING !! this is not a program, only a proposed algorithm
	  - obviously, I don't know the true system call to use either

int logical_screen_base;	/* used by all GEM and ALINE screen calls */
int physical_screen_base;	/* used by video shifter hardware */
int screen_line_number;		/* next line to be mapped */
int logical_rez, physical_rez;	/* resolution mode wanted/implemented */

ALL_REZ()	/*for now refer to the program by this name */
{
	screen_line_number = 0;

	logical_rez = get_rez();
	physical_rez = get_rez();

	/* allocate another screen size buffer at the top */
	/* available memory */
	logical_screen_base = trap14_1_ssbrk(32000);

	/* set up interrupt routines for */
	/* horizontal and vertical blanking */
	signal(HORIZONTAL,fix_line);
	signal(VERTICAL,check_rez);

	/* set up new buffer as logical screen */
	trap14_3_logbase(logical_screen_base);

	/* from now on, after each line is displayed by the
	/* video shifter, during the horizontal interrupt
	/* another line is mapped from the logical
	/* screen buffer to the physical screen buffer
	/* with appropriate pixel representation for
	/* color and density
	/* during the vertical interrupt, rez changes are checked
	********************************************************/

	/* stay resident */
	terminate();
}

change_rez(new_rez)	/* called out of SET-PREFERENCES I suppose */
int	new_rez;
{
	logical_rez = new_rez;
}

fix_line()	/* installed as horizontal blinking routine */
{
	/* remap next line for vidio scanner */

	++screen_line_number;

	switch (logical_rez) {

		/* re-map from logical screen to physical screen buffers */
		/* depending on rez wanted and rez set in hardware */

		case med_to_hi:
			/* medium rez program on hi rez monitor */
			/* need to express 640x200,4 colors
			/* on to 640 by 400, 2 colors	*/
			for (i=0; i<640; i++) {
				/* use color number in logical screen */
				/* as density for two pixels on
				/* adjacent lines in physical screen */
			}
			break;
		case hi_to_med:
			/* hi rez program (monopool.prg) on med rez monitor */
			for (i=0; i<640; i++) {
				/* use two adjacent lines pixel black/white
				/* info on logical screen to select
				/* between black/grey/white on phs screen */
			}
			break;
		case hope_these_are_implemented:
			break;
		default:
	}
}

check_rez()	/* installed as vertical blinking routine */
{
		/* check if user resolution has changed */
		/* depending on changes, set up new colors */
}