ZASM Language Reference

From ZCWiki
Jump to: navigation, search

NOTE: A new, updated version of this page is being worked on here: New ZASM Reference

Arguments

FFC Arguments

d0-d7
The data registers
a1-a2
The address registers
data
the combo reference of the FFC
cset
Its CSet
delay
It's animation delay
x
It's X position
y
It's y position
xd
X speed
yd
Y speed
xd2
X accel
yd2
Y accel
fflagsd
ffcwidth
ffcheight
fftwidth
fftheight
fflink
combod
comboc
combof

Input Arguments

inputstart
inputup
inputdown
inputleft
inputright
inputmousex
inputmousey

Link Object Arguments

linkx
Link's X position
linky
Link's Y position
linkz
Link's Y position
linkjump
linkdir
linkhp
linkmp
linkmaxhp
linkmaxmp
linkaction
linkheld
linkitemd
linkswordjinx
linkitemjinx
linkdrunk

Screen Arguments

cd###
the room's combo data, where ### refers to the combo number of the room (combo 0 is in the upper left-corner, combo 16 is just below combo 0, etc.)
cc###
the room's CSet data
cf###
the room's Combo Flag data

Instructions

Note: V instructions use a designate argument and a value, while R instructions use two designate arguments.

Basic instructions

WAITFRAME
One of the mos important commands. It takes no arguments, and tells the script to STOP executing at that point. Execution will resume from the next instruction in the list in the next animation frame. Make sure that you have at least one WAITFRAME within a GOTO loop!
QUIT
Stops execution of this FFC's script on this screen.
SETV, SETR
Set's the contents of the first argument to the contents of the second argument.
COMPAREV, COMPARER
Compares the first argument with the second argument. If the two arguments are equal, the TRUEFLAG is set. If not, it is unset. If the first argument is greater than or equal to the second argument, the MOREFLAG is set. Otherwise, it is unset.
GOTO, GOTOR
Goto instruction number #. Uses one argument, which is either a line label or a line number. The instruction number is simply the number of instructions counted down from the top of the list, starting from instruction 1.
GOTOTRUE, GOTOFALSE, GOTOMORE, GOTOLESS
The first two will go to instruction number # depending on the status of the true flag. The last two depend on the status of the MOREFLAG.
LOAD1, LOAD2
The first argument refers to the elements of the current FFC, while the second refers to the elements of the FFC referred to by the address registers (a1 and a2 respectively.) Set's the first argument to the second argument.
SETA1, SETA2
The first argument is the reference FFC element, while the second argument is the current FFC elements. Sets the first argument to the second argument.
LOOP
PUSHV, PUSHR
POP
ENQUEUEV, ENQUEUER
DEQUEUE
LOADI
STOREI

Mathematical instructions

ADDR, ADDV
Add's the contents of the second argument to the contents of the first argument, storing the result in the first argument.
SUBR, SUBV
Same, only it subtracts the second argument from the first.
MULTR, MULTV
Same, only it multiplies both arguments
DIVR, DIVV
Same, only it divides the first argument by the second argument.
MODV, MODR
Yields the remainder of dividing the first argument by the second argument.
SINV, SINR
COSV, COSR
TANV, TANR
ABSR
MINV, MINR
MAXV, MAXR
FACTORIAL
POWERV, POWERR
IPOWERV, IPOWERR
ANDV, ANDR
ORV, ORR
XORV, XORR
NANDV, NANDR
NORV, NORR
XNORV, XNORR
NOT
LSHIFTV, LSHIFTR
RSHIFTV, RSHIFTR
TRACEV, TRACER, TRACENL
SQROOTV, SQROOTR

Pointer Instructions

LOADITEMV, LOADITEMR
LOADNPCV, LOADNPCR
CREATEITEMV, CREATEITEMR
CREATENPCV, CREATENPCR
ISVALIDITEM
ISVALIDNPC

Effect Instructions

WARP, WARPR
Uses two value arguments. The first is the map to warp to, and the second is the screen to warp to. IT CAN CRASH THE GAME IF THE VALUES ARE OUT OF BOUNDS.
PITWARP, PITWARPR
PLAYSOUNDV, PLAYSOUNDR
MSGSTRV, MSGSTRR

Primitive Drawing Instructions

RECTR
CIRCLER
ARCR
ELLIPSER
LINER
PUTPIXELR
DRAWTILER
DRAWCOMBOR

Unimplemented Instructions

CHECKTRIG
If the current FF combo has been triggered via secret, it will set the TRUEFLAG. Otherwise, it will unset it.
LOADWEAPONV, LOADWEAPONR
CREATELWEAPONV, CREATELWEAPONR
CREATEEWEAPONV, CREATEEWEAPONR