Home
Popular Electronics
Contents
1. gt M 0058 0 1 0 011 0 1 010 1 0110 0 0 0 Fig 3 17 Diagram showing how to create your own display This one is for parts of five lines of Spaceship Program 44 TABLE TI SPACESHIP PROGRAM M Byte Sequence 0040 00 00 00 00 00 00 00 00 0048 00 00 00 00 00 00 00 00 0050 7B DE DB DE 00 00 00 00 0058 4A 50 DA 52 00 00 00 00 0060 42 5E AB DO 00 00 00 00 0068 4A 42 8A 52 00 00 00 00 0070 7B DE 8A 5E 00 00 00 00 0078 00 00 00 00 00 00 00 00 0080 00 00 00 00 00 00 07 EO 0088 00 00 00 00 FF FF FF FF 0090 00 06 00 01 00 00 00 01 0098 00 7F EO 01 00 00 00 02 00A0 7F CO 3F E0 FC FF FF FE 00A8 40 OF 00 10 04 80 00 00 00BO 7F CO 3F E0 04 80 00 00 00B8 00 3F DO 40 04 80 00 00 00CO 00 OF 08 20 04 80 7A 1E 00C8 00 00 07 90 04 80 42 10 00D0 00 00 18 7F FC FO 72 1C 00D8 00 00 30 00 00 10 42 10 0080 00 00 73 FC 00 10 7B DO 00E8 00 00 30 00 3F FO 00 00 00FO 00 00 18 OF CO 00 00 00 00F8 00 00 07 FO 00 00 00 00 45 Fach of the eight display refresh bytes requested by the 1861 is internally converted to a bit serial form and used to provide the luminance brightness pulses that come out of the 1861 at pin 7 The actual raster display consists of 262 horizontal lines for each frame and there are 60 frames per second Each display spot is four raster lines high which means that each eight byte display row must be repeated four times With the interrupt routine R0 is initially set to M
2. Fig 4 Complete circuit for the Elf computer Identified connections on the left go to the front panel with the eight data switches The remaining can be left floating at 1802 or tied to terminal strip e Cl C2 10 uF 16 volt electrolytic capacitor e C3 C4 30 pF disc capacitor e DI through D6 IN914 switching diode e IC1 CDP1802 COSMAC microprocessor chip RCA e IC2 IC3 2101 256 x 4 static RAM IC e IC4 IC5 4050 noninverting hex buffer IC PARTS LIST e IC12 4013 dual D flip flop IC e IC13 LM309K 5 volt regulator IC e LED1 Red light emitting diode e RI through R9 47 000 ohm 14 watt resistor e R10 470 ohm 4 watt resistor e R11 10 megohm Y4 watt resistor e SI through S11 Spdt toggle switch 5 x 2 14 x 5 1cm piece of thin aluminum Ja x 3 8 19 1 x 9 5 cm pine for chassis rails 14 pin IC sockets 4 16 pin IC sockets 3 22 pin IC sockets 2 40 pin IC socket connector for power supply 9 volt 350 mA dc power source 114 x34 x 1 8 31 8 x 19 1 x 3 2 mm piece of aluminum dry transfer lettering kit machine and wood e IC6 IC7 Hex LED display H P No 5082 T340 e 1C8 IC9 4016 quad bilateral switch IC e IC10 4023 triple 3 input NAND gate IC e IC11 4049 inverting e S12 Pushbutton switch with one set each normally open and normally closed contacts e XTAL 1 to 2 MHz crystal see text e Misc 5 72 x 4 14x 10 1cm
3. LOAD RUN Mode lgnd end load HSV end reset ksv SV fun RUN and LOAD switches S and S2 in Fig 5 control the operation of the computer With both switches set to OFF LOAD is 5V and RUN is at ground potential This resets the 1802 Neither TPA nor TPB are generated in the reset state and RO 0000 P 0 X 0 and Q 0 after the 1802 is reset When the LOAD switch is set to ON LOAD goes low and RUN stays low forcing the system into the load mode Now you can load a sequence of bytes into the RAM starting at address 0000 by setting the bytes into the input toggle switches one at a time and operating the INPUT switch In the load mode the 1802 does not execute instructions but waits for a low to appear on the DMA IN line When this happens the 1802 performs one memory write cycle during which the switch input byte is stored in memory R0 is used to address memory during the DMA IN cycle After the input byte is stored at the address specified by RO this register is incremented by one so that input bytes will be sequentially loaded into RAM locations Line SC1 goes high during the DMA IN cycle so that the control circuits know when the input byte has been stored in the RAM START Q LED IS OFF STEP 1 STEP 2 STEP 3 STEP 4 GO TO STEP 2 3B B1 Fig 7 Program turns on Q LED when INPUT switch is operated 11 INTRODUCTION TO PROGRAMMING Once you have built your Elf you must learn how to load a sequ
4. This program will flash the Q LED and put a square wave on the Q line at a rate determined by the contents of memory M 0002 from a 10 to some other number By referring back to the instruction Subset Table in last month s article you should be able to interpret the above program Note in the program that RI is used as a 16 bit decrementing counter steps 3 4 and 5 When the high order eight bits of this counter reaches 00 the Q line goes to its opposite stage Changing steps 2 and 4 to use the low order byte of R1 increases the Q line s output frequency by a factor of 256 If you use a 1 MHz crystal in the clock the above program can generate square waves at frequencies between 0 3 and 80 Hz depending on the byte in M 0002 22 By changing the B1 instruction at M 0005 to 81 square waves between 80 and 20 000 Hz can be generated In this manner your basic computer becomes a presettable square wave generator We can rewrite the program so that the square wave s frequency becomes a function of the settings of the toggle switches as follows Step 1 0 JO Uh WN M 0000 0003 0004 0005 0007 0009 000B 000D Bytes F8 FF A2 E2 7A 6C Bl 21 91 3A 07 31 04 7B 30 05 INPUT Comment FF gt R2 0 2 gt X 0 gt Q Switch byte gt MX D D gt R1 1 R1 1 R1 1 gt D Repeat step 5 if D 00 Go to step 3 if Q 1 1 gt Q Go to step 4 5 OR SIMILAR 10K 47K Fig 5 13 Circuit to provide
5. IF Q ON TURN OFF AND 7A RETURN TO 00 30 00 IF Q OFF TURN ON AND 7B GO TO 00 30 00 PROGRAM II STORE DEPENDENT VARIABLE 00 IN LOCATION 77 WITH POINTER IN R4 DESIGNATE R4 AS RX 34 E4 F8 77 A4 F8 00 54 STORE INDEPENDENT VARIABLE 01 IN LOCATION 76 WITH POINTER IN R5 DISPLAY AND DECREMENT RX LOOK FOR INPUT SWITCH ON AND OFF ADD TWO VARIABLES AND PUT RESULT IN LOCATION 77 can be changed to subtract to count down RETURN TO START OF LOOP PROGRAM III MAIN PROGRAM 7B D3 35 F8 76 A5 F8 01 55 64 24 3F OF 37 10 05 F4 54 30 07 7B D3 size of INCR F5 subtract 7B D4 INITIALIZE F8 POINTERS 65 FIFTH DOT TA D3 F8 65 A3 7B D3 FIRST DOT F8 65 SIXTH DOT PAUSE AND RETURN TO START 8D A5 30 00 number of used SECOND DOT A3 A3 TA D5 F8 F8 65 A3 F8 79 A4 F8 8D A5 7B D3 F8 65 A3 TA D3 F8 65 A3 7B D3 F8 65 starting address routine or of memory A3 TA D3 flexibility is THIRD DOT FIRST DASH SECOND DASH 36 F8 65 A3 TA D3 F8 65 A3 7B D4 F8 79 A4 TA D3 F8 65 A3 7B D4 F8 79 A4 TA D3 F8 F8 79 THIRD DASH A4 A4 TA D3 F8 A3 7B D3 F8 FOURTH DOT 65 A3 TA D3 F8 65 A3
6. 12 12 PMH 103 2102 red 10K ER a3 4 UA IC4 2102 DATA Ca BUS 5 art 105 2102 4 SKAAK 10K 12 6 g AA 106 2102 MAN 12 107 2102 r may 10K 12 AR 7421110 IC10 11 4016 PIN 7 OF IC9 10 11 GND PIN 14 OF IC9 10 11 5 Fig 2 15 Eight low cost readily available 2102 RAM s 1024 x 1 and two transmission gate packages 1C8 2102 Memory Expansion You can add 1024 bytes of memory to an Elf microcomputer using inexpensive readily available 2102 type static RAM s as shown in Figs 1 and 2 The 10k bus pull up resistors are required if the high output level of the RAM chips isn t at least 3 volts Bits O and 1 of the high order address byte are clocked into the address latch with TPA Fig 1 These two latched bits are used with the low order COSMAC address byte to provide the required 10 bit address for the 2102 RAMSs Bit 2 of the high order address byte is clocked into the address latch for use in selecting eith the original 256 byte RAM or the added 1024 byte section of RAM Disconnect pin 19 of the original two 2102 RAM chips from ground and connect to pin 12 of the 4042 address latch in Fig 1 The original 256 byte memory will now be addressed as 0000 00FF and the new 1024 byte memory will be addressed as 0400 07FF Since all of the previous programs assumed one byte addresses they will not run in this expanded memory system Programs for systems with more than 256 bytes of memory must have both the high
7. 12 for the hex number 7A and depressing the INPUT switch Release the INPUT switch insert 3F and operate the INPUT switch again Then load 00 and so on until the last byte 01 has been stored at M 0005 If you blow the program set MP to ON and LOAD to OFF Then set LOAD to ON and operate the INPUT switch until you get to the byte immediately preceding the wrong entry Set MP to OFF set up the correct byte and operate INPUT Flip MP back to ON to protect what you have stored in memory To start the program running set LOAD to the down position to reset the 1802 and set the RUN switch to ON Nothing should happen until you depress the INPUT switch at which time the Q LED should come on Releasing the INPUT switch should cause the LED to extinguish If you like you can now observe the timing signals of the 1802 on an oscilloscope while the program is running Another simple program involves counting the number of times the INPUT switch is operated and then turning on the Q LED at the end of the count The flow chart for this program is shown in Fig 8 When you load and run this program nothing will happen until you operate the INPUT switch five times at which point the LED will come on and remain on Note in Step 1 that you can change the number of times the INPUT switch is operated Step 6 just loops on itself to terminate the program after the INPUT switch has been operated the specified number of times Depress
8. Fig 2 16 Video display chip connections are shown at A Optional circuit to replace original Elf crystal is at B 42 PIXIE PARTS LIST CI 330 pF disc capacitor IC1 CDP 1861 video IC RCA IC2 74L00 low power quad 2 input NAND gate IC IC3 7474 dual D flip flop IC J1 Phono jack All resistors 1 4 watt 10 tolerance R1 R6 10 000 ohms R2 2000 ohms R3 1000 ohms R4 R5 470 ohms XTAL 3 58 MHz crystal Misc Printed circuit or perforated board IC sockets one 24 pin two 14 pin Spacers machine hardware hookup wire solder etc Note The following are available from Netronics 333 Litchfield Rd New Milford CN 06776 kit including all of above components except those under Misc at 24 95 complete Elf II kit basic Elf plus Pixie components and hexadecimal keyboard including pc board keyboard support IC s and expansion bus at 99 95 plus 3 00 shipping Connecticut residents add 7 sales tax When the 1802 receives the interrupt request it temporarily stops the program it is executing and immediately branches to the interrupt routine previously stored in memory This branch occurs when P is automatically set to 1 and X is set to 2 The interrupt routine program counter is always R1 which must be set to the address of the interrupt routine before the 1861 is activated and starts sending interrupts to the 1802 A pulse from NO is sent to pin 10 of the 1861 permitting this c
9. The Q LED comes on when Q is high The DMA IN DMA OUT and INTERRUPT lines can be pulled low to cause these operations to occur ONE BYTE INSTRUCTIONS TWO BYTE INSTRUCTIONS IN RNA B0MM GOTOMM BNR S lt BIMM GOTOMMIFQ l O EN RNO gt D B9MM GOTOMMIEQ0 5N D gt MN 34MM GO TO MM IF EF 12 1 7A 0 gt Q LIGHT OFF DMM GOTOMMIFER0 7B I gt Q IGHTON B6MM GOTOMMIFEF3 1 Fo Mx BEMMIGOTOMMIFEROD GO TO MM IF EF4 1 IN DI MX or D gt D 37MM swITCH GO TO MM IF EF4 0 IN DI MX and D gt D 3FMM lSwITcH F3 MX xor D gt D F8KK KK gt D F6 SHIFT D RIGHT BIT 0 5DF FOKK KK or D gt D ROTATE D RIGHT DF a gt B7 B0 gt DF FAKK KK and D gt D IFE SHIFT D LEFT BIT 7 gt DF FBKK IKK xor D gt D peg pe AE DERRE DETENER FDKK KK D 5D CARRY 5DF F5 MX D gt D CARRY gt DF FFKK D KK gt D CARRY gt DF F7 D MX gt D CARRY gt DF FCKK KK D gt D CARRY gt DF F4 MX D gt D CARRY gt DF 7CKK KK D DF gt D CARRY gt DF ONE BYTE INPUT 1 BYTE OUTPUT INSTRUCTIONS N2 NINO INSTRUCTIONS N2 NINO 169 BUS gt MX D lo lo 1 61 MX gt BUS RX 1 fo fo fi 6A BUS SMX D lo 1 0 62 MX gt BUS RX 1 lo fi Jo 6B BUS SMX D lbo 1 1 63 MX gt BUS RX 1 fo fa 1 INPUT SWITCH MX gt HEX 6c BYTE gt MX D o DISPLAY RX 1 h fo fo Table 1 Instruction Subset Table shows required sequence of steps 10 The LOAD and RUN lines control the operation of the microprocessor according to the following conditions
10. perforated board hardware hookup wire solder etc Note the CDP1802 COSMAC microprocessor chip is available from any RCA parts distributor as is the COSMAC user manual hex buffer IC with 0 1 2 54 cm hole spacing The memory contains both instructions and data bytes Instruction bytes tell the computer what to do with the data bytes One byte instructions have two hex digits where high order bits 7 6 5 and 4 tell the computer what type of operation to perform Low order bits 3 2 1 and 0 are usually placed in the N register when a new instruction is fetched from memory Any one of the general purpose registers can be used as a program counter The program counter addresses instruction bytes in memory Each time an instruction is fetched from memory the program counter is automatically incremented so that it points to the next instruction to be fetched Branch instructions can be used to change the address in the program counter to permit jumping branching to a different part of the program when desired The digit in the 4 bit P register specifies which 16 bit general purpose register is being used as the program counter Timing Sequence Since many of the 1802 microprocessor s instructions are only one byte long and require two machine cycles the first cycle is always an instruction fetch or memory read The fetched instruction is executed during the next machine cycle which could be a memory read memory write
11. MREAD line is held high to disable the RAM output bus gates The microprocessor then causes the byte stored in the RAM to be gated onto the bus during the memory write cycle This byte can come from an internal register of the 1802 or from an input device such as switches depending on the type of 8 instruction being executed The 1802 then generates a low memory write pulse MWR that causes the bus byte to be stored in the RAM location addressed by the A0 through A7 lines Circuit Operation Using Fig 4 Fig 5 and the Instruction Subset Table we can now discuss the logic of the Elf microcomputer The RAM access is sent out on lines A0 through A7 Fight tri state bidirectional bus lines are used to transfer the data bytes back and forth between the 1802 s registers and the IC2 IC3 RAM A RAM byte can be transferred to hex displays IC6 and IC7 via the data bus using 1C4 and IC5 to supply the current drive for the displays Displays IC6 and IC7 contain latches to store the display byte The basic clock frequency of the processor is determined by XTAL which should not go above 2 MHz in this circuit The MREAD and MWR lines control the read and write cycles of the RAM while TPA and TPB provide the timing pulses TPA can be used for memory expansion address latching TPB to clock bytes into output circuits SCO and SCI indicate the type of cycle being performed by the 1802 The NO N1 and N2 lines are used to select input or output devices in
12. area 21 User programs from M 21 to M FF 27 After loading EHOPS in memory you can use it as follows To load a byte into any memory location from the hex keyboard set the toggles to 02 and flip the RUN switch up The 02 toggles tell EHOPS that you want to store bytes in memory On the hex keyboard press the most significant digit of a memory address followed by the least significant digit This address byte will be displayed and tells EHOPS where you want to start loading bytes in memory You can now load a sequence of bytes into memory via the hex keyboard Just press the two digits most significant first of each byte you want to load and they will be stored sequentially in memory starting at the selected location 0000 03 06 09 oc OD OF 10 equal 12 14 17 19 1A 1C 1E 20 22 BSUB 23 24 26 28 2A 2D 2F 31 HSUB 33 36 3B 3D 40 41 43 45 46 48 PROGRAM 2 EHOPS 256 F8 F8 F8 F8 D3 D5 6C 3A 81 F6 D5 64 30 D5 51 30 D3 D6 FE FE A0 80 64 30 FO E2 FA 62 3D 7B B4 24 3A TA 35 30 FF 23 33 0D Al 14 A3 3B El 17 El 64 1C FE FE D6 F1 22 22 D5 FC OF 22 33 F8 94 41 46 31 A2 A5 A6 A3 1C 52 01 52 09 R2 0 work R5 0 BSUB R6 0 HSUB R3 0 M 0D P 3 BSUB R1 0 D D M2 toggles M 14 if D 00 Note means not R3 0 R1 0 M 1C if D 02 BSUB X 1 Show M1 R1 1 Repeat M 17 BSUB X 1 M1 D
13. if MX is equal to or greater than D The COSMAC instruction manual covers a detailed explanation of the use of this overflow flag in arithmetic and shift operations In Closing Now that you have some familiarity with programming for the Elf look through your back issues of POPULAR ELECTRONICS for some challenging programs to write Try the Logidex game in the November 1973 issue Tug of War game in February 1975 Electronic Dice in July 1975 and the Executive Digital Temper Countdowner in December 1975 These are just a few of the many electronic games you can program instead of building HEX NUMBER SYSTEM Decimal Binary Hex 0000 0001 0010 0011 0100 0101 0110 0111 1000 1001 1010 1011 1100 1101 1110 1111 o 0d TAU BNWN HO hhh RWUNKHO fHUNWFPODNTNAUBWNHO m ul 25 BY JOSEPH WEISBECKER Build The COSMAC ELF Microcomputer Part 3 How to expand memory plus more programs IN TWO previous articles POPULAR ELECTRONICS August 1976 and September 1976 we discussed the construction of the low cost Elf microcomputer gave some programming examples and described some low cost optional input output circuits Here we will examine some software operating systems and discuss adding 1024 bytes of memory for as little as S20 Operating Systems An operating system is a program that makes it easier to program and use your computer For example if you want to change M 43 in the basic Elf memory you would h
14. outputs used for testing In a similar manner you can program bursts of pulses variable interval pulse trains etc You can even write a program where a list of bytes specifies a sequence of different tones to make a programmable music box The following two programs are games that demonstrate how the COSMAC instructions can be used No added I O circuits are required to run these programs 23 Load the following sequence Step M Bytes Comment 1 0000 El 1 gt X 2 0001 F8 OF Al OF gt R1 0 3 0004 64 MX gt display X 1 4 0005 3F 05 Wait for INPUT switch to be depressed 5 0007 6C Switch byte gt MX D 6 0008 F8 OA F7 OA gt D D MX gt D 7 000B 51 64 D gt M1 MX gt display X 1 000D 30 OD 00 Stop 00 Set both the LOAD and MP switches to off then flip RUN to on Have someone select any digit between 1 and 9 multiply by 10 add the original digit Set the binary code for the least significant digit of the final answer into switches 3 2 1 and 0 and place the other input switches in the down position When you depress the INPUT switch the computer will display the unknown digit This program illustrates how to set a memory byte into the output display with a 6C instruction Note the use of R1 as a memory pointer and the use of the binary subtract instruction in step 6 The following program makes the computer think of a byte which you must guess in no more than seven tries Step M Bytes Comment 1 0000
15. the Elf selection can be made among four input and four output devices The table details the values of the NO N1 and N2 lines during the machine cycle in which an input or output instruction is executed Instructions 69 6A 6B 61 62 and 63 are spares that can be used to add I O devices or ports to the computer When 6C is executed the N2 line goes to a logic 1 state and the bus byte is written into the RAM Since this is a write cycle MREAD will be high With both N2 and MREAD high the output of gate JCJOC will be low putting the input toggle switch byte on the bus so that it can be stored at the memory location addressed by RX This input byte will also be placed in the 1802 s D register When a 64 instruction is executed N2 is high and MREAD is low making the output of C10C high and preventing the input switch byte from getting onto the bus Instead gate IC10B generates an output clock pulse with TPB that clocks the RAM output byte into the hex display The four external flag input lines EF1 EF2 EF3 and EF4 can be pulled low by external switches These four lines can be tested by instructions 34 3C 35 3D 36 3E 37 and 3F Note in Fig 5 that the INPUT pushbutton switch debounced by portions of C1 1 is connected to the EF4 line This means that EF4 1 when S12 is depressed and EF4 0 when S 2 is in its normal position Latched output line Q can be set high by a 7B instruction or reset to low by a 7A instruction
16. the RUN switch circuit as shown You can connect an inexpensive cadmium sulfide CdS cell between the EFI line and ground Be sure to use a photocell that has a dark resistance in excess of 200 000 ohms and a light resistance of less than 10 000 ohms If you use any other photocell you may have to increase the value of the resistor to pull up the EF1 line of the 1802 microprocessor The high input impedance of the CMOS logic eliminates the need for photocell amplification Also several photocell inputs can be used each connected to a different flag EF line Using a photocell input you can program the computer to start counting when an object moves past one photocell and stop counting when the object passes a second cell This technique allows you to determine the speed of a moving object It can also be used to count people monitor motor speed provide targets in a computer controlled light gun or eyes for a computer controlled robot etc Magnetic reed switches simple make break switches or similar devices can be connected to the computer via the flag line inputs Several inexpensive methods of expanding the number of input and output lines can be used with this computer One example is shown in Fig 2 Here a CD4058 IC is used in both the input and the output positions while other IC s provide the necessary gating A 69 instruction will store the values of the eight input lines in memory as a single byte In the output port secti
17. time performing the display refresh function Since the 1802 and the 1861 clocks must remain synchronized none of the three cycle instructions described in the 1802 s user s manual should be used in programs that run concurrently with this display The only exception is the use of the C4 instruction in the interrupt routine The sample program given in Table I was designed to run in expanded memory systems as well as in the basic 256 byte Elf In the expanded system just change the bytes at M 0019 and M 001C so that RO initially points to any 256 byte segment of the memory you wish to display on the raster You can write any other main program to run concurrently with this interrupt routine The 1861 chip can also be used to display any number of memory bytes from eight to 1024 by rewriting the interrupt routine For example change the byte at M 0024 from 20 to 80 and you will see 512 bytes displayed on the CRT screen as 64 spots horizontally by 64 spots vertically If you have only 256 bytes of memory in your system you will ass the same 256 bytes repeated twice on the 46 screen When displaying 512 bytes each spot represents half the height of those displayed when 256 bytes are displayed One of the main advantages of mapping main memory directly into the monitor or TV raster is the ability to manipulate the display using the normal instruction set In systems that employ an external frame buffer for refresh specialized instructi
18. x If a different code elements is change the of each sub move to the end page if F8 65 desired 65 A3 A3 PROGRAM III SUB ROUTINES Must be loaded in order indicated after main program is loaded Sec Loop 1 Sec Loop 3 Sec Loop All instructions same as Sec Loop except where indicated PUT 256 IN REG 1 F8 FF Al PUT VARIABLE INTO F8 a REG 2 08 OF 30 A2 C4 C4 5 DECREMENT AND LOOP THRU C4 R1 UNTIL ZERO THEN C4 x OUTPUT TO DECREMENT C4 REG 2 21 81 37 3A 93 LOOP BACK TO START 22 R 1 CYCLE UNTIL 82 3A 93 6p TE xxx TOTAL TIME IS USED UP 6p i TE xx RETURN TO MAIN PROGRAM DO kk Sets Time If a different number of code elements is used change this instruction to starting address of each subroutine wait loop first C4 38 COSMAC ELF PE TESTED BREAKTHROUGH PROJECT BY JOSEPH A WEISBECKER PART IV Build the PIXIE Graphic Display Adding one chip to the Elf provides completevideo interface and animated graphicscapability for less than 25 If you own an Elf microcomputer see POPULAR ELECTRONICS August 1976 or are planning to build one soon the addition of a single IC and a handful of support components and a change in the crystal frequency can give you Pixie graphics The entire graphics system is built into the new CDP 1861 LSI chip that sells for less than 20 from RCA parts distributors A complete k
19. 0 22 DC 01020300 STACK AREA 13 23 STACK 1 48 25 5 THIS PROGRAM USES A MODIFIED VERSION 26 OF THE INTERRUPT ROUTINE THAT APPEARED 27 IN COSMAC ELF PART 4 28 29 A SHIFT ROUTINE HAS BEEN ADDED THAT MOVES THE 30 STARSHIP FROM LEFT TO RIGHT ACROSS THE CRT 31 ng 4 72 32 RETURN LDXA 5 70 33 RET CYCLES 6 22 35 INTRPT DEC R2 pari 7 78 36 SAV 4 R5 COUNTS REFRESH 8 22 37 DEC R2 6 CYCLES USED TO 9 52 38 STR R2 8 DETERMINE WHEN TO A 15 39 INC R5 10 SHIFT ROLL B C4 40 NOP 13 e 94 41 GHI R4 15 R4 TO RO The 32 lines of the display can be moved up one line by incrementing the starting refresh address by eight between refresh cycles Decrementing register 4 R4 allows the display to be rolled down Hence varying the frequency of shifts or rolls varies the animation speed of the displayed image Control of the speed is via the Elf s conventional INPUT switches Setting all switches to zero and depressing the INPUT pushbutton causes a hex 00 to be read into location 13 stack in which case there will be no movement of the displayed image Loading any nonzero bit through the INPUT switches will animate the image Any bits loaded are compared to the bits in the low order byte of R5 and the bits in the byte read into location 13 Register 5 is used to count the refresh cycles and is incremented by one every interrupt cycle LOC COSMAC CODE LNNO SOURCE LINE 1D BO 42 PHI RO 17 REFRESH ADD
20. 0000 to M 0007 to be fetched and displayed The time of each raster line is exactly 14 machine cycles to permit the transfer of eight bytes eight cycles plus the execution of three two cycle instructions during each raster line time Following the eight DMA cycles required to refresh the first eight bytes RO is restored to its original value so that it remains pointing at the same eight bytes The E2 20 AO instructions at M 0020 M 0023 and M 0026 are used to occupy six machine cycles between the DMA requests and to restore RO to its initial value before incrementing it by eight during the eight byte DMA request The 20 instruction decrements RO 1 back to its initial value if a 256 byte page boundary was crossed during the preceding eight DMA cycles After the first group of eight bytes has been displayed for four raster line times RO is permitted to advance to the next group of eight bytes to be displayed This process is continued until 32 groups of eight bytes each 256 total have been displayed At this time the circuits in the 1861 chip cause line EF1 1 at pin 9 and the interrupt routine terminates Other Considerations The raster refresh involves the display of 32 groups of eight bytes and each row of eight bytes is repeated on four raster line scans This means that the display refresh ties up the 1802 uP for slightly more than 128 raster lines 32 x 4 Since there are 262 raster lines per frame the uP spends about 50 of its
21. 00E 000F 0010 0011 0012 ___ 0016 0017 OOFS DOF9 00F 4 DOFB OOFC DOFD OOFE OOFF Fig 1 Memory addresses of bytes mapped onto TV screen in sample program The selected segment of memory appears on screen as an array of small squares that represent individual memory bits If a memory bit is a 1 the appropriate square will be white while if a bit is a O the square will be dark Changing the bit pattern within the memory will change the pattern that appears on screen You can store several different bit patterns pictures in memory and 43 TABLE I TEST PROGRAM 0008 F8 3F A2 R2 0 stack 000E D3 P 3 gotomain 40 Return 000F 72 restoreD R2 1 001070 restore XP R241 Interrupt 0011 2278 R2 1 saveXP M2 10013 2252 R2 lsaveDEM 10015 C4 C4 C4 no op 9 cycles 10018 FS00BO O 001B F8 00 AO RO 0000 refresh ptr Refresh 001E 80E2 D rOO 0029 BC1E go to refresh BF1 0 002B B00F go to return EFI 1 Main 002D E269 X 2 tumTVon 002F BF2F wait for IN pressed 10031 6C A4 set MX D R4 0 toggles 10033 3733 wait for IN released 10035 BF 35 wait for IN pressed 0037 6C setMX D toggles 10038 54 14 setM4 D R441 003A 3033 lgotoM33 CU using software display them successively onscreen to produce animation effects Low resolution alphanumerics can also be created Since the basic Elf has only 256 bytes of memory we will sh
22. 8A AB RA 0 gt RB 0 secret byte 2 0002 F8 AA A3 AA gt R3 0 memory pointer 3 0005 53 E3 D gt M3 3 gt X 4 0007 F8 07 A4 07 gt R4 0 number of turns 5 000A 64 23 M3 gt display 3 1 3 1 6 000C 2A 3F OC RA 1 until INPUT is depressed 7 OOOF 37 OF Wait for INPUT to be released 8 0011 6C 8B Switch byte gt M3 RB 0 gt D 9 0013 F5 33 1A M3 D gt D Go to step 12 if M3 gt RB O 10 0016 F8 01 01 5D 11 0018 30 22 Go to step 16 show D 12 001A 3A 20 Go to step 15 if D 00 13 001C 53 64 D gt M3 M3 gt display 3 1 14 001E 30 1E Stop loop 15 0020 F8 10 10 gt D 16 0022 53 64 23 D gt M3 gt display 3 1 3 1 17 0025 24 84 R4 1 R4 0 gt D turn counter 18 0027 3A OC Go to step 6 if D 00 19 0029 8B 7B RB 0 gt D 1 gt Q 20 002B 30 1C Go to step 13 show D and stop Place both the MP and LOAD switches in the off position after toggling the program When you start the program by operating RUN AA is displayed Now try to guess what byte the computer has selected by setting the eight INPUT switches and depressing the main INPUT switch If 00 is displayed you guessed correctly if Ol is displayed your guess is too low if 10 is displayed your guess is 24 too high You lose after seven wrong tries at which point the computer turns on its QLED and the displays indicate the hidden byte To try again set RUN to off and then on The subtract instruction in step 9 sets an arithmetic overflow flag DF
23. 9 R6 R6 NXTLNE SFREAD R4 8 R4 R4 00 R4 SFREAD R4 R4 SFREAD 00 RIFFIRST LINE TO SHIFT SHIFT 16 LINES SAVE ADDRESS OF 1st ON LINE IN RA R BYTES TO SHIFT 1 SAVE 1ST BYTE ON LINE IN R8 LOAD NEXT SHIFT RIGHT STORE BYTE CHECK IF ALL SHIFTED PUT BIT 0 of BYT ON BIT 1ST BYT ON R9 BYTE O NXT CHECK IF 16 SHIFTED SKP 38 ROLL AND INCREMENT R4 ONE ROLL SCREEN B B 8 Li S POINT R9 TO NEXT BYTE YTE YTES TH OF NE LINE NES HIFT LINE UP CHANGE LNNO 116 TO ADCI O 7C00 IF THAN 256 BY BE SHIFTED IN LOCATIONS E MORE ES 1 thu 23 STACK 34 thm 64 INTERRUPT PROVIDES AND MAIN TIMING LINE REGS INCREMENTS RS LOADS RO WITH REFRESH MAIN LINE 65 66 ADDRESS TURN ON DISPLAY RETURN 32 33 75 NO MAIN LINE INPUT SWITCHES READ ANIMATION ANIMATION CRT INPUT SPEED SWITCHES CONTROL PROGRAM pre YES 83 thu 110 112 thru 121 SHIFT 16 NO LINES 112 RIGHT CIRCULAR 82 Links This book http incolor inebraska com bill r elf html elf 1 33 htm Group http groups yahoo com group cosmacelf message 138 BMP802 http groups yahoo com group cosmacelf message 138 32 53 54 55 56
24. AUGUST 1976 Popular Electronics A A WA Build The COSMAC ELF A Low Cost Experimenter s Microcomputer BY JOSEPH WEISBECKER Part 1 Simple to build computer trainer can be expanded for advanced applications Part 2 Some hardware improvements and more programming details Part 3 How to expand memory plus more programs Part4 Build the PIXIE Graphic Display Adding one chip to the Elf provides complete video interface and animated graphicscapability for less than 25 1 Build The COSMAC ELF A Low Cost Experimenter s Microcomputer Part 1 PE Tested Simple to build computer trainer can be expanded for advanced applications BY JOSEPH WEISBECKER AAA There are basically two ways in which you can get involved with microcomputers on the nonprofessional level You can buy one of several reasonably priced hobby computer kits add a TV or typewriter terminal and learn to use high level language On the other hand you can build your own inexpensive system from scratch This permits you to experiment with simple applications that do not require an expensive terminal or a large memory You can communicate with the computer in a relatively simple language The Elf microcomputer project gives you the latter category of computer system for about 80 Itis an excellent hardware and software trainer that uses machine language and can be easily expanded to do just about anything a full blown microcomputer can P
25. H WEISBECKER R k da oy Wa Os oe Last month we discussed the construction of the low cost Elf microcomputer trainer and gave some examples of simple programming This month we will describe hardware and how to make a low cost LED replacement for the relatively expensive hex display and add a simple 8 bit I O port Then we ll add a 16 switch monitor that among other things will allow you to use a hex keyboard We ll finish up the hardware section by showing how to use a 9 volt battery as power for a RAM circuit to hold a program for as long as six months When we re finished with the hardware details it s back to the software continuing with our programming discussion 16 The Hardware The hex displays called for in the original Elf project can be replaced with a discrete LED circuit as shown in Fig 1 You will need a CD4508 eight bit register eight low current LED s two 4049 hex inverters and eight 470 ohm 2 watt resistors When the LED circuit is substituted for the hex displays current consumption will be reduced by about 150 mA The input comes from the data bus which formerly went to hex displays C4 and IC5 When you use the LED display you must count the LED s to arrive at the hex number displayed The upper four LED s form the first digit the lower four the second digit You can mount the LED s on the front panel Be sure you carefully identify each Also when making the conversion don t forget to modify
26. RESS 1E 84 43 GLO R4 anik IF AO 44 PLO RO soal 45 ng 20 80 46 GLO RO s23 21 80 47 GLO RO m25 22 80 48 REFRESH GLO RO stan DAE 23 E2 49 SEX R2 29 8 DMA CYCLES 50 24 E2 51 SEX R2 25 20 52 DEC RO 26 AO 53 PLO RO pan 8 DMA CYCLES 54 27 E2 55 SEX R2 28 20 56 DEC RO 29 AO 57 PLO RO nG 8 DMA CYCLES 58 2A E2 59 SEX R2 2B 20 60 DEC RO 2C AO 61 62 a 2D 3C22 63 BNI REFRESH ON EF1 REFRESH 49 2F 3014 64 BR RETURN IS OVER 31 E2 65 MAIN SEX R2 RX 2 32 69 66 IMP 1 TELL 1861 TO 67 TURN ON CRT 68 SFREAD READS INPUT SWITCHESTO CONTROL 69 SPEED OF SHIFTS ROLLS 70 INPUT SWITCH IS STORED AT STACK M R2 ik g 72 INITIAL VALUE OF STACK IS ZERO AND THERE IS 73 NO MOVEMENT OF STAR SHIP UNTIL A NON ZERO BIT 74 IS INPUT 33 3F38 75 SPREAD BN4 CKSHIF IF NO INPUT GO SEE 35 3735 76 WTREAD B4 WTREAD IF TIME TO SHIFT 37 6C 77 INP 4 READ INTO STACK TE 3 a 38 85 79 CHKSHIF GLO R5 GHI R5 VARY SPEED 39 F2 80 AND OF STAR SHIP 3A 3233 81 BZ SPREAD SHIFT ROLL BIT MATCH 3C F800 82 LDI A 1 BEGSFT BR ROLL 3061 3E B9 83 PHI R9 ROLL NO SHIFT The numbers in the program flow chart right refer to the line numbers in the program The program can be set up to shift or roll or shift and roll The program is loaded into locations 78 through F7 Try using the program for the starship shown in Table II of the Pixie article Only the data loaded into 78 through F7 is shif
27. a speaker attached to the Q line Start this program at M CO with EHOPS You can then enter eight bytes via the hex keyboard These bytes should have values between 02 and 7F for best results Each byte represents the frequency of a tone you will hear via the speaker After you enter the eighth byte you ll hear the eight tone sequence repeated over and over You can restart the program at M CD to hear a previously entered tone sequence 30 AB Ag TO FIG 2 ATO A107 Fig 1 14 Address latch Connect pin 19 of original 2101 RAM s to A10 instead of ground PROGRAM 5 0000 F8 00 B1 R1 1 00 03 F8 FF Al R1 0 work 06 F8 00 51 M1 00 09 El 64 21 Show M1 oc FO FC 01 51 M1 1 10 F8 10 B2 R2 1 delay 13 22 R2 1 14 92 3A 13 M 13 if R2 1 00 17 30 09 Repeat M 09 An operating system can be designed to incorporate any desired feature For example you might want to examine the contents of internal 1802 registers or control the operation of a cassette recorder As more features are needed you may want to dedicate the entire 256 bytes of memory in the basic system to your operating system and add another section of memory for your other programs The 256 byte operating system memory can be battery powered and protected from modification by the MP switch so that it is always ready for use 31 M READ Alo A9 AB A7 AB AS Ad AB AQ Al AD M Ic9 4001 Pa 5 5 apy 101 2102 1024 X 1 RAM 6 grin 102 2102 9ang 10K
28. ackaging however is up to you 2 The basic Elf has toggle switch input hex LED display 256 bytes of RAM four input lines and a latched output line It can be used to play games sequence lights control motors generate test pulses count or time events monitor intruder alert devices etc You can do all these things while learning how to program in order to produce a real output to determine whether or not the program you designed works If you prefer not to control or time things a simple LED can be used to indicate whether or not your program works Our focus here is on the construction of the low cost computer and some simple examples of programming Design Details The heart of the Elf microcomputer is the new RCA CDP1802 COSMAC microprocessor chip that sells for less than 30 The chip can use any combination of standard RAM and ROM devices and can address up to 65 536 65 k bytes of memory It has flexible programmed I O and program interrupt modes an on chip DMA direct memory access four I O flag inputs directly tested by branch instructions and a 16 x 16 matrix of registers for use as multiple program counters data pointers or data registers Other features of the 1802 chip include voltage operation between 3 and 12 volts dc at very low current drain TTL compatibility built in clock and simplified interfacing There is also a built in program loading capability that allows you to load a sequence of bytes without havi
29. adecimal and depress the INPUT switch to store the byte in the RAM The value of this byte will be displayed with the hex displays C6 and IC7 Repeat this procedure for each byte to be loaded Setting the LOAD switch to OFF puts the 13 1802 back in the reset state where RO 0000 P 0 X 0 and Q 0 If you wish to see what is stored in memory set MP memory protect switch S3 and the LOAD switch to ON Now each time you operate the INPUT switch successive bytes in the RAM starting with M 0000 will be displayed To change a byte proceed to the byte just before the one to be changed Flip the MP switch to OFF set the input toggle switches to the hex value of the new byte and depress the INPUT switch once This new byte will be displayed and stored in the RAM at the location following the byte at which you stopped Place the MP switch in the ON position You can now continue to operate the INPUT switch to sequence through the RAM without modifying the bytes in memory To start the executive cycle of a program set both the LOAD and RUN switches to OFF to reset the 1802 Then set the RUN switch to ON The program counter is always specified by the hex digit in register P which can be set to zero by reset so that the program counter will always initially be RO Set RO to 0000 by resetting so that instruction fetching or program execution will always begin at M0000 Instructions will continue to be fetched from the RAM and executed
30. at alternately turn the Q light on and off when the input switch is depressed Program II displays and increments successive hex characters each time the input button is depressed To do this it was necessary to learn how to input to and output from the memory using pointers in registers and also to do simple arithmetic through the accumulator register D register Program III plays SOS in Morse code The program should be loaded through the system switch registers if you have a half hour without interruption With this program registers are used for pointers to subroutine loops set up for time delay Three subroutines for 0 5 second 1 second and 3 seconds are established addressed by changing the program counter The main program simply turns the Q light on and off at intervals determined by the subroutines The memory provided in the basic Elf system 256 bytes is enough for approximately 19 code elements Each code element requires only 10 instructions for an on and off interval in the main program The timing loops require the use of two registers to provide a sufficient time In my Elf I used a 1 MHz crystal Obviously changing one instruction in the loop subroutines will vary the time as necessary Changing or adding to the main program can change the code Try loading this program with the switch register if you have enough patience Robert Klein 33 PROGRAM I SWITCH ON AND OFF 3F 00 37 02 IF Q OFF GO TO 09 39 09
31. ave to alter the values of RI and R2 to produce a tight sync lock and the desired modulation level of the spots These are only level adjust resistors and play no role in the actual sync or video production The displayed pattern represents whatever is stored in the Elf s memory The top eight rows represent the program given in Table I You can familiarize yourself with the new graphics ability of your computer if you visualize a grid of 64 boxes wide by 32 boxes deep assuming a 256 byte memory Bear in mind that the operating program given in Table I occupies the top eight lines Since the program ends at memory location M 003B load 00 into memory location M 003F to complete that line Now to display the spacecraft shown in the lead photo load the programs given in Tables Iand II in that order starting the Table II program at memory location M 0040 Reset and switch to RUN 47 If you wish to create your own display Fig 3 illustrates how to arrive at the correct hex digits In this case the example used is for a small area of the program in Table II Use graph paper to draw your picture shading in the spots you want to be white on the CRT screen Then transfer the line bit pattern into the eight hex bytes per line as shown in Fig 3 Conclusion The Pixie system described here adds video graphics to your Elf microcomputer at very low cost So far we have described how the Pixie system can be used to put simple stationary ima
32. ave to start at M 00 and step through memory to location 43 before you could change it Program is a simple opoerating system for the Elf microcomputer It lets you directly examine or modify any memory location It also allows you to start program execution at any memory location We call Program 1 ETOPS 256 Elf Toggle OPerating System for 256 byte memory After loading ETOPS in RAM it can be used to help you load and run other programs To examine a memory location using ETOPS set 01 into the toggles Flip the RUN switch up and 01 will be displayed Now set the address of the memory byte you want to examine into the toggles and push the INPUT switch The next time you push the INPUT switch you ll see the selected memory byte displayed Keep pushing the INPUT switch to see the sequence of bytes stored in memory 26 To modify any memory location set 02 into the toggles and turn the RUN switch up 02 will appear Set the address of the memory byte you want to modify via the toggles Push the INPUT switch and the Q light comes on Now set the toggles to the value of the byte you want to place in the selected memory location and push the INPUT switch to store it in RAM You can store a sequence of new bytes by setting each byte into the toggles and pushing the INPUT switch The Q light warns that you are modifying memory If you have the toggles set to 00 when you flip the RUN switch up you can then set the toggles to the beginning add
33. ence of bytes into memory and then go back and display the sequence Let us write a simple program that can be loaded into the memory and run Suppose you want to program the computer to turn on the Q LED whenever the INPUT switch is set to ON First you must draw a flow chart that shows the required sequence of steps Fig 7 Locate the correct instructions in the Instruction Subset Table A 7A instruction will perform Step 1 Load this instruction into M 0000 Note that when the INPUT switch is not depressed EF4 0 A two byte 3F 00 instruction will jump branch back to the 7A instruction at M 0000 as long as the INPUT switch is not operated EF4 0 This condition is known as a loop and the program will stay in this loop while it is waiting for the INPUT switch to be depressed Load 3F 00 into memory locations M 0001 and M 0002 to perform the second step in the flow chart All GO TO MM instructions shown in the Table put MM into the low order byte of the program counter if a GO TO condition exists Otherwise the next instruction in sequence is fetched by the 1802 Loading a one byte 7B instruction into M 0003 takes care of Step 3 while a 30 01 instruction will jump back to the 3F 00 instruction at M 0001 Load the 30 01 instruction at M 0004 and M 0005 to complete the program You load this 6 byte program by placing the LOAD switch on the ON position with RUN and MP set to OFF setting up the toggle switches
34. es The high order byte appears on address lines A0 through A7 first Then the low order byte is held on the A0 through A7 lines for the remainder of the machine cycle This low order address byte can by itself specify one of 256 locations in the minimum 256 byte memory TPB occurs toward the end of the machine cycle and is used to clock a byte from the RAM into an output device such as the hex display used here An input byte to be stored in the RAM is gated to the bus for the duration of the input memory write machine cycle so that no time pulse is needed for input bytes The MREAD line is low during any memory read machine cycle When low it opens the pin 18 RAM data output gates of IC2 and IC3 permitting the byte stored in the RAM location addressed by AO through A7 to appear on the data bus The RAM s access time is such that the output byte appears on the bus prior to TPB The bus byte from the RAM can then be clocked into an internal register of the 1802 or clocked to an external register such as the hex display with TPB depending on the type of instruction being executed Note The MREAD above has a line over the MREAD instead of using the tilde in the article However there isn t any HTML tag to put a line over characters so I m using the tilde convention instead The overhead line or tilde represent active low signals When the 1802 is performing an instruction cycle that requires a byte to be stored in the RAM the
35. es of articles are based on a clock frequency between 1 and 1 8 MHz Displays C6 and IC7 are relatively expensive hex devices They are the only TTL devices in the computer and as a result draw most of the power required by the circuit If you wish to economize you can substitute ordinary LED s for the displays Next month we will discuss how to make the substitution An inexpensive 9 volt 350 mA dc battery eliminator like those used as battery charger eliminators for calculators can be used to power the Elf 14 When the computer is completely assembled use a dry transfer lettering kit to label all switches and positions IC socket locations and pins 1 of all sockets Then exercising the usual safety procedures for handling MOS devices install the integrated circuits in their respective sockets Coming Up In future articles we will provide more programs as well as methods of adding other types of inputs and relay control output circuits We will also detail how to save programs in battery powered COSMOS RAM s and describe a simple operating system that lets you read write any memory location and inspect general register contents for program debugging purposes Memory expansion hex keyboard input and an inexpensive video graphics display are other subjects we will cover in detail 15 Build The COSMAC ELF A Low Cost Experimenter s Microcomputer Part2 Some hardware improvements and more programming details BY JOSEP
36. ges on screen Accompanying this article is a program that will put the graphics in motion Part 4A PIXIE ANIMATION PROGRAM BY EDWARD C DEVEAUX THE PROGRAM given here can be used with the Pixie version of the Elf microcomputer to create animation graphics using only the original 256 bytes of memory The interrupt routine uses the same timing as described in previous Elf articles However a counter has been added to this routine and we load the refresh address into RO from R4 The main line of the program has been completely rewritten and contains shift roll and INPUT switch read routines The shift routine shifts 16 lines of the display to the right one bit at a time bits shifted off the rightmost byte are shifted back onto the display in the high order position of the first byte on the line LOC COSMAC CODE LNNO SOURCE LINE 1 AN 1802 ANIMATION PROGRAM by E DEVEAUX 2 pa 78 3 BEGSFT 78 ADDRESS OF FIRST LINE SHIFTED 4 ae 5 THIS PROGRAM PROVIDES VARIABLE SPEED 6 ANIMATION OF THE IMAGE LOCATED AT 78 to 7 F7 IN MEMORY 8 SPEED CONTROL IS PROVIDED BY INPUT SWITCHES DO 90 9 GHI RO ZERO HIGH ORDER OF 01 Bl 0 PHI RL R1 R2 R3 02 B2 l PHI R2 03 B3 2 PHI R3 04 B4 E PHI R4 R4 POINTS TO REFRESH 05 A4 4 PLO R4 ADDRESS 06 F816 5 LDI A O INTRPT 08 Al 6 PLO R1 09 F813 7 LDI A 0 STACK OB A2 8 PLO R2 OC F831 9 LDI A 0 MAIN OE A3 20 PLO R3 OF D3 21 SEP R3 GO TO MAIN LINE 10 0102030
37. hip to start sending interrupts A 69 instruction can be used to generate the 1861 activation pulse The 1861 is always turned off when the Elf is stopped with the RUN switch down In the program shown in Table I R1 is set to the address of the interrupt routine at M 0011 R2 is set to the address of the work area or stack used subsequently for byte storage R3 is set to the main program starting at M 002D and setting P 3 causes a branch to M 002D with R3 as the program counter The main program permits entry of the bytes at any time via the Elf s toggle switches This permits you to see what is happening to the CRT screen as memory bytes are changed The program loops on itself until an interrupt signal is generated by the 1861 activated by the 69 instruction at M 002F 43 Exactly 29 machine cycles after the initiation of the interrupt routine the 1861 requests eight sequential memory bytes by putting down the DMA OUT pin 2 request line for eight bytes eight machine cycles This automatically causes eight memory bytes addressed by RO to be sequentially fetched and transferred to the 1861 via the data bus Note that the C4 instructions at M 0015 are special no op instructions that require three cycles for each execution These are used only to provide the delay required to between the beginning of the interrupt routine and the first eight byte DMA request generated by the 1861 display circuits M 0050 0 1 1 1 1 0 1 1 1 1 1 1 1
38. ing and releasing INPUT switch S12 sets flip flop C12 Fig 5 The Q output of this stage goes low causing the required low on the DMA IN line The 1802 responds to this request with a memory write cycle during which SCI is high During this cycle MREAD is high and since LOAD switch S2 is also ON the N2 LOAD signal causes gate IC10C to go high gating the switch input byte to the data bus and storing it in memory When SC1 goes high it also resets IC12 which causes DMA IN to return to its high state The computer then waits for the next switch input byte and LOAD switch operation Following each DMA IN cycle the 1802 holds the AO through A7 lines at the address of the byte just stored in the RAM MREAD is also held low while waiting for the next input byte This means that the previously loaded byte is being gated to the bus from the RAM while waiting for a new byte This bus byte is continuously clocked into the hex display since the LOAD switch is holding IC10B open START PUT COUNT 5 D Fa B5 IN DEPRESSED 3F N2 NO YES IN STILL DEPRESSED 37 B4 ves STEP 1 STEP 2 STEP 3 STEP 4 STEP 5 Fig 8 Program counts number of times INPUT switch is operated A sequence of program bytes can be loaded into the RAM starting at MO M 0000 by setting the LOAD switch to the ON position with the RUN switch set to OFF Set the eight input switches S4 through S11 to the desired byte code in hex
39. it is available see Parts List The two other IC s in the optional add on system are for a crystal oscillator that allows the graphics IC to generate the correct TV horizontal and vertical sync pulses The photo at the top of this page illustrates what can be done with the original 256 bytes of memory in the Elf when the Pixie graphics system is added In this article we will show you how to install and program the Pixie system to produce this type of graphics Some Details The unique Pixie graphics system employs the direct memory access DMA capability built into the 1802 microprocessor in the Elf 42 to work in conjunction with the new graphics IC This allows you to display any 256 byte segment of memory on a CRT monitor or TV receiver The output of the new chip is a I volt composite video sync signal 39 wat ano 191 mm The basic Elf project orginally published in the August 1976 issue of POPULAR ELECTRONICS is shown at left with Pixie components added Elf II is a complete kit including a pe board hexadecimal keypad Pixie graphics components and expansion bus see Parts List The basic Elf project originally published in the August 1976 issue of POPULAR ELECTRONICS is shown at left with the Pixie components added Elf II is a complete kit including a pc board hexadecimal keypad Pixie graphics components and expansion bus see Parts List 0000 0001 0002 0003 0004 0005 0006 0007 0008 0009 0004 0
40. letter O Hence if we refer to the low order or least significant byte of R1 we can call it R1 0 while the high order byte of RF would be called RF 1 RO Rea R 0 Ra i 1 i 1 RF i Fig 3 The 16 registers in the 1802 are labelled RO through RF hex There is also an 8 bit D register that is used to move bytes around In the instruction set shown in part in the instruction Subset Table note that the 8N 8 with a digit code will copy a low order general register byte into register D Writing this instruction as 81 in a program will cause R1 0 to be copied into D when the instruction is executed We can then use instruction BF BN in the table with B and a digit to copy the D byte into RF 1 It takes two bytes 81 BF to transfer a byte from R1 0 to RF 1 via temporary holding register D The byte in D 4 can also be used in arithmetic operations performed by the ALU arithmetic logic unit circuits There are three other important registers that are labelled N P and X Each can hold a 4 bit digit that is used to select one of the 16 general purpose registers For example if you wanted to talk about the general purpose register selected by the hex digit in X you would call it RX If you wanted just the low order byte of RX call it RX 0 RN would refer to the general purpose register designated by the 4 bit digit currently contained in N if the digit is 4 RN R4 The general purpose registers can contain 16 bit me
41. mory addresses Suppose register R3 contains data 0012 M3 would mean the memory location specified by the contents of R3 and M 0012 means memory location 0012 directly MX means the memory location addressed by the contents of the general register selected by the current digit in X If X 3 MX M3 if R3 0012 MX M3 M 0012 Since the basic computer has only 256 bytes of memory we use just the low order bytes of the general registers to address the memory In expanded memory systems you can use the high order bytes of the general purpose registers to select individual 256 byte pages of random access memory RAM J1 5 9Y DC 350m Lane pet ais INPUT 10 12 MPMEMORY PROTECT GND N 83 MP OFF MAR Fig 5 Control circuits for the computer Connections at right go to similarly marked connections on main circuit 1 2 3 6534 IL 17 5 4 3 5V 2 1 181 19 8 IH 7 ya ty B2 11 32 7 A A ka 163 IC10 4023 IC10 IC10 po 5 5l c a a ao 4 xo A a RAM RAM s7 BY 107 ap 2 14 pe A Ic4 47 8 N A A 9 EF4 EF3 EF2 EFI DMA N DMAOUT INTERRUPT R1 R7 47K 5V Q 5V 5V O 1410 el aj 2 tol el al alul 561213 7 ICs 5 6 12 13 Ica 4016 4016 7 7p TT TG TT INPUT SWITCHES SHOWN IN S4p 55 SEA STA 584594510451 DOWN OR OFF POSITION p to t5 fay t3 fa f1 fo pr a LI
42. ng to toggle in a new address for each byte No ROM is required for the minimum trainer system described here The multiple program counters permit some interesting programming tricks and the many single byte instructions keep programs short A block diagram of the Elf system is shown in Fig 1 The pinout for the 1802 microprocessor chip is shown in Fig 2 CLOCK XTAL _ ae 4 INPUT LINES CONTROL OUTPUT LINE CIRCUITS ml N SWITCH HEX OUTPUT DISPLAY 8 BIT DATA BUS Fig 1 Block diagram of basic computer Up to 65K bytes of memory 91 instructions and varied I O ports can be added as the system grows CLOCK CONTROL WAIT VO REQUESTS TIMING PULSES padik BUS 3 MA4 BUS 2 MA3 MEMORY ADDRESS ADDRESS BUS 1 MA2 BUS MAT vec MAG NO COMMANDS N1 NO FLAGS Pa Fig 2 Pin out for the CDP 1802 COSMAC microprocessor Basic Operation The key to understanding the computer is the method used for addressing the memory At first the procedure may appear to be complicated but you will soon see that it is not difficult The 1802 chip contains 16 general purpose registers each holding 16 bits two bytes of memory addresses for data The registers are labeled RO through RF to conform to the hexadecimal numbering system as shown in Fig 3 In the diagrams and in computer technology in general a Danish zero a zero with a slash through it is used to distinguish zero from a capital
43. nging the program counter to R5 with a DS instruction It waits until two hex keys have been pressed before returning control to the calling program with the values of the two keys in the two digits of the byte in D and M2 The most significant digit represents the first key pressed Any program you write with R3 as the program counter can call BSUB to obtain a byte from the hex keyboard If you drive a speaker with the Q lines as described in the September article you will hear an audible click each time a hex key is pressed Program 3 can be loaded and run using either ETOPS or EHOPS This program continuously counts up at a rate determined by the byte at M 5E Be sure to start execution at M 50 PROGRAM 4 CO F8 FO AA RA 0 F0 C3 F8 08 A8 R8 0 08 29 C6 C8 CA xCD DO D3 D6 D8 D8 DD DF El E3 E5 E7 E9 EB EE FO F7 D5 1A 88 F8 F8 EA 64 F8 7B FF 3A TA FF 3A 2C 3A 88 30 5A 28 3A F0 08 F0 28 FF 87 01 DD 87 01 E3 8c DB 3A CD C6 A8 A7 AC D3 BSUB MA D At1 R8 1 M C6 if R8 0 00 RA 0 F0 R8 0 08 R7 0 MA Show MA At1 8 1 RC 0 FF Q 1 D R7 0 D 01 M DD if D 00 Q 0 D R7 0 D 01 M E3 if D 00 RC 1 M DB if RC O 00 M D3 if R8 0 00 M CD if R8 0 00 Table of tone values Program 4 should be loaded and run using EHOPS You should also have
44. on a 61 instruction sets a memory byte into this port The output port can control up to eight output lines but you will have to add CD4050 CD4049 buffers if you wish to drive TTL loads You can use these output lines to drive suitable transistors to control relays lamps or LED s or battery powered motors you can have the computer sequence lights control animated displays or robots or control a slide projector in response to tones from an audio tape You can use the existing Q line output in the same manner for a single operation 17 FROM IC4 PIN15 5V cpanag LED gon ata 4 20 e Y DATA Bus NOTE 13121315 CHANGE ORIGINAL 5V Na Ic4 ICS TO CD4049 onf hanlis 7NG Fa EP nn Fig 1 9 Circuit for a discrete LED display 5Y 24 12 322 Do 134 1 8 BIT INPUT PORT INPUT 3 8 5 DATA INPUT PORT LINES 318 CO4508 fa gt Bus 6 8 710 7 INPUT 214173 clock Sy EE of aon RUN OPTIONAL MREAD 47K of 4011 NG 5 of 4011 of 4011 of 4023 PERO mg son 7 ab g2 g 320 3 DATA J 5 5 3 OUTPUT 8 BIT BUs lt 716 004508 fi UNES OUTPUT PORT 5 TE 7 7 24 D 315 5v 7 Fig 2 10 A way to expand the number of input and output lines using two CD4508 integrated circuits 18 A simple method of controlling up to 16 output lines or monitoring the states of 16 switches is shown in Fig 3 A 62 instruction will set the low order digit of a memory byte into the 4 bit CD4515 register The o
45. ons are required to change the buffer contents The buffer memory also costs more money With the refresh buffer approach toward animation you must store two picture patterns in memory and alternately transfer them to the buffer memory Using the Pixie graphics display described here you store the same two picture patterns in memory but you need only change the initial value of RO to alternately display them Not only do you save the cost of a refresh buffer you can greatly simplify the programming Construction The Pixie circuit can be mounted on the original Elf board by relocating the crystal and two capacitors to the center of the board Now the 1861 IC goes on the upper left of the board and the output jack on the rear apron of the chassis Remove the crystal from the Elf and wire the Fig 2B frequency divider to pin 1 of the 1802 uP Then interconnect the two boards exactly as shown in Fig 2A and B including the power lines Jack J can be mounted on a small metal bracket and secured to the add on board with No 4 machine hardware Also mount R and R2 on the add on board via flea clips because they may have to be changed for different value resistors to suit the modulation requirements of the particular monitor you are using Sample Display Program To test the Pixie load the program given in Table I starting at location M 0000 When this program is run a random spot pattern should be displayed on screen At this time you may h
46. or register transfer type of cycle Program execution always consists of a sequence of fetch execute cycles and the two SCO and SCI lines see Fig 4 and Fig 5 indicate what type of cycle is being performed according to the following criteria SC1 SCO Type of Machine Cycle O 0 instruction fetch 1 instruction execute 1 0 DMA in out 1 1 interrupt Direct memory access DMA and interrupt are special types of cycles which we will discuss later Circuit timing is shown in Fig 6 Note that each machine cycle requires eight clock pulses CLOCK Pin TANUAN AA An TPA PIN 34 YA YA TPB PIN 33 A AT HIBYTE X LO BYTE 1 X HIBYTE MREAD PIN 7 MAR PIN 35 ET ES Fig 6 Microprocessor timing One machine cycle requires eight clock pulses TPA and TPB control various functions both on and off the computer The microprocessor has an internal single phase clock circuit Connecting a crystal between pins 1 and 39 of the 1802 chip causes the clock to run continuously If desired XTAL C3 C4 and RI1 can be omitted and an external clock with a 5 volt swing can be substituted between pin I and ground During each machine cycle timing pulses TPA and TPB are available at pins 33 and 34 of the 1802 TPA occurs at the beginning of each machine cycle and can be used to clock the high order byte of a 16 bit memory address into a memory page selection register Note that the 1802 sends out memory addresses as two 8 bit byt
47. order and low order bytes of address registers properly set The previous programs can be easily modified to run in the expanded system by initializing both high and low order bytes of any 16 bit register used to address memory The foregoing counting program could be modified to run at M 0000 in an expanded RAM system as shown in Program 5 In general it adds only a few bytes to program for an expanded memory system By adding bits to the address latch of Fig 1 you could address up to 64k bytes of RAM Instead of addressing extra memory the high order address bits could be used to select input output circuits or devices 32 Don t forget that adding memory will increase system power requirements As the system is expanded make sure your external power supply can handle the increased current requirements With this in mind you ll find that the Elf can be tailored to your needs at low cost A READER S ELF PROGRAMS I recently constructed the COSMAC Elf described in your August 1976 issue and thoroughly enjoyed the construction and testing of this microprocessor system I build approximately two projects a month that are illustrated in your magazine plus some from other sources This particular project turned out to be the most interesting I have ever constructed Here are three programs that I found useful in illustrating various system functions Program I is simply an expansion of your Q light program with additional decisions th
48. ou run this program the square wave frequently depends on the settings of the input switches You can change frequency at any time For higher frequencies change BI at M 0006 to Al and 91 at M 0008 to 81 You can now select any of 256 different frequencies by altering the settings of the switches To modify the program to sweep the audio frequency range use the following program Step M Bytes Comment 1 0000 F8 FF A2 FF gt R2 0 2 0003 7A 0 gt Q 3 0004 82 Al R2 0 gt D D gt R1 0 4 0006 21 81 R1 1 R1 0 gt D 5 0008 3A 06 Repeat step 4 if D 00 6 000A 31 03 Go to step 2 if Q 1 7 000C 7B 22 82 1 gt Q R2 1 R2 0 gt D 8 OOOF 32 00 Go to step 1 if D 00 9 0011 30 04 Go to step 3 This program can be used in audio test applications Note that R2 is used as a second counter that causes the square wave frequency to change after each cycle You can hear what this sounds like by using the circuit shown in Fig 5 Very low frequency square waves or long interval timing can be programmed by cascading counters as illustrated in the following flow chart 21 NO R3 1 HG YES I Q The Q line can then be used to activate a relay as in Fig 5 which can control house lights motors etc Suppose you wish to program a variable pulse generator instead of square wave generator Use separate counts for the pulse off and on times as illustrated in the following flow chart f rQ OFF COUNT R1
49. ow how to display the entire memory on the screen The memory is mapped as shown in Fig 1 in an array of 64 spots wide eight bytes with eight bits byte by 32 spots high to make a total of 256 bytes The byte at M 0000 is displayed at tthe upper left of the screen each row on the screen is equivalent to eight memory bytes Byte M 00FF appears at the bottom right of the screen 41 Circuit Operation The entire schematic diagram for the Pixie graphics display system is shown in Fig 2A It consists of five components the 1861 chip a phono jack for the video output and three resistors The circuit shown in Fig 2B may be used to replace the original crystal used in the Elf microcomputer This is necessary because to use the graphics display the original crystal frequency must be changed to approximately 1 760640 MHz to generate the correct TV horizontal and vertical sync pulses Crystals of this frequency may be expensive The Fig 2B circuit uses a 44 readily available 3 58 MHz color TV crystal and frequency divider to generate 1 789773 MHz which is close enough for the 1861 chip to perform properly The 1861 chip uses the same clock as the 1802 uP chip to trigger internal counters to provide the TV like composite sync at pin 6 The graphics display is directly refreshed from the memory 60 times each second accomplished by an interrupt request sent to the 1802 at the same rate XTAL o 3 79545 MHz 1 789773 MHz TO 1802 PIN 1
50. que would permit up to 128 I O lines Cascading CD4515 s would permit even larger numbers of I O lines to be handled A low cost video terminal can be made using the Scopewriter POPULAR ELECTRONICS August 1974 or you can interface your computer with a cassette data interchange system 19 We have only scratched the surface of I O circuits for the Elf The real fun and program training starts when you think of new things to attach to the output lines and start writing programs to activate them The major drawback with a RAM or memory system is that data stored in it is erased when the main power source is shut down Of course if you could use a ROM this wouldn t be a problem However ROM s must be preprogrammed with the memory data you wish to save a costly and time consuming approach Adding a cassette interface doesn t entirely eliminate the problem because a bootstrap is still required to be stored in memory to run the cassette The use of low power COSMOS RAM IC s and a 9 volt mercury battery as shown in Fig 4 will allow you to save programs in memory for up to six months even with the main power to the computer turned off The 1822 RAM s shown are in compatible with the 2101 s specified for the original project but some of the RAMS s must be rewired as shown With the COSMOS RAM s installed you can turn off power to the computer at any time The mercury battery will supply the required standby power to the memory sys
51. ress of a program you want to execute Just push the INPUT switch to start executing your program at the selected address Your program will begin execution with R3 as the program counter If you ve added the battery RAM option to your system ETOPS will be ready to use as soon as you turn on power Since ETOPS uses only 32 bytes you still have 224 bytes available for your own programs Keyboard Systems Adding a hex keyboard would make your Elf microcomputer even easier to use with 16 keys labelled 0 through F you would have to press only two keys for each byte you want to store in memory In the second article we described a circuit for monitoring the status of 16 switches or keys See POPULAR ELECTRONICS Sept 1976 page 38 Fig 3 If you add this circuit and a 16 key hex keyboard you can use Program 2 EHOPS 256 Elf Hex OPerating System for 256 byte memory This program requires 74 bytes of RAM so you still have 182 bytes left for your own programs You can also use the hex keyboard subroutine as part of your program if desired PROGRAM 1 ETOPS 256 0000 F8 20 Al R1 0 work 03 El X 1 04 6C 64 21 D toggles 07 3F 07 Wait for IN on 09 37 09 Wait for IN off 0B 32 1D M 1D if D 00 0D F6 33 11 M 11 if D 01 10 7B Q 1 11 6c Al R1 0 toggles 13 3F 13 Wait for IN on 15 37 15 Wait for IN off 17 39 1A M 1A if Q 0 19 6C M1 toggles 1A 64 Show M1 R1 1 1B 30 13 Repeat M 13 1D 6C A3 R3 0 toggles 1F D3 P 3 20 00 Work
52. show M1 R1 1 Repeat M 1C P 3 return HSUB D left x 2 D left x 2 R1 D HSUB M2 R1 or M2 Show M2 Go to M 22 D M2 P 5 X 2 D 1 M2 D and OF Select key M2 M 33 if key off 0 1 D 09 R4 1 09 R4 1 M 41 if R4 1 00 Q 0 Wait for key off Go to M 31 28 To examine any memory location without changing its contents set the toggles to 01 before you flip the RUN switch up Using the hex keyboard enter the one byte starting address of the sequence of memory locations you want to examine Press any hex key twice to step through memory and display the stored bytes To run a program you ve loaded using EHOPS set the toggles to 00 before flipping the RUN switch up Using the hex keyboard enter the one byte starting address of your program It will begin running with R3 as the program counter PROGRAM 3 0050 F8 FF Al R1 0 work 53 F8 00 51 M1 00 56 El 64 21 Show M1 59 FO FC 01 51 M1 1 5D F8 10 B2 R2 1 delay 60 22 R2 1 61 92 3A 60 M 60 if R2 1 00 64 30 56 Repeat M 56 EHOPS controls the hex keyboard with two subroutines called BSUB and HSUB BSUB calls HSUB by changing the program counter to R6 with a D6 instruction HSUB continuously scans all 16 hex keyswitches until one is pressed It provides a switch debounce delay and waits until the key has been released It then returns control to BSUB with the value of the pressed key in the least significant digit of the byte in D and M2 BSUB is called by cha
53. ted but the entire area from 00 through FF is rolled Loading the program exactly as it is listed here will enable the shift routine only Loading a 38 SKP instruction in location 5F line 111 will enable both shift and roll routines Loading 30 61 BR ROLL in locations 3C and 3D line 82 will enable only the roll routine After loading and running the program animation of the display will begin after any nonzero byte is loaded via the INPUT switches and operation of the INPUT pushbutton By varying the INPUT bit pattern you can control the speed of the animation If you have never seen a stack in motion when a program is running take a look at displayed location 13 Then vary the speed 50 3F 41 42 44 45 46 47 48 49 4B 4c 4D 4E 4F 50 51 52 53 54 55 57 58 59 5A 5B 5C 5D SF 61 62 64 65 68 69 6B 6C 6D 6F F878 A9 F810 A6 99 BA 89 F807 AT 09 B8 76 19 09 76 59 27 87 3A4F 76 5A 19 26 3A45 3033 84 FCO8 A4 94 F800 B4 3233 84 B4 3033 00 OmINUSVUNKE NNN KO BE OS 23 24 25 MXTLNE MXTBYT vVOUWVH VED Fa UWE E o H Q2 id E T bol Q N HRC R NZ TR Z Q EC LO KA N ROLL Qt 3 QWWQEAUHUMNNARURLUNUEt N Win W d Ek E O ENTER IMAGE TO X 78 RIE END 51 A 0 BEGSFT R9 16 R6 R9 RA R9 RA 7 R7 R9 R8 R9 R9 R9 R7 R7 MXTBYT R8 RA R
54. tem so that the program will be ready to run immediately when the computer is again powered up The newly added STANDBY switch should be turned on 5 volts only after power is turned on It should be off to hold pin 17 of the RAM s at ground potential before removing power from the system MREAD 5V MAR CDPI822 CDPI822 ADDRESS Ad 256 X 4 256 X 4 LINES A3 RAM A2 A1 DATA LINES Fig 4 12 Using a low power COSMOS RAM and a 9 volt battery permits saving programs in memory Periodically check the battery s output if it should fall too low the memory system won t be able to hold data 20 The last piece of hardware we will discuss here is the simple output driver shown schematically in Fig 5 This is a conventional driver for almost anything that doesn t require more current than the transistor is capable of safely handling The diode in the relay circuit removes the reverse transient spike that might otherwise damage the transistor You can substitute a LED or even a load resistor for driving a power stage More Programming The single line output program shown below is a simple program that will flash the Q LED at a preset rate It also provides a programmable square wave on the Q line Step M Bytes Comment 1 0000 7A 0 5Q 2 0001 F8 10 B1 10 gt R1 1 3 0004 21 R1 1 4 0005 91 R1 1 gt D 5 0006 3A 04 Repeat step 3 if D 00 6 0008 31 00 Go to step 1 if Q 1 7 000A 7B 1 gt Q 8 000B 30 01 Go to step 2 When y
55. until the RUN switch is set to OFF resettting the computer Make sure that the MP switch is OFF when running programs so that computer operation is not inhibited Construction Notes Hardware assembly is relatively simple permitting the project to be put together with ordinary perforated board with 0 1 2 54 mm hole spacing and IC sockets using either Wire Wrap or a wiring pencil See photo The perf board measures 5 2 L x 4 W 14 x 10 2 cm and is supported on a base made up of lengths of 34 x 3 8 19 1 x 9 5 pine A sheet of thin aluminum provides the support for the eight toggle type data switches The LM309 voltage regulator IC 1C13 is mounted on a 144 x 34 x 1 8 31 6 x 19 1 x 3 2 mm piece of aluminum to serve as a heat sink Do not mount the IC s except the display devices in their sockets until after all wiring is complete Socket switch and component layout should be roughly the same as shown in the photo Be sure to locate the crystal close to pins 1 and 39 of the microprocessor s socket Then wire the circuit in accordance with the schematics in Figs 4 and 5 Any crystal with a frequency of between 1 and 2 MHz can be used in the EIf or you can substitute a simple 555 or CMOS oscillator with a 5 volt signal swing between pin of the 1802 and circuit ground in which case you will have to omit XTAL C3 C4 and R11 There is no lower limit to the clock frequency but most of the sample programs discussed in this seri
56. utput line corresponding to this digit will go low while the other 15 remain high To make things more interesting the computer can determine whether the switch attached to the selected output line is closed or not by testing EF2 with a branch instruction 57 Fig 3 11 A method of controlling up to 16 outputs The following program continuously examines all 16 switches in sequence and stops with the number of any closed switch from 0 to F in the low order digit of R3 0 Step M Bytes Comment 1 0000 F8 FF A2 FF gt R2 0 memory pointer 2 0003 13 52 E2 R3 1 R3 0 gt MX 2 gt X 3 0006 62 22 MX gt CD4515 select switch 4 0008 3D 03 Repeat step 2 if switch is open 5 000A 30 0A Stop with R3 0 closed switch number The diodes can be omitted if only one switch at a time will be closed This circuit and an appropriate program could permit data and instruction bytes to be loaded into memory a digit at a time from a hex keyboard instead of toggle switches Switch debouncing could be performed with a programmed delay following each key depression A 64 character keyboard could be used by treating it as four groups of 16 keys each with the common side of each key group connected to a different flag line In fact a program to generate the Morse code equivalent of each key could be written using the Q line as the output This circuit can also be used to select one of 16 external devices or I O ports if desired Using the latter techni
Download Pdf Manuals
Related Search
Related Contents
T'nB NEDI032336 air compressed spray SHARP® MANUEL DE SERVICE Avant-propos - Migros Navigation Guide User Manual StarTech.com Round Head Replacement 6-32 Hard Drive Mounting Screws CATALOGO SOLUZIONI DI PROTEZIONE CHRONOPHAGES & LOTOPHAGES ふちなし印刷をするには? Fiche d`observation annuelle – tous les ateliers Copyright © All rights reserved.
Failed to retrieve file