(main) 1. Introduction 2. Getting Started Installation Connecting Writing Code Code Example vNet Support Assembling Code 3. Execution and Debugging Execution Register Selection and Debugging Halting Code 4. Conclusion 5. Acknowledgements
Visual Asm Environment for 80C196KB
Developer’s Guide
Copyright 1997
Anurag Sharma
Ted Bonkenburg
The Visual Asm Environment for 80C196KB has been developed to ease the creation of assembly programs for a micro-controller (specifically the Intel 80C196KB). The main feature of this product is that it enables programmers to develop and debug applications for a micro-controller via the internet. Applications developed with this environment are fully compatible with the vNet protocol. For extended information on the vNet protocol and its use, please refer to the vNet Protocol Developer’s Guide.
The Visual Asm Environment provides support for code generation and editing, as well as an assembler tool and some debugging features. Within this environment, a programmer is able to fully design, create, and debug an assembly language program with vNet capabilities, without ever requiring any additional tools. In addition, this whole process can be performed through a web browser or as a stand-alone application from any location with access to the internet (or running off a localhost). To support the Visual Asm Environment client, all that is required is a proxy server (running on Windows NT 4.0 or above) connected via serial link to a running micro-controller. A web server may also be needed if the user chooses to run the client as an applet. Due to Java security constraints, the web server needs to be located on same machine as the proxy server.
Installation: In order to use the Visual Asm Environment, a few things need to be initialized. The micro-controller must be connected to the host PC via a serial cable to COM2. The assembly "bootstrap" program, serial.obj must be loaded onto the micro-controller using the Intel provided program ECM96. The asm program must then be executed, and ECM96 terminated (this may require setting a jumper on the 8096 Evaluation Board that disables the UART reset assert, so that the "bootstrap" continues to execute after ECM96 terminates).
Once the "bootstrap" program is executing, the proxy server must be started. The proxy server will automatically attempt to initialize the serial connection and the TCP/IP connection. If either of the attempts fail then the host system must be checked for configuration or hardware errors.
With the above tasks accomplished, the Visual Asm Environment server end is ready for connection. If the Visual Asm Environment is to be distributed as a Java applet, then a web server must be set up and configured to serve the applet. Although not difficult, this is beyond the scope of this document, and should be left up to the system administrator.
Connecting: After starting the Visual Asm Environment client, the user must connect to the proxy server. This is done by entering the IP address or hostname of the proxy server in the "Hostname Address Field" and pressing the button labeled "Connect". If a proper connection has been established, the button should change to "Disconnect" and the "Output Area" at the bottom of the window will show the appropriate message.
Writing Code: There are two ways to get started on writing code. The first way is to use the code provided when the Visual Asm Environment initializes. This is the same code that is produced when using the "New" menu item under the "File" menu. It is a bare and simple assembly skeleton that provides no support for interrupts. The user must note that the lowest register segment (rseg) can be declared at 60H and the lowest code segment (cseg) starts at 3000H. Also, the default interrupt routines are declared in advance. If these are removed, assembly errors will result.
The second method for getting started is to use the "Code Wizard" menu item, which is located under the "File" menu. This presents the Code Wizard in the bottom of the window. Here choices for interrupt routines (which the user will write code for) can be made. On pressing the "Generate Code" button, the Code Wizard will generate a more advanced assembly skeleton that contains commented code with outlines for the selected interrupt routines. For example, if the Code Wizard generates code with interrupts "int03" and "int11" enabled, the following code is generated:
$EP PL(79) PW(115) NOSB DB $include(vSetup.inc) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;Wizard: User decls starting at 60H ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; rseg at 60H ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;Wizard: User code seg starting at 3000H ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; cseg at 3000H ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;Wizard: User code goes here ;;;; DO NOT disable int08 and int09 ;;;; in int_mask1 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; orb int_mask1, xxxx ;replace xxxx with int. masks ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;Wizard: Code for int03 (hso_event) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; int03: pusha popa ret ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;Wizard: Code for int11 (timer2_capture) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; int11: pusha popa ret ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;Wizard: WARNING do not modify ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; cseg at 7FE2H int00: br $ int01: br $ int02: br $ int04: br $ int05: br $ int06: br $ int07: br $ int10: br $ int12: br $ int13: br $ int14: br $ end ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;Wizard: End code ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
vNet Support: The Visual Asm Environment provides a set of 16 word registers, ranging from vR0 - vR15. These can be used by the programmer freely in the assembly program as long as "vSetup.inc" is included. Besides being useful general purpose registers, these register are also visible through the vNet protocol. Using vNet, their values can be both seen and modified over the internet. In this fashion, code produced using the Visual Asm Environment is fully compliant with the vNet protocol.
Assembling Code: After editing code, the user can assemble it by selecting the "Assemble" menu item under the "Project" menu. This action runs the ASM96 assembling tool on the host machine. The output window on the bottom of the main window is automatically called up and updated with the results of the assembly. The Visual Asm Environment will not execute a program until the assembly returns no errors.
Execution: Once assembly is successful, the "Execute" menu item under the "Project" menu becomes available. Using this menu item will cause the object code to be downloaded to the micro-controller by the proxy server and execution will begin.
Register Selection and Debugging: Under the "View" menu, the "Register Selection" menu item allows the user to select any of the vR(xx) registers for viewing. After the desired registers are selected, the user can toggle the "Debug" menu item under the "Project" menu. This puts the Visual Asm Environment in debug mode and automatically displays the "Registers View Window" in the bottom of the main window. The "Registers View Window" displays all 16 of the vRxx registers and also has a scroll bar which can be used to set the register refresh rate. When debug mode is on, the values of those registers which have been selected by the user will be continuously updated at the selected refresh rate. The identity of the current register being updated will be displayed in the lower right-hand corner. The debug mode does not affect code execution, although querying the registers at a high rate may cause it to slow down. Also, to enable the other items in the "Project" menu, the debug mode must be toggled off.
Halting Code: The "Halt Execution" toggle under the "Project" menu halts the code execution while saving the state of the program (it will resume exactly where it left off when this option is toggled off). Upon halting, the registers selected by the user in the "Register Select Window" become editable in the "Registers View Window". This presents the programmer with the option to actually modify the values of the chosen registers before resuming program execution. Therefore, the programmer can affect program execution in almost any manner. Just before execution resumes, the new values are downloaded to the micro-controller through the proxy server.
Before developing with the system, the programmer should be aware of a couple of caveats: The serial transmit and receive interrupts (int08 and int09) are not available and cannot be used. They are reserved for the "bootstrap" asm program, and should never be disabled or masked out. Also, malicious code can easily bring the entire system down. Therefore, the development team requests that programmers do not load values into int_mask1. Instead, values should be or’d into int_mask1 (preserving the serial interrupts). The Visual Asm Environment is meant to be a helpful application when programming for a micro-controller. However, its greater purpose is to be used as an aid in developing micro-controller programs that make use of the net with the vNet protocol.
The development team would like to acknowledge Intel Corporation for the use of the ECM96 RISM Monitor and ASM96 assembly tool. They would also like to thank Ken Andrews for the lst2hex software which strips object code from a .lst file, and his freeware assembly code which assisted in downloading object code onto the micro-controller.