APPLET FORMAT FOR MATHWIZ v. 2.1

This file explains how to make applets for MathWiz.  Please note:  all math used is floating point math, which utilizes the variables op1 - op6.  Please note:  for most rom calls using floating point numbers, the operation affects op1.  If it requires two operands, then it also uses op2, and stores it in op1.   Confused?  Simple explanation:

_fpadd does this:  op1 + op2 -> op1

_times2 does this:  op1 * 2 -> op1

Hopefully, this helps unconfuse you a little.  Now, to let you know, MathWiz allows the user to input 10 variables.  (in the future I may lower this to save space)  It also provides the programmer with 6 spare variables, variables that aren't affected by any operations.  (These come in handy.)

To start, your program should include "math.inc"  This contains several pointers to important routines for the program.  I'll explain those at the bottom.  That being said, I now commence the format explanation.

.NOLIST
defines/includes
#include "math.inc"
other stuff... yadda yadda yadda 
.LIST

.org $0000 ; use this

	jr init		; required syntax to 
	.db "MATH"	; detect the applet
	.db 21		; this number is the number of characters
			; between the following quotes + 1 (the 0 is a character)
	.db "Quadratic - Fred C.",0 ; program name
	.db "A=",0,0,0,0
	.db "B=",0,0,0,0
	.db "C=",0,0,0,0
	.db $FF		; place this after the last inputed variable
Explanation for this part:  The program allows the name of each variable to be up to 5 characters long, with the 0 terminating the string.  If it's less, fill the other characters with 0.  So, .db "VALUE",0 is acceptable, but "HELP ME",0 isn't.

Now, the rest of the program consists mostly of ".dw command_goes_here"  For example:
	.dw _fpadd 	; adds op1 and op2
	.dw _fpmult 	; multiplies op1 and op2
	.dw _op1toop2 	; copies op1 to op2
	ret 		; place at the end of the program

Now, what are those extra routines in the math.inc for?  Here are the explanations:

_formDisp - Displays the value in op1 in home-screen text  (may not be necessary with newer format)

data?_op1 - This takes a number that was inputed and places it in op1.  In the input routine at the beginning, the first input (in my example "A=") goes into data0; the next into data1, and so forth.  This destroys whatever is in op1.  (replace the "?" with a number)

op1tospare? - takes the value of op1 and copies it to a spare variable (1-6)

spare?toop1 - the opposite of the above

constant - (note:  if there's a problem, paste this line from math.inc and make it a "#define" in the regular program)
	This routine takes a constant integer between 0 and $FFFF and places it into op2.  The syntax:
	.dw constant
	.dw $ABCD 	; number goes here

MathWiz also allows the user to input their own commands (for example, drawing lines)  to do this, the following format must be used:

here:	jp nextpart-here ; required to know this is special
	ld bc,0101h	; your routine goes here... this just draws a line
	ld de,0202h
	ld h,1
	call _ILINE
	ret		; required at the end of your routine
nextpart:		; next commands go here

If you're confused at all, please refer to any source code, which illustrates this and the constant syntax.

textdisp - This displays a text string (null terminated)  - For this command, please follow the following rule:  if you have X variables, don't let penrow be lower than 6X+6... otherwise, it interferes with the user defined variables.  (And you probably don't want more than 10 vars then ;)
Syntax:
	.dw textdisp
	.db "String goes here",0

Hopefully, this explains everything.  If confused, please refer to the sources; even though they aren't commented, by looking at them you can figure it out much better than I may be able to explain.  (I apologize, I'm horrible at writing readme-style files.)