OsByte Calls ============ A=&00 (0) Return Operating System Number On entry: X=0 Execute error giving OS version message, error number 247 X<>0 Returns OS number in X On exit: If X<>&80 on entry: X=0 OS 1.00 - Early BBC, Electon OS 1.00 X=1 OS 1.20 - BBC B or American MOS X=2 OS 2.00 - BBC B+ X=3 OS 3.2x - Master 128 X=4 OS 4.00 - Master ET X=5 OS 5.00 - Master Compact X=6 OS 6.00 - Archimedes X=7 Springboard X=8 UNIX X=32 BBCBASIC(86) running on an IBM PC BBCBASIC(86) implements all OsByte calls as OsByte 135/&87, Read character at text position. This usually returns 32 (space). If X=&80 on entry: X<&40 No response to call, OS version same as above X>&3F OS version sub-number plus &40 A=&01 (1) User OsByte Call/Program Return Value On entry: X=value to set user variable to On exit: X=old value A=&02 (2) Select input stream On entry: X=0 Keyboard selected, RS232 disabled X=1 RS232 selected and enabled X=2 Keyboard selected, RS232 enabled On exit: X=corrupted A=&03 (3) Select output stream On entry: X determines the output stream as follows: bit 0 Enables RS232 driver bit 1 Disables VDU driver bit 2 Disables printer driver bit 3 Enables printer, independant of VDU 2 or 3 bit 4 Disables spooled output bit 5 not used bit 6 Disables printer driver unless preceded by VDU 1 bit 7 not used On exit: X=old value A=&04 (4) Set cursor editing state On entry: X=0 Enable cursor editing (default) X=1 Editing keys give ASCII codes &87 to &8B X=2 Editing keys are soft keys 11 to 15 X=3 Cursor keys have joystick effect, COPY is fire (Compact) On exit: X=previous state A=&05 (5) Select printer destination This call flushes the printer buffer and selects a new printer. The destination is not reset on a soft Break. On entry: X=0 printer sink X=1 Parallel printer, Centronics port X=2 Serial printer, RS232 port X=3 User printer X=4 Network printer X>4 User printer On exit: X=previous printer destination A=&06 (6) Select printer ignore character On entry: X=character to be ignored On exit: X=previous setting A=&07 (7) Set RS232 receive rate A=&08 (8) Set RS232 transmit rate On entry: X=0 X=1 75 baud X=2 150 baud X=3 300 baud X=4 1200 baud X=5 2400 baud X=6 4800 baud X=7 9600 baud X=8 19200 baud On exit: YX contain old serial ULA contents A=&09 (9) Set mark duration of flashing colours This call sets the duration of the mark state of flashing colours, ie the duration of the first named colour. On entry: X=0 Sets to infinity. Forces mark state if space set to zero. X<>0 Sets mark duration in centiseconds (default 25) On exit: X=old mark duration A=&0A (10) Set space duration of flashing colours This call sets the duratin of the space state of flashing colours, ie the duration of the second named colour. On entry: X=0 Sets to infinity. Forces space state if mark set to zero. X<>0 Sets space duration in centiseconds (default 25) A=&7E (126) Acknowledge ESCAPE with effects This call attempts to clear the Escape condition. All active buffers will be flushed, any open EXEC file will be closed and the VDU paging counter and the VDU queue will be reset. No entry parameters On exit: X=0 No Escape condition found X<>0 The Escape condition cleared A=&7F (127) Check EOF status on open file On entry: X=channel number On exit: X=0 EOF not reached X<>0 EOF true A=&80 (128) Read ADC channel/Mouse coordinates/Buffer sizes This call is used by Basic's ADVAL function and read the ADC channels, the mouse coordinates and return the free space left in the system buffers. (a) Read last ADC channel converted and fire buttons On entry: X=0 On exit: Y=last channel converted X=contains fire button states in bits 0 and 1 (b) Read ADC channel On entry: X=1 Read ADC channel 1 X=2 Read ADC channel 2 X=3 Read ADC channel 3 X=4 Read ADC channel 4 X=5 X=6 On exit: YX=ADC value read (c) Read mouse coordinates On entry: X=7 Return X position of mouse X=8 Return Y position of mouse On exit: YX=mouse coordinate (d) Read buffer free space On entry: X=&FF (-1) Keyboard buffer X=&FE (-2) RS232 input buffer X=&FD (-3) RS232 output buffer X=&FC (-4) Printer buffer X=&FB (-5) Sound channel 0 X=&FA (-6) Sound channel 1 X=&F9 (-7) Sound channel 2 X=&F8 (-8) Sound channel 3 X=&F7 (-9) Speech buffer X=&F6 (-10) Mouse buffer On exit: YX=number of bytes free in buffer A=&81 (129) Read Key or Machine Type This call is used by Basic's INKEY function and can be used to get a character from the keyboard within a time limit, scan the keyboard for a particular character or return information about the machine type. (a) Read key with time limit On entry: XY<&8000 time limit in centiseconds On exit: If character detected, X=ASCII value of key, Y=&00 and Cy=0 If no character detected, Y=&FF, Cy=1 (X=&00) If ESCAPE pressed, Y=&1B (27), Cy=1 (X=&00) (b) Scan for key On entry: X=negative INKEY value of key Y=&FF On exit: X and Y contain &FF if the key is being pressed (c) Information on machine type On entry: X=&00 Y=&FF On exit: X holds a value indicating the machine type: X=&FF -1 BBC Microcomputer (OS 1.00/1.20) X=&FE 254 American BBC Microcomputer X=&FD 253 Master 128 X=&FC 252 West German BBC Microcomputer X=&FB 251 BBC B+ X=&FA 250 Acorn Business Computer X=&F9 249 X=&F8 248 X=&F7 247 Master ET X=&F6 246 X=&F5 245 Master Compact X=&F4 244 X=&F3 243 X=&F2 242 X=&F1 241 X=&F0 240 X=&Ax Archimedes: X=&A5 165 Archimedes RISC OS 3.5x X=&A4 164 Archimedes RISC OS 3.1x X=&A3 163 Archimedes RISC OS 3.0x X=&A2 162 Archimedes RISC OS 2.01 X=&A1 161 Archimedes RISC OS 2.00 X=&A0 160 Archimedes Arthur OS X=&01 1 Electron X=&00 0 BBC Microcomputer, (OS 0.10) A=&82 (130) Read machine high order address This call provides the top 16 bit high order address of the environment the program is running in. No entry parameters On exit: YX contains the high order address: YX=&FFFF Running in i/o processor YX<&FF00 Running in co-processor A=&83 (131) Return OSHWM (lowest address of user memory) This call returns the address of the first byte in memory not used by the operating system and so available as user memory. It is used by Basic to initialise PAGE. No entry parameters On exit: YX contains address of first byte of user memory A=&84 (132) Return top of user memory This call returns the address of the first byte in memory not available for the user. It is used by Basic to initialise HIMEM. No entry parameters On exit: YX contains address of byte after end of user memory A=&85 (133) Return address of top of user memory for given mode This call returns the address of the top of user memory in the i/o processor if the given mode was changed to. On entry: X=screen mode number On exit: YX=address of top of user memory in i/o processor for given mode A=&86 (134) Read input cursor position This is used by Basic to return the cursor position in POS and VPOS. During text editing, the input cursor position is returned. No entry parameters On exit: X=X coordinate Y=Y coordinate A=&87 (135) Read character at cursor position and screen mode No entry parameters On exit: X=character value or 0 if unrecognised Y=screen mode number (0-127, ignoring shadow state) A=&88 (136) Perform *CODE This call is performed by the *CODE command and passes the parameters to USERV with A=0. On entry: X,Y are passed on to the USERV routine On exit: X,Y contain the values returned from the USERV routine. A=&89 (137) Perform *MOTOR This call is performed by the *MOTOR command and switches the cassette motor relay (if present) on and off. On entry: X=0 Relay off X<>0 Relay on Y Ignored. CFS sets Y=0 for reads and Y=1 for writes. On exit: X,Y corrupted A=&8A (138)