Popular Electronics
MARCH 1977
[63] [64] [65] [66] [67]
[Part 1] [Part 2] [Part 3] [Part 4]

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.

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 0 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 RAM's. 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-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.

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 that 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



        PROGRAM I



SWITCH ON AND OFF      3F

                       00

                       37

                       02



IF Q OFF GO TO 09      39

                       09



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     E4

IN LOCATION 77 WITH POINTER     F8

IN R4--DESIGNATE R4 AS RX       77

                                A4

                                F8

                                00

                                54



STORE INDEPENDENT VARIABLE 01   F8

IN LOCATION 76 WITH POINTER     76

IN R5                           A5

                                F8

                                01 (size of INCR)

                                55



DISPLAY AND DECREMENT RX        64

                                24



LOOK FOR INPUT SWITCH ON AND    3F

OFF                             0F

                                37

                                10



ADD TWO VARIABLES AND PUT       05

RESULT IN LOCATION 77           F4 (F5 subtract)

(can be changed to subtract     54

to count down)



RETURN TO START OF LOOP         30

                                07

[63] [64] [65] [66] [67]
[Part 1] [Part 2] [Part 3] [Part 4]
66 POPULAR ELECTRONICS