Home » Archimedes archive » Acorn User » AU 1997-12.adf » Regulars » C/!Skeleton/c/Skeleton

C/!Skeleton/c/Skeleton

This website contains an archive of files for the Acorn Electron, BBC Micro, Acorn Archimedes, Commodore 16 and Commodore 64 computers, which Dominic Ford has rescued from his private collection of floppy disks and cassettes.

Some of these files were originally commercial releases in the 1980s and 1990s, but they are now widely available online. I assume that copyright over them is no longer being asserted. If you own the copyright and would like files to be removed, please contact me.

Tape/disk: Home » Archimedes archive » Acorn User » AU 1997-12.adf » Regulars
Filename: C/!Skeleton/c/Skeleton
Read OK:
File size: 2145 bytes
Load address: 0000
Exec address: 0000
File contents
/* Demo C program to show fonts within windows
 * SJP Mumford, for Acorn User (October 1997) */

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "AULib.h"

/* #defines */

#define MAX_WINDOWS 3
#define MAX_MENUS 1
#define RISC_OS_VERSION 310
#define POLL_MASK 1
#define SPRITE_AREA_SIZE 10240
#define TRANS_BUFFER_SIZE 1024

/* iconbar menu */

#define QUIT_OPTION 0

/* Global variables */

window_data	win_data[MAX_WINDOWS];
menu_data	men_data[MAX_MENUS];
unsigned char sprite_area[SPRITE_AREA_SIZE];
unsigned char translation_buffer[TRANS_BUFFER_SIZE];
unsigned char translation_buffer2[TRANS_BUFFER_SIZE];

int QUIT_FLAG = 0;
int CURRENT_MENU = 0;
int font_handle = 0;
int font_size = 24 * 16; /* size in 16ths of a point */
int font_res = 0; /* Setting this to 0 uses the default font resolution */
int font_flags = 1u << 4;
char appname[] = "FontDemo";
char sprname[] = "!skeleton";
char font_name[] = "Trinity.Medium";
long int msglist[] = {0};

/* Function prototyping */

int	main(void);
void	load_templates(void);
void	wimp_msg(int, unsigned char[]);
void	mouse_click(unsigned char[]);
void	open_main_window(void);
void	menu_selection(unsigned char[]);
void	openwindow(unsigned char[]);
void	closewindow(unsigned char[]);
void	redraw_window(unsigned char[]);
void	setup_sprite_area(void);
void	plot_sprite(char [], int, int, unsigned char []);
void	build_translation_table(char [], unsigned char []);
void	setup_fonts(void);

/* Main program */

int
main()
{
	int task_handle, icon_handle;
	unsigned char poll_block[256];
	int poll_result, i;

	/* Load templates and initialise things here */

	/* Set up the application with the WIMP */
	task_handle = au_initialise(RISC_OS_VERSION, appname, msglist);
	icon_handle = au_create_iconbar_icon(IBAR_PRIOR_APP, IBAR_ONRIGHT, ICON_ISSPRITE | ICON_HCENTRE | ICON_VCENTRE | ICON_CLICKNOTIFIESONCE, sprname);

	/* set up some other bits and pieces */
	load_templates();
	setup_sprite_area();
	build_translation_table("screen", translation_buffer);
	build_translation_table("testspr", translation_buffer2);
	setup_fonts();

	while (QUIT_FLAG == 0) {
		/* Main polling loop */
		poll_result = au_wimp_poll(POLL_MASK, poll_block);

		switch (poll_result) {
			case  1 : redraw_window(poll_block);
					break;
			case  2 : openwindow(poll_block);
					break;
			case  3 : closewindow(poll_block);
					break;
			case  6 : mouse_click(poll_block);
					break;
			case  9 : menu_selection(poll_block);
					break;
			case 17 :
			case 18 :
			case 19 : wimp_msg(poll_result, poll_block);
					break;
		}

	/* End of main polling loop */
	}

	/* If we get this far, it's time to close down */

	au_losefont(font_handle);
	au_closedown(task_handle);

	for(i = 0; i < MAX_WINDOWS; i++) {
		free(win_data[i].win_name);
		free(win_data[i].buffer);
		free(win_data[i].workspace);
	}


}

void
load_templates(void)
{
	char filename[] = "<Skeleton$Dir>.Templates";
	au_opentemplate(filename);

	if(au_loadtemplate("MainWindow", &win_data[0], 0) == 0) {
		au_report_error(1, "Template not found!", 1, appname);
		QUIT_FLAG = 1;
	}

	au_closetemplate();
}

void
wimp_msg(int result, unsigned char pollblock[])
{
	unsigned long int	message_action;

	message_action = au_bytetoword(pollblock, 16);

	switch (message_action) {
		case MESSAGE_QUIT : QUIT_FLAG = 1;
			break;
		case MESSAGE_MODECHANGE : build_translation_table("screen", translation_buffer);
			if (font_handle != 0) au_losefont(font_handle);
			setup_fonts();
			break;
	}
}

void mouse_click(unsigned char poll_block[])
{
	int	clk;
	long int	icon_num;

	/* Determine which button was pressed */
	clk = (int) au_bytetoword(poll_block, 8);

	if((au_bytetoword(poll_block, 12) == -2) && (clk == 4)) {
	open_main_window();
	}

	if((au_bytetoword(poll_block, 12) == -2) && (clk == 2)) {
		/* Time to produce a menu */
		au_buildmenu("Skeleton", &men_data[0]);
		/*au_addtomenu("Info", 0, win_data[1].win_handle, 0, &men_data[0]);*/
		au_addtomenu("Quit", MENU_LASTITEM, -1, 0, &men_data[0]);
		au_createmenu(&men_data[0]);
		CURRENT_MENU = 1; /* keep track of the last menu we opened */
		au_openmenu(&men_data[0], (int) au_bytetoword(poll_block, 0) - 64, (44*1+96));
		return;
	}

	/* Check to see if it was in the main window */
	if((au_bytetoword(poll_block, 12) == win_data[0].win_handle) && (clk == 4)) {
		icon_num = au_bytetoword(poll_block, 16);
		switch (icon_num) {
		}
	}

	return;
}

void open_main_window(void)
{
	_kernel_swi_regs	in, out;
	unsigned char	temp_buffer[1024];

	au_wordtobyte(win_data[0].win_handle, temp_buffer, 0);

	in.r[1] = (int) temp_buffer;
	_kernel_swi(Wimp_GetWindowInfo, &in, &out);
	_kernel_swi(Wimp_OpenWindow, &in, &out);
	return;
}

void menu_selection(unsigned char poll_block[])
{
	long int	first_hit;
	if (CURRENT_MENU == 1) {
		first_hit = au_bytetoword(poll_block, 0);
		if (first_hit == QUIT_OPTION) {
			QUIT_FLAG = 1;
		}
	}
	CURRENT_MENU = 0;
	return;
}

void
openwindow(unsigned char pollblock[])
{
   _kernel_swi_regs in, out;

   in.r[1] = (int) pollblock;
   _kernel_swi(Wimp_OpenWindow, &in, &out);
   return;
}

void
closewindow(unsigned char pollblock[])
{
   _kernel_swi_regs in, out;

   in.r[1] = (int) pollblock;
   _kernel_swi(Wimp_CloseWindow, &in, &out);
   return;
}

void
redraw_window(unsigned char pollblock[])
{
	_kernel_swi_regs	in, out;
	int flag = 0;
	long int visx1, visx2, visy1, visy2;
	long int winx1, winx2, winy1, winy2;
	long int workx1, workx2, worky1, worky2;
	long int scrollx, scrolly;
	int testx, testy;
	int testx1, testx2, testy1, testy2;
	char sample_text[] = "Hello World!";

	in.r[1] = (int) pollblock;

	_kernel_swi(Wimp_RedrawWindow, &in, &out);
	flag = out.r[0];

	while (flag) {
	/* redraw window here */
	winx1 = au_bytetoword(pollblock, 4);
	winy1 = au_bytetoword(pollblock, 8);
	winx2 = au_bytetoword(pollblock, 12);
	winy2 = au_bytetoword(pollblock, 16);
	visx1 = au_bytetoword(pollblock, 28);
	visy1 = au_bytetoword(pollblock, 32);
	visx2 = au_bytetoword(pollblock, 36);
	visy2 = au_bytetoword(pollblock, 40);
	scrollx = au_bytetoword(pollblock, 20);
	scrolly = au_bytetoword(pollblock, 24);

	workx1 = visx1 + (scrollx - winx1);
	workx2 = visx2 + (scrollx - winx1);
	worky1 = visy1 + (scrolly - winy2);
	worky2 = visy2 + (scrolly - winy2);

	/* These give the work coordinates of the area needing
	 * to be redrawn */

	/* Now convert a work coordinate into a screen pixel */

	testx = 25;
	testy = -250;
	testx1 = 230;
	testy1 = -190;
	testx2 = 600;
	testy2 = -250;
	au_convertwindow_to_screen(pollblock, &testx, &testy);
	au_convertwindow_to_screen(pollblock, &testx1, &testy1);
	au_convertwindow_to_screen(pollblock, &testx2, &testy2);

	plot_sprite("screen", testx, testy, translation_buffer);
	plot_sprite("screen", testx2, testy2, translation_buffer);

	/* Re-select the right font */
	au_selectfont(font_handle);
	/* Choose the correct colours again */
	au_setfontcolours(COLOUR_WHITE, COLOUR_BLUE);
	/* Paint the text to the screen */
	au_fontpaint(sample_text, testx1, testy1);

	/* redraw window finished */
	in.r[1] = (int) pollblock;
	_kernel_swi(Wimp_GetRectangle, &in, &out);
	flag = out.r[0];
	}
}

void
setup_sprite_area(void)
{
	_kernel_swi_regs	in, out;
	char	filename[] = "<Skeleton$Dir>.Sprites";

	au_wordtobyte(SPRITE_AREA_SIZE, sprite_area, 0);
	au_wordtobyte(16, sprite_area, 8);

	in.r[0] = 256+9;
	in.r[1] = (int) sprite_area;
	_kernel_swi(OS_SpriteOp, &in, &out);

	/* Load the sprites */

	in.r[0] = 256+10;
	in.r[1] = (int) sprite_area;
	in.r[2] = (int) filename;
	_kernel_swi(OS_SpriteOp, &in, &out);

}

void
plot_sprite(char sprname[], int x_pix, int y_pix, unsigned char trans_buffer[])
{
	_kernel_swi_regs in, out;

	in.r[0] = 256+52;
	in.r[1] = (int) sprite_area; /* global variable */
	in.r[2] = (int) sprname;
	in.r[3] = x_pix;
	in.r[4] = y_pix;
	in.r[5] = 0;
	in.r[6] = 0;
	in.r[7] = (int) trans_buffer;

	_kernel_swi(OS_SpriteOp, &in, &out);
}

void
build_translation_table(char text_buffer[], unsigned char trans_buffer[])
{
	_kernel_swi_regs in, out;
	in.r[0] = (int) sprite_area;
	in.r[1] = (int) text_buffer;
	in.r[2] = -1;
	in.r[3] = -1;
	in.r[4] = (int) trans_buffer;
	in.r[5] = 0;
	_kernel_swi(ColourTrans_SelectTable, &in, &out);
}

void
setup_fonts()
{
/* Request a font handle for the chosen font, size and resolution */
	font_handle = au_findfont(font_name, font_size, font_res);
/* Now select the chosen font */
	au_selectfont(font_handle);
/* Now set up the antialiased colours */
	au_setfontcolours(COLOUR_WHITE, COLOUR_RED);
}

/* End of program */
00000000  2f 2a 20 44 65 6d 6f 20  43 20 70 72 6f 67 72 61  |/* Demo C progra|
00000010  6d 20 74 6f 20 73 68 6f  77 20 66 6f 6e 74 73 20  |m to show fonts |
00000020  77 69 74 68 69 6e 20 77  69 6e 64 6f 77 73 0a 20  |within windows. |
00000030  2a 20 53 4a 50 20 4d 75  6d 66 6f 72 64 2c 20 66  |* SJP Mumford, f|
00000040  6f 72 20 41 63 6f 72 6e  20 55 73 65 72 20 28 4f  |or Acorn User (O|
00000050  63 74 6f 62 65 72 20 31  39 39 37 29 20 2a 2f 0a  |ctober 1997) */.|
00000060  0a 23 69 6e 63 6c 75 64  65 20 3c 73 74 64 69 6f  |.#include <stdio|
00000070  2e 68 3e 0a 23 69 6e 63  6c 75 64 65 20 3c 73 74  |.h>.#include <st|
00000080  64 6c 69 62 2e 68 3e 0a  23 69 6e 63 6c 75 64 65  |dlib.h>.#include|
00000090  20 3c 73 74 72 69 6e 67  2e 68 3e 0a 23 69 6e 63  | <string.h>.#inc|
000000a0  6c 75 64 65 20 22 41 55  4c 69 62 2e 68 22 0a 0a  |lude "AULib.h"..|
000000b0  2f 2a 20 23 64 65 66 69  6e 65 73 20 2a 2f 0a 0a  |/* #defines */..|
000000c0  23 64 65 66 69 6e 65 20  4d 41 58 5f 57 49 4e 44  |#define MAX_WIND|
000000d0  4f 57 53 20 33 0a 23 64  65 66 69 6e 65 20 4d 41  |OWS 3.#define MA|
000000e0  58 5f 4d 45 4e 55 53 20  31 0a 23 64 65 66 69 6e  |X_MENUS 1.#defin|
000000f0  65 20 52 49 53 43 5f 4f  53 5f 56 45 52 53 49 4f  |e RISC_OS_VERSIO|
00000100  4e 20 33 31 30 0a 23 64  65 66 69 6e 65 20 50 4f  |N 310.#define PO|
00000110  4c 4c 5f 4d 41 53 4b 20  31 0a 23 64 65 66 69 6e  |LL_MASK 1.#defin|
00000120  65 20 53 50 52 49 54 45  5f 41 52 45 41 5f 53 49  |e SPRITE_AREA_SI|
00000130  5a 45 20 31 30 32 34 30  0a 23 64 65 66 69 6e 65  |ZE 10240.#define|
00000140  20 54 52 41 4e 53 5f 42  55 46 46 45 52 5f 53 49  | TRANS_BUFFER_SI|
00000150  5a 45 20 31 30 32 34 0a  0a 2f 2a 20 69 63 6f 6e  |ZE 1024../* icon|
00000160  62 61 72 20 6d 65 6e 75  20 2a 2f 0a 0a 23 64 65  |bar menu */..#de|
00000170  66 69 6e 65 20 51 55 49  54 5f 4f 50 54 49 4f 4e  |fine QUIT_OPTION|
00000180  20 30 0a 0a 2f 2a 20 47  6c 6f 62 61 6c 20 76 61  | 0../* Global va|
00000190  72 69 61 62 6c 65 73 20  2a 2f 0a 0a 77 69 6e 64  |riables */..wind|
000001a0  6f 77 5f 64 61 74 61 09  77 69 6e 5f 64 61 74 61  |ow_data.win_data|
000001b0  5b 4d 41 58 5f 57 49 4e  44 4f 57 53 5d 3b 0a 6d  |[MAX_WINDOWS];.m|
000001c0  65 6e 75 5f 64 61 74 61  09 6d 65 6e 5f 64 61 74  |enu_data.men_dat|
000001d0  61 5b 4d 41 58 5f 4d 45  4e 55 53 5d 3b 0a 75 6e  |a[MAX_MENUS];.un|
000001e0  73 69 67 6e 65 64 20 63  68 61 72 20 73 70 72 69  |signed char spri|
000001f0  74 65 5f 61 72 65 61 5b  53 50 52 49 54 45 5f 41  |te_area[SPRITE_A|
00000200  52 45 41 5f 53 49 5a 45  5d 3b 0a 75 6e 73 69 67  |REA_SIZE];.unsig|
00000210  6e 65 64 20 63 68 61 72  20 74 72 61 6e 73 6c 61  |ned char transla|
00000220  74 69 6f 6e 5f 62 75 66  66 65 72 5b 54 52 41 4e  |tion_buffer[TRAN|
00000230  53 5f 42 55 46 46 45 52  5f 53 49 5a 45 5d 3b 0a  |S_BUFFER_SIZE];.|
00000240  75 6e 73 69 67 6e 65 64  20 63 68 61 72 20 74 72  |unsigned char tr|
00000250  61 6e 73 6c 61 74 69 6f  6e 5f 62 75 66 66 65 72  |anslation_buffer|
00000260  32 5b 54 52 41 4e 53 5f  42 55 46 46 45 52 5f 53  |2[TRANS_BUFFER_S|
00000270  49 5a 45 5d 3b 0a 0a 69  6e 74 20 51 55 49 54 5f  |IZE];..int QUIT_|
00000280  46 4c 41 47 20 3d 20 30  3b 0a 69 6e 74 20 43 55  |FLAG = 0;.int CU|
00000290  52 52 45 4e 54 5f 4d 45  4e 55 20 3d 20 30 3b 0a  |RRENT_MENU = 0;.|
000002a0  69 6e 74 20 66 6f 6e 74  5f 68 61 6e 64 6c 65 20  |int font_handle |
000002b0  3d 20 30 3b 0a 69 6e 74  20 66 6f 6e 74 5f 73 69  |= 0;.int font_si|
000002c0  7a 65 20 3d 20 32 34 20  2a 20 31 36 3b 20 2f 2a  |ze = 24 * 16; /*|
000002d0  20 73 69 7a 65 20 69 6e  20 31 36 74 68 73 20 6f  | size in 16ths o|
000002e0  66 20 61 20 70 6f 69 6e  74 20 2a 2f 0a 69 6e 74  |f a point */.int|
000002f0  20 66 6f 6e 74 5f 72 65  73 20 3d 20 30 3b 20 2f  | font_res = 0; /|
00000300  2a 20 53 65 74 74 69 6e  67 20 74 68 69 73 20 74  |* Setting this t|
00000310  6f 20 30 20 75 73 65 73  20 74 68 65 20 64 65 66  |o 0 uses the def|
00000320  61 75 6c 74 20 66 6f 6e  74 20 72 65 73 6f 6c 75  |ault font resolu|
00000330  74 69 6f 6e 20 2a 2f 0a  69 6e 74 20 66 6f 6e 74  |tion */.int font|
00000340  5f 66 6c 61 67 73 20 3d  20 31 75 20 3c 3c 20 34  |_flags = 1u << 4|
00000350  3b 0a 63 68 61 72 20 61  70 70 6e 61 6d 65 5b 5d  |;.char appname[]|
00000360  20 3d 20 22 46 6f 6e 74  44 65 6d 6f 22 3b 0a 63  | = "FontDemo";.c|
00000370  68 61 72 20 73 70 72 6e  61 6d 65 5b 5d 20 3d 20  |har sprname[] = |
00000380  22 21 73 6b 65 6c 65 74  6f 6e 22 3b 0a 63 68 61  |"!skeleton";.cha|
00000390  72 20 66 6f 6e 74 5f 6e  61 6d 65 5b 5d 20 3d 20  |r font_name[] = |
000003a0  22 54 72 69 6e 69 74 79  2e 4d 65 64 69 75 6d 22  |"Trinity.Medium"|
000003b0  3b 0a 6c 6f 6e 67 20 69  6e 74 20 6d 73 67 6c 69  |;.long int msgli|
000003c0  73 74 5b 5d 20 3d 20 7b  30 7d 3b 0a 0a 2f 2a 20  |st[] = {0};../* |
000003d0  46 75 6e 63 74 69 6f 6e  20 70 72 6f 74 6f 74 79  |Function prototy|
000003e0  70 69 6e 67 20 2a 2f 0a  0a 69 6e 74 09 6d 61 69  |ping */..int.mai|
000003f0  6e 28 76 6f 69 64 29 3b  0a 76 6f 69 64 09 6c 6f  |n(void);.void.lo|
00000400  61 64 5f 74 65 6d 70 6c  61 74 65 73 28 76 6f 69  |ad_templates(voi|
00000410  64 29 3b 0a 76 6f 69 64  09 77 69 6d 70 5f 6d 73  |d);.void.wimp_ms|
00000420  67 28 69 6e 74 2c 20 75  6e 73 69 67 6e 65 64 20  |g(int, unsigned |
00000430  63 68 61 72 5b 5d 29 3b  0a 76 6f 69 64 09 6d 6f  |char[]);.void.mo|
00000440  75 73 65 5f 63 6c 69 63  6b 28 75 6e 73 69 67 6e  |use_click(unsign|
00000450  65 64 20 63 68 61 72 5b  5d 29 3b 0a 76 6f 69 64  |ed char[]);.void|
00000460  09 6f 70 65 6e 5f 6d 61  69 6e 5f 77 69 6e 64 6f  |.open_main_windo|
00000470  77 28 76 6f 69 64 29 3b  0a 76 6f 69 64 09 6d 65  |w(void);.void.me|
00000480  6e 75 5f 73 65 6c 65 63  74 69 6f 6e 28 75 6e 73  |nu_selection(uns|
00000490  69 67 6e 65 64 20 63 68  61 72 5b 5d 29 3b 0a 76  |igned char[]);.v|
000004a0  6f 69 64 09 6f 70 65 6e  77 69 6e 64 6f 77 28 75  |oid.openwindow(u|
000004b0  6e 73 69 67 6e 65 64 20  63 68 61 72 5b 5d 29 3b  |nsigned char[]);|
000004c0  0a 76 6f 69 64 09 63 6c  6f 73 65 77 69 6e 64 6f  |.void.closewindo|
000004d0  77 28 75 6e 73 69 67 6e  65 64 20 63 68 61 72 5b  |w(unsigned char[|
000004e0  5d 29 3b 0a 76 6f 69 64  09 72 65 64 72 61 77 5f  |]);.void.redraw_|
000004f0  77 69 6e 64 6f 77 28 75  6e 73 69 67 6e 65 64 20  |window(unsigned |
00000500  63 68 61 72 5b 5d 29 3b  0a 76 6f 69 64 09 73 65  |char[]);.void.se|
00000510  74 75 70 5f 73 70 72 69  74 65 5f 61 72 65 61 28  |tup_sprite_area(|
00000520  76 6f 69 64 29 3b 0a 76  6f 69 64 09 70 6c 6f 74  |void);.void.plot|
00000530  5f 73 70 72 69 74 65 28  63 68 61 72 20 5b 5d 2c  |_sprite(char [],|
00000540  20 69 6e 74 2c 20 69 6e  74 2c 20 75 6e 73 69 67  | int, int, unsig|
00000550  6e 65 64 20 63 68 61 72  20 5b 5d 29 3b 0a 76 6f  |ned char []);.vo|
00000560  69 64 09 62 75 69 6c 64  5f 74 72 61 6e 73 6c 61  |id.build_transla|
00000570  74 69 6f 6e 5f 74 61 62  6c 65 28 63 68 61 72 20  |tion_table(char |
00000580  5b 5d 2c 20 75 6e 73 69  67 6e 65 64 20 63 68 61  |[], unsigned cha|
00000590  72 20 5b 5d 29 3b 0a 76  6f 69 64 09 73 65 74 75  |r []);.void.setu|
000005a0  70 5f 66 6f 6e 74 73 28  76 6f 69 64 29 3b 0a 0a  |p_fonts(void);..|
000005b0  2f 2a 20 4d 61 69 6e 20  70 72 6f 67 72 61 6d 20  |/* Main program |
000005c0  2a 2f 0a 0a 69 6e 74 0a  6d 61 69 6e 28 29 0a 7b  |*/..int.main().{|
000005d0  0a 09 69 6e 74 20 74 61  73 6b 5f 68 61 6e 64 6c  |..int task_handl|
000005e0  65 2c 20 69 63 6f 6e 5f  68 61 6e 64 6c 65 3b 0a  |e, icon_handle;.|
000005f0  09 75 6e 73 69 67 6e 65  64 20 63 68 61 72 20 70  |.unsigned char p|
00000600  6f 6c 6c 5f 62 6c 6f 63  6b 5b 32 35 36 5d 3b 0a  |oll_block[256];.|
00000610  09 69 6e 74 20 70 6f 6c  6c 5f 72 65 73 75 6c 74  |.int poll_result|
00000620  2c 20 69 3b 0a 0a 09 2f  2a 20 4c 6f 61 64 20 74  |, i;.../* Load t|
00000630  65 6d 70 6c 61 74 65 73  20 61 6e 64 20 69 6e 69  |emplates and ini|
00000640  74 69 61 6c 69 73 65 20  74 68 69 6e 67 73 20 68  |tialise things h|
00000650  65 72 65 20 2a 2f 0a 0a  09 2f 2a 20 53 65 74 20  |ere */.../* Set |
00000660  75 70 20 74 68 65 20 61  70 70 6c 69 63 61 74 69  |up the applicati|
00000670  6f 6e 20 77 69 74 68 20  74 68 65 20 57 49 4d 50  |on with the WIMP|
00000680  20 2a 2f 0a 09 74 61 73  6b 5f 68 61 6e 64 6c 65  | */..task_handle|
00000690  20 3d 20 61 75 5f 69 6e  69 74 69 61 6c 69 73 65  | = au_initialise|
000006a0  28 52 49 53 43 5f 4f 53  5f 56 45 52 53 49 4f 4e  |(RISC_OS_VERSION|
000006b0  2c 20 61 70 70 6e 61 6d  65 2c 20 6d 73 67 6c 69  |, appname, msgli|
000006c0  73 74 29 3b 0a 09 69 63  6f 6e 5f 68 61 6e 64 6c  |st);..icon_handl|
000006d0  65 20 3d 20 61 75 5f 63  72 65 61 74 65 5f 69 63  |e = au_create_ic|
000006e0  6f 6e 62 61 72 5f 69 63  6f 6e 28 49 42 41 52 5f  |onbar_icon(IBAR_|
000006f0  50 52 49 4f 52 5f 41 50  50 2c 20 49 42 41 52 5f  |PRIOR_APP, IBAR_|
00000700  4f 4e 52 49 47 48 54 2c  20 49 43 4f 4e 5f 49 53  |ONRIGHT, ICON_IS|
00000710  53 50 52 49 54 45 20 7c  20 49 43 4f 4e 5f 48 43  |SPRITE | ICON_HC|
00000720  45 4e 54 52 45 20 7c 20  49 43 4f 4e 5f 56 43 45  |ENTRE | ICON_VCE|
00000730  4e 54 52 45 20 7c 20 49  43 4f 4e 5f 43 4c 49 43  |NTRE | ICON_CLIC|
00000740  4b 4e 4f 54 49 46 49 45  53 4f 4e 43 45 2c 20 73  |KNOTIFIESONCE, s|
00000750  70 72 6e 61 6d 65 29 3b  0a 0a 09 2f 2a 20 73 65  |prname);.../* se|
00000760  74 20 75 70 20 73 6f 6d  65 20 6f 74 68 65 72 20  |t up some other |
00000770  62 69 74 73 20 61 6e 64  20 70 69 65 63 65 73 20  |bits and pieces |
00000780  2a 2f 0a 09 6c 6f 61 64  5f 74 65 6d 70 6c 61 74  |*/..load_templat|
00000790  65 73 28 29 3b 0a 09 73  65 74 75 70 5f 73 70 72  |es();..setup_spr|
000007a0  69 74 65 5f 61 72 65 61  28 29 3b 0a 09 62 75 69  |ite_area();..bui|
000007b0  6c 64 5f 74 72 61 6e 73  6c 61 74 69 6f 6e 5f 74  |ld_translation_t|
000007c0  61 62 6c 65 28 22 73 63  72 65 65 6e 22 2c 20 74  |able("screen", t|
000007d0  72 61 6e 73 6c 61 74 69  6f 6e 5f 62 75 66 66 65  |ranslation_buffe|
000007e0  72 29 3b 0a 09 62 75 69  6c 64 5f 74 72 61 6e 73  |r);..build_trans|
000007f0  6c 61 74 69 6f 6e 5f 74  61 62 6c 65 28 22 74 65  |lation_table("te|
00000800  73 74 73 70 72 22 2c 20  74 72 61 6e 73 6c 61 74  |stspr", translat|
00000810  69 6f 6e 5f 62 75 66 66  65 72 32 29 3b 0a 09 73  |ion_buffer2);..s|
00000820  65 74 75 70 5f 66 6f 6e  74 73 28 29 3b 0a 0a 09  |etup_fonts();...|
00000830  77 68 69 6c 65 20 28 51  55 49 54 5f 46 4c 41 47  |while (QUIT_FLAG|
00000840  20 3d 3d 20 30 29 20 7b  0a 09 09 2f 2a 20 4d 61  | == 0) {.../* Ma|
00000850  69 6e 20 70 6f 6c 6c 69  6e 67 20 6c 6f 6f 70 20  |in polling loop |
00000860  2a 2f 0a 09 09 70 6f 6c  6c 5f 72 65 73 75 6c 74  |*/...poll_result|
00000870  20 3d 20 61 75 5f 77 69  6d 70 5f 70 6f 6c 6c 28  | = au_wimp_poll(|
00000880  50 4f 4c 4c 5f 4d 41 53  4b 2c 20 70 6f 6c 6c 5f  |POLL_MASK, poll_|
00000890  62 6c 6f 63 6b 29 3b 0a  0a 09 09 73 77 69 74 63  |block);....switc|
000008a0  68 20 28 70 6f 6c 6c 5f  72 65 73 75 6c 74 29 20  |h (poll_result) |
000008b0  7b 0a 09 09 09 63 61 73  65 20 20 31 20 3a 20 72  |{....case  1 : r|
000008c0  65 64 72 61 77 5f 77 69  6e 64 6f 77 28 70 6f 6c  |edraw_window(pol|
000008d0  6c 5f 62 6c 6f 63 6b 29  3b 0a 09 09 09 09 09 62  |l_block);......b|
000008e0  72 65 61 6b 3b 0a 09 09  09 63 61 73 65 20 20 32  |reak;....case  2|
000008f0  20 3a 20 6f 70 65 6e 77  69 6e 64 6f 77 28 70 6f  | : openwindow(po|
00000900  6c 6c 5f 62 6c 6f 63 6b  29 3b 0a 09 09 09 09 09  |ll_block);......|
00000910  62 72 65 61 6b 3b 0a 09  09 09 63 61 73 65 20 20  |break;....case  |
00000920  33 20 3a 20 63 6c 6f 73  65 77 69 6e 64 6f 77 28  |3 : closewindow(|
00000930  70 6f 6c 6c 5f 62 6c 6f  63 6b 29 3b 0a 09 09 09  |poll_block);....|
00000940  09 09 62 72 65 61 6b 3b  0a 09 09 09 63 61 73 65  |..break;....case|
00000950  20 20 36 20 3a 20 6d 6f  75 73 65 5f 63 6c 69 63  |  6 : mouse_clic|
00000960  6b 28 70 6f 6c 6c 5f 62  6c 6f 63 6b 29 3b 0a 09  |k(poll_block);..|
00000970  09 09 09 09 62 72 65 61  6b 3b 0a 09 09 09 63 61  |....break;....ca|
00000980  73 65 20 20 39 20 3a 20  6d 65 6e 75 5f 73 65 6c  |se  9 : menu_sel|
00000990  65 63 74 69 6f 6e 28 70  6f 6c 6c 5f 62 6c 6f 63  |ection(poll_bloc|
000009a0  6b 29 3b 0a 09 09 09 09  09 62 72 65 61 6b 3b 0a  |k);......break;.|
000009b0  09 09 09 63 61 73 65 20  31 37 20 3a 0a 09 09 09  |...case 17 :....|
000009c0  63 61 73 65 20 31 38 20  3a 0a 09 09 09 63 61 73  |case 18 :....cas|
000009d0  65 20 31 39 20 3a 20 77  69 6d 70 5f 6d 73 67 28  |e 19 : wimp_msg(|
000009e0  70 6f 6c 6c 5f 72 65 73  75 6c 74 2c 20 70 6f 6c  |poll_result, pol|
000009f0  6c 5f 62 6c 6f 63 6b 29  3b 0a 09 09 09 09 09 62  |l_block);......b|
00000a00  72 65 61 6b 3b 0a 09 09  7d 0a 0a 09 2f 2a 20 45  |reak;...}.../* E|
00000a10  6e 64 20 6f 66 20 6d 61  69 6e 20 70 6f 6c 6c 69  |nd of main polli|
00000a20  6e 67 20 6c 6f 6f 70 20  2a 2f 0a 09 7d 0a 0a 09  |ng loop */..}...|
00000a30  2f 2a 20 49 66 20 77 65  20 67 65 74 20 74 68 69  |/* If we get thi|
00000a40  73 20 66 61 72 2c 20 69  74 27 73 20 74 69 6d 65  |s far, it's time|
00000a50  20 74 6f 20 63 6c 6f 73  65 20 64 6f 77 6e 20 2a  | to close down *|
00000a60  2f 0a 0a 09 61 75 5f 6c  6f 73 65 66 6f 6e 74 28  |/...au_losefont(|
00000a70  66 6f 6e 74 5f 68 61 6e  64 6c 65 29 3b 0a 09 61  |font_handle);..a|
00000a80  75 5f 63 6c 6f 73 65 64  6f 77 6e 28 74 61 73 6b  |u_closedown(task|
00000a90  5f 68 61 6e 64 6c 65 29  3b 0a 0a 09 66 6f 72 28  |_handle);...for(|
00000aa0  69 20 3d 20 30 3b 20 69  20 3c 20 4d 41 58 5f 57  |i = 0; i < MAX_W|
00000ab0  49 4e 44 4f 57 53 3b 20  69 2b 2b 29 20 7b 0a 09  |INDOWS; i++) {..|
00000ac0  09 66 72 65 65 28 77 69  6e 5f 64 61 74 61 5b 69  |.free(win_data[i|
00000ad0  5d 2e 77 69 6e 5f 6e 61  6d 65 29 3b 0a 09 09 66  |].win_name);...f|
00000ae0  72 65 65 28 77 69 6e 5f  64 61 74 61 5b 69 5d 2e  |ree(win_data[i].|
00000af0  62 75 66 66 65 72 29 3b  0a 09 09 66 72 65 65 28  |buffer);...free(|
00000b00  77 69 6e 5f 64 61 74 61  5b 69 5d 2e 77 6f 72 6b  |win_data[i].work|
00000b10  73 70 61 63 65 29 3b 0a  09 7d 0a 0a 0a 7d 0a 0a  |space);..}...}..|
00000b20  76 6f 69 64 0a 6c 6f 61  64 5f 74 65 6d 70 6c 61  |void.load_templa|
00000b30  74 65 73 28 76 6f 69 64  29 0a 7b 0a 09 63 68 61  |tes(void).{..cha|
00000b40  72 20 66 69 6c 65 6e 61  6d 65 5b 5d 20 3d 20 22  |r filename[] = "|
00000b50  3c 53 6b 65 6c 65 74 6f  6e 24 44 69 72 3e 2e 54  |<Skeleton$Dir>.T|
00000b60  65 6d 70 6c 61 74 65 73  22 3b 0a 09 61 75 5f 6f  |emplates";..au_o|
00000b70  70 65 6e 74 65 6d 70 6c  61 74 65 28 66 69 6c 65  |pentemplate(file|
00000b80  6e 61 6d 65 29 3b 0a 0a  09 69 66 28 61 75 5f 6c  |name);...if(au_l|
00000b90  6f 61 64 74 65 6d 70 6c  61 74 65 28 22 4d 61 69  |oadtemplate("Mai|
00000ba0  6e 57 69 6e 64 6f 77 22  2c 20 26 77 69 6e 5f 64  |nWindow", &win_d|
00000bb0  61 74 61 5b 30 5d 2c 20  30 29 20 3d 3d 20 30 29  |ata[0], 0) == 0)|
00000bc0  20 7b 0a 09 09 61 75 5f  72 65 70 6f 72 74 5f 65  | {...au_report_e|
00000bd0  72 72 6f 72 28 31 2c 20  22 54 65 6d 70 6c 61 74  |rror(1, "Templat|
00000be0  65 20 6e 6f 74 20 66 6f  75 6e 64 21 22 2c 20 31  |e not found!", 1|
00000bf0  2c 20 61 70 70 6e 61 6d  65 29 3b 0a 09 09 51 55  |, appname);...QU|
00000c00  49 54 5f 46 4c 41 47 20  3d 20 31 3b 0a 09 7d 0a  |IT_FLAG = 1;..}.|
00000c10  0a 09 61 75 5f 63 6c 6f  73 65 74 65 6d 70 6c 61  |..au_closetempla|
00000c20  74 65 28 29 3b 0a 7d 0a  0a 76 6f 69 64 0a 77 69  |te();.}..void.wi|
00000c30  6d 70 5f 6d 73 67 28 69  6e 74 20 72 65 73 75 6c  |mp_msg(int resul|
00000c40  74 2c 20 75 6e 73 69 67  6e 65 64 20 63 68 61 72  |t, unsigned char|
00000c50  20 70 6f 6c 6c 62 6c 6f  63 6b 5b 5d 29 0a 7b 0a  | pollblock[]).{.|
00000c60  09 75 6e 73 69 67 6e 65  64 20 6c 6f 6e 67 20 69  |.unsigned long i|
00000c70  6e 74 09 6d 65 73 73 61  67 65 5f 61 63 74 69 6f  |nt.message_actio|
00000c80  6e 3b 0a 0a 09 6d 65 73  73 61 67 65 5f 61 63 74  |n;...message_act|
00000c90  69 6f 6e 20 3d 20 61 75  5f 62 79 74 65 74 6f 77  |ion = au_bytetow|
00000ca0  6f 72 64 28 70 6f 6c 6c  62 6c 6f 63 6b 2c 20 31  |ord(pollblock, 1|
00000cb0  36 29 3b 0a 0a 09 73 77  69 74 63 68 20 28 6d 65  |6);...switch (me|
00000cc0  73 73 61 67 65 5f 61 63  74 69 6f 6e 29 20 7b 0a  |ssage_action) {.|
00000cd0  09 09 63 61 73 65 20 4d  45 53 53 41 47 45 5f 51  |..case MESSAGE_Q|
00000ce0  55 49 54 20 3a 20 51 55  49 54 5f 46 4c 41 47 20  |UIT : QUIT_FLAG |
00000cf0  3d 20 31 3b 0a 09 09 09  62 72 65 61 6b 3b 0a 09  |= 1;....break;..|
00000d00  09 63 61 73 65 20 4d 45  53 53 41 47 45 5f 4d 4f  |.case MESSAGE_MO|
00000d10  44 45 43 48 41 4e 47 45  20 3a 20 62 75 69 6c 64  |DECHANGE : build|
00000d20  5f 74 72 61 6e 73 6c 61  74 69 6f 6e 5f 74 61 62  |_translation_tab|
00000d30  6c 65 28 22 73 63 72 65  65 6e 22 2c 20 74 72 61  |le("screen", tra|
00000d40  6e 73 6c 61 74 69 6f 6e  5f 62 75 66 66 65 72 29  |nslation_buffer)|
00000d50  3b 0a 09 09 09 69 66 20  28 66 6f 6e 74 5f 68 61  |;....if (font_ha|
00000d60  6e 64 6c 65 20 21 3d 20  30 29 20 61 75 5f 6c 6f  |ndle != 0) au_lo|
00000d70  73 65 66 6f 6e 74 28 66  6f 6e 74 5f 68 61 6e 64  |sefont(font_hand|
00000d80  6c 65 29 3b 0a 09 09 09  73 65 74 75 70 5f 66 6f  |le);....setup_fo|
00000d90  6e 74 73 28 29 3b 0a 09  09 09 62 72 65 61 6b 3b  |nts();....break;|
00000da0  0a 09 7d 0a 7d 0a 0a 76  6f 69 64 20 6d 6f 75 73  |..}.}..void mous|
00000db0  65 5f 63 6c 69 63 6b 28  75 6e 73 69 67 6e 65 64  |e_click(unsigned|
00000dc0  20 63 68 61 72 20 70 6f  6c 6c 5f 62 6c 6f 63 6b  | char poll_block|
00000dd0  5b 5d 29 0a 7b 0a 09 69  6e 74 09 63 6c 6b 3b 0a  |[]).{..int.clk;.|
00000de0  09 6c 6f 6e 67 20 69 6e  74 09 69 63 6f 6e 5f 6e  |.long int.icon_n|
00000df0  75 6d 3b 0a 0a 09 2f 2a  20 44 65 74 65 72 6d 69  |um;.../* Determi|
00000e00  6e 65 20 77 68 69 63 68  20 62 75 74 74 6f 6e 20  |ne which button |
00000e10  77 61 73 20 70 72 65 73  73 65 64 20 2a 2f 0a 09  |was pressed */..|
00000e20  63 6c 6b 20 3d 20 28 69  6e 74 29 20 61 75 5f 62  |clk = (int) au_b|
00000e30  79 74 65 74 6f 77 6f 72  64 28 70 6f 6c 6c 5f 62  |ytetoword(poll_b|
00000e40  6c 6f 63 6b 2c 20 38 29  3b 0a 0a 09 69 66 28 28  |lock, 8);...if((|
00000e50  61 75 5f 62 79 74 65 74  6f 77 6f 72 64 28 70 6f  |au_bytetoword(po|
00000e60  6c 6c 5f 62 6c 6f 63 6b  2c 20 31 32 29 20 3d 3d  |ll_block, 12) ==|
00000e70  20 2d 32 29 20 26 26 20  28 63 6c 6b 20 3d 3d 20  | -2) && (clk == |
00000e80  34 29 29 20 7b 0a 09 6f  70 65 6e 5f 6d 61 69 6e  |4)) {..open_main|
00000e90  5f 77 69 6e 64 6f 77 28  29 3b 0a 09 7d 0a 0a 09  |_window();..}...|
00000ea0  69 66 28 28 61 75 5f 62  79 74 65 74 6f 77 6f 72  |if((au_bytetowor|
00000eb0  64 28 70 6f 6c 6c 5f 62  6c 6f 63 6b 2c 20 31 32  |d(poll_block, 12|
00000ec0  29 20 3d 3d 20 2d 32 29  20 26 26 20 28 63 6c 6b  |) == -2) && (clk|
00000ed0  20 3d 3d 20 32 29 29 20  7b 0a 09 09 2f 2a 20 54  | == 2)) {.../* T|
00000ee0  69 6d 65 20 74 6f 20 70  72 6f 64 75 63 65 20 61  |ime to produce a|
00000ef0  20 6d 65 6e 75 20 2a 2f  0a 09 09 61 75 5f 62 75  | menu */...au_bu|
00000f00  69 6c 64 6d 65 6e 75 28  22 53 6b 65 6c 65 74 6f  |ildmenu("Skeleto|
00000f10  6e 22 2c 20 26 6d 65 6e  5f 64 61 74 61 5b 30 5d  |n", &men_data[0]|
00000f20  29 3b 0a 09 09 2f 2a 61  75 5f 61 64 64 74 6f 6d  |);.../*au_addtom|
00000f30  65 6e 75 28 22 49 6e 66  6f 22 2c 20 30 2c 20 77  |enu("Info", 0, w|
00000f40  69 6e 5f 64 61 74 61 5b  31 5d 2e 77 69 6e 5f 68  |in_data[1].win_h|
00000f50  61 6e 64 6c 65 2c 20 30  2c 20 26 6d 65 6e 5f 64  |andle, 0, &men_d|
00000f60  61 74 61 5b 30 5d 29 3b  2a 2f 0a 09 09 61 75 5f  |ata[0]);*/...au_|
00000f70  61 64 64 74 6f 6d 65 6e  75 28 22 51 75 69 74 22  |addtomenu("Quit"|
00000f80  2c 20 4d 45 4e 55 5f 4c  41 53 54 49 54 45 4d 2c  |, MENU_LASTITEM,|
00000f90  20 2d 31 2c 20 30 2c 20  26 6d 65 6e 5f 64 61 74  | -1, 0, &men_dat|
00000fa0  61 5b 30 5d 29 3b 0a 09  09 61 75 5f 63 72 65 61  |a[0]);...au_crea|
00000fb0  74 65 6d 65 6e 75 28 26  6d 65 6e 5f 64 61 74 61  |temenu(&men_data|
00000fc0  5b 30 5d 29 3b 0a 09 09  43 55 52 52 45 4e 54 5f  |[0]);...CURRENT_|
00000fd0  4d 45 4e 55 20 3d 20 31  3b 20 2f 2a 20 6b 65 65  |MENU = 1; /* kee|
00000fe0  70 20 74 72 61 63 6b 20  6f 66 20 74 68 65 20 6c  |p track of the l|
00000ff0  61 73 74 20 6d 65 6e 75  20 77 65 20 6f 70 65 6e  |ast menu we open|
00001000  65 64 20 2a 2f 0a 09 09  61 75 5f 6f 70 65 6e 6d  |ed */...au_openm|
00001010  65 6e 75 28 26 6d 65 6e  5f 64 61 74 61 5b 30 5d  |enu(&men_data[0]|
00001020  2c 20 28 69 6e 74 29 20  61 75 5f 62 79 74 65 74  |, (int) au_bytet|
00001030  6f 77 6f 72 64 28 70 6f  6c 6c 5f 62 6c 6f 63 6b  |oword(poll_block|
00001040  2c 20 30 29 20 2d 20 36  34 2c 20 28 34 34 2a 31  |, 0) - 64, (44*1|
00001050  2b 39 36 29 29 3b 0a 09  09 72 65 74 75 72 6e 3b  |+96));...return;|
00001060  0a 09 7d 0a 0a 09 2f 2a  20 43 68 65 63 6b 20 74  |..}.../* Check t|
00001070  6f 20 73 65 65 20 69 66  20 69 74 20 77 61 73 20  |o see if it was |
00001080  69 6e 20 74 68 65 20 6d  61 69 6e 20 77 69 6e 64  |in the main wind|
00001090  6f 77 20 2a 2f 0a 09 69  66 28 28 61 75 5f 62 79  |ow */..if((au_by|
000010a0  74 65 74 6f 77 6f 72 64  28 70 6f 6c 6c 5f 62 6c  |tetoword(poll_bl|
000010b0  6f 63 6b 2c 20 31 32 29  20 3d 3d 20 77 69 6e 5f  |ock, 12) == win_|
000010c0  64 61 74 61 5b 30 5d 2e  77 69 6e 5f 68 61 6e 64  |data[0].win_hand|
000010d0  6c 65 29 20 26 26 20 28  63 6c 6b 20 3d 3d 20 34  |le) && (clk == 4|
000010e0  29 29 20 7b 0a 09 09 69  63 6f 6e 5f 6e 75 6d 20  |)) {...icon_num |
000010f0  3d 20 61 75 5f 62 79 74  65 74 6f 77 6f 72 64 28  |= au_bytetoword(|
00001100  70 6f 6c 6c 5f 62 6c 6f  63 6b 2c 20 31 36 29 3b  |poll_block, 16);|
00001110  0a 09 09 73 77 69 74 63  68 20 28 69 63 6f 6e 5f  |...switch (icon_|
00001120  6e 75 6d 29 20 7b 0a 09  09 7d 0a 09 7d 0a 0a 09  |num) {...}..}...|
00001130  72 65 74 75 72 6e 3b 0a  7d 0a 0a 76 6f 69 64 20  |return;.}..void |
00001140  6f 70 65 6e 5f 6d 61 69  6e 5f 77 69 6e 64 6f 77  |open_main_window|
00001150  28 76 6f 69 64 29 0a 7b  0a 09 5f 6b 65 72 6e 65  |(void).{.._kerne|
00001160  6c 5f 73 77 69 5f 72 65  67 73 09 69 6e 2c 20 6f  |l_swi_regs.in, o|
00001170  75 74 3b 0a 09 75 6e 73  69 67 6e 65 64 20 63 68  |ut;..unsigned ch|
00001180  61 72 09 74 65 6d 70 5f  62 75 66 66 65 72 5b 31  |ar.temp_buffer[1|
00001190  30 32 34 5d 3b 0a 0a 09  61 75 5f 77 6f 72 64 74  |024];...au_wordt|
000011a0  6f 62 79 74 65 28 77 69  6e 5f 64 61 74 61 5b 30  |obyte(win_data[0|
000011b0  5d 2e 77 69 6e 5f 68 61  6e 64 6c 65 2c 20 74 65  |].win_handle, te|
000011c0  6d 70 5f 62 75 66 66 65  72 2c 20 30 29 3b 0a 0a  |mp_buffer, 0);..|
000011d0  09 69 6e 2e 72 5b 31 5d  20 3d 20 28 69 6e 74 29  |.in.r[1] = (int)|
000011e0  20 74 65 6d 70 5f 62 75  66 66 65 72 3b 0a 09 5f  | temp_buffer;.._|
000011f0  6b 65 72 6e 65 6c 5f 73  77 69 28 57 69 6d 70 5f  |kernel_swi(Wimp_|
00001200  47 65 74 57 69 6e 64 6f  77 49 6e 66 6f 2c 20 26  |GetWindowInfo, &|
00001210  69 6e 2c 20 26 6f 75 74  29 3b 0a 09 5f 6b 65 72  |in, &out);.._ker|
00001220  6e 65 6c 5f 73 77 69 28  57 69 6d 70 5f 4f 70 65  |nel_swi(Wimp_Ope|
00001230  6e 57 69 6e 64 6f 77 2c  20 26 69 6e 2c 20 26 6f  |nWindow, &in, &o|
00001240  75 74 29 3b 0a 09 72 65  74 75 72 6e 3b 0a 7d 0a  |ut);..return;.}.|
00001250  0a 76 6f 69 64 20 6d 65  6e 75 5f 73 65 6c 65 63  |.void menu_selec|
00001260  74 69 6f 6e 28 75 6e 73  69 67 6e 65 64 20 63 68  |tion(unsigned ch|
00001270  61 72 20 70 6f 6c 6c 5f  62 6c 6f 63 6b 5b 5d 29  |ar poll_block[])|
00001280  0a 7b 0a 09 6c 6f 6e 67  20 69 6e 74 09 66 69 72  |.{..long int.fir|
00001290  73 74 5f 68 69 74 3b 0a  09 69 66 20 28 43 55 52  |st_hit;..if (CUR|
000012a0  52 45 4e 54 5f 4d 45 4e  55 20 3d 3d 20 31 29 20  |RENT_MENU == 1) |
000012b0  7b 0a 09 09 66 69 72 73  74 5f 68 69 74 20 3d 20  |{...first_hit = |
000012c0  61 75 5f 62 79 74 65 74  6f 77 6f 72 64 28 70 6f  |au_bytetoword(po|
000012d0  6c 6c 5f 62 6c 6f 63 6b  2c 20 30 29 3b 0a 09 09  |ll_block, 0);...|
000012e0  69 66 20 28 66 69 72 73  74 5f 68 69 74 20 3d 3d  |if (first_hit ==|
000012f0  20 51 55 49 54 5f 4f 50  54 49 4f 4e 29 20 7b 0a  | QUIT_OPTION) {.|
00001300  09 09 09 51 55 49 54 5f  46 4c 41 47 20 3d 20 31  |...QUIT_FLAG = 1|
00001310  3b 0a 09 09 7d 0a 09 7d  0a 09 43 55 52 52 45 4e  |;...}..}..CURREN|
00001320  54 5f 4d 45 4e 55 20 3d  20 30 3b 0a 09 72 65 74  |T_MENU = 0;..ret|
00001330  75 72 6e 3b 0a 7d 0a 0a  76 6f 69 64 0a 6f 70 65  |urn;.}..void.ope|
00001340  6e 77 69 6e 64 6f 77 28  75 6e 73 69 67 6e 65 64  |nwindow(unsigned|
00001350  20 63 68 61 72 20 70 6f  6c 6c 62 6c 6f 63 6b 5b  | char pollblock[|
00001360  5d 29 0a 7b 0a 20 20 20  5f 6b 65 72 6e 65 6c 5f  |]).{.   _kernel_|
00001370  73 77 69 5f 72 65 67 73  20 69 6e 2c 20 6f 75 74  |swi_regs in, out|
00001380  3b 0a 0a 20 20 20 69 6e  2e 72 5b 31 5d 20 3d 20  |;..   in.r[1] = |
00001390  28 69 6e 74 29 20 70 6f  6c 6c 62 6c 6f 63 6b 3b  |(int) pollblock;|
000013a0  0a 20 20 20 5f 6b 65 72  6e 65 6c 5f 73 77 69 28  |.   _kernel_swi(|
000013b0  57 69 6d 70 5f 4f 70 65  6e 57 69 6e 64 6f 77 2c  |Wimp_OpenWindow,|
000013c0  20 26 69 6e 2c 20 26 6f  75 74 29 3b 0a 20 20 20  | &in, &out);.   |
000013d0  72 65 74 75 72 6e 3b 0a  7d 0a 0a 76 6f 69 64 0a  |return;.}..void.|
000013e0  63 6c 6f 73 65 77 69 6e  64 6f 77 28 75 6e 73 69  |closewindow(unsi|
000013f0  67 6e 65 64 20 63 68 61  72 20 70 6f 6c 6c 62 6c  |gned char pollbl|
00001400  6f 63 6b 5b 5d 29 0a 7b  0a 20 20 20 5f 6b 65 72  |ock[]).{.   _ker|
00001410  6e 65 6c 5f 73 77 69 5f  72 65 67 73 20 69 6e 2c  |nel_swi_regs in,|
00001420  20 6f 75 74 3b 0a 0a 20  20 20 69 6e 2e 72 5b 31  | out;..   in.r[1|
00001430  5d 20 3d 20 28 69 6e 74  29 20 70 6f 6c 6c 62 6c  |] = (int) pollbl|
00001440  6f 63 6b 3b 0a 20 20 20  5f 6b 65 72 6e 65 6c 5f  |ock;.   _kernel_|
00001450  73 77 69 28 57 69 6d 70  5f 43 6c 6f 73 65 57 69  |swi(Wimp_CloseWi|
00001460  6e 64 6f 77 2c 20 26 69  6e 2c 20 26 6f 75 74 29  |ndow, &in, &out)|
00001470  3b 0a 20 20 20 72 65 74  75 72 6e 3b 0a 7d 0a 0a  |;.   return;.}..|
00001480  76 6f 69 64 0a 72 65 64  72 61 77 5f 77 69 6e 64  |void.redraw_wind|
00001490  6f 77 28 75 6e 73 69 67  6e 65 64 20 63 68 61 72  |ow(unsigned char|
000014a0  20 70 6f 6c 6c 62 6c 6f  63 6b 5b 5d 29 0a 7b 0a  | pollblock[]).{.|
000014b0  09 5f 6b 65 72 6e 65 6c  5f 73 77 69 5f 72 65 67  |._kernel_swi_reg|
000014c0  73 09 69 6e 2c 20 6f 75  74 3b 0a 09 69 6e 74 20  |s.in, out;..int |
000014d0  66 6c 61 67 20 3d 20 30  3b 0a 09 6c 6f 6e 67 20  |flag = 0;..long |
000014e0  69 6e 74 20 76 69 73 78  31 2c 20 76 69 73 78 32  |int visx1, visx2|
000014f0  2c 20 76 69 73 79 31 2c  20 76 69 73 79 32 3b 0a  |, visy1, visy2;.|
00001500  09 6c 6f 6e 67 20 69 6e  74 20 77 69 6e 78 31 2c  |.long int winx1,|
00001510  20 77 69 6e 78 32 2c 20  77 69 6e 79 31 2c 20 77  | winx2, winy1, w|
00001520  69 6e 79 32 3b 0a 09 6c  6f 6e 67 20 69 6e 74 20  |iny2;..long int |
00001530  77 6f 72 6b 78 31 2c 20  77 6f 72 6b 78 32 2c 20  |workx1, workx2, |
00001540  77 6f 72 6b 79 31 2c 20  77 6f 72 6b 79 32 3b 0a  |worky1, worky2;.|
00001550  09 6c 6f 6e 67 20 69 6e  74 20 73 63 72 6f 6c 6c  |.long int scroll|
00001560  78 2c 20 73 63 72 6f 6c  6c 79 3b 0a 09 69 6e 74  |x, scrolly;..int|
00001570  20 74 65 73 74 78 2c 20  74 65 73 74 79 3b 0a 09  | testx, testy;..|
00001580  69 6e 74 20 74 65 73 74  78 31 2c 20 74 65 73 74  |int testx1, test|
00001590  78 32 2c 20 74 65 73 74  79 31 2c 20 74 65 73 74  |x2, testy1, test|
000015a0  79 32 3b 0a 09 63 68 61  72 20 73 61 6d 70 6c 65  |y2;..char sample|
000015b0  5f 74 65 78 74 5b 5d 20  3d 20 22 48 65 6c 6c 6f  |_text[] = "Hello|
000015c0  20 57 6f 72 6c 64 21 22  3b 0a 0a 09 69 6e 2e 72  | World!";...in.r|
000015d0  5b 31 5d 20 3d 20 28 69  6e 74 29 20 70 6f 6c 6c  |[1] = (int) poll|
000015e0  62 6c 6f 63 6b 3b 0a 0a  09 5f 6b 65 72 6e 65 6c  |block;..._kernel|
000015f0  5f 73 77 69 28 57 69 6d  70 5f 52 65 64 72 61 77  |_swi(Wimp_Redraw|
00001600  57 69 6e 64 6f 77 2c 20  26 69 6e 2c 20 26 6f 75  |Window, &in, &ou|
00001610  74 29 3b 0a 09 66 6c 61  67 20 3d 20 6f 75 74 2e  |t);..flag = out.|
00001620  72 5b 30 5d 3b 0a 0a 09  77 68 69 6c 65 20 28 66  |r[0];...while (f|
00001630  6c 61 67 29 20 7b 0a 09  2f 2a 20 72 65 64 72 61  |lag) {../* redra|
00001640  77 20 77 69 6e 64 6f 77  20 68 65 72 65 20 2a 2f  |w window here */|
00001650  0a 09 77 69 6e 78 31 20  3d 20 61 75 5f 62 79 74  |..winx1 = au_byt|
00001660  65 74 6f 77 6f 72 64 28  70 6f 6c 6c 62 6c 6f 63  |etoword(pollbloc|
00001670  6b 2c 20 34 29 3b 0a 09  77 69 6e 79 31 20 3d 20  |k, 4);..winy1 = |
00001680  61 75 5f 62 79 74 65 74  6f 77 6f 72 64 28 70 6f  |au_bytetoword(po|
00001690  6c 6c 62 6c 6f 63 6b 2c  20 38 29 3b 0a 09 77 69  |llblock, 8);..wi|
000016a0  6e 78 32 20 3d 20 61 75  5f 62 79 74 65 74 6f 77  |nx2 = au_bytetow|
000016b0  6f 72 64 28 70 6f 6c 6c  62 6c 6f 63 6b 2c 20 31  |ord(pollblock, 1|
000016c0  32 29 3b 0a 09 77 69 6e  79 32 20 3d 20 61 75 5f  |2);..winy2 = au_|
000016d0  62 79 74 65 74 6f 77 6f  72 64 28 70 6f 6c 6c 62  |bytetoword(pollb|
000016e0  6c 6f 63 6b 2c 20 31 36  29 3b 0a 09 76 69 73 78  |lock, 16);..visx|
000016f0  31 20 3d 20 61 75 5f 62  79 74 65 74 6f 77 6f 72  |1 = au_bytetowor|
00001700  64 28 70 6f 6c 6c 62 6c  6f 63 6b 2c 20 32 38 29  |d(pollblock, 28)|
00001710  3b 0a 09 76 69 73 79 31  20 3d 20 61 75 5f 62 79  |;..visy1 = au_by|
00001720  74 65 74 6f 77 6f 72 64  28 70 6f 6c 6c 62 6c 6f  |tetoword(pollblo|
00001730  63 6b 2c 20 33 32 29 3b  0a 09 76 69 73 78 32 20  |ck, 32);..visx2 |
00001740  3d 20 61 75 5f 62 79 74  65 74 6f 77 6f 72 64 28  |= au_bytetoword(|
00001750  70 6f 6c 6c 62 6c 6f 63  6b 2c 20 33 36 29 3b 0a  |pollblock, 36);.|
00001760  09 76 69 73 79 32 20 3d  20 61 75 5f 62 79 74 65  |.visy2 = au_byte|
00001770  74 6f 77 6f 72 64 28 70  6f 6c 6c 62 6c 6f 63 6b  |toword(pollblock|
00001780  2c 20 34 30 29 3b 0a 09  73 63 72 6f 6c 6c 78 20  |, 40);..scrollx |
00001790  3d 20 61 75 5f 62 79 74  65 74 6f 77 6f 72 64 28  |= au_bytetoword(|
000017a0  70 6f 6c 6c 62 6c 6f 63  6b 2c 20 32 30 29 3b 0a  |pollblock, 20);.|
000017b0  09 73 63 72 6f 6c 6c 79  20 3d 20 61 75 5f 62 79  |.scrolly = au_by|
000017c0  74 65 74 6f 77 6f 72 64  28 70 6f 6c 6c 62 6c 6f  |tetoword(pollblo|
000017d0  63 6b 2c 20 32 34 29 3b  0a 0a 09 77 6f 72 6b 78  |ck, 24);...workx|
000017e0  31 20 3d 20 76 69 73 78  31 20 2b 20 28 73 63 72  |1 = visx1 + (scr|
000017f0  6f 6c 6c 78 20 2d 20 77  69 6e 78 31 29 3b 0a 09  |ollx - winx1);..|
00001800  77 6f 72 6b 78 32 20 3d  20 76 69 73 78 32 20 2b  |workx2 = visx2 +|
00001810  20 28 73 63 72 6f 6c 6c  78 20 2d 20 77 69 6e 78  | (scrollx - winx|
00001820  31 29 3b 0a 09 77 6f 72  6b 79 31 20 3d 20 76 69  |1);..worky1 = vi|
00001830  73 79 31 20 2b 20 28 73  63 72 6f 6c 6c 79 20 2d  |sy1 + (scrolly -|
00001840  20 77 69 6e 79 32 29 3b  0a 09 77 6f 72 6b 79 32  | winy2);..worky2|
00001850  20 3d 20 76 69 73 79 32  20 2b 20 28 73 63 72 6f  | = visy2 + (scro|
00001860  6c 6c 79 20 2d 20 77 69  6e 79 32 29 3b 0a 0a 09  |lly - winy2);...|
00001870  2f 2a 20 54 68 65 73 65  20 67 69 76 65 20 74 68  |/* These give th|
00001880  65 20 77 6f 72 6b 20 63  6f 6f 72 64 69 6e 61 74  |e work coordinat|
00001890  65 73 20 6f 66 20 74 68  65 20 61 72 65 61 20 6e  |es of the area n|
000018a0  65 65 64 69 6e 67 0a 09  20 2a 20 74 6f 20 62 65  |eeding.. * to be|
000018b0  20 72 65 64 72 61 77 6e  20 2a 2f 0a 0a 09 2f 2a  | redrawn */.../*|
000018c0  20 4e 6f 77 20 63 6f 6e  76 65 72 74 20 61 20 77  | Now convert a w|
000018d0  6f 72 6b 20 63 6f 6f 72  64 69 6e 61 74 65 20 69  |ork coordinate i|
000018e0  6e 74 6f 20 61 20 73 63  72 65 65 6e 20 70 69 78  |nto a screen pix|
000018f0  65 6c 20 2a 2f 0a 0a 09  74 65 73 74 78 20 3d 20  |el */...testx = |
00001900  32 35 3b 0a 09 74 65 73  74 79 20 3d 20 2d 32 35  |25;..testy = -25|
00001910  30 3b 0a 09 74 65 73 74  78 31 20 3d 20 32 33 30  |0;..testx1 = 230|
00001920  3b 0a 09 74 65 73 74 79  31 20 3d 20 2d 31 39 30  |;..testy1 = -190|
00001930  3b 0a 09 74 65 73 74 78  32 20 3d 20 36 30 30 3b  |;..testx2 = 600;|
00001940  0a 09 74 65 73 74 79 32  20 3d 20 2d 32 35 30 3b  |..testy2 = -250;|
00001950  0a 09 61 75 5f 63 6f 6e  76 65 72 74 77 69 6e 64  |..au_convertwind|
00001960  6f 77 5f 74 6f 5f 73 63  72 65 65 6e 28 70 6f 6c  |ow_to_screen(pol|
00001970  6c 62 6c 6f 63 6b 2c 20  26 74 65 73 74 78 2c 20  |lblock, &testx, |
00001980  26 74 65 73 74 79 29 3b  0a 09 61 75 5f 63 6f 6e  |&testy);..au_con|
00001990  76 65 72 74 77 69 6e 64  6f 77 5f 74 6f 5f 73 63  |vertwindow_to_sc|
000019a0  72 65 65 6e 28 70 6f 6c  6c 62 6c 6f 63 6b 2c 20  |reen(pollblock, |
000019b0  26 74 65 73 74 78 31 2c  20 26 74 65 73 74 79 31  |&testx1, &testy1|
000019c0  29 3b 0a 09 61 75 5f 63  6f 6e 76 65 72 74 77 69  |);..au_convertwi|
000019d0  6e 64 6f 77 5f 74 6f 5f  73 63 72 65 65 6e 28 70  |ndow_to_screen(p|
000019e0  6f 6c 6c 62 6c 6f 63 6b  2c 20 26 74 65 73 74 78  |ollblock, &testx|
000019f0  32 2c 20 26 74 65 73 74  79 32 29 3b 0a 0a 09 70  |2, &testy2);...p|
00001a00  6c 6f 74 5f 73 70 72 69  74 65 28 22 73 63 72 65  |lot_sprite("scre|
00001a10  65 6e 22 2c 20 74 65 73  74 78 2c 20 74 65 73 74  |en", testx, test|
00001a20  79 2c 20 74 72 61 6e 73  6c 61 74 69 6f 6e 5f 62  |y, translation_b|
00001a30  75 66 66 65 72 29 3b 0a  09 70 6c 6f 74 5f 73 70  |uffer);..plot_sp|
00001a40  72 69 74 65 28 22 73 63  72 65 65 6e 22 2c 20 74  |rite("screen", t|
00001a50  65 73 74 78 32 2c 20 74  65 73 74 79 32 2c 20 74  |estx2, testy2, t|
00001a60  72 61 6e 73 6c 61 74 69  6f 6e 5f 62 75 66 66 65  |ranslation_buffe|
00001a70  72 29 3b 0a 0a 09 2f 2a  20 52 65 2d 73 65 6c 65  |r);.../* Re-sele|
00001a80  63 74 20 74 68 65 20 72  69 67 68 74 20 66 6f 6e  |ct the right fon|
00001a90  74 20 2a 2f 0a 09 61 75  5f 73 65 6c 65 63 74 66  |t */..au_selectf|
00001aa0  6f 6e 74 28 66 6f 6e 74  5f 68 61 6e 64 6c 65 29  |ont(font_handle)|
00001ab0  3b 0a 09 2f 2a 20 43 68  6f 6f 73 65 20 74 68 65  |;../* Choose the|
00001ac0  20 63 6f 72 72 65 63 74  20 63 6f 6c 6f 75 72 73  | correct colours|
00001ad0  20 61 67 61 69 6e 20 2a  2f 0a 09 61 75 5f 73 65  | again */..au_se|
00001ae0  74 66 6f 6e 74 63 6f 6c  6f 75 72 73 28 43 4f 4c  |tfontcolours(COL|
00001af0  4f 55 52 5f 57 48 49 54  45 2c 20 43 4f 4c 4f 55  |OUR_WHITE, COLOU|
00001b00  52 5f 42 4c 55 45 29 3b  0a 09 2f 2a 20 50 61 69  |R_BLUE);../* Pai|
00001b10  6e 74 20 74 68 65 20 74  65 78 74 20 74 6f 20 74  |nt the text to t|
00001b20  68 65 20 73 63 72 65 65  6e 20 2a 2f 0a 09 61 75  |he screen */..au|
00001b30  5f 66 6f 6e 74 70 61 69  6e 74 28 73 61 6d 70 6c  |_fontpaint(sampl|
00001b40  65 5f 74 65 78 74 2c 20  74 65 73 74 78 31 2c 20  |e_text, testx1, |
00001b50  74 65 73 74 79 31 29 3b  0a 0a 09 2f 2a 20 72 65  |testy1);.../* re|
00001b60  64 72 61 77 20 77 69 6e  64 6f 77 20 66 69 6e 69  |draw window fini|
00001b70  73 68 65 64 20 2a 2f 0a  09 69 6e 2e 72 5b 31 5d  |shed */..in.r[1]|
00001b80  20 3d 20 28 69 6e 74 29  20 70 6f 6c 6c 62 6c 6f  | = (int) pollblo|
00001b90  63 6b 3b 0a 09 5f 6b 65  72 6e 65 6c 5f 73 77 69  |ck;.._kernel_swi|
00001ba0  28 57 69 6d 70 5f 47 65  74 52 65 63 74 61 6e 67  |(Wimp_GetRectang|
00001bb0  6c 65 2c 20 26 69 6e 2c  20 26 6f 75 74 29 3b 0a  |le, &in, &out);.|
00001bc0  09 66 6c 61 67 20 3d 20  6f 75 74 2e 72 5b 30 5d  |.flag = out.r[0]|
00001bd0  3b 0a 09 7d 0a 7d 0a 0a  76 6f 69 64 0a 73 65 74  |;..}.}..void.set|
00001be0  75 70 5f 73 70 72 69 74  65 5f 61 72 65 61 28 76  |up_sprite_area(v|
00001bf0  6f 69 64 29 0a 7b 0a 09  5f 6b 65 72 6e 65 6c 5f  |oid).{.._kernel_|
00001c00  73 77 69 5f 72 65 67 73  09 69 6e 2c 20 6f 75 74  |swi_regs.in, out|
00001c10  3b 0a 09 63 68 61 72 09  66 69 6c 65 6e 61 6d 65  |;..char.filename|
00001c20  5b 5d 20 3d 20 22 3c 53  6b 65 6c 65 74 6f 6e 24  |[] = "<Skeleton$|
00001c30  44 69 72 3e 2e 53 70 72  69 74 65 73 22 3b 0a 0a  |Dir>.Sprites";..|
00001c40  09 61 75 5f 77 6f 72 64  74 6f 62 79 74 65 28 53  |.au_wordtobyte(S|
00001c50  50 52 49 54 45 5f 41 52  45 41 5f 53 49 5a 45 2c  |PRITE_AREA_SIZE,|
00001c60  20 73 70 72 69 74 65 5f  61 72 65 61 2c 20 30 29  | sprite_area, 0)|
00001c70  3b 0a 09 61 75 5f 77 6f  72 64 74 6f 62 79 74 65  |;..au_wordtobyte|
00001c80  28 31 36 2c 20 73 70 72  69 74 65 5f 61 72 65 61  |(16, sprite_area|
00001c90  2c 20 38 29 3b 0a 0a 09  69 6e 2e 72 5b 30 5d 20  |, 8);...in.r[0] |
00001ca0  3d 20 32 35 36 2b 39 3b  0a 09 69 6e 2e 72 5b 31  |= 256+9;..in.r[1|
00001cb0  5d 20 3d 20 28 69 6e 74  29 20 73 70 72 69 74 65  |] = (int) sprite|
00001cc0  5f 61 72 65 61 3b 0a 09  5f 6b 65 72 6e 65 6c 5f  |_area;.._kernel_|
00001cd0  73 77 69 28 4f 53 5f 53  70 72 69 74 65 4f 70 2c  |swi(OS_SpriteOp,|
00001ce0  20 26 69 6e 2c 20 26 6f  75 74 29 3b 0a 0a 09 2f  | &in, &out);.../|
00001cf0  2a 20 4c 6f 61 64 20 74  68 65 20 73 70 72 69 74  |* Load the sprit|
00001d00  65 73 20 2a 2f 0a 0a 09  69 6e 2e 72 5b 30 5d 20  |es */...in.r[0] |
00001d10  3d 20 32 35 36 2b 31 30  3b 0a 09 69 6e 2e 72 5b  |= 256+10;..in.r[|
00001d20  31 5d 20 3d 20 28 69 6e  74 29 20 73 70 72 69 74  |1] = (int) sprit|
00001d30  65 5f 61 72 65 61 3b 0a  09 69 6e 2e 72 5b 32 5d  |e_area;..in.r[2]|
00001d40  20 3d 20 28 69 6e 74 29  20 66 69 6c 65 6e 61 6d  | = (int) filenam|
00001d50  65 3b 0a 09 5f 6b 65 72  6e 65 6c 5f 73 77 69 28  |e;.._kernel_swi(|
00001d60  4f 53 5f 53 70 72 69 74  65 4f 70 2c 20 26 69 6e  |OS_SpriteOp, &in|
00001d70  2c 20 26 6f 75 74 29 3b  0a 0a 7d 0a 0a 76 6f 69  |, &out);..}..voi|
00001d80  64 0a 70 6c 6f 74 5f 73  70 72 69 74 65 28 63 68  |d.plot_sprite(ch|
00001d90  61 72 20 73 70 72 6e 61  6d 65 5b 5d 2c 20 69 6e  |ar sprname[], in|
00001da0  74 20 78 5f 70 69 78 2c  20 69 6e 74 20 79 5f 70  |t x_pix, int y_p|
00001db0  69 78 2c 20 75 6e 73 69  67 6e 65 64 20 63 68 61  |ix, unsigned cha|
00001dc0  72 20 74 72 61 6e 73 5f  62 75 66 66 65 72 5b 5d  |r trans_buffer[]|
00001dd0  29 0a 7b 0a 09 5f 6b 65  72 6e 65 6c 5f 73 77 69  |).{.._kernel_swi|
00001de0  5f 72 65 67 73 20 69 6e  2c 20 6f 75 74 3b 0a 0a  |_regs in, out;..|
00001df0  09 69 6e 2e 72 5b 30 5d  20 3d 20 32 35 36 2b 35  |.in.r[0] = 256+5|
00001e00  32 3b 0a 09 69 6e 2e 72  5b 31 5d 20 3d 20 28 69  |2;..in.r[1] = (i|
00001e10  6e 74 29 20 73 70 72 69  74 65 5f 61 72 65 61 3b  |nt) sprite_area;|
00001e20  20 2f 2a 20 67 6c 6f 62  61 6c 20 76 61 72 69 61  | /* global varia|
00001e30  62 6c 65 20 2a 2f 0a 09  69 6e 2e 72 5b 32 5d 20  |ble */..in.r[2] |
00001e40  3d 20 28 69 6e 74 29 20  73 70 72 6e 61 6d 65 3b  |= (int) sprname;|
00001e50  0a 09 69 6e 2e 72 5b 33  5d 20 3d 20 78 5f 70 69  |..in.r[3] = x_pi|
00001e60  78 3b 0a 09 69 6e 2e 72  5b 34 5d 20 3d 20 79 5f  |x;..in.r[4] = y_|
00001e70  70 69 78 3b 0a 09 69 6e  2e 72 5b 35 5d 20 3d 20  |pix;..in.r[5] = |
00001e80  30 3b 0a 09 69 6e 2e 72  5b 36 5d 20 3d 20 30 3b  |0;..in.r[6] = 0;|
00001e90  0a 09 69 6e 2e 72 5b 37  5d 20 3d 20 28 69 6e 74  |..in.r[7] = (int|
00001ea0  29 20 74 72 61 6e 73 5f  62 75 66 66 65 72 3b 0a  |) trans_buffer;.|
00001eb0  0a 09 5f 6b 65 72 6e 65  6c 5f 73 77 69 28 4f 53  |.._kernel_swi(OS|
00001ec0  5f 53 70 72 69 74 65 4f  70 2c 20 26 69 6e 2c 20  |_SpriteOp, &in, |
00001ed0  26 6f 75 74 29 3b 0a 7d  0a 0a 76 6f 69 64 0a 62  |&out);.}..void.b|
00001ee0  75 69 6c 64 5f 74 72 61  6e 73 6c 61 74 69 6f 6e  |uild_translation|
00001ef0  5f 74 61 62 6c 65 28 63  68 61 72 20 74 65 78 74  |_table(char text|
00001f00  5f 62 75 66 66 65 72 5b  5d 2c 20 75 6e 73 69 67  |_buffer[], unsig|
00001f10  6e 65 64 20 63 68 61 72  20 74 72 61 6e 73 5f 62  |ned char trans_b|
00001f20  75 66 66 65 72 5b 5d 29  0a 7b 0a 09 5f 6b 65 72  |uffer[]).{.._ker|
00001f30  6e 65 6c 5f 73 77 69 5f  72 65 67 73 20 69 6e 2c  |nel_swi_regs in,|
00001f40  20 6f 75 74 3b 0a 09 69  6e 2e 72 5b 30 5d 20 3d  | out;..in.r[0] =|
00001f50  20 28 69 6e 74 29 20 73  70 72 69 74 65 5f 61 72  | (int) sprite_ar|
00001f60  65 61 3b 0a 09 69 6e 2e  72 5b 31 5d 20 3d 20 28  |ea;..in.r[1] = (|
00001f70  69 6e 74 29 20 74 65 78  74 5f 62 75 66 66 65 72  |int) text_buffer|
00001f80  3b 0a 09 69 6e 2e 72 5b  32 5d 20 3d 20 2d 31 3b  |;..in.r[2] = -1;|
00001f90  0a 09 69 6e 2e 72 5b 33  5d 20 3d 20 2d 31 3b 0a  |..in.r[3] = -1;.|
00001fa0  09 69 6e 2e 72 5b 34 5d  20 3d 20 28 69 6e 74 29  |.in.r[4] = (int)|
00001fb0  20 74 72 61 6e 73 5f 62  75 66 66 65 72 3b 0a 09  | trans_buffer;..|
00001fc0  69 6e 2e 72 5b 35 5d 20  3d 20 30 3b 0a 09 5f 6b  |in.r[5] = 0;.._k|
00001fd0  65 72 6e 65 6c 5f 73 77  69 28 43 6f 6c 6f 75 72  |ernel_swi(Colour|
00001fe0  54 72 61 6e 73 5f 53 65  6c 65 63 74 54 61 62 6c  |Trans_SelectTabl|
00001ff0  65 2c 20 26 69 6e 2c 20  26 6f 75 74 29 3b 0a 7d  |e, &in, &out);.}|
00002000  0a 0a 76 6f 69 64 0a 73  65 74 75 70 5f 66 6f 6e  |..void.setup_fon|
00002010  74 73 28 29 0a 7b 0a 2f  2a 20 52 65 71 75 65 73  |ts().{./* Reques|
00002020  74 20 61 20 66 6f 6e 74  20 68 61 6e 64 6c 65 20  |t a font handle |
00002030  66 6f 72 20 74 68 65 20  63 68 6f 73 65 6e 20 66  |for the chosen f|
00002040  6f 6e 74 2c 20 73 69 7a  65 20 61 6e 64 20 72 65  |ont, size and re|
00002050  73 6f 6c 75 74 69 6f 6e  20 2a 2f 0a 09 66 6f 6e  |solution */..fon|
00002060  74 5f 68 61 6e 64 6c 65  20 3d 20 61 75 5f 66 69  |t_handle = au_fi|
00002070  6e 64 66 6f 6e 74 28 66  6f 6e 74 5f 6e 61 6d 65  |ndfont(font_name|
00002080  2c 20 66 6f 6e 74 5f 73  69 7a 65 2c 20 66 6f 6e  |, font_size, fon|
00002090  74 5f 72 65 73 29 3b 0a  2f 2a 20 4e 6f 77 20 73  |t_res);./* Now s|
000020a0  65 6c 65 63 74 20 74 68  65 20 63 68 6f 73 65 6e  |elect the chosen|
000020b0  20 66 6f 6e 74 20 2a 2f  0a 09 61 75 5f 73 65 6c  | font */..au_sel|
000020c0  65 63 74 66 6f 6e 74 28  66 6f 6e 74 5f 68 61 6e  |ectfont(font_han|
000020d0  64 6c 65 29 3b 0a 2f 2a  20 4e 6f 77 20 73 65 74  |dle);./* Now set|
000020e0  20 75 70 20 74 68 65 20  61 6e 74 69 61 6c 69 61  | up the antialia|
000020f0  73 65 64 20 63 6f 6c 6f  75 72 73 20 2a 2f 0a 09  |sed colours */..|
00002100  61 75 5f 73 65 74 66 6f  6e 74 63 6f 6c 6f 75 72  |au_setfontcolour|
00002110  73 28 43 4f 4c 4f 55 52  5f 57 48 49 54 45 2c 20  |s(COLOUR_WHITE, |
00002120  43 4f 4c 4f 55 52 5f 52  45 44 29 3b 0a 7d 0a 0a  |COLOUR_RED);.}..|
00002130  2f 2a 20 45 6e 64 20 6f  66 20 70 72 6f 67 72 61  |/* End of progra|
00002140  6d 20 2a 2f 0a                                    |m */.|
00002145