Hi!

About the robotz.txt v0.0 file:

>2.2 Status Registers
>
>The registers are divided into two classes: public and private.
>The private registers can only be accessed by the robot itself, the public
>registers are accessible to all other robots 

Also mention that they are _status_ registers and as such cannot be
written, only read.

>The env register array contains info on the direct environment of the robot.
>This register array always reflects the current situation. The robot itself
>is placed at env[2][2]; env[0][0], env[0][4], env[4][0] and env[4][4] will
>always contain blank data.

Hard-wireing the robot location to (2,2) is not flexible. If you would
allow negative indices, you could place the robot at (0,0) and expand the
scanner range with a lot less problems.

>  env[0..4][0..4] - the environment

You could also use a part of the memory for this task. That would simplify
the virtual machine.

>-------------------------------------------------------------------------
>2. Command Set
>-------------------------------------------------------------------------

This should be chapter 3! (look in the table of contents).

>2.1. Terminology, definitions and abbreviations
>
><byte>     (un)signed byte value 
><word>     (un)signed word value 
><address>  word in range $0000 - $3FFF (15 bit)
><flag>     Z, P, N, NZ, NP, NN (bitmask over flags status reg)

This paragraph is totally out of place (par 2.1 exists three times!). I
think you should put it more to the beginning of the document, certainly
before the terms "byte" and "word" are mentioned.
Note that "word" does not always mean 16-bits (for example PSX uses 32-bits
words). Please mention the range explicitly.

You didn't include a "bit" type in your list of data types (but you use it
quite often in the document).
Actually, I would prefer a "boolean" type to a "bit" type.

I'd like a 16-bit signed type as well ("integer" or "int").

>When the robot
>gets its turn again, the env registers are updated and the processing
>of the program continues at the next command.

Is the stack automatically cleared every turn?
I think that would be a good thing.
 
>SCAN <byte>
>SCAN (<address>)
>
>MOVE <byte>
>MOVE (<address>)
>
> ...

Why two variants of every action command? Isn't it easier to use the byte
at the top of the stack?

And what does the byte mean anyway?

>2.2. Program flow control
>
>These commands influence the program control flow.  Their intention
>is clear (I think) to anyone with a basic understanding of z80 ML...
>
>JP   <address>
>JP   <flag>,<address>
>JP   <flag>,<address>
>
>CALL <address>
>CALL <flag>,<address>
>
>RET
>RET  <flag>

How about this construction:

Syntax:
        SKIP <flag>
Semantics:
        Skips the execution of the next instruction if the flag is TRUE.
Example:
        SKIP Z
        JP      <address>
  is equivalent to
        JP NZ,<address>

This would make your instruction set smaller and the virtual machine easier
to implement.

Does CALL store an address on top of the stack, or is the stack only used
for arithmetic?

If the stack is used for return addresses, it would be very difficult to
pass parameters to a subroutine. Please think about this!

>2.3. Stack operations
>
>The machine uses a stack for calculations. It's a stack of words,
>not bytes.
>
>PUSB <byte>       (but stores a <word> to keep stack handling simple)
>PUSH <word>       push <word> on stack

I think you should specify how PUSB stores the byte in a word. People are
bound to use this, so you'd better standardize it.

>PUSH (<address>)  push word at address <address> on stack

Why doesn't PUSB (<address>) exist?

>CLR               clear the stack (dangerous! :-))

Why is this instruction needed?

>2.4. Arithmatic operations
>
>The arithmatic operations take the two topmost elements of the stack (or
>only the stack top, for NEG), perform the operation and push the result
>on the stack again. Flags will be set as expected.

"As expected" is not good enough: different people will expect different
things. 

>ADD
>SUB
>MUL
>DIV

Please include "MOD" as well.
And define it such that "-1 MOD 3 = 2", not "-1 MOD 3 = 1" like Pascal.

>NEG

What is the meaning of NEG when there are only unsigned types?
(include int!)

>2.5 Logic operations
>
>AND
>OR
>XOR
>NOT

Are these only defined for booleans, or are bitwise operations on words
supported as well?

>2.6 Assignment
>
>Unlike the z80, this machine has no general purpose registers, so 4 load
>instructions should suffice.

Actually, you don't need load instructions at all. Using the PUSH and POP
operations, you can do anything a load instruction can do.


Maybe some of you think "such a simplified virtual machine is not easy to
program". That's true. But it's very easy to interpret, and it's also easy
to make a compiler that compiles to such a virtual machine. So you don't
have to program in the virtual machine language, but you can use a higher
level language instead.

Keep up the good work! (please make v0.1 soon)

By the way, anyone interested in virtual machine design should read the
"Java virtual machine specification" from Sun Microsystems. It's cool!

Bye,
                Maarten


****
MSX Mailinglist. To unsubscribe, send an email to [EMAIL PROTECTED] and put
in the body (not subject) "unsubscribe msx [EMAIL PROTECTED]" (without the
quotes :-) Problems? contact [EMAIL PROTECTED] (www.stack.nl/~wiebe/mailinglist/)
****

Reply via email to