Sim68K - Basic Operation
A 68000 program can be executed by starting the simulator manually and loading a 68000 S-Record (.S68) file or by clicking the "Execute" button after assembling a 68000 Source file in Edit68K. A batch file may also be used to automatically load and run a 68000 .S68 file. See Running a Program From a Batch File below.
Open - Loads a 68000 program from S-Record (.S68) file into the simulator's 68000 memory space and initializes the simulator environment.
Open Data - Loads a 68000 data from S-Record (.S68) file into the simulator's 68000 memory space without changing the simulator settings.
Close - Clears the current program from the display.
Printer Setup... - Setup the printer used for simulator output. See help for Simulator I/O task 10 for more information.
Once you have loaded a program, the simulator will look similar to the following window:
Note: If no matching "Listing" (.L68) file is available, no code will display in the code window.
Set the Program Counter (PC) to the desired starting address by manually entering the address into the PC field or by double clicking on the desired line of program code. By default the PC is set to the starting address of the program. You may also change any of the 68000's other registers at any time while the simulator is in Stop or Pause mode.
All numbers in the registers are displayed using Hexadecimal notation except the Status Register which is in Binary.
The registers displayed are as follows:
D0= ... D7= Data registers
A0= ... A7= Address registers
SR= Status register
US= User Stack (The user
stack is the same as A7
when the S bit in the Status Register is set to 0).
SS= System Stack (The
system stack is the same as A7
when the S bit in the Status Register is set to 1).
PC= Program Counter
Cycles displays the estimated cycle time required for the previously
executed instructions. The cycle counter does not take into account pipeline
efficiencies. The cycle number displayed tends to be a worst case value and is
only intended for relative comparison purposes. Trap
tasks 30 and 31 may be used to clear and read the cycle counter from
a program.
Run
To run the program, select Run from the Run Menu, press F9 or click the Run
button on the toolbar. Sim68K begins executing the 68000 program at the current Program Counter location.
Program execution will continue until one of the following occurs:
- The program reaches a STOP instruction.
- The program reaches a user placed Break-Point
- The user Pauses the program.
- The user Resets the simulator.
- An exception occurs.
Run
To Cursor - Program execution will continue until the Program Counter reaches the Cursor
line (highlighted line) or until any of the stop conditions listed above in the
Run command occurs. Run To Cursor
may be selected from the Run Menu or by pressing
Ctrl-F9 or by clicking the Run To Cursor button.
Auto Trace - Automatically activates a Trace Into at the
specified time interval. The time interval may be adjusted by selecting Auto
Trace Options in the Options menu.
To start Auto Trace, select Auto Trace from the Run Menu, press F10
or click the Auto Trace
button.
Step Over - Executes the current instruction and positions the Program Counter at the
instruction in the next line. If the current instruction is a JSR or BSR the
subroutine is completely executed and the Program Counter is placed at the
instruction following the JSR or BSR.
To Step through a program, select Step Over from the Run Menu, press F8 or click the
Step Over
button.
Trace Into - Executes the current instruction and positions the Program Counter at the
next instruction to be executed. If the current instruction is a JSR or BSR the
program counter is placed at the first instruction of the subroutine.
To Trace through a program, select Trace Into from the Run Menu, press F7 or click
the Trace Into
button.
When Tracing or Stepping through a program, the next line to be executed is highlighted as shown above.
The Auto Trace, Trace and Step buttons will be disabled if the program is waiting for input.
Pause
Pauses program execution and enables the menus. To Pause a running program select Pause from the Run Menu, press F6 or click the Pause button.
Rewind
Program
Clears the Output Window, clears the 68000 registers and places the Program Counter at the beginning of the program. To Rewind a program select Rewind Program from the Run Menu, press Ctrl+F2 or click the Rewind Program button.
Reload Program
Reloads the last program into the simulator, clears the Output Window, clears the 68000 registers and places the Program Counter at the beginning of the program. To Reload a program select Reload Program from the Run Menu, press Ctrl+F3 or click the Reload Program button.
Log
Start
Starts logging. See Options for help on configuring
the log types.
is
displayed on the toolbar when logging is in progress.
Log Stop
Stops logging. See Options for help on configuring the log types.
Running a Program From a Batch File
Batch files may be used to start Sim68K,
load a 68000 .S68 program and set several simulator options. The following
command line arguments are recognized by Sim68K for this purpose:
The first argument must be the name of the 68000 .S68 file to load followed by
the optional arguments:
/f Full Screen
/e Enable Exceptions
/r Run
/b Enable Bit Field Instructions
For example, if a file named easyzone.bat is created that contains the following
text:
"c:\easy68k\SIM68K" easyzone.s68 /r /f /e
The 68000 program easyzone.s68 would be loaded into Sim68K and run in full
screen mode with exceptions enabled. This example assumes SIM68K is located in
"C:\easy68K" and also assumes easyzone.s68 is located in the same folder as the
batch file.
=== Search Menu ===
Press Ctrl+F or select Find... from the Search menu to open a find dialog. Find searches the code window for the specified text. The search is not case sensitive and will match partial words. The corresponding line in the code window will be highlighted if the search text is found. Press Ctrl+G or select Go to PC from the Search menu to return to the Program Counter location in the code window.
=== View Menu ===
Use the View menu to select between the different Sim68K windows. You may also press Ctrl+Tab to cycle between the currently active simulator windows. The EASyBIN selection will start the EASyBIN application if the EASyBIN.exe file is located in the same folder as Sim68K.
=== Output Window ===
To see what your program has displayed, select the View menu and then click "Output Window"
The output window also serves as a way to enter data into your program. See Text I/O
=== Simple breakpoints ===
A breakpoint is used to halt a program. You can place a simple breakpoint in the your program by clicking the green dot next to the line of code you want to break at.
Once set, the dot will turn red as shown:
You may clear the breakpoint by clicking the dot again.
When the program reaches the breakpoint it will halt prior to running the instruction at the breakpoint. The contents of the 68000 registers are displayed and may be modified. The program may be resumed using the Run button or using Trace and Step. The breakpoint remains active until removed.
=== Embedding breakpoints in the source ===
Breakpoints may be embedded in the 68000 source file using the following form:
*[sim68k]break
Any source line that begins with the above text will
automatically set a PC breakpoint on the following line of code when loaded into
Sim68K.