Macro Information Form
======================
Each entry in this file has the
macro name, its use, and the description following.

The text in the paranthesis tells the macro's usage.
Each operand used by the macro is put within < and >.
If the operand is put within braces, like [<operand>],
that means its optional and can be omited.
A ! before the operand means the argument can be
any memory adress or value. If you put a value,
you must place a # first.
Examples:
	#1			;value
	#def_offetlow	;constant
	#<def_offset	;constant with operator
	TC0			;defined memory adress
	$A000		;hard memory adress
Those are valid for a "!" macro operand.

PPU Macros
==========

set2006 (set2006 <addr>)
------------------------
Sets the PPU VRAM Adress to <addr>.

nametable_clear (nametable_clear !<table>)
----------------------------------------
Clear one nametable w/ attribute table, with value #0.
<table> must be defined with the high adress
of wich table to clear. (#$20, #$24, #$28, or #$2C).
If your program just uses one screen,
your value is #$20.

blockfill (blockfill !<blocktile>)
----------------------------------
Fills the entire screen with a "block".
The block is a 16x16 pixel box composed of 4
tiles in the Pattern Table resembling a 16x16 square.
<blocktile> decides the upper-left tile-value of the block.

So with for example "blockfill #4", it will fill the screen with a matrix of a squares
of these tiles like this:

$04 $05

$14 $15

sprite_hide (sprite_hide)
-------------------------
Put -all- sprites off-screen.

display_off (display_off)
-------------------------
Turn off display, disabling NMI and
making it possible to write directly to VRAM.

display_on (display_on)
-----------------------
Turn on display, enabling NMI.

ppuincreg_set (ppuincreg_set)
-----------------------------
A macro for setting the increase-PPU-adress-by-32
flag in the PPU control register.

ppuincreg_clr (ppuincreg_clr)
-----------------------------
A macro for clearing the increase-PPU-adress-by-32
flag in the PPU control register.

ntrowcalc (ntrowcalc)
---------------------
This will set the VRAM adress registers by converting
from Y and X tile coordinates pointing in the table.
Load cpu register X with Y coordinate and
cpu register A with X coordinate, before
calling this macro.

Common Macros
=============

process_init (process_init !<ID>, ![<operand1>], ![<operand2>], ![<operand3>], ![<operand4>], ![<operand5>], ![<operand6>], ![<operand7>], ![<operand8>]
----------------------------------------------------------------------------------------------------------
Load a process to memory. For <ID>, use #process_[name].
For example if your process was named "cursor",
put "#process_cursor". You can specify up to 5 operands.
Whats meant by operands is that they are placed in the process'
reserved memory (operand1 is placed in process_R1, operand2 is
placed in process_R2, etc..). This is ofcourse prepared before
the process begin to run. Both the ID and the operand values can be
based off either a value in memory, or a defined value or a constant value.
For example, you can place
	process_init	temp0, temp1
if the process ID is in temp0 and a operand is in temp1.
For anything else, a # has to be put first (ie "process_init #process_cursor, #6, #2")

stadium_init (stadium_init !<stadium_id>)
----------------------------------------
This will trigger a stadium to be executed.
For <stadium_id>, use stadium_[name].
For example if your stadium was named "levelinit",
put "stadium_levelinit". Those are constants
automatically generated by NFCompiler when reading
resource data.

set (set <memory>, !<value>)
---------------------------
set <memory> to <value> using A.

rangeset (rangeset <memory>, !<range>, ![<value>])
------------------------------------------------
Set a range of memory to value [value],
writing <range> bytes starting from <memory>.
if <value> is omited, #0 is used.

sprset (sprset !<sprite>, !<tileval>, <Y>, <X>)
---------------------------------------------
Set up a sprite with <tileval> as tile,
at <Y> as Vertical position and <X> as
Horizontal position. <sprite> must be between 0 and 63.

sprremove (sprremove !<sprite>)
------------------------------
Put a sprite off-screen. <sprite> must be between 0 and 63.

highnibb (highnibb)
-------------------
This macro returns the upper 4 bits of A (first nibble)
as a lower 4-bit value back to A.

decimalconv (decimalconv)
-------------------------
This converts whatever value in register A to
a decimal number, by placing high digit in X
and low digit in A.

Process-oriented Macros
=======================

check (check !<ID>)
------------------
Checks if a certian process is loaded to memory.
The result is returned in the Carry flag, (carry set if found)
and the process' slot number is stored in the X register.
The slot number can be used with the Killslot macro,
and maybe other purposes.

pauseall (pauseall)
-------------------
This will pause all processes, expect the one this macro
wall called from. (process pause memory is used with this).

unpauseall (unpauseall)
-----------------------
This will unpause all processes, by clearing the process
pauese memory.

kill (kill)
-----------
Kill the running process (Or aka, unload process from memory).

killslot (killslot !<slot>)
---------------------------
This will kill the process in a specified process slot. 
Slot doesnt mean the same as process ID, so know
what you are doing.

killtwin (killtwin)
-------------------
This will kill any process that is the same as
the current one (the one calling the macro).
It will only kill one at once, though.

stateset (stateset)
-------------------
This will set the process' start position at
the very place this macro is placed.
Meaning, when the process is launched next time,
it will start from the last point this macro was put.

xpc
---

Load the process counter into X register.

ypc
---

Load the process counter into Y register.

waitFC (waitFC <frames>, <loadx>)
---------------------------------
Wait for <frames> * PPU frames to elapse
before rest of process is executed.
Way to do delay :)

delayframe (delayframe <loadx>)
-------------------------------
Wait one PPU frame to elapse before
executing rest of process.

clFC (clFC <loadx>)
-------------------
This will clear the frame counter, so it
starts counting from zero.

waitcl (waitcl <memory>)
------------------------
Wait for a value in memory to be clear (0). In other
words, continue process if clear, quit if not.

Process Reserved Memory Macros
==============================

The '?' in these macros you replace
with the process memory number you want to use.
If for example your project uses 4 process memory bytes,
you can use R0, R1, R2, and R3.

getR? (getR? <loadx>)
---------------------
Store process memory in A register.

setR? (setR? <value>, <loadx>)
------------------------------
Set process memory to <value>

cmpR? (cmpR? <loadx>)
---------------------
Compare A register to process memory.

incR? (incR? <loadx>)
---------------------
Increase process memory by 1.

decR? (decR? <loadx>)
---------------------
Decrease process memory by 1.

addR? (addR? <value>, <loadx>)
------------------------------
Add <value> to process memory.
(A register will keep the result)

subR? (subR? <value>, <loadx>)
------------------------------
Subtract <value> from process memory.
(A register will keep the result)

The <loadx> deal
================

Many of the process-oriented macros use the <loadx> paramenter/argument.
This means that the macro needs the process slot counter (process_count) in the
X register. However, only the programmer knows whetever X already equals
the process slot counter or not. Therefore you can set this paramenter to set
the value automatically (instead of calling the XPC macro).
So if <loadx> is set (paramenter = 1), it will automatically
load it into X, if not (paramenter omited), it uses the current value of X.
If all this is greek to you, just use 1 for the <loadx> paramenter. Its no big.
Just note if X is incorrect when accessing process memeory / these macroes,
its a good way to screw up the program.