Operating Instructions

Using the Tiny EPROM Simulator is quite simple. It is only a matter of connecting it to the target system on one side and to the SB-Bus on the other side. Then it is only matter of sending an Intel HEX file to the device and the target processor will be restarted. This chapter will explain in detail how this is all done.

Connecting The Tiny EPROM Simulator

The main connection between the Tiny EPROM Simulator and the target system is made by a 28-way connector, replacing the EPROM in the target system. It is this connector that also takes care of delivering the power to the Tiny EPROM Simulator.
The standard adapter cable is intended to replace a normal 32kb EPROM of the 27C256 type. Other, smaller EPROMs can also be simulated if you create a suitable adapter cable. Please remember to ground all unused Address lines if you do build an adapter cable for smaller EPROMs.

Required connections to the target system There is one extra connection to be made between the Tiny EPROM Simulator and the target system. This will be the RESET line.
Usually the LOW active RESET signal is required. Most 8051 family members require a HIGH active RESET signal. The Tiny EPROM Simulator generates both RESET polarities simultaneously. It's up to the user to connect the proper polarity output to the RESET input of the target system. Please do not connect both to the same pin because that would result in a short circuit!
The target system's reset delay capacitor is usually the most suitable place to connect to the Tiny EPROM Simulator's RESET output.

The only other connection to be made in order to make the system operational is the SB-Bus. Simply connect one of the 2 SB-Bus connectors to any type of SB-Bus driver or SB-Bus cable. The other SB-Bus connector can be used to loop the SB-Bus through to other devices.

Powering Up

The Tiny EPROM Simulator borrows its power from the target system. This means that the Tiny EPROM simulator will be switched off as long as the target system is switched off.
The power consumption of the Tiny EPROM Simulator is quite modest at only 30 mA.

Remember that the memory in the Tiny EPROM Simulator is volatile, meaning that it will loose its contents when the power is removed. This means that there will be no valid program in memory when the target system is powered up. Therefore the Tiny EPROM Simulator will keep its RESET output active until a file is successfully uploaded to the device.

If you have to switch the target system off and on regularly this is not a desirable situation. In that case you could consider connecting a separate power supply to the system, isolated from the target system's power supply.

Also keep in mind that all other settings in the Tiny EPROM Simulator will be lost when the power is removed. The main one probably being the offset address.

File Upload

Once connected it is only a matter of selecting the Tiny EPROM simulator and uploading the program file.

Selecting the Tiny EPROM simulator is done by sending a byte with the value of 134 or $86 (default address) to the SB-Bus. The device should now reply with the OK prompt => .

Once selected, you can now give the WRITE command to initiate the file transfer. After this WRITE command the Tiny EPROM Simulator will accept a file formatted in Intel HEX format.
Each line of the Intel HEX file should start with a colon : , followed by a number of hexadecimal digits. You can find more information about the Intel HEX file format in my knowledge base. These lines may be as long as you like. The Intel HEX format allows a maximum of 255 bytes per line.
Due to memory constraints the data is immediately put into simulation RAM when it is received. This means that the lines can not be corrected anymore by sending back-spaces or Ctrl-X. This should not be a problem because these lines are always computer generated and a computer doesn't generate typos.
The Intel HEX file may contain comment lines. A comment line is a line which is starting with a quote ( ' ), double quote ( " ), exclamation point ( ! ) or a semi-colon ( ; ). Lines beginning with any of these symbols will be ignored by the Tiny EPROM Simulator.

Normally the data bytes are stored in the memory locations indicated by each Intel Hex line. So if the address of a particular line is e.g. $1000, the first data byte of the line will be stored at address $1000, the next one at address $1001, etc.
Only bytes in the address range from $0000 to $7FFF are stored in memory. All other addresses are ignored. Data bytes stored in other addresses are therefore discarded and will be lost for ever.
But what if the assembler started the program file at e.g. $8000 ? All bytes would get lost. This is obviously not something we want to do. Therefore you can set an address offset with the OFFSET command. If you set the offset to e.g. $8000, all program line addresses will be subtracted by $8000. So if the address of a particular line is e.g. $9000, the first data byte of the line will be stored at address $1000, the next one at address $1001, etc.
Please remember that the offset gets lost, together with all other data when the power to the target system is removed. The default offset address is $0000.
Only normal data lines in the Intel HEX file are processed by the Tiny EPROM Simulator (lines with flag $00). The upload mode is terminated when the End Of File line is received (flag $01). All other line types, like address or segment offset lines, are ignored by the Tiny EPROM Simulator.

The control of the target system's RESET signal is completely automatic. When the Tiny EPROM Simulator is just powered up its simulation memory will not contain a valid program. That's why the target system will be held in RESET until a program is uploaded to the system. Once a program is uploaded the RESET to the target system is deactivated effectively starting the freshly uploaded program.
You can send a RESET command to the Tiny EPROM Simulator, effectively pulsing the RESET output and restarting the target system again. This may come in handy because programs under development tend to buggy and may hang occasionally.
If, for any reason the uploading of the file is aborted, the RESET to the target system will remain activated. This will keep the target system in RESET until an new and complete program is uploaded.

Important note:

Design your I/O circuitry in such a way that no harm can be done when the target system is held in RESET! I mean this: If you are designing a missile launch system for instance, don't let the circuit activate the launch when the processor is held in RESET.
This may sound obvious in the ridiculous example above, but this is most often a failure that is overlooked at the design stage!
It is generally a good idea to ask yourself what happens if the system won't come out of the RESET state for any reason. This has nothing to do with the Tiny EPROM Simulator in particular.
Design your I/O in such a way that motors are stopped, fuel valves are closed, power amplifiers are switched off or set to minimum output, etc, etc, when the system is held in RESET.

Integrating With The SB-Assembler

Like I said it is also possible for the SB-Assembler to control the Tiny EPROM Simulator. If you do you can simply start the assembler and the resulting code will be uploaded to the target system instantly. The new program will be running once the assembler is finished.
This will only work with version 2 of the SB-Assembler, which runs on DOS and Windows machines only. Version 3, which is multi-platform capable, has no ability to send the target file to a COM port (yet).
Below you will find the necessary code to be placed somewhere in the beginning of your assembly program to make the automatic upload happen.

        .OR    $0000
        .CP    1,9600,N,8,1
        .TF    COM1:,INT
        .TW    #134
        .TW    /OFFSET $0000/,#$0D,#$0A
        .TW    /WRITE/,#$0D,#$0A

The first line simply sets the starting address of your program and may be changed to any appropriate value, as long as it is below address $10000.
The .CP directive sets the COM port parameters. In this case I assume that COM1 is used. You may change the first 1 in the parameter list to match your situation.
Now it's time to open the COM port by means of the .TF directive. Here you can change the parameter to match your COM port number again.
Then we send a byte with the value 134 directly to the target file (the COM port in our case). This will select the Tiny EPROM Simulator. Please note that the answers from the Tiny EPROM simulator are discarded for there is no way for the SB-Assembler to read the COM port.
Then we write the OFFSET command to the COM port with the proper offset value. In the example above the offset is $0000. The offset value should be the same as the value used with the .OR directive.
Finally we give the WRITE command which will initiate the file transfer mode on the Tiny EPROM Simulator.
The rest that follows is your program which will now be transferred directly to the Tiny EPROM Simulator.