ROCKWELL R6500 MICROCOMPUTER SYSTEM

TIM MANUAL JUNE, 1977 DOC. NO. 29650N32 REVISION: 0

TIM TERMINAL INTERFACE MONITOR MANUAL

ABSTRACT
This document describes an assembler program for the Rockwell R65XX
family of CPUs. This program, called "Terminal Interface Monitor (TIM),"
is contained on an R6530-004 ROM which is designed to interfacewith a
TTY1 EIA terminal. The document also details configuration of the system
needed and its operation.

Rockwell International

Rockwell International Corporation, 1977 All Rights Reserved Print in U.S.A.

$2

Rockwell Microelectronic Devices P.O. Box 3669 Anaheim, CA 92803

R6500 MICROCOMPUTER SYSTEM MONITOR SUPPORTING DOCUMENTATION

Doc. No. Title 29650N30 R6500 Microcomputer System Programming Manual 29650N31 R6500 Microcomputer System Hardware Manual 29650N50 R6500 Microcomputer System Instruction Set Summary

SALES OFFICES


TABLE OF CONTENTS

Page CHAPTER 1 INTRODUCTION ......................................... 1-1 CHAPTER 2 SYSTEM CONFIGURATION ................................. 2-1 CHAPTER 3 OPERATIONAL FEATURES OF TIM .......................... 3-1 A. TIM Commands .................................... 3-1 B. TIM Interrupt and Breakpoint ...................... 3-3 C. TIM Monitor Calls and Special Locations ........... 3-4 D. TIM Memory Usage .................................. 3-5 CHAPTER 4 TIM CHECKOUT PROCEDURE ............................... 4-1 APPENDIX A - MEMORY ADDRESS TEST ................................ A-1 APPENDIX B - TIM PROGRAM LISTINGS ................................ B-1
iii

iv

CHAPTER 1

INTRODUCTION

TIM is the Terminal Interface Monitor program for Rockwell's R65XX-series microprocessors for the R6500 Microcomputer System. TIM is supplied in read- only memory (ROM) as part of the R6530-004 multifunction chip. Because the TIM code is nonvolatile, it is available at system power-on and cannot be destroyed inadvertently by user programs. Furthermore, the user is free to use only those TIM capabilities which he needs for a particular program. Both interrupt types, interrupt request (IRQ) and nonmaskable interrupt (NMI) may be set to transfer control to TIM or directly to the user's program. TIM communicates with the user via a serial full-duplex port (using ASCII codes) and automatically adjusts to the speed of the user's terminal. Any speed (up to 300 Baud)--even nonstandard ones--can be accommodated. If the user 5 terminal has a long carriage return time, TIM can be set to perform the proper delay. Commands typed at the terminal can direct TIM to start a program, display or alter registers and memory locations, set breakpoints, and load or punch programs. If available in the system configuration, a high-speed paper tape reader may be used to load programs through a parallel port on the R6530-004 chip. Programs may be punched in either of two formats-- hexadecimal (assembler output) or BNPF (which is used for programming read-only memories). On loading or modifying memory, TIM performs automatic read-after- write verification to ensure that addresses memory exists, is read/write type, and is responding correctly. Operator errors and certain hardware failures may thus be detected using TIM. TIM also provides several subroutines which may be called by user pro- grams. These include reading and writing characters on the terminal, typing a byte in hexadecimal, reading from high-speed paper tape, and typing a carriage- return, line-feed sequence with proper delay for the carriage of the terminal being used. Program tapes loaded by TIM may also specify a start address so that programs may be started with a minimum of operator action.
1-1

1-2

CHAPTER 2

SYSTEM CONFIGURATION

Since TIM is a "program" resident in the R6530-004 it must be properly configured in a proper system environment. Figure 2-1 represents a block diagram of a minimum system utilizing the TIM program. The R6502 is the controlling microprocessor with two pages of memory (pages 0 and 1) representing the minimum RAM requirement. These devices, as well as a representative schematic for the TTY, EIA interfaces, are shown in Figure 2-2 which is a detailed system schematic utilizing the R6530-004. Note that the TIM function select equations are found on this schematic.
2-1

figure2-1 * Note that the TIM as sold consists only of the R6530-004 component accompanied by supporting information to build this system Typical Minimum Configuration for "TIM" System FIGURE 2-1 2-2

fig 2-2 This figure is shown here at ¼ of it's quality but gives a good printout. 2-3

2-4

CHAPTER 3

OPERATIONAL FEATURES OF TIM

A. TIM COMMANDS *

Command Description Set line speed. After RESET, a carriage return is - typed to allow TIM to measure the line speed. .R Display user registers. The format is: PC P A X Y S. where: PC is the program counter P is the processor status A is the A (accumulator) register X is the X (index) register Y is the Y (index) register S is the stack pointer low byte (high byte is always 01) .G Go. Begin execution at user PC location (see R command). .M addr Memory examine. TIM will display the eight bytes beginning at address addr. .: ADDR data Alter registers or memory. TIM allows the user to alter registers (if R command precedes) or memory (if M command precedes). Values for registers or memory locations which are not to be changed need not be typed. These fields may be skipped by typing spaces instead of data. The remainder of the fields in a line may be left unchanged by typing carriage return. The : command may be repeated to alter subsequent memory locations without the necessity of typing intervening M commands. Note that TIM automatically types spaces to separate data fields.
* Characters typed by the user are underlined. All other characters are typed by the computer. means carriage-return. The monitor types a period (.) as a prompting character.
3-1

.LH Load Hexadecimal. TIM responds with carriage return, line-feed and loads data in assembler output format from the terminal or high-speed paper tape reader. The format is: Zero or more leading characters except ";" (usually blank leader) Any number of records of the form: ;ccaaaadddd....ddssss where: cc is the number of bytes in the record in hex. aaaa is the hex address to store the first byte of data. dddd....dd is the data (two hex digits per byte). ssss is the check-sum, which is the arithmetic sum, to 16 bits, of all the count, address and data bytes represented by the record. A terminating record of zero length, either: ;00 or ; Note that read-after-write and check-sum tests are per- formed. An error will result in a "?" being typed at the point the error occurred. Data from records with bad checksums is deposited in memory as received, prior to the error stop. .H High-speed/low-speed reader switch. This command switches the load device from the user's terminal to the high-speed reader or vice versa. .WH addl addh Write Hexadecimal. An assembler-format tape is gener- ated at the user's terminal. Format is as described above in the LH command description. Note that the address range must be specified with the lower address first. As in the Alter command, TIM types the space between the address fields. .WB addl addh Write BNPF. A BNPF format tape is generated at the user 5 terminal. Format is one or more records as follows: aaaa BddddddddF BddddddddF BddddddddF BddddddddF where: aaaa is the address of the first of the four bytes specified in the record. (Note: BNPF conventions require that the letter "B11 never occur in the address field. Blanks are substituted by TIM.)
3-2

B is the letter "B", meaning begin data. dddddddd is eight data bits-P for logical true, N for logical false. F is the letter "F", meaning finish. Note that the BNPF format is output as multiples of four bytes. Thus, a multiple of four bytes will always be punched even if a non-multiple of four bytes is specified. Cancel Command. while typing any command, its further effect may normally be terminated by typing one or two carriage returns, as required. During alter (:), carriage return means that no further bytes (or registers) are to be altered.

B. TIM INTERRUPT AND BREAKPOINT

BRK The BRK instruction causes the CPU to interrupt execution, save PC and P registers on the stack, and branch through a vector at locations FFFE and FFFF. TIM initializes this vector to point to itself on RESET. Unless the user modifies this vector, TIM will gain control when a BRK instruction is executed, print an asterisk "*" and the registers (as in R command), and wait for user commands. Note that after a BRK which vectors to TIM, the user's PC points to the byte following the BRK; how- ever, users who choose to handle BRK instructions themselves should note that BRK acts as a two-byte instruction, leaving the PC (on return via RTI) two bytes past the BRK instruction. IRQ Interrupt Request is also vectored through location FFFE. The CPU traps (as with BRK) through this vector when IRQ goes low, provided interrupts are not inhibited. Since this vector is the same as for BRK, TIM examines the BRK bit in the P register after this type of interrupt. If a BRK did not cause the interrupt, then TIM will pass control through the UINT vector. Users should normally put the address of their interrupt service routine in the UINT vector location. If an IRQ occurs and UINT has not been set by the user, TIM reports the unexpected interrupt in the same way as in NMI (see below).
3-3

NMI Non-Maskable Interrupts vector through location FFFA. TIM initializes this vector at RESET to point to itself. If an NMI occurs, a pound-sign character (#) precedes the asterisk and CPU registers printout). This action is the same for IRQ1s if the user has not set this vector to point to his own routine. RESET On RESET, TIM takes control, initializes itself and the system, sets defaults for interrupt vectors and waits for a carriage-return input from the user to determine terminal line speed. After carriage-return is typed, control is passed to the user as in BRK.

C. TIM MONITOR CALLS AND SPECIAL LOCATIONS

Call Address Action Arg. Result Notes JSR WRT 72C6 Type a character A None A,X cleared Y preserved JSR RDT 72E9 Read a character None A X cleared Y not preserved JSR CRLF 728A Type CR-LF and None None A, X cleared delay Y preserved JSR SPACE 7377 Type a space None None A,X,Y preserved character JSR WROB 72B1 Type a byte in hex A None A,X cleared Y preserved JSR RDHSR 733D Read a character None X--char Y preserved from high-speed read paper tape reader A--char trimmed to 7 bits Function Locations Notes Start Address 00F6,00F7 Set with hex tape on load CR-LF Delay 00E3 Set on load or with user program (in bit times, minimum of 1. Zero means 256 bits-time delay). UINT FFF8 User IRQ vector NMI Vector FFFA Hardware NMI vector RESET Vector FFFC Hardware RESET vector IRQ Vector FFFE Hardware IRQ vector
3-4

D. TIM MEMORY USAGE

TIM uses the top 2910 bytes of page zero (locations 00E3 through 00FF). The user is advised to avoid these locations, except as noted above, if return to TIM or use of TIM subroutines is required before RESETing the processor. TIM also uses the hardware stack when it is in control. Provided the user does not alter the stack pointer during a break, and provided the stack does not overflow, TIM will restore the stack to its original status before return- ing to the user's program. The user is advised to use page 1 (the stack page) cautiously, leaving at least 2010 bytes for TIM use during a break or when using other TIM functions.
3-5

3-6

CHAPTER 4

TIM CHECKOUT PROCEDURE

The following step-by-step procedure assumes the user has built the TIM hardware system and is now ready to verify its functionality. ( ) 1. Turn power on, or if the power is on, perform a RESET operation. Type a carriage-return on the terminal. TIM should respond with: * 7052 30 18 FF 01 FF (Exact values may vary, although the first and last values should be as shown.) If no response or a garbled response occurs, RESET and try again. In case of continued trouble, refer to the diagnostic section of the Hardware Manual. The "* 7052 30 18 FF 01 FF" printout is TIM's standard break- point message format. It consists of an asterisk "*" to identify the break- point printout, followed by the CPU register contents in this order: PC, P, A, X, Y, and S, i.e., Program Counter, Processor Status, Accumulator, X index, Y index and Stack Pointer. Note that all TIM inputs and outputs are in base 16 which is referred to as hexadecimal, or just hex. In hexadecimal, the "digits" are 0, 1, 2,..., A, B, C, D, E. F. After printing the CPU registers, TIM is ready to receive commands from you, the operator. TIN indicates this "ready" status by typing the prompting character "." on a new line. ( ) 2. TIM's response to RESET is to wait for a carriage-return and then print the user 5 registers. TIN uses this carriage-return character to measure the terminal line speed. If you have a settable-rate terminal, change the rate (any speed between 10 and 30 cps will work) and repeat Step 1. TIM should respond at the new terminal speed. ( ) 3. The user1s CPU registers may also be displayed with the R command. Type an R. The monitor should respond as above, but without the asterisk. Presence of the asterisk indicates that an interrupt or break instruction caused the printout. .R 7052 30 18 FF 01 FF
4-1

( ) 4. Displayed values may be modified using the Alter (:) command. To modify register contents, type a colon (:) followed by the new values. For example: .R 7052 30 18 FF Ol FE .: 0100 00 00 00 00 FE .R 0100 00 00 00 00 EF Notice that TIM automatically types spaces to separate data fields. (Note: Characters typed by you, the user, are underlined in this document for clarity. Everything else is typed by the computer.) Examine your registers (R command) to verify the changes. Memory may be examined and modified, as above, using the M and : commands. Try this: .M 0100 00 66 23 EE 01 A2 41 6E The memory command (M) causes TIM to type the contents of the first eight bytes of memory. (Memory data will be random on startup.) Alter and verify these bytes using the Alter command, as above: .M 0100 00 66 23 EE Ol A2 41 6E .: 0100 00 01 02 03 04 05 06 07 If only part of a line is to be altered, items to be left unchanged can be skipped over by typing blanks, and carriage-return (). Try this: .M 0100 00 01 02 03 04 05 06 07 .: 0100 FF FF FF .M 0100 FF 01 FF FF 04 05 06 07 ( ) 5. Try to alter a location in TIM ROM: .M 7000 85 F9 A9 23 DO 58 A9 16 .: 7000 00? TIM verifies all changes to memory. Since locations 7000 through 7007 are in read-only memory, alteration is not possible. TIM signals write failure with a question mark. Similarly, the monitor will notify you of an attempt to alter a non-existent location: .M 9000 90 90 90 90 90 90 90 90 .: 9000 00? Note that attempts to read non-existent memory will normally yield the high- order byte of the address read.
4-2

( ) 6. There are three hardware facilities which may be used to stop a running (or run-away) program without the program itself calling TIM. These are the hardware inputs RESET, IRQ, and NMIe To test this feature enter the following program at location 0000: location contents instruction 0000 4C LOOP JMP LOOP 0001 00 0002 00 (Use the M and : commands.) Now, set the program counter (PC) to this location using the R and : commands. Finally, tell TIM to start executing your program using the Go (G) command: .M 0000 FE 11 11 11 91 91 71 91 .: 0000 4C 00 00 .M 0000 4C 00 00 11 91 91 71 91 .R 0000 30 00 00 00 FE .: 0000 .G The computer should now be executing the program. It will continue to run until interrupted. Using the interrupt request line (IRQ), interrupt the processor. It should respond with: * 0000 30 00 00 00 FE Try the same experiment with non-maskable interrupt (NMI). The result should be the same except for a "#" character preceding, which identifies the NMI printout. Finally, try it with RESET. RESET, however, forces a CPU branch to TIM, losing the old PC and other register contents. Thus NMI is the pre- ferred means for manually interrupting program execution. IRQ may also be used unless it is required for other functions such as peripheral interrupts. ( ) 7. Use M and : to enter the following test program called CHSET because it prints the character-set on the terminal. Note that Alter (:) commands may be repeated without intervening M commands to set sequential locations:
4-3

;CHECKOUT PROGRAM -- PRINT THE CHARACTER SET NN USER TERMINAL CRLF =$728A ;ADDRESS OF TIM CRLF ROUTINE WRT =$27C6 ;ADDRESS OF TIM WRITE ROUTINE ; 0000 *=0 ;VARIABLE STORAGE IN PAGE ZERO 0000 CHAR *=*+1 ;STORAGE FOR CHARACTER 0001 *=$0100 ;PROGRAM STARTS ON PAGE ONE ; 0100 20 8A 72 CHSET JRS CRLF ;DO CARRIAGE RETURN & LINE FEED 0103 A9 20 LDA #$20 ;FIRST CHARACTER IS A SPACE 0105 85 CC STA CHAR ;INITIALIZE ; 0107 A5 00 LOOP LDA CHAR ;GET CHARACTER 0109 C9 60 CMP #$6C ;CHECK FOR LIMIT 010B FO C8 BEQ DONE ;DONE IF 60 ; 010D 20 C6 72 JSR WRT ;PRINT CHAR 0110 E6 00 INC CHAR ;NEXT CHAR CODE 0112 4C 07 0l JMP L00P ;CONTINUE 0115 C0 DONE BRK ;STOP & RETURN TO TIM MONITOR ; 0116 4C 00 01 JUMP CHSET ;DO IT AGAIN .M 0100 20 8D 72 20 EC 72 8D 26 .: 0100 20 8A 72 A9 20 85 00 A5 .: 0108 00 C9 60 F0 08 20 C6 72 .: 0110 E6 00 4C 07 01 00 4C 00 .: 0118 01 Now run the program. Do this by setting the PC to 0100 and using the G command. The listing should look like this: .R 0000 30 00 00 00 FF .: 0100 .G !"#$&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\] * 0116 33 60 00 00 FF The program may be continued, causing it to execute again, by typing G: .G !"#$&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\] * 0116 33 60 00 00 FF .G !"#$&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\] * 0116 33 60 00 00 FF .G !"#$&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\] * 0116 33 60 00 00 FF
4-4

The CHSET program uses two TIM monitor functions: CRLF is the TIM function which causes a carriage-return and line-feed to be typed on the termi- nal. WRT is the routine which prints the character whose code is in the A register at the time of the call. ( ) 8. Save the CHSET program on paper tape (if your terminal has a punch) as follows: First, punch some leader tape with the terminal in local mode. Then return to line mode and enter: .WH 0100 0118 Turn the punch on after typing the second address, but before typing carriage- return. Then type carriage-return to punch the tape. when punching stops, turn the terminal back to local and type: ;00 and some blank trailer. This is a zero-length record which terminates your tape. See Appendix B for more information on tape formats. ( ) 9. Try re-loading your program using the LH command: .LH Now start the reader to load the program. The tape will be read and printed simultaneously. Stop the tape when the end is reached. (Before loading, you may wish to destroy the program in memory to verify that loading from tape actually works.) ( ) 10. Use the M and : commands to load the following program:
4-5

Page 4-6
.M 0100 20 8D 72 A9 20 85 00 A5 .: 0100 20 8A 72 20 E9 72 85 00 .: 0108 20 77 73 A9 08 85 01 A9 .: 0110 30 06 00 B0 02 A9 31 20 .: 0118 C6 72 C6 01 10 F1 4C 00 .: 0120 01 The purpose of this program is to print the binary representation of an ASCII input character on the terminal. Run the program by starting it at location 0100. Try typing some characters: .R 0116 33 60 00 00 FF .: 0100 .G U 101010101 B 101111011 1 110011101
4-6

There is obviously something wrong with the program. Bits which should be printed as 1's are 0's and vice versa. (Refer to your 6500 reference card for character codes.) Looking at the program, the problem is that the branch after PBLOOP goes the wrong way! It should be BCC, Branch if Carry Clear (or alternatively, the 1 and 0 loads could be interchanged). Thus, when a one-bit is shifted out of the character, a one should be printede Patch the program and try again (the code for BCC is 90). .M 0113 B0 02 A9 31 20 C9 72 C6 .: 0113 90 .R 7052 31 FC FF 0l FF .: 0100 .G U 010101010 B 010000100 1 001100010 There is, alas, still an error--one too many bits is being printed. The cause of this is a little less obvious. (Do you see it?) To investigate the problem, set a breakpoint at location 011E. Do this by replacing the instruction there with a BRK (code of 00). Then run the program: .M 011E 4C 00 01 EF 4C 00 01 00 .: 011E 00 .R 7052 31 FC FF 01 FF .: 0100 .G U 010101010 * 011F B0 00 00 AA FF Once the break has occurred, you are free to investigate the state of the program using TIM. In particular, check the value in location COUNT: .M 0000 00 FF 1B 2E 31 EA F0 FA Aha! Although COUNT starts out with a value of 8, it is going one step too far (FF is minus 1). This is because the test instruction, BPL PBLOOP is test- ing to see whether the count is greater than or equal to zero. Replace it with BNE (code D0), replace your breakpoint with the original contents at that loca- tion, and try the program again.
4-7

.M 011C 10 Fl 00 00 0l EF 4C .: 011C D0 4C .R 011F B0 00 00 AA FF .: 0100 .G U 01010101 B 01000010 l 100110001 I 01001001 W 01010111 O 01001111 R 01010010 K 01001011 S 01010011 Page 4-8
( ) 11. Save the corrected program using the WH command. Before punching the terminating record (as above in step 8), turn off the punch and set the PC to the start address of the program (0100). Then punch locations 00F6 and 00F7 on the tape, then the terminator (;00), and finally, some trailer: .R 7052 30 37 FF 01 FF .: 0100 .WH 00F6 00F7 ;0200F6000101A2 .;00 The resulting tape can be loaded and then started as follows: .LH : : (program loads in) : .G Locations 00F6 and 00F7 contain the starting address for programs. You may assemble and load your starting address into these locations to make tapes which can be started with a minimum of operator action. The carriage-return delay time may also be set in this manner. See Appendix B. ( ) 12. It is also possible to punch BNPF-format tapes using TIM. BNPF is the format used by some ROM programmers. The command is similar to that for writ- ing hex tapes: .WB 0100 0127 This command would punch the corrected PBIN program in BNPF format. Try punch- ing a BNPF tape. (Note that TIM will not load tapes in this format--use hex format (WH) for saving programs for later loading into your 65XX.) ( ) 13. If you have a high-speed paper tape reader attached to your 65xx sys- tem, you can use it to load programs in hex format. The H command switches the load device to and from the high speed reader. If you have a high-speed reader, try loading a tape as follows: .H .LH Note that control will not return to the user terminal until a terminator record (;00) is read.
4-9

4-10

APPENDIX A

MEMORY ADDRESS TEST

A-1

Appendix A-2
Appendix A-3
Appendix A-4

APPENDIX B

TIM PROGRAM LISTINGS

B-1

Appendix B-2
Appendix B-3
Appendix B-4
Appendix B-5
Appendix B-6
Appendix B-7
Appendix B-8
Appendix B-9
Appendix B-10
Appendix B-11
Appendix B-12
Appendix B-13
Appendix B-14
Appendix B-15
Appendix B-16
Appendix B-17
Appendix B-18
Appendix B-19
Appendix B-20
Appendix B-21
Appendix B-22