SimCom  the Simple Computer

SimCom has

So what can go in the memory boxes? There is room for 4 digits in a memory box. The four digits are sometimes broken into TWO parts by SimCom Here's a simple example: 785. "7" means "jump to" so 785 means "jump to box 85". Why not try it?

Type 785, press enter, click box 00 and click the GREEN button.

SimCom has 18 instructions (Assembler equivalents in brackets):
   0 halt (HLT).
   2 return from subroutine (RTS).
   3 load the accumulator with the number in the next box (LDA #).
   5 add the number in the next box to the accumulator (ADD #).
   6 subtract the number in the next box from the accumulator (SUB #)
 1AA input a number from the keyboard into box AA (INP).
 2AA output the number in box AA to the printer (OUT).
 3AA copy the number in box AA into the accumulator (LDA).
 4AA copy the number in the accumulator into box AA (STA).
 5AA add the number in box AA to the accumulator (ADD).
 6AA subtract the number in box AA from the accumulator (SUB).
 7AA jump to box AA (JMP).
 8AA jump to the subroutine starting at box AA (JSR).
 9AA branch to box AA if the accumulator is negative (BMI).
10AA branch to box AA if the accumulator is equal to zero (BEQ).
11AA branch to box AA if the accumulator is positive (BPL).
12AA add one to box AA (INC).
13AA subtract one from box AA (DEC).

So let's try something a bit more useful than jumping to box 85. How about a program to add two numbers together? First the steps in our language:

  1. get a number;
  2. get another number;
  3. add the two together;
  4. output the result.
Pretty easy huh? Here we go then:

Here's the final program:

00 120
01 121
02 320
03 521
04 422
05 222
06 700

You can now save this program by pressing the ORANGE button - it will be saved as Number 1. It may be recalled at any time with the BLUE button.

Your turn! Write a program to input one number and print its double. Drag your mouse across the space below to see my answer.

00 120
01 320
02 520
03 421
04 221
05 700

My most complex program to date is one to generate the prime numbers. Press the P key to check it out. Best to run it at full speed!

And here's some little challenges for you ...

  1. add two numbers (my example above)
  2. double a number (already done)
  3. teach SimCom to count ... i.e. print 1,2,3,4...
  4. how about a countdown from 10 to 0?
  5. print out the even numbers ... i.e. 2,4,6,8,...
  6. print out the odd numbers ... i.e. 1,3,5,7,...
  7. multiply two numbers;
  8. square a number;
  9. print out the square numbers ... i.e. 1,4,9,16,...
  10. print out the Fibonacci numbers ... 1,1,2,3,5,8,13,...
  11. divide one number by another and print the quotient and the remainder.

My answers

Finally, here's a neat demonstration of how a tiny program can wipe out an entire computer. Enter this program and press the green button:

97 200
98 1297
99 797

Some Extension Ideas:

  1. What is the largest number SimCom can store?
  2. Try to discover or work out the largest:
    • even number
    • odd number
    • square number
    • Fibonacci number
    that SimCom can produce.
  3. What is the result of 9999+1 on SimCom?

The last question opens up a whole new world of investigation if you're into negative numbers. The answer means that 9999 is the same as -1 on SimCom.

So -2 would be 9998 and -3 would be 9997.

If you're prepared to leave your SimCom running overnight, try 9998 x 9997. Another approach is to use a calculator.

What about 9998 + 9997 ?

And ... 9997 x 2?

Computer afficiandos will recognise that this is how real computers deal with negative numbers.