Home » Archimedes archive » Acorn User » AU 1997-06 B.adf » Regulars » WimpC/!SpriteOp/c/!RunImage

WimpC/!SpriteOp/c/!RunImage

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-06 B.adf » Regulars
Filename: WimpC/!SpriteOp/c/!RunImage
Read OK:
File size: 0CA2 bytes
Load address: 0000
Exec address: 0000
Duplicates

There is 1 duplicate copy of this file in the archive:

File contents
/* Simple program to demonstrate sprite plotting
 * SJP Mumford, March 1997 */
/* Stage 1 - non-multitasking */

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

#define SPRITE_AREA_SIZE 10240
#define TRANS_BUFFER_SIZE 1024
#define TRUE -1
#define FALSE 0

/* Global variables */

unsigned char	sprite_area[SPRITE_AREA_SIZE];
unsigned char	translation_buffer[TRANS_BUFFER_SIZE];

/* Prototyping */

int	main(void);

int
main()
{
	_kernel_swi_regs	regs_in, regs_out;
	char	filename[] = "<SpriteOp$Dir>.Sprites";
	char	text_buffer[255];
	int	x;

	/* Prepare user sprite area - need to set up
	 * values in !0 and !0+8 */

	au_wordtobyte(SPRITE_AREA_SIZE, sprite_area, 0);
	au_wordtobyte(16, sprite_area, 8); /* no extension area */

	regs_in.r[0] = 256+9; /* 'Initialise USER sprite area' */
	regs_in.r[1] = (int) sprite_area;
	_kernel_swi(OS_SpriteOp, &regs_in, &regs_out);

	/* Now the sprite area has been created, we'd better prove
	 * it exists  - let's load a sprite */

	printf("Status of user sprite area before loading...\n");
	regs_in.r[0] = 256+8;
	regs_in.r[1] = (int) sprite_area;
	_kernel_swi(OS_SpriteOp, &regs_in, &regs_out);
	printf("Total size = %d\nNo. of sprites = %d\n\n", regs_out.r[2], regs_out.r[3]);

	regs_in.r[0] = 256+10; /* load sprite into USER area */
	regs_in.r[1] = (int) sprite_area;
	regs_in.r[2] = (int) filename;
	_kernel_swi(OS_SpriteOp, &regs_in, &regs_out);

	printf("Status of user sprite area after loading...\n");
	regs_in.r[0] = 256+8;
	regs_in.r[1] = (int) sprite_area;
	_kernel_swi(OS_SpriteOp, &regs_in, &regs_out);
	printf("Total size = %d\nNo. of sprites = %d\n\n", regs_out.r[2], regs_out.r[3]);

	/* Now let's try plotting it */

	/* First, set up a pixel translation table */

	printf("Setting up pixel translation table...\n");
	regs_in.r[0] = (int) sprite_area;
	strcpy(text_buffer, "screen");
	regs_in.r[1] = (int) text_buffer;
	regs_in.r[2] = -1;
	regs_in.r[3] = -1;
	regs_in.r[4] = 0; /* find out how much space we need */
	regs_in.r[5] = 0; /* default flags; use sprite name in R1 */
	_kernel_swi(ColourTrans_SelectTable, &regs_in, &regs_out);

	printf("Required space for translation buffer = %d\n\n", regs_out.r[4]);

	regs_in.r[0] = (int) sprite_area;
	strcpy(text_buffer, "screen");
	regs_in.r[1] = (int) text_buffer;
	regs_in.r[2] = -1;
	regs_in.r[3] = -1;
	regs_in.r[4] = (int) translation_buffer;
	regs_in.r[5] = 0; /* default flags; use sprite name in R1 */
	_kernel_swi(ColourTrans_SelectTable, &regs_in, &regs_out);

	printf("Now plot a sprite...\n");
	for(x = 0; x < 1280; x+=160){
		regs_in.r[0] = 256+52; /* Plot sprite from user bank */
		regs_in.r[1] = (int) sprite_area;
		strcpy(text_buffer, "screen");
		regs_in.r[2] = (int) text_buffer;
		regs_in.r[3] = x;
		regs_in.r[4] = 256;
		regs_in.r[5] = 0;
		regs_in.r[6] = 0;
		regs_in.r[7] = (int) translation_buffer;
		_kernel_swi(OS_SpriteOp, &regs_in, &regs_out);
	}

	/* The following section saves out a user sprite area */

	printf("Saving sprites as <SpriteOp$Dir>.OutSprites\n\n");
	strcpy(text_buffer, "<SpriteOp$Dir>.OutSprites");
	regs_in.r[0] = 256+12;
	regs_in.r[1] = (int) sprite_area;
	regs_in.r[2] = (int) text_buffer;
	_kernel_swi(OS_SpriteOp, &regs_in, &regs_out);
}
00000000  2f 2a 20 53 69 6d 70 6c  65 20 70 72 6f 67 72 61  |/* Simple progra|
00000010  6d 20 74 6f 20 64 65 6d  6f 6e 73 74 72 61 74 65  |m to demonstrate|
00000020  20 73 70 72 69 74 65 20  70 6c 6f 74 74 69 6e 67  | sprite plotting|
00000030  0a 20 2a 20 53 4a 50 20  4d 75 6d 66 6f 72 64 2c  |. * SJP Mumford,|
00000040  20 4d 61 72 63 68 20 31  39 39 37 20 2a 2f 0a 2f  | March 1997 */./|
00000050  2a 20 53 74 61 67 65 20  31 20 2d 20 6e 6f 6e 2d  |* Stage 1 - non-|
00000060  6d 75 6c 74 69 74 61 73  6b 69 6e 67 20 2a 2f 0a  |multitasking */.|
00000070  0a 23 69 6e 63 6c 75 64  65 20 3c 73 74 64 69 6f  |.#include <stdio|
00000080  2e 68 3e 0a 23 69 6e 63  6c 75 64 65 20 3c 73 74  |.h>.#include <st|
00000090  64 6c 69 62 2e 68 3e 0a  23 69 6e 63 6c 75 64 65  |dlib.h>.#include|
000000a0  20 3c 73 74 72 69 6e 67  2e 68 3e 0a 23 69 6e 63  | <string.h>.#inc|
000000b0  6c 75 64 65 20 22 41 55  4c 69 62 2e 68 22 0a 0a  |lude "AULib.h"..|
000000c0  23 64 65 66 69 6e 65 20  53 50 52 49 54 45 5f 41  |#define SPRITE_A|
000000d0  52 45 41 5f 53 49 5a 45  20 31 30 32 34 30 0a 23  |REA_SIZE 10240.#|
000000e0  64 65 66 69 6e 65 20 54  52 41 4e 53 5f 42 55 46  |define TRANS_BUF|
000000f0  46 45 52 5f 53 49 5a 45  20 31 30 32 34 0a 23 64  |FER_SIZE 1024.#d|
00000100  65 66 69 6e 65 20 54 52  55 45 20 2d 31 0a 23 64  |efine TRUE -1.#d|
00000110  65 66 69 6e 65 20 46 41  4c 53 45 20 30 0a 0a 2f  |efine FALSE 0../|
00000120  2a 20 47 6c 6f 62 61 6c  20 76 61 72 69 61 62 6c  |* Global variabl|
00000130  65 73 20 2a 2f 0a 0a 75  6e 73 69 67 6e 65 64 20  |es */..unsigned |
00000140  63 68 61 72 09 73 70 72  69 74 65 5f 61 72 65 61  |char.sprite_area|
00000150  5b 53 50 52 49 54 45 5f  41 52 45 41 5f 53 49 5a  |[SPRITE_AREA_SIZ|
00000160  45 5d 3b 0a 75 6e 73 69  67 6e 65 64 20 63 68 61  |E];.unsigned cha|
00000170  72 09 74 72 61 6e 73 6c  61 74 69 6f 6e 5f 62 75  |r.translation_bu|
00000180  66 66 65 72 5b 54 52 41  4e 53 5f 42 55 46 46 45  |ffer[TRANS_BUFFE|
00000190  52 5f 53 49 5a 45 5d 3b  0a 0a 2f 2a 20 50 72 6f  |R_SIZE];../* Pro|
000001a0  74 6f 74 79 70 69 6e 67  20 2a 2f 0a 0a 69 6e 74  |totyping */..int|
000001b0  09 6d 61 69 6e 28 76 6f  69 64 29 3b 0a 0a 69 6e  |.main(void);..in|
000001c0  74 0a 6d 61 69 6e 28 29  0a 7b 0a 09 5f 6b 65 72  |t.main().{.._ker|
000001d0  6e 65 6c 5f 73 77 69 5f  72 65 67 73 09 72 65 67  |nel_swi_regs.reg|
000001e0  73 5f 69 6e 2c 20 72 65  67 73 5f 6f 75 74 3b 0a  |s_in, regs_out;.|
000001f0  09 63 68 61 72 09 66 69  6c 65 6e 61 6d 65 5b 5d  |.char.filename[]|
00000200  20 3d 20 22 3c 53 70 72  69 74 65 4f 70 24 44 69  | = "<SpriteOp$Di|
00000210  72 3e 2e 53 70 72 69 74  65 73 22 3b 0a 09 63 68  |r>.Sprites";..ch|
00000220  61 72 09 74 65 78 74 5f  62 75 66 66 65 72 5b 32  |ar.text_buffer[2|
00000230  35 35 5d 3b 0a 09 69 6e  74 09 78 3b 0a 0a 09 2f  |55];..int.x;.../|
00000240  2a 20 50 72 65 70 61 72  65 20 75 73 65 72 20 73  |* Prepare user s|
00000250  70 72 69 74 65 20 61 72  65 61 20 2d 20 6e 65 65  |prite area - nee|
00000260  64 20 74 6f 20 73 65 74  20 75 70 0a 09 20 2a 20  |d to set up.. * |
00000270  76 61 6c 75 65 73 20 69  6e 20 21 30 20 61 6e 64  |values in !0 and|
00000280  20 21 30 2b 38 20 2a 2f  0a 0a 09 61 75 5f 77 6f  | !0+8 */...au_wo|
00000290  72 64 74 6f 62 79 74 65  28 53 50 52 49 54 45 5f  |rdtobyte(SPRITE_|
000002a0  41 52 45 41 5f 53 49 5a  45 2c 20 73 70 72 69 74  |AREA_SIZE, sprit|
000002b0  65 5f 61 72 65 61 2c 20  30 29 3b 0a 09 61 75 5f  |e_area, 0);..au_|
000002c0  77 6f 72 64 74 6f 62 79  74 65 28 31 36 2c 20 73  |wordtobyte(16, s|
000002d0  70 72 69 74 65 5f 61 72  65 61 2c 20 38 29 3b 20  |prite_area, 8); |
000002e0  2f 2a 20 6e 6f 20 65 78  74 65 6e 73 69 6f 6e 20  |/* no extension |
000002f0  61 72 65 61 20 2a 2f 0a  0a 09 72 65 67 73 5f 69  |area */...regs_i|
00000300  6e 2e 72 5b 30 5d 20 3d  20 32 35 36 2b 39 3b 20  |n.r[0] = 256+9; |
00000310  2f 2a 20 27 49 6e 69 74  69 61 6c 69 73 65 20 55  |/* 'Initialise U|
00000320  53 45 52 20 73 70 72 69  74 65 20 61 72 65 61 27  |SER sprite area'|
00000330  20 2a 2f 0a 09 72 65 67  73 5f 69 6e 2e 72 5b 31  | */..regs_in.r[1|
00000340  5d 20 3d 20 28 69 6e 74  29 20 73 70 72 69 74 65  |] = (int) sprite|
00000350  5f 61 72 65 61 3b 0a 09  5f 6b 65 72 6e 65 6c 5f  |_area;.._kernel_|
00000360  73 77 69 28 4f 53 5f 53  70 72 69 74 65 4f 70 2c  |swi(OS_SpriteOp,|
00000370  20 26 72 65 67 73 5f 69  6e 2c 20 26 72 65 67 73  | &regs_in, &regs|
00000380  5f 6f 75 74 29 3b 0a 0a  09 2f 2a 20 4e 6f 77 20  |_out);.../* Now |
00000390  74 68 65 20 73 70 72 69  74 65 20 61 72 65 61 20  |the sprite area |
000003a0  68 61 73 20 62 65 65 6e  20 63 72 65 61 74 65 64  |has been created|
000003b0  2c 20 77 65 27 64 20 62  65 74 74 65 72 20 70 72  |, we'd better pr|
000003c0  6f 76 65 0a 09 20 2a 20  69 74 20 65 78 69 73 74  |ove.. * it exist|
000003d0  73 20 20 2d 20 6c 65 74  27 73 20 6c 6f 61 64 20  |s  - let's load |
000003e0  61 20 73 70 72 69 74 65  20 2a 2f 0a 0a 09 70 72  |a sprite */...pr|
000003f0  69 6e 74 66 28 22 53 74  61 74 75 73 20 6f 66 20  |intf("Status of |
00000400  75 73 65 72 20 73 70 72  69 74 65 20 61 72 65 61  |user sprite area|
00000410  20 62 65 66 6f 72 65 20  6c 6f 61 64 69 6e 67 2e  | before loading.|
00000420  2e 2e 5c 6e 22 29 3b 0a  09 72 65 67 73 5f 69 6e  |..\n");..regs_in|
00000430  2e 72 5b 30 5d 20 3d 20  32 35 36 2b 38 3b 0a 09  |.r[0] = 256+8;..|
00000440  72 65 67 73 5f 69 6e 2e  72 5b 31 5d 20 3d 20 28  |regs_in.r[1] = (|
00000450  69 6e 74 29 20 73 70 72  69 74 65 5f 61 72 65 61  |int) sprite_area|
00000460  3b 0a 09 5f 6b 65 72 6e  65 6c 5f 73 77 69 28 4f  |;.._kernel_swi(O|
00000470  53 5f 53 70 72 69 74 65  4f 70 2c 20 26 72 65 67  |S_SpriteOp, &reg|
00000480  73 5f 69 6e 2c 20 26 72  65 67 73 5f 6f 75 74 29  |s_in, &regs_out)|
00000490  3b 0a 09 70 72 69 6e 74  66 28 22 54 6f 74 61 6c  |;..printf("Total|
000004a0  20 73 69 7a 65 20 3d 20  25 64 5c 6e 4e 6f 2e 20  | size = %d\nNo. |
000004b0  6f 66 20 73 70 72 69 74  65 73 20 3d 20 25 64 5c  |of sprites = %d\|
000004c0  6e 5c 6e 22 2c 20 72 65  67 73 5f 6f 75 74 2e 72  |n\n", regs_out.r|
000004d0  5b 32 5d 2c 20 72 65 67  73 5f 6f 75 74 2e 72 5b  |[2], regs_out.r[|
000004e0  33 5d 29 3b 0a 0a 09 72  65 67 73 5f 69 6e 2e 72  |3]);...regs_in.r|
000004f0  5b 30 5d 20 3d 20 32 35  36 2b 31 30 3b 20 2f 2a  |[0] = 256+10; /*|
00000500  20 6c 6f 61 64 20 73 70  72 69 74 65 20 69 6e 74  | load sprite int|
00000510  6f 20 55 53 45 52 20 61  72 65 61 20 2a 2f 0a 09  |o USER area */..|
00000520  72 65 67 73 5f 69 6e 2e  72 5b 31 5d 20 3d 20 28  |regs_in.r[1] = (|
00000530  69 6e 74 29 20 73 70 72  69 74 65 5f 61 72 65 61  |int) sprite_area|
00000540  3b 0a 09 72 65 67 73 5f  69 6e 2e 72 5b 32 5d 20  |;..regs_in.r[2] |
00000550  3d 20 28 69 6e 74 29 20  66 69 6c 65 6e 61 6d 65  |= (int) filename|
00000560  3b 0a 09 5f 6b 65 72 6e  65 6c 5f 73 77 69 28 4f  |;.._kernel_swi(O|
00000570  53 5f 53 70 72 69 74 65  4f 70 2c 20 26 72 65 67  |S_SpriteOp, &reg|
00000580  73 5f 69 6e 2c 20 26 72  65 67 73 5f 6f 75 74 29  |s_in, &regs_out)|
00000590  3b 0a 0a 09 70 72 69 6e  74 66 28 22 53 74 61 74  |;...printf("Stat|
000005a0  75 73 20 6f 66 20 75 73  65 72 20 73 70 72 69 74  |us of user sprit|
000005b0  65 20 61 72 65 61 20 61  66 74 65 72 20 6c 6f 61  |e area after loa|
000005c0  64 69 6e 67 2e 2e 2e 5c  6e 22 29 3b 0a 09 72 65  |ding...\n");..re|
000005d0  67 73 5f 69 6e 2e 72 5b  30 5d 20 3d 20 32 35 36  |gs_in.r[0] = 256|
000005e0  2b 38 3b 0a 09 72 65 67  73 5f 69 6e 2e 72 5b 31  |+8;..regs_in.r[1|
000005f0  5d 20 3d 20 28 69 6e 74  29 20 73 70 72 69 74 65  |] = (int) sprite|
00000600  5f 61 72 65 61 3b 0a 09  5f 6b 65 72 6e 65 6c 5f  |_area;.._kernel_|
00000610  73 77 69 28 4f 53 5f 53  70 72 69 74 65 4f 70 2c  |swi(OS_SpriteOp,|
00000620  20 26 72 65 67 73 5f 69  6e 2c 20 26 72 65 67 73  | &regs_in, &regs|
00000630  5f 6f 75 74 29 3b 0a 09  70 72 69 6e 74 66 28 22  |_out);..printf("|
00000640  54 6f 74 61 6c 20 73 69  7a 65 20 3d 20 25 64 5c  |Total size = %d\|
00000650  6e 4e 6f 2e 20 6f 66 20  73 70 72 69 74 65 73 20  |nNo. of sprites |
00000660  3d 20 25 64 5c 6e 5c 6e  22 2c 20 72 65 67 73 5f  |= %d\n\n", regs_|
00000670  6f 75 74 2e 72 5b 32 5d  2c 20 72 65 67 73 5f 6f  |out.r[2], regs_o|
00000680  75 74 2e 72 5b 33 5d 29  3b 0a 0a 09 2f 2a 20 4e  |ut.r[3]);.../* N|
00000690  6f 77 20 6c 65 74 27 73  20 74 72 79 20 70 6c 6f  |ow let's try plo|
000006a0  74 74 69 6e 67 20 69 74  20 2a 2f 0a 0a 09 2f 2a  |tting it */.../*|
000006b0  20 46 69 72 73 74 2c 20  73 65 74 20 75 70 20 61  | First, set up a|
000006c0  20 70 69 78 65 6c 20 74  72 61 6e 73 6c 61 74 69  | pixel translati|
000006d0  6f 6e 20 74 61 62 6c 65  20 2a 2f 0a 0a 09 70 72  |on table */...pr|
000006e0  69 6e 74 66 28 22 53 65  74 74 69 6e 67 20 75 70  |intf("Setting up|
000006f0  20 70 69 78 65 6c 20 74  72 61 6e 73 6c 61 74 69  | pixel translati|
00000700  6f 6e 20 74 61 62 6c 65  2e 2e 2e 5c 6e 22 29 3b  |on table...\n");|
00000710  0a 09 72 65 67 73 5f 69  6e 2e 72 5b 30 5d 20 3d  |..regs_in.r[0] =|
00000720  20 28 69 6e 74 29 20 73  70 72 69 74 65 5f 61 72  | (int) sprite_ar|
00000730  65 61 3b 0a 09 73 74 72  63 70 79 28 74 65 78 74  |ea;..strcpy(text|
00000740  5f 62 75 66 66 65 72 2c  20 22 73 63 72 65 65 6e  |_buffer, "screen|
00000750  22 29 3b 0a 09 72 65 67  73 5f 69 6e 2e 72 5b 31  |");..regs_in.r[1|
00000760  5d 20 3d 20 28 69 6e 74  29 20 74 65 78 74 5f 62  |] = (int) text_b|
00000770  75 66 66 65 72 3b 0a 09  72 65 67 73 5f 69 6e 2e  |uffer;..regs_in.|
00000780  72 5b 32 5d 20 3d 20 2d  31 3b 0a 09 72 65 67 73  |r[2] = -1;..regs|
00000790  5f 69 6e 2e 72 5b 33 5d  20 3d 20 2d 31 3b 0a 09  |_in.r[3] = -1;..|
000007a0  72 65 67 73 5f 69 6e 2e  72 5b 34 5d 20 3d 20 30  |regs_in.r[4] = 0|
000007b0  3b 20 2f 2a 20 66 69 6e  64 20 6f 75 74 20 68 6f  |; /* find out ho|
000007c0  77 20 6d 75 63 68 20 73  70 61 63 65 20 77 65 20  |w much space we |
000007d0  6e 65 65 64 20 2a 2f 0a  09 72 65 67 73 5f 69 6e  |need */..regs_in|
000007e0  2e 72 5b 35 5d 20 3d 20  30 3b 20 2f 2a 20 64 65  |.r[5] = 0; /* de|
000007f0  66 61 75 6c 74 20 66 6c  61 67 73 3b 20 75 73 65  |fault flags; use|
00000800  20 73 70 72 69 74 65 20  6e 61 6d 65 20 69 6e 20  | sprite name in |
00000810  52 31 20 2a 2f 0a 09 5f  6b 65 72 6e 65 6c 5f 73  |R1 */.._kernel_s|
00000820  77 69 28 43 6f 6c 6f 75  72 54 72 61 6e 73 5f 53  |wi(ColourTrans_S|
00000830  65 6c 65 63 74 54 61 62  6c 65 2c 20 26 72 65 67  |electTable, &reg|
00000840  73 5f 69 6e 2c 20 26 72  65 67 73 5f 6f 75 74 29  |s_in, &regs_out)|
00000850  3b 0a 0a 09 70 72 69 6e  74 66 28 22 52 65 71 75  |;...printf("Requ|
00000860  69 72 65 64 20 73 70 61  63 65 20 66 6f 72 20 74  |ired space for t|
00000870  72 61 6e 73 6c 61 74 69  6f 6e 20 62 75 66 66 65  |ranslation buffe|
00000880  72 20 3d 20 25 64 5c 6e  5c 6e 22 2c 20 72 65 67  |r = %d\n\n", reg|
00000890  73 5f 6f 75 74 2e 72 5b  34 5d 29 3b 0a 0a 09 72  |s_out.r[4]);...r|
000008a0  65 67 73 5f 69 6e 2e 72  5b 30 5d 20 3d 20 28 69  |egs_in.r[0] = (i|
000008b0  6e 74 29 20 73 70 72 69  74 65 5f 61 72 65 61 3b  |nt) sprite_area;|
000008c0  0a 09 73 74 72 63 70 79  28 74 65 78 74 5f 62 75  |..strcpy(text_bu|
000008d0  66 66 65 72 2c 20 22 73  63 72 65 65 6e 22 29 3b  |ffer, "screen");|
000008e0  0a 09 72 65 67 73 5f 69  6e 2e 72 5b 31 5d 20 3d  |..regs_in.r[1] =|
000008f0  20 28 69 6e 74 29 20 74  65 78 74 5f 62 75 66 66  | (int) text_buff|
00000900  65 72 3b 0a 09 72 65 67  73 5f 69 6e 2e 72 5b 32  |er;..regs_in.r[2|
00000910  5d 20 3d 20 2d 31 3b 0a  09 72 65 67 73 5f 69 6e  |] = -1;..regs_in|
00000920  2e 72 5b 33 5d 20 3d 20  2d 31 3b 0a 09 72 65 67  |.r[3] = -1;..reg|
00000930  73 5f 69 6e 2e 72 5b 34  5d 20 3d 20 28 69 6e 74  |s_in.r[4] = (int|
00000940  29 20 74 72 61 6e 73 6c  61 74 69 6f 6e 5f 62 75  |) translation_bu|
00000950  66 66 65 72 3b 0a 09 72  65 67 73 5f 69 6e 2e 72  |ffer;..regs_in.r|
00000960  5b 35 5d 20 3d 20 30 3b  20 2f 2a 20 64 65 66 61  |[5] = 0; /* defa|
00000970  75 6c 74 20 66 6c 61 67  73 3b 20 75 73 65 20 73  |ult flags; use s|
00000980  70 72 69 74 65 20 6e 61  6d 65 20 69 6e 20 52 31  |prite name in R1|
00000990  20 2a 2f 0a 09 5f 6b 65  72 6e 65 6c 5f 73 77 69  | */.._kernel_swi|
000009a0  28 43 6f 6c 6f 75 72 54  72 61 6e 73 5f 53 65 6c  |(ColourTrans_Sel|
000009b0  65 63 74 54 61 62 6c 65  2c 20 26 72 65 67 73 5f  |ectTable, &regs_|
000009c0  69 6e 2c 20 26 72 65 67  73 5f 6f 75 74 29 3b 0a  |in, &regs_out);.|
000009d0  0a 09 70 72 69 6e 74 66  28 22 4e 6f 77 20 70 6c  |..printf("Now pl|
000009e0  6f 74 20 61 20 73 70 72  69 74 65 2e 2e 2e 5c 6e  |ot a sprite...\n|
000009f0  22 29 3b 0a 09 66 6f 72  28 78 20 3d 20 30 3b 20  |");..for(x = 0; |
00000a00  78 20 3c 20 31 32 38 30  3b 20 78 2b 3d 31 36 30  |x < 1280; x+=160|
00000a10  29 7b 0a 09 09 72 65 67  73 5f 69 6e 2e 72 5b 30  |){...regs_in.r[0|
00000a20  5d 20 3d 20 32 35 36 2b  35 32 3b 20 2f 2a 20 50  |] = 256+52; /* P|
00000a30  6c 6f 74 20 73 70 72 69  74 65 20 66 72 6f 6d 20  |lot sprite from |
00000a40  75 73 65 72 20 62 61 6e  6b 20 2a 2f 0a 09 09 72  |user bank */...r|
00000a50  65 67 73 5f 69 6e 2e 72  5b 31 5d 20 3d 20 28 69  |egs_in.r[1] = (i|
00000a60  6e 74 29 20 73 70 72 69  74 65 5f 61 72 65 61 3b  |nt) sprite_area;|
00000a70  0a 09 09 73 74 72 63 70  79 28 74 65 78 74 5f 62  |...strcpy(text_b|
00000a80  75 66 66 65 72 2c 20 22  73 63 72 65 65 6e 22 29  |uffer, "screen")|
00000a90  3b 0a 09 09 72 65 67 73  5f 69 6e 2e 72 5b 32 5d  |;...regs_in.r[2]|
00000aa0  20 3d 20 28 69 6e 74 29  20 74 65 78 74 5f 62 75  | = (int) text_bu|
00000ab0  66 66 65 72 3b 0a 09 09  72 65 67 73 5f 69 6e 2e  |ffer;...regs_in.|
00000ac0  72 5b 33 5d 20 3d 20 78  3b 0a 09 09 72 65 67 73  |r[3] = x;...regs|
00000ad0  5f 69 6e 2e 72 5b 34 5d  20 3d 20 32 35 36 3b 0a  |_in.r[4] = 256;.|
00000ae0  09 09 72 65 67 73 5f 69  6e 2e 72 5b 35 5d 20 3d  |..regs_in.r[5] =|
00000af0  20 30 3b 0a 09 09 72 65  67 73 5f 69 6e 2e 72 5b  | 0;...regs_in.r[|
00000b00  36 5d 20 3d 20 30 3b 0a  09 09 72 65 67 73 5f 69  |6] = 0;...regs_i|
00000b10  6e 2e 72 5b 37 5d 20 3d  20 28 69 6e 74 29 20 74  |n.r[7] = (int) t|
00000b20  72 61 6e 73 6c 61 74 69  6f 6e 5f 62 75 66 66 65  |ranslation_buffe|
00000b30  72 3b 0a 09 09 5f 6b 65  72 6e 65 6c 5f 73 77 69  |r;..._kernel_swi|
00000b40  28 4f 53 5f 53 70 72 69  74 65 4f 70 2c 20 26 72  |(OS_SpriteOp, &r|
00000b50  65 67 73 5f 69 6e 2c 20  26 72 65 67 73 5f 6f 75  |egs_in, &regs_ou|
00000b60  74 29 3b 0a 09 7d 0a 0a  09 2f 2a 20 54 68 65 20  |t);..}.../* The |
00000b70  66 6f 6c 6c 6f 77 69 6e  67 20 73 65 63 74 69 6f  |following sectio|
00000b80  6e 20 73 61 76 65 73 20  6f 75 74 20 61 20 75 73  |n saves out a us|
00000b90  65 72 20 73 70 72 69 74  65 20 61 72 65 61 20 2a  |er sprite area *|
00000ba0  2f 0a 0a 09 70 72 69 6e  74 66 28 22 53 61 76 69  |/...printf("Savi|
00000bb0  6e 67 20 73 70 72 69 74  65 73 20 61 73 20 3c 53  |ng sprites as <S|
00000bc0  70 72 69 74 65 4f 70 24  44 69 72 3e 2e 4f 75 74  |priteOp$Dir>.Out|
00000bd0  53 70 72 69 74 65 73 5c  6e 5c 6e 22 29 3b 0a 09  |Sprites\n\n");..|
00000be0  73 74 72 63 70 79 28 74  65 78 74 5f 62 75 66 66  |strcpy(text_buff|
00000bf0  65 72 2c 20 22 3c 53 70  72 69 74 65 4f 70 24 44  |er, "<SpriteOp$D|
00000c00  69 72 3e 2e 4f 75 74 53  70 72 69 74 65 73 22 29  |ir>.OutSprites")|
00000c10  3b 0a 09 72 65 67 73 5f  69 6e 2e 72 5b 30 5d 20  |;..regs_in.r[0] |
00000c20  3d 20 32 35 36 2b 31 32  3b 0a 09 72 65 67 73 5f  |= 256+12;..regs_|
00000c30  69 6e 2e 72 5b 31 5d 20  3d 20 28 69 6e 74 29 20  |in.r[1] = (int) |
00000c40  73 70 72 69 74 65 5f 61  72 65 61 3b 0a 09 72 65  |sprite_area;..re|
00000c50  67 73 5f 69 6e 2e 72 5b  32 5d 20 3d 20 28 69 6e  |gs_in.r[2] = (in|
00000c60  74 29 20 74 65 78 74 5f  62 75 66 66 65 72 3b 0a  |t) text_buffer;.|
00000c70  09 5f 6b 65 72 6e 65 6c  5f 73 77 69 28 4f 53 5f  |._kernel_swi(OS_|
00000c80  53 70 72 69 74 65 4f 70  2c 20 26 72 65 67 73 5f  |SpriteOp, &regs_|
00000c90  69 6e 2c 20 26 72 65 67  73 5f 6f 75 74 29 3b 0a  |in, &regs_out);.|
00000ca0  7d 0a                                             |}.|
00000ca2