In case anyone
is interested, I whipped up a little CARDIAC
simulator as a JavaScript exercise last night.? You can find
it at:
http://cs.drexel.edu/~bls96/museum/cardsim.html
This is fun!
Summation program:
??? 00: 090??? Read input into location 90
??? 01: 190??? Clear and add first addend into accumulator???
??? 02: 691??? store first addend into running sum???
LP??? 03: 712??? Subtract 1 from current addend to get next added
??? 04: 310??? Test, branch to 10: if subtraction result < 0
??? 05: 690??? store current added to location 90
??? 06: 291??? Add running sum into accumulator
??? 07: 691??? store running sum back into location 91
??? 08: 190??? clear accumulator and place current addend
??? 09: 803??? branch to LP 03:
???
??? 10: 591??? Output running sum
??? 11: 900??? Reset and halt
??? 12: 001??? Constant #1 used for decrement
...
Brian, thank you!
Glad you're enjoying it. There's another fun aspect that you might
want to play with. It's talked about in the manual a bit. You can
bootstrap your program on cards. That's why memory location 00
is set "permanently" to 001. (The simulator does let you change it.)
The bootstrap starts with the two cards 002 and 800. They are
followed by pairs of cards containing the address and value of
what you want to load into memory. Then, to make it jump to the
first instruction of your program, the last two cards will be 002 and 8xx
where xx is the address of the first instruction. Finally, any input
data is put after the 8xx card. I've relocated your program to
address 10, used memory locations 5 and 6, and reused the 001
in location 00 for your decrement constant in the cards below. If
you start with clear memory, cut and paste this list into the input box,
hit reset and hit run, it'll load the program into memory and run it.
002
800
010
005
011
105
012
606
013
700
014
320
015
605
016
206
017
606
018
105
019
813
020
506
021
900
002
810
060
BLS