BBC Small-C Functions -------------------------------- Release 0.73, xx-xxx-2005, J.G.Harston -------------------------------------- -------------------------------------------------------------------------- NAME os_cli SYNOPSIS void os_cli(s) char *s; /* string to pass to OSCLI */ -------------------------------------------------------------------------- NAME os_byte SYNOPSIS int os_byte(type, XYparam) int type; /* A register parameter */ int XYparam; /* X and Y register parameter */ DESCRIPTION Calls osbyte with A=type, X=XYparam mod 256, Y=XYparam div 256. Returns X+256*Y, ie the value held in XY. NOTES It is not os_byte(A,X,Y). It is os_byte(A,X+Y*256) with only two parameters. Also, the current implementation does not return the carry state. -------------------------------------------------------------------------- NAME os_fx SYNOPSIS int os_fx(a, x, y) int a; /* OSBYTE function in A */ int x; /* OSBYTE X value */ int y; /* OSBYTE Y value */ DESCRIPTION Calls osbyte with A,X,Y set to the entry values. Returns the value held in X. -------------------------------------------------------------------------- NAME os_word SYNOPSIS int os_word(type, address) int type; /* A register parameter */ int *address; /* integer parameter block */ or char *address; /* character parameter block */ DESCRIPTION Calls osword with A=type, X=address mod 256, Y=address div 256, ie XY points to the parameter block. NOTES Returns Y in the low byte and Carry in the high byte. Note that this is only valid with osword 0 - read a line - when it holds the returned line length. When working on the second processor, the Tube OS only transfers enough of the parameter block that it thinks will be suffient. Bear this in mind when writing and/or using extra osword calls. The lengths are: osword 0 Special case - read a line. oswords 1 to 20 Varying, enough for the standard osword calls and the NFS osword primitives. However, some systems don't allow enough for osword 14 - read real time clock, reading only 16 bytes instead of 25. oswords 21 to 127 16 bytes. oswords 128 to 255 Determined by parameter entries. XY+0 holds the 'send' block length and XY+1 holds the 'receive' block length. -------------------------------------------------------------------------- NAME os_wrch SYNOPSIS os_wrch(c) char c; /* character */ DESCRIPTION Sends a character to the oswrch vdu output. The character is sent 'pure', no modifications are performed on it as with putc(). -------------------------------------------------------------------------- NAME os_rdch SYNOPSIS int os_rdch(void) DESCRIPTION Returns A in low byte and Carry in second byte. -------------------------------------------------------------------------- NAME os_file SYNOPSIS int os_file(type, name, fcb) int type; /* osfile command */ char *name; /* filename */ int *fcb; /* file control block */ DESCRIPTION Calls osfile with A=type and XY=fcb. Returns the filetype in A. -------------------------------------------------------------------------- long os_args(a, handle, arg); int a OSARGS function in A int handle file handle in Y long arg argument to write, or zero to read Returns the new argument. -------------------------------------------------------------------------- int os_bget(handle); int handle file handle in Y Returns A in low byte and Carry in second byte. -------------------------------------------------------------------------- int os_bput(ch, handle); int ch character to BPUT in A int handle file handle in Y -------------------------------------------------------------------------- int os_gbpb(a, handle, block); int a OSGBPB function in A int handle file handle in block[0] char *block address of control block in XY Returns A in low byte and Carry in second byte. -------------------------------------------------------------------------- int os_find(a, name); int a OSFIND function in A char *name filename Returns file handle in A -------------------------------------------------------------------------- void os_close(handle); int handle OSFIND handle in Y -------------------------------------------------------------------------- char *os_report(); Returns address of error block from &FD/&FE. -------------------------------------------------------------------------- void os_error(err, s); int err error number char *s error string Generates a BRK error. -------------------------------------------------------------------------- int os_escape(); Returns the escape state from &FF -------------------------------------------------------------------------- void os_onerror(f); void *f(void) function to jump to when an error occurs, or NULL -------------------------------------------------------------------------- char *os_call(regs); char *regs register block A,X,Y,P,PC Returns pointer to a register block holding A,X,Y,P -------------------------------------------------------------------------- int os_host() Returns the current BBC host type, as follows: Note: provisional, will be changed #define _kernel_HOST_UNDEFINED -1 #define _kernel_BBC_MOS1_0 0 #define _kernel_BBC_MOS1_2 1 #define _kernel_BBC_ACW 2 #define _kernel_BBC_MASTER 3 #define _kernel_BBC_MASTER_ET 4 #define _kernel_BBC_MASTER_COMPACT 5 #define _kernel_ARTHUR 6 #define _kernel_RISC_OS 6 #define _kernel_SPRINGBOARD 7 #define _kernel_A_UNIX 8 #define _kernel_AMSTRAD 30 #define _kernel_SPECTRUM 31 #define _kernel_PC 32 -------------------------------------------------------------------------- #define __bbc__ Macro defined when targetting the BBC platform --------------------------------------------------------------------------