 Help File for ST622 and ST626 programs

Contents

Program Start

Description

Creating a Project File

Menus

Toolbar

Status Bar

Port History

I/O Test

Edit EEPROM/Extra Ram

Input Signals Simulation

Miscellaneous

Other Features

Editing Assembler Code

File Conversion


 Description

Description

ST622.EXE is a simulation program for the following SGS Microcontrollers

ST6200 ; ST6201 ; ST6203 ; ST6208 ; ST6209 ; ST6210 ; ST6215 : ST6220 ; ST6225 Both in T Version and (where available) in  E Version

ST626.EXE is a simulation program for the following SGS Microcontrollers

ST6260 ; ST6263 ; ST6265 Both in T Version and (where available) in  E Version

The programs were written to obtain a good visual rendering with a video resolution of 640x480 pixels.

NOTE Before starting the program simulation, it is necessary to proceed with the creation of the Project File '.PRG'   (Creating a Project File)

ST622 and ST626  use the following Files

-  Filename.PRG	File generated by the program ST622.EXE or ST626.EXE

-  Filename.HEX	File generated by the AST6.EXE Compiler

-  Filename.DSD	File generated by the AST6.EXE Compiler

-  Filename .SIM	File generated by the AST6.EXE Compiler

-  Filename.CMD	Command file created by the user

Note 1 The  .PRG  and  .HEX  Files are Essential

Note 2 All Files, except the .CMD file, (Signals Simulation) must reside in the same directory

After Loading the program to be Simulated, the following 4 windows appear on screen:

a) Assembler Window 	-> displays the program Code

Line example

! > 0880 0DD8FE  reset   ldi   wdr,FEh

Description

!	(If present) Indicates Breakpoint

>	(If present) Indicates Next instruction

0880	Address

ODD8FE	Code

reset	(If present) Label

ldi  wdr,FEh	Instruction

b) Memory Window 	-> displays the content of the Micro's RAM

c) Variables Window 	-> displays the Variables/Registers if visible (Variables Visibility)

Line example

adcr	D1	40	64

Description

adcr	Name of the Register/Variable

D1	Address

40	Hexadecimal Value

64	Decimal Value

Note Clicking on the top Right button switches the

     display from Binary to Hexadecimal + Decimal

d) Registers Window 	-> displays:

- the STACK level

- the Interrupt level

- the status of the Flags

- the value of the PC (Program Counter)

- the values of Registers A ;X ;Y ;V ;W

When a program is loaded that contains data in ROM (which will be loaded via the dwr register starting from address 40H) it is normal that in the Assembler window the text * Invalid * is displayed on one or more instructions.

This is because the value in that location is NOT an instruction but Data.

In case * Invalid * is not displayed despite it being data, it means that (and this is the majority of cases) the data value coincidentally matches the code of an instruction.

Warning

In order for the simulator to correctly disassemble the .HEX file, it is necessary that the data blocks are placed at the end of the program just before the interrupt vectors as in the following example

.block	64-$%64	;to insert a table in ROM

dati	.byte	11111100b	;Data start

.	;Intermediate data

.byte	10011111b	;Last Data

.org    0ff0h	;Start of interrupt and reset vectors

jp      ad_int

.

.

Alternatively, if this is not feasible, it is possible to precede the routine that follows the data with two nop instructions as follows

.block	64-$%64	;to insert a table in ROM

dati	.byte	11111100b	;Data start

.	;Intermediate data

.byte	10011111b	;Last Data

nop	;nop instruction

nop	;nop instruction

etichetta	ldi     wdog,0FFh	;First instruction of the routine

.

.

The nop instructions will NOT alter the program's operation in any way (since they will never be executed); it is always possible to remove them for the final compilation before writing the program to the Micro.

Note

In the VARIABLES Window, when loading the program to be simulated, the Registers and Variables whose last 2 characters are '!m' are visible (Variables Visibility)

Example:

Dato	.def	084h!m	;Comment

(see also the 6215_reg.asm  and 6265_reg.asm files)

The names of the Registers in the 6215_reg.asm  6265_reg.asm  ST622.reg and ST6226reg files follow the nomenclature used in the SGS manuals

6215_reg.asm   6265_reg.asm	= Definition files to include in programs

ST622.reg    ST626.reg	= Definition file used by the ST622 and ST626 programs


Project File
 Project File (.PRG)

The project file contains information necessary for the Simulator's operation

To create the .PRG File, proceed as follows

1) First, create the .HEX  .DSD  .SIM Files by compiling the .ASM File

2) Start ST622.EXE or ST626.EXE and choose New Project from the File Menu

3) The first Window appears allowing the choice of Path and Name for the .PRG File to be created (it is recommended to use the same name as the .ASM File and select the same Directory where the .HEX .DSD .SYM Files are present)

4) As soon as the .PRG File Name is confirmed, a new window appears (see above) from which you choose the Micro type (top Left), the Micro frequency (top Right) and the Path and Name of the .HEX File (center)

The Browse button allows you to explore the disk to search for the desired .HEX File (this window is very similar to the one that allows entering the name, see point 3)

5) Confirm the entered data using the OK button

By clicking on the Preload EEPROM button at the bottom Left, it is possible (Only for ST6260-65 Micros) to edit the EEPROM content


 Menus

Menus

File Menu

Debug Menu

Run Menu

Ports Menu

Windows Menu

Variables Menu


 File Menu

File MENU

1) New Project

Used to create a new Project (Project File)) A File with the .PRG extension is created

2) Open Project

Used to start a simulation, the name of the .PRG file is requested

3) Edit Project

Used to edit an existing .PRG File Project (Project File)

4) Save ASM Code

Allows Saving the Code of the Assembler Window (Editing Assembler Code)

5) Write Input Data File

Writes to File (.CMD) all input events which include the data of the (optional) .CMD File + those entered directly from the I/O Test and Port History windows

6) Write Output Data File

Writes to File (.DAT) all output events processed by the Micro + those entered directly from the I/O Test window

7) Option Byte

Allows setting the 'Option Byte'

8) Edit EEPROM/Extra Ram (Only on ST626)

Allows editing the content of the EEPROM or Extra Ram

9) Exit

End of Work


 Debug Menu

Debug MENU

1) Breakpoint ON/OFF

Allows Inserting/Removing a breakpoint (at the cursor position)

2) Next Instruction

Allows Setting the Next Instruction (at the cursor position)

3) Edit ASM Code

Allows Editing the .ASM Code (Edit ASM Code)

See also:

Other Features


 Run Menu

Run MENU

1) Run

Starts the program in Fast Execution

2) Animate

Starts the Program in Slow Execution

3) Step Into (Execute Instruction)

Executes one Instruction

4) Step Over (Execute Sub)

If the current instruction is CALL executes the Subroutine, otherwise executes until the next RET or IRET instruction

5) Run to Cursor

Executes up to the cursor position (in the Assembler window)

6) Stop

Suspends the Program execution

7) Reset

Executes the Reset of the Micro and, if Input Data is enabled, reloads the optional .CMD File

8) Adjust Slow Speed

Allows varying (within certain limits) the speed in Slow Mode (Animate)


 Ports Menu

Ports MENU

1) Enable Input Data

Enables the input of external data, the name of the .CMD Command File is requested

N.B. Entering the Name can also be omitted and data can be entered directly in the I/O Test and Port History windows

2) Enable Output Data

Enables the output of data

3) Port History

Graphically shows the state of the pins as time changes (Port History)

4) I/O Test

Displays the current state of the Micro's pins (and relative registers) (I/O Test)


 Windows Menu

Windows MENU

Manages the Visibility of the windows


 Variables Menu

Variables MENU

Activates a dialog box that allows managing the visibility of Registers/Variables in the VARIABLES window

In the Left Window, NON-Visible Variables/Registers are listed

In the Right Window, Visible Variables/Registers are listed

The Remove and Add buttons Move the selected items between windows

With the OK button, the changes made are confirmed

If the CheckBox at the bottom Right is checked, the changes will be made permanent for future simulations as well (the .DSD File is modified)


 Toolbar

Toolbar Buttons

(From Left to Right)

For description see the relative Menu items

1)  Open Project (File Menu)

2)  Enable Input Data (Ports Menu)

3)  Enable Output Data (Ports Menu)

4)  Animate (Slow Execution) (Run Menu)

5)  Run (Fast Execution) (Run Menu)

6)  Stop (Run Menu)

7)  Step Into (Execute Instruction) (Run Menu)

8)  Step Over (Execute Sub) (Run Menu)

9)  Run to cursor (Run Menu)

10) Port History (Ports Menu)

11) I/O Test (Ports Menu)


 Status Bar

Status bar cells

(From Right to Left)

1) Current time in µs

2) By single-clicking on a cell of the Memory window

Location of the Variable/Register

3) By single-clicking on a cell of the Memory window

Name of the Variable/Register

4) Micro's working frequency

5) Type of Micro Used

6) Messages


 Port History

Port History

Activated from Ports Menu (Port History) or by the corresponding button (second from Right) on the Toolbar

you are asked to choose between Graphic and Numeric display

Numeric Display

In numeric mode, the value of the ports is represented numerically in various ways.

 Tempo  |HEX    PA      dt   |HEX     PB    dt   |HEX        ecc.

   50    22  xx+-0010    50    .      .     .      .

  100     .     .       .     00   00000000   100  .

  150    21  xx+-0001   100   10   00010000    50  .

Description

- The Tempo (Time) column 	displays the Time elapsed since the start of the Simulation

- The HEX	column displays the Port value (hexadecimal) according to the selections

made in the HEX box (top Left) as follows

Outputs   -> Value referred only to Outputs

Inputs -> Value referred only to Inputs

Both -> Total Value

None  -> The column is NOT displayed

- The PA PB etc. column 	Displays the state of the port bit by bit as follows

x = Pin NOT used

+ = High Input (1)

- = Low Input (0)

A = Analog Input

C = Start (or continuation) of Cyclic Input

c = End of Cyclic Input

1 = High Output

0 = Low Output

It is obvious that A represents only the type of the last received signal

- The dt	column Displays Partial Times if Partial Times in the top center box

is checked, otherwise the column is NOT displayed

All displayed data can also be saved to a File (default extension .DAT) by pressing the Button at the bottom Right

Graphic Display

Opens a window where the state of the Micro's Pins can be displayed graphically.

Allows:

Choice of Port to Display (Option Buttons top Left)

Choice of the window Width (in µs) (Lower Right Box)

(A direct value can be entered in the text box (max 10,000,000)

Choice of display Start Time (offset) (Lower Left Box)

(A direct value can be entered in the text box (max 10,000,000)

At the top Right (in digits) and on the window (vertical line), the current time is displayed

By Right-Clicking (and holding it) on the graph, a vertical line appears (and a digit at the top Right (below the previous one) representing the time relative to the line's position)

The graph is represented with:

Green Line for digital input signals (Dark Green for cyclic signals)

Numeric Value for Analog input signals

Red Line for output signals

Graph Editing

Graph editing can be done after activating Edit in the top center box (naturally after enabling input data (Ports Menu)

For input signals editing is possible as follows:

a) By positioning the mouse at a 0-1 state change, a vertical arrow is displayed which (by holding down the Left Mouse button) allows it to be moved.

Keep in Mind That if Limited (In the Top Center Box) is Not checked, in case of overlap with adjacent signals, the latter will be removed

b) By Clicking on the graph (not at a state change), a state change is inserted.

c) By Double Clicking on the graph (at a state change), the state change is removed

Note  If the Click (or Double Click) is done before the last change, 2 changes are inserted (or removed)

For cyclic input signals editing is possible as follows:

a) By positioning the mouse at the start or end (if it exists) of the pulse train, a vertical arrow is displayed which (by holding down the Left Mouse button) allows it to be moved.

Keep in Mind That if Limited (In the Top Center Box) is Not checked, in case of overlap with adjacent signals, the latter will be removed

b) By Clicking on the graph inside a pulse train:

1) In the case of an endless pulse train, a dialog box will appear asking whether to interrupt the train or modify the period.

2) In the case where the pulse train has an end, it is possible to modify the Period.

c) By Double Clicking on the graph at the start or end (if it exists) of the pulse train (when a vertical arrow is visible):

1) By Double Clicking on the end (if it exists), the End is removed (and therefore the cyclic signal will then be endless) and all other signals eventually present after the end itself

2) By Double Clicking on the start, the train is removed

See also:

Input Signals Simulation


 I/O Test

I/O Test

Activated from Ports Menu (I/O Test) or by the respective button (first from Right) on the Toolbar

Opens a window displaying the current state of the Pins (Micro pinout on the left side) and relative Micro Registers (in the Boxes on the Right)

In the Timer Box (if present), bits 4(DOUT) and 5(TOUT) of the TSCR Register (address D4h) are represented

In the ARTimer Box (if present), bits 0(ARMC0) and 1(ARMC1) of the ARMC Register (address D5h) are represented

If changes are made, confirmation of the variation is requested (If it involves Input Lines and Data, the insertion Time is also requested)

Note It should be noted (see also the screenshot above) that in the case of Input configuration, the appearance of the pins may be different from the value of the DRA, DRB, or DRC Register

When the pin is configured as an input, the value returned in the I/O Window (but also with Ld  jrr jrs instructions) will be:

1) In the presence of a Signal (.CMD File) 	-> The Signal Value (0 if analog)

2) In the Absence of a Signal with configuration:

     a) Input Pull-Up	-> 1

     b) Input No Pull-Up	-> 0

     c) Analog Input	-> 0

Naturally, in the case of an Analog Input in the presence of an Analog signal (CMD File), the value will be returned in the adr register at the time of conversion


 Miscellaneous

Stop and Wait Instructions

When a Stop or Wait instruction is encountered, the program automatically enters fast execution and maintains it until exiting the Stop or Wait state to resume the previous speed.

Naturally, it is always possible to stop execution with the STOP button


Edit EEPROM
 Edit EEPROM/Extra Ram

Editing the content of the EEPROM/Extra Ram (Only for ST626)

By choosing Edit EEProm/Extra Ram from the File Menu or during Project Creation or Editing (Preload EEPROM Button), the window above appears, allowing the Editing of the Micro's EEPROM/Extra Ram Content

It is Possible to:

a) Fill the EEPROM/Extra Ram entirely with a desired value (Fill Button)

b) Edit a single cell by Double Clicking on the cell to edit

In Both cases, the input of the new value will be requested


Signals Simulation
 Input Signals Simulation

Input Signals Simulation

Input signals can be simulated by creating a Text File with a .CMD extension using any Text Editor (the DOS Editor is fine)

CMD File Format

The CMD File is a text file with the following format:

PA4 I 0 1234

PA4 I 1 1222

PB2 C 50 250

PB2 C 0 500

PB2 C -20 100

PB3 C 20 300

PB3 C 0 1000

PB3 I 1 150

PB3 I 0 200

PA4 I 1 1111

PB0 A 155 1234

TIM I 1 2000

NMI I 0 325

RES I 0 1500

Description:

PA4;PB0;TIM;NMI;RES  3 Characters Identifies the Port (TIM=Timer RES=Reset)

Space                1 Character (ASCII character 32)

I ; A ; C            1 Character I=Digital Input A=Analog Input C=Cyclic Input

Space                1 Character (ASCII character 32)

0 ; 155 ; 1          Input value (155 analog value 0-255)

Space                1 Character (ASCII character 32)

1234 ; 1222  etc     Time

Note For the same Port, time is intended as time elapsed since the last data

Observations on cyclic input

Format

<Port><Space><C><Space><Period><Space><Time>

Period is an Integer number representing the time (in µs) in which the signal will be high and low (so a high-low cycle will last 2*Period)

If Period is Positive the signal will start with value 1

If Period is Negative the signal will start with value 0

If Period is Zero the signal will end (naturally a command with Period=0 can be entered After entering a command with Period <>0)

Time is an integer number indicating the moment (see note above) of the start (or end) of the signal

Multiple pulse trains can also follow each other on the same port

After the end of the last pulse train, 'Normal' Signals I or A can also be entered

In the Example above

Port PB2

- Receives a Cyclic signal with period 50 µs starting with high pulse after 250 µs

- The Cyclic signal ends after 500 µs

- Receives a Cyclic signal with period 20 µs starting with low pulse after 100µs that lasts forever

Port PB3

- Receives a Cyclic signal with period 20 µs starting with high pulse after 300 µs

- The Cyclic signal ends after 1000 µs

- Receives a High signal (I) after 150 µs

- Receives a Low signal (I) after 200 µs

See also:

Port History


 Other Features

Other Features

1) By Double Clicking on the Assembler window, a window appears with which it is possible to:

a) Insert/Remove a breakpoint (at the cursor position)

b) Set the Next Instruction (at the cursor position) (to be used with extreme care)

c) Edit the .ASM Code (Edit ASM Code)

d) Exit without performing any action

2) By Double Clicking on the Registers window (NORM Flags ; INT Flags ; NMI Flags) a window opens allowing the Display/Editing of Flags

3) By Double Clicking on the Registers window (A ; X ; Y ; V ; W) or on the Variables and Memory Windows, a window opens allowing the Display/Editing of Registers/Variables

4) By Clicking on the Memory window, the Name of the Variable/Register and its relative memory Location are displayed on the Status Bar


Editing Assembler Code

Editing ASM Code

By double-clicking on the Assembler window and selecting Edit or by selecting Edit from the Debug menu, a window appears allowing you to choose whether to Insert, Edit, or Delete a line of code.

Editing the code may Imply the redirection of instructions.

In the case of code 'shortening', it is possible to choose to replace the freed memory locations with 'nop' instructions.

In the case of code 'lengthening', it is possible to choose to delete any subsequent 'nop' instructions to recover memory locations.

However, keep in mind that:

1) The program presumes that the entered instructions are correct

2) It is not permitted to lengthen or shorten the code between locations FF0h and FFFh because the 'interrupt' and 'reset' vectors are located between these locations.

3) In the case of data in ROM memory, their addresses CANNOT be changed, so the program, upon the first "Editing" request, Asks for the Label Name (or address) of the first Data in ROM

4) In the case of code 'lengthening', attention must be paid to the offset of jump instructions (especially those with a maximum jump of 16 bytes) which with such lengthening could exceed the maximum allowed jump (in this case the simulation can still continue but during the recompilation of the modified .ASM File it will cause an error)

Once changes are Complete, it is possible to save the code (File Menu) keeping in mind that:

1) Modified or inserted Lines are recognizable because their HEX code is replaced with '---' (whose length is proportional to the code length)

2) Deleted lines are moved to the end of the file

The resulting File will have a .TXT extension and can be used as a guide for editing the original .ASM File


 File Conversion

Conv.EXE

It might be useful, after obtaining a .DAT (File Menu) file from a simulation, to use the signals of this file as input for a subsequent simulation.

The Conv.exe program allows creating, even redirecting the signals to another port, a .CMD File starting from a .DAT File (but also a .CMD)

After loading the 'source' File, and clicking on the desired 'source' Port (on the Left windows), choose the destination port from the central list and the program will display the chosen port on the corresponding Right window.

If desired, only some of the ports of the 'source' File can be used.

At the end of work, choose from the File Menu - Save .CMD File and the file will be saved with the chosen name and path.


Start
 Startup Screen

ST6.EXE

Click with the mouse on the button whose action you want to know


Starting the ST622 Simulator (Description)


Starting the ST626 Simulator (Description)


Starting the Conv.EXE File Converter (File Conversion)


Starts the Help File