Rockwell Automation 1747-PBASE User Manual

BASIC Development Software
(Catalog Numbers 1747-PBASE)
Programming Manual

Important User Information

Because of the variety of uses for the products described in this publication, those responsible for the application and use of this control equipment must satisfy themselves that all necessary steps have been taken to assure that each application and use meets all performance and safety requirements, including any applicable laws, regulations, codes and standards.
The illustrations, charts, sample programs and layout examples shown in this guide are intended solely for purposes of example. Since there are many variables and requirements associated with any particular installation, Rockwell International Corporation does not assume responsibility or liability (to include intellectual property liability) for actual use based upon the examples shown in this publication.
Rockwell Automation publication SGI-1.1, Safety Guidelines for the Application, Installation and Maintenance of Solid-State Control (available from your local Rockwell Automation office), describes some important differences between solid-state equipment and electromechanical devices that should be taken into consideration when applying products such as those described in this publication.
Reproduction of the contents of this copyrighted publication, in whole or part, without written permission of Rockwell Automation, is prohibited.
Throughout this manual we use notes to make you aware of safety considerations:
ATTENTION
!
Attention statements help you to:
identify a hazard
avoid a hazard
recognize the consequences
IMPORTANT
PLC-5 is a registered trademark; and SLC 500, RSLogix, and RSLinx are trademarks of Rockwell Automation.
Identifies information about practices or circumstances that can lead to personal injury or death, property damage or economic loss.
Identifies information that is critical for successful application and understanding of the product.
Installing the Software

Table of Contents

Preface
Who Should Use This Manual . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . P-1
Purpose of this Manual . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . P-2
Terms and Abbreviations. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . P-4
Conventions Used in this Manual . . . . . . . . . . . . . . . . . . . . . . . . . . . . P-5
Rockwell Automation Support . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . P-5
Local Product Support . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . P-5
Technical Product Assistance. . . . . . . . . . . . . . . . . . . . . . . . . . . . . P-5
Your Questions or Comments on this Manual . . . . . . . . . . . . . . . P-6
Chapter 1
What Your Software Does. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-1
Hardware Requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-2
Hardware for Interfacing Your Personal Computer with the
BASIC or BASIC-T Module . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-2
Installation Procedure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-3
Directory Structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-5
Backing-up Your Software. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-6
Getting Familiar with Your Development Software
Chapter 2
Starting Your Software . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-1
Toplevel Menu . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-2
Main Menu. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-2
Status Line . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-3
Message Line. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-4
Function Keys . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-4
Using Help Outside a Program . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-4
Using Help Within a Program . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-5
Typical Pull-down Menu . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-5
Navigating Within Windows . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-6
Editing a BASIC Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-9
General Editing. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-9
Saving Your Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-10
Translating Your Program. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-11
Physically Connecting to Your BASIC or BASIC-T Module . . . . 2-11
Changing to Terminal Mode. . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-12
Downloading Your Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-13
Exiting a BASIC Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-13
i Publication 1746-PM001A-US-P
Table of Contents ii
Configuring Your Software
Chapter 3
Setup and Configuration Menu . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-1
Command Line Switches . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-2
Loading Files from the Command Line . . . . . . . . . . . . . . . . . . . . 3-4
Configuring Your Edit Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-4
Configuring Display Setup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-7
Configuring Mouse and Keyboard Options . . . . . . . . . . . . . . . . . . . . 3-7
Configuring Your Filename Extensions. . . . . . . . . . . . . . . . . . . . . . . . 3-8
Configuring Your Printer Options . . . . . . . . . . . . . . . . . . . . . . . . . . 3-11
Configuring Your Memory Options . . . . . . . . . . . . . . . . . . . . . . . . . 3-11
Backup Files, Temporary Files, and Autosave . . . . . . . . . . . . . . . . . . 3-12
Backup Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-12
Temporary Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-12
Autosave . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-12
Search and Replace Defaults . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-13
Terminal Emulation Mode Selection . . . . . . . . . . . . . . . . . . . . . . . . 3-13
Save Configuration and Exit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-14
Editing a Program
Manipulating Files
Chapter 4
Using Simple Editing Techniques. . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-1
Searching Operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-2
Using Block Operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-3
Text Formatting, Undo, and Redo . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-6
Advanced Editing Techniques. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-7
Drawing Lines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-8
Using the Calculator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-9
The ASCII Table . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-9
Using Windows . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-9
Using Keystroke Macros . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-11
Using Cursor Markers. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-15
Chapter 5
The File Menu . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
Selecting Project Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
User Menu . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
User-defined Programs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54
Name Selection. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
Selecting a Filename . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
Swap Method Selection. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
Memory Required Selection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
Use COMMAND.COM Option . . . . . . . . . . . . . . . . . . . . . . . . . . 57
Starting Directory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
Publication 1746-PM001A-US-P
Writing Programs Using the BASIC Development Language
Table of Contents iii
Chapter 6
Overview of the Language . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-1
Translator Directives. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-2
Include . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-3
Label . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-4
Text . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-5
Line Number . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-6
Increment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-6
Breakpoint . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-7
Debug on
Debug off . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-7
Macros . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-8
Creating Your Own Programming Macro . . . . . . . . . . . . . . . . . . . . . . 6-8
Bringing in Programs from Separate Files . . . . . . . . . . . . . . . . . . . . . . 6-9
Subprogram CALL 70, CALL 71 . . . . . . . . . . . . . . . . . . . . . . . . 6-10
Programming Macros . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-10
Merging a Program File. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-10
Creating a Second Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-11
Entering the Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-11
Translating . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-13
Downloading . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-15
Executing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-15
Printing Your Program
Translating Your Program
Chapter 7
Setting Up Your Printer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-1
Printer Selection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-2
Printer Setup. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-3
Printer Device/File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-3
Serial Printers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-4
Using the Printer Controls . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-5
Copies to Print . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-5
Line Numbering . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-5
Print Margin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-5
Eject Page . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-5
Printing All or Part of a Document . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-6
Printing In Background. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-6
Chapter 8
Translating Feature . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-1
Eliminating Translator Errors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-4
Find Next Compiler Error. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-4
Translator Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-4
Publication 1746-PM001A-US-P
Table of Contents iv
Communicating with the Module
Chapter 9
Changing to Terminal Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-1
Downloading File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-3
Uploading File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-4
Hex File Transfers. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-6
Uploading Hex Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-6
Downloading Hex Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-7
Backing Up the Module Image . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-8
Restoring the Module Image. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-9
Debugging Your Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-9
Debugging Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-11
Making Corrections to Your Program. . . . . . . . . . . . . . . . . . . . . 9-14
RS-232 Communications Setup . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-14
Autobaud . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-15
General Setup Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-16
Terminal. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-16
Com Port Settings. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-16
Colors. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-17
Save Setup. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-17
DH485 Communications Setup . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-18
Attach . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-18
General Setup Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-19
Terminal. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-19
Com Port Settings. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-20
Who Active. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-21
Who Listen. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-22
Colors. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-22
Save Setup. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-22
BASIC Macro Library
Publication 1746-PM001A-US-P
Appendix A
Library Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-1
Screen Functions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-2
Keyboard Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-3
SLC Backplane Functions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-4
Clock Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-5
Battery Back-Up . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-6
Program Control. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-6
String Routines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-7
[CTRL-C] Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-8
Port Control Functions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-8
DH485 Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-8
1771-DB/B Backplane Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-9
The DOS Directory Shell
Table of Contents v
Appendix B
Using the DOS Directory Shell. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . B-1
DOS Directory Shell Operation. . . . . . . . . . . . . . . . . . . . . . . . . . B-2
File Operations from the DOS Directory Shell . . . . . . . . . . . . . . . B-4
Publication 1746-PM001A-US-P
Table of Contents vi
Publication 1746-PM001A-US-P
Preface
Read this preface to familiarize yourself with the rest of the manual. This preface covers the following topics:
who should use this manual
the purpose of this manual
how to use this manual
terms and abbreviations
conventions used in this manual
Rockwell Automation support

Who Should Use This Manual

Use this manual if you are responsible for designing, installing, programming, or troubleshooting control systems that use Allen-Bradley small logic controllers.
You should have a basic understanding of SLC 500™ products, PLC products, and 1771 and 1746 I/O products. You should understand programmable controllers and be able to interpret the ladder logic instructions required to control your application. If you do not, contact your local Rockwell Automation representative for information on available training courses before using this product.
P-1 Publication 1746-PM001A- US-P
P-2

Purpose of this Manual

This manual is a programming guide when using the BASIC Development Software, 1747-PBASE.
Chapter Title Contents
Preface Describes the purpose, background, and scope of this manual. Also lists related
publications.
1 Installing the Software Described how to install the BASIC Development Software onto your personal
computer.
2 Getting Familiar with Your
Development Software
3 Configuring Your Software Provides information on a number of configuration options including mouse,
4 Editing a Program Covers all editing techniques, including searches, moving blocks of text, text
5 Manipulating Files Provides information on file management, from simple loads, saves, and merges,
6 Writing Programs Using the
BASIC Development Language
7 Printing Your Program Covers all aspects of printer setup and printing.
8 Translating Your Program Prepares your BASIC development program for downloading to the BASIC or
Describes the basic concepts of the BASIC Development Software, including how the help system works, using the pull-down menus, and creating a simple first program.
display, printer, memory, function keys, and Terminal mode.
formatting, and advanced editing features.
to creating your own User Menus.
Begins with an overview of the BASIC language, macros, and program organization. A second sample program is written, translated and downloaded.
BASIC-T module.
9 Communicating with the BASIC
or BASIC-T Module
Appendix A BASIC Macro Library Lists the programming macros available through the BASIC Development
Appendix B The DOS Directory Shell Explains how to display a DOS directory tree and directory from which you can
Provides information on changing to Terminal mode, downloading to and uploading from the module, and debugging your BASIC program.
Software.
execute a large number of DOS commands.
Publication 1746-PM001A-US-P
Related Documentation
The following documents contain additional information regarding Rockwell Automation products. To obtain a copy, contact your local Rockwell Automation office or distributor.
For Read this document Publication Number
P-3
A BASIC and BASIC-T manual that provides information on installing and using the 1746-BAS and 1746-BAS-T modules.
A reference manual that explains the BASIC language as used with the BASIC and BASIC-T modules.
A user manual that provides information on installing and using the 1771-DB/B module.
An overview of the SLC 500 family of products SLC 500™ System Overview 1747-SO001A-US-P
A description of how to install and use a Modular SLC 500 Processor
A reference manual that contains status file data and instruction set information for SLC 500 processors
A description of how to install and use a module that acts as a bridge between DH485 networks and devices requiring DF1 protocol.
In-depth information on grounding and wiring Allen-Bradley programmable controllers
A glossary of industrial automation terms and abbreviations
An article on wire sizes and types for grounding electrical equipment
SLC 500™ BASIC and BASIC-T Modules User Manual
BASIC Language Reference Manual 1746-RM001A-US-P
BASIC Module User Manual 1771-6.5.113
Modular Hardware Style Installation and Operation Manual
SLC 500™ and MicroLogix™ 1000 Instruction Set Reference Manual
DH-485/RS-232C Interface Module User’s Manual
Allen-Bradley Programmable Controller Grounding and Wiring Guidelines
Allen-Bradley Industrial Automation Glossary
National Electric Code Published by the National Fire Protection
1746-UM004A-US-P
1747-6.2
1747-6.15
1747-6.12
1770-4.1
AG-7.1
Association of Boston, MA
Publication 1746-PM001A-US-P
P-4

Terms and Abbreviations

The following terms and abbreviations are specific to this product. For a complete listing of Allen-Bradley terminology, refer to the Allen-Bradley Industrial Automation Glossary, publication number ICCG-7.1.
A-Stack error — occurs when too many expressions are PUSHed onto the
argument stack or when you attempt to POP data that does not exist
BASIC development language enhanced BASIC language that comes with
the BASIC Development Software (catalog number 1747-PBASE) and provides programming support for the BASIC and BASIC-T modules.
DH485 network communication protocol
dialog box — a box that appears on the screen of the BASIC Development
Software displaying available options for a selected menu item
EMS — refers to the expanded memory that may be installed on your personal
computer. The BASIC Development Software uses expanded memory not extended memory.
EPROM Erasable Programmable Read Only Memory
file — a BASIC program file
filename extension — the characters to the right of the filename and period.
Hypertext help — a context-sensitive help system that allows access to help
from practically any point in the BASIC Development Software.
keystroke macros — a recorded series of keystrokes invoked by one keystroke
to reduce the number of keystrokes needed to perform a function
memory module — BASIC or BASIC-T modules EEPROM or UVPROM
MTOP system control value that holds the last valid memory address
program port — the port used to program the module. Either PRT1 or port
DH485 can be used as the program port.
programming macros — commands available through the BASIC
Development Software designed to streamline programming
QuickStroke — refers to a key or pair of keys that are pressed rapidly to
perform a function or access a menu. These keys are shown within braces for example,
[Alt-F10].
[],
RAM — Random Access Memory
ROM — Read Only Memory, refers to the optional memory module memory
space (EEPROM or UVPROM)
RS-232/423 serial communication interface
RS-422 differential communication interface
RS-485 network communication interface
SLC 500 SLC 500 fixed and modular controller
Publication 1746-PM001A-US-P
P-5

Conventions Used in this Manual

Rockwell Automation Support

The following conventions are used throughout this manual:
Bulleted lists such as this one provide information, not procedural steps.
Numbered lists provide sequential steps or hierarchical information.
Italic type is used for emphasis.
Tex t i n this font indicates words or phrases you should type.
Key names match the names shown and appear in bold, capital letters within
brackets (for example,
The progression to arrive at a screen through a menu path is shown as follows:
Path: Toplevel menu →→→ Edit mode →→→→ File →→→→ load file in cur.win.
The progression to arrive at a screen through a QuickStroke is shown as
follows:
QuickStroke: <SHIFT-F5>
Rockwell Automation offers support services worldwide, with over 75 Sales/ Support Offices, 512 authorized Distributors and 260 authorized Systems Integrators located throughout the United States alone, plus Rockwell Automation representatives in every major country in the world.
[ENTER]).
Local Product Support
Contact your local Rockwell Automation representative for:
sales and order support
product technical training
warranty support
support service agreements
Technical Product Assistance
If you need to contact Rockwell Automation for technical assistance, please review the information in the appropriate chapter first. Then call your local Rockwell Automation representative.
Publication 1746-PM001A-US-P
P-6
Your Questions or Comments on this Manual
If you find a problem with this manual, please notify us of it on the enclosed Publication Problem Report.
If you have any suggestions for how this manual could be made more useful to you, please contact us at the address below:
Rockwell Automation Control and Information Group Technical Communication, Dept. A602V P.O. Box 2086 Milwaukee, WI 53201-2086
Publication 1746-PM001A-US-P
Chapter

Installing the Software

This chapter begins with a general description of your BASIC Development Software and then steps you through installing the software on your personal computer. Major topics include:
a general description of the BASIC Development Software
the necessary hardware for installation
the BASIC Development Software disk sets
how to install your software
how to back up your disks
1

What Your Software Does

This section provides a general outline of what the BASIC Development Software can do. Standard features of the BASIC Development Software include:
communication terminal capabilities
debugger feature to troubleshoot software that is executing on the BASIC or
BASIC-T module
translator utility to convert BASIC Development Software programs for
downloading to the module
windows that allow you to edit up to 100 files (or different parts of the same
files) simultaneously
adjacent window function for easy movement between split windows
pull-down menu system and QuickStroke shortcuts
dynamic display function key labels with [Shift] [Ctrl] and [Alt] keys
user-definable keystroke macros that allow you to replace a series of commonly
used keystrokes with a single keystroke
undo up to 65,535 operations and then redo the last undo
line, stream, and columnar block operations, including inter-window copy,
move, and cut-and-paste capability
search and replace multi-file search across directories or files
DOS shell and DOS directory shell with multi-directory display
Hypertext help that provides a context-sensitive on-line help system, available
at all times
automatic extension that allows specific default setups for editing, translating,
and compiling
language support (auto-indent, construct matching) for BASIC
1 Publication 1746-PM001A-US-P
1-2 Installing the Software
linedraw facility that lets you program graphic screens that translate into
BASIC and can be executed from the module
simple text formatting features including intelligent word wrap and reformat,
indent and outdent
mouse support to speed menu selections
pop-up programmer’s calculator with hex, decimal, octal and binary
operations, a simulated printing tape, and the ability to paste the result into a program
pop-up ASCII table with hexadecimal and decimal equivalents
full EMS support where large files may be edited completely in EMS memory
swap out memory to EMS memory or disk when running other programs or
large compiles
user menus that you can create for rapidly selecting your most frequently
edited files, or for selecting frequently used programs installed in your personal computer
user-configurable default switch set-ups for search and replace, and multi-file
search functions

Hardware Requirements

multiple default directories based on file extensions (.bas files in one directory;
.bdl files in another)
The BASIC Development Software requires an MS-DOS compatible personal computer with at least 640K byte available RAM installed and at least 2M byte of available disk space on the hard drive. Your personal computer must be operating with a DOS version between 3.1 and 6.22.
Your BASIC Development Software supports almost all video cards and video modes. EGA 43 line and VGA 50 line modes are built in. Other video modes can be configured using the command line. Refer to Chapter 3 for additional information on configuring video modes.
The software supports Microsoft, MOUSE SYSTEMS, LOGITECH or any compatible mouse. It also supports the Expanded Memory Specification 4.0 and above.
Hardware for Interfacing Your Personal Computer with the BASIC or BASIC-T Module
Publication 1746-PM001A-US-P
A minimum of one communication port must be available on your personal computer. You need one of the following combinations of accessories to interface your personal computer with the module.
Installing the Software 1-3
To interface the communication port (COM1 or COM2) on your personal computer with port DH485 on the module, use an Allen-Bradley 1747-PIC Interface/Converter:
for direct connection to port DH485 on the module
plus an Allen-Bradley 1747-AIC Isolated Link Coupler to interface your
personal computer with a DH485 network on which the module resides
To interface the communication port (COM1 through COM8) on your personal computer with the port PRT1 on the module, use a 9-pin female to 25-pin male for the 1771-DB/B null modem cable or a 9-pin female to 9-pin female D-shell for the 1746-BAS or 1746-BAS-T null modem cable.
To communicate with the module without using one of the communication ports on your personal computer, use an Allen-Bradley 1784-KR DH485 Interface Card and 1747-AIC Link Coupler for direct connection to port DH485 on the module.
For cable details and jumper settings associated with these different configurations, refer to the SLC 500 BASIC and BASIC-T User Manual (publication number 1746-UM004A-US-P).
You should have two 3.5 inch disks or three 5.25 inch disks.
Table 1.1 Disk Contents
Disk
Number
Contents
3.5 inch disks
1 INSTALL.EXE IDENTIFY.TXT
MACROS.EXE HELP.EXE
2 IDENTIFY.TXT BASICEX.EXE
TRANS.EXE MISC.EXE
3 none IDENTIFY.TXT BASICEX.EXE
Contents
5.25 inch disks
INSTALL.EXE IDENTIFY.TXT HELP.EXE
IDENTIFY.TXT MACROS.EXE
TRANS.EXE MISC.EXE
Installation Procedure
Before installing your BASIC Development Software, the autoexec.bat file in your personal computer should be modified to include the \ABBASIC\BDS directory in its path command. This allows the BASIC Development Software to be initiated from any directory in the hard disk.
Use some form of file editing (most DOS systems come with an editing program called EDLIN) to add this statement to the path line in the autoexec.bat file on your personal computer. You may need to refer to the DOS manual for your personal computer for detailed information on structuring and editing this file. An example of a typical path statement with this directory added would be as follows:
PATH=C:\;C:\DOS;C:\MOUSE;C:\ABBASIC\BDS;
Publication 1746-PM001A-US-P
1-4 Installing the Software
IMPORTANT
When modifying your path command in the autoexec.bat file,
not
remove any other directories from the existing path. Add
C:\ABBASIC\BDS; to the end of the current path line. This
do
assumes you are installing your BASIC Development Software on the hard drive called C:. If you are installing on a different hard drive, substitute the letter of that drive for the C: above.
Check your config.sys file to be sure it establishes a minimum of 20 files and 20 buffers. In most DOS systems, this file can be read by typing
TYPE CONFIG.SYS. If
necessary, edit this file to include the lines:
FILES=20 BUFFERS=20
IMPORTANT
The number of files and buffers required is a minimum of 20. If the current number is greater than 20, do not reduce this number to 20. Doing so may cause some other software installed on your personal computer to become inoperable.
An automated installation program is provided to ease installation. The installation program automatically creates sub-directories and copies files from the disks to the hard disk.
IMPORTANT
The installation procedure may be aborted at any time by pressing and holding the [Ctrl] key and then pressing [c]. This
leaves the installation incomplete and the software inoperable.
To run the installation program:
1. Insert Disk 1 into the disk drive.
2. Type:
IMPORTANT
I
A:INSTALL and press [Enter].
Substitute the letter of the drive you are using, if it is not drive A.
Follow the instructions displayed.
Two megabytes of free disk space is required to install this software. If you choose a drive with less than that amount of available memory, the following message is displayed:
There is not enough room on you disk drive. The minimum number of free bytes must be 2000000.
WARNING: Software was not properly installed. C:\>
Publication 1746-PM001A-US-P
This indicates that the installation procedure has been aborted. If you still wish to use this drive, you must free some space by deleting any unnecessary files you have on that disk and then try the installation again.
Installing the Software 1-5
You may also choose a different drive. If the drive you choose has sufficient memory, the installation procedure continues. You are prompted to approve or alter the directory in which the software is to be installed:
Specify main directory in which to install files. C:\ABBASIC
Press [Enter] to accept the directory name or type a new directory name and press
[Enter].
IMPORTANT
If you alter a directory or sub-directory name, be sure to change the autoexec.bat file appropriately, as described in the beginning of the installation procedure section.
When you are finished loading the disks, you are reminded to modify your config.sys and autoexec.bat files as described in the previous section.
Directory Structure
The default directory structure after installation is as follows:
\ABBASIC – main directory
\ABBASIC\BAS – sub-directory to store the user BASIC source programs.
This is your working directory.
\ABBASIC\BDS – sub-directory that stores the BASIC Development Software
files
\ABBASIC\BDS\HELP – sub-directory that stores the help files
Change to your working directory before invoking PBASE. Additional working directories can be created anywhere on your hard disk.
You can change the sub-directory names after the installation process if the default names are not acceptable. The HELP sub-directory must reside directly under the BDS sub-directory or its equivalent. Do not rename the HELP sub-directory.
IMPORTANT
If you alter a directory or sub-directory name, be sure to change the autoexec.bat file appropriately, as described in the beginning of the installation procedure section.
Rockwell Automation grants you a license to install and use this software on a single personal computer, and to make one copy for backup purposes only. You are not licensed to install this software on more than one personal computer or to distribute it in any way. See the outside of the software package for licensing information.
Publication 1746-PM001A-US-P
1-6 Installing the Software

Backing-up Your Software

ATTENTION
!
You need as many blank, double-sided, double density disks for backup as you received for the original software installation (two-3.5 inch or three 5.25 inch disks).
Your blank disks need not be formatted. Refer to your DOS manual for more information.
This software is protected under the copyright laws of the United States. Unauthorized reproduction of copyrighted software violates U.S. copyright laws. Criminal penalties may include fines or imprisonment.
Publication 1746-PM001A-US-P
Chapter
2

Getting Familiar with Your Development Software

This chapter is intended to give you an overview of the BASIC development software so that you can understand the software’s general structure. The topics in this chapter include:

Starting Your Software

software start-up
toplevel menu
main menu
program editing and exiting
After installation, follow these steps to start your software.
1. Reboot your personal computer. This is necessary to activate any changes made to the autoexec.bat and config.sys files.
2.
2. If your mouse driver is not automatically installed by your autoexec.bat file,
2.2. execute whatever command is necessary to install it prior to starting the BASIC development software.
3.
3. Change to your working directory. If you accepted the default directory
3.3. assignments during software installation (refer to Chapter 1), the BAS subdirectory was created for use as a working directory. To change to this directory, type:
[Enter] or [Return] key (indicated throughout this manual by [Enter]).
The > moves to the end of the line:
4.
4. Type: > PBASE at the DOS prompt and press [Enter]. The software
4.4. determines your monitor type and displays the Toplevel menu.
> CD\ABBASIC\BAS at the DOS prompt and press the
CD\ABBASIC\BAS.
IMPORTANT
If you have a mouse and it is not working, you can still proceed by using the arrow keys. You may want to go back and check to make sure your mouse driver was installed either through the autoexec.bat file or through commands you entered.
IMPORTANT
1 Publication 1746-PM001A-US-P
If your personal computer does not recognize the command PBASE, the path command in your autoexec.bat file may not have been modified correctly.
There are additional mouse setup options listed in the Setup and Configuration menu. These include a mouse ON/OFF option. Refer to Chapter 3 for additional information on the Setup and Configuration menu.
2-2 Getting Familiar with Your Development Software

Toplevel Menu

The Toplevel menu allows you to create and edit your BASIC program.
Table 2.1 Toplevel Menu Selections
Selection Description
Select a project file
Edit mode allows you to enter Edit mode and open a new file window or enter the
Translate/compile allows you to immediately translate/compile a selected file, provided you
teRminal [232] switches your personal computer to Terminal mode so you can establish
User-defined program
Configuration menu
shell to DOS temporarily exits the BASIC development software and takes you back to
Quit exit your PBASE software and return to DOS
allows you to select a project file through your own custom menu. Selecting a project file is also available from the Other menu, and is described in Chapter 5.
presently active window. All main menu functions are available in this mode.
have correctly set up the filename extension and compiler program. Translate/compile is also available from the Other menu and is described in Chapter 8.
communications with the BASIC or BASIC-T module or other port device you have configured. Terminal mode is also available from the Other menu and is described in Chapter 9.
allows you to temporarily leave the BASIC development software and execute a program at the DOS level of your personal computer. Select the program from a menu that you have created. User Defined Program is also available from the Other menu and is described in Chapter 5.
displays a menu of set up features for mouse, display, printer, editing, etc. Chapter 3 describes this menu.
DOS where you can run programs or execute DOS commands. You can return by typing exit at the DOS prompt. Shell to DOS is also available from the Other menu.

Main Menu

Publication 1746-PM001A-US-P
The Main menu appears once you enter Edit mode through the Toplevel menu.
1. From the Toplevel menu, move the cursor or the mouse to select the Edit
mode option. You can also type in [E] since that is the highlighted letter on
this menu item.
2.
2. If cursoring, press
2.2. click the left mouse button when the mouse cursor is positioned over
mode
option.
[Enter] after highlighting Edit mode. If using a mouse,
Edit
The Main menu screen appears as shown below. You are now in Edit mode and can write or edit a program.
Near the top left of the Main menu is the letter
?No-File?. These are labels for the current window, which opened when you
A; and near the top right is
selected Edit mode. They tell you that you are looking at window A, which contains no file at this time.
Figure 2.1 Window A
Getting Familiar with Your Development Software 2-3
Status Line
Message Line
Labels for Current Window
Function Keys
L:3 C:1 1747-PBASE V X.XX [Text Edit] ↑ Ins 175k 06-12-91 1:15pm
File Window Block cUrsor Search Text Layout Print Macro Config Other Exit
+=+A+========================================================??No-File??+====+ |>> EOF << | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | +----------------------------------------------------------------------------+ 1Help 2Menu 3Term 4Indent 5Save 6Search 7MarkBl 8BasHlp 9CopyBl 0MoveBl
Status Line
The status line is the first line at the top of the Main menu screen. Following is a description of the status line in the previous figure:
Table 2.2 Status Line Indicators
Indication Description
L:3 C:1 1747-PBASE [TEXT EDIT]
R does not appear in this example, but would appear if you were creating
indicates that the
Ins
175K
06-12-91 1:15pm
indicates that your cursor is in the third line of the active window indicates that your cursor is in the first column of the active window indicates that you are working with the BASIC development software indicates that you are in Text Editing mode
a keystroke macro (described in Chapter 4) to indicate when you are recording
[caps lock] key on your keyboard is on.
toggles between this and Or to indicate whether you are in Insert or Overstrike mode of text editing.
indicates the amount of currently available RAM memory for your personal computer
the current date from your personal computer’s clock the current time from your personal computer’s clock
Publication 1746-PM001A-US-P
2-4 Getting Familiar with Your Development Software
Message Line
The message line is the third line on the main menu screen, just below the pull-down menus. The software displays normal operating messages, instructions, or error messages on this line as dictated by your selections and actions.
Function Keys
The function keys are listed along the bottom of the screen (1 through 10).
For additional function keys press and hold the keys prior to pressing the function keys. For example, press cursor up to the main menu. Press active window. Press
[Alt-F2] to bring up the calculator. Press [Ctrl-F2] to
[Shift-F2] to print the date and time in the
[Shift], the [Alt] or the [Ctrl]
[F2] to move your
move to the next error if an error file was loaded for examination.
The function key menu changes as you select different menus, or after you select a specific function key. This way, the most commonly used features can be accessed by pressing a function key. For example, pressing
[F8] to bring up help on the
module causes a new function key menu to appear.
Using Help Outside a Program
1. Press [F1], or click the left mouse button when the cursor is on 1 Help at the
bottom left corner of the screen. Help is context-sensitive, meaning that a help screen appropriate for the current subject appears. If you are not working on any specific subject at the time,
CONTENTS appears.
2.
2. Move the cursor or arrow keys to
2.2.
[Enter] or the left mouse button. You should now be looking at 1747–PBASE QUICK REFERENCE. Help screens may range from a couple sentences to several
paragraphs.
1747-PBASE REFERENCE GUIDE - TABLE OF
B. Editor Quick Reference and press
Publication 1746-PM001A-US-P
3.
3. Scroll through this help screen by using the up/down, right/left cursor (arrow)
3.3. keys or the page-up/page-down keys. To the far right of the help screen is a column with arrows at the top and bottom. Place your mouse cursor on the upper or lower arrow, and click the left mouse button to scroll through the help screen. Notice that many of the help screens include words or items that are highlighted (or in a different color if you have a color monitor). These items are related topics for which additional help information is available.
4.
4. Place the cursor on
4.4. button. The help screen for
goto Line number and press [Enter] or the left mouse
goto Line number appears with more related
topics you can select from this screen.
Getting Familiar with Your Development Software 2-5
5.
5. Press the [Backspace] key or move the mouse cursor to Back–
5.5.
track<BackSpace> and click the left mouse button. This steps you back
through the help screens you have accessed and eventually brings you back to
1747-PBASE REFERENCE GUIDE - TABLE OF CONTENTS. From there you can
select other topics that may be of benefit. There is also a comprehensive Help Index that can be selected.
6.
6. Press the
6.6.
[ESC] key or move the mouse cursor to Done<ESC> and click the left
mouse button to exit any help screen at any time. The main menu screen reappears.
Using Help Within a Program
1. Type a command such as GOTO after the main menu screen reappears. (GOTO
has an entire section of Hypertext help available.)
2.
2. Press
2.2.
3.
3. Press the
3.3.
4.
4. Move the cursor up or down so that it is no longer on the same line as the GOTO
4.4.
5.
5. Press
5.5.
6.
6. Press the
6.6.
[F8] or move the mouse cursor to 8 BasHlp at the bottom of the screen
to bring up help on the module and BASIC language.
[ESC] key or move the mouse cursor to Done<ESC> and click the left
mouse button to exit help on
GOTO.
statement.
[F8] or move the mouse cursor to 8 BasHlp and click the left mouse
button. If you are not on a word, the
TABLE OF CONTENTS
appears. From this table of contents, you can access a
BASIC Language Reference Manual -
broad range of help screens on the modules, including hardware setup, and programming information.
[ESC] key or move the mouse cursor to Done<ESC> and click the left
mouse button to exit help. The main menu reappears.
Typical Pull-down Menu
PBASE uses a pull-down menu to allow access to the options you need.
For example, the File menu is available once you enter Edit mode through the Top le v e l me nu .
Path: Toplevel menu →→→ Edit mode →→→→ File QuickStroke: available for individual items within the File menu
If using a mouse, move the cursor over to the File menu at the top left and click the left mouse button to pull-down the File menu. If you do not have a mouse, press
[F2] on your keyboard to get you up to the pull-down menus. Cursor to the right
or left to highlight
File and press [Enter]. The FILE dialog box appears:
Publication 1746-PM001A-US-P
2-6 Getting Familiar with Your Development Software
Figure 2.2 File Dialog Box
L:3 C:1 1747-PBASE V x.xx [Text Edit] Ins 175k 06-12-91 1:15pm File Window Block cUrsor Search Text Layout Print Macro Config Other Exit +------------------FILE-------------------+ |Edit new file... |Load file into current window... <ShftF5>| |Save file in current window | | |save file As... <F5> | |Information about current file... | | |-----------------------------------------| |Merge file from disk... | | |(save Block to disk... ) | | |-----------------------------------------| | |DOS directory shell <CtrlF4>| | |Quit <AltX> | | +---------------Cancel<ESC>---------------+ | | | | | | | | | | | | |
1 Help 2 3 4 5 6 7 8 9 0
| |
|
=========================?No-File?=+
|
|
The FILE dialog box lists all the available options. Use your up and down arrow keys to move to the option you want. Press wish to leave the dialog box without selecting anything, press
[Enter] to select your option. If you
Cancel <ESC>.
Some of the options have a QuickStroke assignment listed on the right. For example, pressing
[Shift F5] instead of pulling down the File menu would load a
file into the current window.
Navigating Within Windows
Windows are labeled alphabetically in their top left corner. Your BASIC Development Software can open up to 100 windows simultaneously. Each may contain a separate file, or they can be linked together and contain different parts of the same large file. You can open and close these windows independently of each other.
The following screen shows an example with 3 windows opened simultaneously. Window A contains a file called BASE#1 while windows B and C both contain a file called BASE#2. In this case, B and C are linked together; you are actually looking at different parts of the same file.
Publication 1746-PM001A-US-P
Figure 2.3 Window Labels
L:3 C:1 1747-PBASE V x.xx [Text Edit] Ins 175k 06-12-91 1:15pm File Window Block Cursor Search Text Layout Print Macro Config Other Exit
+=+A+=======D:\ABBASIC\BAS\BASE#1=+ | | +=+B+= =======D:\ABBASIC\BAS\BASE#2===+ |100 (this is BASE #1) | |100 (this is BASE #2) | |110 for x = 1 to 100 | |110 for x = 1 to 50 | |120 a = x * 2 | |120 a = x * 2 + 5 | |130 if a = 60 then 180 | |130 if a = 70 then 180 | |140 next x | |140 next x | |150 goto 200 | |150 goto 190 | |180 print "a = 60" | |180 print "a = 70" | |200 end | | | |>> EOF << | +=+C+= =========D:\ABBASIC\BAS\BASE#2==+« | | |550 for x = 1 to 100 | | | |560 a = x * 2 | | | |570 if a = 60 then 600 | | | |580 next x | | | |590 goto 700 | | | |600 print "a = 60" | | | |700 end (end of BASE #2) | | | |>> EOF << | | | | | +----------------------------------------------------------------------------+
1 Help 2Menu 3Term 4Indent 5Save 6Search 7MarkBl 8BasHlp 9CopyBl 0MoveBl
Getting Familiar with Your Development Software 2-7
ε
A more complete explanation of the options available through the Window menu is in Chapter 4. At this point, we simply want you to understand the concept behind the windows feature. To accomplish that, make a few adjustments to the current window:
1. If using a mouse, move the cursor over to the Window menu (near the top left)
and click the left mouse button. If you do not have a mouse, press
[F2] on
your keyboard to access the pull-down menus. Cursor to the right or left to highlight the Window menu and press
[Enter].
Publication 1746-PM001A-US-P
2-8 Getting Familiar with Your Development Software
Figure 2.4 Adjusting the Current Window
L:3 C:1 1747-PBASE V x.xx [Text Edit] Ins 175k 06-12-91 1:15pm File Window Block cUrsor Search Text Layout Print Macro Config Other Exit
+----------WINDOW----------+ +=+A+|Open | |Close | | | |Split | | | |List... <AltF1> | | | | | |Next <ShftF1> | | | |Previous <CtrlF1> | | | |(Adjacent <AltW>) | | | | | |Hide | | | |Modify size <ScrollLockOn>| | | |Zoom <CtrlF3> | | | |mInimize | | | | | |linK... | | | |(Unlink) | | | +--------Cancel<ESC>-------+ | | | | |
+--------------------------------------------------------------------------------+ 1 Help 2 3 4 5 6 7 8 9 0
--------------------------
--------------------------
--------------------------
|=====================C:\ABBASIC\BAS\FIRST.BDL==+
| |
| |
| |
2.
2. Cursor down, or move your mouse to select Modify size on the Window
2.2. menu. When it is highlighted, press
[Enter] or click the left mouse button.
The border of the A window changes to highlighted (or a different color), indicating it is ready to have its size or position modified. Instructions appear on the message line directly above the A window.
3.
3. Press and hold
3.3. If you let go of
[Shift] and [left arrow]. The A window shrinks to the left.
[left arrow] and press [up arrow], the screen shrinks
upwards.
4.
4. Let go of
4.4.
[Shift], and press [right arrow]. You are now positioning the A
window.
5.
5. Press
5.5.
[ESC] when you are finished adjusting the size and shape of the A
window.
6.
6. Pull down the Window menu again. Cursor down to select
6.6. Window menu.
Zoom causes the A window to return to full size.
Zoom on the
Publication 1746-PM001A-US-P
Getting Familiar with Your Development Software 2-9

Editing a BASIC Program

The BASIC Development Language (BDL) streamlines BASIC programming by providing a number of screen editing features, open-format line entry, and macros. Macros are commands that represent a more complex series of BASIC commands.
After you finish writing your program in the BASIC development language, you must translate/compile it into the BASIC language that the BASIC or BASIC-T module understands. This creates a BAS file, which you can then download to the module.
Translating and downloading are described in the following sections and in Chapters 8 and 9.
General Editing
In the last section you positioned and sized the A window. Now you edit a BASIC program.
1. If using a mouse, move the cursor over to the File menu at the top left and click
the left mouse button to pull down the File menu. If you do not have a mouse,
[F2] on your keyboard to move the cursor to the pull-down menus.
press Cursor to the right or left to highlight
2.
2. Cursor down, or move your mouse to select
2.2. When it is highlighted, press could have pressed
A since it is the highlighted letter corresponding to this
[Enter] or click the left mouse button. You also
menu item.
File and press [Enter].
save file As on the File menu.
The
SAVE FILE AS dialog box appears on the screen. On the first line, it
indicates that the file in the current window is named
3.
3. Type:
3.3.
4.
4. Press [Enter] or move the mouse cursor to OK<ENTER>, and click the left
4.4.
FIRST.BDL
?No-File?.
mouse button.
The
SAVE FILE AS dialog box disappears and
“C:\ABBASIC\BAS\FIRST.BDL Saved” appears in the message line (third line
from the top). Your message will be different if your software is not installed on the C: drive, or if you are using different directory names.
You have just saved a file containing the
FIRST with the file extension of BDL. BDL stands for BASIC development
GOTO statement under the name
language, and entering the file extension .BDL enables the software to identify the correct compiler for translating your program into the BASIC language. Filename extensions are described in Chapter 3.
Publication 1746-PM001A-US-P
2-10 Getting Familiar with Your Development Software
5.
5. Use the previously saved program:
5.5.
FIRST.BDL
6.
6. Move the cursor to the top left corner of the window.
6.6.
7.
7. Type in the following program:
7.7.
{THIS IS A FIRST PROGRAM} REM FIRST PROGRAM FOR X=1 TO 100
A=X*2 PRINT A NEXT X
END
Notice that there are no line numbers entered here. Also notice that when you type in the lines within the for/next loop, they are indented. This is because the BASIC development software recognizes that you are entering a BASIC development language program (since your filename extension is BDL) and the default parameters are set for smart indenting. There are a number of other related parameters for BDL files discussed in Chapter 3.
Saving Your Program
Path: Edit mode →→→ File →→→→ save file as Path: Edit mode →→→ File →→→→ save file as →→→→ save file in current window QuickStroke: [F5]
We recommend that you periodically save sizeable programs as you work on them to avoid losing large quantities of work in the event of a system error or power failure.
The BASIC development software has an autosave feature that offers two methods for automatically saving files as you work on them. It also has a backup feature with several methods for making backup files. These features are described in Chapter 3.
1. If using a mouse, move the cursor over to the File menu at the top left and click the left mouse button. If you do not have a mouse, press [ cursor to the pull-down menus. Cursor to the right or left to highlight the File menu and press
2.
2. Move the cursor to
2.2.
[Enter].
Save file in current window and press [RETURN] or
click the left mouse button.
Since you have previously named and saved the file in the current window and selected
Save file in current window, the software assumes you are saving
it under its existing name. A message appears in the message line indicating that the save was completed.
F2] to move the
Publication 1746-PM001A-US-P
Getting Familiar with Your Development Software 2-11
Translating Your Program
Path: Toplevel menu →→→ Translate/compile Path: Toplevel menu →→→ Edit mode →→→→ Other →→→→ Translate/compile QuickStroke: [CTRL F8]
1. If using a mouse, move the cursor over to the Other menu and click the left mouse button. If you do not have a mouse, press menus. Cursor to the right or left to highlight the Other menu and press
[Enter].
[F2] to get to the pull-down
2.
2. Move the cursor to Translate/compile and press
2.2.
[Enter] or click the left
mouse button. A dialog box appears asking you to select a translator/compiler. At this point, there is only one available that recognizes the .BDL extension under which you saved your file.
3.
3. Move the cursor to select 1747–PBASE Translator and press [Enter] or the
3.3. left mouse button.
If you did not make any errors in entering this program, the translation occurs successfully. If you had errors, an error message appears in the message line, and the cursor moves to the location of the error in the program.
After successfully translating a .BDL file, a new file is created using the same name but with the .BAS extension. The .BAS file contains the BASIC language version of your program, including line numbers. In our case, there is now a file named FIRST.BDL and a file named FIRST.BAS.
IMPORTANT
Translation is required only if your file was written using the BASIC Development Language (BDL). If you wrote the file using the BASIC language as described in the BASIC Language Reference Manual (publication number 1746-RM001A-US-P) or the SLC 500™ BASIC and BASIC-T Module User Manual (publication number 1746-UM004A-US-P), translation is not necessary.
Physically Connecting to Your BASIC or BASIC-T Module
At this point you could download the FIRST.BAS program to the module and execute it on the module. To do so requires that you connect the module to one of your personal computer’s serial ports (COM1 through COM8). If you have the Allen-Bradley 1784-KR card installed in your personal computer, you could connect to this instead of a serial port.
You may need to refer to Chapter 3 for details on terminal selection, and Chapter 9 for details on Terminal mode setup. Refer to the SLC 500™ BASIC and BASIC-T Modules User Manual (publication number 1746-UM004A-US-P) for details on making hardware connections.
Publication 1746-PM001A-US-P
2-12 Getting Familiar with Your Development Software
Changing to Terminal Mode
Path: Toplevel menu →→→ teRminal [232] Path: Toplevel menu →→→ Edit mode →→→→ Other →→→→ teRminal [232] QuickStroke: [F3]
1. If using a mouse, move the cursor over to the Other menu and click the left mouse button. If you do not have a mouse, press left to highlight the Other menu and press
[F2]. Cursor to the right or
[Enter].
2.
2. Move the cursor to
2.2.
teRminal [RS-232] and press [RETURN] or click the left
mouse button. The Main menu screen is replaced by the Terminal Mode screen, as follows:
Figure 2.5 Terminal Mode Screen
HELP<F1> |MENU<F2> |EXIT<F3> |COM1 1200 8 1 N |LOG CLOSED |ANSI |07-04-91 06:33pm File Setup Display deBug Exit Edit PBASE RS-232 TERMINAL MODE Version x.xx
↑↓→← to
Publication 1746-PM001A-US-P
The [RS-232] that follows the terminal selection indicates that the BASIC development software is currently configured for RS-232 communications. Depending on your system, you may have configured it for DH485 communications [DH485] instead.
3.
3. Press
3.3.
[Enter] and the prompt symbol > should appear indicating that you
have established communications with the module. If you do not see the prompt symbol, you have not established communications with the module. Verify your terminal selection (Chapter 3), the communications setup (Chapter 9), and jumper settings on the module and cabling (SLC 500™ BASIC and BASIC-T Modules User Manual, publication number 1746-UM004A-US-P).
Getting Familiar with Your Development Software 2-13
Downloading Your Program
Path: Toplevel menu →→→ teRminal [232] →→→→ File →→→→ Download from host to module Path: Toplevel menu →→→ Edit mode →→→→ Other →→→→ teRminal [232] →→→→ File →→→→ Download from host to module QuickStroke: [PgDn]
1. If using a mouse, move the cursor over to File on the Terminal mode screen
and click the left mouse button. If you do not have a mouse, press Cursor to the right or left to highlight the File menu and press
[F2].
[Enter].

Exiting a BASIC Program

2.
2. Move the cursor to
2.2.
Download from host to module and press [Enter] or
click the left mouse button. A dialog box appears asking you to enter a filename for downloading.
3.
3. Pressing
3.3.
[Enter] causes the translated version (FIRST.BAS) of the file you are
actively working on (FIRST.BDL) to be downloaded to the module.
IMPORTANT
Only files with the .BAS extension can be downloaded to the module.
To exit a program:
1. Press
[F3] to exit terminal mode. This returns you to the main menu screen in
Edit mode.
2.
2. If using a mouse, move the mouse cursor over to
2.2. screen, and click the left mouse button. You can also press
Exit on the second line of the
[F2] on your
keyboard to access the pull-down menus and cursor left or right to highlight
Exit and press [Enter]. This returns you to the Toplevel menu.
3.
3. From the Toplevel menu, move the mouse cursor down to
3.3. left mouse button. You can also cursor up or down to highlight
[Enter]. This quits the BASIC development software and returns you to the
Quit and click the
Quit and press
DOS level.
Publication 1746-PM001A-US-P
2-14 Getting Familiar with Your Development Software
Publication 1746-PM001A-US-P
Chapter

Configuring Your Software

This chapter describes how to configure your software. Major topics include:
edit options
display options
mouse and keyboard options
filename extensions
printer options
memory options
file backup, temporary file, and autosave
search and replace defaults
Terminal Emulation mode selection
3

Setup and Configuration Menu

save configuration and exit
The Setup and Configuration menu can be selected from the Toplevel menu or the Main menu.
Path: Toplevel Menu →→→ Configuration Menu Path: Main Menu →→→ Config
To access the Setup and Configuration menu from the Toplevel menu, for example, move the cursor using your mouse to the the left mouse button. If you do not have a mouse, cursor up or down to highlight
Configuration menu option and press [Enter].
the
Configuration menu option and click
1 Publication 1746-PM001A-US-P
3-2 Configuring Your Software
Figure 3.1 Configuration Menu
L:3 C:1 1747-PBASE V x.xx [Text Edit] Ins 175k 06-12-91 1:15pm File Window Block cUrsor Search Text Layout Print Macro Config Other Exit
+------SETUP AND CONFIGURATION-----+ +|DOS=5.0 CPU=80386 |===========================?No-File?=+ ||Video Card = VGA Color | | ||PBASE Path = C:\ABBASIC\BDS\ | | ||Expanded Memory N/A | | ||Serial # PBASE1 | | ||
----------------------------------| | ||Edit settings... | | ||Display setup... | | ||Mouse / Key repeat setup... | | ||Filename extensions... | | ||Printer... | | ||sWapping / Expanded memory... | | ||Backups / Temp files / Autosave...| | ||Search and Replace defaults | | ||Terminal Selection Menu... | | ||saVe configuration and exit | | || | | |+========Exit Setup<ESC>===========+ | | | | |
+
----------------------------------------------------------------------------­ 1 Help 2 3 4 5 6 7 8 9 0
+
Command Line Switches
The BASIC Development Software allows you to configure almost all of its options via the Configuration menu. However, if you need to force a configuration setting or change a setting temporarily, a command line switch can be used.
The following command line switches are available for use when starting the BASIC Development Software. To use any of them type desired switch or switches. (A space between
PBASE and the / is optional; however,
if using more than one switch, each must be separated by a space.)
PBASE followed by the
Publication 1746-PM001A-US-P
Configuring Your Software 3-3
Table 3.1 Command Line Switches
Switch Equals Summary
/MN Mouse disable The BASIC Development Software auto-detects the
presence of a mouse driver. The BASIC Development Software requires DOS version 3.1 or higher.
/MY Mouse enable
/KN Don’t change keyspeed Some personal computers with special ANSI.SYS
replacement files encounter problems when attempting to alter the keyspeed or keyboard repeat speed. If you experience keyboard problems, try the /KN switch. (/KY is the default.) If this fixes your problem, be sure to go into the Configuration menu and select saVe configuration and exit. This saves /KN as the default and you do not need to use either of these command line switches again. To restore the previous settings, start the software using the /KY command line switch and again save the configuration.
/KY Change keyspeed
/KR 1784-KR card is installed If you choose to use this card, first verify that its
driver resides in the main subdirectory of the BASIC Development Software (ABBASIC\BDS unless you renamed it during installation). Then you must use this command line switch every time you run the BASIC Development Software.
/EN Don’t try to use enhanced
keyboard
Some personal computers and some special memory resident programs do not work when the BASIC Development Software tries to use the enhanced keyboard functions. If you experience keyboard problems, try the /EN switch.
/NR No restore Disables the Restore feature of the BASIC
Development Software. Use this if you have the Restore feature turned ON (via the Setup and Configuration menu), and would like to run the BASIC Development Software without restoring the previous status of the editor.
/B Black and white Forces the software to display screens in black and
white instead of color.
/Xn Sets screen length to n The /X and /Y switches are used to override
automatic detection of screen size and redefine the size. This is to accommodate custom video modes on some of the SUPER or ENHANCED EGA/VGA (and other) boards. The values you enter for n must be legal for your particular custom video mode. Use of either of these switches disables the Video Mode options when display setup is selected from the configuration menu.
Publication 1746-PM001A-US-P
3-4 Configuring Your Software
Table 3.1 Command Line Switches
Switch Equals Summary
/Yn Sets screen width to n
/V No snow suppression on
CGA monitor
/EMSOFF Don’t use expanded memory Do not use Expanded Memory. This disables any
Do not wait for retrace on CGA video I/O. This disables snow suppression on CGA monitors.
expanded memory options available through the configuration menu.
Loading Files from the Command Line
Files to be loaded may be specified on the command line with the PBASE command. If more than one file is specified (separated by a space), then windows are created for each additional file. DOS wild card characters (* and ?) are allowed.
Examples:
PBASE *.BAS opens windows as required to load all .BAS files in the current
directory.
PBASE TEST.BDL TEST.BAS opens a window for TEST.BDL and then opens a
window for TEST.BAS.

Configuring Your Edit Options

Path: Toplevel Menu →→→ Configuration menu →→→→ Setup and Configuration menu →→→ Edit settings Path: Main Menu →→→ Config →→→→ Setup and Configuration menu →→→→ Edit settings
Selecting Edit settings from the Setup and Configuration menu causes the following dialog box to appear:
Publication 1746-PM001A-US-P
Configuring Your Software 3-5
Figure 3.2 Edit Settings Dialog Box
L:3 C:1 1747-PBASE V x.xx [Text Edit] Ins 175k 06-12-91 1:15pm File Window Block cUrsor Search Text Layout Print Macro Config Other Exit
+------SETUP AND CONFIGURATION------+ +|DOS=5.0 CPU=80386 |===============================?No-File?=+ ||Video+±±±±±±±±±±±±±±±±±±±±±±±±±EDIT SETTINGS±±±±±±±±±±±±±±±±±±±±±±±±±+ |
||PBASE|Page break string........ | |
||Expan|Word delimits............ ( ) " ' # $ @ ! % * { } ? / | 9 | |
||Seria|Max undo count........... 50 | |
||±±±±±| | | ||Edit | | | ||Displ|Cursor: | | ||Mouse| Insert Overwrite Options: | | ||Filen| ( ||Print| ( ) ± ( ||sWapp| ( ) ± ( ) 1/3 block [ ] CR/LF at EOF | | ||Backu| ( ) ± ( ) Full block [ ] Restore previous status | | ||Searc| | | ||Termi|Tab expand: Column block move style: Default mode: | | ||SaVe | ( || | ( ) Spaces ( ) Leave space ( ) Overwrite | | |+=====| | | | | OK<ENTER> Cancel<ESC> Help<F1> | | | +===============================================================+ | +------------------------------------------------------------------------------+
.) ± ( ) Underline [ ] Truncate spaces | |
.) 1/2 block [ ] Control±Z at EOF | |
.) Tabs (.) Delete space (.) Insert | |
STRING INPUT: Next field<TAB>, Previous<ShftTAB>, Select<Spacebar>
The EDIT SETTINGS dialog box allows you to configure several miscellaneous editor parameters which affect the operation and use of your BASIC Development Software. Press
[Tab] to move to the next option.
Page break string allows the configuration of a user-definable page
break string of up to 10 characters. The BASIC Development Software treats this string as a page break when it is encountered in a file. The default page break string is a single form-feed character (ASCII 12), typically entered by typing [
Ctrl–L]. Refer to the help screens for more details.
Word delimits allows you to enter a string of characters that define the
word delimits. The default word delimits string is
()”’,#$@!%*{}?/ |9
where striking the space bar enters the [space] character and |9 enters the
[Tab] character.
The characters chosen as word delimiters typically are those that follow the end of a word. When you move the cursor one word to the left
arrow]
or one word to the right [Ctrl - right arrow], the cursor stops at
[Ctrl - left
the next character to the right of a word delimiter. If two or more word delimiters appear together, the cursor stops at the next character to the right of the furthest right delimiter.
Publication 1746-PM001A-US-P
3-6 Configuring Your Software
In the example below, the delimiter string is [space] ? : . The cursor stops at each
w since a word delimiter is encountered:
winter
winter?winter:winter
Max undo count allows you to configure the amount of undo steps for
each window. The maximum count is 65535. Setting this option to 0 turns undo off. The default count is set to 50. The larger this number, the less memory is available for editing.
Insert/Overwrite allows you to choose between four different cursor
sizes. You can configure different sizes for the insert and overwrite cursors to make it easy to determine which mode you are in. Move your mouse cursor to select the desired cursor size and click the left mouse button. If you do not have a mouse, press position the cursor on the desired field, and then press
[Tab] to access this field, use the up or down arrow keys to
[Tab] again to select
the item and move on to the Options field.
Options To select these miscellaneous edit options, move your mouse
cursor to the desired field and then click the left mouse button. If you do not have a mouse, press position the cursor, and press
Truncate spaces This option tells 1747-PBASE whether or not to
[Tab] to access this field, use the up or down arrow keys to
[Space bar] to select the desired items.
truncate spaces that trail lines of text. This truncation only occurs when loading a file.
Ctrl–Z at EOF Some programs require a [Ctrl–Z] (ASCII 26) at the
end of a text file. Selecting this option toggles this feature on and off.
CR/LF at EOF This option determines whether or not a Carriage
Return/Line Feed pair is placed at the end of the file. This is the normal termination for DOS files.
Restore previous status allows you to toggle the Restore feature
ON and OFF. With Restore on, the entire STATUS of the editor is saved when you exit the BASIC Development Software. This includes loaded files, windows, cursor positions, marked blocks, and history lists for virtually every prompt.
Publication 1746-PM001A-US-P
IMPORTANT
If a file to be loaded is specified from the command line, the restore feature is not invoked. Restore may also be suppressed by using the /NR option on the DOS command line when initiating the BASIC Development Software.
Configuring Your Software 3-7
Tab expand allows you to configure how 1747-PBASE handles tab
characters and the
[Tab] key. When Tabs is selected, pressing [Tab] causes a
tab character to be inserted and moves the cursor to the next tab stop. When
Spaces is selected, pressing [Tab] causes spaces (ASCII 32) to be inserted to
the next tab stop.
Tabs is selected, tab spacing can be changed at any time in the
IMPORTANT
If future. If
Spaces is selected, tab spacing for the file cannot be
changed by entering a new tab setting on the Layout menu.
Column block move style allows you to either leave the space intact or
delete the space where the marked columnar block originated. Refer to the help screen for an example.
Default mode allows you to configure whether 1747-PBASE is in the
Insert or Overwrite mode when it is first invoked. When you are in Edit mode, you can toggle this mode by pressing
[Insert].

Configuring Display Setup

Configuring Mouse and Keyboard Options

IMPORTANT
The word wrap function should turned off when editing .BAS and .BDL files. You can use the word wrap function for general word processing applications.
Path: Toplevel Menu →→→ Configuration menu →→→→ Setup and Configuration menu →→→ Display setup Path: Main Menu →→→ Config →→→→ Setup and Configuration menu →→→→ Display setup
Selecting the Display setup option from the Setup and Configuration menu allows you to set the video mode at 25 lines or 43/50 lines. Selecting 43/50 lines allows you to view more of your program on the screen, but the text size is considerably smaller. Refer to the help screens for details.
Path: Toplevel Menu →→→ Configuration menu →→→→ Setup and Configuration menu →→→ Mouse / Key repeat setup Path: Main Menu →→→ Config →→→→ Setup and Configuration menu →→→→ Mouse / Key repeat setup
Selecting the Mouse / Key repeat setup option from the Setup and Configuration menu allows you to enable/disable a mouse, adjust the sensitivity of the mouse, and turn the mouse cursor off when the keyboard is used. It also allows you to set the keyboard repeat speed (delay between keystrokes when a key is held down) and the keyboard repeat delay (delay before repeating begins when a key is held down). Refer to the help screen for details.
Publication 1746-PM001A-US-P
3-8 Configuring Your Software

Configuring Your Filename Extensions

Path: Toplevel Menu →→→ Configuration menu →→→→ Setup and Configuration menu →→→ Filename extensions Path: Main Menu →→→ Config →→→→ Setup and Configuration menu →→→→ Filename extensions
To configure your filename extensions:
1. Select
Filename extensions from the Setup and Configuration menu. You
get a list of the filename extensions that are currently recognized by the BASIC Development Software. You can add (Create) or remove (Delete) extensions from this list as needed.
Effect on Programming: Upon loading a file, the software searches this list for the extension of the file being loaded.
Figure 3.3 Extension Setup
L:3 C:1 1747-PBASE V x.xx [Text Edit] = Ins 175k 06-12-91 1:15pm
File Window Block cUrsor Search Text Layout Print Macro Config Other Exit +------SETUP AND CONFI+--------EXTENSION SETUP----------+ +|DOS=3.30 CPU=80386 | Create<Ins> Delete<Del> |==========?No-File?==+ ||Video Card = VGA Colo| Copy<F4> Edit<F3> | | ||PBASE Path = C:\ABBAS| | | ||Expanded Memory N/A | DEFAULT | | ||Serial # 1234567 | BDL ||---------------------| BAS | |
||Edit settings... | DOC | |
||Display setup... | | | ||Mouse / Key repeat se| Edit<ENTER> Done<ESC> Help<F1> | | ||Filename extensions..+=================================+ | ||Printer... | | ||sWapping / Expanded memory... | | ||Backups / Temp files / Autosave...| | ||Search and Replace defaults | | ||Terminal Selection Menu... | | ||saVe configuration and exit | | || | | |+========Exit Setup<ESC>===========+ | |
LIST BOX: Next field<TAB>, Previous<ShftTAB>,
+-------------------------------------------------------------------------------+
| |
<PgUp><PgDn><Home><End>
↑↓
Publication 1746-PM001A-US-P
2. Press [Tab] to move to the next option. Press [Enter] to make selection.
3. Highlight the filename extension you wish to edit (BDL in this case) from the extension setup list and select
Edit<F3>. You get the EXTENSION SETUP
dialog box for the BDL extension. There you can see that the Edit mode for BDL files is text, the Indent style is smart, the Tab spacing is 2, the Right margin is 78 and Word wrap is off.
Effect on Programming: If, for example, you select a program called FIRST.BDL to be loaded into an edit window, the software searches the filename extension list, and finds BDL. It refers to the parameters entered in the
EXTENSION SETUP dialog box for BDL as the file is loaded. When you edit
Configuring Your Software 3-9
this file, the indents, tabs, margins, and word wraps are guided by these settings.
Figure 3.4 Extension Dialog Box
+--------------------------EXTENSION SETUP------------------------+ | Extension: BDL | | Edit mode: Indent style: Tab spacing: 2 |
| (
.) Text ( ) Off Right margin: 78 |
| ( ) Document ( ) Auto |
| (
| | | Language type: [1747_PBASE ]
| Default directory: ................................ |
| Compiler-Program setup | | | | OK<ENTER> Cancel<ESC> Help<F1> | +-----------------------------------------------------------------+
.) Smart [ ] Word wrap |
|
4. Move the cursor down to highlight Language type for the .BDL extension. (Use your mouse or press bring up the Language list box. Note that
[Tab] to move the cursor.) Press [down arrow] to
1747-PBASE was selected from this
list for the .BDL extension.
Effect on Programming: While you edit programs, the software notes the
Language type from the extension setup table and interacts accordingly.
Refer to the help screen on Language Specific Support for details.
Figure 3.5 Language Dialog Box
+-----------LANGUAGE--------------+ | Create<Ins> Delete<Del> | | | | 1747-PBASE | | NONE | BASIC | | OK<ENTER> Cancel<ESC> Help<F1> | +
---------------------------------
↑ ↓
| | |
+
5. Press [ESC] to exit the Language list box and return to the EXTENSION SETUP
dialog box. The next parameter,
Default directory, is used to define DOS
directory paths for loading and saving files. You can enter a disk drive and/or directory and sub–directory path here. Refer to the help screen on the Default directory for details.
Effect on Programming: When you enter a filename to be loaded into a window, you can enter a DOS path along with the filename. If you do not, the currently active directory will be searched for that filename. If it is not found, then the default directory entered is searched.
When you save a file from an open window, you can also enter a DOS path along with the filename. If you do not, the file is saved in the default directory entered here.
Publication 1746-PM001A-US-P
3-10 Configuring Your Software
6. Move the cursor down by pressing [Tab] to highlight Compiler–Program
setup for the .BDL extension, and press [Enter]. The Compiler/Program
setup list box appears from which the desired compiler can be selected. In this case, the .BDL extension has only one compiler to select from: the 1747-PBASE Translator.
Effect on Programming: When you attempt to translate/compile a file, the software again refers to the extension setup table. There it finds that files with .BDL as their filename extension use the compiler program called the 1747-PBASE Translator. This compiler is used during translate/compile.
Figure 3.6 Compiler Setup Dialog Box
+-----COMPILER/PROGRAM SETUP------+ | Create<Ins> Delete<Del> | | Copy<F4> Edit<F3> | | | | 1747±PBASE Translator | | | | | | | | Edit<ENTER> Done<ESC> Help<F1> | +
---------------------------------
+
7. Press [Enter]. The COMPILER/PROGRAM SETUP dialog box appears. You can
define a number of compiler-specific parameters here. Refer to Chapter 8 for details on the parameters in this dialog box.
Effect on Programming: Compiling is controlled by the settings in the
COMPILER/PROGRAM SETUP dialog box. Parameters there determine, among
other things, whether the file is saved first, whether the screen is cleared, whether compiler errors are processed, and how memory is allocated during the compile.
Figure 3.7 Compiler/Program Setup Variables
+---------------------COMPILER/PROGRAM SETUP------------------------+ | Description: 1747±PBASE Translator |
| Command line: BTRAN <FILE> /I\ABBASIC\BAS................ |
| Program type: [1747-PBASE ] | | Memory requited in k bytes(0=all): 0 | | | | Swap method: Options: |
| (
.) Use default [ ] Clear screen |
| ( ) No swap [X] Save all files | | ( ) To disk only [ ] Reload file | | ( ) To EMS only [ ] Do NOT process compiler errors | | ( ) To EMS then to disk | | | | OK<ENTER> Cancel<ESC> Help<F1> | +
==================================================================
+
Publication 1746-PM001A-US-P
Configuring Your Software 3-11

Configuring Your Printer Options

Configuring Your Memory Options

Path: Toplevel Menu →→→ Configuration menu →→→→ Printer Path: Main Menu →→→ Config →→→→ Printer
When you select the Printer option from the Setup and Configuration menu, you get a list of common printers. You can select a printer from this list or you can select
Create<Ins> to add a printer if it is not listed. By selecting Edit<F3> , you
can modify the parameters for a listed printer or a printer you have added.
Refer to Chapter 7 for information on printing and printer configuration.
Path: Toplevel Menu →→→ Configuration menu →→→→ sWapping/Expanded memory Path: Main Menu →→→ Config →→→→ sWapping/Expanded memory
When you select the sWapping/Expanded memory option from the Setup and Configuration menu, you get a screen with several memory-related parameters. These allow you to optimize the use of conventional memory (the first 640K of RAM memory), expanded memory, and disk space in your personal computer.
IMPORTANT
The BASIC Development Software uses expanded memory, not extended memory. Most 80386-based personal computers come with software (typically called EMM for Expanded Memory Manager) that allows you to designate some of your memory as expanded memory. Some 80386 and most 80286, 8088, 8086-based personal computers need a special board for expanded memory. Refer to the hardware and DOS documentation provided with your computer.
During editing or file manipulation, it is common for the conventional memory of your personal computer to fill completely. When this happens, the BASIC Development Software may attempt to move portions of a file into expanded memory or onto a disk drive. This memory swapping is done with no effect on you as a user.
You should find out how much expanded memory (EMS) your personal computer has before setting values to any of these parameters. As you become more proficient in using this software and begin using shell to DOS or user-defined program features, you should determine the maximum program size that you expect to use and allocate memory accordingly.
IMPORTANT
The memory swapping parameters here are similar to those in the compiler setup screen that you access when setting up a compiler for a specific filename extension (Chapter 8). Be aware that any memory swapping method selected for a compiler overrides the method selected here when that compiler is used. Refer to the help screens for details.
Verify your personal computer’s expanded memory size before selecting your memory option. If sufficient memory is not available, a system error may occur.
Publication 1746-PM001A-US-P
3-12 Configuring Your Software

Backup Files, Temporary Files, and Autosave

Path: Toplevel Menu →→→ Configuration menu →→→→ Backups/Temp files/ Autosave Path: Main Menu →→→ Config →→→→ Backups/Temp files/Autosave
When you select the Backups/Temp files/Autosave option from the Setup and Configuration menu, you get a dialog box with several parameters for backing up files, making temporary files, and saving open files.
Backup Files
Backup files are a previously saved versions of files you have edited. They can be restored in the event of damage or undesired changes to the original file. You have several options for backup method and backup frequency.
Temporary Files
Temporary files are those created during memory swapping, or when you use the DOS shell. Though you have limited access to these files, and they are typically erased when you quit the BASIC Development Software, you can select a specific directory where they are to be stored. You can also use the Temporary file directory to send files to a RAM disk if you have that utility on your personal computer.
IMPORTANT
If no directory paths are entered for the temporary files, they are saved to the active disk drive and directory. This may cause problems if, for example, you use the DOS Shell from the BASIC Development Software, log on to a floppy disk drive, and then exit back to the software. Temporary files are written to that floppy disk and an error occurs if the floppy disk runs out of space. To avoid this, you may want to enter the name of the directory in which your software was installed, such as C:\ABBASIC\BDS.
Autosave
The autosave feature causes files to be saved automatically after a specified period of time or a specified period of keyboard inactivity. This prevents you from losing too much of your work should there be a power failure or system error.
For details and descriptions of these parameters, refer to the help screens.
Publication 1746-PM001A-US-P
Configuring Your Software 3-13

Search and Replace Defaults

Terminal Emulation Mode Selection

Path: Toplevel Menu →→→ Configuration menu →→→→ Search and Replace defaults Path: Main Menu →→→ Config →→→→ Search and Replace defaults
When you select the Search and Replace defaults option from the Setup and Configuration menu, you get a list box with three types of searches. When you highlight one of these and select it, you get a dialog box with parameters for that specific type of search.
These parameters are the defaults that define how the search is conducted. When the actual search is performed in Edit mode, a nearly identical screen appears, with the search parameters as you entered them. They can be altered at the time of the search, and remain altered until you quit; however, they revert back to the default values entered here the next time you run the BASIC Development Software.
User-defined keystroke macros can be created to select desired search and replace settings. Keystroke macros are described in Chapter 4.
For details and descriptions of these parameters, refer to the help screens.
Path: Toplevel Menu →→→ Configuration menu →→→→ Terminal Selection Menu Path: Main Menu →→→ Config →→→→ Terminal Selection Menu
The Terminal Selection Menu option from the Setup and Configuration menu allows you to select the Terminal Emulation mode desired for communicating with your BASIC or BASIC-T module. The following three Terminal modes are available:
RS-232 Terminal Mode  allows you to communicate to the RS-232 program
port (Prt1) of the module
DH485 Terminal Mode  allows you to communicate to the DH485 port of
the module
General Purpose Communications Terminal Mode — allows you to use your
personal computer as a general purpose communications terminal. In this mode, your personal computer can be used as an ASCII terminal that supports phone/modem dialing. This mode should not be used for communication to the module.
Refer to the SLC 500™ BASIC and BASIC-T Modules User Manual (publication number 1746-UM004A-US-P), for information on connecting and communicating with the module or other port device through the Terminal mode.
Publication 1746-PM001A-US-P
3-14 Configuring Your Software

Save Configuration and Exit

Path: Toplevel Menu →→→ Configuration menu →→→→ saVe configuration and exit Path: Main Menu →→→ Config →→→→ saVe configuration and exit
Some configuration changes are saved immediately at the time you assign them, while others are not saved until you select the option from the Setup and Configuration menu. At that time, you are prompted to save the configuration if changes have been made and were not saved previously.
If you elect to exit without saving configuration changes, those that were changed immediately remain changed. Only changes that are not saved until exiting are abandoned.
IMPORTANT
ATTENTION
!
A file called DEFAULTS.BAT is included with the BASIC Development Software package to restore the default values. It will restore all values as if you had just installed the software in your personal computer. This file is executed by typing (while in the directory in which DEFAULTS.BAT is stored) prior to running the BASIC Development Software.
Executing the file DEFAULTS.BAT deletes all changes you made to any of the BASIC Development Software parameters and replaces them with the original default values. Do not execute DEFAULTS.BAT from the DOS shell.
saVe configuration and exit
DEFAULTS
Publication 1746-PM001A-US-P
Chapter
4

Editing a Program

This chapter is designed to help you understand the file editing features available with your BASIC Development Software. It provides a general description of the features so you can apply them as needed when you begin writing your own programs. major topics include:
simple editing techniques
search operations
block operations
text formatting
advanced editing features

Using Simple Editing Techniques

When you select Edit mode from the Toplevel menu, the main menu appears and a window opens. This window, the A window, is immediately available for file editing, or an existing file can be opened and loaded into it. At that point, your keyboard provides you with some simple editing techniques.
IMPORTANT
If using the keys on the numeric keypad of your personal computer, make sure you have turned your
[NumLock] off.
The following keys perform as described while editing text:
Table 4.1 Key Functions
Keys Function
[right arrow] [left arrow] [up arrow] [down arrow] [Ctrl-right
arrow] [Ctrl-left arrow] [Home] [End] [PageUp] [PageDown] [Ctrl-PageUp] [Ctrl-PageDown] [Ctrl-Home] [Ctrl-End]
Moves the cursor across the screen to the right. Moves the cursor across the screen to the left. Moves the cursor up the screen. Moves the cursor down the screen. Moves the cursor one word to the right.
Moves the cursor one word to the left. Moves the cursor to the beginning of a line. Moves the cursor to the end of a line. Scrolls the screen up by one full screen. Scrolls the screen down by one full screen. Scrolls the screen to the top of the page. Scrolls the screen to the top of the next page. Scrolls the screen to the top of the file. Scrolls the screen to the end of the file.
1 Publication 1746-PM001A-US-P
4-2 Editing a Program
Table 4.1 Key Functions
Keys Function
[Delete] [Backspace] [Insert]
Deletes the character directly under the cursor. Deletes the character to the left of the cursor. Toggles between Insert mode (new text is inserted to the left of the
cursor) and the Overstrike mode (new text overwrites the character under the cursor).
Another technique for moving through a program is to select a line number. You can select
Path: Toplevel Menu →→→ Edit Mode →→→→ cUrsor →→→→ goto Line number QuickStroke: [Alt F8]
goto Line number when you pull down the cUrsor menu.
There are a number of other QuickStrokes and simple editing techniques available. They are listed in Hypertext help when you select Quick Reference from the help index or table of contents.

Searching Operations

The Search menu provides methods of searching for various expressions. This description is limited to a general explanation of the selections within that menu. For a detailed explanation on implementing menu selections, refer to the network of help screens. Refer to Chapter 2 for details on using Help.
Path: Toplevel menu →→→ Edit mode →→→→ Search Quickstroke: available for individual items within the Search menu.
Figure 4.1 Search Menu
L:3 C:1 1747-PBASE V x.xx [Text Edit] Ins 175k 06-12-91 1:15pm File Window Block cUrsor Search Text Layout Print Macro Config Other Exit
+----------------SEARCH----------------+ +=+A+====================|Search for text... <F6> |===?No-File?=+ |>> EOF << |search and Replace... <ShftF6>| | | |repeat Previous search <CtrlF6>| | | |--------------------------------------| | | |multiple File search... <AltF> | | | |List files from last search...<AltG> | | | +--------------Cancel<ESC>-------------+ | | | | | | | | | | | | | | | | | | | | | | | | | | | +------------------------------------------------------------------------------+
1 Help 2 3 4 5 6 7 8 9 0
Publication 1746-PM001A-US-P
Editing a Program 4-3
The Search menu is divided into two sections. The first section provides search options used to search the current file that is loaded into the edit window. The second section provides options used to search multiple files in the specified search path, regardless of whether or not the file has been loaded into an edit window.
The following is a list of the options available from the Search menu and a brief explanation of their function. Remember that Hypertext help is available to assist you should you need more details:
Search for text — allows you to search within a window, in the forward or
reverse direction, in a number of different search modes, for several different expressions, literals, or phrases. For a complete description and examples of this search option, refer to the help screen.
search and Replace — allows you to replace the searched item with a
selected item. This is the same as
Search for text, except that it allows for
replacement of the searched characters during the search.
repeat Previous search — repeats the last Search for text or search
and Replace

Using Block Operations

multiple File search — searches any or all files on any disk drive for any
specified string with a number of different search options. Where the search was successful, files appear in a list box from which a file can be selected and loaded into a window.
List files from last search — lists the files found in the last multiple
File search.
The Block menu provides many features for use with word processing software to increase speed and accuracy when editing BASIC programs.
Path: Toplevel menu →→→ Edit mode →→→→ Block QuickStroke: available for individual items within the Block menu.
Publication 1746-PM001A-US-P
4-4 Editing a Program
Figure 4.2 Block Menu
L:3 C:1 1747-PBASE V x.xx [Text Edit] Ins 175k 06-12-91 1:15pm File Window Block cUrsor Search Text Layout Print Macro Config Other Exit
+--------------BLOCK-------------+ +=+A+=======|(Copy block <F9>) |>> EOF << |(Move block <F10>) | | | |(Delete block <CtrlF10>)| | | |--------------------------------| | |cut and Paste | | | |(save Block to disk...<CtrlF5>) | | | |(Indent line block <AltI>) | | | |(Undent line block <AltU>) | | | |--------------------------------| | |Window copy... <ShftF9> | | | |window moVe... <ShftF10> | | | |--------------------------------| | |mark Lines of text <F7> | | | |mark cOlumns of text <ShftF7> | | | |mark Stream of text <AltF7> | | | +-----------Cancel<ESC>----------+ | | | | | | | | +------------------------------------------------------------------------------+ 1 Help 2 3 4 5 6 7 8 9 0
|======================?No-File?=+
|
|
|
|
Before you can manipulate a block (copy, move, delete, etc.), you must first define the block using one of the three marking options on the Block menu.
IMPORTANT
If you are unable to change any characters in a file, that file has probably been locked. Files can be locked (made read-only) or unlocked through the File menu. Move the cursor to the Information About Current File option and press
[Enter] or the
left mouse button. Below the description of the current file are the unlock and lock options. Press to select either of these options and press
[Tab] and/or the arrow keys
[Enter] or the left
mouse button.
The following is a list of the options available from the Block menu and an explanation of their function. Remember that Hypertext help is available with more details:
Publication 1746-PM001A-US-P
Table 4.2 Block Defining Options
Option QuickStroke Description
mark Lines of text
mark cOlumns of text
mark Stream of text
End block [F7]
turn marking oFf
[F7]
[Shift-F7]
[Alt-F7]
[Ctrl-F9]
allows you to mark specific lines in a file beginning or ending with the line where the cursor is positioned prior to selecting this menu item. If using a mouse, click the left mouse button to define this cursor position in the file.
allows you to mark specific columns in a file beginning or ending with the column where the cursor is positioned prior to selecting this menu item. If using a mouse, click the left mouse button to define this cursor position in the file. With this option, you can fan out to control the column and row width being selected.
allows you to mark a stream of text in a file beginning or ending with the character where the cursor is positioned prior to selecting this menu item. If using a mouse, click the left mouse button to define this cursor position in the file. This option is similar to marking lines of text except that it allows you to take portions of a line.
only appears while you are in the process of marking text. Select it after you have marked all that you want of the block.
only appears after you have marked text. It allows you to remove all block marking in the file in the active window.
Editing a Program 4-5
Figure 4.3 Marking Examples
MARK LINES OF TEXT <F7>
MARK COLUMNS OF TEXT <ShiftF7>
MARK STREAMS OF TEXT <AltF7>
Once you have defined a block, you can perform the following actions on it.
Table 4.3 Block Menu Actions
Option QuickStroke Description
Copy block
Move block [F10]
Delete block [Ctrl-F10]
cut and Paste
save Block to disk
Indent line block
[F9]
[Ctrl-F5]
[Alt-I]
allows you to copy a block to the current cursor position in a window.
allows you to move a block to the current cursor position within a window.
allows you to delete the block within the currently active window.
allows you to move, copy, or append a block to a hidden buffer for insertion elsewhere in any active window. Only one block can be in the hidden buffer at a time.
allows you to save a block to a disk as a separate file.
moves a block one tab stop to the right. This can be used only on blocks made by marking lines of text.
Publication 1746-PM001A-US-P
4-6 Editing a Program
Table 4.3 Block Menu Actions
Option QuickStroke Description
Undent line block
Window copy [Shift-F9]
[Alt-I]
moves a block one tab stop to the left. This can be used only on blocks made by marking lines of text.
allows you to copy any block to the currently active window.
window moVe [Shift-F10]
allows you to move any block to the currently active window.

Text Formatting, Undo, and Redo

The Text menu supports text entry and formatting with a number of timesaving features. This menu also includes an undo and redo, allowing you to step back through any unwanted work.
Path: Toplevel menu →→→ Edit mode →→→→ Text QuickStroke: available for individual items within the Text menu
Figure 4.4 Text Menu
L:3 C:1 1747-PBASE V x.xx [Text Edit] Ins 175k 06-12-91 1:15pm File Window Block cUrsor Search Text Layout Print Macro Config Other Exit +-------------TEXT--------------+ +=+A+===========================|Undo <CtrlF7> |===?No-File?=+ |>> EOF << |Redo <CtrlDEL>| | | |-------------------------------| | | |Sort text... | | | |upper Case | | | |Lower case | | | |cenTer line | | | |time/Date stamp <ShftF2> | | | |-------------------------------| | | |re±Format paragraph <AltR> | | | |-------------------------------| | | |rePeat command n times<CtrlR> | | | +----------Cancel<ESC>----------+ | | | | | | | | | | | | | | | +------------------------------------------------------------------------------+ 1 Help 2 3 4 5 6 7 8 9 0
Publication 1746-PM001A-US-P
IMPORTANT
If you are unable to change any characters in a file, that file has probably been locked. Files can be locked (made read-only) or unlocked through the File menu. Move the cursor to the Information About Current File option and press
[Enter] or
the left mouse button. Below the description of the current file are the unlock and lock options. Press keys to select either of these options and press
[Tab] and/or the arrow
[Enter] or the
left mouse button.
Editing a Program 4-7
The following is a list of the options available from the text menu and a brief explanation of their function. Remember that Hypertext help is available with more details.
Table 4.4 Text Menu Options
Option QuickStroke Description
Undo [Ctrl-F7]
Redo [Ctrl-Delete] Sort text
upper Case
Lower Case
cenTer line
time/Date stamp
re-Format paragraph
rePeat command n times
[Shift-F2]
[Alt-R]
[Ctrl-R]
allows you to undo your last editing actions, excluding file saves and file loading. The amount of undo stops can be set from 0 to 65535 through the Setup and Configuration menu.
allows you to reverse your last undo. allows you to sort the lines of your file into ascending or
descending, alphabetical or numerical order. You can control which column of characters is to be sorted, and you can confine the sorting to a specific area you have defined with a block.
allows you to change a word, line, or block to all upper-case letters.
allows you to change a word, line, or block to all lower-case letters.
Centers the currently selected line between column 1 and the right margin.
causes the current date and time to be inserted at the cursor location.
places text into a paragraph that extends from the left margin to the right margin and wraps lines as needed. This feature is generally used when paragraphs of text are involved.
allows you to type in a number of repetitions followed by the key you want to repeat. For example, selecting rePeat command n times and then typing 74x results in seventy-four x’s being inserted at the current cursor location.
Typing 20 followed by the delete key causes the next twenty characters to be deleted.

Advanced Editing Techniques

This section deals with the more sophisticated editing techniques available with the BASIC Development Software. These topics include:
lines
calculator
ASCII Table
windows
keystroke macros
cursor markers
Publication 1746-PM001A-US-P
4-8 Editing a Program
The Other menu provides access to the first three of the advanced features described in this section.
Path: Toplevel menu →→→ Edit mode →→→→ Other QuickStroke: available for individual items within the other menu.
Figure 4.5 Other Menu
L:3 C:1 1747-PBASE V x.xx [Text Edit] Ins 175k 06-12-91 1:15pm File Window Block cUrsor Search Text Layout Print Macro Config Other Exit +----------------OTHER----------------+ +=+A+==================================|Select a project file... |>> EOF << | | |Translate/Compile <CtrlF8> | | | |find neXt error <CtrlF2> | | | | |Calculator <AltF2> | | | |Ascii table <AltA> | | | |shell to DOS <AltF5> | | | |Linedraw <AltL> | | | | |teRminal [RS±232] <F3> | | | +-------------Cancel<ESC>-------------+ | | | | | | | | | | | | | | | +-------------------------------------------------------
1 Help 2 3 4 5 6 7 8 9 0
|User defined program... | | |-------------------------------------| |
|-------------------------------------| |
|-------------------------------------| |
<AltENTER>|=+
------------------------
+
Publication 1746-PM001A-US-P
Drawing Lines
Path: Toplevel Menu →→→ Edit mode →→→→ Other →→→→ Linedraw QuickStroke: Toplevel Menu →→→ Edit mode →→→→ [Alt-L]
The linedraw feature, available through the Other menu, is useful in creating boxes, bar graphs, and tables. When used in a print statement, these lines translate for use in any BASIC program executed through the BASIC module.
Linedraw allows you to draw single or double lines and boxes in a window. The lines are saved with the file and translated into BASIC code if you are using the 1747-PBASE Translator. Be aware that some printers may require special line characters to be defined in order to print the lines.
Hypertext help is available with more details on this feature.
Your BASIC Development Software comes with an example line-drawing program that uses this feature with programming macros. You can load this program into a window and review it as an example. It is called LINEDRAW.BDL and resides in the BAS sub-directory.
Editing a Program 4-9
Using the Calculator
Path: Toplevel Menu →→→ Edit mode →→→→ Other →→→→ Calculator QuickStroke: Toplevel Menu →→→ Edit mode →→→→ [Alt-F2]
The calculator feature, available through the Other menu, is useful for doing quick math operations right on your personal computer where the result can be pasted into the active file.
The calculator works with decimal, hexadecimal, octal, or binary formats. It can perform addition, subtraction, multiplication, and division. It can also perform logical AND, OR and exclusive OR functions. The calculator has a tape output so you can review your entries, and a paste option that pastes the calculation result at the last cursor location in the active window.
Hypertext help is available with more details on this feature.
The ASCII Table
Path: Toplevel menu →→→ Edit mode →→→→ Other →→→→ ASCII table QuickStroke: Toplevel menu →→→ Edit mode →→→→ [Alt-A]
The ASCII table is a view-only, three-page ASCII table with character, decimal, and hexadecimal columns.
Using Windows
Path: Toplevel menu →→→ Edit mode →→→→ Window QuickStroke: available for individual items within the Window menu
Windows are labeled alphabetically in their top left corner. The software can open up to 100 windows simultaneously. Each may contain a separate file, or they can be linked together and contain different parts of the same large file. You can open and close these windows independently of one another.
Publication 1746-PM001A-US-P
4-10 Editing a Program
Figure 4.6 Window Menu
L:3 C:1 1747-PBASE V x.xx [Text Edit] Ins 175k 06-12-91 1:15pm File Window Block cUrsor Search Text Layout Print Macro Config Other Exit
+----------WINDOW----------+ +=+C+|Open | |Close | | | |Split | | | |List... <AltF1> | | | |--------------------­| |Next <ShftF1> | | | |Previous <CtrlF1> | | | |Adjacent <AltW> | | | |-------------------­| |Hide | | | |Modify size <ScrollLockOn>| | | |Zoom <CtrlF3> | | | |mInimize | | | |----------------­| |linK... | | | |(Unlink) | | +--------Cancel<ESC>-------+ | | | | | | +-------------------------------------------------------------------------------+
1 Help 2 3 4 5 6 7 8 9 0
------
---------
|====================C:\ABBASIC\BAS\FIRST.BDL==+
-----
| |
| |
| |
|
|
The best way to understand and become proficient at using the window features is to apply them as you edit files. Hypertext help is available to assist you. The window menu items are explained briefly in the following table.
Table 4.5 Window Menu Options
Option QuickStroke Description
Open opens a new window. A new file may or may
not be loaded at the same time.
Close closes the current window. If the file in that
window has been edited but not saved, you are prompted to save or abandon the changes.
Split splits the current window horizontally or
vertically. A new file can be loaded in the process. If not, the existing file is duplicated in the split window and linked to the original.
List
Next
Previous
Adjacent
[Alt-F1]
[Shift-F1]
[Ctrl-F1]
[Alt-W]
lists the open windows by window letter, filename, status, and path. Windows can be selected, deleted, hidden, saved, and previewed through this list.
alphabetically selects the next window, unless it is hidden.
alphabetically selects the previous window, unless it is hidden.
prompts for a direction to activate an adjacent window.
Publication 1746-PM001A-US-P
Editing a Program 4-11
Table 4.5 Window Menu Options
Option QuickStroke Description
Hide hides a specific window. To bring it back,
select List from the Window menu, select the
Modify size Zoom
[Scroll Lock On] [CTRL-F3]
hidden window on the box, and then press
OK<ENTER>.
moves or resizes a window. increases a window to full size. Zooming the
WINDOW LIST dialog
[Enter] or select
same window a second time returns it to its
original size. mInimize reduces a window to a single line icon. linK allows you to view and/or edit different
sections of the same file by placing those
sections in different windows. This is useful
for large files and when doing block editing. Unlink unlinks a previously linked window.
Using Keystroke Macros
Keystroke macros allow you to record a series of key presses that accomplish a specific task. The recorded keystrokes are then saved as a keystroke macro that can be played back with a single QuickStroke.
Path: Toplevel menu →→→ Edit mode →→→→ Macro
Figure 4.7 Macro Menu
L:3 C:1 1747-PBASE V x.xx [Text Edit] Ins 175k 06-12-91 1:15pm File Window Block cUrsor Search Text Layout Print Macro Config Other Exit +------MACRO---------+ +=+A+=============================================|Keystroke macros... |>> EOF << +-----Cancel<ESC>----+ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | +------------------------------------------------------------------------------+
1 Help 2 3 4 5 6 7 8 9 0
|File?=+
Publication 1746-PM001A-US-P
4-12 Editing a Program
Keystroke macros make your work easier and faster by allowing you to cut down on repetitive actions. For example, suppose that every time you create a program file, you enter the same information in a header. You can create a file that contains this information and splice it into each new program file. To do this, you create a file containing the header information, save it to disk under the name then use the
Merge file from disk option from the File menu.
header, and
This makes things faster, but you still have to go through the steps of getting the file and merging it into your program. Creating a keystroke macro would allow you to complete the merge process with one keystroke.
IMPORTANT
When recording keystrokes to create a keystroke macro, do not use the mouse to select menu items or to position the cursor. Use the actual keystrokes, including the function keys and the appropriate letter keys to select menu item.
IMPORTANT
When recording keystrokes, avoid using the cursor keys to select menu items or filenames. If you record cursoring down to select the sixth file in the list, and that list increases or decreases in number, you will probably end up selecting the wrong file.
Follow the step by step procedure below to create a keystroke macro to consolidate the file merging in the above example. Remember that Hypertext help is available to assist you.
1. Press
[Alt-F10] to begin keystroke recording.
Notice the blinking reverse R character in the status line at the top of the screen. The R stands for recording and alerts you that all keystrokes are being recorded until you press
[Alt-F10] again.
2. Press the keys that you would use to accomplish the file splicing:
[F2] brings up the Main menu
[F] selects the File menu
[M] selects Merge file from disk
•••• [type in the name of the file to load]
•••• [Enter]
Publication 1746-PM001A-US-P
3. Press [Alt-F10] again to stop keystroke recording. Once recording is
terminated, you asked if you want to save the keystroke macro. Select the option. The
EDITING KEYSTROKE MACRO dialog box appears. You are
prompted to enter a description, QuickStroke key assignment, and mode specification for the keystroke macro.
4. Type in press assignment. If you press
KEYSTROKE MACRO dialog box by pressing [F3].
Company header, the description for this keystroke macro. DO NOT
[Enter]. Doing so will save the macro without a QuickStroke
[Enter] by mistake, you can return to the EDITING
Yes
Editing a Program 4-13
5. Move the mouse cursor to the QuickStroke assignment field and click the left mouse button. If you do not have a mouse, press the QuickStroke assignment field and then press
QUICKSTROKE dialog box appears.
[Tab] to move the cursor to
[Space bar]. The EDIT
6. Press
[Alt-B], the QuickStroke for this macro. Legal QuickStroke key
assignments are described in Valid QuickStroke Key Assignments on page 4-15.
7. Press
[Tab] to move down to the Mode field. This is described in Editing
Keystroke Macros.
8. Press
[Enter] to leave the Mode field unchanged and return to the keystroke
MACRO MANAGER dialog box. There you see Company header added to the list
of keystroke macros with
[Alt-B], the QuickStroke that activates it, on the
right.
From this point on in the current editing session, whenever you press
[Alt-B],
the header is entered at the current cursor location.
Changing Recorded Keystrokes
Before leaving the keystroke MACRO MANAGER dialog box, you may want to make a change to the recorded keystrokes. For example, you find that the company header is always left-highlighted after the file-merge operation you defined with the {Alt-B] QuickStroke. Since it is necessary to turn this block marking off before any other block editing can be done, you can add the necessary keystrokes to the macro.
1. From the keystroke
header keystroke macro, and press [F3] to edit it.
2. On the
EDITING KEYSTROKE MACRO dialog box, select Edit keystrokes
MACRO MANAGER dialog box, highlight the Company
with the mouse and press the left mouse button. If you do not have a mouse, press
[Tab] to move the cursor to highlight Edit keystrokes, and then press
the space bar or down arrow.
3. Move the cursor down the list of keystrokes to the line immediately preceding where you wish to insert keystrokes.
4. Press
[INS-F2] to insert the keystroke to access the pull-down menus.
[INS-B] to insert the keystroke to access the block menu.
[INS-F] to insert the keystroke to turn the block marking off.
5. Press
6. Press
7. Press
[Enter], indicating that you are done editing keystrokes.
[Enter], indicating that you are done editing the keystroke macro.
[Enter], indicating that you are done with the keystroke MACRO
MANAGER.
Publication 1746-PM001A-US-P
4-14 Editing a Program
The whole process of splicing header information into any new file has now been reduced to one keystroke,
[Alt-B], and has been saved permanently to the active
disk drive.
Editing Keystroke Macros
You have just recorded, saved, renamed, and edited a keystroke macro using a step-by-step approach. This sub-section is intended to provide an overview of all of the options available to create, delete, copy, edit, or play back a keystroke macro from the
Table 4.6 Macro Manager Options
Option QuickStroke Description
Create
MACRO MANAGER dialog box.
[INS]
creates a new keystroke macro. Selecting create brings up the
EDITING KEYSTROKE MACRO dialog box. There are four
fields in this dialog box.
Description – enter up to 25 characters
QuickStroke assignment – press
[Tab] to get to this field,
followed by the space bar to allow you to edit it. Enter the keystroke that will trigger the macro.
Mode – Press
[Tab] to get to this field, followed by the
space bar or down arrow to display the options you may select. Mode selection determines whether the keystroke
macro can be invoked from Edit or Terminal modes.
(1)
Edit Keystroke – Press [Tab] to get to this field, followed
by the space bar or down arrow to display a list of the actual keystrokes programmed for the selected macro. You
Delete
Copy
[DEL] [F4]
can cursor up or down the list and then add
[DEL], or change [F3], the keys as needed.
erases a keystroke macro that was previously saved.
duplicates a keystroke macro. You are prompted for a
[INS], delete
descriptive name for the duplicate. Then you are prompted to replace or reassign the QuickStroke key.
Edit
Playback
[F3]
[Enter]
allows you to edit the existing keystroke macro. Selecting this brings up the
EDITING KEYSTROKE MACRO dialog box.
executes the highlighted keystroke macro immediately and returns to the Edit mode. You can use this to execute any keystroke macro on the list, including those that have not been assigned a QuickStroke.
Done
[Esc]
exits the keystroke MACRO MANAGER dialog box and returns to the Edit mode.
(1) In some cases, it may be useful to assign keystroke macros for use in Terminal mode. They could be written to send
commands like RUN, CONT, NEW, or LIST to the BASIC or BASIC-T modules.
Publication 1746-PM001A-US-P
Editing a Program 4-15
Valid QuickStroke Key Assignments
You can use any keystrokes that begin with [Alt] provided that the combination is not already in use. A message appears prompting you to enter a different combination if the one you selected is already in use. The QuickStroke key assignments are listed when you select Quick reference in Hypertext help.
In addition to the
[Alt] keystrokes, you may be able to assign additional special
function keys, depending on you personal computer’s keyboard. For example, on AT or PS/2 style keyboards, the
[F11], [F12], and [center] keys can be assigned
as QuickStroke keys.
Using Cursor Markers
The Cursor menu provides several options for marking and retrieving the cursor position while writing programs.
If you are editing a very large file and need to frequently access a different section, you can set a cursor position marker at a key location and then instantly move to that position marker at any time with a single keystroke. The markers can be stacked up to 10 deep so that you can access up to 10 positions in the reverse order that they were stored. You can also set several random access marks throughout a file for random access according to a marker number.
Path: Toplevel →→→ Edit mode →→→→ cUrsor QuickStroke: available for individual items within the Cursor menu
Publication 1746-PM001A-US-P
4-16 Editing a Program
Figure 4.8 Cursor Menu
L:3 C:1 1747-PBASE V x.xx [Text Edit] Ins 175k 06-12-91 1:15pm
File Window Block cUrsor Search Text Layout Print Macro Config Other Exit
+=+A+=============|Push position onto marker stack<AltF3> |=========?No-File?=+ |>> EOF << |Get position from marker stack <ShftF3>| | | |---------------------------------------| | | |Set random access mark | | | |Retrieve random access mark | | | |---------------------------------------| | | |goto Line number... <AltF8> | | | +--------------Cancel<ESC>--------------+ | | | | | | | | | | | | | | | | | | | | | | |
1 Help 2 3 4 5 6 7 8 9 0
| | +-----------------------------------------------------------
+-------------CURSOR POSITION------------+
-------------------
+
The following table briefly describes the options available from the Cursor menu. Remember that Hypertext help is available with more details.
Table 4.7 Cursor Menu Options
Option QuickStroke Description
Push position onto marker stack
Get position from marker stack
Set random access mark stores up to 10 cursor position for random
Retrieve random access mark
goto Line number
[Alt-F3]
[Shift-F3]
[Alt-F8]
stores up to 10 cursor positions in a marker stack. They are stored in the order they are saved each time this menu option is selected.
retrieves a stored cursor position from the marker stack and causes the cursor to move to that position. Positions are retrieved in the reverse order that they were saved.
retrieval within each window. These are not the same cursor positions as those in the marker stack. They are stored with a marker number from 0 through 9 and prompted when this menu option is selected.
retrieves the selected, stored cursor position and causes the cursor to move to that position. You are prompted for marker number 0 through 9 when this menu option is selected.
prompts for a line number and then positions the cursor at that line in the file. The number you enter is
not
a BASIC program line number; rather, it is the absolute line number from the top of the file.
Publication 1746-PM001A-US-P
Chapter
5

Manipulating Files

The goal of this chapter is to familiarize you with the manipulation features of your BASIC Development Software, including:
the File menu
project file selection
user-defined programs

The File Menu

The first pulldown menu to the left of the main menu is the File menu. This menu is the most commonly used feature for file manipulation.
Path: Toplevel menu →→→ Edit mode →→→→ File QuickStroke: available for individual items within the File menu
Figure 5.1 File Menu
L:3 C:1 1747-PBASE V x.xx [Text Edit] Ins 175k 06-12-91 1:15pm File Window Block cUrsor Search Text Layout Print Macro Config Other Exit
+------------------FILE-------------------+ |Edit new file... |=========================?No-File?=+ |Load file into current window... <ShftF5>| | |Save file in current window | | |save file As... <F5> | | |Information about current file... | | |-----------------------------------------| | |Merge file from disk... | | |(save Block to disk... ) | | |-----------------------------------------| | |DOS directory shell <CtrlF4>| | |Quit <AltX> | | +---------------Cancel<ESC>---------------+ | | | | | | | | | | |
+------------------------------------------------------------------------------+
1 Help 2 3 4 5 6 7 8 9 0
The following table provides a brief explanation of the options available from the File menu.
1 Publication 1746-PM001A-US-P
5-2 Manipulating Files
Table 5.1 File Menu Options
Option QuickStroke Description
Edit new file creates a new window where a new or existing file is
loaded. A dialog box appears from which you can either type in the filename or select it from a directory list. The directory list has the flexibility to list files from any directory on any disk drive in your system. There are also sort options for the directory list that allow you to list files by extension, name, size, date, and time.
Load file into current window
Save file in current window
save file As
Information about current file
Merge file from disk merges another file into the file you are editing at the
save Block to disk saves a block to a disk as a separate file. A block is a
DOS directory shell
Quit
[Shift-F5]
[F5]
[Ctrl-F4]
[Alt-X]
loads a file into the existing window and replaces any file currently in the window. If the current file has been changed and not saved, you are first prompted to save or abandon the changes. Then a dialog box appears from which you can select a new file to load.
save the files in the currently active window. It saves the file under its original name and replaces any previously saved version.
saves the files in the currently active window under a different name. You can type a new name with extension in the dialog box that appears, or you can select an existing name from the directory list in the dialog box. If you select the name of an existing file, you are asked if you want to overwrite that file before the save takes place.
gives you the current filename, location, and amount of disk space used. From the dialog box displayed, you can also change the filename or lock the file so it cannot be modified.
current cursor location. A dialog box appears from which you can select the file you wish to merge.
portion of a program you have marked to be copied moved, or deleted, etc. See Using Block Operations on page 4-3 for details on selecting a block.
displays DOS directories and directory trees from which you can select files. See Appendix B for more information on the DOS directory shell.
takes you out of the BASIC Development Software. IF any open files have been changed and not saved, you will be prompted to save or abandon the changes.

Selecting Project Files

Publication 1746-PM001A-US-P
The Select a project file option creates a personalized menu of frequently used files. It helps with organization and saves file loading time. This option can be accessed from either the Toplevel menu or the Other menu (under the Main menu).
User Menu
Path: Toplevel menu →→→ Select a project file Path: Toplevel menu →→→ Edit mode →→→→ Other →→→→ Select a project file QuickStroke: Toplevel menu →→→ Edit mode →→→→ [Alt-ENTER]
Figure 5.2 User Menu
L:3 C:1 1747-PBASE V x.xx [Text Edit] Ins 175k 06-12-91 1:15pm File Window Block Cursor Search Text Layout Print Macro Config Other Exit
+=+A+===============================================================?No-File?=
|>> EOF << +---------------User Menu---------------+ |
| | Create<Ins> Delete<Del> Copy<F4> | |
| | Edit<F3> | |
| | | |
| | | |
| | | |
| | Example Linedraw Program with macros | |
| | | |
| | | |
| | | |
| | Go<ENTER> Cancel<ESC> Help<F1> | |
| +=======================================+ |
| |
| |
| | | |
+----------------------------------------------------------
LIST BOX: Next field<TAB>, Previous<ShftTAB>,
Manipulating Files 5-3
------------------
↑↓<PgUp><PgDn><Home><End>
+
-+
Behind the user menu is the A window and above it is the Main menu, indicating that you are now in Edit mode.
Use the up or down arrow keys or click you mouse on the vertical scroll bar to highlight different files. When you reach the file you wish to load, press or click your mouse on the
Go<ENTER> option. The file is loaded into the next
[Enter]
available window. A new window is created, if necessary.
When you load a file into the User menu, you must create a descriptive name for the file under which the file will be listed on the user menu. The actual filename does not change.
For example, you have two BASIC files called FURN1.BDL and FURN2.BDL, used to control heat-treating furnaces. If you add them to the user menu, you can load them quickly using the Select a project file option. Also, you can create a descriptive name so that others using the software will recognize them. The FURN1.BDL file could be listed as “FURNACE CONTROL PROGRAM, MAIN FURNACE, SOUTH WALL”. The FURN2.BDL file could be listed as “FURNACE CONTROL PROGRAM, BACKUP FURNACE, WEST WALL”.
Publication 1746-PM001A-US-P
5-4 Manipulating Files
To load files into the User menu:

User-defined Programs

1. Select the
Create<Ins> option from the user menu.
2. Enter a descriptive filename to the right of the Name option.
3. Enter the actual filename to the right of the select a Filename option.
4. Select the
OK<ENTER> option when you are finished.
Notice that the descriptive name now appears on the User menu.
Besides inserting a file on the User menu, you also have the option to edit, delete, or copy an existing file on the User menu.
The User-defined program option on the Toplevel menu allows you to drop out of the BASIC Development Software to execute other programs on your personal computer. User-defined programs may be your word processing program, a file or disk management program, or a spreadsheet.
User-defined programs appear on a User menu, just like the project files discussed in the previous section. However, this is an entirely different User menu and the programs on it are generally independent programs, executable at the DOS level of your personal computer.
Path: Toplevel menu →→→ User defined program Path: Main menu →→→ Edit mode →
Other →→→→ User defined program
Figure 5.3 User-defined Programs User Menu
+-----------------BASIC MODULE PROGRAM DEVELOPMENT ENVIRONMENT-----------------+
| |
| +------------User Menu-----------+ |
| | Create<Ins> Delete<Del> | |
| | Copy<F4> Edit<F3> | |
| | | |
| | Screen±saver program | |
| | Spreadsheet | |
| | Star±Death Computer Game | |
| | Word Processing | |
| | | |
| | Go<ENTER> Cancel<ESC> Help<F1> | |
| +================================+ |
| |
| Allen±Bradley Company, Copyright 1994 |
| 1747-PBASE |
| All Rights Reserved |
| This software is licensed to: ABBASIC | | FACSYS | +===============================================================================+
1 Help 2 3 4 5 6 7 8 9 0
Publication 1746-PM001A-US-P
Manipulating Files 5-5
Programs are entered onto the User menu in a similar manner as the previous User menu, except that there are memory and directory issues to clarify.
Name Selection
When you enter a program into the User menu, you must create a descriptive name for the program, under which the program will be listed in the User menu. The actual filename for the file does not change.
To create a descriptive name for the file:
1. Select the
Create<Ins> option from the User menu.
2. Enter a descriptive name, up to 120 characters, as you would like it to appear on the User menu.
Selecting a Filename
For the user-defined program feature to work correctly, you must enter the actual filename of the program as it appears in you personal computer’s directory. Typically, you have to enter more than just the filename here. Unless the file resides in the current working directory, you have to provide a complete DOS path for the program.
To select the actual filename:
1. Highlight the select a Filename option and press mouse button.
A dialog box appears, giving you the option to view a directory listing of you personal computer. Use this directory listing to move through your directories and disk drives until you find the actual name that you want to enter into the User menu.
2. Highlight the program that you want and press mouse.
[Enter] or click the left
[Enter] or select it with the
The filename, along with its complete DOS path, is entered for the selected program.
After selecting the actual filename, move down to the Swap method option.
Swap Method Selection
The Swap method option in this dialog box refers to how memory is allocated when executing a user-defined program while still retaining the active files and current screens being used in the BASIC Development Software.
The following table contains a brief explanation of the options available under the Swap method option.
Publication 1746-PM001A-US-P
5-6 Manipulating Files
Table 5.2 Swap Method Options
Option Description
No swap when executing a user-defined program, no additional memory is
freed up by swapping BASIC Development Software out to disk or EMS. EMS refers to your computer’s expanded memory, if it has any.
To disk only when executing a user-defined program, additional memory is freed
up by swapping BASIC Development Software out to disk.
To EMS only when executing a user-defined program, additional memory is freed
up by swapping BASIC Development Software out to EMS.
To EMS then to disk when executing a user-defined program, additional memory is freed
up by swapping BASIC Development Software out to EMS first and then to disk.
Use default method the swap method used is the same as selected for Shelling to DOS
IMPORTANT
You may select a user-defined program that was executed with no problems before, and find that it is now too large for you personal computer’s RAM memory. This is because the program now has to share RAM memory with the BASIC Development Software.
For large RAM memory-consuming files, you generally have to select the To EMS or To disk only options when adding those files to the User menu.
To select the swap method:
1. Highlight
Swap method.
2. Select the desired Swap method.
After selecting the
Swap method, move to Memory required.
Memory Required Selection
The Memory required option in this dialog box refers to how much memory is required to run your user-defined program. The BASIC Development Software checks its available memory before attempting to run the user-defined program. If the amount of available memory is greater than the amount specified by this option, then the BASIC Development Software will not swap itself out to EMS or disk.
Publication 1746-PM001A-US-P
To s el ect
1. Highlight
Memory required:
Memory required.
2. Enter the amount of memory required for your user-defined program.
After selecting the amount of memory required, move down to
Options.
Manipulating Files 5-7
Use COMMAND.COM Option
The Use COMMAND.COM option allows you to use internal DOS commands like DIR, DEL, COPY, etc. from the User-defined Programs menu.
To s e l ec t
1. Highlight
Use COMMAND.COM:
Use COMMAND.COM.
2. Use the space bar to toggle your selection.
[X] = Yes
[Y] = No
After selecting
Options, move to Starting directory.
Starting Directory
If you failed to define a complete directory path to the filename you entered above, you may do so here. For example, you could enter C:\WORD if the word processing filename you selected resided in the C: drive of your personal computer in the Word directory on that drive. Refer to you DOS manual for details on defining directories and directory paths.
Publication 1746-PM001A-US-P
5-8 Manipulating Files
Publication 1746-PM001A-US-P
Chapter
6

Writing Programs Using the BASIC Development Language

This chapter is designed to help you write programs using the BASIC development language. It begins with an overview of the language. Other topics include:
translator directives
keystroke and programming macros
program integration from separate files
second program creation

Overview of the Language

The BASIC Language Reference Manual (publication number 1746-RM001A-US-P) and the SLC 500™ BASIC and BASIC-T Modules User Manual (publication number 1746-UM004A-US-P) define the syntax that provides the core of the BASIC development language. This core is then enhanced by the addition of translator directives and programming macros, all structured to a simple, open format that requires no line numbers. Descriptive label references are used as destinations for transferring control, instead of line numbers.
As an example, a BASIC development language program for printing the date is shown below. It uses a translator directive and a programming macro, and translates to about nine lines in BASIC. That means if you were not using the BASIC development language, instead of typing the three lines on the left, you would have to type in the eleven lines on the right.
REM EXAMPLE PROGRAM 0 REM ... {$I INCLUDE.BDL} 10 REM EXAMPLE PROGRAM PRINT_DATE() 20 PUSH A
30 CALL 44 40 POP A 50 P. A,”/”, 60 POP A 70 P. A,”/”, 80 POP A 90 P. A,” ”,
100 POP A
1 Publication 1746-PM001A-US-P
6-2 Writing Programs Using the BASIC Development Language
The initial statement {$I INCLUDE.BDL} is called a translator directive. There are several translator directives described in the next section of this chapter; however, this particular one has to be included in the beginning of your BASIC development language programs if you want to use any of the BASIC programming macros. It directs the 1747-PBASE Translator to a file called INCLUDE.BDL at the time the file is translated. This file contains the programming macros described in Appendix A of this manual.

Translator Directives

IMPORTANT
The command
If you are using the 1771-DB/B, you must also include the line:
{$I INCLUDBB.BDL}.
PRINT_DATE() is one of those BASIC programming macros from
the INCLUDE.BDL file. A programming macro is like a BASIC subroutine that has already been created for you. If you look through appendix A, you see that there are close to 100 macros, including many with single or multiple variables.
To summarize, the core of the BASIC development language is the BASIC language. The BASIC development language enhances the BASIC language by offering translator directives and programming macros in an open format that does not require line numbering.
When you write a program using the BASIC development language, it eventually must be translated to the BASIC language for downloading to the BASIC or BASIC-T module. Translation is performed by the 1747-PBASE Translator software.
This translation software is driven by translator directives that are included in a program. These directives result in the simplified, open format of the BASIC development language being translated to the commands and format of the BASIC language. The following is a list of BASIC translator directives:
Publication 1746-PM001A-US-P
Comment (Remark)
Any text located within { } curly brackets are program comments which are not included in the translated program. Remarks (which are not translator directives, mentioned here for comparison only) are included in the translated program. Both of these can be used as an aid in debugging as well as program documentation. Memory limitations of the BASIC or BASIC-T module may dictate that you use more comments and fewer remarks.
Writing Programs Using the BASIC Development Language 6-3
Syntax:{ }
Syntax: REM
Example: Before translation: After translation:
{This is a comment} 0 REM ... REM THIS IS A REMARK 10 REM THIS IS A REMARK
IMPORTANT
If a dollar sign immediately follows the left curly bracket, it is not interpreted as a comment. Comments are also not allowed inside of comments.
Examples of illegal comments:
{$ comment} {{comment}}
IMPORTANT
Remarks (line zero) will be created by the 1747–PBASE Translator for each .BDL program that is translated (indicated in this manual by: 0
REM ...). This remark contains the translator’s
filename (BTRAN), followed by its revision number, path and name of the program being translated, and date and time.
For example, upon translating the FIRST program of chapter 2 you would get something like:
0 REM BTRAN V X.XX C:\ABBASIC\BAS\FIRST.BDL, 06-12-91 06:35pm
Include
The Include directive tells the translator to load another source code file into the current program. This method of file inclusion allows you to frequently used routines in many different programs without re-entering any code or having to edit line numbers. The included file can contain any combination of program statements and translator directives.
Syntax:
{$I [filename.ext]}
Example: Before translation: After translation:
REM INCLUDE EXAMPLE 0 REM ... {$I FIRST.BDL} 10 REM INCLUDE EXAMPLE
20 FOR X=1 TO 100 30 A=X*2 40 P. A 50 NEXT X 60 END
Publication 1746-PM001A-US-P
6-4 Writing Programs Using the BASIC Development Language
For this example, we have included the file FIRST.BDL. Its name was entered in an include directive, and the entire program appeared after translation.
During translation, the translator first looks to see if there is a DOS path specified with the include directive to indicate where the file FIRST.BDL can be found. For example, you could use:
{$I A:\FIRST.BDL} if the file FIRST.BDL is on the A: disk drive,
or
{$I C:\ABBASIC\BDS\FIRST.BDL} if the file FIRST.BDL is in the BDS
subdirectory of the BASIC Development Software.
If no DOS path is specified with the include directive, then the translator looks to see if a DOS path is specified in the translator’s command line. This is described in Chapter 8.
If there is no DOS path specified in either the include directive or the translator’s command line, then the translator searches the current working directory for the file FIRST.BDL.
In either of these three cases, if the file is not found, then
found appears in the message line during translation.
IMPORTANT
The file INCLUDE.BDL comes as part of the BASIC Development Software package. It contains the BASIC
Error 25: File not
programming macros and the information necessary to translate them. Therefore, the statement
{$I INCLUDE.BDL} should
appear at the beginning of any program in which you intend to use the programming macros.
Label
Labels are used instead of line numbers to reference a target location in a program. A symbolic label is used anywhere you would have used a program line number in BASIC to reference a branch or jump location. This makes programs easier to read and understand, and there is no need to renumber the program after changes are made.
The label name is a string of up to 30 ASCII characters. The character set is defined to be [0..9, A..Z, a..z,_]. The label name cannot contain any tabs or spaces and must begin with a letter.
Publication 1746-PM001A-US-P
Writing Programs Using the BASIC Development Language 6-5
Syntax: {$L [labelname]}
Example: Before translation: After translation:
REM LABEL EXAMPLE 0 REM ... IF A>C THEN GOTO GET_C_VALUE 10 REM LABEL EXAMPLE A=55 20 IF A>C THEN GOTO 40 {$L GET_C_VALUE} 30 A=55 C=107 40 C=107
Tex t
The Text directive allows you to include commands like RUN and LIST in your program. When translated, these commands are not given line numbers; but they are included in the output file. As the file is downloaded to the BASIC or BASIC-T module, these directives are executed as soon as they are encountered.
Syntax:
{$T [command for module]}
Example: Before translation: After translation:
REM TEXT COMMAND EXAMPLE 0 REM ... {$I INCLUDE.BDL} 10 REM TEXT COMMAND EXAMPLE FOREGROUND_BLACK() 20 PRINT CHR(27),“[30m”, BACKGROUND_RED() 30 PRINT CHR(27),“[41m”, CLS() 40 PRINT CHR(27),“[2J”, A=55 50 A=55 C=107 60 C=107 {$T RUN} RUN
In the above example, immediately after the file is downloaded, the RUN command is encountered and executed.
Publication 1746-PM001A-US-P
6-6 Writing Programs Using the BASIC Development Language
Line Number
The Line Number directive allows you to specify a starting line number to be used by the translator when it assigns line numbers to each program line. The line number can be any number between the values of 1 and 65535.
Line Number directives can be placed anywhere in the program. The line following the directive begins with the new number.
Syntax:
{$N [linenumber]}
Example: Before translation: After translation:
REM LINE NUMBERING 0 REM ... {$N 500} 10 REM LINE NUMBERING IF A>C THEN GOTO GET_C_VALUE 500 IF A>C THEN GOTO 800 A=55 510 A=55 {$L GET_C_VALUE} 800 C=107 {$N 800} C=107
Increment
The Increment directive allows you to specify a numeric value to be used as an increment between line numbers. The translator uses this increment when it assigns line numbers during translation. The number must be between the values of 1 and 100.
This directive can be used throughout the program as often as needed. The line number immediately following this directive is numbered according to the previous increment. Any lines after that are numbered according to the new increment.
Publication 1746-PM001A-US-P
Syntax:
{$S [number]}
Example: Before translation: After translation:
REM INCREMENT LINES BY 5’S 0 REM ... {$S 5} 10 REM INCREMENT LINES BY 5’S IF A>C THEN GOTO GET_C_VALUE 20 IF A>C THEN GOTO 35 A=55 25 A=55 REM INCREMENT LINES BY 10’S 30 REM INCREMENT LINES By 10’S {$S 10} 35 C=107 {$L GET_C_VALUE} 45 END C=107 END
Writing Programs Using the BASIC Development Language 6-7
Breakpoint
The Breakpoint directive inserts a STOP statement into the program when it is translated. The STOP statement is inserted only if the Debug directive is turned on {$D+}. When downloaded to the module and executed, program execution halts when the STOP is encountered. Entering the command CONT (for CONTinue) resumes execution from where it stopped.
Breakpoints can be used as debugging aids or to allow you to display or modify variables.
Syntax:
{$B}
Example: Refer to the example for Debug.
Debug on Debug off
When the Debug directive is programmed on {$D+}, STOP statements are inserted at all the Breakpoints {$B} during program translation. {$D+} inserted anywhere in the program turns Debug on until {$D–} is encountered. The default is for Debug to be turned off {$D–}.
IMPORTANT
Syntax:
{$D–} to turn debug off
{$D+} to turn debug on
The Debug directive is not related to the Terminal mode debugger in any way. In fact, if you use the Terminal mode debugger (described in Chapter 9), you should not use the Debug directive or the Breakpoint directive. The Debug and Breakpoint directives are useful for debugging programs from Terminal mode without using the Terminal mode debugger.
Example: Before translation: After translation:
REM DEBUGGING 0 REM ... {$B} 10 REM DEBUGGING {$D+} 20 IF A>C THEN GOTO 50 IF A>C THEN GOTO GET_C_VALUE 30 STOP {$B} 40 A=55 A=55 50 STOP {$L GET_C_VALUE} 60 C=107 {$B} C=107
In the preceding example, the first breakpoint is not translated to a STOP. This is because Debug has not been turned on at that point.
Publication 1746-PM001A-US-P
6-8 Writing Programs Using the BASIC Development Language

Macros

There are three types of macros used with the BASIC Development Software. They are:
keystroke macros  temporarily or permanently record a series of keystrokes
and replace them with a single keystroke. Keystroke macros are described in Chapter 4.
programming macros streamline programming and make your programs
more readable and understandable. The BASIC Development Software comes with a file called
INCLUDE.BDL, which contains close to 100 programming
macros. These programming macros are listed and described in detail in Appendix A. The 1771-DB/B backplane calls are in the INCLUDBB.BDL file. These backplane calls are listed and described in detail in Appendix A.
Beginning a program with the statement any of them by simply typing in its macro call, such as
{$I INCLUDE.BDL} allows you to use
foreground_green().
When your program is translated, the 1747–PBASE Translator goes to the INCLUDE.BDL file to find the BASIC subroutine that corresponds to that macro call.
user-created programming macros support your programming needs.
While the programming macros described above already exist in the BASIC Development Software, these are created by you. They are created using a
$MACRO translator directive described in the next section.

Creating Your Own Programming Macro

The Macro directive is a translator directive that allows the user to define BASIC statements as a macro that can be used in the program.
A programming macro must be defined before it can be called, or else a syntax error results. The maximum number and size of macros defined in a source file is limited only by the amount of memory available on your personal computer at translation time. Programming macros cannot be nested.
Labels can be defined and used within a macro; however, these labels can be referenced only from within the body of the macro. The translator assigns a unique line number for each label in the macro when the program is translated.
The macro call is a string of up to 30 ASCII characters. The character set is defined to be [0..9, A..Z, a..z,_]. The macro call cannot contain any tabs or spaces, and must begin with a letter.
Syntax:
{$ENDM}
{$MACRO [macrocall(%1,%2...%n)]}
The variables %1, %2... above refer to parameter values that are passed to the programming macro. The maximum number of passed parameters, %n, is limited to 20. The
{$ENDM} directive marks the end of the macro definition.
Publication 1746-PM001A-US-P
Writing Programs Using the BASIC Development Language 6-9
Example:
A programming macro is written to set the wall clock’s day, month, and year. The macro is named Setdate and is defined by the BASIC lines between and
{$ENDM}. After the programming macro is defined, it can be called again any
{$MACRO...}
number of times, anywhere in that program, by simply programming the name Setdate.
Example: Before translation: After translation:
REM CREATE PROGRAM MACRO 0 REM ... {$MACRO Setdate(%1, %2, %3)} 1O REM CREATE PROGRAM MACRO PUSH %1 20 D=16 PUSH %2 30 M=06 PUSH %3 40 Y=90 CALL 41 50 PUSH D {$ENDM} 60 PUSH M D=16 70 PUSH Y M=06 80 CALL 41 Y=90 Setdate(D,M,Y)

Bringing in Programs from Separate Files

If you have a large number of your own programming macros or a number of them that you use frequently, you may wish to create a file containing only those macros. You could then include that file in all of your programs. For example, if you made a programming macro file named programs with the command
mine.bdl, you could then begin all of your
{$I Mine.bdl}. This would include that file
during translation and allow you to use your programming macros throughout the program.
Depending on the circumstances, you may want to access other programs from your program, or you may wish to copy other programs directly into your program. There are several methods for accomplishing this.
When choosing between accessing a program as a subprogram or inserting it into your main program, consider the following:
the size of the program you wish to access or insert
the frequency with which you need to execute it from your main program
whether it is or may be used as a subprogram for other programs
whether inserting it makes your main program unmanageably large
IMPORTANT
If you are unable to merge or edit files, those files have probably been locked. Files can be locked (made read-only) or unlocked through the
Information about current file option from
the File menu.
Publication 1746-PM001A-US-P
6-10 Writing Programs Using the BASIC Development Language
Subprogram CALL 70, CALL 71
In a main program, the BASIC commands CALL 70 and CALL 71 cause execution to branch to a subprogram. The subprogram must have been previously stored in the memory module of the BASIC or BASIC-T module. Execution can be returned to the main program with a CALL 72. Refer to the BASIC Language
Reference Manual (publication number 1746-RM001A-US-P) or the SLC 500™ BASIC and BASIC-T Module User Manual (publication number
1746-UM004A-US-P).
IMPORTANT
The BASIC and BASIC-T modules do not distinguish between subprogram variables and main program variables. If a variable used in the main program is changed in a subprogram, the main program is affected.
Programming Macros
Appendix A describes the programming macros contained in the BASIC Development Software. Programming macros are BASIC subroutines that can be used through the BASIC development language. You can also create your own programming macros using the $Macro translator directive described in this chapter.
Merging a Program File
There are two ways to merge program files: the $Include translator directive and
Merge file from disk option available from the File menu. $Include can
the be used only with BASIC development language programs and is described in this chapter in the translator directives section.
Merge file from disk can be used with any program file. It prompts you for a
filename and then merges that file into your program at the current cursor location.
Publication 1746-PM001A-US-P
IMPORTANT
If you merge two .BAS files with any identical line numbers, the duplicate line numbers remain until you download the file to the module. At that time, if there is more than one line of the same number, the last line downloaded replaces any preceding lines with that number. This is not a problem with .BDL files, since line numbering is not allowed.
Writing Programs Using the BASIC Development Language 6-11

Creating a Second Program

In Chapter 2, you created a simple program. Following is a more complex program to illustrate many of the programming features described. It includes using programming macros, labels, and line-draw.
After you type in this BASIC development language program, translating, downloading, and executing it on your BASIC or BASIC-T module is briefly described.
Saving a file with a .BDL extension before you begin working on it causes the attributes for that extension to be used while you edit. Features such as indent style, tab spacing, right margin, word wrap, and language type are established for you.
Entering the Program
1. Pull down the File menu.
2. Select
3. Type:
4. Press [Enter], or move the mouse cursor to OK<ENTER> and click the left mouse
save file As. The SAVE FILE AS dialog box appears on the screen.
SECOND.BDL
button. The
C:\ABBASIC\BAS\SECOND.BDL Saved appears in the message line.
SAVE FILE AS dialog box disappears, and the message
5. Type the first two lines of the Second program:
REM SECOND PROGRAM {will print screen below, then check operator number}
Note that they are comments because they are enclosed in {}. Remember, comments are not translated. If you want these lines in the translated BASIC file, use
REM instead of {}. We have indented all comments in this example
by five spaces to make them stand out.
6. Type
{$I Include.bdl}
{$I Include.bdl} is not a comment because the { is followed immediately
by a
$. $I is the include translator directive requesting that a separate file
Include.bdl in this case) be included during translation. Include.bdl is the
( file available with the BASIC Development Software that contains programming macros. As you become more familiar with the BASIC Development Software, you may wish to create your own file,
mine.bdl for
example, that contains your own programming macros. You could then include it during translation by beginning your program with the command
{$I Mine.bdl}.
Publication 1746-PM001A-US-P
6-12 Writing Programs Using the BASIC Development Language
7. Type the screen setup comment and the screen commands that follow it. Note that these commands are programming macros. See Appendix A of this manual.
{screen setup} background_Black( ) High_Intensity ( ) foreground_Yellow ( ) cls()
8. Type the print statements comment and the first print command. Print commands can be abbreviated as entered. A print command on a line by itself results in a blank line being printed.
{print statements} print
You are now ready to enter the print commands that cause a boxed-in message to appear on the screen when this program is run. Since you are using the line-draw feature here, it is best to first enter the text and then draw the lines in afterwards. Line drawing is performed in Overstrike mode only, so be sure that you have spaces and not text wherever you expect to draw a line.
P. or the full command PRINT can be
9. Type the print statements as shown except for the lines. Leave spaces where you expect to draw a line.
P.tab(10),” “ P.tab(10),” WARNING “ P.tab(10),” Use of this machine is restricted “ P.tab(10),”
10. When you are ready to draw the box, pull down the Other menu and select
Linedraw.
11. Position the cursor to a corner of the box by using the arrow keys. Line drawing does not begin until you hold [ keys. Press [
F2] to go into Double line mode. Press it again to go into Erase
Shift] while moving with the arrow
mode (to erase lines), and press it again to go back to Single line mode.
12. Press and hold [
Shift] while you move with the arrow keys to create the box.
Note that when you make a corner or intersection, the correct line characters are exchanged for the straight line. If you make a mistake, press [
F2] to get to
Erase mode; and then move over the unwanted line with the arrow keys while holding [
13. When you have completed the box, press [
Shift].
ESC] to exit Line-draw mode.
Publication 1746-PM001A-US-P
Writing Programs Using the BASIC Development Language 6-13
14. Continue typing in the rest of the program as shown:
hit_any_key( ) {pause and wait for keystroke} cls() {$L loop1} Print “Enter your Operator Number” {pause and wait for input} get_key (op) {check for input of 49 or 50 which are ASCII decimal for 1or2} if op=49 then goto op1setup if op=50 then goto op2setup {print error and loop back for another entry} cls() print “Invalid Entry . . Operator number not recognized” goto loop1 {$L op1setup} get_time (d1,m1,y1) {setup for operator #1} goto acknowledge {$L op2setup} get_time (d2,m2,y2) {setup for operator #2} {$L acknowledge} cls() cursor_down(11) print_time ( ) print “Operator #”,op-48.” acknowledged” end
Tra nsl at ing
Since this example is written using the BASIC development language, it must be translated to the BASIC Language prior to downloading to the module. Do this by selecting Translate/Compile from the Other menu, and then selecting 1747-PBASE Translator. The program on the following page is the previous program after it is translated.
Publication 1746-PM001A-US-P
6-14 Writing Programs Using the BASIC Development Language
Figure 6.1
0 REM... 10 REM SECOND PROGRAM 20 P. CHR(27),”[40M”, 30 P. CHR(27),”[1M”, 40 P. CHR(27),”[33M”, 50 P. CHR(27),”[2J”, 60 P. 70 P. TAB(10),” “ 80 P. TAB(10),” WARNING “ 90 P. TAB(10),” Use of this machine is restricted “ 100 P. TAB(10),” “ 110 P. 120 P. “Hit any key to continue . . .”, 130 If (EOF) THEN GOTO 130 140 PUSH A 150 A=GET 160 POP A 170 P. 180 P. CHR(27),”[2J”, 190 P. “Enter your Operator Number” 200 IF (EOF) THEN GOTO 200 210 OP=GET 220 IF OP=49 THEN GOTO 270 230 IF OP=50 THEN GOTO 320 240 P. CHR(27), “[2J”, 250 P. “Invalid Entry . . Operator number not recognized” 260 GOTO 190 270 CALL 46 280 POP D1 290 POP M1 300 POP Y1 310 GOTO 360 320 CALL 46 330 POP D2 340 POP M2 350 POP Y2 360 P. CHR(27),”[2J”, 370 P. CHR(27),”[11B”, 380 PUSH A 390 CALL 46 400 POP A 410 P. A,”:”, 420 POP A 430 P. A,”:”, 440 POP A 450 P. A,” “, 460 POP A 470 P. “Operator #”, OP-48,” acknowledged” 480 END
Second Program, After Translation (SECOND.BAS)
Publication 1746-PM001A-US-P
If you do not have any errors, the message BASIC translator Version x.xx appears in the message line after the translation is complete. If you have errors, correct them and translate the program again. For details on translating programs and finding translation errors refer to Chapter 8.
Writing Programs Using the BASIC Development Language 6-15
Downloading
Downloading a file requires that you connect your personal computer to the module using the configurations described in the SLC 500 BASIC and BASIC-T Modules User Manual (publication number 1746-UM004A-US-P). Module jumpers should be set to support that configuration per the SLC 500™ BASIC and BASIC-T Modules User Manual (publication number 1746-UM004A-US-P).
Before downloading, you also must select the correct terminal type through the Configuration menu (described in Chapter 3) and set up the terminal through the Setup menu (available when in Terminal mode). For complete details on terminal setup and downloading, refer to Chapter 9.
Assuming this is done and your configuration is correct, use the following steps to download a file:
1. Select
Terminal mode from either the Other menu or from the Toplevel
menu.
2. Select the File menu while in Terminal mode.
3. Select
4. If
Download from host to module.
second.bdl was the last file you translated, its translated version
(
second.bas) is the default file for the download and you need only press
[Enter]. Otherwise, type in the name of the file you wish to download, in
our case
second.bas. Remember that you must download a translated file,
meaning it has an extension of .BAS.
Executing
After you have successfully downloaded a file to the module, execute it by typing
RUN to the right of >. To exit the program press [F3]. You can interrupt execution
by pressing [ programming. Chapter 9 of this manual describes how to debug a program on the BASIC or BASIC-T module.
Ctrl C], unless this interrupt feature has been disabled through
Publication 1746-PM001A-US-P
6-16 Writing Programs Using the BASIC Development Language
Publication 1746-PM001A-US-P
Chapter
7

Printing Your Program

This chapter describes how to set up a printer and print a program. Major topics include:
selecting and setting up a printer
using the printer controls
printing all or part of a document

Setting Up Your Printer

The Print menu, accessed from the main menu, is used both to set up the printer and to control the printing of a file. Most of the discussion in this chapter involves features selected from this menu.
Path: Toplevel Menu →→→ Edit mode →→→→ Print QuickStroke: none
Figure 7.1 Print Menu
L:3 C:1 1747-PBASE V x.xx [Text Edit] Ins 175k 06-12-91 1:15pm
File Window Block cUrsor Search Text Layout Print Macro Config Other Exit +-------------PRINT-------------+ +=+A+=======================================|print current File |==+ |>> EOF << |(print marked Block) | | | |-------------------------------| | | |printer Setup... | | | |printer Type...IBM | | | |printer Device/file...LPT1 | | | |-------------------------------| | | |Copies to print...1 | | | |Line numbering Off | | | |print Margin...1 | | | |eject Page | | | +----------Cancel<ESC>----------+ | | | | | | | | | | |
+-------------------------------------------------------------------------------+
1 Help 2 3 4 5 6 7 8 9 0
1 Publication 1746-PM001A-US-P
7-2 Printing Your Program
Printer Selection
The BASIC Development Software has printer setup parameters already defined for a number of common printers. Also, the software is designed with enough flexibility to accommodate almost any printer. Printer setup begins by selecting a printer.
Path: Toplevel Menu →→→ Configuration menu →→→→ Printer Path: Main Menu →→→ Config →→→→ Printer Path: Main Menu →→→ Print →→→→ Printer type
Figure 7.2 Printer Selection
L:3 C:1 1747-PBASE V x.xx [Text Edit] Ins 175k 06-12-91 1:15pm File Window Block cUrsor Search Text Layout Print Macro Config Other Exit
+-------------PRINT-------------+ +=+A+=======================================|print current File |==+ |>> EOF << |(print marked Block) | | | |-------------------------------| | | |printer Setup... | | | |printer Type...IBM | | | | +-----SELECT A PRINTER TYPE----+| | | | Create<Ins> Delete<Del> || | | | Copy<F4> Edit<F3> || | | |+-----------------------------+|| | | | IBM || | | | OKIDATA || | |_| C.ITOH || | | EPSON || | | TOSHIBA || | | NEC || | | HP Laserjet II || | | NONE || | | || | |OK<ENTER> Cancel<ESC> Help<F1> || | +===============================+| +-------------------------------------------------------------------------------+
LIST BOX: Next field<TAB>, Previous<ShftTAB>,
↑↓<PgUp><PhDn><Home><End>
Publication 1746-PM001A-US-P
Select your printer from the list provided. If it is not on the list, you can select
Create<Ins> to access the PRINTER DRIVER SETUP screen where you can assign it
a name, initialization string, and print control codes.
If your printer is on the list provided and does not function properly or as you would like it to (possibly from being an older model with slightly different control codes), you can select
IMPORTANT
Edit<F3> to modify the control codes.
Pressing
[Enter] after making changes to the PRINTER DRIVER
SETUP screen saves those changes. If you have made changes that
you do not want to save or if you just want to leave the
DRIVER SETUP
screen, press [Esc.].
PRINTER
Printing Your Program 7-3
Following is a description of the parameters that you can create or modify on the
PRINTER DRIVER SETUP screen. Refer to the help screens for a more details.
printer Type is entered if you are creating a new printer driver setup
Initialization string is entered to initialize your printer (refer to the
documentation provided with the printer)
You can define up to 19 different printer codes for each printer. Each printer code has the following definable fields:
Code name is a string for the user’s benefit to identify the printer code. It
can be up to 17 characters. For example, you may want to use the names of the fonts which correspond to each code. The string you enter here appears on the printer setup screen.
Printer control code is the actual string of characters you wish to send
to the printer. This would normally be an escape sequence to initiate a particular action by the printer, such as changing font styles or line spacing; but is not restricted to that.
Printer Setup
Path: Main Menu →→→ Print →→→→ printer Setup QuickStroke: none
When you select printer Setup, a menu of printer-specific control codes is displayed. These codes originate in the PRINTER DRIVER SETUP screen (described in the previous section).
Typically, these printer codes determine things like letter quality, font, and line spacing. Printer codes differ depending on the printer. Move the cursor to highlight the desired printer code, and press
[Enter] or click the left mouse button.
Printer Device/File
Path: Main Menu →→→ Print →→→→ printer Device/file QuickStroke: none
When you select printer Device/file, you get a screen from which you can select a printer device or file to direct your print output to. These device names can be edited, or additional devices can be created as needed.
Typically, you select either a filename or a printer port here. If you select a filename, print–data is sent to that file. If you select a port, print-data is sent directly to the printer connected to that port.
Most printers communicate with a personal computer through its parallel communications port (typically LPT1).
Publication 1746-PM001A-US-P
7-4 Printing Your Program
Serial Printers
Some printers use serial communications, and some are equipped for both serial and parallel. This section deals exclusively with serial printer configuration.
The BASIC Development Software supports both parallel and serial printers. The port set-up of your personal computer determines which port on your personal computer is the printer output port. Refer to the documentation provided with your personal computer and printer for additional information on port set-up.
IMPORTANT
The following examples use COM2 as the serial printer port. Make sure the port you specify as the serial printer port is not already being used as the mouse port or as the interface port to the BASIC or BASIC-T module.
When printing to a serial printer, you must match the baud rate, parity, number of data bits, and the number of stop bits of your serial port to the corresponding parameters of your printer. One way of doing this is by using the DOS Mode command. For example:
mode COM2:9600,n,8,1
You can then use the DOS Mode command again to redirect printer output from the LPT1 port to one of your serial communication ports. For example:
mode LPT1:=COM2:
If you do not want to redirect printer output, you can add a serial printer device to the Print menu.
Path: Toplevel Menu →→→ Edit mode →→→→ Print QuickStroke: none
To specify a new printer device:
Publication 1746-PM001A-US-P
1. Select
2. Select
printer Device/file to access the PRINTER DEVICE dialog box.
Create<Ins> to enter a new printer device.
3. Enter the name of the serial communication port on your personal computer that is to be the printer port, then press
For this example, you would type in:
[Enter].
COM2
The PRINTER DEVICE dialog box is displayed with the communication port name you entered and is added to the top of the list of printer devices.
4. Highlight the port you named as the serial printer port and press
[Enter].
All printer output is sent to the serial port you specified.
Printing Your Program 7-5

Using the Printer Controls

We have already discussed printer setup; but before we actually print a file, this section explains the various printer controls available from the BASIC Development Software. Remember that Hypertext help is available with more details.
Copies to Print
Path: Main Menu →→→ Print →→→→ Copies to print QuickStroke: none
This allows you to print multiple copies of a file or block. The default value is one.
Line Numbering
Path: Main Menu →→→ Print →→→→ Line numbering QuickStroke: none
This adds line numbers to the left hand side of your printout. These are not BASIC line numbers but simply print line numbers beginning with the number one.
Print Margin
Path: Main Menu →→→ Print →→→→ print Margin QuickStroke: none
This allows you to define a left margin for printing only (in addition to any margin or tab already defined in the file). The default value is one.
Eject Page
Path: Main Menu →→→ Print →→→→ eject Page QuickStroke: none
This causes the printer to scroll forward one page.
Publication 1746-PM001A-US-P
7-6 Printing Your Program

Printing All or Part of a Document

The Print menu, accessed from the main menu, allows you to print a block or file directly from a window.
Path: Main Menu →→→ Print →→→→ print current File QuickStroke: none
Following is a brief explanation of the two print options available from the Print menu. Remember that Hypertext help is available with more details.
Print current file prints all of the file in the currently active window.
To abort printing at any time press
print marked Block prints the currently marked block. This allows you
to print a portion of a file instead of the entire file. Refer to the block operations discussion in Chapter 4 for information on the three block marking methods.
There are other print options available by using the DOS shell. Refer to your DOS manual for details.
[Esc].
Printing In Background
This requires that the DOS print spooler, PRINT.COM, be loaded prior to running the BASIC Development Software. Also, there must be a path to where the PRINT.COM file resides. Printing in the background is possible by:
1. Printing the file to disk.
2. Selecting it through the DOS directory shell (discussed in Appendix B).
3. Pressing
[F8].
Publication 1746-PM001A-US-P

Translating Your Program

When you have completed this chapter, you will know how to:
translate your program
locate and correct programming errors
configure your translator
Chapter
8

Translating Feature

The translate/compile feature available with the BASIC Development Software is executed based on the extension portion of a filename. Refer to Chapter 3 for details on setting up filename extensions. For proper program translation, the following file extensions must be used:
Table 8.1 Filename Extensions
File Extension Description
name.BDL This is your source file you have written in the BASIC development
language. This is the file you should be translating.
name.BAS This is the BASIC file created by the 1747-PBASE Translator. This file is
the file you download to the BASIC module.
name.MAP This file is generated by the 1747-PBASE Translator. It is used for
tracking variables when executing the development software debugger discussed in chapter 9.
IMPORTANT
Before performing a translate/compile operation on a program, load the file into an edit window. If it already has been loaded, verify that the window is the currently active window. Once this is accomplished, translate/compile your program by using one of the following paths:
The 1747-PBASE Translator file extensions and cannot be reconfigured.
(BTRAN.EXE) works only with these
Path: Toplevel Menu →→→ Translate/compile Path: Toplevel Menu →→→ Edit mode →→→→ Other →→→→ Translate/compile QuickStroke: Toplevel Menu →→→ Edit mode →→→→ [CTRL F8]
1 Publication 1746-PM001A-US-P
8-2 Translating Your Program
The software checks the extension of the file in the active edit window and prompts you to select a translator/compiler.
IMPORTANT
The 1747-PBASE Translator expects your filename to have a .BDL extension. If it does not, you get an error.
The file in the active edit window is always saved prior to translating. Other open, altered files may be saved if the translator is configured to save all files as discussed in the last section of this chapter.
Once selected, the translator/compiler translates the source code you have written in the BASIC Development Language into BASIC. The translator:
removes comments
adds BASIC line numbers
replaces labels with line numbers
brings in include files
expands programming macros
checks for syntax errors
For example, the translator will accomplish these tasks in the following program:
Figure 8.1 Second Program, Before Translation (SECOND.BDL)
REM SECOND PROGRAM {will print screen below, then check operator number} {$I Include.bdl} {screen setup} background_Black( ) High_Intensity ( ) foreground_Yellow ( ) cls() {print statements} print P.tab(10),” “ P.tab(10),”WARNING “ P.tab(10),”Use of this machine is restricted“ P.tab(10),” “ hit_any_key( ) {pause and wait for keystroke} cls() {$L loop1} Print “Enter your Operator Number” {pause and wait for input} get_key (op) {check for input of 49 or 50 which are ASCII decimal for 1 or 2} if op=49 then goto op1setup if op=50 then goto op2setup {print error and loop back for another entry} cls() print “Invalid Entry..Operator number not recognized” goto loop1 {$L op1setup}
Publication 1746-PM001A-US-P
Translating Your Program 8-3
get_time (d1,m1,y1) {setup for operator #1} goto acknowledge {$L op2setup} get_time (d2,m2,y2) {setup for operator #2} {$L acknowledge} cls() cursor_down(11) print_time ( ) print “Operator #”,op-48.” acknowledged” end
If no syntax errors are encountered during the translation, the translator creates a native BASIC program (with the .BAS extension) ready for downloading to the module:
Figure 8.2 Second Program, After Translation (SECOND.BAS)
0 REM... 10 REM SECOND PROGRAM 20 P. CHR(27),”[40M”, 30 P. CHR(27),”[1M”, 40 P. CHR(27),”[33M”, 50 P. CHR(27),”[2J”, 60 P. 70 P. TAB(10),” “ 80 P. TAB(10),” WARNING “ 90 P. TAB(10),” Use of this machine is restricted “ 100 P. TAB(10),” “ 110 P. 120 P. “Hit any key to continue...”, 130 If (EOF) THEN GOTO 130 140 PUSH A 150 A=GET 160 POP A 170 P. 180 P. CHR(27),”[2J”, 190 P. “Enter your Operator Number” 200 IF (EOF) THEN GOTO 200 210 OP=GET 220 IF OP=49 THEN GOTO 270 230 IF OP=50 THEN GOTO 320 240 P. CHR(27), “[2J”, 250 P. “Invalid Entry . . Operator number not recognized” 260 GOTO 190 270 CALL 46 280 POP D1 290 POP M1 300 POP Y1 310 GOTO 360 320 CALL 46 330 POP D2 340 POP M2 350 POP Y2 360 P. CHR(27),”[2J”, 370 P. CHR(27),”[11B”, 380 PUSH A
Publication 1746-PM001A-US-P
8-4 Translating Your Program
390 CALL 46 400 POP A 410 P. A,”:”, 420 POP A 430 P. A,”:”, 440 POP A 450 P. A,” “, 460 POP A 470 P. “Operator #”, OP-48,” acknowledged” 480 END
It also creates a .MAP file for use when executing the debugger discussed in Chapter 9.
If the translator/compiler encounters any errors in your .BDL file, it aborts the translation and tags these errors for you to correct. When translator errors are found, you must correct them as discussed in the following section before continuing.

Eliminating Translator Errors

If the translator encounters errors when it translates your .BDL file, the translate operation is halted, and the error window is created. The error window contains a listing of all the errors that were generated and the corresponding program line number.
If an error is found in an include file during translation, another window is opened containing that include file. The cursor is placed at the error location in that file.
Find Next Compiler Error
This feature locates the next error in the source file window generated by the most recent compile. If you are not currently on the source file window, you are bumped to that window when the
Path: Toplevel Menu →→→ Edit mode →→→→ Other →→→→ find neXt error QuickStroke: Toplevel Menu →→→ Edit mode →→→→ [Ctrl F2]
When the find neXt error option is selected, the cursor is positioned on the line that caused the translator error; and a brief description of the error is shown on the message line.
find neXt error option is selected.

Translator Configuration

Publication 1746-PM001A-US-P
The configuration for the 1747-PBASE Translator converts .BDL files to .BAS files. The translator configuration can be altered through the COMPILER/ PROGRAM SETUP dialog box, accessed through the following path:
Path: Toplevel Menu →→→ Configuration menu →→→→ Filename extensions →→→→ BDL →→→→ Compiler–Program setup →→→→ 1747-PBASE Translator
Figure 8.3 Compiler Program Setup Dialog Box
L:3 C:1 1747-PBASE V x.xx [Text Edit] Ins 175k 06-12-91 1:15pm
File Window Block cUrsor Search Text Layout Print Macro Config Other Exit +------SETUP AND CONFI+------EXTENSION SETUP---------+ +|DOS=3.30 CPU=80386 | Create<Ins> Delete<Del> |=============?No-File?==+ ||Video Card = VGA Colo+±±±COMPILER/PROGRAM SETUP±±±±+ | ||PBASE Path = C:\ABBAS | Create<Ins> Delete<Del> | | ||Exp+--------------------COMPILER/PROGRAM SETUP------------------------+ | ||Ser| Description: 1747±PBASE Translator
||±±±| Command line: BTRAN <FILE> /I\ABBASIC\BAS................ | |
||Edi| Program type: [1747±PBASE ] | | ||Dis| Memory required in k bytes(0=all): 0 | | ||Mou| | | ||Fil| Swap method: Options: | |
||Pri| (
||sWa| ( ) No swap [X] Save all files | | ||Bak| ( ) To disk only [ ] Reload file | | ||Sea| ( ) To EMS only [ ] Do NOT process compiler errors | | ||Ter| ( ) To EMS then to disk | | ||saV| | |
|| | |+===+==================================================================+ |
| | +-------------------------------------------------------------------------------+
.) Use default [ ] Clear screen | |
OK<ENTER> Cancel<ESC> Help<F1> | |
STRING INPUT: Next field<TAB>, Previous<ShftTAB>, History list <
Translating Your Program 8-5
| |
>
Publication 1746-PM001A-US-P
8-6 Translating Your Program
The following table lists the translator configuration options available through the COMPILER/PROGRAM SETUP dialog box. Included are descriptions specific to the 1747-PBASE Translator.
Table 8.2 Translator Configuration Options
Options Description
Command line This allows you to select different parameters for the translator call.
The default command line is BTRAN <FILE> /I\ABBASIC\BAS. The options for this line are BTRAN filename[.ext] [/Ipath] [/Tpath] where: .ext - is replaced with .BDL Ipath - is the path where your include files are located. It is your current working directory if omitted here. Tpath - is the path where the translator puts the translated BASIC file. It will be put in the same directory as the source file if omitted here. The following example would translate the file in the current working directory using include files from a directory called INCLUDE in the D: drive. The translated file would be saved on the A: drive: BTRAN <FILE> /ID:\INCLUDE /TA:
Program type This allows you to select a program or compiler type for each compiler–
program interface.
Memory required Enter the amount of memory required for your compiler in k bytes
(0=all). When used in conjunction with swap method, this parameter helps determine how much memory swapping is necessary.
Swap method The options here determine the location where memory swaps take
place when they are necessary. They are affected by the amount entered under memory required. Use default should normally be selected for this. Options are: Use default - selecting this causes the swap method selected when configuring Swapping/expanded memory to be used. No swap - no additional memory is freed before invoking the compiler/ program. To disk only - causes swapping the software out to disk whenever invoking the compiler/program. Use this if you need additional memory space but do not have expanded memory in your personal computer. To EMS only - causes swapping the software to expanded memory whenever invoking the compiler/program. To EMS then to disk - causes all available expanded memory to be used before any swapping to disk takes place.
Options This includes a number of miscellaneous options as follows:
Clear screen - clears the BASIC Development Software from the screen during a translate/compile. This allows you to watch for errors in the compile at the DOS level. This should normally not be selected (off). Save all files - When (on), this forces all files that are currently open and have been altered to be saved before the translator is executed. When (off), only the file in the currently active window will be saved before the translator is executed. Reload file - This reloads the file just compiled into the current window. This is useful if your compiler alters the original file in some way. This should normally not be selected (off). Do NOT process compiler errors - If this option is selected, then compiler errors are not processed. This should normally not be selected (off).
Publication 1746-PM001A-US-P
Loading...