• Keine Ergebnisse gefunden

i~ffIBR~titbE~D3,0)

1- ABC DEFI

Returns a string of spaces of <num-exp> length.

Example: PRINT LEFT$(A$,3)&SPACE$(4)&MID$(A$,4,5) ABC DEFGH

IDd1catea a' -trias o~ nuaerio characters repreaenti.q the ftlue

or

the...no up ... 10.. !here are DO leadiDg or trail i

ns

blaaka.

Example: PRINT "ABC"oSTR$(1.23)oftDEF"

ABC1.23DEF ' , PRINT "ABC"·1.23"IIDEF"

ABC 1.23 DE~ . '

Indicates a string of characters in normalized time format (1.e., bh:mm:ss) representing the numeric expression interpreted as the number of seconds since midnight of the current day. The value 0 (zero) is interpreted as the current time ot day. The numeric e~pression must be in the range of 0 - 86399 or the function will return the time "00:00:00-.

Example: PRINT TlME$(7199),TlME$(0)

01:59:59 15:24:32

!IlI$«atP.lD&-ezp»

Removes any leading or trailing spaces and reduces all embedded '

. multiple spaces to a single space.

Example: PRINT "I""TRIM$("

IABC DEF

HIJI .

ABC DEF HIJ ")j"l"

BJSl:C I n B

CIIlPID 10: IOcrICIIS 10.1& IDpu~/Oa~pu~ FuaeUOIUI

Dr

BASXC ley B

Returns the ASCII, integer value of the first 'character ot the last input, if the first character was a control character or a user defined key. When the first character was not acontrol character, the value of the function is O. For example: it the' last inpu~ was a CTRL/D the value of the INP is 4. It the last input was a CTRL/Z the value of INP is 26. If the last input _was ABCDEFG the value of INP is O. _

"-Also see the appendix on "User Definable Keys".

Returns the integer value of. the ATTACHed line length of device opened on the I/O channel whose value is <num-exp>. I/O channel

o

may be used to indicate the console device.

Example: PRINT LINE(O) REM Console terminal 79

Returns the integer value of the ATTACHed page length of device opened on the I/O channel whose value is <num-exp>. I/O channel

o

may be used to indicate the console device.

Example: PRINT PAGE(O). REM Console terminal

23 .

Returns the integer count of the number of characters output on the I/O channel indicated by the numeric expression.

Example: PRINT "123456";POS(O) . 123456 6

- 165 - VO FUllCUCIIS

BJSI:C IIFBIIIICB IlDUAL 10.5 Logical PUDot:1ou'

The following functions allow the programmer to manipulate the bits of an integer value (binary word--16 bits). All of_ the arguments are numeric expressions whose value will be integ~rized.

LIL« __ exp1>,<Jma-exp2>1 If the valqe for either of the expressions is negative .-, tnen it is replaced with the value O. -If the first exprression

is greater than 65535 then it is replaced with the value 0. If the second expression is greater than 15 then it is replaced with the value O. A logical rotate lett is perfor.med on the first integer tor (num-exp2> bit-positions. ' .

LII«~ezp1>,<a~2» If the value tor either of-the expressions is negative then it is replaced with the value O. It the first expression is greater than 65535 then it 1s replaced with the value O. It the second expression is greater than 15 then it is replaced with the value 9. A logical rotate right is performed on the value of (num-exp1> for (num-exp2> bit positions. . . LSL(~exp1>,<mDl exp2» If the value for either of the expressions is negative

then it is replaced wi th the value O. " If the first expression , is greater than 65535 then it, is replaced with the value 0., If the second expression is greater than 15 then it is replace¢

with the value 9. A logical shift lett is performed on the value .of' (num-exp1> for <num-exp2> bit positions.

LSI(<ua.-exp1>,<au. ~2» If the value tor either of the expressions is negative then it is replaced with the value O. If the first expression is greater than 65535 then it is replaced with the value O. If the second expression is greater than 15 then it is replaced with the value 9. A 1081cal shift right is performed on the value O't <num-ex·p 1> -for <num-exp2> bi t -posi tions.

10.6 Plle P1mct:10D .

IOP( (DU.

exp»

The numeric expression is evaluated and the I/O channel corresponding to that value is checked for end-of-file-condition. If the channel has not reached end-of-file the value of the function is 0 (false). If the Qhannel has reached end-of-file the value of the function is -1 (true) •.

Channel zero (console) is never at end-Of-file and will cause an error if tested with this function. Use the INP function to test for a CTRL/Z.

-. 166 - BJSl:C ley B

. CIIlPDI 10: F1JJICUc.s 1 0 ~ 1- Error FuacU.oDa

The following two functions do not have any arguments and should only be used in an error handling routine (see ON ERROR and RESUME statments).

I. BIL R eturns the integer line num er. of the statement causing the b

BASI:C ley B

error to occur. A value of zero is returned if no error has . occured.

Note: When this - function is used on the left side of a relational expression and an unsigned integer is used on the right side - of the same relational expression the RENUMBER command will assume that the unsigned integer is a line number

~nd adjust it accordingly. . . _

Note 2: When this function is used in a compiled 'program the value returned will be that of the hexadecimal address of the statement causing the error. This address is the same as that listed when the program-was compiled. This should not affect·

the programmer except when th~ value of ·this function is

displayed on the screen. .

Retur~ the integer error number of the error that occured. ' A value of zero is returned if no error has occured. For a list of error numbe~s, their meanings and what might cause them see

the app~ndix nErro~ Messages". .

This function may be assigned a value with the LET statement in order that error handling routines may be tested.

- 161 - BOOR FUllCUCIIS

BASIC IBPBIIICB IIDOJL 10.8 1J8JI PuDcu'OIl

. "

The USR function allows the BASIC programmer to interface a assembler language subroutine to the BASIC language program.

When the user requires a procedure t~ be accomplished that requires real-time processing or can only be d.one with the features of the CPU that are not available to the-BASIC program, he must write an assembler language program. In many cases it 1s advantageous to only have apart of the procedure written in assembler code

wit~ the more routine processes accomplished with a BASIC langu~e program. In order to' transfer control and data between the user written subroutine ,and the BASIC program the USH function is used.

-OSI«addr>,<au.ezp»

USB(<adclr>,<atr.1Da-4xp»

(addr) (num-exp>

(string-exp>

refers to the entry point address, relative to the load address of the assembler subrouti·ne.

when evaluated and rounded to .the nearest integer, is the sixteen bits of Signed integer data to be transmitted to the assembler subroutine via the HL registers. When the subroutine is ready to return control back to BASIC the numeric value to be assigneCi to the function should be placed in the HL register

pair. .

when evaluated, is left in the ftstring accumulatorft. The address of this string accumulator is placed in the HLregister pair before control is given to the user subroutine. The string accumulator is a 256 byte area that contains a one byte lengtn followed by up to 255 characters. This area may be used by the subroutine as long as care is taken not ·to exceed the 256 byte limit. When the subroutine 1s ready to return control back to . BASIC1 it should load the HL. register pair with the address of the s~ring that is to be re.turned.

The USH function is a standard function call and may be used in any pos1tion of a BASIC statement that the other functions may be used.

Only one user written assembler language subroutine may be in memory while BASIC is executing however the one subroutine may in fact· be several subroutines concatenated. together. Information may be found regarding assembly language programming in the OASIS MACRO Assembler ~anguage Reference Manual. . The subroutine is loaded into memory by specifying it in an OPTION USR statement.

The 9ASIS MACRO Assembler Language Reference Manual has an example of a USH

routl.ne. .

- 168 - B.lSZC 1_ B

APPBlDD .l IBSBIItBD VODS

The following words are reserved and may not be 'used for variable names. Tha

notation [ ••• l means that a variable may not even start with the word indicated, if that variable is ever used with an implIed LET s t a t e m e n t . , .

===================================================================================

ABS FIX MAX RIGHT

AND FLOAT MID . RND

ASC FNEND MIN ROUND

AT FN[ ••• ] MOD RPAD

ATN FOR MOUNT RPT

BIN FORMAT NBR RTRIM

BINOF GET NEXT RUN

CASE GOSUB OCT' SCH

CEND GOTO OCTOF SEC

CHAIN HEX ON SELECT

CHR HEXOF OPEN SGN

CLEAR IF OPTION SIN

CLOSE IFEND OR SLEEP

COMMON IMP OTHERWISE SPACE

COS INP OUTPUT SQR

CRT INPUT OVR . STEP

CSI INS PAGE STOP

DATA INT PI STR

DATE LEFT .POS TAN

DAY LEN PRINT THEN

DEF LET PROMPT TIME

DEL LINE PUT TRIM

DELETE LINK QUIT UNLOCK

DIM LIN PUT QUOTE USR

DTE LOG RANDOMIZE VAL

ELSE LPAD READ WAIT

END LRL READNEXT WEND

EOF LRR REM WHILE

EQV .LSL REM[ ••• ] WRITE

ERL LSR REP XOR

ERR LTRIM RESTORE

EXP MAT RESUME

EXT MATCH RETURN

---

---~---~---• All "variables" 'that start with the

reference to a user defined function. letters FN will ,lways be treated as a {See DEF statement.

BJSl:C ley B - 169 - IISBIYBD VOIIDS

APP.IJIDD B definable keys bI BASIC. The displayable ASCII characters have de.cima1 values between 32 and 127, inclUSive. 'To determine the exact values generated oy these