My favorites | Sign in
Project Logo
                
Feeds:
People details
Project owners:
  sirdarckcat

This is a javascript/PHP implementation of a low level virtual machine.

It has a similar syntax to Intel ASM.

Wazm Standard
by sirdarckcat@gmail.com

Overview:

The Wazm standard is the only accepted standard for the WZVM project. This document contains the correct syntax that the WZVM accepts. It also shows the standard interruptions, but this ones can be modified depending on
the implementation of the WZVM.
This program is not intended to emulate Assembly language at all. This program is based on the "Simulador" problem (Mexican 1st Preselective test IOI 2006).
General:
We work on a VirtualMachine (WZVM), that runes not in bytes, but in wytes. The wytes can hold up to any signed number between -9999,9999 There are 10 registers, e0x,e1x,e2x,e3x,e4x,e5x,e6x,e7x,e8x,e9x You have a reserved stack memory of 10,000 wytes. The WZVM is able to hold strings, in memory using C style, if the value is bigger
than 255 the asumed value is '\0'.
There is another type of memory, the zyte memory, it can only store a value between
0 and 999.
This memory only is accesible to the WZVM, and has a limited memory of 999 zytes. The char "<" serves as one line "comentary", anything written after it will be ignored. The char ">" serves as multiline comentary, anything written after it will be ignored until
another ">" is found.
OPCODES and instructions:

000 - int 0 // ext < exit 001 - int 1 // ret < return 002 - int 2 < print string value of e1x to stdout 003 - int 3 < read string value from stdin and save it to e1x 004 - int 4 < print string value of e1x to handler e2x 005 - int 5 < read string value from handler e2x and save it to e1x 006 - int 6 < CONFIGURABLE HANDLER 1 007 - int 7 < CONFIGURABLE HANDLER 2 008 - int 8 < asks if e1x handler is still alive, and return value in e2x 009 - int 9 < close handler e1x 01N - jmp eNx < Jump to eNx. 02N - call eNx < Call eNx. 03N - push eNx < Push eNx value, to stack memory. 04N - pop eNx < Pop a wyte from the stack memory and save it to eNx. 05N - inc eNx < Increment eNx. 06N - dec eNx < Decrement eNx. 07N - clr eNx < Set eNx to 0. 08N - save eNx < Save eNx value. 09N - load eNx < Load saved value of eNx.
  1. M - mov eNx CONST < Move a number (0-9) to eNx.
2NM - sum eNx CONST < Add a number (0-9) to eNx. 3NM - mul eNx CONST < Multiply a number (0-9) to eNx. 4NM - mov eNx eMx < Copy the value of eMx to eNx. 5NM - sum eNx eMx < Add the value of eMx to eNx. 6NM - res eNx eMx < Rest the value of eMx to eNx. 7NM - mov eNx eMx < Move the value of the memory pointed to eMx to eNx. 8NM - mov eNx eMx < Move the value of eMx to the memory pointed position of eNx. 9NM - jnz eNx eMx < Jump to eMx if eNx is not zero.

Considerations:

If you ask for a memory position with a register having a negative number, the memory
pointed will be the absolute value of it.
The stack memory starts at the 0 position of memory. The e0x register has the "Zyte Memory" position identifier, it is readOnly.
License:
Copyright (c) 2007 sirdarckcat@gmail.com Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license is available at:
http://www.gnu.org/licenses/fdl.html









Hosted by Google Code