HOWTO assemble the MegaTerm 2.0 source code
A brief tutorial written by Matt Ownby (redflame@xmission.com)
Feb 24th, 2000


IMPORTANT: This source code is completely UNSUPPORTED!  If you try to
assemble it and it doesn't work, the only thing I can suggest is read this
file again, thoroughly.  Mailing the co-author (me) for help will not
get you any closer to solving your problem, so pursue other avenues!
	Also, this source is GPL'd (hehe).  If you don't know what that means,
it means that if you modify this source code, you have to make your
modified source available to the public.  If you don't wish to abide by this,
then don't bother with the source code in the first place.


HISTORY:
MegaTerm was a terminal program for the Apple ][gs written by Bluetamon
and The Red Flame (me).  Its goal was to emulate the color scheme built
into MS-DOS's ANSI.SYS and the character set built into IBM PC's.  Why?
Because these colors and characters were used very commonly on BBS's that
were run on IBM PC's and they were also supported by many MS-DOS based
term programs such as Telix, Qmodem, etc.  And frankly, a BBS experience
with colors and pseudo-graphics was preferable to the black & white of the
Apple ][ BBS world (although we did have Proterm Special, dangit!).
	Anyway, about the beginning of 1993 I stopped working on MegaTerm
and let the source code sit on my 40 meg hard drive.  Some time after that,
the hard drive would no longer power on (doh!).  We replaced a transistor
inside the hard drive case (it was an external Chinook) and it powered on
once again, but the ][gs would not see it!
	Years passed and I figured I had lost MegaTerm's source code forever.
Then a few days ago (literally) I decided to hook up the hard drive to
a Linux box with SCSI and use the 'dd' command to copy the entire image off.
Incredibly enough, I was able to get the entire hard drive image perfectly!
I then used the excellent Apple ][gs emulator known as KEGS to boot off
the image and then retrieve my source code.  Now I am finally releasing it
to the public domain.  I hope Bluetamon approves.  I have no idea whatever
happened to that guy =].


OBSERVATIONS:
The source code you are receiving is a work-in-progress.  It is apparent that
I fully intended to implement so-called ANSI music (it really had nothing to
do with ANSI as far as I know), as well as Xmodem, Ymodem and Zmodem transfer
protocols!  In fact, inside the source code you will find an almost working
Xmodem/Ymodem protocol as well as code to catalog a directory.
	Also you will see that the intro to MegaTerm was juiced up quite
a bit.  The public never saw this, but there is scrolling text and a
sound effect.  It actually looks pretty cool, I wonder why I never released
it (laziness).
	MegaTerm 2.0 was supposed to have ANSI music and transfer protocols.
I therefore will refer to this as MegaTerm 2.0 with the understanding that
it was never finished.  As for adding ANSI music, that would be a complete
waste.  Adding transfer protocols would be cool, but again not very useful
since today all file transfers are done with ftp and http!  But it would be
kind of a novelty anyway.
	All source code that begins with MTERM was written by Bluetamon
except for MTERM.EXTRA.S, MTERM.INIT.S and MTERM.FILES.S;
Any other source code was written by me.



REQUIRED FILES:
The so-called version 2.0 of Megaterm is composed of the following files:
ANSI.SYSTEM	- Standalone Executable
TERM.RUN	- Standalone executable
INITPIC		- Uncompressed picture with special color palette
FONTSTUFF	- Font printing program, cannot be executed
FONTEDIT	- Small program to change the MegaTerm font.
SHO.RYU.KEN	- Sound sample from Street Fighter II


THEORY OF OPERATION:
ANSI.SYSTEM is run which initializes 320x200 color mode and displays
INITPIC, which is the method Megaterm used to set the color palette.
(the program itself contains no color palette info).  INITPIC can only
be properly edited with a 256-color paint program such as Dreamgrafix.
If a 16-color paint program (Paintworks) is used, the extended color
palette will be lost and the intro will look like schlop.  ANSI.SYSTEM
also loads FONTSTUFF which is a program I wrote to display a decent looking
font while in graphical mode.  This program loads in at $B000.  ANSI.SYSTEM
also loads SHO.RYU.KEN which is a sound I shamelessly ripped from Street
Fighter 2, which was a popular game at the time Megaterm was written.  It
is in there just as a gimmick.  After ANSI.SYSTEM is loaded it will print
some greetings to the user in a cool scrolling window.  The actual text of
the greeting is stored in the source code and can be edited by anyone who
adds something to MegaTerm and wants to give themselves props =].
	When the user presses a key, the SHO.RYU.KEN sample is played
and the palettes are faded out separately to give a cool looking effect.
TERM.RUN is then loaded into memory at $2000 and executed.
	TERM.RUN can be executed without ANSI.SYSTEM but the color palette
will not be setup, so ANSI graphical mode will be useless (but text mode
will work normally).
	TERM.RUN is a standalone executable, it does not require any
external files.
	FONTEDIT is a program which can be used to modify the fonts inside
TERM.RUN - It works fine but is very unfriendly when it comes to
maintenance.  I recommend not bothering with this program since you have
the source code.



SOURCE CODE STRUCTURE:
	Megaterm is written strictly in assembly language.  It was assembled
using Merlin 8/16 or Merlin 16.  It should assemble "out of the box" using
one of these programs.  Any other assembler may give unpredictable results
so unless you know what you're doing, stick to what is known to work.


ANSI.SYSTEM is composed of the following source files:
	ANSISTART.S
	LOADFONT.S
	TITLE.S

	To assemble it, load up ANSISTART.S and type @-A.


TERM.RUN is composed of the following source files:
	MTERM.MAIN.S
	MTERM.TITLE.S
	MTERM.FILES.S
	XMODEMCRC.S
	YMODEM.S
	YBATCH.S
	CRC.S
	MTERM.DISK.S
	MTERM.PROCESS.S
	MTERM.DIAL.S
	MTERM.EMS.S
	ANSIMAIN.S
	ANSIFONT.S
	ANSIUTILS.S
	MTERM.EXTRA.S
	MTERM.MODEM.S
	MTERM.WIND.S

	To assemble it, load up MTERM.MAIN.S and type @-A.


FONTSTUFF is composed of the following source files:
	FONTLINK.S
	FONTMAIN.S
	FONT.S

	To assemble it, load up FONTLINK.S and type @-A.


FONTEDIT is composed of FONTEDIT.S only.  It is entirely dependant on code
inside TERM.RUN and it also _modifies_ TERM.RUN (this design is very
dangerous and hard to maintain, I wouldn't do it again hehe).  To assemble
FONTEDIT you have to first assemble TERM.RUN and take note of the following
label addresses:
	superprint
	ansi_begin
	ansitoast
	anscursor
	CHAR0
	X
	Y
	forecolor
	backcolor

You then have to modify the beginning of FONTEDIT.S and update all of those
addresses accordingly.  Basically, FONTEDIT isn't worth the trouble
of assembling it since you have the source code to TERM.RUN.  I only include
it in this archive for completeness.


INITPIC and SHO.RYU.KEN are the only files Megaterm uses which cannot be
assembled.  I suggest you leave these alone unless you know what you're
doing.


Once again this source code is completely UNSUPPORTED so you are on your own.
