Professional Documents
Culture Documents
for the
SYSTEM51
Release 20000111.
P A R T I , The IDE
1. INTRODUCTION. 1
1.1 Installation. 3
2. TUTORIALS. 7
4. EDITOR 22
i
4.3 Moving around in the editor screen. 26
8. EMULATORS. 72
iii
P A R T I I, The PAS51 Language
14.2 Variables. 96
14.2.1 Predefined variables. 97
14.2.2 Absolute placed Variables. 97
15.1 Assignment. 99
iv
15.6 The WITH statement. 110
vii
viii
SYSTEM51 1
________________________________________________________
P A R T I , The SYSTEM51.
1. Introduction.
The high level language PAS51W, supplied with the system, contains
an almost complete implementation of Pascal by Wirth with a few
exceptions and several additions to make it compatible with Borland
Delphi and Pascal version 7.0 and also several additions especially
suited for the INTEL 8051 microcontroller used in embedded systems.
You may for instance directly access all the special registers, ports,
interrupt services and bits of the chip by their INTEL-defined names.
The PAS51W compiler is a 1-pass compiler (on the source level) which
may directly generate
When using the simulator or the DEBUG51, you will see the
corresponding high level source in a window, and you will be able to
modify and examine memory, and register and flag values and to step
on HLL statements.
PAS51 3
________________________________________________________
1.1 Installation.
The system(s) are delivered to you on two or more diskettes. Most of the
content is packed. To install the software, you must have 1) Microsoft
Windows 95 or later installed on your computer, 1) the necessary
diskette(s) available, 3) necessary free space available on your harddisk
(about 2mbytes depending on the configuration, and 4) the installation
company name and corresponding control code available.
For installation, please place the (1.) diskette in the A: drive, go to the
Fig. 1
Fig. 2
When fig. 2, inserting company name and serial number shows up, you
must carefully enter the information send to you. Please enter exactly as
stated. The serial number to enter is identical to the control code of the
form 123456-7890. (Your serial number is in fact the number after the
‘-’). Do not try to "improve" or correct spelling errors in company name
and control code. The code is your and our guarantee for no illegal
copying or use of the system.
The system is normally intended for use with the integrated Windows
IDE. However, for your convienience, you have the choice of using the
command line versions of the compiler (PASCAL.EXE), the assembler
(ASM51.EXE) and the linker (LINK51.EXE). You may also use the
simulator (SIM51.EXE) stand alone. However, you can’t move those
programs to other computers without re-installing the full system there.
From the menu bar pull down menus, the speed buttons or by using the
accelerator keys, you can invoke the compiler, the integrated or stand
alone simulator, optionally the debugger, the linker or the assembler,
and you can open or change editing windows or set options.
6 SYSTEM51
________________________________________________________
In the editing window(s), you will be able to enter and/or modify source
texts, or any other texts including the generated .LST, .ASM, and
.MAP files. When the compiler or the assembler meets an error, you
will return to the erroneous point in this window.
2. Tutorials.
In this tutorial, you will try to write on your screen the message "Hello,
SingleChip" 4 times.
You will now see the system picture with a menu and speedbutton bar
above, and an empty area below (if this is the first time you start the
system).
Press the File menu, select ‘Project Main File’ and click on
HELLO.PAS
In an edit window you should see the .PAS program HELLO.PAS. Try
to move a little around in the text using the cursor keys, Home, End,
PgUp, PgDn, ^PgDn (Ctrl key pressed at the same time as PgDn) and
^PgUp.
8 SYSTEM51
________________________________________________________
Now enter Alt-C and a new window, a so called pull down menu will
come down; click the mouse on Make, press M or the cursor down key
and then Enter ; the compiler will be invoked, open a window called
"Messages", but after a while it will discover the error in the source file,
give an error message in the message window, and bring you back
again in the editor with the cursor on xcounter. Press <Del> and the
text will again be while counter< .
Perhaps you saw in the pull down menu that the hot key for making
was F12; therefore press F12. Now the compiler will compile to an end
and the linker will take over. The message
will appear in the messages window. You are back in the main system
menu.
The figure shows the result of the run of the integrated simulator.The
“Messages” window
Instead you could have envoked the stand alone simulator from the
IDE, press Shift-F9.
The simulator screen that comes up, looks very much like the main
screen with a MENU line above,a speed button area and a source text
window.
In the source text window you will see the HELLO.PAS program with
some numbers to the left. Those are program addresses. You will use
those later on.
First we will just try to run the program. Press the function key F9, run.
A run window will pop up, and the output from the program, 4 times
the text "Hello, Singlechip" will appear in that window.
The text "RUNNING" will be shown at the right in buttom field. Press
ESC to return to the "READY" mode.
Bring the variable "counter" into the watch window. This may be done
in the following way: Search for the word counter as in the editor: ^F
counter Enter. Then ^F7. A watch input dialog box with the input line
showing "counter" will come up. The "counter" will come up because
the cursor pointed there. Now type Enter, and the watch contains the
counter variable and its value in decimal and hex notations, together
with its address. As we have already run the program, this value will be
4. Because it is declared as an (16 bit) int, it is shown as 16 bit. To see
both HELLO.PAS and the watch window, press the tile speed button (2
white squares above each other) or Alt W/T, to tile the windows.
Press ^F9, animate. You will see the program stepping while the watch
will be updated.
Perhaps it all happened too fast, so let us use a breakpoint instead. Press
^F2 again.
instead.
Press F9 or , run, 5 times. The first four times, the simulator will
stop at the statement, writeln( will write its message, and the watch will
be updated. The fifth time the simulator will continue as the for
statement is passed. Press ESC to stop running the program.
At the time you compiled the program without errors, several files were
generated: HELLO.OBJ, HELLO.ASM, and HELLO.A51 which are
used by the simulator, as well as the files HELLO.MAP and
HELLO.HEX.
Press Alt-F/P. Select File Type .ASM, HELLO.ASM, and you will open
a new editor window showing the newly generated HELLO.ASM file.
Move a little around in it and study the generated .ASM code mixed
with .PAS statements as comments. Normally, this is the only purpose
of this file.
To activate one of the items in the pull down menus, do one of the
following:
PAS51 13
________________________________________________________
A) Click the menu with the mouse to pull down the menu. Then
click the item with the mouse.
The menu bar is the uppermost line on your screen. You may go there
by pressing F10, clicking the mouse or pressing Alt-the highlighted
letter.
From the menu bar, you may pull down menus for almost any purpose.
To activate an item from a pull down menu, click the item with the
mouse, press the highlighted letter or move the bar up and down with
the cursor keys and then press Enter.
The menu looks like the following when you have an editor window
open:
The name of the project main file will be shown on the system caption
as SYS51W-name.PAS
which from left to right are: Load File, Save, Exit and Print (without
questions)
Undelete will only restore a modified line, if you haven't moved away
from that line.
With the tabbed toolbar, you get available different tools to simplify
your PAS51 programming.
PAS51 17
________________________________________________________
With this menu, you may invoke other parts of this integrated system,
like the compiler, the linker or the assembler
Compile Ctrl+F9
Make F12
Build Ctrl+F12
Make/Run Ctrl+F8
Assemble Ctrl+A
Link Ctrl+L
Compile Ctrl-F9
18 SYSTEM51
________________________________________________________
If you want the whole project compiled and linked, choose Make
or Build.
Make F12.
The conditions for recompilation / linking is that the resulting file type
(.OBJ for compilation, .A51 and .HEX for linking) is older than any of
the source files or the date of the relevant opT)ions settings.
Build
the different files will then be linked; if, however, errors occur,
you will be taken to the point of the first error.
If you are in the IDE, press Ctrl-A. The file Project N)ame.ASM will
then be assembled. If errors occur, you will return to the erroneous
point in the assembler source.
After assembling, you must link your program(s) before running them.
A dialog box will appear when this is selected. A combo-box offers you
some suggestions of linkings, but you may enter your own.
PAS51W files need to be inked with the runtime library files FP51
(only if real or longint is used), PL51 and IODRIVER. In case that you
use the Siemens 80C517 or 80C537, the runtime library files are
FP517, PL517 and IODRIVER, in case you use the small Philips
80C748..80C751, only use PL751.
SYS51CW files need to be linked with the runtime library files FPC51
(only if float or long is used), CL51 and IODRIVER. In case that you
use the Siemens 80C517 or 80C537, the runtime library files are
FPC517, CL517 and IODRIVER. In case of Reentrancy mode 2, the
files are FPCR51, CLR51 and IODRIVER.
20 SYSTEM51
________________________________________________________
There are several different methods the execute and debug your Pascal
program.
2) A stand alone full high and low level simulator may be invoked
from the IDE or from a command line. See chapter 7.
3) A stand alone debugger (optional), full high and low level, may be
invoked from the IDE or from a command line. Described in a
separate manual.
PAS51 21
________________________________________________________
With the help of the setup dialog box, you are able to setup certain
information about your tools for executing and debugging your
programs.
In the text field, named "Name of RUN program", you may select the
name of the program, to which the RUN button and F9 will respond. To
select the integrated simulator as the choosen tool , choose (Integrated
simulator), to select the stand alone simulator, choose SIM51 (stand
alone), to select DEBUG51 as the tool, choose DEBUG51W, and to
select other tools such as a 3. party emulator, write its name in the Run
select box.
In the "Name of emulator" text field, you enter the name of your
debugging or emulating tool, ex. DEBUG51W
Target
With this Combo box, placed on page “Target” in the Options dialog
box, you set the target processor, for which you want to generate code.
If your target isn’t in the list, you may use the SFR2SFB compiler
system to include it.
4. Editor
On this page, you may set different options in the text editing windows.
You may set the width of a tab (default 8), if entering a tab should
generate spaces or a character in the source code (default spaces), if
your editor is in insert or overwrite mode (default insert, shown in the
panel below left).
You may also select if you want your C or Pascal-code shown in online
syntax colours (default on, select which colours and styles for each
lexical type in "syntax").
Autoindent (default on) means that new lines will automatically indent
to the 1. non-blank position in the line above. Improves structured
program entry.
By pressing the Font button, a standard window Font dialog box will
appear. You may change font type and size. We recommend that you
choose a fixed width font like “Courier New”, as this will give the best
results. Do not set font color here.
PAS51 23
________________________________________________________
By pressing the “Syntax Colors” button, a pop-up menu gives you the
choice of selecting colors for different types of tokens:
Normal colors
Reserved words
Identifiers
Comments
Strings
Compiler
On this page, you set different options concerning the compiler(s) that
you use in your system. In the “Current Compiler” combo-box, you may
see the current selected compiler and available ones, you may also set
another one, but normally, you will not get anything out of that, as the
system itself will decide which one from the file extension.
In the Conditional edit box you set default compiler conditionals. In the
Directives edit box, you set default compiler conditionals.
The .ASM and .HEX generation check-boxes allow you to taylor which
files should be generated as does the Generate IAR UBROF box,
whereas the 2 Ext of File boxes allow you to taylor names of extensions.
24 SYSTEM51
________________________________________________________
Regarding the "Generate .HEX" check box, you should include this
facility when you need to program an EPROM with the final code. Most
EPROM-Programmers need that.
Directories
For those familiar with the DOS versions of SYSTEM51, the directory
structure is rather different in this Windows version. All outputs from
the different compilers, linkers and assemblers will go to the project
directory, which is the directory where the project source file resides. If
you want the Make facility to be able to recompile/reassemble
programs, all those source files must also reside in the project directory.
In the source “include files directories” edit line, you may enter several
disks and pathes of directories where you have placed your include
source files.The pathes must be separated by ";". As the different
programs start searching in the project directory, you need not mention
that.
In the user .OBJ files directories dialog box, you may enter disks and
pathes of several directories where you want your linker to search for
the .OBJ files. The different pathes must be separated by ";".
The linker will look for its .OBJ files 1.) in the project directory. 2.) in
the
directory where your system files are placed. 3.) in these directories.
Contents F1
Topic Search Ctrl+F1
How to use Help
--------------------
About...
This standard Windows menu may envoke the Windows standard help
system in different ways, or you may see in the about box, details about
your installation of the SYSTEM51.
26 SYSTEM51
________________________________________________________
F1 will also bring you to the help system, as will the speed button.
Depending on where you are in the menues of dialog boxes, the default
help item will change.
Summary:
-> Move cursor 1 position right.
<- Move cursor 1 position left.
^ Move cursor 1 position up.
v Move cursor 1 position down.
^-> Move cursor word right.
^<- Move cursor word left.
Home Move cursor to start of line.
End Move cursor to end of (nonblank) line.
PgUp Move cursor one screen page up.
PgDn Move cursor one screen page down.
^PgUp Move cursor to start of text.
^PgDn Move cursor to end of text.
^QG Move to line #n (given in a dialog box)
^Qn Move to marker #n.
Using keystrokes:
To move 1 position up, down, left or right, use the cursor pad
keys.
To move to the left or right end of the current line, press Home
or End, alternatively press ^Q^S or ^Q^D.
If you want to see whats beyond the rightmost shown coloumb, just
scroll the
PAS51 27
________________________________________________________
picture horisontally.
To move to the start or end of the text file, press ^PgUp or ^PgDn,
alternatively press ^Q^R or ^Q^C.
Summary of keystrokes:
When you press any visible character, it will be inserted at the cursor
position, and the rest of the line will move to the right. To enter
characters with a nonvisible ASCII value ( < 32 ), press ^P and the
character. It will then be shown on the screen in a different colour or
intensity.
When entering Return, a new line will be generated, and you will move
to the start of the new line. If you instead press ^N, a new line will be
generated, but you will remain on the previous one.
A special feature, the auto indent feature, allows you to beautify your C
or Pascal programs. If you press Return or ^N, and the old line contains
1 or more spaces to the left, the same number of spaces will
automatically be inserted. The indent feature may be disabled / enabled
by pressing Alt-P/E/A.
PAS51 29
________________________________________________________
Tabs in the text will move the cursor to the next by-n-dividable position
on the line. The value of a toggle switch, tabson, will decide whether
the character ^I or spaces will be inserted in the text buffer. This toggle
switch may be changed in the Options menu, where also the value of n
may be set.
To delete a whole line, press ^Y. To delete to the end of the line, use
^QY. To delete the word at the right of the cursor position, use ^T.
New style:
Shift curser moves: Mark block
^X Cut marked block to clipboard
^C Copy marked block to clipboard
^V Paste from clipboard
Old style:
^KB Start of block.
^KK End of block.
^KT Mark word.
^KL Mark line
^KH Hide block.
^KC Copy marked block to cursor position. Also put it into the clip-
board.
^KP Print marked block.
^KR Read file into cursor position.
30 SYSTEM51
________________________________________________________
Cut
Copy
Paste
Descriptions:
^K^R will read a disk file into the text whereas ^K^W will
write the marked block to a disk file.
Find
Find/Replace next
Replace
Detailed:
If the editor is called from the system menu, both find and
find/replace will offer you the values poined at as suggestions: you
may use those values by typing Enter or click; you may edit the values
by moving the arrows and then typing; or you may just start typing a
new value.
The compiler is envoked from the IDE through one of the Compiler
menus, an accellerator key, or by pressing one of 4 speed buttons
regarding this. In the "Messages" window, you will be able to follow
the compilation. If an error occurs, it will be described in that window,
and the carêt will point on the error in the appropriate window.
If you want stand alone compilation instead, you must use the DOS
version of the compiler.
In "Compile" (Ctrl+F9) you just compile the source in the front editor
window. No linking takes place.
"Make/Run" first does a Make on your project, and after that calls
a progam to execute your project. Which program to execute (default
integrated simulator) depends on the setting in Run|Setup. If no project
is given, the execution program if external, will start without loading
any target program.
If you do not use the module facilities, it will also generate the
following:
5) A .MAP file.
34 SYSTEM51
________________________________________________________
Whereas files 1) and 4) are fully linked to the runtime library, this is
not the case with 3). EXTRN pseudoops are generated to all used
entries in the library. If you assemble your source code modules written
in assembly language with the ASM51 supplied with this package, the
linker will link the files FP51.OBJ, PL51.OBJ, and IODRIVER.OBJ at
the end of your LINK51 process. If you for some reason use another
assembler, the file IODRIVER.ASM may be included or linked by
using that assembler.
If you just a simple simulation of your high level program, use the
In the RUN window you may watch the current PC value, the escaped
time (12 Mhz Crystal), the values in hex of your program variables and
selectable either a small window of the data, sfr or xdata window or the
8 registers. If stepping, a green bar in the program source will show the
line, containing the statement just executed. SBUF communication
(also read(ln)/write(ln) )will be simulated using the ‘Message Window’.
36 SYSTEM51
________________________________________________________
If you have written your programs in one of our high level languages
SYS51C or Pascal, the source text of your project .C or .PAS file will
appear in a window on your screen when entering the program. This
window information may be used in both directions, i. e. breakpoints
and listpoints will be shown in the source text, and you may set
breakpoints, go from- points and listpoints by referencing statement
boundaries shown in the text window.
Whether or not you use the hll window facility, you will be able to
debug the program on an assembler symbolic or absolute level.
1) The upper line on the screen is the menubar line. You may
pull down the menus listed by clicking the mouse or pressing
keys Alt-the_Highlighted_Letter.
When a menu is pulled down, you may click the item, move
the colored bar with cursor up/down and press Enter, or press
the highlighted letter.
2) A speed button bar, allowing you to fast enter some often met
commands.
You may Load other .C, .PAS, .HEX, . or .A51 files than the default
by start-up time. . Files without an extension (no extension) or .A51
files contain code, symbol and statement information, whereas .HEX
files
contain only code information. .A51 files must correcpond to .PAS or
.C files for HLL's to be loaded.
Change Modules
In this dialog box, you choose which module you want to look at. You
may optionally have the choice of all modules or modules,
corresponding to some C or Pascal source text When running the
program, the system itself will select the HLL module, to which the
program counter actually points.
With WriteFile... active, output to the RUN window will also go to disk.
With ReadFile... active, input to the SBUF, normally taken from the
keyboard when the RUN window is active, will instead come from disk.
The 2 disk output facilities will be closed either when you once again
click the menu item, or when you exit the simulator.
Port Streams
Port streams are text files that help you to control or watch port value
history. Output port streams let a (simulated) running program generate
such a file for you to either use for input later or to analyse by the
graphic port window facility or by any text editor.
Port streams may also be used for controlling port inputs during
(simulated) program run.. For this purpose use port stream files,
generated by either an output port stream or a text editor.
Port streams are text files with either extension .PTD or .TXT and have
the format:
<Port_name>
<time1> <value1>
<time2> <value2>
...
The 1. line gives the port name, from where the file originates, and
which name is passed to the graphics port window. When using the
port stream for port input streaming, this line isn’t used.
The next lines contain two decimal, positive numbers, separated by one
or more spaces or tabs. The 1. number, a 32 bit unsigned integer, gives
the time in clock cycles (1 microsec. °12mhz crystal freq.) that the 2.
PAS51 41
________________________________________________________
1 The bus timing on port P0, P2 and P3.6 and P3.7, in case of
external memory, isn’t implemented and shown.
2. The on-chip or’ing of the pin input signals and the chip-
internal output flip-flop isn’t implemented.
You may generate such a file either by using any text editor, or by
letting an output port stream generate it for
Please notice that there is no upper limit of the size of the file, only the
limited size of your disk. If your program changes your port very
rapidly, be prepared to stop the simulated run at an appropriate
moment.
Exit simulator
You may Exit the simulator by typing Alt-F4 or press the exit key. You
return to where you entered the simulator, probably the IDE.
PAS51 43
________________________________________________________
The High Level Language (HLL) window will show you where you are
in your C or Pascal program. You may set and delete breakpoints here,
follow the execution of your programs, see corresponding assembler
code, and enter watch symbols in the watch window by pointing on the
symbol name here.
44 SYSTEM51
________________________________________________________
You may open them by pulling down the View menu and click the
item.
To change a value in such a memory, just click or place the cursor over
the value at the wanted address, and start typing the (hex) value. If you
want to see / change an address that is not in the window, you may
scroll to it or you may just place the cursor over the address and type a
new one.
The CPU-Window will show the current value of selected registers like
the PC, Acc, PSW, B, SP, DPTR and ports. It will also show you the
elapsed time since program run started.
To see / change the values of the registers R0-R7, see the Register
Window
To show the correct time, the clock frequency must be that of your real
hardware.
PAS51 45
________________________________________________________
There are three sorts of "cursor marks" in it. The cursor you move with
the mouse or the cursor keys are marked gray.
If the PC value is within the window, you see a green bar on that
position.
In an animated run, you will see the green bar move around in this
window.
The REG-Window will show the current value of registers both as 8 bit
items and as 16 bit double registers.
If SERIAL ON (default), this window will show you the SBUF SERIAL
output from running programs. If your program needs SBUF input,
what you type on the keyboard will be send to your program if the
RUN-window has the focus.
If you don't want this SBUF feature, go to the Command View Window
and
type SERIAL OFF.
The RUN window may be opened by either clicking on the menu (Alt-
V/U) or automatically when a running program starts to output data to
SBUF.
If you don't want this SBUF feature, go to the Command View Window
and type SERIAL OFF.
With the two scrollbars you may set the display area and scale.
The two scrollbars at the buttom of the window will allow you to
change the scale of the time axis and to mode the zero-point, all
allowing you to get a broad view of the timing, or to study details
everywhere. The are not so many fix-points, but placin the mouse at a
certain point will give you the exact coordinates.
The input to this window must be a port stream, which may come from
an earlier generated port sreeam file either from an earlier run with the
port output stream facility enabled or from a file, written by using a
standard text editor.
The window consists of two parts a lower and an upper part; you will
enter your commands in the lower part. As this is a combobox, you will
easily be able to repeat commands: just draw down the list and click.
48 SYSTEM51
________________________________________________________
If you list the content of macros, this will be done in this window.
In the next chapter 6.4, we will review which commands to enter in this
window to operate the simulator.
In the watch window, you may see the value of variables during the run.
If you have a Hll window, the cursor may be placed above the symbol
to enter. Type ^F7 then enter. Otherwise type ^F7, write the
symbolname then press
enter. If the symbol is a name in a HLL program, it will be shown in
the type, declared there; otherwise it will be shown as a byte. If you
otherwise want the item displayed as a special type other than byte,
add a space and then the type letter. Type letters are
With the Simulator Edit Watch Menu, you may change already entered
watch expressions. Enter Alt-A /E then the number of the item (given
left in the watch window). Correct the spelling and press ENTER.
PAS51 49
________________________________________________________
To delete only one, enter Alt-A/D or click the item, then enter its
number (given left in the watch window).
Substitute...
To delete only one, enter Alt-A/D or click the item, then enter its
number (given left in the watch window).
Assemble...
First you will see a dialog box, asking for an address expression. This
may be absolute in hex, symbolic preceeded by . or statement number
preceeded by #.
50 SYSTEM51
________________________________________________________
After that you should enter symbolic assembler lines in the next dialog
boxes; an empty line will end the entry.
You will see the content of the showing address point in the program. If
you want to change it, just enter the new value and type enter.
To change the Program Counter (PC), from where a run will continue,
use the CPU window
Fill...
Three dialog boxes will follow, the first should give the start address
in one of the memories, the next the final address, and the last a content
byte.
The start address should give not only the address, but also the memory
type. This may be done by preceeding a hex number by one of the
letters
P (code mem), X (xdata mem), R (data and idata mem) or S (sfr
memory), or
it may be done symbolically (label, variable or function/procedure name
preceeded by ".") or by statement number (preceeded by "#"), the latter
giving the code memory.
Run (F9)
You start a run by pressing the RUN button or you may use F9. In
the buttom status line, simulated time will be shown; otherwise you
won't see the program run, except if your program uses the serial port.
In that case, the RUN window will be your connection. The green field
in the status line will show "RUNNING" or "RECORDING" depending
on whether the trace buffer facility is enabled or disabled. If the
program counter meets a breakpoint, it will stop. Otherwise to stop
running, press ESC or the break button.
Here (F4)
By pressing F4 while in the HLL window, you will set a temporary
breakpoint at the pointed statement and then start a running as above.
Animate Ctrl+F9
If you use animation ^F9 you will see the following: If you have a hll
view open, the cursor will move around to the executed positions; if you
have a list view open, the just executed instruction will be highlighted
green; if you have a watch view open, the symbols values will be
updated.
52 SYSTEM51
________________________________________________________
Step Into F7
Step Over F8
This function is the as F7, except that it do not step into functions, but
runs the whole function in one step.
NB. NB. Do not use F8 as the very first step. You must use F7 instead.
Trace Back...
This dialog box shows you some peviously recorded execution data.
Using the scrollbar you may mode back and forth in the execution
history. Please notice that the hll window, the watch window and the
disassembly window will follow the history. Also please notice that no
other windows will be updated.
Exec Macro...
PAS51 53
________________________________________________________
In this dialog box, you might start execution of a macro; for how to
make a macro, see advanced commands or Edit Macros
Toggle Breakpoint F2
Advanced breakpoints
This dialog box, envoked by the menu item Alt-R/A services two
purposes: to set/reset complex expression breakpoints, and to see which
simple breakpoints are set and possibly go to an address, were a simple
breakpoint is set.
In both cases, a combobox allows you to edit old breakpoints and to add
new
Recording...
Reset Ctrl+F2
^F2 will reset the (simulated) target, i.e. PC will be set to 0000, SP to 7,
interrupt to off, port P0 to P3 to 0FFH and all other SFRs are set to 0.
As in the real chip, the memories and the other registers are not
affected.
Options.
A multitabbed dialog box will show up. The leftmost tab is concerning
how the serial port (serial port 0 in those derivatives with 2 serial ports)
will be simulated.
Default is “Baud rate simulated”. The appropriate timer (normally
timer1) will run the correct number of ticks (simulated) to send /
receive a character. Please notice that there is no check that this leads
to a correct baud rate on the real target. As especially using animation,
this way of simulation may seem very slow, there are two other
selections of simulation modes: “Immediate” where the character is
send / received immediatly without any delay, and “off” where you have
to manually set TI / RI when a character has been send / received.
Please notice that “Immediate” may cause problems when working with
serial interrupts.
PAS51 55
________________________________________________________
In the left but one tab area, you may set a animation delay count. As
this is implemented by a software loop, the actual speed will depend on
the speed of your PC.
In the right but one tab area, you setup how much xdata you have in
your target and if some parts of this are overlapped with the
corresponding code area. Please notice that you also have to enable
xdata areas containing memory mapped I/O to get a proper result.
Macros entered in the Edit box have the same syntax and semantics as
described in the "Advanced Commands" section of this manual, except
that the "DEF :" command word must be omitted, i.e. a macro consists
of a sequence of commands, ended by "EM". This ending EM (end
macro) is already placed into the text.
Examples:
var
mychar: byte data;
myarray: array[0..5] of byte data;
#25
(#25)
.myproc
.myproc+3
.myproc - PC
.myarray + 2 * 2
.myarray + [ mychar ]
.myarray + [ mychar + 1 ] & 7F
PAS51 59
________________________________________________________
L[<list_start>][,<list_stop>]
A<assemble_start>
Examples:
-A2000
2000 mov dptr,#1234*2
2002 mov t2,0s
?
2002 mov r2,5+5
2004
-L2000,2003
2000 MOV DPTR,#2468
2002 MOV R2,0A
-L#1,#3
002B MOV 43,#0
002D MOV 44,#0
-
D<startpoint>[,<stoppoint>]
S<first_address>
After typing the S command and Return, the memory type, the address
and the value will be shown.
You may now optionally enter a new value and then type return. The
next location will then be shown, you may alter it until a .<Return> is
typed.
XA The accumulator
XRn Register Rn, where n is a number between 0 and 7
XP The Program Counter PC
XT The elapsed simulated time in milliseconds
G[P][<start_address>[,[T]<breakpoint>][,[T]<breakpoint>]
SETUP DELAY (abbreviated SE DE) will insert a delay every time the
GP command displays a statement boundary in the upper window, so
you may have a chance to follow what is happening, even on a fast PC.
The choice of the delay value depends on you and your PC, but try for
instance 2000.
At start up time of the simulator when called from the system menu, the
file with the name <filename>.A51 will be loaded. The code, symbol
table and upper window HLL source will be automatically loaded. If
you later on during the execution want to reload or load additional files,
use the LOAD command.
Syntax:
LOAD <filename>
If the <filename> has the extension .HEX, the INTEL HEX file format
is assumed, otherwise an INTEL compatible absolute file. (In this
system with the extension .A51).
The LIST command will redirect a copy of the command view window
output to any DOS file or device.
Syntax:
LIST <filename>|STOP
In case of a <filename>, this file will be opened and the output will be
sent to that file. In case of STOP, the output redirection will be stopped
and the file closed.
PAS51 65
________________________________________________________
The WRITE command will redirect a copy of the runtime SBUF write
or writeln output to any DOS file or device.
Syntax:
WRITE <filename>|STOP
The READ command will redirect input from any DOS file or device to
the runtime SBUF C device.
Syntax:
READ <filename>|STOP
In case of a <filename>, this file will be opened and input taken from
that file. In case of STOP, the input redirection will be stopped and the
file closed.
66 SYSTEM51
________________________________________________________
CALC <expression>
The value of the expression will be shown in hex and decimal. Also the
memory type will be shown.
Syntax 1:
This form defines a new variable (label) with the value of the
expression and of the memory type given in <memory_type>. Valid
memory types are CODE, DATA, XDATA, SFR, BIT, or ABS.
Syntax 2:
DEF :<macro>
<macro body>
EM
IF expression
Inside a macro, it offers conditional execution of
commands. If "expression" is true, (i.e. bit0 =
1) the following commands are executed until an
ELSE or an ENDIF is met. In case of an ELSE
met, commands after ELSE and until ENDIF are
executed if the "IF" expression was false,
otherwise not.
ELSE See IF
WHILE expression
See REP.
UNTIL expression
See REP.
Example of a macro:
68 SYSTEM51
________________________________________________________
DEF :CRUN
ECHO OFF
REP
TP
IF .XX>22
ECHO ON
CALC .XX
ECHO OFF
ENDIF
UNTIL PC>#24
ENDR
ECHO ON
EM
This macro will step HLL statements until the program counter gets a
value greater than code address for statement 24. During stepping, the
variable XX will be shown if its value is greater than 22H
Syntax:
:<macroname> [<parameter>]{,<parameter>}
Syntax:
INCL <filename>
Redirects command input from the file <filename>. May be used for
start up or reading in previously defined macro definitions.
If you want to activate an include file at start up time, you may enter a
start up file name in the opT)ions submenu in the system menu, or you
may use the /I switch when the system is started stand-alone mode.
Syntax:
PUT <filename>
Puts all defined macros into the file named <filename>. May be read
back again later by the INCL command.
70 SYSTEM51
________________________________________________________
Syntax
MAC
or
MAC :<macroname>
The latter form displays on the screen the macro by the name
<macroname>.
Syntax:
ECHO ON|OFF
REM remark
Inside a macro, this is intended for comments. Do not use "%" inside
comments as they will be expanded.
In the simulator, the program space and the external data memory
space is separated. The maximum size of each of these memories is 64
KBytes ( 0 -> 0FFFFH ). In your real hardware, you may have
overlayed some parts of those memories; this will not be simulated.
In the real 8051 processor, the parity flag bit is set after every
instruction execution. In the simulator this is omitted in order to get
reasonable simulation execution speed. All other instructions should be
executed exactly as on the chip. The (simulated) execution time
appearing in the register window is calculated using a clock frequency
of 12 Mhz by default. You may change this in the CPU window. The
time calculation regards the original 8051 with 12 or 24 oscillator clock
cycles per instruction. The compressed, pipelined execution of the Intel
80C251 (in compatible mode) and the Dallas Semiconductor 80C320 is
not simulated.
72 SYSTEM51
________________________________________________________
8. Emulators.
Different of ways exist to debug and test your programs in a real chip.
The best way is to download the program to an In Circuit Emulator
(ICE) connected to the chip and test and debug your program through
that ICE. A simpler, but a little less efficient and limited way is to
include a special monitor program in your program space, and then
place the code under test in RAM memory. Special software providing
both sorts of debugging environment with the same HLL window
facility as the simulator exists, but must be ordered separately.
To use other In Circuit Emulators you may use the "Generate IAR
UBROF" option or the SYMCONV program described in chapter 10 of
this manual to get acquainted with some high level debugging features
in your system.
MetaLink
V'Nice-51
PAS51 73
________________________________________________________
To call the ASM51, just call it from the IDE menu, Compiler|Assemble
(Ctrl+A)
In the .ASM source text, capital letters and lower-case letters are
completely intermixable.
Operands for both instructions and pseudoops may use labels, numbers
and the operator $ denoting the location counter, either alone or
combined by the operators +, -, *, /, &, and !. A dot "." will cause the
calculation of a bit address of either a SFR or a variable. & and ! denote
bitwise AND and OR.
DB XX1,XX2,...
generates bytes of code with the value
XXn
DW XXX1,XXX2, ...
generates 16 bit words of code with the
low and high value of XXXn
<mn> MACRO
[<formal param>{,<formal param>}]
<macro body lines>
ENDM
The name <mn>defines the name of a
macro with optional parameters <formal
param> and the content <macro body
lines>. Do not use $ directives inside
macro definitions. Macro definitions
must not be nested.
IF <expression>
If the <expression> has the value
0FFFFH (true) then the lines until the
corresponding ELSE or ENDIF will be
assembled, otherwise they will not be
assembled. In case of an ELSE is met,
the lines after ELSE and until the
corresponding ENDIF will be
assembled. If-constructs may be nested
to a level of 10.
$INCLUDE <includefile>
Include the file <includefile>
$LINE n <source_line>
HLL line # and corresponding source
code
(line # to be included in the .OBJ file)
; ASSEMBLER EXAMPLE 1
JMP START
; The absolute code segment CSEG is
; default and starts at 0
ORG 13H
INC VARIA
RETI
START:
; Main program
SETB EA
SETB EX1
MOV VARIA,#0
; Initialization of variable
LOOP:
PAS51 79
________________________________________________________
MOV P1,VARIA
SJMP LOOP
END
; End of assembler source
The next example is very much like the former, but the interrupt
routine is placed in another module and the main program is
relocatably placed in a code module. The data is also relocatably placed
and PUBLIC. An assembler directive IF-construct choses between
internal DATA memory and external XDATA memory.
; ASSEMBLER EXAMPLE 2
NAME EXAMPLE2
PUBLIC START,VARIA
; START and VARIA may be called
; from other modules
INEXT EQU 0
; XDATA switch set false
IF INEXT
; If true, select XDATA
80 SYSTEM51
________________________________________________________
RSEG EX2XDATA
VARIA: DS 1
; Reserve 1 byte in XDATA
; relocatable area
ELSE
; Otherwise select DATA
RSEG EX2DATA
VARIA: DS 1
; Reserve 1 byte in DATA ;
relocatable area
ENDIF
CSEG
; The absolute code segment
JMP START
ORG 13H
JMP EX1INTERRUPT
RSEG EXCODE
; Code from here is relocatable
SETB EA
; Initialization of interrupt
SETB EX1
IF INEXT
MOV DPTR,#VARIA
MOV A,#0
MOVX @DPTR,A
LOOP:
MOVX A,@DPTR
MOV P1,A
SJMP LOOP
ELSE
MOV VARIA,#0
; Initialization of a variable
LOOP:
MOV P1,VARIA
SJMP LOOP
ENDIF
END
82 SYSTEM51
________________________________________________________
The last example is using the MACRO and LIBRARY facilities of the
assembler.
; Example 3
GLOBAL_C GSET 0
LIBRARY THIS_MODULE
; THIS_MODULE will only be loaded
; if THIS_ENTRY is declared EXTRN
PUBLIC THIS_ENTRY
; in a preveously loaded module
MOV DPTR,#PA
; Actual PA must be XDATA address
MOVX A,@DPTR
MOV PB,A
; Actual PB must be register or DATA
ENDM
RSEG THIS_CSEG
PAS51 83
________________________________________________________
THIS_ENTRY:
; In here if loaded and called
MYMACRO ADDRA+5*4,R3
; XDATA byte to register R3
MYMACRO ADDRB,P1
; XDATA byte to port P1
RET
ENDLIB
LIBRARY THAT_MODULE
; Next module in same text file
PUBLIC ...
...
ENDLIB
; End of module THAT_MODULE
END
84 SYSTEM51
________________________________________________________
The linker LINK51 will link and relocate object files generated by
SYS51C, PAS51W or ASM51. It will connect externals in one module
with code addresses in others. It may be invoked from the IDE menu
Compile|Link (Ctrl+L). After a succesful Compiler|Make or
Compiler|Build, an automatic linking process will take place.
The main files generated by the linker is a .A51 file which is an INTEL
compatible absolute file, and a .MAP file, an INTEL compatible map
file. If the option is set, it will generate an INTEL HEX format output
file. Also, if that option is set, it will generate an IAR UBROF .UBR
absolute file.
If Ctrl+L is used, a dialog box will appear. The format of what to enter
is the following:
The -O directive will start placing relocatable code from origin <hex
number>.
A -M- directive may optionally be given in the link line. This will
exclude generation of a .MAP file.
PAS51 85
________________________________________________________
If your command line is too long, or you want to repeat the same long
line many times, you may use command file indirection. Place your
linker .OBJ file names and switches in a file, let us say LOADFILE,
with one name or switch on each line, and then enter in the linker
dialog box @LOADFILE or the integrated system compiler directive
#pragma link @LOADFILE
A variant of the LOADFILE is the make project file .KPR. Seen from
the linker, it works as a LOADFILE, but contains HLL extensions and
probably more file names on a line. These are just ignored by the linker.
Because so many targets are supported (about 50) and as the different
parts of the system use different source syntaxes for the names of all the
special function registers, a common binary file, SYS51.SFB is used
throughout the system and its compilers, assembler, simulator, and
86 SYSTEM51
________________________________________________________
different emulators. This file describes all the differences between the
targets, and may be changed by you. For this purpose, describing source
files 80xxx.SFR are supported together with a SFR "compiler"
SFR2SFB.EXE. This compiler only works under DOS.
Every line, not starting with a ";", describes a SFR BYTE, BIT,
INTERRUPT routine, or a special characteristic of the particular target
type. The 1. line must be a comment line, describing the processor, as
this line will be presented in the target selection menu.
P A R T I I , the P A S 5 1 Language
Special symbols are used for various purposes such as addition and
separation. A list of them with a short explanation is shown in the
following:
+ - * /
are arithmetic and set operators.
( ) (. .) [ ]
are different sorts of parentheses, the former are
used in expressions and for procedure parameters,
the latter in conjunction with array addressing.
; is a statement separator.
The built-in type BYTE is the type used for simple integer arithmetic
calculations and general data handling. In respect of addition and
subtraction, bytes are treated as numbers between 0 and 255. As calcu-
lations in the 8051 microcontroller are in 2's complement, you may in
very special cases treat bytes between 128 and 255 as the negative
numbers -128 downto -1, but this is not the case in multiplications,
divisions and by comparing bytes. The byte type take advantage of the
hardware byte-oriented facilities of the 8051 family chips.
The built-in type CHAR represents ASCII (or other national ISO
alphabet) characters.
The built-in type REAL represents a 32 bit floating point type with a 24
bit mantissa and bit exponent according to IEEE 794.
The built-in type PROCESS may be used in conjunction with the low
level concurrency primitives NEWPROCESS and TRANSFER as
explained in chapter 21.
Besides the built-in types you may declare your own types in a type
declaration part. This part will start with the reserved word TYPE.
TYPE
valve_position=(open,closed,opening,closing);
The subrange type is another user-definable type that defines a new type
consisting of a part of the number range of a whole longint, integer,
byte or char. Examples are
TYPE
digit = 0..9 ;
letter = 'A'..'Z' ;
Examples:
TYPE
arr = array[ 5..4*2 ] of byte ;
sl = 0..79 ;
line = array(. sl .) of char ;
TYPE
rec=RECORD
x,y: byte;
alfa: array[0..10] of char
end;
Another construct very much like the record construct exist: Numbered
bits on special registers and ports. This construct is identically to the
same facility in the Intel 8051 Assembler Language.
Example: p1.5
PAS51 95
________________________________________________________
The STRING type acts very much like ARRAY of CHAR, but the first
byte is dynamically showing the length of the text string.
The SET type consists of a set of some elements that you define. In
PAS51, variable sets are restricted to one byte; You may think of the set
as each individual of the 8 bits in the byte representing one element of
the set, a one value of the bit expressing that element to be member of
the set. SETs will be further explained in chapter 19.
96 PAS51
________________________________________________________
14.2 Variables.
VAR
count: byte;
ch1, ch2: char;
char_buffer: array(. 0..79 .) of char xdata;
line1, line2: line xdata;
valve1, valve2: valve_position;
PAS51 97
________________________________________________________
Special function registers in the 8051 are given special names. Those
names will normally be the same as in the appropriate company's
assembler language. For exact knowledge please refer to the xxx.SFR
definition files.
Examples:
98 PAS51
________________________________________________________
VAR
R2_0: byte absolute $2;
C_8155: byte xdata absolute $3800;
doubleR2_0: byte absolute R2_0;
TYPE
arr= array(.0..3.) of integer;
CONST
Pipe=5*5;
Pipe1=Pipe+1;
cstring='This is a constant text string';
constarray: arr=(1,22,1235,-40);
cstringarray: array[1..2] of string[15]=
('Text 1',
'and text 2');
15.1 Assignment.
variable:=expression
i:=7
bitx:=true
count:=count+1
record1.array1:=record2.array1
100 PAS51
________________________________________________________
record1:=record2
P1:=%11010110
Input and output in PAS51 are based on the built-in ports and timers of
the 8051. Ports as P0 to P3 (P0 to P5 in 80515) and SBUF are treated as
output ports just as variables in assignment statements like the above,
whereas as input ports in parts of expressions. Simple examples of
input and output are
p1:=$27
serial:=sbuf
bit_y:=p2.3
Subsequent alignment of the output file at the start of a new line may be
achieved by using the alternative form
writeln(v1,v2,...) or writeln(d,v1,v2,...)
writeln or writeln(d)
PAS51 101
________________________________________________________
Values may be read from some device or text file d to variables v1, v2,
... by using the
read(d,v1,v2,...) or read(v1,v2,...)
readln(v1,v2,...) or readln(v1,v2,...)
is identical with
read(d,v1,v2,...) ; writeln(d)
(NOTE this is NOT identical with standard pascal: no eoln or eof flags
exist when using devices)
102 PAS51
________________________________________________________
The SERIAL device must be initialized before use to the correct baud
rate and bit length by the call
RESET;
or the identical
RESET(SERIAL);
In this version of the compiler, you may use general text files. However,
to gain full use of text files, you must either buy the optional FILES
TOOLBOX or taylor your own version of the file IODRIVER.ASM, see
appendix C.
Declarations:
PAS51 103
________________________________________________________
New procedures:
ASSIGN will connect the text file f with a dos file name given in the
string <dos file name>.
RESET(f);
RESET will reset the file f to the start of the file. May thereafter be used
for input or output.
REWRITE(f);
If and old file by the name assigned to f is found, it will be erased. After
that, a file of initial length 0 will be created. Writing to f is after that
supposed.
CLOSE(f);
New functions:
EOLN(f);
This boolean function will return the value TRUE if the you have
reached end of line by preveous READ(f,...)s. May be set to FALSE by
READLN(f,...);
EOF(f);
104 PAS51
________________________________________________________
This boolean function will return the value TRUE if if you have reached
end of file by preveous READ(f,...) or READLN(f,...).
read(i)
assign(textfile1,'MYFILE.TXT');
reset(textfile1);
A;B;C; ...
begin A ; B ; C ; D end
often written as
begin
A;
B;
C;
D
end
106 PAS51
________________________________________________________
15.4 Selection.
15.4.1 If Statement.
if Q then A else B
if Q then A
may be used;
PAS51 107
________________________________________________________
case Q of
a :A;
b,c : BC ;
d :D;
end
If none of the selectors are equal to the current value of the selector
expression, this version will produce no action. If, however you want to
have this opportunity, an optional else action may be taken as shown
below:
case Q of
a:A;
b:B;
c:C
else D ;
end
case Q of
a..b: AB;
c..f: CDEF;
else G;
end;
108 PAS51
________________________________________________________
15.5 Repetition.
while Q do A
for v :=i to f do A
for v :=i downto f do A
For code and speed efficiency, use variables declared DATA or IDATA
as counter variable v.
Examples:
VAR
Rec: RECORD
X,Y: Integer;
Ch: Char;
END;
BEGIN
WITH Rec DO BEGIN
X:=0;
Y:=P1;
Ch:=Chr(SBUF);
END;
TYPE
PObj=^TObj;
TObj=OBJECT
PAS51 111
________________________________________________________
X1,Y1: Integer;
CONSTRUCTOR Init;
PROCEDURE DoThis;
PROCEDURE DoThat;
END;
VAR
Obj: PObj;
BEGIN
Obj:=New(PObj,Init);
WITH Obj^ DO BEGIN
DoThis;
IF X1=5 THEN
DoThat;
END;
Examples:
var
alfa: integer idata;
beta: byte xdata;
const
movad=$E5;
movdptr=$90;
begin
code
movad alfa
movdptr beta
$F0 { MOV @DPTR,A } ;
...
PAS51 113
________________________________________________________
All types may be assigned to variables of the same type. They may also
be compared to variables or constants of the same type. The result of a
comparison will be of the type boolean.
Integers or bytes may be variables declared integer, byte, constants or
elements of variables or constants declared as array(. ... .) of integer or
byte. They may be part of expressions containing arithmetic or logical
operators. The operator hierarchy is as follows:
If one of the operands is integer, word or longint and the other byte,
automatic type conversion to integer, word or longint takes place. In
other cases, automatic conversion may take place, but if you get an
incompatible types error message or you use the $T- directive, you may
use the general type cast function of the compiler.
If one of the operands is real and the other byte, word, integer or
longint, automatic type conversion to real takes place.
Examples:
a := i + j * 3 ;
NOTE:
You must remember that bytes are
0..255, but in 2's complement. This
implies that for instance the program
part (a and b are of the type byte)
a:=2;
b:=(a-4) div 2
8051 chip family is designed especially for 8 bit use; for instance it is
equipped with a very fast unsigned 8 bit division (4 microseconds at
12MHz clock) that cannot at all be used for 16 bit division. So if you
want to write fast and compact programs, use bytes as much as possible
throughout your program, integers only if absolutely necessary.
To help you to mix bytes and integers and get the correct result
anyhow, 3 conversion functions are offered.
The INT function requires a byte expression as the parameter and will
return the corresponding 16 bit signed integer value.
Examples:
var
i,j: integer;
c,d: byte;
begin
i:=int(c)*int(25);
d:=hi(j);
...
PAS51 117
________________________________________________________
The whole program is a block ended by a . (dot). The block may also be
the body of the subroutine constructs in PAS51, procedures and
functions.
17.1 Procedures.
var
item_count: byte;
procedure count_item;
begin (* block of count_item has only statement
part *)
item_count:=item_count+1
end;
...
count_item;
...
118 PAS51
________________________________________________________
end.
...;write_char('a') ; ...
17.4 Functions.
In the last example, you must have a whole statement to get a new
value of line(.i.). If instead you prefer to get the next input character as
a part of an expression, you might have used a function instead:
17.5.1 Scopes.
17.5.2 Recursivity.
The <n> in the {$R directive is a number, used to tell (in 256 bytes
pages) the system, how much xdata space you want to be used in total
for parameter- and local variable space. Default is 1 KByte (<n>=4).
PAS51 123
________________________________________________________
ch := chr( $31 )
HighNib(b): Byte; will return the high 4 bits of b, swapped into the
low 4 bits of the result; the high 4 bits are zeroed.
COS
SIN
TAN The trigonometic functions are calculated by row
expansion and are therefore accurate, but not
extremely fast.
PORT_AND(PORT,BYTE)
will read the output latches of PORT, do
an AND operation between this value
and a BYTE expression, and finally
output the result to PORT.
PORT_OR(PORT,BYTE)
will read the output latches of PORT, do
an OR operation between this value and
a BYTE expression, and finally output
the result to PORT.
Examples:
A general tool, looking very much like the built-in functions is the
general typecast possibility.
The name of a type, for instance WORD or a user defined type might be
used as a "function" name, followed by a parantetized expression of
another type. The result of such a "function" will be conversion of the
type of the expression to an expression of the named type. Conversion
is possible following certain rules: a) All types of the same length may
be converted. b) conversions between any of the types BYTE,
INTEGER, WORD, LONGINT and REAL may be performed. When
converting from REAL, truncation is used.
PAS51 129
________________________________________________________
or
8x52:
805x5, C515:
8xC552:
87C751:
X0 X1 T0 T1 S1
When using bank 1 to 3, the fast bank switching is used. Such interrupt
routines cannot use operations on variables and constants of type REAL
or LONGINT or string concatenation. At 12MHz clock rate, it takes
about 10 microseconds to enter or leave interrupt.
Using bank 0 for interrupts causes a slow interrupt to take place. Slow
interrupt can only take place if you have an XDATA memory in your
system. In this case, not only bank 0, but floating point- and longint
registers are moved to and from XDATA memory. It will take
(@12MHz clock) about 200 microseconds to enter or leave the
interrupt, ie. 400 plus interrupt routine code in total.
The built-in transcendental functions like SIN and LN and read and
write procedures and STR and VAL are not reentrant and uses its own
data area, which is not moved away on slow interrupts. Those functions
may therefore not be used in any interrupts.
The fast and slow interrupt has nothing to do with the priority systems
of the processors. It is up to you to program that.
PAS51 131
________________________________________________________
NOTICE 1:
When using bank 1 to 3 fast interrupt, it is not
permitted to share routines between interrupt and
non- interrupt part of a program. If you want to
share a procedure or function between more
interrupt procedures or place such routines
elsewhere, you may set the bank used for code
generation by the USING attribute to procedures
or functions. PROCEDURE iii; USING n, where
n=1, 2 or 3 will define a procedure to be called
from interrupt procedures, whereas PROCEDURE
ppp; USING 0 will define a normal procedure.
USING is only necessary when changing format.
Used in connection with a normal procedure/func-
tion, USING is a toggle switch.
NOTICE 2:
The runtime package for LONGINT, REAL and
STRING-addition uses 2 fixed address registers
and bank 0. It is therefore not possible to use
longint and real operations and string addition
inside fast interrupt routines.
NOTICE 3:
When working with a multimodule program, you
must know that only the MAIN module
("PROGRAM" module) will generate the interrupt
vector. At least the head of all interrupt procedures
must be placed in that module. If you want to
place (most of) the body in another module, you
must define an imported procedure, called from
within the procedure interrupt xxx; Remember the
USING n statement part.
132 PAS51
________________________________________________________
You may use one interrupt routine as an interrupt routine for another
interrupt without loosing time to call a common procedure. The syntax
is:
You may reduce the code and stack space used for pushing and popping
information at interrupt entry/exit by using the new compiler directive
(*$ISn*), that controls the level of PUSHING / POPPING; the possible
values of n are:
0=Save nothing
Example:
program interrupt_demo;
var
timer: word; { counts seconds }
fractions: word;
Although the methods mentioned still are possible, the most commonly
used method in version 2.0 and 3.0 will be to use separately compiled
or assembled modules as mentioned in chapter 20.
PAS51 135
________________________________________________________
18. Pointers.
If your target is equipped with XDATA ram memory (told the compiler
by the M directive) then you may use the pointer type variables either
like in Pascal by using variables on the heap by calls to NEW,
DISPOSE, MARK and RELEASE, or like in C and PL/M by calcula-
ting new pointers.
A pointer to a type (some simple type, array type, record type etc.) is a
mean to access that type in an indirect way through a variable, for
instance p pointing to different points in memory at different times, the
variable pointed to ( named p^ ) being the content of memory, where p
is actually pointing.
Example.
type
p= ^rec;
rec= record
data: integer;
ptr: p
end;
var
p1,p2: p;
If you use the normal type-checking {$T+}, the only way of mani-
pulating pointers is to assign a pointer to another pointer of the same
type, or to use one of the three built-in procedures NEW, MARK or
RELEASE.
The (external data) memory is divided into two parts, the fixed address
space for variables declared in the VAR-parts and as procedure
parameters and the HEAP, the rest of free external memory.
A call to NEW(p1) will reserve space on the heap for a variable of size
and type rec, if p1 is of a type ^rec.
A call to MARK(px), where px is any pointer type variable will set px
to the first free position on the heap.
A call to RELEASE(px) will move all heap space from px^ and up to
the free heap space.
Example.
Pascal like languages are strictly type checking languages. If you don't
do anything actively, PAS51 is acting like Pascal. The reason for
strictly type checking is program security: The compiler will tell you if
you are possibly making mistakes in as many contents as possible. This
puts some restrictions on what to do in your program that is unfamiliar
to users of such languages as C and PL/M, where pointers are freely
manipulated. Free manipulations of pointers might lead to more effici-
ent programs, but also to greater danger of programming errors. Before
you read further here, please realize, that one of the reasons for this is
the lack of direct multiple byte assignment in PL/M and C, but here
present as described in chapter 14.
19. Set.
Examples.
type
bits=(b0,b1,b2,b3,b4);
bitset=set of bits;
var
bits1: bits;
bitset1: bitset;
begin
bits:=b1;
bitset1:=[b0,b2,b4];
if bits in bitset1 then
writeln('This should never occur')
end.
______________________________________
type
bitset=set of 0..7;
timer0_def=(m0,m1,ct,gate);
timer0_bits=set of timer0_def;
var
bitset1: bitset;
i: 0..7;
begin
for i:=0 to 4 do
bitset1:=bitset1+[i];
bitset1:=bitset1-[2];
end.
______________________________________
var
ch: char;
...
if ch in ['0'..'9','A'..'Z','?','_','Æ','Ö','Å'] then ...
PAS51 139
________________________________________________________
20. Objects.
You declare an object like you declare a record, by using the reserved
word OBJECT instead of RECORD, and by writing procedure and
function headers inside the declaration.
Example:
TYPE
Oo=OBJECT
X: Integer;
PROCEDURE DoX(Val: Integer);
140 PAS51
________________________________________________________
END;
...
PROCEDURE Oo.DoX(Val: Integer);
BEGIN
IF X<0 THEN
X:=X+Val;
END;
20.1 Inheritance.
One major feature on objects is that one object type may inherit the
properties from another object type and then add more data and / or
methods. The added methods may be a real addition (new name) or
may overwrite another inherited (same name). Data can only be added,
not overwritten.
TYPE
Oo1=OBJECT(Oo)
Y: Integer;
PROCEDURE DoXY(Val: Byte); (* really added *)
PROCEDURE DoX(Val: Integer);(* overwriting Oo.DoX *)
END;
...
BEGIN
Y:=X+Y+Val;
END;
TYPE
Oo=OBJECT
X: Integer;
CONSTRUCTOR Init; (* see below why *)
PROCEDURE DoX(Val: Integer); VIRTUAL;
END;
Oo2=OBJECT(Oo)
142 PAS51
________________________________________________________
Y: Integer;
CONSTRUCTOR Init; (* see below why *)
PROCEDURE DoX(Val: Integer); VIRTUAL;
END;
...
VAR
O1: ^Oo;
O2: ^Oo2;
BEGIN
O1:=New(Oo,Init);
O2:=New(Oo2,Init);
...
O2^.DoX(7); (* Oo2.DoX, X <- 14 *)
O2:=O1;
O2^.DoX(7); (* Oo.DoX, X <- 7 *)
Before you use an object, you may want to initialize something about
that object; to do that, you could use a special procedure. However, if
your object contains virtual methods, it is absolutely necessary to do
PAS51 143
________________________________________________________
that, using a special method, a constructor. The reason why you must
initialize in a special way, objects containing virtual methods, is that a
virtual method contains a dynamic address field inside the object that
must contain a valid address of a method, otherwise the program will
show unpredictable behavour.
As you often want to make space for an object on the heap and then
initialize it, and perhaps want to initialize it to an object, from which
this is inherited, the built-in procedure/function New() has been ex-
tended with an alternative form:
object_pointer:=New(Object_type_pointer, Init_construct);
20.4 Destructors.
When inside the code for a method, you need to reference the data of
the corresponding object. No problem, you just write the name of the
field as in a with-statement.
Inherited methods must therefore also have the same parameters as its
parent method.
You may now think: is all this really something that I can use in my
embedded system, or is this only an academic possibility, not useful for
me and not practical with such a small processor? The answer is that
objects present a different way of thinking that offers you some
advantages and sometimes some disadvantages. The principles are
absolutely, as the below example should show you, useful also in the
type of jobs that these processors are normally used for. Some of the
advantages are that you get encapsulation and that you get a whole new
set of possibilities when using inheritance and virtual methods. Some of
the disadvantages are, that you tend to use more bytes for your program,
and that program execution isn't completely Read-Only when using
virtual methods, and therefore more sensible to errors.
Example:
unsolved, but it contains the valve position and methods to set and
retrieve the position. In this fundamental object, "SETVALVE" and
"GETVALVE" just writes to and reads from "Position". TValve.Init not
only executes the visible code that sets the position to "Open", but it
also invisibly initializes the addresses of the VIRTUAL methods of the
object.
PValve=^TValve;
TValve=OBJECT
Position: TValvePosition;
CONSTRUCTOR Init;
PROCEDURE SetValve(V: TValvePosition); VIRTUAL;
FUNCTION GetValve: TValvePosition; VIRTUAL;
END;
PPortValve=^TPortValve;
TPortValve=OBJECT(TValve)
Mask: Byte; (* Port bit for actual valve *)
CONSTRUCTOR InitP(No: Byte);
PROCEDURE SetValve(V: TValvePosition); VIRTUAL;
FUNCTION GetValve: TValvePosition; VIRTUAL;
END;
PSerialValve=^TSerialValve;
TSerialValve=OBJECT(TPortValve)
Number: Byte; (* Valve number *)
CONSTRUCTOR InitS(No: Byte; BaudRate:Word);
PROCEDURE SetValve(V: TValvePosition); VIRTUAL;
FUNCTION GetValve: TValvePosition; VIRTUAL;
END;
CONSTRUCTOR TValve.Init;
PAS51 147
________________________________________________________
BEGIN
Position:=Open;
END;
END;
Now we are ready to use the valves, and the dynamic properties of the
virtual methods:
VAR
Valves: ARRAY[0..2] OF PValve; { 3 different valves }
I: Byte;
...
BEGIN
Valves[0]:=New(PPortValve, InitP(0)); { #0 is parallel }
Valves[1]:=New(PSerialValve, InitS(1,9600); { #1 is serial }
Valves[2]:=New(PPortValve, InitP(2)); { #2 is parallel }
...
FOR I:=0 TO 2 DO
Valves[I]^.SetValve(Closed);
The type PROCESS is a built-in record, the fields not accessible from
PAS51 directly. It is intended to contain a runtime description of a
parameterless procedure turned into a parallel process by a call to the
procedure NEWPROCESS.
Example.
Program Round_Robin;
{ This program will demonstrate Round Robin Scheduling. }
{ At start-up only one process is active. }
{ After 16 repeats process1 will activate process2. }
{ After that, both processes are active and will alternate.}
type
procs=0..1;
var
sched_bits: set of procs;
sched,startp: process;
pd: array[0..1] of process;
cp,i: byte;
procedure scheduler;
begin
cp:=0;
repeat
if cp in sched_bits then transfer(sched,pd[cp]);
cp:=(cp+1) mod 2
until false
end;
begin
newprocess(scheduler,sched);
newprocess(proc1,pd[0]);
newprocess(proc2,pd[1]);
sched_bits:=[0]; (* only process 1 active at start *)
i:=$F0;
transfer(startp,sched)
end.
154 PAS51
________________________________________________________
3) Suspended: the process(es) that waits for some event to happen. The
events may be detected by either another process or an interrupt routine.
Processes will transfer from state Running to state Suspended by a call
to WAITS if the semaphore S, parameter to WAITS, has reached the
low threashhold mentioned above. Processes will transfer from the state
Suspended to Active when some other process calls SIGNAL or an
interrupt routine calls ISIGNAL on S, and the actual process is the
longest waiting on S.
procedure RELEASE_PROCESSES;
Transfers the running process to state Active.
This procedure should be called from a running process on strategic
points to allow scheduling.
156 PAS51
________________________________________________________
procedure STARTPROCESSES;
This procedure should be called from the main program as the last
before end. ; Starts the whole kernel; no return beond this call takes
place. Before the call to this procedure, calls to NEWPROCESS for
every process in the system must have taken place.
In the start of your program, you must define the numbers of processes,
MAXPROCESSES=...
If the number is different from 3, you must reedit and recompile the file
SEMAPHOR.PAS.
PROGRAM <prog_name>;
Please use the same name for the unit and the pascal file, because else
the simulator and the DEBUG51 won't work properly. This is true both
for the main program and for other modules.
The bodies of the procedures / functions, and the types, consts and
variables local to the unit, should be given in the IMPLEMENTATION
part of the unit, which follows the interface part. In this way,
implementation details may be hidden to other users of the unit.
158 PAS51
________________________________________________________
INTERFACE
USES
U1, (* This unit itself uses *)
U1, (* the other units U1.PAS, *)
U3; (* U2.PAS and U3.PAS *)
TYPE
TA=ARRAY[0..3] OF Byte;
PROCEDURE ProcU;
(* ProcU can be imported in other modules *)
IMPLEMENTATION
PROCEDURE ProcU;
BEGIN
... (* code for ProcU *)
END;
BEGIN
... (* this code is executed before the main code *)
END.
PROGRAM UProg;
USES
PAS51 159
________________________________________________________
TestU;
VAR
AA: TA; (* known from TestU *)
BEGIN
...
ProcU; (* --- *)
...
END.
For variables or constants add IMPORT after the name and type, just
before ;
Another method, where you get the name itself exported, and which
may be used also in a main Pascal program is the following: Use the
attribut EXPORT, in procedures/functions just after this word,
otherwise after the type.
160 PAS51
________________________________________________________
If you are using a Pascal main program and only Pascal units, and
compiles from inside the IDE, the system will link all necessary
modules for you, and will also in most cases do the necessary
recompilation of units, where the source has been changed after last
compilation. If, however, you are using 1) include files in your units, or
2) modules written in other languages (for instance assembler or C) or
3) you have a long chain of units using each other and changes units
deep into the chain, the automatic compilation facility of the Pascal
compiler will not always work, use the .KPR project file facility.
If you are using more modules you are encouraged to to use the MAKE
facility of the integrated system. Write a .KPR project file.
1) In the first line not starting with a "-", the name of the main file with
extension .PAS followed by the names of all include files for that file.
2) In the next lines the names of the modules including the extension
.PAS followed by the names of all include files for appropriate module.
MYPROG.PAS INCLUDEF1.PAS
-X2000
MODULE1.PAS INCLUDEF.PAS INCLUDE2.INC
MODULE2.PAS
PAS51 161
________________________________________________________
When compiling or making a main program from within the IDE, the
system recompiles any changed uses units and then finally links the
appropriate files. If "make" was used, and before linking, the IDE
system looks for a .KPR file; if found, it further compiles/assembles any
extra file, found in there, and then links according to the .KPR file list.
If not using the IDE, you need to manually link the files.
or
LINK51 @<link-file>
The <link-file> must contain a list of all files to be linked, each file or
linker directive on a separate line.
When you get to the processor limit of 64 KBytes code, you are not
completely lost. SYSTEM51 Pascal offers you a solution, where you
may have programs up to 256 KBytes.
162 PAS51
________________________________________________________
To do this, you need to have some hardware that supports this. That
hardware should provide bankswitching of some upper part of your
code memory between different banks. The easiest border between low,
common code memory and upper banked memory is 8000H, but any
other limit may do, provided that low common memory has space
enough to hold 1) the main program, and 2) all interrupt routines, and
3) all runtime library routines included.
The code overlaying mechanism is based on units. Some units, declared
"overlay", will share upper code addresses, but will be placed in
different banks.
<n> is the bank number, in where you want the code to be placed.
To get the system know your specific software, you must modify the
routine ?SWITCHBANK in runtime library PL51.ASM (PL517.ASM)
to fit your hardware. When ?SWITCHBANK is called, the ACC
contains the new bank number; you must set your hardware according
to this.
If you use the Dallas Semiconductor 80C390, this processor has two
different ways of handling code memory > 64K; in version 6.5, only the
banked method is possible; to activate that method in SYS51W, you
must reassemble the file PL51.ASM after adding an additional
condition:
SWITCH390 GSET 1
(*$C+ or (*$C-
Comment terminate when long. Default on. If this directive
is on, comments can't be longer than 255 characters. This is
done for your comfort. When off, comments may have any
lengths.
(*$D-*)
No debug information is generated in the .OBJ and therefore
the .A51 file.
PAS51 165
________________________________________________________
(*$D+*) or (*$DS*)
Debug information concerning symbol names and types, and
character positions of pascal statement boundaries in the
code is generated into the .OBJ file and therefore into the
.A51 file. (Default and used by the simulator and DEBUG51,
but not INTEL standard)
(*$DEBUG51*)
Will generate debug information for KSC Software Systems
DEBUG51, version 5.0 or later by combining $D+ and $UI
directives. Can not be used for version 4.
(*$DL*)
Debug information concerning symbol names and line
numbers is generated into the .OBJ file and therefore into the
.A51 file. (INTEL standard and demanded by some
emulators, but not unambiguous)
(*$ELSE*)
Conditional compilation. See $IFDEF or $IFNDEF.
(*$F+ or (*$F-
Full 16 bit evaluation. In SYSTEM51 default off. In SYS517
default on. If on, bytes will always be expanded to 16 bit
before arithmetic operations. If off, 8 bit arithmetic
operations will occur between bytes as explained in chapter
15. The latter will give you efficient code, but may lead to
mistakes.
166 PAS51
________________________________________________________
(*$I<Includefile> *)
means including of some other source text file in
the main source text. The include-file must have
the extension .pas, but that extension must not be
given in the directive. he scanner of the compiler
will return to the main source when end-of-file is
met in the include file. Include files must not
contain include files themselves. As the order of
declarations of types, variables and procedures is
insignificant in PAS51, include file is a good tool
for modularity.
(*$ISn*)
Controls the amount of PUSHing/POPping at interrupt entry
/ exit. Be careful when using this directive. Only use it when
interrupt speed is essential and you are sure that your
PAS51 167
________________________________________________________
(*$LIBRARY
Generate a library source .ASM file. Must be placed before
any statements generating any code, including PROGRAM
or MODULE. For generating library files, please see
Appendix E.
(*$P<size>*)
Parallel process descriptors will be placed in the xdata
memory by TRANSFER and NEWPROCESS. <size> is your
maximal allowable stack plus 2 for your processes.
(*$R+ [n]*)
170 PAS51
________________________________________________________
(*$T+*)
means that Pascal-like extensive type checking is
performed throughout the compiling process
(default).
(*$T-*)
means that weaker type checking is performed:
Pointers are treated like WORDs, i.e. may be
added, subtracted or the like.
(*$U+*)
means that the compiler will generate a LJMP
instruction on every statement border in the
program. This may be used for debugging
necessary in certain debugging systems.
(*$U-*)
means no extra instructions generated. (default)
(*USING n*)
Sets the default register bank, used by all subsequent non-
interrupt functions/procedures to n.
If you have got only data memory in internal ram, it is some of an art to
get enough space for variables and stack. If you get into trouble, the
following might be done:
The (*$O proc1 directive is used to optimize the usage of internal RAM
space. If You as programmer know that certain procedure(s) or
function(s) proc2 will never call some other procedure(s) or function(s)
proc1, you may force the compiler to place the parameters and local
variables at the same RAM space by placing the directive (*$O proc1
just before the declaration of proc2. Indeed this compiler directive will
force variable allocation to proceed from the same address as proc1.
With the (*$O <address> directive, you may force internal ram
allocation to take place from the absolute address <address> no matter
what the compiler else has placed there. If you know the address, this
may be used as before, or you may use it to separately compile more
modules in the same or different languages.
PAS51 173
________________________________________________________
27.1 Errors.
The PAS51 compiler will try to calculate the maximal size of your stack
use. The stack in the 8051 is placed in the internal RAM. It is therefore
rather small. If you get a warning of possible stack overflow, don't give
up, but inspect your .asm and .pas file carefully. It is likely that you will
never exceed the stack size limit, but that the compiler just don't know
how you have intended to run your program.
174 PAS51
________________________________________________________
{$PX}; notice that mixed parameters in bit, data and xdata memory is
no longer possible like it was in earlier versions of the compiler.
The bits at (byte) address 32 are used for scratch-pad purposes by the
DEBUG51.
All other addresses are relocatably managed at link time. The only
space that the runtime packages will demand is 1 PUBLIC byte called
?STACKPTR containing the initial value of the stack pointer, in case of
external RAM present 1 PUBLIC integer called ?HEAPPTR,
containing the address of the first free address on the heap.
The stack will be placed in the first free DATA area, in case of a
processor type with high internal ram in the first free IDATA area.
If you use a target with high onchip data ram, no external data ram and
no separate modules (no public or import), then the compiler will
automatically shift variable address allocation from DATA to IDATA
when DATA is supposed to be full. In all other cases you must
explicitly declare variables IDATA, if you want them placed in high
onchip RAM.
PAS51 177
________________________________________________________
This chapter describes first the facts about how the Pascal version 5
parameter transfer works, and then gives you a cookbook of how to
implement it in practice. Please note that the version 5 way of para-
meter transfer is different from that of earlier version.
If you havn't set the compiler directive {$M cccc xxxx} where xxxx<>-
1, your default memory is "data", the chip internal 128 bytes data area.
Parameters will be placed in "data", with an offset >=0 to a position
178 PAS51
________________________________________________________
If you have set the compiler directive {$M cccc xxxx} to xxxx>=0, but
havn't set the {$R+ directive, parameters will be placed absolute in the
"xdata" memory with the same notation as in "data" memory, i.e.
relative to ?fkt?BYTE.
With the directives {$PD} and {$PX}, you might switch the parameter
memory. This may be necessary, if you want to interface to some third
party products.
If you set the compiler directive {$R+}, both parameters and local
variables are placed relative to a certain frame in xdata.
4) Edit that .ASM file, knowing that the compiler do not expect
any registers, not used for interfacing the function, to be
saved by you.
P0, P1, P2, P3, IP, PSW, B, IE, TMOD, TCON, TH0, TL0, TH1, TL1,
SCON, SBUF, PCON.
IT0, IE0, IT1, IE1, TR0, TF0, TR1, TF1, RI, TI, RB8, TB8, REN,
SM2, SM1, SM0, EX0, ET0, EX1, ET1, FS, EA, PX0, PT0, RX1, PT1,
PS, P, OV, RS0, RS1, F0, AC, CY, INT0, INT1, T0, T1.
The procedures write and writeln call a routine WRITC in I/O part of
the runtime library when writing a character. This routine may select 5
different ways to output that character.
Using the output serial device of the 8051 is default in write and writeln
and is implemented in a polled way. The code already existing in the
library may be described, although not implemented so, in the
following PAS51 procedure:
The serial channel and its baud rate generator is not automatically
initialized by the system. If the statement RESET or RESET(SERIAL)
is used before use of write(ln) or read(ln), then a standard setup is
executed, corresponding to the inclusion of the following pascal code:
For other setups, you may either include a modified version of the code
in your program, or you may modify and reassemble the file
IODRIVER.ASM, LIBRARY RESET.
PAS51 187
________________________________________________________
In case of a 11.0592 MHz clock CPU, the baud rate may be modified by
using:
Please notice that if you use a 8052 or 80C515/517 like processor, there
are alternative timers to TIMER1; you must program that yourself.
The procedures read and readln call a routine READC in I/O part of the
runtime library when reading a character. This routine may select 4
different ways to input that character.
Using the input serial device of the 8051 is default in read and readln
and is implemented in a polled way.
By using the {$LIBRARY compiler directive, you may build your own
libraries out of Pascal modules using the following steps:
If you want to make your own library MYLIB.OBJ file out of the Pascal
sources p1, p2 and p3, please follow the steps:
NAME MYLIB
$INCLUDE P1.ASM
$INCLUDE P2.ASM
$INCLUDE P3.ASM
END
The version 4 of the SYSTEM51 uses the same relocatable file format
as the INTEL PLM51. It is therefore in principle possible to link
PAS51.obj modules to PLM51.obj modules.
The data type WORD in PLM51 is stored msb first, whereas the data
types WORD or INTEGER in PAS51 is stored lsb first. To solve this
problem you may define and use the following function before
exporting or after importing to / from PLM51:
(************************)
(* *)
(* H E X L O A D *)
(* *)
(************************)
{$M 0 -1}
{ Must be changed to serve your hardware
}
program hexload;
var
adr: word;
procedure loadhex;
var
ch: char;
cs,count,number: byte;
procedure getch;
(* returns next character in ch *)
begin
read(ch);
end;
function hex: byte;
(* returns next hex pair of hex digits
*)
194 PAS51
________________________________________________________
var
bb: byte;
function nibble: byte;
begin
getch;
if ch>'9' then nibble:=ord(ch)-55
else nibble:=ord(ch)-48;
end;
begin (* hex *)
b:=nibble shl 4 + nibble;
cs:=cs+bb;
hex:=bb;
end;
begin (* loadhex *)
getch;
repeat
while (ch<>':') and (ch<>#27) do
getch;
(* ESC used as end_of_file mark *)
if ch=':' then
begin (* block to read *)
cs:=0;
number:=hex;
adr:=word(hex) shl 8 + hex;
count:=hex; (* dummy read hex *)
if number>0 then
begin
for count:=1 to number do
begin
xmem[adr]:=hex;
inc(adr);
end;
count:=hex; (* dummy read again *)
end;
end;
PAS51 195
________________________________________________________
Index
CMEM
Build-in array, 99
—2— Code
256 KBytes 256 KBytes, 166
Code, 166 CODE statement, 114
Code.
Embedded, 114
—A— Code-start, 172
Abs CodeWindow
ABSOLUTE,, 99 Simulator, 43
Active Comment, 93
Semaphores, 158 Compiler Directives, 93; 168
ADDR, 126 Concurrency, 142; 153
ARCTAN, 129 Constants, 100
ARRAY, 95 Constructor
ASCII, 94 COS, 129
Assembler, 74
Interfacing to, 181 —D—
Assembler Directives, 74
Assignment, 101 DATA, 98
AT DataWindow
Compiler absolute placement, Simulator, 43
99 Dec
Delete a character, 29
Destructor
—B— Device name, 104
Bank switching Directives
Overlay, 166 Assembler, 74
Beautify, 28 Compiler, 93; 168
BOOLEAN, 94 DISPLAY, 104
Breakpoints, 36
—E—
—C— Editor
C, 1; 91; 138; 140 Moving around, 26
Case Statement, 109 Embedded code, 114
CHAR, 94 Emulators, 73
Character constants, 92 Eof
CHR, 126 no, 103
PAS51 197
________________________________________________________
Eoln Inc
no, 103 Includefile, 170
Error Handling, 177 Inheritance.
Errors Object oriented programming,
SYS51C, 34 143
Examples Input, 102
Assembler, 80; 81; 84 Installation, 3
Exec INT, 127
Exit, 128 INTEGER, 94
EXP, 129 INTEL HEX
Expression, 101; 115 Linker generation, 86
External memory start, 172 INTERFACE
Units, 161
Interfacing
—F— to assembler or C, 181
For Statement, 111 INTERNAL, 98
Functions, 119; 123 Interrupt, 132
—G— —K—
GOTO, 115 keystrokes
editor, 26; 28
—H—
—L—
Hexadecimal
Pascal, 92 LENGTH, 126
HI, 126 Linker, 86
HighNib ListWindow
HllWindow Simulator, 43
Simulator, 43 LN, 129
LO, 127
LowNib
—I—
I/O, 106 —M—
ICE, 73
IDATA, 98 MARK, 138
If Statement, 108 Menues
IMPLEMENTATION Simulator, 38
Units, 161 Method
In Circuit Emulator, 73 Object oriented programming,
142
198 PAS51
________________________________________________________