Home > Vidicode > Communications System > Vidicode Argus Basic Programmers Reference Manual

Vidicode Argus Basic Programmers Reference Manual

    Download as PDF Print this page Share this page

    Have a look at the manual Vidicode Argus Basic Programmers Reference Manual online for free. It’s possible to download the document as PDF or print. UserManuals.tech offer 9 Vidicode manuals and user’s guides for free. Share the user manual or guide on Facebook, Twitter or Google+.

    							ARGUS Programmable Modem 
    BASIC Programmers Reference Manual 
    © 1990 - 1997 Vidicode Datacommunicatie BV 
    8
      
    The quality of mercy is not strained..
    Constants are so-called because they have a fixed value that does not change during program execution. 
     
    The term variable is used to describe a named piece of data whose value can change during program execution.  For 
    example: 
    X=25
    Quote$=The quality of mercy is not strained..
    Here, X and Quote$ are variables which can be given different values at different times.  After the command: 
    X=43
    the value of X will be 43, not 25 as previously. 
     
    There are only two types of constants and variables in modem BASIC which are known as integers and strings.  Floating 
    point (fractional) numbers are not allowed. 
    Variable names 
    Variable names must start with a letter, may contain letters, numbers and the underline character and may be up to 127 
    characters long.  They may be typed in upper or lower case but the modem will convert them during listing so that only the 
    first character is capitalized.  The underline character is generally used to split a variable name into two or more parts to 
    make it more readable, in which case the first letter after each underline will also be capitalized. 
     
    The following are examples of valid variable names: 
    A X395
    Home_Num$ Start_Pointer
    Inp_Line$ S$
    Name$ Start_Date$
    Telephone Temperature
    String variable names are suffixed by $ as in most versions of BASIC, but, whereas it is normal to use the % or # symbols 
    to distinguish between integer and floating point variables, this is not necessary on the modem so that any variable not 
    suffixed by $ will be treated as an integer. 
    Integers & integer arrays 
    Argus BASIC will handle integer numbers and variables in the range -32768 to 32767 ($0000 - $FFFF).  Arrays (tables) can 
    only have one dimension and the number of elements is limited to 32767.  Space for arrays is allocated using the standard 
    form of the DIM command.  For example: 
    DIM A(100)
    reserves space for 100 integers in array A. Only 1 dimensional arrays are allowed. Multiple arrays can be defined in a single 
    DIM command: 
    DIM Table1(300), Table2(500)
    To assign the contents of the tenth element in the array Table1 above, to the integer variable R, you would use the notation: 
    R=Table1(9)
    Element 0 is the first element. 
    Integers occupy two bytes of memory. 
    Strings & string arrays  
    						
    							ARGUS Programmable Modem 
    BASIC Programmers Reference Manual 
    © 1990 - 1997 Vidicode Datacommunicatie BV 
    9
      
    Strings are sequences of up to 32767 characters enclosed in double quotes. 
    String variables are assigned values using the equal = sign: 
    Postcode$=GL53 7PJ
    Title$=Introduction to Basic
    Arrays of strings can also be defined: 
    DIM Options$(8)
    DIM Lines1$(200), Line2$(50)
    Strings can be added using the + sign, or by just writing the one after the other; thus A$B$ is the same as A$+B$. 
     
    When A$=ABC and B$=DEF and these two strings are added, the result will be ABCDEF as one string. 
    The minus sign can also be used with strings, but its operation is very different.  It will search for the numerical location 
    where a given string is found within another string.  Thus: 
    x=HELLO - LL
    will result in x=3. 
     
    If the result is 0, the string was not found.  E.g.: 
    IF A$ - Post GOSUB Zip
    will execute the procedure Zip only if Post is found in A$. 
     
    Normally when you input a string a carriage return will terminate the input.  To insert a carriage return between B$ and C$ 
    use A$=B$C$; or to add a carriage return use A$=A$. 
    Labels 
    In addition to line numbers, Argus BASIC allows the use of labels to uniquely identify particular program lines; e.g. the first 
    line of a subroutine. 
     
    Label names must be preceded by a % symbol and must appear at the start of a line immediately following the line number.  
    In all other respects labels obey the same rules as variable names and, as with variables it is advisable to choose meaningful 
    names that indicate the function of the label. 
    300%Count_pulses
    550%Check_password
    Labels can be used interchangeably with line numbers in commands such as GOSUB and GOTO: 
    GOTO Try_again
    GOSUB Mail
    IF A=1 GOTO Yes ELSE GOTO No
    The commands LIST and DELETE can also be used with labels: 
    LIST phone
    LIST p1,p2
    DELETE part3,part16
    To retain compatibility with earlier versions of Argus BASIC, it is permissible to precede the label with %.  Thus: 
    GOSUB %Mail
    is equivalent to:  
    						
    							ARGUS Programmable Modem 
    BASIC Programmers Reference Manual 
    © 1990 - 1997 Vidicode Datacommunicatie BV 
    10
      
    GOSUB Mail
    If you want to use a label with the same name as an existing command, you must always place a % sign in front of the label, 
    e.g.: 
    GOTO %Connect
    GOSUB %Delete
    Calculations & expressions 
    Like any version of BASIC, Argus BASIC can be used for calculations; but as a result of the fact that only integer numbers 
    are allowed, all mathematical operations give integer results. 
    The following mathematical operators are available: 
     + : addition 
     - : subtraction 
     * : multiplication 
     /  : integer division 
     DIV  : same as / 
     MOD  : remainder from integer division 
     ABS  : absolute value 
     SGN : sign 
     
    The following are examples of expressions using integer variables: 
    X=10 * Y
    Scs =(HOUR * 60 * 60) + (MIN * 60)
    Res=X/3+Y
    Hexadecimal numbers 
    Numbers can be entered and displayed in decimal or hexadecimal format.  Hex numbers must be preceded by the 
    ampersand (&) character: 
    Hex=&3AC0
    Address=PTOP+&1000
    Print &A84B
    Converting hexadecimal numbers into decimal format is achieved by preceding the hex value by the tilde (~) character.  For 
    instance, to print the decimal equivalent of a hex value or variable: 
    PRINT ~1200 displays 4608
    PRINT ~PTOP displays the value of PTOP in
    decimal
    PRINT ~1000+50 displays 4146 (i.e. 4096 + 50)
    By adding the command VAL$, the decimal value can be stored in a text string: 
    G$=VAL$~120
    assigns the value 78 to the string variable G$. 
    Logical operations  
    						
    							ARGUS Programmable Modem 
    BASIC Programmers Reference Manual 
    © 1990 - 1997 Vidicode Datacommunicatie BV 
    11
      
    Argus BASIC also supports a full range of logical operators which are used to make comparisons between expressions, 
    usually within conditional commands such as IF...THEN...ELSE, REPEAT...UNTIL etc. 
     
    The logical operators are: 
     
    AND 
    : bitwise AND 
    EOR 
    : bitwise Exclusive OR 
    FALSE 
    : logical 0 
    NOT 
    : bitwise negation 
    OR 
    : bitwise OR 
    TRUE 
    : logical 1 
    = 
    : equal to 
    > 
    : greater than 
    < 
    : less than 
    = 
    : greater than or equal to 
     
    : not equal to 
    Logical operations by the modem are carried out in a bitwise fashion.  For example, the command: 
    X=6AND8
    would set X to 0 as follows: 
    00000110 AND 00001000 = 00000000
    Similarly: 
    X=6OR8
    would set X to 12: 
    00000110 OR 00001000 = 00001110
     
    Strings can be compared using logical operators: 
     
    IF A$=Z THEN ...
    IF A$>B$ THEN ...
    X=A$
    						
    							ARGUS Programmable Modem 
    BASIC Programmers Reference Manual 
    © 1990 - 1997 Vidicode Datacommunicatie BV 
    12
      
    ON BUTTON(1/2/3)
    ON CONNECT
    ON DTD
    ON DTR
    ON ERROR
    ON ESCAPE
    ON HANGUP
    ON RESET
    ON RING
    ON SEQUENCE
    ON SLASH
    ON TIMEOUT
    So, if you would like your modem to welcome you with a start-up message whenever you start your terminal program, you 
    might include in your program: 
    10 ON DTR GOSUB Welcome
    1100%Welcome
    1110 Print Hello there, this is your modem.
    1120 RETURN
    1.2 Writing programs 
    There are two distinct methods of programming the modem. 
     
    The first, which you have used so far, is referred to as direct programming; i.e. programs are typed straight into the modem 
    from your computer, using the terminal mode of your communications software.  This method is suitable for entering small 
    programs and for testing individual functions; but due to the lack of editing facilities provided by the modem, it is impractical 
    for large programs. 
     
    Large programs are best created using a word processor on your computer and then downloading them into the modem 
    when they are ready for testing.  This is referred to as indirect programming. 
    Direct programming 
    Assuming that the modem is now in command mode with the >1 prompt displayed on screen, you can enter BASIC 
    commands or program lines.  The modem is now functioning as a computer and is simply using your PCs keyboard and 
    screen for input and output respectively. 
     
    Before starting to enter any new program you should use the following commands to ensure that no other programs are 
    loaded and that the new program is stored in the correct place: 
    BUFFER OFF
    NEW 
    						
    							ARGUS Programmable Modem 
    BASIC Programmers Reference Manual 
    © 1990 - 1997 Vidicode Datacommunicatie BV 
    13
      
    For reasons of speed, direct programming is best carried out at 19200 baud or 38400 baud.  If your terminal does not 
    support 38400 baud, use the next highest speed that is available.  If your terminal is currently running at a slower speed, you 
    may reconfigure the modem as follows: 
    •  Enter the command WAIT FOR AT, or press the STOP button on the front panel.  This will put the modem into 
    AT scan mode. 
    •  Change the baud rate in your terminal software to the required speed. 
    •  Go back on-line.  If you pressed the STOP button, type: 
      AT*B [Return] 
      if you entered the command WAIT FOR AT, type: 
      AT
    •  The baud rate serial and data format for port 1 will now be set to match that of your terminal, and the command 
    mode prompt will be shown. 
    There is only one editing tool available if you are editing on-line.  CTRL-R will display the last line entered.  The cursor will 
    be at the end of the line and you can delete the characters backwards and/or add new characters. 
     
    Despite the limited editing facilities that are available when entering programs directly, it is still an ideal way to explore the 
    modem and learn about the various functions that are provided.  Most commands or commands when entered without line 
    numbers will be executed immediately, and you will see the results. 
    Indirect programming 
    It is simpler and more efficient to use the word processing or text editing facilities on your computer to write larger programs.  
    In this case you will first create an ASCII text file of the program and save it on disk.  This file may then be transferred 
    (downloaded) into the modem, using the ASCII file transfer option in your communications software.  The sequence of events 
    for creating and loading a program in this way is as follows: 
    •  Use a word processor or text editor to create the ASCII version of the program. 
    •  Save the program in a file on disk. 
    •  Load your communications software and get the command mode prompt from the modem. 
    •  Use the ASCII file transfer option in your communications software (NOT X/Y-MODEM or any other error correcting 
    protocol), to send the program file to the modem. 
    Note:  If you encounter problems with echo during the transfer procedure, you should reset the modem before disabling 
    echo (using the ECHO OFF command), and try again. 
     
    When programming indirectly, the first few lines of your program file must contain certain commands which prepare the 
    modem to receive the remainder of the program.  Specifically the following must be included: 
    •CLEAR or BUFFER OFF - to clear that part of the modems memory which is used for variable storage. 
    •PBOT=&3000 - sets the address in the modems memory at which the program will be stored.  PBOT is a 
    system variable that stands for Program BOTtom. 
    •NEW - clears program memory and prepares the modem BASIC interpreter to accept a new program. 
    If you include line numbers in your word-processed file you must keep track of them yourself.  For obvious reasons you will 
    not be able to use the modems RENUM command until you have uploaded the program. 
     
    If you do not include line numbers in your program text file, you must include the AUTO command at the beginning of the file 
    so that line numbers will be generated for you during uploading.  One disadvantage of using a word processor to create 
    program files without line numbers is the difficulty of implementing GOTOs or GOSUBs to line numbers.  As an alternative to 
    line numbers in programs where a limited number of subroutine calls or GOTO commands are used, you should use labels.  
    Because labels are easier to remember, we recommend that you only use labels. 
     
    The first few lines of your program should be:  
    						
    							ARGUS Programmable Modem 
    BASIC Programmers Reference Manual 
    © 1990 - 1997 Vidicode Datacommunicatie BV 
    14
      
      With line numbers:    Without line numbers: 
    PBOT=&3000 PBOT=&3000
    BUFFER OFF BUFFER OFF
    NEW NEW
    10 REM Program start AUTO
    . REM Program start
    ..
    ..
    Prior to downloading you should ensure that you have hardware handshaking (RTS/CTS), enabled within your terminal 
    software to avoid losing characters during the transfer. 
     
    Note: the modem uses hardware handshake by default, but software handshaking can also be selected using the 
    HANDSHAKE command. 
     
    You should also ensure that ESCAPE is enabled in order that it can be used to cancel auto line-numbering when 
    downloading is complete.  (See ESCAPE.) 
     
    Remarks in a text file can be best implemented by using the \ sign instead of the REM command.  The BASIC interpreter 
    discards the rest of the line behind  when it is in auto mode.  Example: 
    X=12 \ Start for X
    1.3 Running programs 
    The modem has two (2) different operating modes: it can be used either as a Hayes compatible modem or as a 
    Programmable (or BASIC) modem.  It is important that you know exactly how to change from one mode to the other. 
     
    To go from modem-mode to BASIC-mode: 
    • enter AT*B [Return] 
    To go from BASIC to modem-mode: 
    • enter MODEM [Return], or have MODEM as a command in a program line. 
    or 
    •  In case of an Argus with 5 buttons: first set the S/A button in the in-position and push the STOP button, then set the 
    S/A button in the out-position again. 
    or 
    •  In case of an Argus with keyboard: press > + >> + >>> at the same time. This will jump directly to modem-mode. 
    The effect of entering modem-mode from BASIC is to: 
    •  disable all events but ON RESET.  You must be careful here, since once ON RESET is effective, the modem 
    will execute the command associated with ON RESET after every reset or power shutdown. 
    •  leave all variables and buffers as they are. 
    While still under development, a program will normally be executed using the RUN command.  Once development is 
    complete, it is recommended that the program be started with the command ON RESET, or ON RESET GOTO .  This will make your program start whenever you press the RESET button, or after a power failure in the same 
    way.  No variables or buffers will be cleared when this happens.  If you want the variables and buffers to be cleared, make 
    CLEAR one of your first program commands. 
    10 ON RESET PRINT You are in BASIC once again
    20 PRINT *; 
    						
    							ARGUS Programmable Modem 
    BASIC Programmers Reference Manual 
    © 1990 - 1997 Vidicode Datacommunicatie BV 
    15
      
    30 WAIT 300
    40 GOTO 20
    If the RESET button is pressed immediately after this program has been entered (but before it has been run), nothing will 
    happen.  After the program has been run once, the modem will return to BASIC mode after you press the RESET button, 
    print You are in BASIC once again, and send asterisks to your screen. 
     
    Pressing the RESET button will restart the program again from the first line.  If an [Esc]ape sequence ([Ctrl-C]) is now 
    entered , the program will stop; but ON RESET will still be enabled.  Pressing the START button prints You are in
    BASIC once again and the program will show the asterisks again.  If you now press the STOP button again, you will 
    return to modem mode once more. 
     
    As soon as you press the RESET button again after that you will return to BASIC once more and the program will run once 
    more, etc. 
    Running files from the filing system 
    If you have a filing system (RAM-, FLASH- or Hard-disk or LAN), you can load and save BASIC programs.  The command 
    RUN Name will first load  the program ‘Name’ in system memory on address PBOT (default &3000) and then run it.  
    Once ON RESET RUN Name has been entered, you will always start the program Name, when you push the 
    RESET button.   
    For standard applications, we have also included a special program named BOOT.  This means that if there is a program in 
    memory/disk with the name BOOT, it will always run when you press RESET or after a power shutdown, even if ON
    RESET is active or inactive. The only way to disable BOOTis with the command BOOT OFF. 
    1.4  Program and variable storage 
    The area of memory between &3000 and &7FFF is known as Program memory.  BASIC programs are normally stored 
    starting at location &3000 and working upwards, while the variables used by a program are stored in the area just below 
    &7FFF. 
     
    A system variable PBOT is used to hold the current program start address, and can be changed to allow two or more 
    programs to be stored at the same time in Program memory. 
     
    The highest location used by a program is held in another system variable called PTOP.  The size of a program can 
    therefore be calculated by subtracting PBOT from PTOP, and the amount of space remaining for variable storage may be 
    calculated by subtracting PTOP from &7FFF. 
     
    Two other commands will reduce the amount of space available for variables: 
     BUFFER ...  if the BUFFER command has been used to define a user buffer, the specified amount of space 
    will be reserved starting from &7FFF and working downwards.  This means that variables will be stored at a lower 
    location than usual. 
     BUFFER OFF may be used to release previously allocated space. 
    Note:  the use of BUFFER will always clear all variables and is therfore recommended to be one of the first commands in 
    any program. 
     
    If a program runs out of memory, it is also possible to split up a big program into smaller programs. Depending on the 
    application, a program can be called from within another program with RUN “Name2”, without loosing all variables!  
      
    Variables are stored in alphabetical order in memory so that, for example, if an integer A is the first used variable, its value 
    will be stored in locations &7FFE and &7FFF. 
     
    The first letter of a variable name is therefore very important as two 26-entry tables are maintained (one for integers and the 
    other for strings), which contain the start address for variables starting with a specific letter.  Once an entry has been created 
    in the table, all variables with the same first character are stored in the same memory area.  As only the first defined variable  
    						
    							ARGUS Programmable Modem 
    BASIC Programmers Reference Manual 
    © 1990 - 1997 Vidicode Datacommunicatie BV 
    16
      
    with a specific start character is directly accessible, a sequential search of memory must be made to find other variables 
    starting with the same letter.  For this reason you should try to use as many different start characters as possible when speed 
    of operation is important. 
     
    This method of storage results in the creation of up to 52 separate storage areas.  If no variables starting with the letter T 
    are used then no space will be reserved for them.  The CLEAR command which is used to destroy all program variables 
    simply clears the look-up table and sets the variable pointer to &7FFF. 
     
    Assuming that no buffer memory is allocated, the memory map will be as follows: 
    Address   Letter/variable  type 
    &7FFF 
    integer variables starting with Z 
      integer variables starting with A 
      string variables starting with Z 
      string variables starting with A 
    PTOP 
    end of program 
    PBOT 
    start of program 
     
    The way in which variables are allocated can be demonstrated by entering the following program: 
    PBOT=&3000
    NEW
    DIM A(6000)
    After execution of this program, a single variable with 12K allocated has been created in memory.  When variable B is 
    defined with the command: 
    B=0
    you might notice that it takes a little while before the prompt returns.  This is because the entire area of memory allocated for 
    the integer array A must be shifted in order to create space for the integer variable B.  Once this has been done, further 
    access of B will take no noticeable time, a fact that you may prove by now entering the command: 
    B=1
    1.5 I/O ports 
    Each I/O port on the modem is identified by a unique port number: 
     Port Device 
      1  Serial port 1 (25 pin D type) 
      2  Serial port 2 (9 pin D type) 
      3   Telephone line (modem chip) 
     4 reserved 
     5 reserved 
      6  Keyboard input & LCD display output  
      7  Parallel Printer port 
     8 Memory buffer 
     
    Port 1 is serial communications port 1 with asynchronous speeds up to 115200 baud. Synchronous operation is also 
    possible.  
    						
    							ARGUS Programmable Modem 
    BASIC Programmers Reference Manual 
    © 1990 - 1997 Vidicode Datacommunicatie BV 
    17
      
     
    Port 2 is serial communications port 2 with asynchronous speeds up to 38400 baud. 
     
    Port 3 is the telephone line and is only used if a modem connection is active. 
     
    All data streams associated with these ports (receive and send for each), are managed by the modems operating system, 
    using interrupt driven buffers.  All BASIC commands related to the receipt of data (INPUT, GET, etc.) automatically use 
    the input buffers.  Commands which serve to transmit characters, such as PRINT and PUT, use the output buffers.  Buffer 
    management is therefore transparent to the user, whose only concern should be the type of handshaking used (see below). 
     
    I/O buffers are 256 bytes in length and are filled and emptied automatically as data is transferred.  However, overflow of input 
    buffers will occur at any speed if data is removed from the input buffers more slowly than new data is received AND no 
    handshaking protocol is in use.  Loss of data due to overflow can be avoided by enabling either software (XON/XOFF), or 
    hardware (RTS/CTS) handshaking as appropriate. 
     
    Under normal conditions, a program attempting to place data into a full output buffer will be suspended until space becomes 
    available.  However when a LINK has been established between two ports handshaking must again be used to prevent 
    overflow.  Full descriptions of the HANDSHAKE and LINK commands are given under the appropriate headings in the 
    BASIC reference section. 
     
    Port 6 is used for the keyboard as an input and the LCD display as an output (if available).  At the back of this manual there 
    are tables for both keyboard and LCD codes.. 
     
    Port 7 is the parallel printer port.  The connector is situated inside the case but a slot in the rear panel is provided for a 
    parallel cable.  The parallel port can be defined as an input only or output only. 
     
    Port 8 is unusual in that it is not a hardware port, but refers to an area of memory that may be used as a data buffer by 
    BASIC programs.  The buffer must be created explicitly using the BUFFER command before it can be used, but thereafter it 
    may be treated in the same way as any other port, using commands such as PUT, GET, PRINTand INPUT. It can 
    be used for input and output in the way a FIFO stack works. 
    Port syntax 
    Port numbers in BASIC commands must always be preceded by the hash or pound (#) character.  For example, to print a 
    message to port 2 you could use the following: 
    PRINT#2, Message from port 2
    In all cases the word PORT can also be used e.g.: 
    PRINT PORT1, Message from port 1
    Similarly, to read a string from port 2: 
    INPUT#2, A$
    Your program may be easier to understand if you give names to the ports that you use by assigning them to variables: 
    P=3
    PRINT#P, text
    INPUT#P, A$
    For those commands used to set port attributes such as the baud rate, and those used to output data, you may specify more 
    than one port.  The following command will print the message Commencing file transfer... to both ports 1 and 
    2 simultaneously: 
    PRINT#1,#2, Commencing file transfer...
    Commas between the port numbers are optional (PRINT#1#2). 
     
    Listed below are those commands which may include one or more port numbers as parameters:  
    						
    All Vidicode manuals Comments (0)

    Related Manuals for Vidicode Argus Basic Programmers Reference Manual