
 ****************************************************************************
 *                              Virtual 86 v1.3                             *
 *                    By: Daniel Foesch (krach42@hotmail.com)               *
 *                              TI-86 Emulator                              *
 ****************************************************************************


*** Description

  Virtual 86 (V86) is an emulator for the TI-86 calculator made by Texas
Instruments.  V86 allows you to run games and programs for your TI-86
calculator on your PC.  V86 is designed to run under DOS, but also runs under
a Windows 95, or 98 DOS box.  V86 requires a ROM dump from a TI-86, or an
alternate ROM image.  V86 includes all software needed to obtain your own ROM
from your own calculator.  The only hardware required is a supported link
type.  See the section *Getting my ROM* for more help.  V86 also should have
come with a file "GROM86.ROM", which is a pretty simplistic ROM, which you
can run to look at V86.  This ROM image is copyright me, and it's use is
fully authorized.  For more information on this rom see the section *GROM*

  V86 uses a lot of things that are normally for game console emulation. For
example, it renders the LCD screen per line, not all at once.  This is
because the TI-86 has a retrace time to it, and this should be emulated to
the best of ability.  Another unusal option is realistic interrupting, where
V86 interrupts at a 200Hz period exactly.  Just like a real TI-86.  This is
done in Realism mode, for maximum realism.

*** Features

* As far as I know, perfect Z80 emulation. (See section *Z80vP*)
* 2.7/8.0/4.3/6.8 times faster than a real TI-86 (on my P200MMX) at full
    speed (The first number is while running NOPs, the second is while halted
    the third is while executing random commands, excluding NOP, and HALT,
    the fourth is while sitting at the EOS)
* Approximately the same speed as a real TI-86 in realism mode
* Multiple command line options for maximum modifiablity
* Linkport support for Speaker, and Parallel Ports
* Real 200Hz interrupting
* Has an XDebug mode, which allows for direct interaction with the Z80 core
* Ability to save states before quiting, so it starts where it last ended
  (See the section *Startup* below, and the note about saving states)
* Ability to upload files without use of a link cable

*** Command Line
Command Line Format:
        v86 [option1] [option2] [option3] [...]

 -h, --help
	Displays help information

 -v, --version
	Displays version information

 -d, --run_debug
	Run in Debug Mode (currently disabled)

 -f, --run_free
	Run in Free Mode

 -R [number], --run_real [number]
	Run in Real Mode at 6MHz, or specified KHz

 -t, --run_turbo
	Run in Real Mode at 12Mhz

 -x, --run_xdebug
	Run in XDebug Mode (see documentation)

 -g, --get_rom
	Get ROM image from calculator (see documentation)

 -S, --send_rom86
	Send ROM86 program to calculator (see documentation)

 -r <filename>, --rom_file <filename>
	Specifies ROM image filename to load

 -s <filename>, --sta_file <filename>
	Specifies STA filename to load

 -a, --all_access
	Allow write access to ROM data

 -rt <number>, --disp_retrace <number>
	Effects time spent retracing

 -rf <number>, --disp_refresh <number>
	The number of times per second the screen refreshes

 -i <number>, --instructions_per_line <number>
	Number of T-States to execute per line in Free Mode

 -l <option>, --link_type <option>
	Specifies type of linking hardware to use

 -L, --link_swap
	Swaps the lines on the linking hardware

 -F <number>, --foreground_color <number>
	Specifies the color of the foreground in 24-bit format

 -B <number>, --background_color <number>
        Specifies the color of the background in 24-bit format

** Startup

  V86 automaticly attempts to load the .STA file first, if it exists. If it
doesn't, then it attempts to load the ROM file. If the rom file isn't found,
V86 then attempts to load "GROM86.ROM", and if that doesn't exist, it fails
to execute.

  V86 checks STA files for validity, so attempting to load an invalid file
will result in a message from V86 saying so.  V86 does _NOT_ check ROM files
in anyway that matters at this time.  Be aware that you can potentially cause
damage to your computer by loading an invalid file as a ROM image!

  The default ROM name is: "TI86.ROM"
  The default STA name is: "V86.STA"

  NOTE ON STATE SAVING:  For some unknown reason, my state saver is not
perfect, and may potentially save an incorrect state, and when you attempt to
restart V86 with that .STA, it will not run in an unwanted way.  I'm looking
into correcting this, but for now the safest STAs appear to be when you turn
the emulated calculator off. (In the EOS, I've not tested it in an assembly
program)  Exit all programs, so that you're in the EOS, then hit Right Shift,
then Backslash (OFF), and then quit with saving.  This will increase your
chances of having a valid .STA

  LEGAL NOTE ABOUT .STAs:  The STA files saved by V86 contain a copy of the
ROM image, which V86 was using.  !!! IF DISTRIBUTING THE ROM IMAGE THAT WAS
USED WOULD BE ILLEGAL, DISTRIBUTING ANY .STA FILES FROM THAT ROM WILL ALSO
BE ILLEGAL !!!

** Running Modes
  The five running modes are indicated by the "--run_" Thus the five run
modes are Real, Turbo, Free, Debug, and XDebug.

  Real mode is the default mode.  In Real mode, V86 attempts to emulate a
TI-86 as closely as possible.  Thus, this mode can run a bit slower than a
real TI-86 in a few cases, and sometimes faster, though for the most part V86
will run the same speed.  Real mode can also take a parameter.  If a number
follows the option then V86 uses that number to limit the processor speed.
The number given indicates the KHz you wish the processor to run at. (Note:
1Khz = 1024Hz, and 1Mhz = 1024Khz)  The default value is 6144, which is 6MHz.
  The four numbers which are displayed on the screen are the speed the
processor is running at, Refreshes Per Second, Frames per Second, and
Interrupts Per Second.  In RealMode, with all defaults, the numbers should
stay about locked to 6291456, 50, 50, 200.  They are updated every second.
Note the speed of the processor is displayed in hertz.
  Refreshes Per Second (RPS) is how many times the PC screen is being updated.
To conserve speed this is done at a rate which is fast enough that one
shouldn't notice the difference.  In Real Mode this number is linked to
Frames Per Second, and they try to run at the same speed. (They do well) But
they don't have to be linked.
  Frames Per Second (FPS) is the number of frames the line drawer completes
in one second.  The line drawer draws each line of the screen one at a time,
as apposed to just drawing it all out at one time.  This is probably what's
ruining my grey scaling, but what you gonna do?
  Interrupts Per Second (IPS) actually doesn't fit this exactly best. Rather
because in RealMode the interrupts always happen at a 200Hz interval.  This
was done by trapping the timing interrupt, and jacking it up to 200Hz.  It
seems to work well enough.  Mainly in RealMode this number indicates the
number of program loops that occur in one second.  This is somewhere around
200Hz.
  In Real Mode you can upload files, this is done by pressing the INS button.
For more information on uploading files see the section *Uploading*

  Turbo mode is an alias to Real mode running at 12Mhz.  This simulates the
effects of replacing a certain capacitor on your calculator. (Don't ask me
which, find the documentation on your own.)

  Free mode is the fastest mode.  In Free mode, V86 runs as fast as it can,
which is about 4 to 8 times faster than a real TI-86 on my P200MMX.  This
mode is a hold over from previous versions, where it was the default mode,
and now it only has any purpose if you just wanna see how fast V86 will run,
if you really need to upgrade your computer, or if you just really want to
get your math THAT fast.  It's virtually impossible to play some games in
this mode on a decent computer. (Like Mario86 and ZTetris)  But, that depends
on the input method, that the program uses. The four numbers displayed on the
screen are the same as in Real mode, but in Free mode these values are not
locked, and can vary wildly.
  In Free mode, the Interupts Per Second actually displays the number of
interrupts per second, since this number is not fixed.  Well, sort of. In
Free mode one interrupt is generated every 200th of a second based on
processor time..  Since this number can (obviously) vary a great deal, it's
displayed.  All other information on the screen is the same as in Real mode
  In Free Mode you can upload files, this is done by pressing the INS button.
For more information on uploading files see the section *Uploading*

  Debug mode will be supported in version 1.4, it will function like Run
mode, except that there will be a debugging panel, which will allow you to
control aspects of the processor such as registers, or set break points.

  XDebug mode runs in a text screen, and at first glance, looks like a really
nasty evil DOS thing.  Well, that's exactly what it is.  XDebug mode exists
so I (or you) can test specific instructions and things.  It allows the user
to see all registers, and a couple memory dumps, and generally gives full
processor control to the user.  There's no option to turn on the screen.
(Maybe I'll add this at some point)  But that's of little regard, since
XDebug exists for me to test the Z80vP, and not to jingle around with making
an assembly program on the calculator.  (Epsecially when I couldn't.) For
more information on how XDebug works, see the section *XDebug Mode*

** Run-time options
  These options were at one time consts or defines in C.  They were changed
so that I could test various things.  Each has a default value, which is the
one I finally decided on, but if you want to muck around with these to see
what you can do with them. Go ahead, that's why they're there.

  The --rom_file option was the first one I ever had.  Even though the help
doesn't show it, there is another option to this besides a filename.  If you
enter (null) for the filename, then V86 just starts up with empty ROM pages.
Since each instruction is a NOP, and these take (equivalently) more time than
a halt, (which can nearly quadruple your instructions per second)  It's a
nice thing to test how fast V86 is on your computer.  Default is "ti86.rom"

  --all_access is a nice option to use when loading simple ROM images,
because if the ROM wants to be able to write any information, it has to be in
RAM.  So the program can either copy itself into RAM, to access it's
variables, or you can use --all_access.  This option is in-active unless you
include this command line option.

  --retrace is used to set the number of lines that are draw between drawing
the last and the first line.  Thus, changing this can effect how much time
that the refresh bit is active or inactive.  You could tweak this to exactly
what you want.   The number you give is multiplied by eight, then added to
the 64 diplay lines, to find the last line.  Default is 50.

  --refresh is used to set the number of screen refreshes that occur in one
second.  In Real mode this allows you to adjust how many FPS are occuring and
in Free mode it indirectly effects how many instructions are executed per
line.  Default is 50.

  --instructions_per_line only effects Free mode.  This command line
parameter effects how many instructions are executed per drawn LCD line.
Thus, the lower you set this number the lower the speed of the Z80vP, but the
higher the framerate. If you set it higher, then the faster the speed of the
Z80vP, but the lower the framerate.  The default for this is autocalculation,
which is designed to give a fixed framerate with maximum instruction rate.
This autocalculation is what makes V86 usable even at full speed.

  --link specifies the type of link cable is installed on your system.
It takes a single parameter, which specifies which link method to use.  Valid
option values are: NONE, SPKR, LPT1, LPT2, LPT3, LPT4, COM1, COM2, COM3, COM4.
If the link type is not supported, you will be told so.  For more information
see the section *Linking* below.

  --link_fix is designed to flip the lines on the link cable.  This option
exists in case you incorrectly constructed your link cable, and you don't
want to fix it.  This option is untested, but hopefully should work.  This
option is in-active unless you include this command line option.

*** Z80 vProcessor
  Z80 vProcessor is the name of the part of my emulator, which emulates the
CPU.  Z80vP is (as far as I know) the most accurate Z80 emulator in use on a
TI calc emulator.  It emulates stuff that other emulators would just leave
alone, because it doesn't have to be done. It's also written in Assembly, but
not only that, but hand optimized assembly. Thus it's fast, really fast.
It's so accurate, I'd rather say it's a clone of the Zilog Z80, not an
emulation of it. (Like Java claiming it's a "Virtual Machine" instead of an
"Emulator")
  Z80vP emulates exactly how the R register reacts. (As documented from many
sources.)  In that the 7th bit is never altered, and it's properly
incremented in every case it should be. (Repeative commands increment per
iteration, and halt increments per skipped instruction)
  IFF1, and IFF2 are correctly emulated in that both are set on EI, and both
are reset on DI, and IFF1 is cleared when interrupted, and IFF2 is copied
into IFF1 when RETI executes. (As document in offical user's manual)
  All undocumented opcodes, which I've been able to find, are accurately
emulated. (In that I brute force tested each one before I emulated it.)
  When Zilog's documentation said that an OUT or IN instruction had a high
byte on the port number, that was emulated. (Even though it's never used)
  It properly wraps memory writes, (ld ($FFFF), HL) Protects ROM (so long as
--all_access isn't active) and fully emulates Memory Paging. (Thus if two
copies of a memory page are active, altering a value in one, alters the value
in the other)
  Sets up interrupts to occur every 200th of a second.  Just like a real
Z80, and supports all three interrupt modes correctly. (Yes, even IM 0!)
Repeative commands can also be interrupted in-progress (Zilog's documentation,
Z80 instruction set)

  What's new to Z80vP in v1.2?  I've cut out about a zillion jumps that were
there to make my programming life easier, and are now replaced by macros.
Thus, it's much faster.  No corrections to my knowledge were made to the core
from v1.2 to v1.3

  What's new to Z80vP in v1.3?  Well, before I said the next release was
going to just be a more macroed version of v1.2, and still called v1.2, why
the change?  Well, I found out about a lot more 80x86 opcodes, and so the
code is now (as I believe) _SO_ optimized, that unless I figure out a new
trick, it's not going to get any faster.  No corrections to my knowledge were
made to the core from v1.2 to v1.3

*** TI-86 Hardware Emulation
** Grey scaling
  V86 emulates all documented ports of the TI-86.  Since V86 allows for
changing the location of the LCD memory, and doesn't immediately clear bits
away, it has support for grey scaling.  The emulator TI8XEmu supports grey
scaling, though as a command line option.  EMU86 supports it automaticly, as
does V86. Of course, if you've already checked out any grey scaling on V86,
you'll notice something.  It flickers... REALLY bad.  I'm working on this,
but for now, you just have to put up with it.  A good rule of thumb for now
is, that if the game supports grey scale inside the actual game, you probably
won't want to play it, until grey scaling works better.  Hopefully when V86
goes open-source, someone else can get this working.

** Keypad
  The V86 has a unique feature in that, it has two keypad definitions, which
change as the Alpha option of the TI-86 changes.  So, it has an Alpha Keypad
map, and a Non-Alpha Keypad Map.  The alpha keypad map is exactly like the
non-alpha keypad, except that all of the keys which have an alpha to them are
remapped to the key on the keyboard, which corresponds to that letter. Thus,
C becomes COS, D becomes SIN, and E becomes TAN.  This greatly assists, when
typing.  Though, if you're not typing alpha characters with it, then you want
to be able to easily remember which keys are which right?  That's why the
non-alpha keypad map has easily memorizable assignments.  C is COS, S is SIN,
T is TAN. Also, Should you want to use a keypad in the other mode, from the
one you are currently using, just press and hold the ALT key before you press
the button.  This is useful for games that want you to enter your name, but
don't set the ALPHA status. (i.e. ZTetris and the high score entry) The
complete keymaps are given below:

* Keys, which are the same on both maps
TI	PC
----------------------
ON	\ (Backslash)
EXIT	Esc
MORE	TAB
DEL	DEL
2nd     RIGHT SHIFT (Left shift doesn't work)
ALPHA	CTRL
GRAPH	F6
TABLE	F7
PGRM	F8
CUSTOM	F9 
CLEAR	BACKSPACE
ENTER	ENTER
F1	F1
F2	F2
F3	F3
F4	F4
F5	F5
UP	UP
DOWN	DOWN
LEFT	LEFT
RIGHT	RIGHT

* Key Definitions for other keys in Non-Alpha Mode
LOG	K
SIN	S
COS	C
TAN	T
^       ~ (Tilda)
LN      L
EE      E
(       [
)       ]
DIV     /
MUL     M
SUB     -
ADD     +
x^2     " (Quote)
,       , (Comma)
STO->   ; (Semicolon)
(-)     N
.       . (Period)
0-9     0-9

* Key Definitions for other keys in Alpha Mode
A-Z     A-Z
x       0
SPACE   SPACE
=       =

* Special Emulator Commands
Key	Action
-------------------
F10	Save a screen shot to a monochrome bitmap named TI86.BMP.
F11     Quit emulator, and save state to STA filename
F12	Quit emulator, and do not save.
ALT     Use other keypad from one that's active
INS     Upload a variable to V86 (See the *Uploading* Section)

NOTE: The Left Shift key is not attached to anything.  My keyboard driver
didn't like the left shift key being assign to something, and using the
arrow keys at the same time.  I know why this is, and I'll fix it someday.

** Refresh / On Button / LCD on/off / Low Power Mode / On Button Interrupt
  Wow, that's a lot of stuff.  Why's it all in one group, I bet you're
asking.  Simple, because they're all on the same port.  (The Nightmare of
emulators.  The Jack-Of-All-Trades Port)  Port $3 deals with ALL of that. I
read a lot of stuff about how this port's supposed to work, but none of it
helped.  But here's the information for you.  Do what you want with this
information, it's free.  This information is how V86 treats the information,
and for all but the *not used ones it works for a TI-86.

* Input (IN A, ($03)
Bit 0:	Set: Call On Interrupt	Reset: Skip On Interrupt
Bit 1:  Set: LCD Refreshing	Reset: LCD Drawing
Bit 2:	*Not used
Bit 3:	Set: On Button Up	Reset: On Button Down
Bit 4-7: *Not used

* Output (OUT ($03), A)
Bit 0:  *not used
Bit 1:  Set: Turn LCD on	Reset: Turn LCD off
Bit 2:  *not used
Bit 3:	Set: Normal Power Mode	Reset: Low Power Mode

  If anyone can tell me what Bit 0 of Output does, it'd be appreciated,
because the only places I see it reset, it gets set again right after! What's
with that? (Could possibly be a reset of the On button interrupt check?)
  When the calculator is in Low Power Mode, it refuses to recognize
interrupts.  Not that it disables them, it just ignores them.  But, once the
On Button is pressed, this mode clears.  Thus, if you OUT the value one to
port $03, then halt, it waits indefinately there until you press the on
button.  At that time it executes the interrupt, and then returns to the
instruction after the halt.  It should be noted that the interrupt handler
for the TI-86 always resets port $03 to $B, so you don't have to.
  Sending a value with Bit 3 reset to port $03 results in the LCD going off.
Though, like I said above, the first interrupt called after this function
will set the value back on.  So, the LCD goes off for at most a 200th of a
second.  Then it's back on.  You could disable interrupts do a loop until
something, and then quit the loop and enable interrupts again to turn the
screen off for awhile, or put it in Low Power Mode, which waits for the ON
button.
  The first two bits of input from Port $03 are of special intrest, because
the interrupt handler uses them to call different parts of the interrupt
handler.  If bit 0 is set, then the calculator checks the status of the on
button, and returns.  If an emulator always has this value set, it's pretty
bad.  Set this bit when the on-button changes and then reset it afterwards.
If bit 1 is set, then the refresh part is executed.  During the refresh part
the run indicator is updated, keys are read, and the cursor is blinked.  If
this is called too much the emulator blinks the cursor a lot, and reads the
keyboard faster than it should, thus making use difficult.  If this isn't
called enough, or not at all.  The emulator blinks the cursor really slow,
and keyboard input is really slow and sluggish.  Finding the just right is
what it's all about.

  Well, that covers this port.  I hope you've learned something, because it
took me a LONG time to figure this stuff out. (Most of the data on this that
I read was wrong.  Except the On Button down/up.)

** Linkport
  Yes, V86 has linkport support.  This was a priority for me to get it
working for awhile.  Good ol' trial-'n-error eventually got it working. V86
has a couple different linkport modes.  One is NULL, one is SPKR, one is LPT,
and the last is COM.

  NULL type is the default, and does nothing.  The link port information gets
updated, and both lines are always high, so that V86 doesn't think there's
another calculator trying to talk to it. 
  SPKR is a nice mode for games which support sound through the linkport.
SPKR mode functions like NULL, except that if input from the linkport results
in either bit 1 or bit 0 being not set, a sound is emitted through the PC
speaker.  If both are set, then the sound is stopped.  The sound is pretty
garbled right now, but like with grey scaling, that'll be fixed in time.
  LPT is the most versitile mode right now.  It uses the parallel port as the
link cable connector thingy.  When using the command line option "-link" you
should put "LPT1" for LPT1, "LPT2" for LPT2 and so on through 4.  This
initializes the right information and stuff.  Once this is done, V86 can
communicate with either another calculator, another computer, which is
sending data files, or another computer, which is emulating a TI calculator
with a link port.  There is also the option --link_fix, which is helpful if
you crossed lines when you made your link cable.  If V86 won't talk to your
TI-86, then try this option, if it doesn't work but works with other programs
which compensate for crossed lines, let me know.  This link type has been
tested using my link cable, which I made.  My lines aren't crossed (I can use
other upload programs) so you can likely rely that if it works without
--link_fix, it's probably not crossed.  V86 uses the BIOS's shadowed memory
to determine the ports to use for your LPT port, so you shouldn't have a
problem.  Though, if you do have problems, with the link not working, please
write me.
  COM mode will use the serial port. (com port) To communicate.  Though,
right now, I don't have a COM port link cable.  So it isn't available.  I will
purchase materials to make one somewhat soon to support this mode as soon as
I can.
  There may be one more linkport option, which would use the graph-link. I'll
need to borrow/purchase one, and work with it.  Don't expect this one soon.

** Uploading
  This section concerns uploading files directly to the emulator, and not
through a real calculator.  First, you need to goto the RAM view screen. This
is the screen which shows how much free memory you have, and how many bytes
are taken up by each data type.  Once here, press INS on your keyboard. This
will bring up a prompt (at the bottom of the screen) asking for a filename.
Enter the filename of the program to upload.  It should upload and display,
"Upload successful" and "Press any Key to Continue" at the bottom of the
screen.  You should then press a key, and emulation will continue as normal,
except that the program is loaded.
  If you see the message "Unable to open file:" then the filename that you
specified, it means that V86 was unable to locate that file.  If you recieve
the message "Must be in RAM view screen" it means you weren't RAM view screen
when you attempted to upload.  You must be in this screen to insure that the
emulator doesn't accidentally glich, when you're uploading.
  Limitations:  Ok, this has some numerous limitations.  File uploading works
by having the emulator and ROM actually create a variable with the proper
name, then loading that into the second swapable memory page, then copying
the information into there.  This requires inserting code into PlotScreen,
there is no problem if the size of the program overflows as that this is
handled without problems.
  V86 does not handle group files properly.  It should upload the first
variable, but will not even attempt to upload the other variables.  It's also
important to note that V86 determines the variable type from within the file,
_NOT_ from the extension of the file.  I know of at least one situation where
I uploaded a file to V86, and instead of a program, it was a string! (To my
surprise)  This can be fixed with a hex-editor, and changing the type
definition in the file to the correct one.  I'm not intending at any time to
"fix" this, because I don't see it as a bug in V86, but rather in the saved
variables.

*** Planned Work

*  I want to get greyscaling to work.  Or at least better.  Maybe I should
have an option to disable graphics screen moving so people don't get sick
from my emulator.  Well, all stuff to deal with in a later version.

*  I want to get a com port link cable, and a graph-link cable, so that
I can start supporting those, too.  After all, not everyone has, nor
wants a parallel port cable.

*  I'll be doing work here and there in the emulator, getting stuff to work
better and all, and more efficently.  I would appreciate bug reports, so that
I can fix stuff with my emulator.  Luckly I finally got V86 to work under
DOS, so you don't have to have windows in order to run it.

*  I have someone working on a Linux port of V86.  The first release for
Linux should be this version.  Visit the official V86 webpage to check on
it's development.

*  The next version will have a Debug mode. Also, XDebug mode will be totally
revamped. (Don't expect it to be even close to the same)  XDebug mode should
end up similar to DOS's DEBUG.EXE

*** ROM Images
  V86 will not do much of anything without a ROM image.  V86 supports loading
of any file as a ROM image, (no restriction or requirement on length)  But
more than likely if you load some random file, V86 won't do anything cool,
and could potentially damage your system.  V86 should be distributed with
GROM86.ROM  This ROM image is a ROM image, which I have programmed. You can
freely use this one, but to use the real TI-86 ROM, while you don't own a
TI-86 is _ILLEGAL_.  Don't do it!  I do not condone the use of illegal ROMs.
Also, just because at one time you OWNED a TI-86, doesn't mean you have the
right to use the ROM, you must actually currently be in possession of one.

  Also, do _NOT_ email me, or in any other way contact me about how to
obtain a ROM, or where to obtain a ROM.  I already put support for getting
the ROM from your calculator, and to my knowledge it works.  If it doesn't
too bad, I'm sorry.  It's included as an extra, and is _NOT_ supported.  Also,
the calculator program used to send the ROM is _NOT_ written by me, do not
gripe at me if it doesn't work!
  Also, downloading a ROM from the internet is illegal in _ALL_ cases.  I
will ignore all messages concerning where such sites are, and if I know of
any of these sites, I will personally report them to TI. (I've already done
this to one site.)  I don't want people seeing emulators as pirates, or
assistants to pirates.  TI worked hard to make they're software for the
TI-86, and there is _NO_ reason, and _NO_ cause for obtaining a ROM, which
you do not legally own.

** GROM 86
  This is the ROM, which is included with V86.  It's a simple ROM, and a ROM
in the works.  Right now, it just displays the first 128 characters on the
screen and blinks an immobile cursor.  It's capable of more, but it's not
active yet.  I'll continue to develop this ROM, and may at some time even
release a couple games, which use it.
  You can freely use this ROM on any medium (emulator, real calculator,
whatever)  Though you may not disassemble it.
  I'm planning on making this open-source along with V86.EXE

** Getting my ROM
  Ok, I've been saying that V86 has all the software you need to get the ROM
from your calculator, but you don't see any files included in the ZIP file,
which would suggest getting a ROM.  This is because it's all internalized,
thus insuring that they will be a fully available feature.  ROM86.86P is
INTERNALLY included with V86, which means it's inside of the V86.EXE file.
By giving V86 the command line argument --send_rom86 and specifing a proper
link type, V86 will upload this internalized ROM86.86P to your calculator.
To get your TI-86 ready to recieve ROM86.86P press <2nd> then <Link> (the
<x-VAR> button).  This will bring up a menu with the options, "SEND", "RECV",
and "SND85"  The only one you have to concern yourself with for now is
"RECV".
  Get V86 started up with the --send_rom86, and V86 should display, "Press
any key to start sending"  Now, select "RECV" from the menu on your TI-86,
and hit a key on your computer.  V86 will display "CALC <= ROM86", and will
start sending to your calculator.  If V86 displays "Timeout" or "Link
Failure" then there was an error sending the file.  If your calculator
already has a data object named, "ROM86" it will ask you to rename,
overwrite, skip, or quit.  You should no matter what get the ROM86 included
in V86, because I don't technically support any other ROM sending programs.
If you skip, or quit, V86 should display, "Skipped" but it doesn't really
matter too much.  Once V86 has successfully uploaded ROM86, it will display,
"Upload successful" and quit.

  To get the ROM from your calculator, start up your calculator and run
ROM86.  ROM86 will wait indefinately to send, so this will give you all the
time you need to get your computer ready.  Start V86 with the --get_rom
option, and specify a proper link type.  V86 downloads to the name specified
by the --rom_file option. (default: TI86.ROM)  V86 will wait for information
to be sent, and if it doesn't start up downloading right away, you should
press a button on your calculator, this will start the download.  V86 will
display "Recieving" and then will put a period after this for every
downloaded 8Kb. (8192 bytes) There are 32 dots, so it will take awhile.  The
dots are nice indicators as to your progress.  If V86 fails to download the
complete ROM, it will notify you, and your calculator will continue to try
and send, patiently awaiting a receiver.  Should this happen, restart V86,
with the --get_rom option and wait for it to finish, then restart the
process.  Once you get a full download, you should have your ROM,
congradulations, you're ready to use V86!

*** Installation
  Installation of V86 is a sinch.  Merely extract V86.ZIP into any directory.
(I suggest you put it somewhere, where you'll remember it) Then at a command
line prompt, goto that directory, and run the program V86.EXE  It's that
simple!  If you don't have a TI-86 rom in that directory, (named TI86.ROM)
though you would like to, then you have to follow the steps above to get the
ROM from your calculator.

*** V86.ZIP contents
The zip file should contain:
  V86.EXE                The executable for V86
  GROM86.ROM             The demonstration ROM. Doesn't do much.
  V86.TXT                This file
  CWSDPMI.EXE            DPMI Dos extender
  CWSDPMI.DOC            Distributed file for CWSDPMI.EXE

  If you have a ZIP file, which does not contain all of these files, then I
suggest that you download V86.ZIP from the official homepage. (See below)

** Requirements
  V86 requires at least a 386 processor to even properly execute, though this
would be very difficult to use.  On a 486DX/66, v1.2 ran about half speed,
although this is better than I expected, and it was useable, it was mightly
slow.  Thus, I suggest (for accurate speeds) at least a Pentium 75.  It runs
overly well on my Pentium 200 MMX, and can get about twice speed on my
friends Pentium 133.
  V86 requires access to a DOS prompt under a DPMI environment.  DPMI is a
specification to allow protected mode programs to interface with DOS (a real
mode operating system)  If you are running V86 under Windows 95, or 98, then
you automaticly have DPMI enabled.  (If you don't check your DOS memory
settings)  If you are running V86 under DOS, then you will need CWSDPMI.EXE
(included) or some other DPMI servicer.  I can not even guess as to V86's
compatability with DOSEmu for Unix/Linux.  If it doesn't run, don't complain
to me. That is unless it fails under MS-DOS (v5.0 or later) or Windows 95.
  Actually, I don't understand how the versions previous to 1.2 even managed
to run under Windows.  There was a NASTY misuse of memory, which DOS hated,
and Windows didn't care about.  (More proof that DOS was the last solid
operating system.)
  V86 uses VGA graphics, so just about every computer that CAN run V86,
should support it, because if you have an MCGA, or EGA system, you probably
don't have the processing power.

*** Compatability
  The programs, which I have tested on V86, are very few.  But still, it
should work with all of them.  If you find a program, which V86 will not
function correctly with, let me know.
  Some programs are bound to not upload correctly in certain situations. If
this occurs you can always turn to the sure-to-work method.  That is; upload
it to a real calculator then to the emulator.

*** How to turn off Auto Power Down
  TI-86's have a nice feature in them to conserve power.  This feature is
Automatic Power Down.  While this is nice on a calculator, which drains
batteries, it's not required for an emulator.  To turn it off you will need
to have a hex editor.  Merely open the ROM file up, goto offset $184 (this is
hex) and change that value to $C9. (hex again) Please note that you really
should backup your ROM before doing this.
  This trick works for v1.3 and v1.2 ROMs, I can't say anything about other
ROM versions.
  Later versions of V86 may check ROMs for validity, so your ROM without APD
may become invalid in the future.  So, make sure you keep that backup copy.

*** XDebug Mode
  Too much to explain.  And it will all change in the next version. For now,
consult the official webpage.  For the most part, this will work.  In
addition to what's on the page, the following is new:
  The "hi" beside the PC, SP, display are the three processing flags.  They
are: Halted, and Interrupt holding, respectively.  The H flag is set when the
processor is halted, and the I flag is set when the calculator is in low
power mode, and thus preventing recognition of interrupts.
  The bottom line now displays write access flags for each available page.
A 1 means access allowed, a 0 means write access disallowed.
  The flag display has been moved to be on the same line as the AF register.
  The command "unlock" turns off the I processor control flag, allowing
interrupts to again be recognized.
  The command "unhalt" turns off the H processor control flag, allowing
execution to continue.
  All other information supplied on the offical webpage applies.

*** What's new?

v1.3b (V86) //maintanence update
- Fixed Free Mode, so that it can upload (like this file said)
- Fixed Free Mode to interrupt correctly.

v1.3 (V86)
- File uploading independant of a real calculator
- Included v1.3 of Z80vP, which is (most likley) as fully optimized as it
    will get, unless I discover a new trick.
- V86 now has GNU complient output, working on source, the next update will
    make V86 open-source.

v1.2 (V86)
- A name change (removal of trademarked TI, was TI86v)
- Now runs under DOS, and doesn't require a Win95 DOS box
    (Running under DOS will now be always be available)
- Included v1.2 of Z80vP, which has a couple optimizations to it to increase
    the speed by a significant amount.  
- Did some work on how V86 deals with the contrast and the LCD screen.
    Greyscaling still doesn't work, but it will.
- Added the modes to get your ROM
- Processor now binds per KHz, not per 1024 instructions

v1.1 (TI86v)
- First working release, all updates will be marked from here.

*** Other stuff to deal with

** Acknowledgements
  I'd first of all, like to thank Texas Instruments for making the TI-86. It
would be really hard to emulate something, which doesn't exist.
  Second of all, I'd like to thank all those Assembly TI-86 nuts, who got the
TI-86 to be so cool.  Without them, I probably would have purchased the
calculator and sold it before I had a clue as to what you could do with it.
(Maybe I wouldn't have even have purchased the calculator)
  I want to thank the makers of DJGPP.  V86 would have been really annoying
to write outside of protected mode, because I use so many nifty techiniques
for speed ups.
  I want to thank Randy Gluvna, who wrote ROM86.86P, which is included in
V86, to allow users to get their ROMs without hunting down software.
  Lastly, I'm gonna thank Zilog for putting the Z80 official documentation on
the internet.  Had I not had that, I don't know what type of quality V86
would have.  (If you want to emulate a chip, first goto the official
documentation)

** Information on the Original Author
  I'm 19, and attend New Mexico State University.  I am a German an Computer
Science major, who spends all his free time coding on his computer.  I like
to program, and eat.  Sleep comes only when necessary. :) This is my first
but hopefully not last emulator.

** Legal Stuff
- It is illegal to use V86 with the TI ROM without owning a TI-86!

- V86, Z80vP, and GROM86 are Copyright (C) 1999 Daniel Foesch.

- V86, Z80vP, and GROM86 are free.

- V86, Z80vP, and GROM86 come with NO WARRANTY

- I'm not responsible for damage direct, or indirect as a result of your use
    of V86.

- You may use V86 and/or GROM86 for as long as you want.

- Distributation of V86 is encouraged, so long as the content is not
    altered in any way, and the TI ROM is _NOT_ included.  If you wish to
    distribute V86, I suggest you keep a close eye on the homepage for
    updates, or talk to me and have me inform you of updates.

- You may _NOT_ sell V86.  It is _MY_ intellectual property, and it will
    remain free for the duration of my copyright! (75 years after my death)

**  How to contact me
  You may contact me through the following methods to report bugs, or give
me thanks or whatever (no spam please):

E-Mail: krach42@hotmail.com
ICQ UIN: 1478626 (Krach)

The official V86 webpage is at:
http://www.geocities.com/Area51/Station/7142/?startpage=v86.html

  Go here for the latest version, and updates about V86, and GROM86

  If you want to use Z80vP in one of your programs, please contact me, and
I'll let you know about the terms of use.

  If you are interested in porting V86 to another system, hold that thought
for v1.4, when V86 goes open-source.
