/* To avoid the need to link with complete RISC_OSLib modules when
   we only need a few simple routines in them */

#include <string.h>
#include "os.h"
#include "sprite.h"


os_error *bbc_move(int x,int y)
/*****************************/
{
	return(os_swi3(0x45+os_X,4,x,y));
}   /* end of bbc_move */


os_error *bbc_draw(int x,int y)
/*****************************/
{
	return(os_swi3(0x45+os_X,5,x,y));
}   /* end of bbc_draw */


os_error *bbc_rectanglefill(int x, int y, int width, int height)
/********************************************************/
{
	os_swi3(0x45+os_X,4,x,y);
	return(os_swi3(0x45+os_X,96+1,width,height));
}   /* end of bbc_rectanglefill */



int bbc_vduvar(int varno)
/***********************/
{
	int block[2];
	int out[2];

	block[0] = varno;
	block[1] = -1;
	os_swi2(0x31,(int)block,(int)out);  /* OS_ReadVduVariables */
	return(out[0]);
}   /* end of bbc_vduvar */


int bbc_modevar(int mode,int varno)
/*********************************/
{
	os_regset regs;

	regs.r[0] = mode;
	regs.r[1] = varno;
	os_swi(0x35,&regs);   /* OS_ReadModeVariable */
	return(regs.r[2]);
}   /* end of bbc_modevar */



#ifdef deleted32
os_error *bbc_vdu(int x)
/**********************/
{
	return(os_swi1(0x00,x));   /* OS_WriteC */
}   /* end of bbc_vdu */
#endif


os_error *font_paint(char *string, int options, int x, int y)
/***********************************************************/
{
	os_regset regs;

	regs.r[0] = 0;
	regs.r[1] = (int)string;
	regs.r[2] = options;
	regs.r[3] = x;
	regs.r[4] = y;
	regs.r[7] = strlen(string);
	return(os_swix(0x40086,&regs));      /* Font_Paint */

}   /* end of font_paint */



os_error *font_lose(int f)
/*************************/
{
	return(os_swi1(0x40082+os_X,(int)f));   /* Font_LoseFont */
}   /* end of font_lose */




void sprite_area_initialise(sprite_area *a, int size)
/***************************************************/
{
	int *p;
	p = (int *)a;
	p[0] = size;
	p[2] = 16;
}   /* end of sprite_area_initialise */



os_error *sprite_area_load(sprite_area *a, const char *filename)
/**************************************************************/
{
	return(os_swi3(0x2e + os_X,0x100+10,(int)a,(int)filename));
}   /* end of sprite_area_load */

