Next: , Previous: Debug commands, Up: Commands


6.2.3 State commands

Inspection and modification of the virtual machine state (memory, registers, overflow toggle and comparison flag contents) is accomplished using the following commands:

— state command: pstat

This commands prints the current virtual machine state, which can be one of the following:

— state command: pc

Prints the current value of the program counter, which stores the address of the next instruction to be executed in a non-halted program.

— state command: sreg A | X | J | I[1-6] value
— state command: preg [A | X | J | I[1-6]]
— state command: pall

preg prints the contents of a given MIX register. For instance, preg A will print the contents of the A-register. When invoked without arguments, all registers shall be printed:

          MIX > preg
          rA: - 00 00 00 00 35 (0000000035)
          rX: + 00 00 00 15 40 (0000001000)
          rJ: + 00 00 (0000)
          rI1: + 00 00 (0000)	rI2: + 00 00 (0000)
          rI3: + 00 00 (0000)	rI4: + 00 00 (0000)
          rI5: + 00 00 (0000)	rI6: + 00 00 (0000)
          MIX >
     

As you can see in the above sample, the contents is printed as the sign plus the values of the MIX bytes stored in the register and, between parenthesis, the decimal representation of its module.

pall prints the contents of all registers plus the comparison flag and overflow toggle.

Finally, sreg Sets the contents of the given register to value, expressed as a decimal constant. If value exceeds the maximum value storable in the given register, VALUE mod MAXIMU_VALUE is stored, e.g.

          MIX > sreg I1 1000
          MIX > preg I1
          rI1: + 15 40 (1000)
          MIX > sreg I1 1000000
          MIX > preg I1
          rI1: + 09 00 (0576)
          MIX >
     
— state command: pflags
— state command: scmp E | G | L
— state command: sover F | T

pflags prints the value of the comparison flag and overflow toggle of the virtual machine, e.g.

          MIX > pflags
          Overflow: F
          Cmp: E
          MIX >
     

The values of the overflow toggle are either F (false) or T (true), and, for the comparison flag, E, G, L (equal, greater, lesser). scmp and sover are setters of the comparison flag and overflow toggle values.

— state command: pmem from[-to]
— state command: smem address value

pmem prints the contents of memory cells in the address range [FROM-TO]. If the upper limit to is omitted, only the contents of the memory cell with address FROM is printed, as in

          MIX > pmem 3000
          3000: + 46 58 00 19 37 (0786957541)
          MIX >
     

The memory contents is displayed both as the set of five MIX bytes plus sign composing the stored MIX word and, between parenthesis, the decimal representation of the module of the stored value.

smem sets the content of the memory cell with address address to value, expressed as a decimal constant.