diff --git a/Makefile b/Makefile index a1f263ce5cfb67c4b7b2839aeb886219a009465c..0f835afc9af35e2f60ea3fa7280b06ce7feaf0d2 100644 --- a/Makefile +++ b/Makefile @@ -500,7 +500,7 @@ lib.arthurlib: o.arth_new_n o.arth_old_n o.ArtAsm_n o.ArtAsm_o ${LIBFILE} ${LIBFLAGS} $@ o.Arth_new_n o.Arth_old_n o.ArtAsm_n o.ArtAsm_o # Derived headers: -derived.swis: s.makehswis +derived.swis: s.makehswis h.swisheader ${AS} ${AFLAGS} -from s.makehswis -to $@ settype $@ text diff --git a/VersionASM b/VersionASM index 28c651ffa4759d2ceb02d893fdba9a4ab24b7efe..79aa5c4ca7668fb663143ea85b2e0e7684176a12 100644 --- a/VersionASM +++ b/VersionASM @@ -5,8 +5,8 @@ GBLA Module_Version GBLS Module_MinorVersion GBLS Module_Date -Module_MajorVersion SETS "4.89" -Module_Version SETA 489 +Module_MajorVersion SETS "4.90" +Module_Version SETA 490 Module_MinorVersion SETS "" -Module_Date SETS "01 Oct 1998" +Module_Date SETS "26 Oct 1998" END diff --git a/VersionNum b/VersionNum index bc2151bcf3e646e528a01e9c8e7342cfa136c0d4..25a07a4b70c9b54e477a4e3af93a06618cc03546 100644 --- a/VersionNum +++ b/VersionNum @@ -1,14 +1,14 @@ -/* (4.89) +/* (4.90) * * This file is automatically maintained by srccommit, do not edit manually. * */ -#define Module_MajorVersion_CMHG 4.89 +#define Module_MajorVersion_CMHG 4.90 #define Module_MinorVersion_CMHG -#define Module_Date_CMHG 01 Oct 1998 +#define Module_Date_CMHG 26 Oct 1998 -#define Module_MajorVersion "4.89" -#define Module_Version 489 +#define Module_MajorVersion "4.90" +#define Module_Version 490 #define Module_MinorVersion "" -#define Module_Date "01 Oct 1998" +#define Module_Date "26 Oct 1998" diff --git a/h/swisheader b/h/swisheader new file mode 100644 index 0000000000000000000000000000000000000000..39dd223a85abcea2fd1cac85ee965e342b3aa757 --- /dev/null +++ b/h/swisheader @@ -0,0 +1,146 @@ +/* Copyright 1998 Acorn Computers Ltd + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#pragma force_top_level +#pragma include_only_once + +/*Name: swis.h + Purpose: Generalised SWI interface + Author: (c) Acorn Computers Ltd, 1989 + Version: 2.04 (09-Jan-1995) + This file is automatically generated from Hdr:makehswis +*/ + +#ifndef __swis_h +#define __swis_h + +#ifndef __kernel_h + #include "kernel.h" +#endif + +#ifdef __cplusplus +extern "C" +{ +#endif + +#pragma -v4 +extern int _swi (int swi_no, unsigned int, ...); + +extern _kernel_oserror *_swix (int swi_no, unsigned int, ...); +#pragma -v0 + +#ifdef __cplusplus +} +#endif + +#define _FLAGS 0x10 /*use with _RETURN() or _OUT()*/ +#define _IN(i) (1U << (i)) +#define _INR(i,j) (~0 << (i) ^ ~0 << (j) + 1) +#define _OUT(i) ((i) != _FLAGS? 1U << 31 - (i): 1U << 21) +#define _OUTR(i,j) (~0U >> (i) ^ ~0U >> (j) + 1) +#define _BLOCK(i) (1U << 11 | (unsigned) (i) << 12) +#define _RETURN(i) ((i) != _FLAGS? (unsigned) (i) << 16: 0xFU << 16) +#define _C (1U << 29) +#define _Z (1U << 30) +#define _N (1U << 31) + +#define XOS_Bit (1U << 17) /*deprecated: use _swi() or _swix()*/ + +/* + * These functions provide a generic method of calling RISC OS SWIs from C or + * C++. + * + * Two functions are provided: + * _swi for calling SWIs without setting the X bit + * _swix which sets the X bit before calling the SWI. + * + * swi_no is the number of the SWI to be called. This should never have the + * X bit set. + * + * mask is a word containing an input and output register mask, a return + * register, and a block parameter register. + * + * The arrangement of mask is as follows: + * + * Bits 0 - 9: Set if R(N) is passed to the SWI. + * Bits 22 - 31: Set if R(31-N) is output from the SWI (ie bit 31 + * corresponds to R0, bit 22 corresponds to R9). + * Bit 21: Set if the PC (including the flags) is to be output. + * Bits 16 - 19: Register no. to be returned from a _swi call. This is only + * applicable to _swi as _swix always returns either 0 or an error + * pointer. + * Bit 11: Set if a local block parameter is to be passed to the SWI + * Bits 12 - 15: Register number for local block parameter if bit 11 set. + * + * If a register is specified as a return register (bits 16-19) it must not + * also be specified as an output register in the output register mask + * (bits 22-31). + * + * If a register is specified as a local block parameter register it must not + * also be specified as an input register in the input register mask + * (bits 0-9). + * + * If the PC is specified as a return register (ie bits 16-19 = 15) or as an + * output registers (bit 21 = 1) the value returned will contain the flags in + * bits 28 to 31 (28 = V, 29 = C, 30 = Z, 31 = N). + * + * The remainder of the variadic arguments are as follows (in order): + * + * The word value of each input register in order from 0 to 9 as specified by + * bits 0 to 9 of the mask. + * + * The address of a word to be written for each output register in order from + * 0 to 9 as specified by bits 31 downto 22 of the mask. + * + * The address of a word to be written with the PC value on exit from the SWI + * if bit 21 of the register mask is set. + * + * If bit 11 is set the remainder of the arguments are placed in order in a + * parameter block and the address of the parameter block is passed to the SWI + * in the register specified by bits 12-15. + * + * The macros are as follows: + * + * _IN(n) - Specifies that R(n) is used on input + * _OUT(n) - Specifies that R(n) is output + * _BLOCK(n) - Specifies that R(n) is a block parameter + * _RETURN(n) - Specifies that R(n) is returned from _swi. + * + * The values of the macros should be ORed together to produce the value for + * the mask. + * + * The following constants are defined + * + * _FLAGS - the register containing the flags (currently 15) + * _C - mask for the C bit in _FLAGS + * _Z - mask for the Z bit in _FLAGS + * _N - mask for the N bit in _FLAGS + * + * Example calls: + * + * _swi(OS_NewLine, 0); // Must specify 0 register mask + * + * _swi(OS_Write0, _IN(0), "Hello, World"); + * + * task_handle = _swi(Wimp_Initialise, _IN(0)|_IN(1)|_IN(2)|_RETURN(1), + * 300, *(int *)"TASK", "Test"); + * + * e = _swix(Wimp_LoadTemplate, _IN(1)|_IN(2)|_IN(3)|_IN(4)|_IN(5)|_IN(6)| + * _OUT(2)|_OUT(6), + * template_buffer, workspace, workspace_end, -1, "MyWind", next, + * &workspace_end, &next); + * + * e = _swix(Wimp_SetExtent, _IN(0)|_BLOCK(1), w, minx, miny, maxx, maxy); + */ + diff --git a/s/makehswis b/s/makehswis index aa20dce699a151a833b344a1016259df320b360a..a180b486f71fe923c53a145b40ea8734c967ee93 100644 --- a/s/makehswis +++ b/s/makehswis @@ -103,137 +103,7 @@ string2 SETS "&":CC:(:STR:value) GET Hdr:PublicWS ; First output the file header - - = "#pragma force_top_level", 10 - = "#pragma include_only_once", 10 - = 10 - = "/*Name: swis.h", 10 - = " Purpose: Generalised SWI interface", 10 - = " Author: (c) Acorn Computers Ltd, 1989", 10 - = " Version: 2.04 (09-Jan-1995)", 10 - = " This file is automatically generated from Hdr:makehswis", 10 - = "*/", 10 - = 10 - = "#ifndef __swis_h", 10 - = "#define __swis_h", 10 - = 10 - = "#ifndef __kernel_h", 10 - = " #include ""kernel.h""", 10 - = "#endif", 10 - = 10 - = "#ifdef __cplusplus", 10 - = "extern ""C""", 10 - = "{", 10 - = "#endif", 10 - = 10 - = "extern int _swi (int swi_no, unsigned int, ...);", 10 - = 10 - = "extern _kernel_oserror *_swix (int swi_no, unsigned int, ...);", 10 - = 10 - = "#ifdef __cplusplus", 10 - = "}", 10 - = "#endif", 10 - = 10 - = "#define _FLAGS 0x10 /*use with _RETURN() or _OUT()*/", 10 - = "#define _IN(i) (1U << (i))", 10 - = "#define _INR(i,j) (~0 << (i) ^ ~0 << (j) + 1)", 10 - = "#define _OUT(i) ((i) != _FLAGS? 1U << 31 - (i): 1U << 21)", 10 - = "#define _OUTR(i,j) (~0U >> (i) ^ ~0U >> (j) + 1)", 10 - = "#define _BLOCK(i) (1U << 11 | (unsigned) (i) << 12)", 10 - = "#define _RETURN(i) ((i) != _FLAGS? (unsigned) (i) << 16: 0xFU << 16)", 10 - = "#define _C (1U << 29)", 10 - = "#define _Z (1U << 30)", 10 - = "#define _N (1U << 31)", 10 - = 10 - = "#define XOS_Bit (1U << 17) /*deprecated: use _swi() or _swix()*/", 10 - = 10 - = "/*", 10 - = " * These functions provide a generic method of calling RISC OS SWIs from C or", 10 - = " * C++.", 10 - = " * ", 10 - = " * Two functions are provided:", 10 - = " * _swi for calling SWIs without setting the X bit", 10 - = " * _swix which sets the X bit before calling the SWI.", 10 - = " * ", 10 - = " * swi_no is the number of the SWI to be called. This should never have the", 10 - = " * X bit set.", 10 - = " * ", 10 - = " * mask is a word containing an input and output register mask, a return", 10 - = " * register, and a block parameter register.", 10 - = " * ", 10 - = " * The arrangement of mask is as follows:", 10 - = " * ", 10 - = " * Bits 0 - 9: Set if R(N) is passed to the SWI.", 10 - = " * Bits 22 - 31: Set if R(31-N) is output from the SWI (ie bit 31", 10 - = " * corresponds to R0, bit 22 corresponds to R9).", 10 - = " * Bit 21: Set if the PC (including the flags) is to be output.", 10 - = " * Bits 16 - 19: Register no. to be returned from a _swi call. This is only", 10 - = " * applicable to _swi as _swix always returns either 0 or an error", 10 - = " * pointer.", 10 - = " * Bit 11: Set if a local block parameter is to be passed to the SWI", 10 - = " * Bits 12 - 15: Register number for local block parameter if bit 11 set.", 10 - = " * ", 10 - = " * If a register is specified as a return register (bits 16-19) it must not", 10 - = " * also be specified as an output register in the output register mask", 10 - = " * (bits 22-31).", 10 - = " * ", 10 - = " * If a register is specified as a local block parameter register it must not", 10 - = " * also be specified as an input register in the input register mask", 10 - = " * (bits 0-9).", 10 - = " * ", 10 - = " * If the PC is specified as a return register (ie bits 16-19 = 15) or as an", 10 - = " * output registers (bit 21 = 1) the value returned will contain the flags in", 10 - = " * bits 28 to 31 (28 = V, 29 = C, 30 = Z, 31 = N).", 10 - = " * ", 10 - = " * The remainder of the variadic arguments are as follows (in order):", 10 - = " * ", 10 - = " * The word value of each input register in order from 0 to 9 as specified by", 10 - = " * bits 0 to 9 of the mask.", 10 - = " * ", 10 - = " * The address of a word to be written for each output register in order from", 10 - = " * 0 to 9 as specified by bits 31 downto 22 of the mask.", 10 - = " * ", 10 - = " * The address of a word to be written with the PC value on exit from the SWI", 10 - = " * if bit 21 of the register mask is set.", 10 - = " * ", 10 - = " * If bit 11 is set the remainder of the arguments are placed in order in a", 10 - = " * parameter block and the address of the parameter block is passed to the SWI", 10 - = " * in the register specified by bits 12-15.", 10 - = " * ", 10 - = " * The macros are as follows:", 10 - = " * ", 10 - = " * _IN(n) - Specifies that R(n) is used on input", 10 - = " * _OUT(n) - Specifies that R(n) is output", 10 - = " * _BLOCK(n) - Specifies that R(n) is a block parameter", 10 - = " * _RETURN(n) - Specifies that R(n) is returned from _swi.", 10 - = " * ", 10 - = " * The values of the macros should be ORed together to produce the value for", 10 - = " * the mask.", 10 - = " * ", 10 - = " * The following constants are defined", 10 - = " * ", 10 - = " * _FLAGS - the register containing the flags (currently 15)", 10 - = " * _C - mask for the C bit in _FLAGS", 10 - = " * _Z - mask for the Z bit in _FLAGS", 10 - = " * _N - mask for the N bit in _FLAGS", 10 - = " * ", 10 - = " * Example calls:", 10 - = " * ", 10 - = " * _swi(OS_NewLine, 0); // Must specify 0 register mask", 10 - = " * ", 10 - = " * _swi(OS_Write0, _IN(0), ",34,"Hello, World",34,");", 10 - = " * ", 10 - = " * task_handle = _swi(Wimp_Initialise, _IN(0)|_IN(1)|_IN(2)|_RETURN(1),", 10 - = " * 300, *(int *)",34,"TASK",34,", ",34,"Test",34,");", 10 - = " * ", 10 - = " * e = _swix(Wimp_LoadTemplate, _IN(1)|_IN(2)|_IN(3)|_IN(4)|_IN(5)|_IN(6)|", 10 - = " * _OUT(2)|_OUT(6),", 10 - = " * template_buffer, workspace, workspace_end, -1, ",34,"MyWind",34,", next,", 10 - = " * &workspace_end, &next);", 10 - = " * ", 10 - = " * e = _swix(Wimp_SetExtent, _IN(0)|_BLOCK(1), w, minx, miny, maxx, maxy);", 10 - = " */", 10 - = 10 + BIN h.swisheader ; Now output all the SWI symbols we can access