Commit 256c9d65 authored by Kevin Bracey's avatar Kevin Bracey

Features:

* APCS-32 support complete.
* APCS-A compatibility removed.
* Old ArthurLib code removed.
* _clib_version() now reports version from VersionNum.
* time() no longer does a run-time host check - I think we know we're not a BBC
  Master ARM second processor now.
* rename() now uses OS_FSControl 25 instead of *rename.
* getenv() can handle arbitrary length variables.
* Can now handle exceptions in 32-bit form of FPEmulator (on either 26 or 32
  bit systems).
* tmpnam() switches to SVC mode to access its zero page counter.
* Faster divide routines.

Admin:

  This will build all sorts of different things depending on the flags. See
  the Docs directory for details.

  As far as ROM builds are concerned, if using APCS-R, no changes are needed.
  If using APCS-32, the Shared C Library must be built as APCS-R to ensure
  compatibility with old binaries. To achieve this, pass in the option
  SCL_APCS="-APCS 3/26bit" in the Components file.

Version 4.97, 4.12.2.8. Tagged as 'RISC_OSLib-4_97-4_12_2_8'
parent dfa2ab08
To make ANSILib, RISCOSLib, stubs and Shared C library module compatible with
26-bit RISC OS 3.1 onwards (including APCS-32 client support in Shared C
Library), build with APCS = APCS-R, No26bitCode = {FALSE}, No32bitCode =
{TRUE}.
To make RISCOSLib, stubs compatible with 26 or 32-bit RISC OS 3.1 onwards,
build with APCS = APCS-32. The resulting programs will require an APCS-32 capable
Shared C Library.
To make ANSILib compatible with 26 or 32-bit RISC OS 3.5 onwards, build with
APCS = APCS-32, No26bitCode = {TRUE}, No32bitCode = {FALSE}.
To make Shared C Library compatible with 32-bit RISC OS, build with APCS = APCS-32.
An APCS-32 Shared C Library will NOT run 26-bit programs, even on a 26-bit
system; an APCS-R Shared C Library must be used. In a build using APCS-32,
the SCL must be forced to APCS-R - pass the option SCL_APCS="-APCS 3/26bit"
in the components file to acheive this.
26-bit Shared C library (ROM or RAM): ARM 2 or later (26-bit)
Will always be in 26-bit modes
Client may be APCS-32 or APCS-R
26-bit ANSILib ARM 2 or later (26-bit)
Will always be in 26-bit modes
Client is APCS-R
32-bit Shared C library (ROM or RAM): ARM 6 or later (32-bit)
May be in 26 or 32-bit modes
32-bit instructions always available
Client is APCS-32
32-bit ANSILib ARM 6 or later
May be in 26 or 32-bit modes
32-bit instructions always available
Client is APCS-32
32-bit ANSILib will be RISC OS 3.5 or later
other requirements for any CLib or ANSILib:
RISC OS 3.1
FPEmulator 4.03 or later
CallASWI (if RISC OS 3.6 or earlier)
......@@ -24,7 +24,6 @@
# lib.romstubs RISC_OSLib:o.romstubs ${ROMSTUBS} ROM RISC_OSStubs Module_Only
# lib.romastubs ROM RISC_OSStubs Apps_Only
# lib.ansilib
# lib.arthurlib
# lib.clib
# lib.riscoslibm
#---------------------------------------------------------------------------------------------
......@@ -91,18 +90,20 @@ ALFLAGS =\
-PD "DEFAULT_TEXT SETL {TRUE}"
VLFLAGS =\
-DLIB_SHARED="\"\""\
-DLIB_APCS="\"R\""
-DLIB_SHARED="\"\""
# Shared C Library flags
CSFLAGS =\
-I@,^.clib\
-DSHARED_C_LIBRARY\
-DUROM
-DUROM\
${SCL_APCS}
VSFLAGS =\
-DLIB_SHARED="\"Shared \""\
-DLIB_APCS="\"R\""
-DLIB_SHARED="\"Shared \""
ASFLAGS =\
${SCL_APCS}
VPATH = @ kernel clib rlib
......@@ -119,8 +120,8 @@ VPATH = @ kernel clib rlib
.s.o:; ${OBJASM} ${AFLAGS} ${ALFLAGS} $< $@
.s.o_rl:; ${OBJASM} ${AFLAGS} $< $@
.s.m_o_rl:; ${OBJASM} ${AFLAGS} $< $@
.s.rm_o:; ${OBJASM} ${AFLAGS} ${OPTIONS} $< $@
.s.rm_o_rl:; ${OBJASM} ${AFLAGS} ${OPTIONS} $< $@
.s.rm_o:; ${OBJASM} ${AFLAGS} ${ASFLAGS} ${OPTIONS} $< $@
.s.rm_o_rl:; ${OBJASM} ${AFLAGS} ${ASFLAGS} ${OPTIONS} $< $@
#
# Libraries
......@@ -504,9 +505,6 @@ lib.romastubs: rlib.s.rl_stub_a
lib.clib: ${CLIB_MOD_OBJS}
${LD} -o $@ -module ${CLIB_MOD_OBJS}
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 h.swisheader
${AS} ${AFLAGS} -from s.makehswis -to $@
......@@ -633,25 +631,25 @@ rm_o.bsearch_a: c.bsearch
${CC} ${CFLAGS} -ffah -zm1 ${CSFLAGS} -zkA ${OPTIONS} -o $@ c.bsearch
rm_o.clib: clib.s.cl_obj_r
${OBJASM} ${AFLAGS} ${OPTIONS} -from clib.s.cl_obj_r -to $@
${OBJASM} ${AFLAGS} ${ASFLAGS} ${OPTIONS} -from clib.s.cl_obj_r -to $@
rm_o.cl_modbody: clib.s.cl_mod_r
${OBJASM} ${AFLAGS} ${OPTIONS} -from clib.s.cl_mod_r -to $@
${OBJASM} ${AFLAGS} ${ASFLAGS} ${OPTIONS} -from clib.s.cl_mod_r -to $@
rm_o_rl.rl_modbody: rlib.s.rl_mod_r
${OBJASM} ${AFLAGS} ${OPTIONS} -from rlib.s.rl_mod_r -to $@
${OBJASM} ${AFLAGS} ${ASFLAGS} ${OPTIONS} -from rlib.s.rl_mod_r -to $@
rm_o.k_modbody: kernel.s.k_mod_r
${OBJASM} ${AFLAGS} ${OPTIONS} -from kernel.s.k_mod_r -to $@
${OBJASM} ${AFLAGS} ${ASFLAGS} ${OPTIONS} -from kernel.s.k_mod_r -to $@
rm_o.memcpy: s.memcpy s.h_regs
${OBJASM} ${AFLAGS} ${OPTIONS} -from s.memcpy -to $@
${OBJASM} ${AFLAGS} ${ASFLAGS} ${OPTIONS} -from s.memcpy -to $@
rm_o.initmodule: clib.s.initmod_r
${OBJASM} ${AFLAGS} ${OPTIONS} -from clib.s.initmod_r -to $@
${OBJASM} ${AFLAGS} ${ASFLAGS} ${OPTIONS} -from clib.s.initmod_r -to $@
rm_o_rl.initmodule: rlib.s.initmod_r
${OBJASM} ${AFLAGS} ${OPTIONS} -from rlib.s.initmod_r -to $@
${OBJASM} ${AFLAGS} ${ASFLAGS} ${OPTIONS} -from rlib.s.initmod_r -to $@
#
# Objects that require extra flags
......@@ -723,19 +721,4 @@ m_o_rl.trace: rlib.c.trace
rm_o_rl.trace: rlib.c.trace
${CC} ${CFLAGS} -ffah ${DFLAGS} -zm1 ${CSFLAGS} ${STK_EXTN} ${OPTIONS} -DTRACE -o rm_o_rl.trace rlib.c.trace
#
# Arthur objects
#
o.arth_new_n: c.arthur
${CC} ${CFLAGS} -fah -o $@ c.arthur
o.arth_old_n: c.arthur
${CC} ${CFLAGS} -fah -DARTHUR_OLD_NAMES -o $@ c.arthur
o.ArtAsm_n: s.Art_n_r
${OBJASM} ${AFLAGS} -from s.Art_n_r -to $@
o.ArtAsm_o: s.Art_o_r
${OBJASM} ${AFLAGS} -from s.Art_o_r -to $@
# Dynamic dependencies:
| Copyright 2000 Pace Micro Technology plc
|
| 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.
|
Dir <Obey$Dir>
wimpslot -min 1000k
echo amu_machine SCL_APCS="-APCS 3/26bit" lib.stubs lib.risc_oslib lib.riscoslibm lib.clib lib.ansilib
amu_machine SCL_APCS="-APCS 3/26bit" lib.stubs lib.risc_oslib lib.riscoslibm lib.clib lib.ansilib
echo MkLibs: all done
......@@ -8,7 +8,7 @@
GBLS Module_FullVersion
Module_MajorVersion SETS "4.97"
Module_Version SETA 497
Module_MinorVersion SETS "4.12.2.7"
Module_Date SETS "14 Jan 2000"
Module_FullVersion SETS "4.97 (4.12.2.7)"
Module_MinorVersion SETS "4.12.2.8"
Module_Date SETS "09 May 2000"
Module_FullVersion SETS "4.97 (4.12.2.8)"
END
......@@ -4,12 +4,12 @@
*
*/
#define Module_MajorVersion_CMHG 4.97
#define Module_MinorVersion_CMHG 4.12.2.7
#define Module_Date_CMHG 14 Jan 2000
#define Module_MinorVersion_CMHG 4.12.2.8
#define Module_Date_CMHG 09 May 2000
#define Module_MajorVersion "4.97"
#define Module_Version 497
#define Module_MinorVersion "4.12.2.7"
#define Module_Date "14 Jan 2000"
#define Module_MinorVersion "4.12.2.8"
#define Module_Date "09 May 2000"
#define Module_FullVersion "4.97 (4.12.2.7)"
#define Module_FullVersion "4.97 (4.12.2.8)"
/* Copyright 1996 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.
*/
/* > C.Arthur */
/* Copyright (C) Acorn Computers Ltd., 1988 */
#include "arthur.h"
#include <stdarg.h>
/*
** Things in the Arthur C library.
**
** See also S.ArthurAsm for the OS bits
*/
int art_osbyte1(int, int);
art_error *art_osbyte(art_reg_set *regs)
{
return art_swix(OS_Byte, regs);
}
int art_osbyte1(int num, int arg)
{
art_reg_set a;
a.r[0] = num;
a.r[1] = arg & 0xff;
a.r[2] = arg >> 8;
arg = (int)art_osbyte(&a);
return (a.r[1] & 0xff) | (a.r[2] << 8);
}
art_error *art_osword(int action, void *data)
{
art_reg_set a;
a.r[0] = action;
a.r[1] = (int)data;
return art_swix(OS_Word, &a);
}
art_error *art_osgbpb(art_osgbpb_block * data)
{
return art_swix(OS_GBPB, (art_reg_set *)data);
}
art_error *art_osfile(art_osfile_block *data)
{
return art_swix(OS_File, (art_reg_set *)data);
}
art_error *art_osargs(art_reg_set *regs)
{
return art_swix(OS_Args, regs);
}
art_error *art_osfind(art_reg_set *regs)
{
return art_swix(OS_Find, regs);
}
int art_adval(int x)
{
return art_osbyte1(128, x);
}
void art_clg()
{ art_vdu(16);
}
void art_cls()
{ art_vdu(12);
}
void art_colour(int c)
{ art_vdu(17);
art_vdu(c);
}
/* note: cursor ends up on circle */
void art_circle(int x,int y,int r)
{ art_move(x,y);
art_plot(0x95,x+r,y);
}
void art_circlefill(int x,int y,int r)
{ art_move(x,y);
art_plot(0x9D,x+r,y);
}
void art_cursor(int c)
{
art_vduq(23,1,c,0,0,0,0,0,0,0);
}
void art_draw(int x,int y)
{ art_vdu(25);art_vdu(5);
art_vduw(x);art_vduw(y);
}
void art_drawby(int x,int y)
{ art_vdu(25);art_vdu(1);
art_vduw(x);art_vduw(y);
}
void art_fill(int x,int y)
{
art_plot(0x85,x,y);
}
void art_gcol(int a,int b)
{ art_vdu(18);art_vdu(a);art_vdu(b);
}
void art_gwindow(int a,int b,int c,int d)
{ art_vdu(24);art_vduw(a);art_vduw(b);art_vduw(c);art_vduw(d);
}
int art_inkey(int n)
{
n=art_osbyte1(129,n);
if ((n & 0xFF00) == 0xFF00) return -1;
return n;
}
void art_mode(int n)
{ art_vdu(22);
art_vdu(n);
}
/*
art_mouseX();
art_mouseY();
art_mouseB();
*/
void art_move(int x,int y)
{ art_vdu(25);art_vdu(4);
art_vduw(x);art_vduw(y);
}
void art_moveby(int x,int y)
{ art_vdu(25);art_vdu(0);
art_vduw(x);art_vduw(y);
}
/* mandel() ? */
void art_origin(int x,int y)
{ art_vdu(29);art_vduw(x);art_vduw(y);
}
void art_palette(int l,int p,int r,int g,int b)
{ art_vdu(19);art_vdu(l);art_vdu(p);art_vdu(r);art_vdu(g);art_vdu(b);
}
void art_plot(int n,int x,int y)
{ art_vdu(25);art_vdu(n);
art_vduw(x);art_vduw(y);
}
int art_point(int x,int y)
{
short block[3];
block[0]=x;
block[1]=y;
block[2]=0; /* to zero high byte */
x = (int)art_osword(9,block);
return block[2];
}
int art_pos()
{ return art_osbyte1(134,0) & 0xFF;
}
void art_rectangle(int x,int y,int l,int h)
{
art_move(x,y);
art_drawby(0,h);
art_drawby(l,0);
art_drawby(0,-h);
art_drawby(-l,0);
}
void art_rectanglefill(int x,int y,int l,int h)
{
art_move(x,y);
art_plot(0x61,l,h);
}
unsigned art_rnd(unsigned n)
{
extern unsigned rand(void);
return rand()%n+1;
}
void art_stringprint(char *s)
{
while (*s) art_vdu(*s++);
}
void art_tab(int x,int y) { art_vdu(31);art_vdu(x);art_vdu(y); }
void art_tint(int type, int mask)
{
art_vdu(23);art_vdu(17);
art_vdu(type & 3);
art_vdu((mask << 6) & 0x0c0);
art_vduw(0);art_vduw(0);art_vduw(0);
}
/*
** array of length of sequence for vdu codes
** it is assumed that the correct number of arguments has been supplied
*/
static char Qlen[32] =
{ 1, /* VDU 0 */
2, /* next character to printer only */
1, /* printer on */
1, /* printer off */
1, /* print at text cursor */
1, /* print at graphics cursor */
1, /* enable VDU driver */
1, /* beep */
1, /* backspace */
1, /* forward space (horizontal tab) */
1, /* line feed */
1, /* up a line */
1, /* clear (text) screen */
1, /* carriage return */
1, /* page mode on */
1, /* page mode off */
1, /* clear graphics window */
2, /* define text colour */
3, /* define graphics colour */
6, /* define logical colour */
1, /* restore default palette */
1, /* disable VDU drivers */
2, /* Select screen mode */
10, /* VDU 23,.. */
9, /* set graphics window */
6, /* PLOT ... */
1, /* restore default windows */
1, /* ESCAPE char - no effect */
5, /* define text window */
5, /* define graphics origin */
1, /* home cursor */
3 /* tab cursor */
/* and all the rest are 1 */
};
/*
** send the appropiate number of characters to art_vdu()
** it is assumed that the correct number of arguments has been supplied
*/
void art_vduq(int c,...)
{ va_list ap;
int n;
art_vdu(c);
if (c>=' ') return;
va_start(ap,c);
n=Qlen[c];
while(--n)
{ art_vdu(va_arg(ap,int));
}
va_end(ap);
}
int art_vpos()
{
return art_osbyte1(134,0) >> 8;
}
/******************************************************************************
Now for the new sound functions
******************************************************************************/
void art_sound(chan, amp, pitch, dur, futime)
int chan, amp, pitch, dur, futime;
{
art_reg_set a;
a.r[2] = (chan &0x0000ffff) | (amp << 16);
a.r[3] = (pitch & 0x0000ffff) | (dur << 16); /* compact bits */
if(futime != -2) {
a.r[0] = futime;
a.r[1] = 0;
a = art_swi(Sound_QSchedule, &a);
}
else
a = art_swi(Sound_Sound, (art_reg_set *)(8 + (int)(&a))); /* fast! */
}
void art_sound_on()
{
art_reg_set a;
a.r[0] = 2;
a = art_swi(Sound_Enable, &a);
}
void art_sound_off()
{
art_reg_set a;
a.r[0] = 1;
a = art_swi(Sound_Enable, &a);
}
void art_voices(int chan)
{
art_reg_set a;
a.r[1] = a.r[2] = a.r[3] = a.r[4] = 0;
a.r[0] = chan;
a = art_swi(Sound_Configure, &a);
}
void art_stereo(int chan, int pos)
{
art_reg_set a;
a.r[0] = chan;
a.r[1] = pos;
a = art_swi(Sound_Stereo, &a);
}
void art_set_beats(int length)
{
art_reg_set a;
a.r[0] = length;
a = art_swi(Sound_QBeats, &a);
}
int art_get_beats()
{
art_reg_set a;
a.r[0] = -1;
a = art_swi(Sound_QBeats, &a);
return a.r[0];
}
int art_get_beat()
{
art_reg_set a;
a.r[0] = 0;
a = art_swi(Sound_QBeats, &a);
return a.r[0];
}
void art_set_tempo(int newtemp)
{
art_reg_set a;
a.r[0] = newtemp;
a = art_swi(Sound_QTempo, &a);
}
int art_get_tempo()
{
art_reg_set a;
a.r[0] = 0;
a = art_swi(Sound_QTempo, &a);
return a.r[0];
}
/******************************************************************************
The WIMP functions - most of them in m/c in arthurasm for compactness
******************************************************************************/
int art_w_initialise(art_error * e)
{
art_reg_set a;
art_error * eo;
eo = art_swix(Wimp_Initialise, &a);
if((e->errnum = (int)eo) != 0)
*e = *eo;
return a.r[0];
}
int art_create_wind(art_wind_block *details, art_error *e)
{
art_reg_set a;
art_error * eo;
a.r[1] = (int)details;
eo = art_swix(Wimp_CreateWindow, &a);
if((e->errnum = (int)eo) != 0)
*e = *eo;
return a.r[0];
}
int art_create_icon(art_icon_block *details, art_error * e)
{
art_reg_set a;
art_error * eo;
a.r[1] = (int)details;
eo = art_swix(Wimp_CreateIcon, &a);
if((e->errnum = (int)eo) != 0)
*e = *eo;
return a.r[0];
}
void art_delete_wind(int handle, art_error *e)
{
art_reg_set a;
art_error * eo;
a.r[1] = (int)&handle;
eo = art_swix(Wimp_DeleteWindow, &a);
if((e->errnum = (int)eo) != 0)
*e = *eo;
}
void art_delete_icon(int wind, int icon, art_error *e)
{
art_reg_set a;
int i[2];
art_error * eo;
i[0] = wind;
i[1] = icon;
a.r[1] = (int)i;
eo = art_swix(Wimp_DeleteIcon, &a);
if((e->errnum = (int)eo) != 0)
*e = *eo;
}
void art_open_wind(art_open_block *details, art_error *e)
{
art_reg_set a;
art_error * eo;
a.r[1] = (int)details;
eo = art_swix(Wimp_OpenWindow, &a);
if((e->errnum = (int)eo) != 0)
*e = *eo;
}
void art_close_wind(int handle, art_error *e)
{
art_reg_set a;
art_error * eo;
a.r[1] = (int)&handle;
eo = art_swix(Wimp_CloseWindow, &a);
if((e->errnum = (int)eo) != 0)
*e = *eo;
}
int art_poll_wimp(int mask, art_univ_block *details, art_error *e)
{
art_reg_set a;
art_error * eo;
a.r[0] = mask;
a.r[1] = (int)details;
eo = art_swix(Wimp_Poll, &a);
if((e->errnum = (int)eo) != 0)
*e = *eo;
return a.r[0];
}
int art_redraw_wind(art_redraw_block *details, art_error *e)
{
art_reg_set a;
art_error * eo;
a.r[1] = (int)details;
eo = art_swix(Wimp_RedrawWindow, &a);
if((e->errnum = (int)eo) != 0)
*e = *eo;
return a.r[0];
}
int art_update_wind(art_redraw_block *details, art_error *e)
{
art_reg_set a;
art_error * eo;
a.r[1] = (int)details;
eo = art_swix(Wimp_UpdateWindow, &a);
if((e->errnum = (int)eo) != 0)
*e = *eo;
return a.r[0];
}
int art_get_rectangle(art_redraw_block *details, art_error *e)
{
art_reg_set a;
art_error * eo;
a.r[1] = (int)details;
eo = art_swix(Wimp_GetRectangle, &a);
if((e->errnum =