FCPU - Emulator V2.0
--------------------

(1) General

The emulator instruction set and emulation is based on the manual V0.2.
Please note:

    * Logarithmic integers are not implemented
    * OP_DIV computes r1 = r2 / r3 instead of r1 = r3 / r2.
    * SR_URL is not implememted. Access causes a PROTECTIONFAULT
	* OP_FIAPRX, OP_FSQRTAPRX, OP_FLOG, OP_FEXP are not supported.

The commandline syntax is:

    fcpu [ <filename> ]

For example

    fcpu test.asm

or

    fcpu

If there is a filename defined in the commandline, the emulator loads
this file, assembles it and then executes a "go" command. This causes
the assembled file to be executed until a HALT instruction is reached.
On HALT the emulator terminates.

If there is no commandline, the emu enters debugging mode and there
are several commands available:


help, h, ?    ... print help

go, g         ... run program until halt instruction

step, s       ... single step one instruction

reset, r      ... reset cpu

quit, q       ... quit emulator

dumpcpu, dc   ... dump cpu state

loadasm, la   ... load and assemble file:

                  la "test.asm"

drui          ... dump registers as unsigned hex. integer.
                  See drfd for an example.

drfs          ... dump registers as single precision float:
                  See drfd for an example.

drfd          ... dump registers as double precision float:

                  drdf          dump all registers
                  drfd r12-r16	dumps registers r12 to r16
				  drfd r2       dump register r2


(2) Native SYSCALLs

The emulator supports the following "native" syscalls. Native
means, that these syscalls are processed by native code on the
host machine. These SYSCALLs do not jump to a FCPU-coded
SYSCALL handler.



0xFFFF - prints the character in the LSB of R63 th stdout

The following code prints 'hello' to stdout:

PRINTHELLO:
	loadcons.0	"h", r63
	syscall		0xFFFF, r0
	loadcons.0	"e", r63
	syscall		0xFFFF, r0
	loadcons.0	"l", r63
	syscall		0xFFFF, r0
	loadcons.0	"l", r63
	syscall		0xFFFF, r0
	loadcons.0	"o", r63
	syscall		0xFFFF, r0
	halt



0xFFFE - reads a character from stdin into LSB of R63




(3) The symbolic assembler

The emulator contains a symbolic assembler.



The assembler supports labels. Labels are always the first element
of a line and end with ":". For example:

JumpHere: loadcons.0 1, r2



The assembler supports the following directives:



EQU - defines a symbol. For example

symbol EQU 0x1000

The "symbol" is defined to be 0x1000. If "symbol" is used in an
instruction it is replaced by its value 0x1000.



ORG - defines into which absolute address the following opcodes are
assembled to. For example:

ORG 0x1AF0
loadcons.0 symbol, r1

The "loadcons.0" instruction is put into memory at address 0x1AF0



ALIGN - aligns the absolute address. For example

ORG 0x1111
ALIGN 4
loadcons.0 symbol, r2

The "loadcons.0" instruction is put into memory at address 0x1114



DB - defines a byte or a string (sequence of bytes). For example

db 0x99
db "This is a string"

DD - defines a double byte in little endian order.
DDLE - same as DD.
DDBE - defines a double byte in big endian order.

DQ - defines a quad byte in little endian order.
DQLE - same as DQ.
DQBE - defines a quad byte in big endian order.

DO - defines a oct byte in little endian order.
DOLE - same as DO.
DOBE - defines a oct byte in big endian order.


The assembler accepts the following constants
(see function fcpu_utl_convert_string_to_constant for details)

	signed decimal:

		-3
		55

	unsigned hexadecimal ( leading "0x" ):

		0xFF

		0x00000777

	single float ( trailing "f" )

		1.778E2f

	double float ( trailing "d" )

		1.223d


Registers are coded with a leading "r" or "R". The register number
is expected to be a decimal number, for example:

	r1
	r33
	r63