Miscellaneous Information about Simulate ...... To Assembly Language info page. ... To Prof. Wade's information page

There are some instructions on using the Simulator in the file C:\SX\Simulate\SXSIM_Instr.DOC that can be found on the computers in Room D112 & 114. You can open it in word and look at it, however, please start the simulator through the icon supplied, not as described in the document.

Note: Chapter 5 and 6 of the SX-Key manual do a good job of describing how to use the SX Key assembler software. Chapter 5 covers the mechanics of the program. Chapter 6 covers a lot of the details of writing programs

  1. The Debug function of the SX-Key assembler will NOT run unless the hardware is plugged in and you should not try to use it. You should use only the Assemble function of the RUN menu except in class when you have hardware plugged in. To see how the programs run at home you can use the SX simulator program that is somewhat like Debug. One difference is that Debug presents a vertical listing of the registers and Simulate presents a horizontal listing.
  2. In order to to use the simulator program you need to produce a "list" file of your program with the ".lst" extension. You can do this with SX Key as follows. First write your program and assemble it (with no errors). Be sure to use FILE-SAVE AS to save your source file with a proper name. (We suggest a name of 8 letters or less so it will display properly when trying to run the simulator.) When you are ready to produce the list file toggle the list display (FILE-TOGGLE LIST ON) -- Your file name should show at the top of the display with the .lst extension. To save, just click on FILE -SAVE (not "save as") and it should save it with the proper name and extension. You can check this by looking at the name at the top of the display.

  3. --In the case that SX-Key always has added on the ".SRC" extension so the file was saved as XXXX.LST.SRC (where XXXX is the name you gave your file): Open up the folder the files are in. (Click on the "My Documents" folder on your desktop and then on the SX sub folder.) You should see the XXXX.LST.SRC file. Click (only once) on it to highlight it and then press F2 in order to edit the file name. Use the right arrow key to move to the end of the name and then backspace over the extra extension so it now is XXXX.LST only. [Or use any other method you find easier to change the extension to ".LST"]
    --When you open up the SX Simulator, your file should now appear in the list of available files to use with the simulator. Follow the on-screen instructions to run and exit from the simulator.
  4. If SX-Key wil not toggle into the list display, there is a syntax error in the program. Try RUN-ASSEMBLE for a better display of the error.
  5. The status of the I/O ports can be seen in Simulate. On the right hand side of the screen, just above the program section is a listing of the states of the output ports, RA, RB and RC:

  6. Example (your data may be different):
    PORT 
    RA
    RB
    RC
    TRIS  1111 11111111 11111111
    LATCH 0001 01110101 11011101
    PIN  0110 11110110 00100000
    --"TRIS" is the register which controls the TRIState gates which attach to the pins -- it is the direction register which attaches the pins as either inputs or outputs. A "0" in any TRIS bit configures the corresponding pin as an output. A "1" in any TRIS bit configures the corresponding pin as an input.
    --"LATCH" is the status of the data which has been sent to each bit of the port by the micro controller. When the pin is configured as an output that data will appear on the corresponding pin. When the pin is configured as an input the data is simply held in the latch.
    --"PIN" is the data appearing on the pin. When the pin is configured as an output that data will be the same as the data in the latch. When the pin is configured as an input, there is a way to apply input data to those pins in simulate. (This method is not covered here.)
  7. In SIMULATE the function keys are listed at the bottom of the screen. You can get a similar summary of the ALT-function keys by pressing ALT on the keyboard. See SXSIM_instr.doc for full information on the function keys.
  8. One important function key is ALT-F3 which toggles on a counter which shows how many times each line is executed. ALT-F10 will clear the counters (as well as all the registers and set the program counter to reset).
  9. When checking routines with multiple passes, they can be difficult to troubleshoot. Some suggestions: (A) modify the program to load "01" or "02" into delay registers so they will be quick to single step through and see what happens at each step. (B) Use the RUN command (F9) and the full counts but put a breakpoint at RETURN. Then you can read the time (and/or counts for each line) after each pass through the routine.
  10. You can set as many breakpoints in simulate as you wish. They are set in either of 2 ways: (A) just click on the line with the mouse, this will toggle a breakpoint on or off at that line. (B) Use the arrow keys to move the line highlight up/down to the proper line and press F2 to toggle a breakpoint on or off. Note that F3 will clear all breakpoints
  11. As a suggestion: When you are working on a program back and forth between SX-Key and simulate, do not close the dos window that simulate is running in or the window containing SX-Key. If you leave them both open you can just task switch between them if you want to make changes in the program. Note that you must SAVE the program from SX-Key in LST form and reload it into simulate since simulate takes the listing from the saved file and not from the screen you work on. Also you must quit (ESC) simulate and retype "SSX yourfilename" in order to reload a new program into simulate. (Do not type exit in the dos window until you want to close everything.)
  12. See the information page "Simulate_print" for more information on the screen capture function.
P.S. For your information: the programs (and manuals) we have given out are free software for educational use and so it is legal to have then on as many machines as you wish.
To top of page
-- Simulate_miscl.htm 1/20/02-dw