138 of 208
ZBasic Language Reference 130 ZX Microcontroller Family The “Load Files…” menu entry is for loading constituent project files into the editor. The resulting dialog presents a list of files that are currently part of the project and you may select one or more from the list to load into the editor. Of course, you may also load files into the editor at any time using the “Open” entry on the File menu. The “Compile” entry on the project menu will invoke the ZBasic compiler instructing it to process the project file. Any error messages and warnings issued by the compiler will appear in the Output window and the editor cursor will be positioned automatically to the first error or warning. After addressing the problem you can move to the next error using the F4 key or by selecting the “Next Message” entry on the Tools menu. Once the project compiles without errors, you may download the resulting .zxb file by choosing the “Go” entry from the Project menu. The list on the bottom of the Project menu will contain up to 10 recently used projects. The project currently loaded will have a checkmark beside it on that list. If you wish to have your project compiled with certain compiler command line options you may manually add those options to the project file. For example, if you wanted to enable warnings about unused parameters you might add the following line to your project file: --warn=unused-param Generally speaking, you’ll want to add such lines at the top of the project file so that they will be in effect for all of the subsequently listed files. See Section 8.2 for more information on compiler options. 7.3 Compiling and Downloading Individual Files In addition to being able to compile an entire project, the IDE can compile an individual file. If the currently selected document is a .bas file, you may compile that file by using the “Compile” entry on the Tools menu. This method is suitable for small programs that exist in a single file; it’s not necessary to create a project for such a simple application. If the compiler detects any errors, they will be displayed in the Output window that appears near the bottom of the main application window. Note that the first error or warning message will automatically be selected and the cursor will be positioned automatically to the offending line. After you rectify the error, you can quickly move to the next error or warning by pressing the F4 key or by selecting the “Next Message” entry on the Tools menu. When the file compiles without errors, a download file will have been created in the same directory as the source file but having a .zxb extension. To download this file to the ZX, select the “Go” entry from the Tools menu. It is important to note that the “Go” entry on the Tools menu will attempt to download a file having the same name as the current document but with a .zxb extension. You may also download a previously compiled file at any time using the “Download…” entry on the File menu. 7.4 Setting Serial Port Options By default, the serial port used for communicating with the ZX is COM1. The serial port to use may be changed by using the “Serial Port Options…” entry on the Options menu. The combo box on the resulting dialog will contain entries for all of the recognized serial ports on your system The serial port options dialog has other options that you may wish to modify as well including whether or not a verification pass is performed after the download. All of the options configurable via the serial port options dialog are stored in the User Options File. You may load this file into the editor using the “Open User Options File” entry on the Options menu.