View Full Version : Test my new program!

09-11-2003, 10:38 PM
Hello World!
I've just about finished my new program (Version .8) called ComEmm (very original i know). Anyways what it does is take assembly-like programming instructions and processes them showing just what happens in the memory of a computer. It really isn't to be used as a real programming language *duh* but rather a teaching tool to show how very basic computer instructions and memory works... nothing special, but it is my first REAL program... (well nearly)

Anyways, enough ramble, heres a link


Those who know assembly/programming shouldn't have tooooo much trouble understanding it, theres a basic help file included for getting started.

- David
p.s. many diet coke cans have been druken and broken in the making of this program..

09-11-2003, 11:13 PM
very cool!!

fetures you might want to add are:

1. a way to save and load the programs you have writen
2. a way to load from a text file listing.
3. a few more registors
4. a few more commands like XOR, AND, OR , Compare
5. a stack
6. bigger address space (8-bit)

with a system that has the extra fetures like I have listed you could write some very cool code.

10-11-2003, 12:14 PM
Thanks for the reply! it helps a lot..

Anyways i was planning adding save/load for version 1.0 as txt (or .cme files or something...) in version 1.0

I was planning on adding a few more commands such as OUT for printing text on the screen and all those XOR and if's etc etc, later. It's basically just the bare bones at the moment.

Sorry to sound stupid but what do you mean by more registors and a stack...

Thanks a heap

- David

10-11-2003, 12:46 PM
ok so you have a accumulator for the add comand and such like.
if you add say an X and a Y register then you can do loops counted off by the X regester and such cool things.

having another register called SP (stack pointer) lets this example work.

LDX 11111 ; LDX is load the number to X regester
MOV SP,X ; this moves the number in the X to the SP (SP now point to top of ram)
LDX 101 ; load 5 to the X regester
PUSH X ; this pushes X on the stack (location 11111 holds 5 and SP is decresed by 1)
LDY 111 ; load 7 to Y regester
PUSH Y ; this pushes Y to the stack (location 11110 holds 7 and SP is decresed by 1)
POP X ; this pops 7 off the stack (location 11110) and incress SP by 1
POP y ; this pops 5 off stack (location 11111) and increses the SP by 1

the effect of that code is to swap the data from X regester to Y regester.
the other things that the stack can be used for is procedures. push the current program count to the stack then jump to procedure. and the end of the procedure do a RET (return) and the program count to POPed off the stack.

hope all that made sence.

10-11-2003, 01:02 PM
wow this is real assembly ;)
lol i'll try figure it out later... i've been studying physics for exams all morning and my head hurts :P

So basically x and y are just variables... that shouldn't be too hard to implement (famous last words )

- David

Wayne H
10-11-2003, 05:51 PM
I thought that the topic started out in English, did i loose something in the translation?

10-11-2003, 06:01 PM
I broke in to assembler there for a bit :-)

if you dont understand it then dont panic.

unless you want to program in a very full on way or understand what your computer is doing in the CPU then you dont need to understand.

10-11-2003, 06:12 PM
Well this is what summer is going to be for... all night coding sessions and too much diet coke :)

- David

10-11-2003, 08:24 PM
Hey Dave, just a few pointers

Should have separate temporary registers
Program Counter should be a special register that points to current address executed
Recommend you do the addresses in hex and expand to 16 or 32 bits. Also expand address range
Stored values should be in hex, alot easier to figure out fast, no confusion
memory/ram is used for storage and retrieval, no direct manipulation

All functions like adding, subtracting etc are done in temporary registers and then stored to main memory
Also need more instructions like loading an address into a temporary register, compare instructions etc, but get fundamentals right first
Also recommend one line opcode e.g. ENT temp1; will store to temp1
An example below of what the memory and registers look like after the following program has been run:

STO temp1 //enter 3
temp2 //enter 4
ADD temp1, temp2, (0x0007)
//had to change this a bit, you can only store to (memory address) or temp?

Temporary registers

identifier memory ascii hex

temp1 00000003 ???? Hex 0
temp2 00000004 ???? Hex 0
temp3 00000000 ???? Hex 0
temp4 00000000 ???? Hex 0
temp5 00000000 ???? Hex 0
temp6 00000000 ???? Hex 0
temp7 00000000 ???? Hex 0
temp8 00000000 ???? Hex 0

program counter 0000000a ??? Hex a integer=10

main memory
0001 10000000 ENT
0002 20000000 STO temp1 //enter 3
0003 30000000 ENT
0004 40000000 STO temp2 //enter 4
0005 50000007 ADD temp2, temp1, (0x0007)
0006 60000000 END
0007 00000065 ??? Hex 7
0008 00000000 ???? Hex 0
0009 00000000 ???? Hex 0

However apart from that you have made an excellent start, look forward to see v1.0.

10-11-2003, 08:55 PM
couple of corrections

temp1 00000003 ??? Hex 3
temp2 00000004 ??? Hex 4

0007 00000007 ??? Hex 7

10-11-2003, 09:11 PM
Thanks for the help, it has been a great inspiration... i never expected this much interest...

I feel i might create a simple and complex mode, one with basic commands and another with complex more assembly like instructions with a stack etc, but then again i'm going to finish my NCEA Level 2 exams first ;)

- David