ANN: Cute X86 assembler simulator on RevOnline

Andre Garzia andre at andregarzia.com
Fri Sep 14 14:22:12 EDT 2007


Hi Friends,
some may recall a previous post I made on my blog:

    http://andregarzia.com/blog/files/aasm.html

In which I detailed the construction of a simple assembly language simulator
that I made to prep myself to an assembly examination at my university. I
decided to make it available so people can check it out. I've also expand
the original instruction set to have more commands.

Just for the kicks, I've added a built-in mini portal like RevOnline where
users can upload and download assembly source code. I've added a couple,
including a simple fibonacci series printer.

The subset of the assembly language implemented is very small, just enough
to run the exercises from the chapter used in my examination. Also, I've not
implemented memory access, all you have is four registers to play (ax, bx,
cx, dx).

It is an educational tool, I find it fun and decided to share. Of course
there are a lot of bugs and places for improvement,  this is a little ad hoc
interpreter, not a solution.

its on my space in revOnline

Instruction set:
GET - fetches a numeric input from keyboard.
PUT - display content of ax register.
MOV - copies content to target register
   MOV <target>, <register>
   MOV <target>, <number>
CMP - compares to registers
JA - jump if greater
JB - jump if smaller
JAE - jump if equal or greater
JBE - jump if equal or smaller
JNA - jump if not greater
JNB - jump if not smaller
JE - jump if equal
JNE - jump if not equal
JMP - jump!
XCHG - swaps two registers
ADD - sums
SUB - subtracts
AND - bitwise and
OR - bitwise or
XOR - exclusive or
CALL - call subroutine
RET - return from subroutine
HALT - finishes
SETE - set 1/0 if equal
SETNE - set 1/0 if not equal
SETLE - set 1/0 if lower or equal
SETL - set 1/0 if lower
SETG - set 1/0 if greater
SETGE - set 1/0 if greater or equal
SETNLE - set 1/0 if not lower or equal
SETNL - set 1/0 if not lower
SETNGE - set 1/0 if not greater or equal
SETNG - set 1/0 if not greater

Bonus points for the line by line execution and line hilighting. Minus point
for not having an abort button when you enter infinite loops...

Alan J Perlis said, have fun coding...

Best
Andre



More information about the use-livecode mailing list