               TChip  v0.1  Copyright (c) 1997-98 Image!
                      Written by Rick van Lieshout
                             marm@hetnet.nl




Legal message:


USE AT YOUR OWN RISK!

If something goes wrong, don't blame me!
I cannot be charged for anything!



About TChip:

TChip is a small program that allows you to program a texturemap.
The maps dimensions are 256x256 pixels, and pixel-depth equals 24 bits.

To create a texture with this program you need to program the map.

1) Use somekind of editor to code your texture.
2) Use the parser (parser.exe) to assemble your text into a for the
   TChip understandable bytecode.
3) Execute the TChip (tchip.exe) to generate the texturemap.
4) Use the convertor (out2tga.exe) to convert the output code of TChip
   to a 24 bits TARGA file.

Lots of examples are included, and if you ever might create a good looking
texture... don't wait and mail it to me!

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!! Mail me the source or the bytecode, NOT the output data !!!
!!!                                                         !!!
!!!          Sugestions / Remarks are also allowed          !!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!


Specs:

registers	[A-Z]		26 floating point numbers

flags		LESS, GREATER, EQUAL

texturemaps	4 x 256 x 256

stacksize	50 addresses

current map	value 0..3




instructions:


ADD  r1,a		r1 = r1 + a
ADD  r1,r2		r1 = r1 + r2

BLUR			will blur the current texture map

CALL label		stores the current IP at the stack, jumps to label
CLIP r1			forces r1 to be within the range 0-255
CLRM			fills current map with values from regs. R,G and B
CMP  r1,a		compares the value of r1 with a (aff. flags)
CMP  r1,r2		compares the value of r1 with r2 (aff. flags)
COS  r1			r1 = cos(r1)

DEC  r1			r1 = r1 - 1
DIV  r1,a		r1 = r1 / a
DIV  r1,r2		r1 = r1 / r2

INC  r1			r1 = r1 + 1

JE   label		if EQUAL jump to label
JG   label		if GREATER jump to label
JL   label		if LESS jump to label
JGE  label		if GREATE|EQUAL jump to label
JLE  label		if LESS|EQUAL jump to label
JMP  label		jump to label

LDC  r1,r2		loads col. val. intro regs. R,G and B from pos (r1,r2)
LDPI r1			r1 = 3.1415.....
LDZ  r1			r1 = 0

MONO			converts current map colors to grayvalues
MOV  r1,a		r1 = a
MOV  r1,r2		r1 = r2
MUL  r1,a		r1 = r1 * a
MUL  r1,r2		r1 = r1 * r2

RET			pops IP value from stack, and will continue at new IP
RNDD			fills map with random dots (radius = 5)
RNDD a			fills map with random dots (radius = a)
RNDP			fills map with random pixels

SAVM			saves the current map to disk.
SIN  r1			r1 = sin(r1)
STC  r1,r2		sets colors at pos (r1,r2) from regs. R, G and B
STM  a			sets the current map (a = 0,1,2 or 3)
STM  r1			sets the current map (r1 = 0,1,2 or 3)
SUB  r1,a		r1 = r1 - a
SUB  r1,r2		r1 = r1 - r2
SQR  r1			r1 = r1 * r1
SQRT r1			r1 = sqrt(r1) (SQuare RooT)



parser file instruction:


Rulez:

- Behind a label name, no more instructions are allowed.
- Remarks are until the end of the line, starting with a ';' character.
- Entry point is at label 'Main', or if none specified at the first
  encountered instruction.


Howto's:


To define a label in your code, insert the following

>label

example:

> mylabel

			; Some code

  jmp mylabel		; Jump to label 'mylabel'




To define a procedure you can call, you can do 2 things

1) Just call a label, and use RET to return to the calling address.
2) This way

	PROC      procname

		...	; some code

		ret	; return to caller

	ENDP

Do whatever you like!
