Advertisement

Quick Links

THE
PRIMER
TRAINER
SELF INSTRUCTION
MANUAL
Manual Revision 3.0
For board revision 3
Copyright 2005, EMAC INC.
UNAUTHORIZED COPYING, DISTRIBUTION,
OR MODIFICATION PROHIBITED
ALL RIGHTS RESERVED
1

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the PRIMER and is the answer not in the manual?

Questions and answers

Subscribe to Our Youtube Channel

Summary of Contents for EMAC PRIMER

  • Page 1 PRIMER TRAINER SELF INSTRUCTION MANUAL Manual Revision 3.0 For board revision 3 Copyright 2005, EMAC INC. UNAUTHORIZED COPYING, DISTRIBUTION, OR MODIFICATION PROHIBITED ALL RIGHTS RESERVED...
  • Page 2: Table Of Contents

    INTRODUCTION TO THE PRIMER TRAINER INTRODUCTION TO COMPUTERS Computer Math Computer Logic A BRIEF OVERVIEW OF THE PRIMER HARDWARE MEMORY INPUT/OUTPUT REGISTERS TECHNICAL CIRCUITRY DESCRIPTION Schematic Sheet 2: Microprocessor and Expansion Bus Schematic Sheet 3: I/O Decoding and Memory Schematic Sheet 4: Display and Keypad Circuitry...
  • Page 3 LESSON 2 : RUNNING YOUR FIRST PROGRAM LESSON 3: LOADING REGISTERS AND TRANSFERRING DATA BETWEEN REGISTERS 29 LESSON 4: EIGHT BIT ADDITION LESSON 5: EIGHT BIT SUBTRACTION LESSON 6: SIXTEEN BIT SUBTRACTION LESSON 7: SIXTEEN BIT ADDITION LESSON 8: SIXTEEN-BIT SUBTRACTION USING TWO'S COMPLEMENT ADDITION LESSON 9: BINARY CODED DECIMAL SIXTEEN-BIT ADDITION LESSON 10: MULTIPLICATION LESSON 11: DIVISION...
  • Page 4 LESSON 24: USING COMPARE INSTRUCTIONS LESSON 25: USING INTERRUPTS LESSON 26: WRITING YOUR OWN PROGRAMS APPENDIX A: JUMPER DESCRIPTIONS AND I/O ADDRESSES APPENDIX B: THE PRIMER KEYPAD DESCRIPTION APPENDIX C: 8085A CPU INSTRUCTIONS IN OPERATION CODE SEQUENCE APPENDIX D: MOS SERVICES...
  • Page 5: Introduction To The Primer Trainer

    The PRIMER Trainer is a compact, low cost, 8085 based microprocessor system, designed primarily for educational purposes. In spite of its low cost and small size, it contains many important and educational features. The PRIMER has digital I/O, analog I/O, and a display plus keypad for human interface. There are also several options that can be added to the basic unit to enhance flexibility and functionality.
  • Page 6 POWER SUPPLY Any filtered DC power source from seven ( 7 ) to ten ( 10 ) volts DC may be used to power the PRIMER. Power is fed to the unit via power jack J1. Make sure that the power supply's output plug has a positive tip and a negative sleeve.
  • Page 7: Introduction To Computers

    Introduction to Computers Computers basically perform three functions: inputing data, processing the data and outputing data. Some devices that are commonly used to input information to a computer are keyboards, DIP switches and joysticks. Common computer output devices are light emitting diodes (LEDs), liquid crystal displays (LCDs), video monitors, and printers. Disk drives and modems are common devices that have both input and output characteristics.
  • Page 8 (bit number) number (2 ). The binary number 11111111 can be converted to decimal by knowing the weights of each bit, as in the example below: bit # weight value = decimal result = 128 sum of bits * weights = 255 The three forms of numbers we will use in this manual are binary, hexadecimal (hex, for short) and decimal.
  • Page 9: Computer Logic

    least significant byte (LSB). Computer Logic The 8085 supports 4 logical operations: 1) The AND operation takes two input bits and returns a 1 bit if both input bits are 1 and a 0 bit if either bit is 0. 2) The OR operation takes two input bits and returns a 1 bit if either input bit is 1 and a 0 bit if both input bits are 0.
  • Page 10: A Brief Overview Of The Primer Hardware

    Writing to ROM chips has no effect. The RAM and ROM chips in the PRIMER trainer have eight pins which send data to, or receive data from the microprocessor through a group of eight connections called the data bus.
  • Page 11 The 8085 has many instructions which use these individual general purpose registers. There are also instructions which view a pair of the general purpose registers as a single 16 bit register. The register pairs that are used in these instructions are BC, DE, and HL. When they are paired with other registers C,E and L represent the least significant 8 bits of the register pairs (bits 0-7) and B,D and H represent the most significant 8 bits (bits 8-15).
  • Page 12: Technical Circuitry Description

    The system clock oscillator, whose frequency is set to 6.144 MHZ by crystal Y1, drives all timing functions within the 8085 and it runs as long as power is applied to the PRIMER. It is possible to run the 8085 under a wide range of frequencies, but in the PRIMER we use 6.144 MHZ to provide compatibility with circuits used elsewhere in the system.
  • Page 13: Schematic Sheet 3: I/O Decoding And Memory

    I/O, every decoder is unique to that design. In the PRIMER, two types of memory maps may be decoded based on the setting of OJ3. In the standard map (OJ3 in position A), a 16K (K=1024 bytes) byte space is reserved for program EPROM, starting at address 0000 hex and ending at 3FFF hex ( remember the 8085 begins execution at 0000 hex after reset ).
  • Page 14: Schematic Sheet 4: Display And Keypad Circuitry

    32 K static RAM chip to be installed onto the PRIMER. In the standard map it starts at 4000 hex and goes to BFFF hex. With OJ3 in position A, the 8155 PPI's memory space begins at C000 hex and ends at the top of the 8085's address range at FFFF hex.
  • Page 15: Schematic Sheet 5: Digital I/O And Timer

    The base address of U5 in the PRIMER is 40 hex. The I/O decoder's chip select will be valid for all I/O map transactions up to 7F hex. Therefore, the two addresses for U5 repeat themselves throughout this range, just as the memory addresses repeat in the 8155.
  • Page 16: Schematic Sheet 6: Optional Serial Communication Port

    The 8155 has a programmable timer/counter in it that is software programmable to count from 1 to 16,383. The counter becomes a timer if it is fed a regular pulse train, as it is in the PRIMER. The SYSCLK signal is first divided by ten, and fed to the 8155 timer input.
  • Page 17 18.75 Hz. Also shown on this sheet, are the spare gates that are not used by the PRIMER circuit, but present on the board. This often occurs since gate packages often come with multiple gates on one chip. As is customary, unused gate inputs should be defined to an idle logic state to prevent random oscillations, latchup, etc.
  • Page 18: Hardware Features

    TTL level signals through this connector. D/A: An analog output voltage in the range of approximately 0 to +5v can be output from the PRIMER. This digital to analog convertor is implemented through an R-2R ladder which is connected to bits 0-5 of output PORT C. The output from the R-2R ladder is available on pin 19 of the digital I/O connector CN3.
  • Page 19 Upon the resulting timer interrupt your program can execute the desired software. The timer/counter is also used to drive the PRIMER's speaker. Different frequencies can be output from the speaker using a MOS service.
  • Page 20: Languages Used By The Primer

    Languages Used By the PRIMER 8085 Machine Language The 8085 microprocessor has 246 instructions and each instruction is represented by an 8 bit binary value, which is called an op code or an instruction byte. The Instruction Set Encyclopedia ( (c) Intel Corporation ) included at the end of this manual, divides these instructions into five general categories which are as follows: 1) Data Transfer Group: Moves data between registers or between memory locations and registers.
  • Page 21 characters "dips" represents the value 12 hex, so line 7 which says "in dips" means, load the A register with the data from input port 12 hex ( which is the DIP switch port ). As you can see, this is more readable than its assembly language equivalent "in 12h".
  • Page 22: Getting Started

    EMAC for repair. If the PRIMER is now running you may want to run the PRIMER diagnosis function. This function allows you to check the DIP switches, digital output LEDs, A/D convertor, 8155 timer, speaker, numeric displays, keypad and the optional serial RS-232 port.
  • Page 23 If an optional 32k RAM is in memory slot 1 and option jumper OJ3 is in position "A" you should turn off the PRIMER and move the jumper to position "B" then turn it on again and run the diagnosis function. If the RAM is okay, and you want the position "A"...
  • Page 24: Lesson 1: Using The Monitor Operating System

    : (memory addresses FF04-FFFF) When an address and the data at that address is displayed, the PRIMER is in "data entry mode". Press the "enter" key and the PC register will be incremented to FF02 and shown on the "ADDRESS/REGISTER PAIR" display and the data pointed to by the new value of the PC will be shown on the "DATA/OP"...
  • Page 25: Viewing And Changing Register Contents

    PRIMER. The worst thing that can happen is that you would have to press the reset button, or if the program was corrupted you may have to enter the program into memory again.
  • Page 26: Some Tips About Changing Registers

    As described earlier, the flag register is an 8 bit register which has individual bits called flags, that indicate the result of arithmetic or logical operations. To see what the values of the individual bits are, you must BINARY 0100 0001 convert the hexadecimal value of the flag register to binary.
  • Page 27 This procedure is called single stepping. After the instruction is completed, the PC register points to the address of the next instruction and the PRIMER will be returned to data entry mode. To single step the first instruction, press the "stp/run"...
  • Page 28 LEDs. * NOTE: The PRIMER was designed so the digital output LEDs will turn on when a logic 0 is output to a particular bit of port A. So, for example, if 01h is output to the port all LEDs will be turned on except for LED 0, and if F0h is output to the...
  • Page 29 LESSON 3: Loading Registers and Transferring Data Between Registers NEW INSTRUCTIONS A,<byte> op code = 3E B,<byte> op code = 06 C,<byte> op code = 0E D,<byte> op code = 16 E,<byte> op code = 1E H,<byte> op code = 26 L,<byte>...
  • Page 30 The last instruction in the machine language program is FF which is the RST 7 instruction. Read the instruction's definition at the beginning of this lesson, again (stack will be explained later). The PRIMER's ROM has instructions at address 0038 which return control of the microprocessor to the MOS.
  • Page 31 LESSON 4: Eight-Bit Addition NEW INSTRUCTIONS op code = 81 The C register is added to the A register with the result being stored in the A register. The Z,S,P,CY and AC flags are affected. op code = 78 The contents of the B register are copied to register A. No flags are affected. This program adds the B and C registers together and stores the result in the A register.
  • Page 32 LESSON 5: Eight-Bit Subtraction NEW INSTRUCTION op code = 91 The C register is subtracted from the A register with the result being stored in the A register. The Z,S,P,CY and AC flags are affected. If the previous program is still in memory and you change the instruction at FF02 to 91 (SUB C) the following program is the result.
  • Page 33 LESSON 6: Sixteen-Bit Subtraction NEW INSTRUCTIONS op code = 93 The E register is subtracted from the A register with the result being stored in the A register. The Z,S,P,CY and AC flags are affected. op code = 9A Subtracts the D register and the carry flag from the A register with the result being stored in the A register. The Z,S,P,CY and AC flags are affected.
  • Page 34 FF05 The D register and the Carry flag are subtracted from the A register (A = A - D - carry flag = 21 hex - 10 hex - 1 = 10 hex). FF06 B equals A which is 10 hex FF07 This is the end of the program.
  • Page 35 LESSON 7: Sixteen-Bit Addition NEW INSTRUCTIONS ADD E op code = 83 Adds the E register to the A register, storing the result in the A register. The Z,S,P,CY and AC flags are affected. ADC D op code = 8A Adds the D register and the carry flag to the A register, storing the result in the A register.
  • Page 36 FF07 This is the end of the program. Examine the BC register pair and you will see that it is now 3401 hex just as predicted in the equation that was shown. Try pressing the reset button and loading BC and DE with other values and running the program again. Try loading the C and E registers with values that will not set the carry flag when the ADD E instruction is executed.
  • Page 37 LESSON 8: Sixteen-Bit Subtraction Using Two's Complement Addition NEW INSTRUCTIONS op code = 09 Add the 16 bit number in BC to the 16 bit number in HL and store the result in HL. The carry flag is 1 if the result is too big to fit in HL.
  • Page 38 LESSON 9: Binary Coded Decimal Sixteen-Bit Addition NEW INSTRUCTION op code = 27 Change the value in the A register to two binary coded decimal digits. This is done by: (a) Adding 6 to the A register if the value of its lower 4 bits is greater than 9, or if the auxiliary carry flag is set. (b) Adding 6 to the upper 4 bits of the A register if they are greater than 9 or if the carry flag is set.
  • Page 39 FF03 Single step the DAA instruction and examine the A register and you will see that 66 was added to it which set the carry flag and made the A register 13. FF04 Single step to FF07 and examine the A register ( it will be 32) and flag register. The auxiliary carry flag will be 1 and the carry flag will be 0 so the DAA instruction that follows will add 6 to the A register.
  • Page 40 LESSON 10: Multiplication NEW INSTRUCTIONS op code = 17 Rotate all the bits in the accumulator one position left and put the carry flag in bit 0 and put the value that was rotated out of bit 7 into the carry flag. Only the carry flag is affected. op code = 29 Add HL to HL and store the result in HL.
  • Page 41 Load the above program into memory then load the DE register pair with 0080 hex (128 decimal) and run the program. This value is chosen because it will show that after you run the program, bit 7 of E is shifted into bit 0 of D, giving a result of 0100 (128 * 2 = 256 decimal).
  • Page 42 LESSON 11: Division NEW INSTRUCTIONS op code = 1F Shift all the bits in the accumulator one position right and put the carry flag in bit 7 and put the value that was shifted out of bit 0 into the carry flag. Only the carry flag is affected. op code = 7A The contents of the D register are copied to register A.
  • Page 43 (connected to the DIP switches) by setting, resetting and toggling the bits. This process of changing bits is called "bit manipulation". Bit manipulation instructions are used by the MOS to allow the 8085 to control other chips in the PRIMER...
  • Page 44 DIP switch #0 is off or on if the switch is on NOTE: If you are facing the PRIMER, the DIP switches are numbered 7-0 from left to right. Also, a DIP switch in the on position will produce a logic 0 input and in the off position will produce a logic 1 input.
  • Page 45 LESSON 13: Using Conditionals NEW INSTRUCTIONS <addr> op code = C2 If the zero flag is 0, load the PC register with the two bytes following the op code, otherwise start executing the instruction after this one. The first byte following the op code is the low byte of the address, the second byte is the high byte of the address.
  • Page 46 FF01 Move the DIP switches to the on position, so that the value of the DIP switches wil be be 0 and single step to address FF06 again. FF06 Examine the flag register and you will see that bit 6 (the zero flag) is 1 indicating that the ORA A instruction gave a zero as a result.
  • Page 47 LESSON 14: Using Register Indirect Addressing NEW INSTRUCTIONS H,<word> op code = 21 Load the HL register pair with the word (a word = 2 bytes) that follows the op code. The byte following the op code goes in the L register and the byte after that goes into the H register. No flags are affected. M,<byte>...
  • Page 48 0ff01h h,addr ; load HL with the address of the reserved byte. ; load E with data pointed to by HL ; HL=HL + 1 (point to next address) ; HL=HL + 1 (point to next address) ; HL=HL + 1 (point to next address) ;...
  • Page 49 LESSON 15: Using Register Indirect Addressing to Perform 24-Bit Addition NEW INSTRUCTIONS op code = 86 Adds the byte in memory pointed to by the HL register pair to the A register, storing the result in the A register. The Z,S,P,CY and AC flags are affected. op code = 8E Adds the carry flag and the byte in memory pointed to by the HL register pair to the A register, storing the result in the A register.
  • Page 50 FF04 Single step and the A register will be loaded with the value of the E register. Examine the A register (it should be BF) FF05 Single step and the ADD M instruction will be executed which will add to the A register the data at the memory address pointed to by HL.
  • Page 51 LESSON 16: Using Register Indirect Addressing to Move Data NEW INSTRUCTIONS op code = 03 Increment the BC register pair. No flags are affected. op code = 13 Increment the DE register pair. No flags are affected. op code = 2D Decrement the L register.
  • Page 52 FF04 Single step and the DE register pair will be incremented so that it points to the next memory address (FF0B) to store data. FF05 Single step and the L register will be decremented. Since the result is not 0, the zero flag is 0. FF06 Single step and JNZ FF01 will load PC with FF01 since the zero flag is 0.
  • Page 53 LESSON 17: Using Variables NEW INSTRUCTIONS SHLD <addr> op code = 22 Store the L register at memory address <addr> and store the H register at memory address <addr+1>. The first byte after the op code is the low order byte of <addr> and the second byte after the op code is the high order byte of the address.
  • Page 54 ADDRESS DATA INSTRUCTION FF01 H,8000 FF02 FF03 FF04 D,FF00 FF05 FF06 FF07 FF08 FF09 FF24 FF0A FF0B FF0C FF0D SHLD FF22 FF0E FF0F FF10 FF11 FF12 FF13 FF10 FF14 FF15 FF16 FF24 FF17 FF18 FF19 FF1A FF1B FF1C LHLD FF22 FF1D FF1E FF1F...
  • Page 55 was stored earlier using the SHLD FF22. FF1F Run the program from here to see what the program does. This program has demonstrated the usefulness of variables to remove the limitations caused by having only a few registers. As you write larger programs you may find that the use of variables is an absolute necessity. The last page of the assembly language listing of MOS shows the system variables used by MOS.
  • Page 56 LESSON 18: The Stack and Related Instructions NEW INSTRUCTIONS PUSH PSW op code = F5 Put the processor status word ( A register and flag register ) on the stack. No flags are affected. PUSH B op code = C5 Put the BC register pair on the stack.
  • Page 57 You can now see where the name "stack" comes from, data is "stacked" in memory with every PUSH instruction. Since the stack grows down in memory it is possible for it to eventually overwrite your program, so you must be careful when using the stack.
  • Page 58 ADDRESS DATA DESCRIPTION FFC7 PUSH PC-> FFC8 PUSH FFC9 FFCA FFCB (undefined value) FFCC (undefined value) FFCD (undefined value) FFCE (undefined value) (See note below) FFCF (undefined value) FFD0 (undefined value) FFD1 (undefined value) SP-> FFD2 value from flags FFD3 value from register A FFD4 7) Execute the PUSH B instruction by single stepping once.
  • Page 59 stack pointer at the same place, some of the bytes below the stack pointer address will be changed because of the PUSHes. If it were possible to run the program full speed and stop it at FFCB without single stepping or breakpoints, the memory values would be defined as follows: ADDRESS DATA...
  • Page 60 LESSON 19: Using the XTHL Instruction. NEW INSTRUCTIONS XTHL op code = E3 Exchange L with the value at memory address SP and exchange H with the value at memory address SP + 1. No flags are affected. PUSH H op code = C5 Put the HL register pair on the stack.
  • Page 61 FF0D FF0E FF0F FF10 XTHL FF11 FF07 FF12 FF13 FF14 FF15 Load the program into memory and press the reset button. Load the HL register with 0002 and the DE register with FFFF and do the following: CURRENT PC FF01 Single step and the HL register will be PUSHed on the stack.
  • Page 62 FF0C Single step the XTHL instruction and HL is now the number of additions that are left to do, and the value on the stack holds the sum from the addition. FF0D Single step and 1 will be subtracted from the number of additions left to do in the HL register. FF0E Single step and the H register will be copied to the A register.
  • Page 63 LESSON 20: Subroutines NEW INSTRUCTIONS CALL <addr> op code = C3 Put the address of the next instruction on the stack and load the program counter with the two bytes that follow the op code. The byte immediately following the op code is the least significant byte of the address and the one after that is the most significant byte.
  • Page 64 FF0D A,55 FF0E FF0F CALL FF16 FF10 FF11 FF12 FF13 FF04 FF14 FF15 FF16 PUSH H FF17 PUSH PSW FF18 FF19 FF1A FF1B FF1C FF1D FF1A FF1E FF1F FF20 FF21 FF22 Load the program into memory and run it; The program should display 3 different patterns on the discrete LEDs, one after the other, and repeat the patterns again.
  • Page 65 s you can see, a subroutine CALL acts like a user-defined op code. A subroutine can perform a task without changing the registers, as in the program above, or it can change the registers according to the rules that you define when writing the subroutine.
  • Page 66 CALL that is being single stepped is in ROM or RAM, and if it is in ROM it will run the subroutine full speed until it is finished. This is because the method of single stepping used by the PRIMER requires the instructions being single stepped to be in RAM.
  • Page 67 LESSON 22: Using PITCH (service 10) NEW INSTRUCTIONS op code = 0F Shift the bits in the A register to the right and put the value shifted out of bit 0 in the carry flag and bit 7. Only the carry flag is affected. This program translates the value of the DIP switch to a 14 bit value that is stored in the DE register pair.
  • Page 68 OP CODE VALUES OF REGISTERS AFTER EXECUTION OF OP CODE 00001111b XXXXXXXXb XXXXXXXXb 10000111b XXXXXXXXb XXXXXXXXb 11000011b XXXXXXXXb XXXXXXXXb 11000011b XXXXXXXXb 11000011b 00111111b 00000011b XXXXXXXXb 11000011b 00000011b 00000011b 11000011b 11000011b 00000011b 11000011b 11000000b 11000000b 00000011b 11000011b 11000000b 00000011b 11000000b Single step to address FF0D and you will see that the 8 bit value of the DIP switch is now the upper 8 bits of the 14 bit number in DE.
  • Page 69 Connector CN3 provides +5 volts on pin 22, analog input on pin 20 and ground on pin 18. Be sure there is no power to the PRIMER when connecting the potentiometer to the I/O connector. Also be sure that you do not short any of the connections when connecting the potentiometer to CN3.
  • Page 70 FF10 FF11 FF12 FF13 FF14 FF15 LOOP FF16 FF17 FF18 FF19 FF1A FF01 FF1B FF1C Press reset and run the program. You will see that the bar graph displayed on the digital output LEDs changes proportionally with the input voltage.
  • Page 71 LESSON 24: Using Compare Instructions NEW INSTRUCTIONS op code = 07 Shift the bits in the A register to the left and put the value shifted out of bit 7 in the carry flag and bit 0. Only the carry flag is affected. op code = BD Subtract the L register from the A register and set the condition flags accordingly without changing the A register.
  • Page 72 FF0E FF14 FF0F FF10 FF11 FF12 FF13 FF14 FF15 FF16 FF17 FF03 FF18 FF19 FF1A FF1B FF1C FF1D FF03 FF1E FF1F To see how the compare instructions work in a program, load the program into memory and verify that the data was entered correctly then press the reset button and do the following: CURRENT PC FF01...
  • Page 73 FF03 Run the program full speed from here to see the way the pressing keys affects the digital output LEDs. The previous program used compare instructions to check for equality of two values. The compare instructions can also be used to tell whether a value is greater or less than another value. The following program compares the H and L register and causes the digital output LEDs to show different patterns depending on the relative sizes of H and L.
  • Page 74 CURRENT PC FF01 Load HL with FFE0 so H will be greater than L then single step and H will be copied to the A register. FF02 Single step and A will be compared with L and the flags will be set accordingly. According to the definition of the CMP L instruction if A is greater than L then the zero flag and the carry flag will both be 0 (examine the flag register to verify this).
  • Page 75 LESSON 25: Using Interrupts NEW INSTRUCTIONS op code = FB Enable interrupts after the next instruction is executed. No flags are affected. op code = F3 Disable interrupts after the DI instruction has been executed. No flags are affected. op code = 20 (See Instruction Set Encyclopedia) op code = 30 (See Instruction Set Encyclopedia)
  • Page 76 per second and each time will increment the byte at address FF2E. Type in the program and run it. You will see that the LEDs are displaying the increasing value of the data at address FF2B. Press the reset button and set a breakpoint at FF20, (the start of the ISR) then run the program. The execution will stop at FF20, and if you look at the stack contents (S.C.) the value will be the address of the next instruction which the main loop will execute.
  • Page 77 FF16 FF17 FF18 FF2B FF19 FF1A FF1B FF1C FF1D FF18 FF1E FF1F FF20 PUSH FF21 FF2B FF22 FF23 FF24 FF25 FF2B FF26 FF27 FF28 FF29 FF2A FF2B (not an op code, but the counter value)
  • Page 78 LESSON 26: Writing Your Own Programs NEW INSTRUCTIONS D,<word> op code = 11 Load the DE register pair with the word (a word = 2 bytes) that follows the op code. The byte following the op code goes in the E register and the byte after that goes into the D register. No flags are affected. Now that you have a basic knowledge of most of the 8085 instructions, it is possible for you to write your own programs.
  • Page 79 0ff01h 1000h ; start address of MOS subroutines keyin ; service # of keyin ledhex ; service # of ledhex start: ; clear the total in DE rdkey: c,keyin ; C = keyin service number call ; load L with key from keypad a,0fh ;...
  • Page 80 Be aware of the memory limitations when you are writing a program. If you do not have one of the PRIMER Upgrade Options, the available memory is from FF01 to FFD3 (211 bytes). If you are using the stack in your program, remember that 2 bytes are used with each PUSH or CALL and when an interrupt occurs.
  • Page 81 Pressing "Func." then "3" will then enable the PRIMER's serial port to receive a hex file. After this, the displays will show "rEC.." indicating that the PRIMER is ready to receive the data.
  • Page 82 APPENDIX A: Jumper Descriptions and I/O addresses Jumper Descriptions JUMPER DESCRIPTION This allows the selection of one of the following baud rates: 300, 600, 1200, 4800, 9600 and 19,200. This is used to select the sources for the 8085's RST 5.5 and RST 6.5 interrupt inputs.
  • Page 83 APPENDIX B: The PRIMER Keypad Description The PRIMER Trainer has twenty keys for input, with some keys having a second function which can be invoked using the "FUNC." key. Each key produces an audible tone when pressed, providing feedback for the user.
  • Page 84 For more details see "Using MOS Services". This enables a PRIMER with a Deluxe or Standard Upgrade Option to receive an Intel hex file through its serial port. See the end of the lesson "Writing Your Own Programs" for more information.
  • Page 85 APPENDIX C: 8085A CPU Instructions In Operation Code Sequence The information in this appendix may be found in “The MCS-80/85 Family User’s Manual” which contains more details about interfacing and programming the 8080 and 8085 microprocessors. This and other Intel Literature may be obtained from: Intel Corporation Literature Department...
  • Page 86 Abbreviations used in this table: constant or logical/arithmetic expression that evaluates to an 8-bit quantity constant or logical/arithmetic expression that evaluates to an 16-bit quantity 16-bit address. All mnemonics copyrighted © Intel Corportation 1976 CODE MNEMONIC CODE MNEMONIC CODE MNEMONIC CODE MNEMONIC B,D16...
  • Page 87 APPENDIX D: MOS Services MOS version 2.7 EMOS version 2.0...
  • Page 88 SERVICE 0 DEMO Demonstration; this service routine sends a pitch of increasing frequency to the speaker while flashing the output LEDs at an increasing rate. INPUT REGISTER C: 0 OUTPUT NONE SERVICE 1 CONIN Console input; this service waits for a key from the terminal keyboard to be pressed. This service requires the optional serial port.
  • Page 89 SERVICE 9 ADCIN Analog to Digital input; this service returns a 6 bit value from the analog to digital convertor. INPUT REGISTER C: 9 OUTPUT REGISTER L: 6 bit analog conversion. SERVICE A DIPSWIN DIP switch input; this service reads the current switch positions of the 8 position DIP switch.
  • Page 90 SERVICE 12 LEDHEX LED Hexadecimal output; This service routine displays the number in the DE register pair in hex, in the four displays on the left. INPUT REGISTER C: 12 REGISTER PAIR DE: 16 bit number to be displayed in HEX. OUTPUT NONE SERVICE 13...
  • Page 91 mode and vice-versa you must change the hours to match the selected mode. Once the hours are correct, the real time clock will maintain the correct hour for the selected mode. If bit 5 of address DE + 4 is set to 1 and WRSCL is executed, the real time clock will be stopped.
  • Page 92 8K x 8 ) EPROM WHICH PROGRAMS AT 21.0 VOLTS. If an illegal type number is passed to one of the following services, the A register will return the value 4, with other registers unaffected. There are 5 MOS services which support EMAC's EPROM programmer . SERVICE 1C READ Copies a number of bytes starting at an EPROM memory address and stores them in system memory.
  • Page 93 Service number 20h If ZAP has finished executing with no errors, the A register will be 0 and the other registers (except the flag register) will be unaffected. If an error has occured, the A register will indicate the following: Error during EPROM write (registers returned with same values as BURN error) Error during verification (registers returned with same values as VERIFY error) EPROM not erased (registers returned with same values as ERASECHK error)
  • Page 94 SERVICE 23 BCD2BIN Binary Coded Decimal to Binary. This service converts a 4 digit BCD number in register pair DE to binary. INPUT REGISTER C: 23H REGISTER PAIR DE: 4 digit BCD number OUTPUT REGISTER PAIR DE: converted number in binary SERVICE 24 KPINPUT Keypad Input.

Table of Contents