RTR logo

BBC BASIC for SDL 2.0

BBC BASIC for Windows

Reference information



Table of ASCII codes

Binary Hex  Dec  Char 
00000000 &000 ^@NUL
00000001&011 ^ASOH Start of Heading
00000010&022 ^BSTX Start of Text
00000011&033 ^CETX End of Text
00000100&044 ^DEOT End of Transmit
00000101&055 ^EENQ Enquiry
00000110&066 ^FACK Acknowledge
00000111&077 ^GBEL Bell - Audible Signal
00001000&088 ^HBS Back Space
00001001&099 ^IHT Horizontal Tab
00001010&0A10 ^JLF Line Feed
00001011&0B11 ^KVT Vertical Tab
00001100&0C12 ^LFF Form Feed
00001101&0D13 ^MCR Carriage Return
00001110&0E14 ^NSO Shift Out
00001111&0F15 ^OSI Shift In
00010000&1016 ^PDLE Data Link Escape
00010001&1117 ^QDC1 X On
00010010&1218 ^RDC2 Aux On
00010011&1319 ^SDC3 X Off
00010100&1420 ^TDC4 Aux Off
00010101&1521 ^UNAK Negative Acknowledge
00010110&1622 ^VSYN Synchronous Idle
00010111&1723 ^WETB End of Transmitted Block
00011000&1824 ^XCAN Cancel
00011001&1925 ^YEM End of Medium
00011010&1A26 ^ZSUB Substitute
00011011&1B27 ^[ESC Escape
00011100&1C28 ^\FS File Separator
00011101&1D29 ^]GS Group Separator
00011110&1E30 ^^RS Record Separator
00011111&1F31 ^_US Unit Separator

Binary Hex  Dec  Char
00100000 &2032 Space
00100001&2133 !
00100010&2234 "
00100011&2335 #
00100100&2436 $
00100101&2537 %
00100110&2638 &
00100111&2739 '
00101000&2840 (
00101001&2941 )
00101010&2A42 *
00101011&2B43 +
00101100&2C44 ,
00101101&2D45 -
00101110&2E46 .
00101111&2F47 /
00110000&3048 0
00110001&3149 1
00110010&3250 2
00110011&3351 3
00110100&3452 4
00110101&3553 5
00110110&3654 6
00110111&3755 7
00111000&3856 8
00111001&3957 9
00111010&3A58 :
00111011&3B59 ;
00111100&3C60 <
00111101&3D61 =
00111110&3E62 >
00111111&3F63 ?
 
01000000 &4064 @
01000001&4165 A
01000010&4266 B
01000011&4367 C
01000100&4468 D
01000101&4569 E
01000110&4670 F
01000111&4771 G
01001000&4872 H
01001001&4973 I
01001010&4A74 J
01001011&4B75 K
01001100&4C76 L
01001101&4D77 M
01001110&4E78 N
01001111&4F79 O
01010000&5080 P
01010001&5181 Q
01010010&5282 R
01010011&5383 S
01010100&5484 T
01010101&5585 U
01010110&5686 V
01010111&5787 W
01011000&5888 X
01011001&5989 Y
01011010&5A90 Z
01011011&5B91 [
01011100&5C92 \
01011101&5D93 ]
01011110&5E94 ^
01011111&5F95 _
 
01100000 &6096 `
01100001&6197 a
01100010&6298 b
01100011&6399 c
01100100&64100 d
01100101&65101 e
01100110&66102 f
01100111&67103 g
01101000&68104 h
01101001&69105 i
01101010&6A106 j
01101011&6B107 k
01101100&6C108 l
01101101&6D109 m
01101110&6E110 n
01101111&6F111 o
01110000&70112 p
01110001&71113 q
01110010&72114 r
01110011&73115 s
01110100&74116 t
01110101&75117 u
01110110&76118 v
01110111&77119 w
01111000&78120 x
01111001&79121 y
01111010&7A122 z
01111011&7B123 {
01111100&7C124 |
01111101&7D125 }
01111110&7E126 ~
01111111&7F127 DEL Delete


Mathematical functions

BBC BASIC has more intrinsic mathematical functions than many other versions of BASIC. Some of those that are not provided may be calculated as shown below.

Function        Definition(s)
SECANT
 DEF FNSEC(X)=1/COS(X)
COSECANT
 DEF FNCSC(X)=1/SIN(X)
COTANGENT
 DEF FNCOT(X)=1/TAN(X)
Inverse SECANT
 DEF FNARCSEC(X)=ACS(1/X)
Inverse COSECANT
 DEF FNARCCSC(X)=ASN(1/X)
Inverse COTANGENT
 DEF FNARCCOT(X)=ATN(1/X)
DEF FNARCCOT(X)=PI/2-ATN(X)
Hyperbolic SINE
 DEF FNSINH(X)=(EXP(X)-EXP(-X))/2
Hyperbolic COSINE
 DEF FNCOSH(X)=(EXP(X)+EXP(-X))/2
Hyperbolic TANGENT
 DEF FNTANH(X)=EXP(-X)/(EXP(X)+EXP(-X))*2+1
Hyperbolic SECANT
 DEF FNSECH(X)=2/(EXP(X)+EXP(-X))
Hyperbolic COSECANT
 DEF FNCSCH(X)=2/(EXP(X)-EXP(-X))
Hyperbolic COTANGENT
 DEF FNCOTH(X)=EXP(-X)/(EXP(X)-EXP(-X))*2+1
Inverse Hyperbolic SIN
 DEF FNARCSINH(X)=LN(X+SQR(X*X+1))
Inverse Hyperbolic COSINE
 DEF FNARCCOSH(X)=LN(X+SQR(X*X-1))
Inverse Hyperbolic TANGENT
 DEF FNARCTANH(X)=LN((1+X)/(1-X))/2
Inverse Hyperbolic SECANT
 DEF FNARCSECH(X)=LN((SQR(-X*X+1)+1)/X)
Inverse Hyperbolic COSECANT
 DEF FNARCCSCH(X)=LN((SGN(X)*SQR(X*X+1)+1)/X
Inverse Hyperbolic COTANGENT
 DEF FNARCCOTH(X)=LN((X+1)/(X-1))/2
LOGn(X)
 DEF FNLOG(N,X)=LN(X)/LN(N)
DEF FNLOG(N,X)=LOG(X)/LOG(N)


Keyword tokens

BBC BASIC internal-format programs are tokenised, that is BASIC keywords are represented as single-byte values. This results in programs which are shorter and which execute faster; see the Format of data in memory section for more details. The following table lists the token value for each keyword in BBC BASIC for Windows and BBC BASIC for SDL 2.0:
Token  Keyword
&80AND
&81DIV
&82EOR
&83MOD
&84OR
&85ERROR
&86LINE
&87OFF
&88STEP
&89SPC
&8ATAB( 3
&8BELSE
&8CTHEN
&8Dline number 1
&8EOPENIN
&8FPTR (right) 2
 
&90PAGE (right) 2
&91TIME (right) 2
&92LOMEM (right) 2
&93HIMEM (right) 2
&94ABS
&95ACS
&96ADVAL
&97ASC
&98ASN
&99ATN
&9ABGET
&9BCOS
&9CCOUNT
&9DDEG
&9EERL
&9FERR
 
&A0EVAL
&A1EXP
&A2EXT
&A3FALSE
&A4FN
&A5GET
&A6INKEY
&A7INSTR( 3
&A8INT
&A9LEN
&AALN
&ABLOG
&ACNOT
&ADOPENUP
&AEOPENOUT
&AFPI
 
&B0POINT( 3
&B1POS
&B2RAD
&B3RND
&B4SGN
&B5SIN
&B6SQR
&B7TAN
&B8TO 4
&B9TRUE
&BAUSR
&BBVAL
&BCVPOS
&BDCHR$
&BEGET$
&BFINKEY$
 
&C0LEFT$( 3
&C1MID$( 3
&C2RIGHT$( 3
&C3STR$
&C4STRING$( 3
&C5EOF
&C6SUM
&C7WHILE
&C8CASE
&C9WHEN
&CAOF
&CBENDCASE
&CCOTHERWISE
&CDENDIF
&CEENDWHILE
&CFPTR (left) 2
 
&D0PAGE (left) 2
&D1TIME (left) 2
&D2LOMEM (left) 2
&D3HIMEM (left) 2
&D4SOUND
&D5BPUT
&D6CALL
&D7CHAIN
&D8CLEAR
&D9CLOSE
&DACLG
&DBCLS
&DCDATA
&DDDEF
&DEDIM
&DFDRAW
 
&E0END
&E1ENDPROC
&E2ENVELOPE
&E3FOR
&E4GOSUB
&E5GOTO
&E6GCOL
&E7IF
&E8INPUT
&E9LET
&EALOCAL
&EBMODE
&ECMOVE
&EDNEXT
&EEON
&EFVDU
 
&F0PLOT
&F1PRINT
&F2PROC
&F3READ
&F4REM
&F5REPEAT
&F6REPORT
&F7RESTORE
&F8RETURN
&F9RUN
&FASTOP
&FBCOLOUR5
&FCTRACE
&FDUNTIL
&FEWIDTH
&FFOSCLI
 
&00reserved
&01CIRCLE
&02ELLIPSE
&03FILL
&04MOUSE
&05ORIGIN
&06QUIT
&07RECTANGLE
&08SWAP
&09SYS
&0ATINT
&0BWAIT
&0CINSTALL
&0Dend of line
&0EPRIVATE
&0FBY
 
&10EXIT
&11spare
&12spare
&13spare
&14spare
&15spare
&16spare
&17spare
&18reserved (fast FN/PROC) 6
&19reserved (fast byte) 6
&1Areserved (fast dword) 6
&1Breserved (fast double) 6
&1Creserved (fast variant) 6
&1Dreserved (fast structure) 6
&1Ereserved (fast qword) 6
&1Freserved (fast string) 6
Notes:
  1. Token value &8D doesn't represent a keyword, but marks the presence of an encoded line number (e.g. following a GOTO, GOSUB or RESTORE).

  2. The pseudo-variables PTR, PAGE, TIME, LOMEM and HIMEM each have two tokens, depending on whether they are being written (i.e. to the left of an equals sign) or read (to the right of an equals sign).

  3. The tokens for TAB, INSTR, POINT, LEFT$, MID$, RIGHT$ and STRING$ include the opening bracket; there cannot be a space between the keyword and the bracket.

  4. The keyword TOP does not have a token. It is represented by the token for TO followed by a P.

  5. Both COLOUR and COLOR are accepted, but the token is always listed as COLOUR.

  6. These tokens are used internally by the compiler and run-time-engine. They should not normally appear in a saved BASIC program.

Left CONTENTS

CONTINUE Right


Best viewed with Any Browser Valid HTML 3.2!
© Richard Russell 2021