In order to create ROMs in LogicWorks to hold your programs, follow
these steps:
1. Translate your assembly code into machine code (binary).
It might look something like this:
00111100
00001111
10101010
00001111
01110111
11110000
00110011
00001111
01110011
2. Then translate that into hexadecimal (by hand),
and put it in a file that looks something like this (notice that comments
are allowed in this file, preceded by a #):
# program 2
#divide
# by me
3C # lda $3, $4
0F #add $1, $2, $7
AA #etc.
0F
77
F0
33
0F
73
The allowed format is actually more flexible than this, but there is no need to stress it.
Now that you have your input file (I'll assume it is called prog_file), you need to:
3. Translate the hexadecimal file into something LogicWorks
understands, which is the bizarre ihex format. To do that translation,
Jeff Brown, your classmate, has written a program, which is at least as
good as mine, so we'll just use his. It can be found at his
directory, or I also have saved a copy locally.
Download the C file (ihex.c), compile it ("cc -o make_ihex ihex.c", for example, on Unix), and run it on your program file:make_ihex < prog_file > prog_file.ihex
(having the .hex suffix allows LogicWorks to find the file a little easier).
4. Then using an ftp program like "fetch" on the Macintosh,
transfer the .hex file to the machine running LogicWorks. The rest of these
instructions refer to LW 3.0 on the Mac, but I doubt that they are much
different for the PC.
1. Create your own device library, if you haven't already.
2. Select PromPLA from the Tools menu
3. Choose your custom library from "Save To Library:"
4. Give your device a name
5. Set number of inputs. This is the number of bits needed to address your
biggest ROM. My nine-line (nine-instruction) ROM above would need 4 bits,
a 256-line ROM would need 8 bits (8 inputs).
6. Number of outputs is 8.
7. Now it will let you select a file. Hit "Hex File" button and open your
.hex file.
8. Hit Build PROM
9. Now you can select that device from your device library and put it in a
circuit. Be sure to test it carefully.