Copyright: Copyright 2000 Jeff Chai
Citation: Assembly Langauge


Welcome Page
TI-83 Plus Asm Tutorials

Version 1.02, 2.01

Authored by Jeff Chai

    Quick Start to:      Table of Contents         Z80 Instructional  References          Credits           Web Links

Introduction

What is a TI-83 Plus? If you don't know this, delete this help file immedeatly and pray for mercy... Just kidding:) A TI-83 Plus is a Graphing Calculator made by Texas Instruments. Take a look at the specs below:

TI-83 Plus Specifications

   CPU (Central Processing Unit)-	          8Mhz Z80 (Running at 6Mhz)

   Available Flash ROM (Archive Mem)-	          160K

   Available RAM (User Memory)-          	          24K user RAM

   Power-	          4AAA batteries (Main) 1 CR 1616 (Back-UP)

   Display (Lcd) -	          64 x 96 Pixels

   Built in Programming Languages-	          TI-Basic and Assembly

   Mean Price-	    	                             $95

The TI-83 Plus isn't that much different from the TI-83.  Besides the added Flash ROM and different key pad setup, the TI-83 Plus is almost the exact same thing. After all, they are designed to work side by side with each other. A cool fact about the Z80 processor is that it is the same processor used in Nintendo's GameBoy!

What should I do to learn TI-83 Plus Asm?

For starters, you should read each tutorial and follow along with what each one says. This tutorial was not meant to replace ASMguru, well sort of, at least for purposes of getting the user aquainted with TI-83 Plus Asm. Skipping tutorials is not recommended because each one will likely build off the previous one.

Programming Languages

There are two built-in langauges you can program in on the TI-83 Plus, z80 Assembly language and TI-Basic.

TI-Basic

Have you ever heard of Visual Basic or QBasic? Both of them are powerful progamming languages. They are rather easy to learn and understand. TI-Basic, which can be programmed directly on the calculator, takes the most common commands from the latter and adds a few calculator commands. It can be programmed directly on the calculator, or written on the computer, and then sent to the calculator. TI-Basic should be mastered before attempting Assembly langauge. TI-Basic programs are generally slower than Asm programs due to the fact that the calculator reads each command line in the TI-Basic program one at a time.

Assembly Language

Assembly Langauge, also called Asm or Assembler language, is the lowest level language you can program on a CPU. In other words, programs written in Asm are given access to restricted areas in the CPU's (calculator's) memory, therefore any bugs in the program could cause the calculator to crash and reset. Sometimes ALL the batteries in the calculator need to be removed to recover from a crash. Using a calculator emulator such as Virtual TI is the only safe way to test an Asm program. Asm programs run faster than their TI-Basic counterparts because Asm programs are compiled into the calculators native langauge.

 About the Author

The author of this great tutorial is Jeff Chai. I am (believe it or not) an eighth grader at Kingsview MS. I have a 4.0 GPA (pretty good...). Yes, I was really excited when I got my TI-83 Plus and TI-89 though I was dissapointed when no one knew how to program in Asm for the TI-83 Plus. I live in Gaithersburg, Md. I play the Piano and the Violin. I can program in Visual Basic (and QBasic), C, C++, TI-Basic and Z80 Assembly. My favorite computer game? That would have to be Command & Conquer. I learned Asm with the help of Robert Senser. He's a great guy, knows his stuff...

I'm currently making this tutorial as I learn TI-83 Plus Asm. If you need help, contact me at ecchai@netzero.net. Please report any false information in this tutorial to me immedeatly. You will recieve the proper acknowledgements, just don't scrutinize my work (That includes spelling errors).  If I forget to give someone credit, don't kill me, I'm only human, let me know as soon as possible. If text or font compatibility problems arise, let me know and I will send you a version with corrected text formatting.

Let's Start Learning!

This help file has been produced using helpMATIC Pro V1.22 Shareware

http://members.aol.com/harbsg/

The above message will not appear in the registered version


Tutorial 1

What you need to Write asm programs

Overview

In this tutorial, I will be showing you what is needed to make/assemble Asm programs. We'll even learn some DOS commands!

Required hardware

The following items are needed to create/run Asm programs:

- TI-83 Plus (this is kind of important)

- TI-Graph Link or Equivalent (actually optional)

- IBM compatible PC

Required software

The following programs are needed to write/assemble Asm programs:

-TI-Graph link software (only if using TI-Graph Link)

-*TASM cross assembler/linker

-*Objhex (Objhex is a program I made in C that converts Binary files to hexadecimal code)

-*Virtual TI (optional, I'll show you how to use it later)

-**Asm.bat (a batch file I will show you how to make, don't worry about it yet)

-Any word processor (Notepad is prefered)

                -Windows 3.x, 95, 98, 2000, or greater

*Available at www.ticalc.org, www.calc.org, or other calculator websites. Your best bet is to look in their program archives.

**Included with this Help File

What is this?

If you are new to Asm programming, you have probably never heard of the software mentioned above. The TASM assembler/linker assembles the program you've written in z80 assembly language. Nobody would have heard of ObjHex because I made it (It is programmed in C). The only reason I use it is because I have never used Obj83 (I just recently found out what it was for:). They both do the same thing, but I'd prefer you use ObjHex because I worked hard on it. If you want proof that it isn't just a renamed Obj83, give me an e-mail, I'll show you the source code for it! Virtual TI is a calculator emulator, I'll tell you how to use it later. If you don't know what Windows is, you probably shouldn't be using this help file, because you wouldn't be able to. Notepad is a word processor, we will type in the source code for our programs here.

What we're going to do

Now, we need to organize the files into folders ("Directory" is the DOS term for folder). Create a new folder called "LearnAsm". You may call this folder anything you want as long as you know what it is. Now, inside this folder, create four more new folders, name them: "TASMassembler", "ObjHex", "Virtual TI", and "MyPrgms". Extract the contents of the TASM zip file to "TASMassembler", the ObjHex zip file to "ObjHex", and so forth with the rest of them. Leave the "MyPrgms" folder alone for now, we will save all the programs you make to this folder. Now copy the contents of "ObjHex" to "TASMassembler". Before we get to the batch file, make sure if you're using the TI-Graph Link software that it's installed correctly in it's own seperate folder.

Now, here's the batch file. Open the "LearnAsm" folder. Now right click and select New, then click on text document. Name it "asm.bat". Note the file extension is .bat. Now open it. Copy and paste the following text into it.

@echo off

echo ----- Assembling %1 for the TI-83 Plus...

tasm -80 -i -b %1.z80 %1.bin

if errorlevel 1 goto ERRORS

echo ObjHex Converter   	  Version 1.2

echo  Copyright (C) 2000 Jeff Chai

objhex %1.bin > %1.hex

echo ----- Converting to hexadecimal format...

echo ObjHex: HexaDecimal version is %1.hex

echo ObjHex: Task Complete!

goto DONE

:ERRORS

echo ----- Errors were found!

:DONE

echo ----- Done

Just to let you know, these are MS-DOS commands (Microsoft Disk Operating System). DOS was developed by Microsoft in the late 80's. It is simple to use if you know how. What do these commands mean? Well, look below:

@echo off - prepares OS to display text

echo - command that displays anything typed after it, always preceded by @echo off

goto <Label> - goes to a Label

If - If statement true, do something

%1 - This is replaced with the name of the file you specify in another batch file.

Save the file and then move it to the "TASMassembler" folder ("Directory" is the DOS term for folder for those who are DOS illiterate...). Take a look at the batch file. Try to understand it, know what it is doing at a specific point in time. It'll make things a lot clearer.

Important!

Assembly programs must be written in z80 assembly language. Though to be sent to the calculator, they must be assembled and converted to ASCII (Hexadecimal code). Once on the calculator, they may be run as is, or compiled in to the calc's native language.

Tutorial 2

This help file has been produced using helpMATIC Pro V1.22 Shareware

http://members.aol.com/harbsg/

The above message will not appear in the registered version


Tutorial 3

Program Format

Overview

We're going to recognize and identify the parts of a program.

What belongs where in a program?

Look at the format of an Asm program, just follow along. Just to let you know a ; (semicolon) means anything on that line is a remark. Remarks are used to make comments in a program. Remarks are not read by the assembler or calculator. A note when writing Asm programs, indentaions are required, they help the TASM assembler read the program so it can understand.

#define B_CALL(xxxx)	rst 28h \ .dw xxxx	;THE HEADER

#define B_JUMP(xxxx)	call 50h \ .dw xxxx

;

;

;

;DEFINES AND EQUATES(Part of the HEADER)

;

;

;

.org	9D95h	;THE PROGRAM START

;

;

;THE BODY

;

;

.end	;THE END

END

The HEADER

There is not much to know about this section except that it goes into every Asm program you write. what you should know about this section is that it defines the two macros B_CALL and B_JUMP. These macros call ROM calls. If you use an include file, this section is not nessesary.

The DEFINES AND EQUATES (Part of the HEADER)

This section allows you to define each call you use in your program. Again, if you use an include file and know that the commands you are using are covered in there, you do not have to define them again. To incorporate an include file to define calls, type in #include "XXX.inc". Where XXX is the name of the include file. An include file is a file that has ROM calls or routines defined in them. The #include statement just saves you time by copying the contents of the include file to the program.

The PRGOGRAM START

This tells the calculator where to start running the program in memory. With the TI-83 Plus, the program always starts at the address  9D95h.

The BODY

The body of the program is where you write the calls and functions (routines) you want the program to do. It can be as long as you want. You must call each call or function using the B_CALL(xxxx) statement. Where xxxx is the command you wish to run. Make sure you define each ROM call in the Defines and Equates section when you use them in your program. Or make sure that the specific ROM call is in the include file if you are using one.

The END

Simply stated. The END of the program. This must always be at the end of every program.  Don't change anything in this section, all you need is the .end and END.

Tutorial 4

This help file has been produced using helpMATIC Pro V1.22 Shareware

http://members.aol.com/harbsg/

The above message will not appear in the registered version


TI-Basic is a built in programming language on the TI-83 Plus. It is easy to learn but programs written in TI-Basic usually run slow. Errors in TI-Basic programs will not crash your calculator. TI-83 Plus TI-Basic programs can be sent to a TI-83, and vice versa. But Asm programs are not interchangable between the two calculators unless some changes (Porting) have been done.

This help file has been produced using helpMATIC Pro V1.22 Shareware

http://members.aol.com/harbsg/

The above message will not appear in the registered version


Assembly language is the lowest level programming language on the TI-83 Plus. It allows the programmer to see exactly what commands the CPU can run. It is the most powerful language for an individual CPU but is very hard to understand. Since it has acess to restricted areas in memory, if there are bugs in a program, the calculator may crash and reset itself. So backup all important files on your calculator!

This help file has been produced using helpMATIC Pro V1.22 Shareware

http://members.aol.com/harbsg/

The above message will not appear in the registered version


Table of Contents

Version 1.12,2.01

Welcome!

Tutorial Set 1(Dated 2/12 - 2/23) v.1.01,1.02 Difficulty level 1 - 2 (Beginning Asm)

Tutorial 1 - What you need to Write Asm programs

Tutorial 2 - TI-83 vs. TI-83 Plus

Tutorial 3 - Program Format

Tutorial 4 - Clearing the Screen(Prgm)

Tutorial 5 - Assembling Asm Programs

Tutorial 6 - Moving the Cursor to the next line(Prgm)

Tutorial 7 - Displaying Text(Prgm)

Tutorial 8 - Using _Getkey(Prgm)

Tutorial 9 - Turning the calculator off!(Prgm)

Tutorial 10 - The Run Indicator(Prgm)

Tutorial 11 - Graphing a Verticle line(Prgm)

Tutorial 12 - Customizing ROM calls to fit your needs

Tutorial 13  - Using Virtual TI

Tutorial 14 - User Input via Key pad(Prgm)

Tutorial 15  - Tic Tac Toe(Prgm)

Tutorial Set 2 (Dated 3/10-3/22) v.2.01 Difficulty level 2-3 (Intermediate  Asm)

Tutorial 16  - Text Formatting 2(Prgm)

Tutorial 17 - Registers: What are they?

Tutorial 18 - Registers: Their uses

Tutorial 19 - Registers: Their uses (Part 2)

Tutorial 20 - The Include file

Tutorial 21 - Enabling the Lowercase Alpha key(Prgm)

Tutorial 22 - Porting

Tutorial 23 - Using Ion

Tutorial 24 - Creating Program(Prgm)

Tutorial 25  - Mem Check(Prgm)

Credentials - Thanks to all who helped make this help file possible

Disclaimer - Ahhhhh!

Programming References

TI83PlusAsm.inc - TI-83 Plus ROM call Include file

List of common TASM errors - Useful for debugging Asm Programs

Comprehensive Glossary - A Glossary

z80 Instructional References - z80 information

Calculator Web Links

Beginner 83 Asm - Tutorial on Asm on the TI-83, also contains other useful information

This help file has been produced using helpMATIC Pro V1.22 Shareware

http://members.aol.com/harbsg/

The above message will not appear in the registered version


Flash ROM, or archive memory, is more expensive than RAM. Flash ROM can be written or erased about 100,000 times before it becomes corrupt. Applications are run directly from the Flash ROM.

This help file has been produced using helpMATIC Pro V1.22 Shareware

http://members.aol.com/harbsg/

The above message will not appear in the registered version


Tutorial 4

First Program-Clearing the Screen

Overview

In this tutorial, we will be learning how to clear the screen, the Asm way of course.

Programming

The code in the following program will clear the screen on the calculator. This is your first program, so I will lead you step by step. Open the "MyPrgms" folder and create a new text file. Name it "Clrscreen.z80". Note that the file extension is .z80. Open it and copy the following program into it. I recommend that instead of copying and pasting it, you should print it out and copy it by hand, you'll get used to the program format and will thus learn to program faster.

#define B_CALL(xxxx)	rst 28h \ .dw xxxx	;This defines the two macros, bcall and bjump

#define B_JUMP(xxxx)	call 50h \ .dw xxxx	;Don't worry about bjump too much because you won't you use it very often

_clrlcdfull	=4540h	;The calls we will be using are defined here

_homeup	=4558h

.org	9D95h	;This tells the calculator that the program will start at the mem adress 9D95h

B_CALL(_homeup)	;Bringing up the home screen

B_CALL(_clrlcdfull)	;Clearing the screen

ret	;Returning to TI-OS

.end	;End of program

END

Commands Used

_clrlcdf - This command will clear the entire lcd display. When using this call alone in a program, it will clear the entire screen. But don't forget to include a ret call at the end or else the calculator won't  return back to the OS forcing it to crash and reset. The same goes with all ROM calls.

_homeup - This call brings up the home screen.

ret - A standard z80 Asm instruction that takes you back to the TI-OS

.end and END - z80 instructions that tell the calculator that that is the end of the program.

Assembling the Program

To assemble this program, go on to tutorial 5

Other Clear Commands

Other commands such as _ClrLcd (_ClrLcd = 4543h) will clear the display while _Clrlcdf will clear the display ignoring any split screen modes. _ClrScrn (_ClrScrn	= 4549h) will clear the screen and any text shading along with it. _ClrScrnFull (_ClrScrnFull = 4546h) will clear the screen and text shading ignoring split screen modes. _ClrTxtShd ( _ClrTxtShd = 454Ch)will clear the text shade buffer. To use any of these calls in the program above, define the call and call it to the program using the B_CALL() macro.

For example, to use the _ClrScrnFull ROM call, this is what the program would look like:

#define bcall(xxxx)	rst 28h \ .dw xxxx

#define bjump(xxxx)	call 50h \ .dw xxxx

_clrscrnfull	=4546h	;Don't forget to define it

_homeup	=4558h

.org	9D95h

bcall(_homeup)

bcall(_clrscrnfull)	 ;Instead of _clrlcdf, you use _clrscrnfull

ret

.end

END

If you have any questions, e-mail me. I'll do my best.

Tutorial 5

This help file has been produced using helpMATIC Pro V1.22 Shareware

http://members.aol.com/harbsg/

The above message will not appear in the registered version


Glossary

Terms and Abbreviations

Address - A number given to a location in memory.  The location is accessed by using that number, like accessing a variable by using its name.

ASCII - Without getting too complicated, ASCII is basically a convention for encoding character, numerals in a 7 or 8-bit binary number.  ASCII stands for American Standard Code for Information Interchange.

Asm - Assembly language, lowest level programming on a processor

Assembly language - A low-level language used to program microprocessors directly.  Z80 assembly language can be used on the TI-83 to write programs that execute faster than programs written in TI-BASIC.  See the Introduction to read about the advantages and disadvantages of ASM.

Assembler - Assembly Language (ASM) or a program that converts source code that the programmer wrote into machine language that the processor can understand.  Similar to compilers used with high-level languages.

Binary -  A system of counting using 0's and 1's.  First 7 digits and the decimal equivalents are:

0	0

1	1

10	2

11	3

100	4

101	5

110	6

111	7

See also: ASCII

Bit - Short for binary digit— either 1 or 0.  In computer processing and storage, a bit is the smallest unit of information handled by a computer and is represented physically by an element such as a single pulse sent through a circuit or a small spot on a magnetic disk capable of storing either a 1 or a 0.  Considered singly, bits convey little information a human would consider meaningful.  In groups of eight, however, bits become the familiar bytes used to represent all types of information, including the letters of the alphabet and the digits 0 through 9.  (Microsoft Encarta '97)

Byte - A unit of information consisting of 8 bits, the equivalent of a single character, such as a letter.  Notice, 8-bits equals {0-255}, and there are 256 letters in the extended-ASCII character set.  Standard ASCII uses a 7-bit value (0-127), thus there are 128 characters.

Compiled Language - A language that has to be compiled by a compiler before the program can be run.  Examples include C/C++, Pascal.

Compiler - A compiler translates source code into machine code.  Our compiler is TASM.

CPU - Cenral Processing Unit, basically, if a computer "had" a brain, this would be it.

Cursor - The flashing marker you see on the screen that shows the position of where you are typing.

Character - A single letter, digit, or symbol.  'Q' is a character.  '4' is a character.  '%' is a character. '123' and 'yo' are not characters

Decimal - Decimal is the standard, base 10, system of counting, as opposed to base 2, binary, or base 16, hexadecimal.

.db - Data Byte

Execute - Run a program or carry out a command.

Flash ROM - Archive memory on TI-83 Plus, write/erase up to about 100,000 times before memory becomes corrupt

Hexadecimal - Base 16 system, often used in computing.  Counting is as follows {0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F}.

High-level language - Any programming language that tries to look like plain English so it is easier for humans to understand.  Unfortunately, a computer cannot

understand it unless it is compiled into machine language.  See also low-level language.  Examples of High-level languages are: C/C++, Pascal, Fortran, Cobol, Ada etc.

Immediate - An immediate value is one that is given in the program code, instead of being loaded from somewhere else. For example, in LD A, 17, 17 is an

immediate value. In LD A, B, the value in B is not immediate, because is is not written into the code.

Interpreted Language: A language that is changed from source code to machine language in real-time.  Examples of this are BASIC (the PC version, and the Ti-version), JavaScript, HTML (bad example…but you get the point).  The advantages are interpreted languages are often much simpler, good for beginners.  Bad points are speed, and no native is generated.

Instruction - A command that tells the processor to do something, like add two numbers or get some data from the memory.

Lcd - Liquid Crystal Display, the calculators screen

Low-level language - Any programming language that doesn't look like English but is still able to be understood by people. It uses "words" like "ADD" to replace machine language instructions like "110100" to make it easier for the human. See also high-level language.

Machine language - Any programming language that consists of 1's and 0's (called binary) representing instructions.  A typical machine instruction could be 110100, meaning, "add two numbers together".  It is the only language understood by the processor and is completely incomprehensible to most people.

Memory - Memory is where data is stored. On the TI-85, the main memory is the built-in 32K of RAM. This memory is composed of one-byte sections, each with a unique address.

Mhz - Megahertz, speed at which the processor runs at. Also measured in hertz, gigahertz, etc.

Operating System (OS) - The User interface between the User and calculator

Processor - A large computer chip that does most of the work in a computer or calculator.  The processor in the TI-83 is the Zilog Z80 chip.

Program - A program is a list of instructions written in sequential order for the processor to execute.

QBasic - QBasic stands for "Quick Beginners All-Pupose Symbolic Instruction code". It's easy to learn and use, but is very much out-dated.

RAM - Random Acess Memory

Register - A register is a piece of high-speed memory located directly on the processor. It is used to store data while the processor manipulates it.  On the TI-83,

there are 14 registers.

ROM - Read Only Memory

TI - Texas Instruments

TI-Basic - TI-83/+ programming Language, mainly compilation of common Basic commands and Calculator commands

Visual Basic - Visual Basic is much like QBasic, only for windows. Visual Basic is kind of Object oriented, the programs use a "window" format.

z80 - Zilog's z80 CPU introduced more than 25 years ago.

This help file has been produced using helpMATIC Pro V1.22 Shareware

http://members.aol.com/harbsg/

The above message will not appear in the registered version


Tutorial 5

Assembling Asm Programs

Overview

You will learn the steps to assembling Asm programs using TASM.

Backround Information

TASM stands for Telemark Cross Assembler. The TASM assembler assembles for the Intel 8080 processor. What!? But we're assembling for Zilog's Z80 processor! Don't worry =) When the Z80 was developed by Zilog (A renegade group of Intel engineers), it was highly based off of the Intel 8080. In fact. they are cross compatible! That's why we're using TASM to assemble our programs.

Checklist for Assembling

- Is the program written in z80 Asm?

- Does the program have a .z80 file extension?

- Have you self checked it for errors?

- Have you had a friend (or me) check it?

- Have you properly installed all the software?

- Have you backed up your calculator?

Once this checklist is completed, continue on.

Assembling Programs

Now, copy the program you've written from the "MyPrgms" folder to the "TASMassembler" folder. Next, in the "TASMassembler" folder, make sure if you used any include files that they're in the folder along with the written program. In the "TASMassembler" folder, create a new text file called "Start.bat". You may edit this file later by right clicking on it and clicking on edit. In the "start.bat" file type in asm progname. Where progname  is the name of the program you've written. Do not include the .z80 extension when typing in the name. Now save it and close the file. Now, to start assembling the program, click on the "start.bat" file. If all goes well, the assembler should have outputted a .hex file. If it did go on. If the assembler gave you an error message, click here to try to debug it.

Sending and Running

Open the progname.hex file in the "TASMassembler" folder. Select the entire contents of the file and copy it. Then open the TI-Graph Link program and type in AsmPrgm in the new program editing area on the right.  Paste the contents of the .hex file there. Give it a name and send it to RAM. Make sure if you're using a Graph Link, that the link is securely connected to one of the computers COM ports. Then, on the calculator, press [2nd] + [Catalog] . Then scroll down to Asm (. Hit enter to paste it to the home screen. Then hit [Prgm] then select your program. Hit Enter. The home screen should look like this:

Asm ( prgmprogname

Hit enter to execute the command. Your Asm program is now running! What if it Crashes?

If you don't have a Graph Link, create a new program on the TI-83 Plus. Paste the AsmPrgm token in the program. Then you'll have to hand copy each charater from the .hex file to the calculator.

Compiling

To compile your program, paste the AsmComp( token from the catalog. Then paste the program you want to complile to the screen, then hit the , button. Then, from the catalog, paste the Prgm token to the screen. Then type in a name up to 8 characters long. It cannot be the same as the program you are compiling. Your calc screen should look like this:

AsmComp(prgmprogname, prgmprogname2

Hit enter and your program has now been compiled. You can run the program the same way as the program before you compiled it.

Tutorial 6

This help file has been produced using helpMATIC Pro V1.22 Shareware

http://members.aol.com/harbsg/

The above message will not appear in the registered version


TASM Errors

Errors TASM will give you

The Errors

These are errors I have encountered using TASM and the methods I used to correct them. When debugging a program, look in the <progname>.1st file that should have been outputted in the "TASMassembler" folder when you assembled the program. This file is a log of TASM assembling your program. If there was an error in your program, TASM will give the error message again where it ocurred in your program. This file is the key to debugging your programs.

 Unused data in MS byte of argument.

You tried to load a number value to a instead of hl or there is an unidentified label in your program. If there is an unidentified label in your program, this error will be preceded with a "Label not found" error. So make sure the label is there and check the spelling. If you loaded a number value into a instead of hl, change it because hl is a 16 bit register, so it will probably work.

unrecognized instruction.

You probably mispelled one of the z80 instructions. Find the mispelled z80 instruction (Not ROM call, this error does not apply to ROM calls) and correct it's spelling.

 Label not found: <LABEL>

Numerous things could of happened to generate this error.

A. You mispelled a label	Solution - Fix Spelling

B. You mispelled a ROM call(s)	Solution - Fix Spelling

C. You mispelled a ROM call(s) when defining them	Solution - Fix Spelling

D. You didn't include the label	Solution - Include it!

That was easy to fix:)

 Duplicate label.

I wonder how you solve this one? Hmm... I know. Maybe you have two of the same labels. Rename one of the labels something else.

 Label value misaligned.

Line up the program a little bit better or fix the duplicate label error if you got one.

tasm: source file open error on <filename>

This means either you spelled the name of the program you are assembling, or TASM couldn't open an include file (If you used one). A good way to fix this is to check the spelling of filenames where ever you used them.

 unrecognized token.

It took me 2 days to fix this one! When it happened to me, I mispelled a z80 instruction, Label, ROM call, or the macro that calls the ROM call. So double check your spelling.

 Maximum number of args exceeded.

You put too many arguments in a specified .db statement. Spread them out into multiple .db statements.

unrecognized argument.

You probably put in an argument where one isn't accepted. Try loading the value into a different register. Sorry I can't offer more help on this error, it has never happened to me (yet).

Range of relative branch exceeded.

Strange, this one's never happened to me either. Well I found the solution in James Matthew's ASMguru! He says "All that means is that you loaded a jp statement instead of a jr." Try it!

Unbalanced Conditional

I recieved this error when including an include file into my program. I don't know how I fixed the problem, it just seemed to vanish...??? If you know how to fix it please tell me.

This help file has been produced using helpMATIC Pro V1.22 Shareware

http://members.aol.com/harbsg/

The above message will not appear in the registered version


A ROM call is a system routine predefined in the calculators memory. The bcall( macro easily calls them to a program.

This help file has been produced using helpMATIC Pro V1.22 Shareware

http://members.aol.com/harbsg/

The above message will not appear in the registered version


Tutorial 7

Displaying Text

Overview

This tutorial will show you how to make a program that will display normal and inverse (white on black) text.

Programming

The program below will display normal text on the home screen. The program uses the calls we have already learned, and adds some new ones. In a future tutorial, we will make a program that displays small text.

#define B_CALL(xxxx)	rst 28h \ .dw xxxx

#define B_JUMP(xxxx)	call 50h \ .dw xxxx

_clrlcdfull	=4540h	;The calls we will be using are defined here or use an include file

_homeup	=4558h

_puts	=450Ah

CURCOL	=800Dh

CURROW	=800Ch

.org 9D95h

B_CALL(_clrlcdfull)	;Clear the screen

B_CALL(_homeup) 	;Bring on the home screen

ld	a,0	;Load "a" register as zero

ld	(CURCOL),a	;Load zero into the y coordinate

ld	(CURROW),a	;Load zero into the x coordinate

ld	hl,txtLabel	;Load text from label below

B_CALL(_puts)	;Put text on screen

B_CALL(_clrlcdfull)	;Clear screen

ret	;Return to OS

txtLabel:	;the "Label" can be replaced with any name you want as long as you change the one on the top

.db	"This Program    "

.db	"displays text      "

.db	"on the home     "

.db	"screen. It can   "

.db	"be up to 16 char"

.db	"long, it     can  "

.db	"only be 8 lines  "

.db	"long.	          ",0

.end

END

New Commands Used

(CURCOL) - the y coordinate of the cursor

(CURROW) - the x coordinate of the cursor

_puts - Puts the text on the screen. This command will bring the specefied text to the screen.

_getkey - Detects a key press on the key pad

ld - z80 instruction fo loading something. In this program, it loads 0 (zero) to the "a" register. The syntax is - ld (register), (value#)

Registers

The calculator's memory is where nearly all data is stored.  Unfortunately, memory access is relatively slow for the processor.  So, when we want the processor to manipulate data, like add two numbers together, we don't want to do it in the memory.  Instead, we load the data into special fast memory locations inside the processor itself called registers. In the normal text displaying program (above), the value "0" was saved into the "a" register. The value in the register was then in turn, loaded in to CURCOL and CURROW (the X and Y coordinates of the text). Registers are extremely important! If you don't understand them, I recommend that you read tutorial 4 in Andy S.' tutorials.

Inverse Text

Jeez, things just keep getting better. Inverse text is normal font text (white) on a black backround. This program will display the text "TI-83 Plus Asm" in inverse text. All you need to know to display inverse text is loading text coordinates and setting textinverse mode.

#define bcall(xxxx)	rst 28h \ .dw xxxx

#define bjump(xxxx)	call 50h \ .dw xxxx

_clrlcdf	=4540h

_homeup	=4558h

_puts	=450Ah

CURCOL	=800Dh

CURROW	=800Ch

textinverse	=3	;See the new commands section for more information

textflags	=5

.org 9D95h

bcall(_clrlcdf)

bcall(_homeup)

set	textInverse,(iy+textflags)	;Sets the textinverse mode

ld	a,0	;Load 0 to the "a" register

ld	(CURCOL),a	;Setting Y coordinates

ld	a,0	;Loading 0 to the "a" register

ld	(CURROW),a	;Setting X coordinates

ld	hl,txtTIAsm	;Display text from the TIAsm label

bcall(_puts)	;Put text on screen

res	textInverse,(iy+textflags)	;Resets the text inverse

ret	;Return to OS

txtTIAsm:

.db	" TI-83 Plus Asm ",0	;Text to be displayed on screen

.end

END

New Commands Used

set - z80 instruction that sets the characteristics of the TI

res - z80 instruction which will reset the characteristic

textinverse - Inverse text mode of the TI

textflags - You don't need to know this yet

Tutorial 8

This help file has been produced using helpMATIC Pro V1.22 Shareware

http://members.aol.com/harbsg/

The above message will not appear in the registered version


To exchange Asm programs between a TI-83 and TI-83 Plus, some manual editing (porting) must be done. The ROM calls and memory addresses are slightly different. To learn how to Port Asm programs between the two calculators, see the Porting section.

This help file has been produced using helpMATIC Pro V1.22 Shareware

http://members.aol.com/harbsg/

The above message will not appear in the registered version


Tutorial 8

Using Getkey to Detect Key presses

Overview

This will show you how to use the _getkey ROM call

What is _Getkey?

_Getkey is a ROM call similar to it's TI-Basic counterpart command, getkey. Getkey waits for a key press from the key pad. Then, depending on what you want to do, getkey can display the key code of the key pressed, execute another command, or act like a program pause.

Programming

This program will use _getkey as a program pause.

#define B_CALL(xxxx)	rst 28h \ .dw xxxx

#define B_JUMP(xxxx)	call 50h \ .dw xxxx

_clrlcdfull	=4540h	;The ususal constants and defines, look at the New Commands section for more information

_homeup	=4558h

_getkey	=4972h

.org	9D95h

B_CALL(_homeup)	;Call up home screen

B_CALL(_getkey)	;Pause until next key press

B_CALL(_clrlcdfull)	;After key press, clear screen. Or you can use any other clear screen command (Tutorial 3)

ret	;Return to being a good old calculator

.end

END

New Commands

_getkey - Detect key press, store key code if nessasary

Programming

We will make our own program that displays the Hex key code of the key pressed.The code for the program is here. It looks complicated, but it really isn't. I'll comment the program along the way so you don't get lost. An important concept is the "stack". The stack holds numbers for future use or reference. In this program, it holds the hex code of each key pressed.

#define B_CALL(xxxx)	rst 28h \ .dw xxxx

#define B_JUMP(xxxx)	call 50h \ .dw xxxx

_clrlcdf	=4540h	;The ususal constants and defines, look at the New Commands section for more information

_homeup	=4558h

_puts	=450Ah

_putc	=4504h

_getkey	=4972h

_newline	=452Eh

.org	9D95h

B_CALL(_clrlcdf)	; clear screen

B_CALL(_homeup)	; home the cursor

ld	hl,txt1	; Display the message at the txt1 label

B_CALL(_puts)

B_CALL(_getkey)	; Detect key press

push	af	; Save key press in register a

B_CALL(_clrlcdf)	; clear screen again

B_CALL(_homeup)	; home again

ld	hl,txt2	; Display msg2

B_CALL(_puts)	; Display text

pop	af	; restore reg a

call	dishex	; Follow commands at label dishex to find hex key code

B_CALL(_getkey)	; pause until next key press

B_CALL(_newline)	; Move cursor to next line

ret	;Return to TI-OS

dishex:	push	af	; keep copy of value

and	0F0h	; terminate lower nibble

rra	; shift nibble right 4

rra

rra

rra

ld	l,a	; Display the Key's hex code in Str1

ld	h,0

ld	de,hexStr

push	de	; keep for other nibbler

add	hl,de	; add offset to hexStr address

ld	a,(hl)	; find correct ASCII character from string below to display hex code of key pressed.

bcall(_putc)	; display character

pop	de

pop	af

and	0Fh	; wipeout upper nibble

ld	l,a

ld	h,0

add	hl,de

ld	a,(hl)

bcall(_putc)

ret	; Return to OS

hexStr 	.db	"0123456789ABCDEF"	;These are the characters used to display the key's hex code

txt1	.db	"Push a key.",0

txt2	.db	"Key code: ",0

.end

END

New Commands

_putc - Display character and advance cursor

push - Pushes a number on to the stack.

pop - Takes a number off the stack.

call - This looks like the TI-83 macro, and serves almost the same purpose, only for the TI-83 Plus, it jumps the program to a specified label.

Conclusion

This program wasn't exactly "lightning fast". That's because the _Getkey command was scanning the entire key pad for a key press. Later on, we will make a program like this one, only we'll narrow down the area in which _Getkey looks in for a keypress, making it faster.

Tutorial 9

This help file has been produced using helpMATIC Pro V1.22 Shareware

http://members.aol.com/harbsg/

The above message will not appear in the registered version


Tutorial 10

The Run Indicator

Overview

What is a Run Indicator? Funny you should ask... The Run Indicator is the marker in the upper right corner of the calclulator's display that comes up when the calculator's CPU is busy doing something. Sort of like the light that flashes when your computer's busy. This tutorial will show you how to turn the Run Indicator on and off.

Programming

Let's take the Getkey program that displays the keycode of a key press program (Tutorial 8). When the program is waiting for a key press, it displays a Run Indicator in the corner of the screen. Isn't that thing annoying? Simple solution is to get rid of it.

#define B_CALL(xxxx)	rst 28h \ .dw xxxx

#define B_JUMP(xxxx)	call 50h \ .dw xxxx

_clrlcdfull	=4540h	;The ususal constants and defines, look at the New Commands section for more information

_homeup	=4558h

_puts	=450Ah

_putc	=4504h

_getkey	=4972h

_newline	=452Eh

_RunIndicOff	=4570h

.org	9D95h

B_CALL(_clrlcdfull)	; clear screen

B_CALL(_homeup)	; home the cursor

B_CALL(_RunIndicOff)	; Turning off the Run Indicator

ld	hl,txt1	; Display the message at the txt1 label

B_CALL(_puts)

B_CALL(_getkey)	; Detect key press

push	af	; Save key press in register a

B_CALL(_clrlcdfull)	; clear screen again

B_CALL(_homeup)	; home again

ld	hl,txt2	; Display msg2

B_CALL(_puts)	; Display text

pop	af	; restore reg a

call	dishex	; Follow commands at label dishex to find hex key code

B_CALL(_getkey)	; pause until next key press

B_CALL(_newline)	; Move cursor to next line

ret	;Return to TI-OS

dishex:	push	af	; keep copy of value

and	0F0h	; terminate lower nibble

rra	; shift nibble right 4

rra

rra

rra

ld	l,a	; Display the Key's hex code in Str1

ld	h,0

ld	de,hexStr

push	de	; keep for other nibbler

add	hl,de	; add offset to hexStr address

ld	a,(hl)	; find correct ASCII character from string below to display hex code of key pressed.

B_CALL(_putc)	; display character

pop	de

pop	af

and	0Fh	; wipeout upper nibble

ld	l,a

ld	h,0

add	hl,de

ld	a,(hl)

B_CALL(_putc)

B_CALL(clrlcdfull)

ret	; Return to OS

hexStr 	.db	"0123456789ABCDEF"	;These are the characters used to display the key's hex code

txt1	.db	"Push a key.",0

txt2	.db	"Key code: ",0

.end

END

New Commands

_RunIndicOff - Disables the Run Indicator

Related Commands

There is a ROM call that does exactly the opposite of the _RunIndicOff call, it is _RunIndicOn ( RunIndicOn  =  456Dh). To use it, place it at the end of a program to turn the Indicator back on, or put in in the front of the program to make sure it is on.

Tutorial 11

This help file has been produced using helpMATIC Pro V1.22 Shareware

http://members.aol.com/harbsg/

The above message will not appear in the registered version


Tutorial 2

Key Differences - TI-83 vs. TI-83 Plus vs. Z80 Asm

Overview (Part 1)

In this tutorial, you should learn the key differences between programming for the TI-83 and TI-83 Plus and the Z80 CPU.

Compare and Contrast

Over all, programming in Asm for both calculators is not all that different. In fact, most TI-83 Asm Programs will work on the TI-83 Plus, and vice versa (With some porting of course). The TI-83 Plus was designed with applications in mind. So to utilize that function, some changes in it's Asm programming were made. You should know what the differences are when programming the TI-83 Plus in Asm after reading this tutorial.

•	The TI-83 Plus uses the B_Call() macro for ROM calls instead of the regular call macro.

•	Asm	programs (Not Applications) written in Asm are limited to 8K in size.

•	Most (Some) TI-83 Asm programs will run on the TI-83 Plus provided that a few minor changes be done. They require that the original source code be re-assembled for the specific memory addresses for the TI-83 Plus.

ex. TI-83 ROM call:	ex. TI-83 ROM call address:

call _clrLCDFull	_clrLCDFull	=4755h

ex. TI-83 Plus ROM call:	ex. TI-83 Plus ROM call address:

B_CALL(_clrLCDFull)	_clrLCDFull	=4540h

Conclusion (Part 1)

TI-83 Plus programs only need to slightly changed to run on the TI-83, and vice versa. But since the TI-83 Plus has more SafeRAM areas, TI-83 Plus programs using these SafeRAM areas may not be run on a TI-83.

Overview (Part 2)

There are differences between programming in Asm for the TI-83/+ and Z80. They are explained here.

Compare and Contrast

First off, the ROM calls used in TI-83/+ are unique only to the TI. That's because the ROM calls were developed by TI (not Zilog) for use with only the TI-83/+ calculator and stored in the TI's memory. So don't use these ROM calls on the a lone Z80 (it's OK to use them on the TI-83/+ Z80). Z80 instructions however, are compatible between the two because the instructions can be used on all Z80 CPU's.

Conclusion (Part 2)

That's about it between Z80 Asm and TI-83/+ Asm. Just the ROM calls. Now that you know these differences, you can gather the right information for each and incorporate them into your own programs. You can also look in the Z80 Instructional References section for more information.

Tutorial 3

This help file has been produced using helpMATIC Pro V1.22 Shareware

http://members.aol.com/harbsg/

The above message will not appear in the registered version


Tutorial 9

Using a Program to turn off the calculator

Overview

This program will turn off the calculator. WOW!

Programming

The code is simple, it dosn't even include any ROM calls! Follow along now.

#define B_CALL(xxxx)	rst 28h \ .dw xxxx

#define B_JUMP(xxxx)	call 50h \ .dw xxxx

.org 9D95h

DI	; disable interrupts

        LD A,001H	; Loading 0 to "a" register

        OUT (003H),A	; turn off screen

EI	;enabling intterupts

        RET

.end

END

New Commands Used

DI - z80 Instruction that Disables Interrupts

EI - z80 Instruction that Enables Interrupts

Conclusion

What's to explain?

Tutorial 10

This help file has been produced using helpMATIC Pro V1.22 Shareware

http://members.aol.com/harbsg/

The above message will not appear in the registered version


QBasic stands for "Quick Beginners All-Pupose Symbolic Instruction code". It's easy to learn and use, but is very much out-dated.

This help file has been produced using helpMATIC Pro V1.22 Shareware

http://members.aol.com/harbsg/

The above message will not appear in the registered version


Visual Basic is much like QBasic, only for windows. Visual Basic is kind of Object oriented, the programs use a "window" format.

This help file has been produced using helpMATIC Pro V1.22 Shareware

http://members.aol.com/harbsg/

The above message will not appear in the registered version


Tutorial 6

Moving the cursor to the next line

Overview

This is a seemingly worthless but none the less important tutorial on moving the cursor to the next line.

The Source Code

This code will move the cursor to the new line.

#define B_CALL(xxxx)	rst 28h \ .dw xxxx

#define B_JUMP(xxxx)	call 50h \ .dw xxxx

_homeup	=4558h

_newline	=452Eh

_clrlcdfull	=4540h

.org 9D95h

B_CALL(_clrlcdfull)

B_CALL(_homeup)	;Call up the home screen

B_CALL(_newline)	;Move cursor to next line

ret	;Return home

.end

END

Explanation

The screen should look like this after you run the program:

As you can see, there is an empty line on the top of the screen followed by a "Done" message and the blinking cursor on the next line. If it weren't for the "Done" message, the cursor would have been on the preceding line. The point is, the cursor isn't on the "First line". But rather on the next "empty" one.

New Commands

_newline - sets the cursor on the next "empty" line.

Related Commands

Did you know there is actually a ROM call that displays the "Done" message on the screen? Well that call is _DispDone (_DispDone = 45B5h). Try it out.

Tutorial 7

This help file has been produced using helpMATIC Pro V1.22 Shareware

http://members.aol.com/harbsg/

The above message will not appear in the registered version


What! You don't know what a cursor is? It's the flashing thing you see on the screen that shows the position of where you are typing. I hope that cleared things up.

This help file has been produced using helpMATIC Pro V1.22 Shareware

http://members.aol.com/harbsg/

The above message will not appear in the registered version


Z80 is an 8-bit microprocessor from Zilog, a company founded by former Intel engineers. The Z80 has a 16-bit address bus, yielding 64 kilobytes of addressable memory, and an 8-bit data bus. A descendant of the Intel 8080, it was the favorite processor in the days of the CP/M operating system.

This help file has been produced using helpMATIC Pro V1.22 Shareware

http://members.aol.com/harbsg/

The above message will not appear in the registered version


Texas Instruments Incorporated, manufacturer and developer of high-tech electronic components, based in Dallas, Texas. Engineers at Texas Instruments have produced several major advancements in the electronics field, including the silicon transistor, the integrated circuit, and the microprocessor. Texas Instruments products include computer chips, devices for semiconductors, digital signal processors for cellular phones and computer multimedia applications, digital micromirror device technology for high-definition television, and control units for weapons systems.

Texas Instruments began as Geophysical Service, a Texas oil exploration company founded in 1930 by J. Clarence Karcher and Eugene McDermott. Geophysical Service pioneered the use of sound-wave technology to locate oil deposits. During World War II (1939-1945) the company's research and equipment laboratories began working on electronic equipment for military use. After the war electronics manufacturing became the company's major activity, and in 1951 a reorganization resulted in the name change to Texas Instruments.

In 1954 the company developed the first commercial transistor made from silicon. The silicon transistor was significantly less expensive and more reliable than previous transistors made from germanium. In that same year the company marketed the world's first small, portable transistor radio, the Regency Radio. In 1958 Texas Instruments engineer Jack Kilby invented the integrated circuit, which greatly increased the capabilities of electronic equipment. Texas Instruments and other companies used the integrated circuit in such products as calculators, computers, televisions, and stereo equipment. In 1975 Texas Instruments produced the world's first inexpensive digital watch. In 1979 it began producing personal computers.

Despite Texas Instrument's many landmark inventions, it had difficulty fighting off low-cost Asian competition. By 1983 the company was out of the home computer and digital watch businesses. In that same year Texas Instruments reported its first operating loss ever, amounting to $145 million.

In 1985 Jerry R. Junkins took over as president and chief executive officer and revived the company's fortunes. In 1989 a Japanese court upheld a patent for Kilby's integrated circuit. As a result, a number of major Japanese corporations that used the integrated circuit to make electronic products were ordered to pay royalties to Texas Instruments, boosting the company's income by many millions of dollars over several years. In the late 1980s and early 1990s the company entered into a number of strategic partnerships to produce custom-designed electronic components for Sun Microsystems, Inc., Sony Corporation, General Motors Corporation, and Sweden's LM Ericsson Telephone Company. Junkins died suddenly in 1996 and was replaced by Thomas Engibous.

Taken from MS Encarta Encyclopedia 98

This help file has been produced using helpMATIC Pro V1.22 Shareware

http://members.aol.com/harbsg/

The above message will not appear in the registered version


COM is the device name for communications. A name reserved by the MS-DOS operating system for up to four serial communications ports named COM1, COM2, COM3, and COM4. (The latter two appear only in MS-DOS versions 3.3 and later.) Thus, if a modem is connected to one serial port and a serial printer to another, the devices are identified as COM1 and COM2 by the operating system.

This help file has been produced using helpMATIC Pro V1.22 Shareware

http://members.aol.com/harbsg/

The above message will not appear in the registered version


ASCII is the acronym for American Standard Code for Information Interchange. In computing, a coding scheme that assigns numeric values to letters, numbers, punctuation marks, and certain other characters. By standardizing the values used for these characters, ASCII enables computers and computer programs to exchange information.

ASCII provides for 256 codes divided into two sets—standard and extended—of 128 each. These sets represent the total possible combinations of either 7 or 8 bits, the latter being the number of bits in 1 byte. The basic, or standard, ASCII set uses 7 bits for each code, yielding 128 character codes from 0 through 127 (hexadecimal 00H through 7FH). The extended ASCII set uses 8 bits for each code, yielding an additional 128 codes numbered 128 through 255 (hexadecimal 80H through FFH).

This help file has been produced using helpMATIC Pro V1.22 Shareware

http://members.aol.com/harbsg/

The above message will not appear in the registered version


To create a new folder open My Computer or Windows Explorer, click on FILE (On the menu bar), then on NEW. Select FOLDER and then give it a name. Or, right click on the screen, select NEW, then FOLDER.

This help file has been produced using helpMATIC Pro V1.22 Shareware

http://members.aol.com/harbsg/

The above message will not appear in the registered version


Oh my G_d! My calculator froze on me! Don't worry, this should be pretty routine, so get used to it. A simple solution is to take a battery out and then put it back in. This will clear your RAM (That's what backing up your calculator is for). If it is a more serious crash, take out all the batteries, including the lithium CR 1616 back-up battery. Now turn your calculator on (This will  also clear your memory). If your calclulator still dosn't turn on, take out ALL the batteries, and leave your calculator on the table to sit a while (1-24 hrs.) to let the memory "calm" down. Chances are, your program did something in the memory the calculator didn't like, so it crashed. Let me just tell you, IT IS VIRTUALLY IMPOSSIBLE TO PERMANENTLY MESS UP YOUR CALCULATOR! So don't worry about it, just give it time. If your calculator dosn't turn back on within 24 hours, call Texas Instruments at 1-800-TICARES. Just a reminder, I'm not responsible for any damage (if any) that happens to your calculator. The source code of the programs in my tutorials have been tested and debugged numerous times. They shouldn't cause any problems unless they have been tampered with.

This help file has been produced using helpMATIC Pro V1.22 Shareware

http://members.aol.com/harbsg/

The above message will not appear in the registered version


An include file is a file with predefined ROM calls in it. Using an include file in your program may save you time. Though an improperly made include file may cause more trouble than nessasary. Read Tutorial 20 for information on how tho use an Include file. Learn how to use them in tutorial 20.

This help file has been produced using helpMATIC Pro V1.22 Shareware

http://members.aol.com/harbsg/

The above message will not appear in the registered version


An Emulator is a program that simulates something. For example, Virtual TI simulates almost every TI calculator. Provided that you copy the ROM from your calculator to the computer (Follow the instructions in the program).

This help file has been produced using helpMATIC Pro V1.22 Shareware

http://members.aol.com/harbsg/

The above message will not appear in the registered version


Credentials

Credit where deserved:)

            I'd like to thank several people for helping me understand Asm, for without them, this TI-83 Plus Asm tutorial would never have been poosible. First and foremost, I'd like to thank Robert Senser for helping me understand z80 Asm. I came across a TI-83 Plus website of his one day while looking for Asm documents on the Web. He had several Asm program's on the website. He seemed very knowledgable about z80 Asm. I gave him an e-mail showing my interest in Asm. Before I knew it, I was asking questions left and right. He willingly answered them and thus I started learning Asm. If it were not for him, the only programming language I would be able to program on a TI would be TI-Basic. Thanks Robert!

Next in line for credit is Jeff Meister. He gave me the moral support for making this help file. Not to mention giving me food at lunch... He's the person who edited this help file for mistakes. And luckily for me, he found a few "dumb" ones. Thanks again!

Now I'd like to thank You for reading this help file. If it wern't for you guys, why would I be even making this help file=) If you think this tutorial was good, let me know. I'm making another help file (version 3.01). This version will continue off and add on more advanced tutorials, not to mention fix bugs.

Special thanks to David Brigada for finding an equate error in tutorial 14. If you want to know what happened, I defined B_CALL twice when one of them was supposed to be B_JUMP! Thanks again!

Finally, I'd like to thank this darn help file creator program for actually working. If you havn't figured out what program I've been using yet, I'm giving you 24 hours to find out...

This help file has been produced using helpMATIC Pro V1.22 Shareware

http://members.aol.com/harbsg/

The above message will not appear in the registered version


Tutorial 11

Drawing a line on the Graph Screen

Overview

This tutorial will show how to display a line on the graph. Compare the speed of an Asm program graphing the line to a TI-Basic program doing the same thing. You'll be surprised!

Programming

Follow along now, this is definetly not hard:)

#define B_CALL(xxxx)	rst 28h \ .dw xxxx

#define B_JUMP(xxxx)	call 50h \ .dw xxxx

_op1set3	=41a1h

_vertcmd	=48a9h

.org	9D95h

B_CALL(_op1set3)	; Opl1 = 3

B_CALL(_vertcmd)	; Draw vertical line at Y = 3

ret

.end

END

As you can see, the line was drawn lighting quick, almost in a blink of an eye. That's the power, advantage, and speed of Asm! Op1-Op6 are floating point variables. It's called "OP1 to OP6" because it is used as 6 registers each 11 bytes in size.  Therefore when you read documentation that refers to OP1, OP2, OP3, OP4, OP5 or OP6, what is meant is the 11-byte "register". The size of each of these registers is driven by the fact that the TI-83 Plus has a floating point number format of 9 bytes and any var name also can be formatted into at most 9 bytes.  The 10th and 11th byte in each register is used during floating point math execution.  Floating-point number and variable formats are explained in another section.  Understanding the use of this area of RAM will expand your ability to use TI-83 system routines.

New Commands

op1set - Set op1 = 3

_vertcmd - Graph verticle line

Conclusion

We will get into more in depth graphing in v.2.01. This tutorial was meant to introduce you to graphing.

Tutorial 12

This help file has been produced using helpMATIC Pro V1.22 Shareware

http://members.aol.com/harbsg/

The above message will not appear in the registered version


References
z80 References

Table of Contents

This is the Table of Contents for the z80 instructional references. These will be extremely useful in getting to know the z80 processor.

References

z80 Hardware Reference - References to the z80 registers and memory areas

z80 Instruction Set Summary(1) - A simple summary of the a80 Instruction Set

z80 Instruction Set Summary(2) - Another well written Instruction Summary set

z80 Optimizations - Ways to optimize your programs

Z80 Insructions (Complete) - Complete Set of Z80 Instructions

This help file has been produced using helpMATIC Pro V1.22 Shareware

http://members.aol.com/harbsg/

The above message will not appear in the registered version


z80 Hardware Reference

Written by Magnus Hagander

Z80 Hardware Reference

This file contains information on how to program the Z80 microprocessor.

---------------------------------------------------------------------------

Contents

   * Registers

   * Addressing methods

   * Flags

   * Symbol descriptions

   * Instructions

---------------------------------------------------------------------------

Registers

The following registers are available:

A,B,C,D,E            8-bit registers

AF                   16-bit register containing A and flags

BC                   16-bit register containing B and C

DE                   16-bit register containing D and E

HL                   16-bit register used for addressing

F                    8-bit Flag register

I                    8-bit Interrupt Page address register

IX,IY                16-bit index registers

PC                   16-bit Program Counter register

R                    8-bit Memory Refresh register

SP                   16-bit Stack Pointer register

---------------------------------------------------------------------------

Addressing methods

The following addressing methods are available:

Mnemonic        Description

n               Immediate addressing (8-bit)

nn              Immediate extending addressing (16-bit)

e               Relative addressing (8-bit; PC=PC+2+offset)

[nn]            Extended addressing (16-bit)

[xx+d]          Indexed addressing (16-bit + 8-bit)

r               Register addressing (8-bit)

[rr]            Register indirect addressing (16-bit)

b               Bit addressing

p               Modified page 0 addressing

---------------------------------------------------------------------------

Flags

The following flags are available:

S               Sign flag (bit 7)

Z               Zero flag (bit 6)

H               Half Carry flag (bit 4)

P               Parity/Overflow flag (bit 2)

N               Add/Subtract flag (bit 1)

C               Carry flag (bit 0)

---------------------------------------------------------------------------

Symbol descriptions

Here is a short description of the symbols that are used in the instruction

list:

b               One bit (0 to 7)

cc              Condition (C,M,NC,NZ,P,PE,PO,Z)

d               One-byte expression (-128 to +127)

dst             Destination s, ss, [BC], [DE], [HL], [nn]

e               One-byte expression (-126 to +129)

m               Any register r, [HL] or [xx+d]

n               One-byte expression (0 to 255)

nn              Two-byte expression (0 to 65535)

pp              Register pair BC, DE, IX or SP

qq              Register pair AF, BC, DE or HL

qq'             Alternative register pair AF, BC, DE or HL

r               Register A, B, C, D, E, H or L

rr              Register pair BC, DE, IY or SP

s               Any register r, value n, [HL] or [xx+d]

src             Source s, ss, [BC], [DE], [HL], nn, [nn]

ss              Register pair BC, DE, HL or SP

xx              Index register IX or IY

---------------------------------------------------------------------------

Instructions

The flag field contains one of the following:

-               Flag unaffected

*               Flag affected

0               Flag reset

1               Flag set

?               Unknown

The following instructions are available:

Mnemonic    Flags   Description           Notes

            SZHPNC

ADC A,s     ***V0*  Add with Carry        A=A+s+CY

ADC HL,ss   **?V0*  Add with Carry        HL=HL+ss+CY

ADD A,s     ***V0*  Add                   A=A+s

ADD HL,ss   --?-0*  Add                   HL=HL+ss

ADD IX,pp   --?-0*  Add                   IX=IX+pp

ADD IY,rr   --?-0*  Add                   IY=IY+rr

AND s       ***P00  Logical AND           A=A&s

BIT b,m     ?*1?0-  Test Bit              m&{2^b}

CALL cc,nn  ------  Conditional Call      If cc CALL

CALL nn     ------  Unconditional Call    -[SP]=PC,PC=nn

CCF         --?-0*  Complement Carry Flag CY=~CY

CP s        ***V1*  Compare               A-s

CPD         ****1-  Compare and Decrement A-[HL],HL=HL-1,BC=BC-1

CPDR        ****1-  Compare, Dec., Repeat CPD till A=[HL]or BC=0

CPI         ****1-  Compare and Increment A-[HL],HL=HL+1,BC=BC-1

CPIR        ****1-  Compare, Inc., Repeat CPI till A=[HL]or BC=0

CPL         --1-1-  Complement            A=~A

DAA         ***P-*  Decimal Adjust Acc.   A=BCD format

DEC s       ***V1-  Decrement             s=s-1

DEC xx      ------  Decrement             xx=xx-1

DEC ss      ------  Decrement             ss=ss-1

DI          ------  Disable Interrupts

DJNZ e      ------  Dec., Jump Non-Zero   B=B-1 till B=0

EI          ------  Enable Interrupts

EX [SP],HL  ------  Exchange              [SP]<->HL

EX [SP],xx  ------  Exchange              [SP]<->xx

EX AF,AF'   ------  Exchange              AF<->AF'

EX DE,HL    ------  Exchange              DE<->HL

EXX         ------  Exchange              qq<->qq'   (except AF)

HALT        ------  Halt

IM n        ------  Interrupt Mode                     (n=0,1,2)

IN A,[n]    ------  Input                 A=[n]

IN r,[C]    ***P0-  Input                 r=[C]

INC r       ***V0-  Increment             r=r+1

INC [HL]    ***V0-  Increment             [HL]=[HL]+1

INC xx      ------  Increment             xx=xx+1

INC [xx+d]  ***V0-  Increment             [xx+d]=[xx+d]+1

INC ss      ------  Increment             ss=ss+1

IND         ?*??1-  Input and Decrement   [HL]=[C],HL=HL-1,B=B-1

INDR        ?1??1-  Input, Dec., Repeat   IND till B=0

INI         ?*??1-  Input and Increment   [HL]=[C],HL=HL+1,B=B-1

INIR        ?1??1-  Input, Inc., Repeat   INI till B=0

JP [HL]     ------  Unconditional Jump    PC=[HL]

JP [xx]     ------  Unconditional Jump    PC=[xx]

JP nn       ------  Unconditional Jump    PC=nn

JP cc,nn    ------  Conditional Jump      If cc JP

JR e        ------  Unconditional Jump    PC=PC+e

JR cc,e     ------  Conditional Jump      If cc JR(cc=C,NC,NZ,Z)

LD dst,src  ------  Load                  dst=src

LD A,i      **0*0-  Load                  A=i            (i=I,R)

LDD         --0*0-  Load and Decrement    [DE]=[HL],HL=HL-1,#

LDDR        --000-  Load, Dec., Repeat    LDD till BC=0

LDI         --0*0-  Load and Increment    [DE]=[HL],HL=HL+1,#

LDIR        --000-  Load, Inc., Repeat    LDI till BC=0

NEG         ***V1*  Negate                A=-A

NOP         ------  No Operation

OR s        ***P00  Logical inclusive OR  A=Avs

OTDR        ?1??1-  Output, Dec., Repeat  OUTD till B=0

OTIR        ?1??1-  Output, Inc., Repeat  OUTI till B=0

OUT [C],r   ------  Output                [C]=r

OUT [n],A   ------  Output                [n]=A

OUTD        ?*??1-  Output and Decrement  [C]=[HL],HL=HL-1,B=B-1

OUTI        ?*??1-  Output and Increment  [C]=[HL],HL=HL+1,B=B-1

POP xx      ------  Pop                   xx=[SP]+

POP qq      ------  Pop                   qq=[SP]+

PUSH xx     ------  Push                  -[SP]=xx

PUSH qq     ------  Push                  -[SP]=qq

RES b,m     ------  Reset bit             m=m&{~2^b}

RET         ------  Return                PC=[SP]+

RET cc      ------  Conditional Return    If cc RET

RETI        ------  Return from Interrupt PC=[SP]+

RETN        ------  Return from NMI       PC=[SP]+

RL m        **0P0*  Rotate Left           m={CY,m}<-

RLA         --0-0*  Rotate Left Acc.      A={CY,A}<-

RLC m       **0P0*  Rotate Left Circular  m=m<-

RLCA        --0-0*  Rotate Left Circular  A=A<-

RLD         **0P0-  Rotate Left 4 bits    {A,[HL]}={A,[HL]}<- ##

RR m        **0P0*  Rotate Right          m=->{CY,m}

RRA         --0-0*  Rotate Right Acc.     A=->{CY,A}

RRC m       **0P0*  Rotate Right Circular m=->m

RRCA        --0-0*  Rotate Right Circular A=->A

RRD         **0P0-  Rotate Right 4 bits   {A,[HL]}=->{A,[HL]} ##

RST p       ------  Restart                (p=0H,8H,10H,...,38H)

SBC A,s     ***V1*  Subtract with Carry   A=A-s-CY

SBC HL,ss   **?V1*  Subtract with Carry   HL=HL-ss-CY

SCF         --0-01  Set Carry Flag        CY=1

SET b,m     ------  Set bit               m=mv{2^b}

SLA m       **0P0*  Shift Left Arithmetic m=m*2

SRA m       **0P0*  Shift Right Arith.    m=m/2

SRL m       **0P0*  Shift Right Logical   m=->{0,m,CY}

SUB s       ***V1*  Subtract              A=A-s

XOR s       ***P00  Logical Exclusive OR  A=Axs

---------------------------------------------------------------------------

That's all there is for this time. If you have any comments, questions or

just a wish to contribute with a program or some information, please e-mail

me, Magnus Hagander (mha@ticalc.org).

Last updated: 95-03-04, 15:30.

This help file has been produced using helpMATIC Pro V1.22 Shareware

http://members.aol.com/harbsg/

The above message will not appear in the registered version


Web Links
Internet Links

Calculator sites

These are Internet sites that contain great information about z80 assembly programming and news about TI calculators

www.ticalc.org

www.calc.org

www.geocities.com/SiliconValley/Peaks/3938/

www.geocities.com/SiliconValley/Mouse/2260/

www.TI.com/Calc

www.zilog.com

This help file has been produced using helpMATIC Pro V1.22 Shareware

http://members.aol.com/harbsg/

The above message will not appear in the registered version


z80 Instruction Set Summary(2)
z80 Instruction Set Summary

Written by Jonathan Bowen

       ----------------------------------------------------------------

       |                                                              |

       |                                                              |

       |                            Zilog                             |

       |                                                              |

       |                 ZZZZZZZ    88888      000                    |

       |                      Z    8     8    0   0                   |

       |                     Z     8     8   0   0 0                  |

       |                    Z       88888    0  0  0                  |

       |                   Z       8     8   0 0   0                  |

       |                  Z        8     8    0   0                   |

       |                 ZZZZZZZ    88888      000                    |

       |                                                              |

       |          Z80 MICROPROCESSOR Instruction Set Summary          |

       |                                                              |

       |                                                              |

       |Written by     Jonathan Bowen                                 |

       |               Programming Research Group                     |

       |               Oxford University Computing Laboratory         |

       |               8-11 Keble Road                                |

       |               Oxford OX1 3QD                                 |

       |               England                                        |

       |                                                              |

       |               Tel +44-865-273840                             |

       |                                                              |

       |Created        August 1981                                    |

       |Updated        April 1985                                     |

       |Modified       by Robert Taylor on 27/12/95 for compatibilty  |

       |               with TASM                                      |

       |Issue          1.3                Copyright (C) J.P.Bowen 1985|

       ----------------------------------------------------------------

       ----------------------------------------------------------------

       |Mnemonic  |SZHPNC|Description          |Notes                 |

       |----------+------+---------------------+----------------------|

       |ADC A,s   |***V0*|Add with Carry       |A=A+s+CY              |

       |ADC HL,ss |**?V0*|Add with Carry       |HL=HL+ss+CY           |

       |ADD A,s   |***V0*|Add                  |A=A+s                 |

       |ADD HL,ss |--?-0*|Add                  |HL=HL+ss              |

       |ADD IX,pp |--?-0*|Add                  |IX=IX+pp              |

       |ADD IY,rr |--?-0*|Add                  |IY=IY+rr              |

       |AND s     |***P00|Logical AND          |A=A&s                 |

       |BIT b,m   |?*1?0-|Test Bit             |m&{2^b}               |

       |CALL cc,nn|------|Conditional Call     |If cc CALL            |

       |CALL nn   |------|Unconditional Call   |-(SP)=PC,PC=nn        |

       |CCF       |--?-0*|Complement Carry Flag|CY=~CY                |

       |CP s      |***V1*|Compare              |A-s                   |

       |CPD       |****1-|Compare and Decrement|A-(HL),HL=HL-1,BC=BC-1|

       |CPDR      |****1-|Compare, Dec., Repeat|CPD till A=(HL)or BC=0|

       |CPI       |****1-|Compare and Increment|A-(HL),HL=HL+1,BC=BC-1|

       |CPIR      |****1-|Compare, Inc., Repeat|CPI till A=(HL)or BC=0|

       |CPL       |--1-1-|Complement           |A=~A                  |

       |DAA       |***P-*|Decimal Adjust Acc.  |A=BCD format          |

       |DEC s     |***V1-|Decrement            |s=s-1                 |

       |DEC xx    |------|Decrement            |xx=xx-1               |

       |DEC ss    |------|Decrement            |ss=ss-1               |

       |DI        |------|Disable Interrupts   |                      |

       |DJNZ e    |------|Dec., Jump Non-Zero  |B=B-1 till B=0        |

       |EI        |------|Enable Interrupts    |                      |

       |EX (SP),HL|------|Exchange             |(SP)<->HL             |

       |EX (SP),xx|------|Exchange             |(SP)<->xx             |

       |EX AF,AF' |------|Exchange             |AF<->AF'              |

       |EX DE,HL  |------|Exchange             |DE<->HL               |

       |EXX       |------|Exchange             |qq<->qq'   (except AF)|

       |HALT      |------|Halt                 |                      |

       |IM n      |------|Interrupt Mode       |             (n=0,1,2)|

       |IN A,(n)  |------|Input                |A=(n)                 |

       |IN r,(C)  |***P0-|Input                |r=(C)                 |

       |INC r     |***V0-|Increment            |r=r+1                 |

       |INC (HL)  |***V0-|Increment            |(HL)=(HL)+1           |

       |INC xx    |------|Increment            |xx=xx+1               |

       |INC (xx+d)|***V0-|Increment            |(xx+d)=(xx+d)+1       |

       |INC ss    |------|Increment            |ss=ss+1               |

       |IND       |?*??1-|Input and Decrement  |(HL)=(C),HL=HL-1,B=B-1|

       |INDR      |?1??1-|Input, Dec., Repeat  |IND till B=0          |

       |INI       |?*??1-|Input and Increment  |(HL)=(C),HL=HL+1,B=B-1|

       |INIR      |?1??1-|Input, Inc., Repeat  |INI till B=0          |

       |JP (HL)   |------|Unconditional Jump   |PC=(HL)               |

       |JP (xx)   |------|Unconditional Jump   |PC=(xx)               |

       |JP nn     |------|Unconditional Jump   |PC=nn                 |

       |JP cc,nn  |------|Conditional Jump     |If cc JP              |

       |JR e      |------|Unconditional Jump   |PC=PC+e               |

       |JR cc,e   |------|Conditional Jump     |If cc JR(cc=C,NC,NZ,Z)|

       |LD dst,src|------|Load                 |dst=src               |

       |LD A,i    |**0*0-|Load                 |A=i            (i=I,R)|

       |LDD       |--0*0-|Load and Decrement   |(DE)=(HL),HL=HL-1,#   |

       |LDDR      |--000-|Load, Dec., Repeat   |LDD till BC=0         |

       |LDI       |--0*0-|Load and Increment   |(DE)=(HL),HL=HL+1,#   |

       |LDIR      |--000-|Load, Inc., Repeat   |LDI till BC=0         |

       |NEG       |***V1*|Negate               |A=-A                  |

       |NOP       |------|No Operation         |                      |

       |OR s      |***P00|Logical inclusive OR |A=Avs                 |

       |OTDR      |?1??1-|Output, Dec., Repeat |OUTD till B=0         |

       |OTIR      |?1??1-|Output, Inc., Repeat |OUTI till B=0         |

       |OUT (C),r |------|Output               |(C)=r                 |

       |OUT (n),A |------|Output               |(n)=A                 |

       |OUTD      |?*??1-|Output and Decrement |(C)=(HL),HL=HL-1,B=B-1|

       |OUTI      |?*??1-|Output and Increment |(C)=(HL),HL=HL+1,B=B-1|

       |POP xx    |------|Pop                  |xx=(SP)+              |

       |POP qq    |------|Pop                  |qq=(SP)+              |

       |PUSH xx   |------|Push                 |-(SP)=xx              |

       |PUSH qq   |------|Push                 |-(SP)=qq              |

       |RES b,m   |------|Reset bit            |m=m&{~2^b}            |

       |RET       |------|Return               |PC=(SP)+              |

       |RET cc    |------|Conditional Return   |If cc RET             |

       |RETI      |------|Return from Interrupt|PC=(SP)+              |

       |RETN      |------|Return from NMI      |PC=(SP)+              |

       |RL m      |**0P0*|Rotate Left          |m={CY,m}<-            |

       |RLA       |--0-0*|Rotate Left Acc.     |A={CY,A}<-            |

       |RLC m     |**0P0*|Rotate Left Circular |m=m<-                 |

       |RLCA      |--0-0*|Rotate Left Circular |A=A<-                 |

       ----------------------------------------------------------------

       ----------------------------------------------------------------

       |Mnemonic  |SZHPNC|Description          |Notes                 |

       |----------+------+---------------------+----------------------|

       |RLD       |**0P0-|Rotate Left 4 bits   |{A,(HL)}={A,(HL)}<- ##|

       |RR m      |**0P0*|Rotate Right         |m=->{CY,m}            |

       |RRA       |--0-0*|Rotate Right Acc.    |A=->{CY,A}            |

       |RRC m     |**0P0*|Rotate Right Circular|m=->m                 |

       |RRCA      |--0-0*|Rotate Right Circular|A=->A                 |

       |RRD       |**0P0-|Rotate Right 4 bits  |{A,(HL)}=->{A,(HL)} ##|

       |RST p     |------|Restart              | (p=0H,8H,10H,...,38H)|

       |SBC A,s   |***V1*|Subtract with Carry  |A=A-s-CY              |

       |SBC HL,ss |**?V1*|Subtract with Carry  |HL=HL-ss-CY           |

       |SCF       |--0-01|Set Carry Flag       |CY=1                  |

       |SET b,m   |------|Set bit              |m=mv{2^b}             |

       |SLA m     |**0P0*|Shift Left Arithmetic|m=m*2                 |

       |SRA m     |**0P0*|Shift Right Arith.   |m=m/2                 |

       |SRL m     |**0P0*|Shift Right Logical  |m=->{0,m,CY}          |

       |SUB s     |***V1*|Subtract             |A=A-s                 |

       |XOR s     |***P00|Logical Exclusive OR |A=Axs                 |

       |----------+------+--------------------------------------------|

       | F        |-*01? |Flag unaffected/affected/reset/set/unknown  |

       | S        |S     |Sign flag (Bit 7)                           |

       | Z        | Z    |Zero flag (Bit 6)                           |

       | HC       |  H   |Half Carry flag (Bit 4)                     |

       | P/V      |   P  |Parity/Overflow flag (Bit 2, V=overflow)    |

       | N        |    N |Add/Subtract flag (Bit 1)                   |

       | CY       |     C|Carry flag (Bit 0)                          |

       |-----------------+--------------------------------------------|

       | n               |Immediate addressing                        |

       | nn              |Immediate extended addressing               |

       | e               |Relative addressing (PC=PC+2+offset)        |

       | (nn)            |Extended addressing                         |

       | (xx+d)          |Indexed addressing                          |

       | r               |Register addressing                         |

       | (rr)            |Register indirect addressing                |

       |                 |Implied addressing                          |

       | b               |Bit addressing                              |

       | p               |Modified page zero addressing (see RST)     |

       |-----------------+--------------------------------------------|

       |DEFB n(,...)     |Define Byte(s)                              |

       |DEFB 'str'(,...) |Define Byte ASCII string(s)                 |

       |DEFS nn          |Define Storage Block                        |

       |DEFW nn(,...)    |Define Word(s)                              |

       |-----------------+--------------------------------------------|

       | A  B  C  D  E   |Registers (8-bit)                           |

       | AF  BC  DE  HL  |Register pairs (16-bit)                     |

       | F               |Flag register (8-bit)                       |

       | I               |Interrupt page address register (8-bit)     |

       | IX IY           |Index registers (16-bit)                    |

       | PC              |Program Counter register (16-bit)           |

       | R               |Memory Refresh register                     |

       | SP              |Stack Pointer register (16-bit)             |

       |-----------------+--------------------------------------------|

       | b               |One bit (0 to 7)                            |

       | cc              |Condition (C,M,NC,NZ,P,PE,PO,Z)             |

       | d               |One-byte expression (-128 to +127)          |

       | dst             |Destination s, ss, (BC), (DE), (HL), (nn)   |

       | e               |One-byte expression (-126 to +129)          |

       | m               |Any register r, (HL) or (xx+d)              |

       | n               |One-byte expression (0 to 255)              |

       | nn              |Two-byte expression (0 to 65535)            |

       | pp              |Register pair BC, DE, IX or SP              |

       | qq              |Register pair AF, BC, DE or HL              |

       | qq'             |Alternative register pair AF, BC, DE or HL  |

       | r               |Register A, B, C, D, E, H or L              |

       | rr              |Register pair BC, DE, IY or SP              |

       | s               |Any register r, value n, (HL) or (xx+d)     |

       | src             |Source s, ss, (BC), (DE), (HL), nn, (nn)    |

       | ss              |Register pair BC, DE, HL or SP              |

       | xx              |Index register IX or IY                     |

       |-----------------+--------------------------------------------|

       | +  -  *  /  ^   |Add/subtract/multiply/divide/exponent       |

       | &  ~  v  x      |Logical AND/NOT/inclusive OR/exclusive OR   |

       | <-  ->          |Rotate left/right                           |

       | ( )             |Indirect addressing                         |

       | ( )+  -( )      |Indirect addressing auto-increment/decrement|

       | { }             |Combination of operands                     |

       | #               |Also BC=BC-1,DE=DE-1                        |

       | ##              |Only lower 4 bits of accumulator A used     |

       ----------------------------------------------------------------

This help file has been produced using helpMATIC Pro V1.22 Shareware

http://members.aol.com/harbsg/

The above message will not appear in the registered version


z80 Optimizations

Written by Chris?

Optimization Techniques on the TiCalc's Z80

Optimization on the Z80 reminds me of the old days on the 8088 family processors.  It was cruel, but a good programmer could get the most of it with a few optimization techniques.  The purpose of this text is to enhance your Z80 optimization skills so that you CAN put all the nice effects you wish to add into your game/application/etc.

BUS, just about the worst transportation method…

The BUS in the chips can be seen as a lazy way to make the circuitry of a chip!  The idea is to use the BUS as a bias from the memory to the registers and to load the operands/opcode.  It's kind'a like a highway =).  So if you want to load something from memory, you load it in the bus and the second step consists of loading it from the bus to the register.  Honestly, it's purpose is to put less wires/logical doors so that it costs less, since it would really look bad having a 4Meg without BUS <lol>.  Anyways, you'll see that if you catch yourself a book on the inner circuitry of computers ;).

For optimization purposes, you may consider the BUS as an intermediaire register (getting the information from one location to the other).  The Z80 has to fetch every instructions it executes.  Having a 8bit bus, means it takes it a total of 4cycles to get one single byte in a queue to be processed.  Fortunately, the fetching process can be done at the same time as an execution occurs.  But the problem comes around when you have a 4cycle instruction which is more then 1 bytes for example on an empty queu.

Suppose the instruction ld a, 1 that instruction is 2 bytes in length and takes 7 cycles according to 	Zilog,  7 cycles?  Not quite, since the instruction is 2 bytes it requires 2x4 cycles to fetch the 	instruction which means you're down to 8 cycles.

Figure 1.1

Now suppose the next string of instruction

ld  	a, 4

push 	af

It takes 8 cycles to load the first command as we've seen and then it takes a total of 11 cycles to do the push since the push is only 4bytes long.  There's plenty of time to fetch the instruction.  Since there's more instruction time then fetching time, the fetching process will still continue and fetch the following instruction after the 4th cycle.  So in all, this set of command takes 11 + 8 = 19 cycles when the prefetch queue is empty.  Consider the case where we reverse the operation.  We do the push first and then the load.  In such a case, we use 11 cycles to run the push and only 7 cycles for the load.  That's 18 in total.

So did Zilog screw-up when counting their instruction speeds?  Not at all, as you can see, if the prefetch queue is empty, then you're going to have to count knowing that 4cycles are needed for the fetch.  If the prefetch is not empty, then considering that all the bytes needed for the instruction has been loaded, you can count Zilog's cycles.

There's also another BUS effect which you have to take under consideration…  Consider the case "ld  a, (hl)".  This command uses 1 bytes in length, and according to Zilog uses 7cycles.  But because of our good friend the data BUS, it actually takes 8 cycles.  The reason is the following, it takes 4 cycles to prefetch the instruction like we saw, but it also takes 4 cycles to access the memory in (hl) [BUS].  So in total you're counting 8 cycles.  Of course if you already have the instruction in the queue.  Then you're really looking at 7cycles as usual.

So basically the moral in here is not to go with cycle counting.  Cause that's not going to give you a good overview of the speed of the program at all.  There's much more things that affect the performance of a program not counting the BUS itself.  To really know the speed of a program you're always better off making a counter for it and use that.  Atlease it will give you a true relative speed comparison.  Last notes on the prefetch queue.  Note that as soon as you jump somewhere, you will empty your queue.

Self Modifying Code

A Chameleon is a very intriguing animal.  It's rather well known for changing colors all depending on it's environment.  It's actually one of it's defense system.  If you look from a distance and it hides, you'll notice the Chameleon will adapt very well to his environment color-wise.  Take that same chameleon and place it in another colorful environment and you'll see it changing once again to match the background.  Self modifying code does just about the same thing but of course you have to program to possibilities it can behave into.  This is a very nice technique and can do wonders to a program if it's well applied.  But there's also a bad trap in this one if the programmer isn't fully knowledgefull about it.

Let's take case number 1.  You're out of registers and you need something to store a value into and most programmer's choice at this point is to make a typical variable.  But although this is an acceptable method, if you are referencing that value many times, then you're reducing the speed of your code.  The solution?  Use the variable intertwined with your code so that you only need to store the value therefore accessing the indirect memory once instead twice, (Saving and Retrieving).  How can we do that?  Suppose the following piece of code

ld 	(VarName), a

;(Do some stuff)

ld  	a, (VarName)

Instead, you would reduce the last instruction by making it a direct memory load as in

ld (Patch1 + 1), a

;(Do some stuff)

Patch1:	ld  a, 12h

Note that the value12h doesn't affect anything.  Whatever you put in there won't affect anything since it's being written over.  Also note that this technique uses less cycles then push/pop.

Now suppose another case : where you have 2 functions, the first one erases the screen from top to bottom and the second one erases from bottom to top.

Start:ld	a, (hl)

; (Do some math on "a")

ld	(bc), a

Patch1:

inc	hl

inc	bc

dec	d

jr	nz, Start

The only thing you have to do is to patch the word value "0323h" at Patch1 to increment and patch the word value "0B2Bh" to decrement.  You may obtain theses values from the .TAB file you use to compile you assembler Z80 files.  Here if the math on a is very long, you get to save quite a bundle of bytes in size.

You have to make sure that whatever you modified isn't currently in the prefetch queue.  Or else that means the changes simply won't seem to have applied.  There's a great potential for this technique.

Math VS Tables

A few days back, I was working on the init screen of a small game.  I wanted a horizontal line which would alternate colors every 3pixels.  Since the Z80 has 1 bit representing one pixel, it's not an easy task.  I had a nice long formula which worked very well, but it had a good deal of shifts and such commands.  The final version of it was actually a simple 3byte string which was dumped to the screen.  It only used copying commands and didn't require math at all.  Needless to say there's no equation which will do that in 3bytes.  So in that case, using tables to lookup the graphic was the best idea.  That whole idea of doing that pattern was also an optimization by itself since the whole screen was using patterns, by removing the 1K image and replacing it by math, I was able to reduce the size from 1K down to 0.3K which is quite an improvement on the size's side.  (This game is the Bomb screen Init : BTW)

So when you come upon a piece of graphic you have to do.  Make sure you think really well if it's preferable to use an equation, a simple table or a combination of both like what I had up there.  You can calculate a table in a program if you find that taking less space then storing it directly.

Unrolled Loops

In the old times, there used to be sailors competition.  There were many types of them, but the one I'm most interested into is the one about the weight carrying one.  For this competition, the sailor had a cart full of heavy things which were all sailing related.  There were some heavy anchors, chains, wood pieces and much more.  The winner was the one who could move every object from the cart to the second one using the less time possible.  The first one, took one object at a time and carried it to the other cart very fast and did a good time.  The second sailor took 2 objects at a time, therefore reducing his walking time, but also reducing his walking speed since the weight was much more considerable.  The last one, also the winner for the fastest time, had taken every object on his back and walked at a turtle's speed, but didn't have to come back at all to the first cart.

This is exactly the effect of an unrolled loop.  The idea is that you take your typical "FOR/DO/WHILE" loop and split it so that you do more then one of the same thing in it, but reducing the number of iterations.  This will increase the size of your code obviously, but it will also speed it up.  Here's why.  Consider the speed of a jump.  It's around 10/12 cycles.  And now that of a comparison which is about 4cycles.  Suppose you do that loop 100 times, that means you're wasting about 16cycles per iteration therefore 1600cycles for the whole loop.  That's a great amount.  If you would copy/paste the internal loop only once, you'd need about 50iterations instead.  Then you cut your looping cycling speed by about half.  Which is 800cycles.  If your loop is small enough, you can ever consider unrolling the whole loop which means you don't even need to do a check at all.

ld   b, 100d

Loop:	add  hl, de

djnz Loop	; We're wasting about 13*100 = 1300cycles

Ld   b, 50d

Loop:	add  hl, de

add  hl, de

djnz Loop	; Here we're using 13*50 = 750cycles

Smart direct RAM usage

A few years ago, the PC's didn't have much RAM and the conventional memory's minimum requirements for a game was really hi for some games.  Back in DOS, we could only access Half a meg directly.  Some games would request as huge amounts as 620K to run.  That means you only had 20K to load your drivers.  It was really hard to squeeze in everything.  That's the point where most people though that Bill Gate's famous sentence "640K should be enough for everyone" wasn't so true.  And look who's using 25times that amount for an OS eh? =)  But anyhow, while the PC was more and more checked out, some ingenious people were able to find some free holes in the memory which could be used to run programs.  Such holes were the Black text mode address (B000-B7FF), and depending on your PC, other holes were also available.  Intel, Lotus and Microsoft also developed a program called "HIMEM.SYS" which could make the memory accessible to DOS.  They also found leek where you could use the first part of the your RAM as conventional by using non-standard addressing calls.  Also know as HMA.

I don't have to go all the way to make you see where I'm heading.  The calculator has holes also.  Not every parts of it are used and must be kept.  There's many holes you can use as temporary variables and you should seek to know where they are if needed.  For starters, at address $4000, there is a nice 16K which is reserved for the ROM.  This Flipping page is used by the calculator to accomplish all the ROM calls you're making.  If you're not using any ROM calls in your code, why not make good use of this space.  Just make sure you load the page back when you're down with it.  You can get the current page by using the command "in a, (5)".  Also following that buffer, at $8000 is another 16K buffer reserved for RAM flipping.  SO if you're accessing anything outside your direct memory, it flips there and can get read.  Again, if you're not using that space and most programs really don't need to use it, then use it yourself for sprites or such data.

The biggest problem is probably How can you get external data into that RAM page for you to use.  Well, the concept is a bit tricky but it does work pretty well once done.  First, get the full 3bytes address of your variable via the VAT.  Check other references for that.  Once you have the address, calculate what page that data is at.  It's a really simple calculation "Page = (Address / 16K) - 3".  Make sure you load that page into the ROM area ($4000) and also, load the next page into area ($8000).  So that if your data is within the 16K boundary, then it will still be there!  No, what you're probably interested into is to free up the ROM page and have only the data you need in the RAM page.  To do that, you'll have to get the starting address which you can get by the formula (Address AND (16K-1)).  Then copy that buffer to $8000.  But you have to copy it starting from the end to the beginning since if you do it like you usually do from beginning to end, you might overwrite a portion of the data you need in >= $8000.  So all that said, here's the code to do just that : (Assuming ex points to the data itself)

in   a, (5)

ex   af, af'

ld   a, (ix + 2)

ld   l, (ix + 1)

sla  l

rla

sla  l

rla	; a = Data Page (This is AHL/16K)

add  a, %01000000 - 3	; Access the RAM page - 3

out  (5), a	; Show it in $4000

inc  a

out  (6), a	; The Data is between $4000 and $C000

ld   bc, Length

ld   a, (ix + 1)

and  %00111111

ld   h, a

ld   l, (ix)

ld   de, $4000 + 1 + Length

add  hl, de

ld   de, $BFFF

lddr	; Store data into RAM swap page $8000

ex   af, af'

out  (5), a	; Give back the ROM page

Note here that we're actually copying the data so that it ends at $BFFF.  There's no needs for that to be there, it's just a personal preference!

For the ones doing Grayscale, you may also use the holes in the system to use that as one of the virtual screens.  There's also a nice hole at $CA00.  This one is commonly used by Grayscale programmers.  Since it has a nice screen-length buffer free.  For temporary variables, you may also want to check at $C100.  There's a wealth of space all around the calculator, check in your .INC/.H files and see what addresses aren't in use, try to see if they don't affect anything, if not, then you can use them =)  After all, the most we're getting out of this calculator, the better it is.  Also you might want to check if you can use places where you don't use or need the variables/ROM calls.  Just make sure that you give back it's values after if they're important at all for the calculator to work well.

BTW : The holes explained up here are onoly conform to the TI-86 (Maybe some others aswell?)

Branched Jump Size Optimization

This technique will really serve to the coders who optimize speed to the MAX.  The idea is simple, you may save 1byte if you use a "jr" instead of a "jp".  Suppose the case where you wish to jump to an address which has a Delta > 127.  In other words, a "jp" instruction seems to be the only option here!  Not quite.  If somewhere in your code, you have a jump which goes to where you want, you simply need to jump to the jump.  Now that might sound a tad cryptic at first, but here's an example.  Although, be aware that this method, really doesn't optimize for speed, since it requires 2 jumps or more in order to get to your desried position.

Start:

; Some core goes here!

Jp1:  jr  Start

; Lots of Code goes here

Jp2:  jr  Jp1

; Lots more code lies in here (There's more then 127bytes between Jp2

; and Start so instead, we'll jump to Jp1 which will in turn, jump to

; Start.  We're saving one byte here!

  jr  Jp2

Working on 16bit registers might mean 8bit

This is a trick many car repairshops could use.  When you go to see them and they found a problem with your alternator for example, they usually change the whole block.  While instead, they could try to isolate exactly what's wrong within the alternator and change that part only.  Of crouse, they're up for cash and timesaving, but we're here to make our games better, faster so we'll use the techniques to change only what we need to change and not the extra.

Many times, you operate on a 16bit register.  Maybe you're addressing some place in memory?  You're using an incremental function.  That's 6cycles!  You could increment only the lower part if you were sure that by incrementing, you wouldn't hit a 256bytes boundary.  That would mean 4cycles.  If you place your data using a well though of manner in memory, you should be able to make sure that you don't overlap such a boundary and therefore use a 8bit increment.  Another case for this is the addition.  Sometimes you have multiple layers to fixup and you want to update both (Grayscale for example).  So you need to write your byte at (hl) and then you need to write your byte at (hl + Page2 – Page1).  Of course most coders would use "add  hl, bc"  where b would contain the delta of  the page.  A smarter, leaner way to do this is to only increment "h" leaving "l" as is.  So basically, you only need a "add  h, N" instruction which is 7[8]cycles instead of something near 21[23]cycles for loading the delta and adding it.  And BTW, you also get to free up the temporary addition register =).  But here again, you must make sure that your pages end in a boundary of 256bytes within memory.

Afterwards

Well, that's pretty much all the optimization techniques I can think of for now.  There's undoubtfully much more then what I've written here, but that'll be the discussion of another piece of writing later on.  I haven't written the obvious optimization either.  Those like "xor a instead of ld  a,0", since I assume they're obvious and not really for advanced/intermediate programmers =).  In other words I assume you already know theses things.

Liked this tut, want more, have suggestions?  Fixes, bugs in the code, anything?  Write to me : Ti_chris@yahoo.com

This help file has been produced using helpMATIC Pro V1.22 Shareware

http://members.aol.com/harbsg/

The above message will not appear in the registered version


z80 Instruction Set Summary(1)
z80 Instruction set

By ???

Z80 Instruction set summary

 Table A-3. Z80 Mnemonics and Operations in Alphabetical Order

+------------+--------------------+------+---+---+----------------------+

|Mnemonic    |Operation           |CZPSNH|Len|Tim|Comments              |

+------------+--------------------+------+---+---+----------------------+

|ADC A,r     |A:=A+r+CY           |**V*0*| 1 | 4 | r - A,B,C,D,E,H,L    |

|ADC A,(HL)  |A:=A+(HL)+CY        |      | 1 | 7 |                      |

|ADC A,n     |A:=A+n+CY           |      | 2 | 7 | n - byte (0..FF)     |

|ADC A,(ii+n)|A:=A+(ii+n)+CY      |      | 3 |19 |ii - IX,IY            |

|ADC HL,rr   |HL:=HL+rr+CY        |**V*0x| 2 |15 |rr - BC,DE,HL,SP      |

+------------+--------------------+------+---+---+----------------------+

|ADD A,r     |A:=A+r              |**V*0*| 1 | 4 |                      |

|ADD A,(HL)  |A:=A+(HL)           |      | 1 | 7 |                      |

|ADD A,n     |A:=A+n              |      | 2 | 7 |                      |

|ADD A,(ii+n)|A:=A+(ii+n)         |      | 3 |19 |                      |

|ADD HL,rr   |HL:=HL+rr           |*...0x| 1 |11 |                      |

|ADD IX,ry   |IX:=IX+px           |      | 2 |15 |ry - BC,DE,SP,IY      |

|ADD IY,rx   |IY:=IY+py           |      | 2 |15 |rx - BC,DE,SP,IX      |

+------------+--------------------+------+---+---+----------------------+

|AND r       |A:=A and r          |0*P*01| 1 | 4 |                      |

|AND (HL)    |A:=A and (HL)       |      | 1 | 7 |                      |

|AND n       |A:=A and n          |      | 2 | 7 |                      |

|AND (ii+n)  |A:=A and (ii+n)     |      | 3 |19 |                      |

+------------+--------------------+------+---+---+----------------------+

|BIT b,r     |Z:=not rb           |.*xx01| 2 | 8 | b - bit number (0..7)|

|BIT b,(HL)  |Z:=not (HL)b        |      | 2 |12 |xb - bit b of         |

|BIT b,(ii+n)|Z:=not (ii+n)b      |      | 4 |20 |          location x  |

+------------+--------------------+------+---+---+----------------------+

|CALL nn     |PUSH PC;PC:=nn      |......| 3 |17 |nn - word (0..FFFF)   |

|CALL cc,nn  |If cc then CALL nn  |      | 3 |17 |cc - C,NC,Z,NZ,M,P,PE,|

|            |      else continue |      |   |10 |                   PO |

+------------+--------------------+------+---+---+----------------------+

|CCF         |CY:=not CY          |*...0x| 1 | 4 |                      |

+------------+--------------------+------+---+---+----------------------+

|CP r        |A-r                 |**V*1*| 1 | 4 |                      |

|CP (HL)     |A-(HL)              |      | 1 | 7 |                      |

|CP n        |A-n                 |      | 2 | 7 |                      |

|CP (ii+n)   |A-(ii+n)            |      | 3 |19 |                      |

+------------+--------------------+------+---+---+----------------------+

|CPD         |A-(HL);dec HL;dec BC|.***1*| 2 |16 |PV=0 if BC=0,else PV=1|

+------------+--------------------+------+---+---+----------------------+

|CPDR        |Repeat CPD          |.***1*| 2 |21 |                      |

|            | until Z=1 or BC=0  |      |   |16 |                      |

+------------+--------------------+------+---+---+----------------------+

|CPI         |A-(HL);inc HL;dec BC|.***1*| 2 |16 |PV=0 if BC=0,else PV=1|

+------------+--------------------+------+---+---+----------------------+

|CPIR        |Repeat CPI          |.***1*| 2 |21 |                      |

|            | until Z=1 or BC=0  |      |   |16 |                      |

+------------+--------------------+------+---+---+----------------------+

|CPL         |A:=A xor 255        |....11| 1 | 4 |                      |

+------------+--------------------+------+---+---+----------------------+

|DAA         |Decimal adjust Acc. |**P*.*| 1 | 4 |                      |

+------------+--------------------+------+---+---+----------------------+

|DEC r       |r:=r-1              |.*V*1*| 1 | 4 |                      |

|DEC (HL)    |(HL):=(HL)-1        |      | 1 |11 |                      |

|DEC (ii+n)  |(ii+n):=(ii+n)-1    |      | 3 |23 |                      |

|DEC rr      |rr:=rr-1            |......| 1 | 6 |                      |

|DEC ii      |ii:=ii-1            |      | 2 |10 |                      |

+------------+--------------------+------+---+---+----------------------+

|DI          |IFF:=0              |......| 1 | 4 |                      |

+------------+--------------------+------+---+---+----------------------+

|DJNZ e      |dec B;if B 0 JR e   |......| 2 |13 | e - relative address |

|            |     if B=0 continue|      |   | 8 |                      |

+------------+--------------------+------+---+---+----------------------+

|EI          |IFF:=1              |......| 1 | 4 |                      |

+------------+--------------------+------+---+---+----------------------+

|EX AF,AF'   |AF<->AF'            |......| 1 | 4 |                      |

|EX DE,HL    |DE<->HL             |      | 1 | 4 |                      |

|EX (SP),HL  |(SP)<->HL           |      | 1 | 4 |                      |

|EX (SP),ii  |(SP)<->ii           |      | 2 |23 |                      |

+------------+--------------------+------+---+---+----------------------+

|EXX         |BC<->BC';DE<->DE';  |......| 1 | 4 |                      |

|            |HL<->HL'            |      |   |   |                      |

+------------+--------------------+------+---+---+----------------------+

|HALT        |Halt CPU            |......| 1 | 4 |                      |

+------------+--------------------+------+---+---+----------------------+

|IM 1        |Interrupt mode 1    |......| 2 | 8 |                      |

|IM 2        |Interrupt mode 2    |      |   |   |                      |

|IM 3        |Interrupt mode 3    |      |   |   |                      |

+------------+--------------------+------+---+---+----------------------+

|IN A,(n)    |A:=port(n)          |......| 2 |11 |                      |

|IN r,(C)    |r:=port(C)          |.*P*0*| 2 |12 |                      |

|IN ?,(C)    |only set flags as   |.*P*0*| 2 |12 |can't be entered as a |

|            |   as IN r,(C) does |      |   |   |command;code is ED 70 |

+------------+--------------------+------+---+---+----------------------+

|INC r       |r:=r+1              |.*V*0*| 1 | 4 |                      |

|INC (HL)    |(HL):=(HL)+1        |      | 1 |11 |                      |

|INC (ii+n)  |(ii+n):=(ii+n)+1    |      | 3 |23 |                      |

|INC rr      |rr:=rr+1            |......| 1 | 6 |                      |

|INC ii      |ii:=ii+1            |      | 2 |10 |                      |

+------------+--------------------+------+---+---+----------------------+

|IND         |(HL):=port(C);      |x*xx1x| 2 |16 |Z=1 if B=0,else Z=0   |

|            |dec HL;dec B        |      |   |   |                      |

+------------+--------------------+------+---+---+----------------------+

|INDR        |Repeat IND          |x1xx1x| 2 |21 |                      |

|            | until B=0          |      |   |16 |                      |

+------------+--------------------+------+---+---+----------------------+

|INI         |(HL):=port(C);      |x*xx1x| 2 |16 |Z=1 if B=0,else Z=0   |

|            |inc HL;dec B        |      |   |   |                      |

+------------+--------------------+------+---+---+----------------------+

|INIR        |Repeat INI          |x1xx1x| 2 |21 |                      |

|            | until B=0          |      |   |16 |                      |

+------------+--------------------+------+---+---+----------------------+

|JP nn       |PC:=nn              |......| 3 |10 |                      |

|JP cc,nn    |If cc then JP nn    |......| 3 |10 |                      |

|JP (HL)     |PC:=HL              |      | 1 | 4 |                      |

|JP (ii)     |PC:=ii              |      | 2 | 8 |                      |

+------------+--------------------+------+---+---+----------------------+

|JR e        |PC:=PC+e            |......| 2 |12 |                      |

|JR cond,e   |If cond then JR e   |      | 2 |12 |cond - C,NC,Z,NZ      |

|            |        else NOP    |      |   | 7 |                      |

+------------+--------------------+------+---+---+----------------------+

|LD r,r      |r:=r                |......| 1 | 4 |                      |

|LD r,(HL)   |r:=(HL)             |      | 1 | 7 |                      |

|LD r,n      |r:=n                |      | 2 | 7 |                      |

|LD r,(ii+n) |r:=(ii+n)           |      | 3 |19 |                      |

|LD (HL),r   |(HL):=r             |      | 1 | 7 |                      |

|LD (ii+n),r |(ii+n):=r           |      | 3 |19 |                      |

|LD (HL),n   |(HL):=n             |      | 2 |10 |                      |

|LD (ii+n),n |(ii+n):=n           |      | 4 |19 |                      |

|LD A,(BC)   |A:=(BC)             |      | 1 | 7 |                      |

|LD A,(DE)   |A:=(DE)             |      | 1 | 7 |                      |

|LD A,(nn)   |A:=(nn)             |      | 3 |13 |                      |

|LD (BC),A   |(BC):=A             |      | 1 | 7 |                      |

|LD (DE),A   |(DE):=A             |      | 1 | 7 |                      |

|LD (nn),A   |(nn):=A             |      | 3 |13 |                      |

|LD A,I      |A:=I                |.***00| 2 | 9 |PV=IFF                |

|LD A,R      |A:=R                |      | 2 | 9 |PV=IFF                |

|LD I,A      |I:=A                |......| 2 | 9 |                      |

|LD R,A      |R:=A                |      | 2 | 9 |                      |

|LD rr,nn    |rr:=nn              |      | 3 |10 |                      |

|LD ii,nn    |ii:=nn              |      | 4 |14 |                      |

|LD HL,(nn)  |HL:=(nn)            |      | 3 |16 |                      |

|LD rr,(nn)  |rr:=(nn)            |      | 4 |20 |                      |

|LD ii,(nn)  |ii:=(nn)            |      | 4 |20 |                      |

|LD (nn),HL  |(nn):=HL            |      | 3 |16 |                      |

|LD (nn),rr  |(nn):=rr            |      | 4 |20 |                      |

|LD (nn),ii  |(nn):=ii            |      | 4 |20 |                      |

|LD SP,HL    |SP:=HL              |      | 1 | 6 |                      |

|LD SP,ii    |SP:=ii              |      | 1 |10 |                      |

+------------+--------------------+------+---+---+----------------------+

|LDD         |(DE):=(HL);         |..*.00| 2 |16 |PV=0 if BC=0,else PV=1|

|            |dec DE,HL,BC        |      |   |   |                      |

+------------+--------------------+------+---+---+----------------------+

|LDDR        |Repeat LDD          |..0.00| 2 |21 |                      |

|            | until Z=1 or BC=0  |      |   |16 |                      |

+------------+--------------------+------+---+---+----------------------+

|LDI         |(DE):=(HL);         |..*.00| 2 |16 |PV=0 if BC=0,else PV=1|

|            |inc DE,HL;dec BC    |      |   |   |                      |

+------------+--------------------+------+---+---+----------------------+

|LDIR        |Repeat LDI          |..0.00| 2 |21 |                      |

|            | until Z=1 or BC=0  |      |   |16 |                      |

+------------+--------------------+------+---+---+----------------------+

|NEG         |A:=0-A              |**V*1*| 2 | 8 |                      |

+------------+--------------------+------+---+---+----------------------+

|NOP         |No operation        |......| 1 | 4 |                      |

+------------+--------------------+------+---+---+----------------------+

|OR r        |A:=A or r           |0*P*00| 1 | 4 |                      |

|OR (HL)     |A:=A or (HL)        |      | 1 | 7 |                      |

|OR n        |A:=A or n           |      | 2 | 7 |                      |

|OR (ii+n)   |A:=A or (ii+n)      |      | 3 |19 |                      |

+------------+--------------------+------+---+---+----------------------+

|OTDR        |Repeat OUTD         |x1xx1x| 2 |21 |                      |

|            | until B=0          |      |   |16 |                      |

+------------+--------------------+------+---+---+----------------------+

|OTIR        |Repeat OUTI         |x1xx1x| 2 |21 |                      |

|            | until B=0          |      |   |16 |                      |

+------------+--------------------+------+---+---+----------------------+

|OUT (n),A   |port(n):=A          |......| 2 |11 |                      |

|OUT (C),r   |port(C):=r          |      | 2 |12 |                      |

+------------+--------------------+------+---+---+----------------------+

|OUTD        |port(C):=(HL);      |x*xx1x| 2 |16 |Z=1 if B=0,else Z=0   |

|            |dec HL;dec B        |      |   |   |                      |

+------------+--------------------+------+---+---+----------------------+

|OUTI        |port(C):=(HL);      |x*xx1x| 2 |16 |Z=1 if B=0,else Z=0   |

|            |inc HL;dec B        |      |   |   |                      |

+------------+--------------------+------+---+---+----------------------+

|POP qq      |qq:=(SP);SP:=SP+2   |......| 1 |10 |qq - AF,BC,DE,HL      |

|POP ii      |ii:=(SP);SP:=SP+2   |      | 2 |14 |                      |

+------------+--------------------+------+---+---+----------------------+

|PUSH qq     |SP:=SP-2;(SP):=qq   |......| 1 |11 |                      |

|PUSH ii     |SP:=SP-2;(SP):=ii   |      | 2 |15 |                      |

+------------+--------------------+------+---+---+----------------------+

|RES b,r     |rb:=0               |......| 2 | 8 |                      |

|RES b,(HL)  |(HL)b:=0            |      | 2 |15 |                      |

|RES b,(ii+n)|(ii+n)b:=0          |      | 4 |23 |                      |

+------------+--------------------+------+---+---+----------------------+

|RET         |POP PC              |......| 1 |10 |                      |

|RET cc      |If cc then RET      |......| 1 |11 |                      |

|            |      else NOP      |      |   | 5 |                      |

+------------+--------------------+------+---+---+----------------------+

|RETI        |Return from interr. |......| 2 |14 |                      |

+------------+--------------------+------+---+---+----------------------+

|RETN        |Return from NMI     |......| 2 |14 |                      |

+------------+--------------------+------+---+---+----------------------+

|RL r        |+------->------+    |**P*00| 2 | 8 |                      |

|RL (HL)     ||+--+ +-------+|    |      | 2 |15 |                      |

|RL (ii+n)   |++CY+<+7 <-- 0++    |      | 4 |23 |                      |

+------------+ +--+ +-------+     +------+---+---+----------------------+

|RLA         |                    |*...00| 1 | 4 |                      |

+------------+--------------------+------+---+---+----------------------+

|RLC r       |     +---->----+    |**P*00| 2 | 8 |                      |

|RLC (HL)    |+--+ |+-------+|    |      | 2 |15 |                      |

|RLC (ii+n)  ||CY+<++7 <-- 0++    |      | 4 |23 |                      |

+------------++--+  +-------+     +------+---+---+----------------------+

|RLCA        |                    |*...00| 1 | 4 |                      |

+------------+--------------------+------+---+---+----------------------+

|RLD         | A    +---->---+(HL)|.*P*00| 2 |18 |                      |

|            |+---+-+-++---+-+-+  |      |   |   |                      |

|            ||7 4|3 0||7 4|3 0|  |      |   |   |                      |

|            |+---+-+-++++-+-+-+  |      |   |   |                      |

|            |      +-<-++-<-+    |      |   |   |                      |

+------------+--------------------+------+---+---+----------------------+

|RR r        |+------<-------+    |**P*00| 2 | 8 |                      |

|RR (HL)     ||+-------+ +--+|    |      | 2 |15 |                      |

|RR (ii+n)   |++7 --> 0+>+CY++    |      | 4 |23 |                      |

+------------+ +-------+ +--+     +------+---+---+----------------------+

|RRA         |                    |*...00| 1 | 4 |                      |

+------------+--------------------+------+---+---+----------------------+

|RRC r       |+---<-----+         |**P*00| 2 | 8 |                      |

|RRC (HL)    ||+-------+| +--+    |      | 2 |15 |                      |

|RRC (ii+n)  |++7 --> 0++>+CY|    |      | 4 |23 |                      |

+------------+ +-------+  +--+    +------+---+---+----------------------+

|RRCA        |                    |*...00| 1 | 4 |                      |

+------------+--------------------+------+---+---+----------------------+

|RRD         | A    +---<----+(HL)|.*P*00| 2 |18 |                      |

|            |+---+-+-++---+-+-+  |      |   |   |                      |

|            ||7 4|3 0||7 4|3 0|  |      |   |   |                      |

|            |+---+-+-++++-+-+-+  |      |   |   |                      |

|            |      +->-++->-+    |      |   |   |                      |

+------------+--------------------+------+---+---+----------------------+

|RST adr     |CALL adr            |......| 1 |11 |adr - byte (000xxx00b)|

+------------+--------------------+------+---+---+----------------------+

|SBC A,r     |A:=A-r-CY           |**V*1*| 1 | 4 |                      |

|SBC A,(HL)  |A:=A-(HL)-CY        |      | 1 | 7 |                      |

|SBC A,n     |A:=A-n-CY           |      | 2 | 7 |                      |

|SBC A,(ii+n)|A:=A-(ii+n)-CY      |      | 3 |19 |                      |

|SBC HL,rr   |HL:=HL-rr-CY        |**V*1x| 2 |15 |                      |

+------------+--------------------+------+---+---+----------------------+

|SCF         |CY:=1               |1...00| 1 | 4 |                      |

+------------+--------------------+------+---+---+----------------------+

|SET b,r     |rb:=1               |......| 2 | 8 |                      |

|SET b,(HL)  |(HL)b:=1            |      | 2 |15 |                      |

|SET b,(ii+n)|(ii+n)b:=1          |      | 4 |23 |                      |

+------------+--------------------+------+---+---+----------------------+

|SLA r       |+--+ +-------+      |**P*00| 2 | 8 |                      |

|SLA (HL)    ||CY+<+7 <-- 0+<0    |      | 2 |15 |                      |

|SLA (ii+n)  |+--+ +-------+      |      | 4 |23 |                      |

+------------+--------------------+------+---+---+----------------------+

|SRA r       |  +-------+ +--+    |**P*00| 2 | 8 |                      |

|SRA (HL)    |+>+7 --> 0+>+CY|    |      | 2 |15 |                      |

|SRA (ii+n)  |+-+-------+ +--+    |      | 4 |23 |                      |

+------------+--------------------+------+---+---+----------------------+

|SRL r       |   +-------+ +--+   |**P*00| 2 | 8 |                      |

|SRL (HL)    | 0>+7 --> 0+>+CY|   |      | 2 |15 |                      |

|SRL (ii+n)  |   +-------+ +--+   |      | 4 |23 |                      |

+------------+--------------------+------+---+---+----------------------+

|SUB r       |A:=A-r              |**V*0*| 1 | 4 |                      |

|SUB (HL)    |A:=A-(HL)           |      | 1 | 7 |                      |

|SUB n       |A:=A-n              |      | 2 | 7 |                      |

|SUB (ii+n)  |A:=A-(ii+n)         |      | 3 |19 |                      |

+------------+--------------------+------+---+---+----------------------+

|XOR r       |A:=A xor r          |0*P*00| 1 | 4 |                      |

|XOR (HL)    |A:=A xor (HL)       |      | 1 | 7 |                      |

|XOR n       |A:=A xor n          |      | 2 | 7 |                      |

|XOR (ii+n)  |A:=A xor (ii+n)     |      | 3 |19 |                      |

+------------+--------------------+------+---+---+----------------------+

This help file has been produced using helpMATIC Pro V1.22 Shareware

http://members.aol.com/harbsg/

The above message will not appear in the registered version


Ti-calc, a great website for any calculator. It is updated frequently updated and highly organized. If you don't find what you're looking for here, you probably won't find it anywhere else.

This help file has been produced using helpMATIC Pro V1.22 Shareware

http://members.aol.com/harbsg/

The above message will not appear in the registered version


Calc.org, otherwise known as Dimension TI, is home to TCPA. It is like Ti-Calc's sister site. Though not quite as organized. None the less, it is still an exellent site for TI calculator information.

This help file has been produced using helpMATIC Pro V1.22 Shareware

http://members.aol.com/harbsg/

The above message will not appear in the registered version


Tutorial 12

Customizing Asm ROM calls to fit your needs

Overview

When you define a ROM call (ex. _clrlcdf =4540h) you are telling the assembler that every time you call the ROM call using B_CALL(), you want the calculator to go to the certain location in memory (ex. 4540h to clear the screen) and execute the call saved there. For example, let's say you want to clear the screen on the calculator. The adress of the clear screen call is 4540h. So when you define the call (_clrlcdfull), you can name it anything you want as long as you define it to the right location in memory.

Programming

To better understand what I am trying to say, look at the program below:

#define B_CALL(xxxx)	rst 28h \ .dw xxxx

#define B_JUMP(xxxx)	call 50h \ .dw xxxx

clearthescreen	=4540h	;This is the adress for the _clrlcdf call. As you can see, "clearthescreen" is defined to this address. So every time	; you call the "clearthescreen" call, you are actually calling the call stored in the adress 4540h which is _clrlcdfull.

homescreen	=4558h	;Same here. Only the adress 4558h is the _homeup command.

.org	9D95h

B_CALL(clearthescreen)	;calling the _clrlcdf call at 4540h

B_CALL(homescreen)	;calling the _homeup call at 4558h

ret

.end

END

Conclusion

The point is, the name for each call is just a reference to help Humans understand what each call at each address does. You can name any call anything you want as long as you define the address where the call is stored. This tutorial wasn't much about programming. It was meant just to help you better understand TI-83 Plus Asm.

Tutorial 13

This help file has been produced using helpMATIC Pro V1.22 Shareware

http://members.aol.com/harbsg/

The above message will not appear in the registered version


Tutorial 13

Using Virtual TI

Overview

Again, this really isn't much of a Programming tuorial. But the information in this tutorial could save your calculator from crashes. Virtual TI is a TI calculator emulator made by Rusty Wagner. So far, it is the only emulator available that emulates the TI-83 Plus, not to mention about every TI calculator available. The Virtual TI readme below (included with VTI) describes the functions, keypresses, and general information about Virtual TI:

Virtual TI v2.5 beta 4

Written by Rusty Wagner

Requirements

* A Pentium or better running Windows 95 or higher,

  or Windows NT 4.0 or higher

This emulator will run ROMs from the TI-82, TI-83,TI-83 Plus, TI-85, TI-86, TI-89, TI-92, TI-92 II,and/or TI-92 Plus calculators.

A menu containing the functions of the emulator can be obtained by right clicking on the LCD.

Features:

* ROM versions are automatically detected

* Switch between ROM versions without restarting the emulator

* Built-in ROM dumper with automatic error correction

* Archive memory support for TI-89 and TI-92 Plus

* Send files to the calculator

* Receive files from the virtual calculator

* Use a TI Graph-link cable or serial cable to connect to a     real calculator

* Connect two instances of the emulator with a virtual

  link

* Sound emulation

* Save and load the state of the calculator.  Any

  changes to the Flash ROM (i.e. archived variables)

  will be included in the state.

* 4-level and 7-level grayscale support

* Full skinning system with editor

* Resize emulation window to any size

* Screenshot feature which saves to a BMP or to the clipboard

* Option to emulate at either the true speed of the calculator or the fastest the computer can handle.

* The letter keys are aliased to produce their respective letters.  No need to press the Alpha key, just type.

* A full-featured graphical debugger

    * Code disassembly pane.  ROM call addresses are replaced by the name of the ROM function.  DB92 symbol information is also used when available.

    * Code breakpoints.  Does not modify memory, so they are completely transparent.

    * Data breakpoints can be set on a single byte, word, or dword, or a range of addresses.

    * Set a breakpoint on entry to an assembly program automatically.

    * View and change the value of the registers

    * Hexadecimal memory view/edit pane with search capability

    * On the 89/92(+), a handle pane which lists all allocated handles.  Allows user to jump directly to the start of the handle within either the disassembly pane or the memory pane.

    * On the 82-86, a variable pane which lists all variables and their types.  Allows user to jump

      directly to the start of the variable within either the dissassembly pane or the memory pane.

    * Real time updates to the LCD, even with grayscale

    * Log reads/writes to memory or changes to individual bits

Limitations of this beta 4 version:

* 8-level grayscale on the TI-86 doesn't work properly yet

* Key redefinition is not yet implemented, although the program should now work on international keyboards without it

* Receiving of backups from the virtual calculator is not implemented

* Log link port send/receive is not implemented

This emulator requires a ROM image from a real calculator that you own.  I will not send you any ROMs. You can use the built-in ROM dumper to obtain an image from your calculator.

If you already have a ROM dump, place it in the same directory as VTI.EXE (this is done automatically if you use the built-in dumper).  Make sure it has the extension .rom, .bin, or .dmp.  The file name may be anything (the calculator and version number are automatically detected).  Any .tib Flash ROM upgrades

will also be recognized if placed in the same directory as VTI.EXE.  The latest version will be used by default, but you may revert to an earlier version from the

emulation mode dialog.

On the TI-92, these are the PC key equivilents that are not obvious:

F9 - Apps

; - Theta

Tab - Store

Left ctrl - Diamond

Left alt - 2nd

[ - (

] - )

Caps lock - Hand/Lock

` - Mode

\ - Ln

Ins - Sin

Home - Cos

PgUp - Tan

Del - Clear

Scroll lock - On

Num Pad Enter - Enter below cursor pad

On the TI-89:

F6 - Catalog

F9 - Apps

Tab - Store

Left ctrl - Diamond

Left alt - 2nd

[ - (

] - )

Caps lock - Alpha

` - Mode

\ - |

Ins - EE

Del - Clear

Scroll lock - On

On the TI-82 and TI-83:

F1 - Y=

F2 - Window

F3 - Zoom

F4 - Trace

F5 - Graph

Esc - Mode

Caps lock - Alpha

` - X,T,theta

= - Stat

F6 - Math

F7 - Matrx

F8 - Prgm

F9 - Vars

PgDn - Clear

End - x^-1

Insert - sin

Home - cos

PgUp - tan

Num lock - ^

; - x^2

[ - (

] - )

' - log

\ - ln

Tab - Store

Scroll lock - On

On the TI-85 and TI-86:

Esc - Exit

` - More

Caps lock - Alpha

Ctrl - x-var

F6 - Graph

F7 - Table

F8 - Prgm

F9 - Custom

PgDn - Clear

' - log

Insert - sin

Home - cos

PgUp - tan

Num lock - ^

\ - ln

End - EE

[ - (

] - )

; - x^2

Tab - Store

Scroll lock - On

To send a file to the calculator, press F10 or drag and drop from explorer. To enter the debugger, press F11. To bring up the emulation ROM version screen, press F12.

The debugger is for the most part the same as any other graphical debugger.  One thing to note is the color of the lines in the disassembly pane.  Red means

breakpoint, green means current PC, and blue means currently selected.  If a line is in more than one state at the same time, the colors will be combined.

For example, a breakpoint that is selected will combine red and blue, making magenta.  Also, pressing G in either the disassembly or memory pane will allow you

to jump to a specific address.  Registers can be changed by clicking on them.

The source code to the emulator can be found on the Virtual TI web page at http://vti.acz.org, and requires

C++Builder 3 to compile.  You may use the 68K and Z80 emulation core and disassembler as long as you mention its original source, the Multiple Arcade Machine

Emulator, and provide the address where one can obtain the entire distribution (its web address is listed below).  The JPEG encoding/decoding code is part of the Colosseum Builders C++ Image Library.  Any of the other code can be used as long as you state that it came from this program.

You may not sell the binaries or source to this program. They are free and will always be free.  This program cannot be distributed with any copyrighted ROM images

(independently developed replacement operating systems are OK).

Questions?  Comments?  Bugged?  E-mail me at rusty@acz.org

For updates, visit the Virtual TI web page at http://rusty.acz.org Visit the Assembly Coders Zenith web page at http://www.acz.org

The 68K and Z80 emulation cores are from the Multiple Arcade Machine Emulator.  The source and binaries of the entire M.A.M.E emulator can be found at http://mame.retrogames.com/

Special thanks to:

Mike Heckenbach for writing and testing the parallel link support

Michael Donn for providing me with a black link cable to test with

Nick Caldwell for his scan of the 83 and 85

Matt Johnson for his info on the 86

Alan Bailey for his info on the 86 ports

Pascal Bouron for his info on the 85 link protocol

Tim Singer for his info on the 86 link protocol

Per Finander for his info on the 82/85 link protocol

David Ellsworth for his info on the 92

History:

November 2, 1999:

    Released version 2.5 beta 4

    Fixed bugs in parallel link

    Fixed bugs in ROM Wizard

    Changed startup screen and about box

    Included simple version of skin editor

    Fixed window resizing bug (hopefully)

    Fixed load state bug for TI-83(+)

    Fixed list variable saving bug on TI-82/83

    Eliminated pause after sending variable to hard drive

    Fixed screenshot saving bug

October 28, 1999:

    Released version 2.5 beta 3

    Parallel link is now supported, although it is a bit slow

    Organized list of ROMs into separate tabs for each calculator

October 11, 1999:

    Released version 2.5 beta 2

    Added support for black TI-Graph Link cable

    Fixed support for serial link cable

September 26, 1999:

    Released version 2.5 beta

    Fixed TI-89 and TI-92 Plus update bug

    Fixed ROM dumpers for 82-86

    Added ROM dumper for 83+

    Fixed file sending for 83+

August 25, 1999:

    Released version 2.5 alpha 3 (restricted).

    Fixed problems with TI-92 and TI-92 II emulation.

    Program now loads much faster after the first time.

    Set breakpoint on program entry now works on all

      calculators.

    Improved disassembler output for 82-86.

    Added support for TI-83 Plus

July 5, 1999:

    Released version 2.5 alpha 2 (restricted).

    Fixed bug in window resizing.

    When virtual link is enabled, the second calculator

      will pause when the first enters debug mode.  This

      prevents the second calculator from timing out when

      debugging link routines.

    Added "Run to cursor" (F4) in debugger.

    Added LCD update frequency option.

    Added sound support.

July 1, 1999:

    Released version 2.5 alpha 1 (restricted).

    Added skinning system.

    Window can be resized to any size, not just 1x and 2x.

    Added full screen mode.

    Added option to display percentage of actual speed.

    Added "stay on top" option.

    Built-in ROM dumper is now available for the 86.

    Improved timing, especially for the 85 and 86.

    Fixed several bugs.

    Emulation now in a thread separate from message

      handling, allowing for more efficient

      operation.

    Gigantic improvement in real/virtual link support.

    Added setup wizard and ROM wizard.

    Added support for DB92 symbol information.

    Added ability to drag and drop files.

May 1, 1999:

    Released version 2.0 alpha 4.

    Fixed bug in file sending.

    Added images for the 83 and 85, updated 86 image.

    Fixed bug in 89/92(+) exception handling.

    Fixed bugs in keyboard handling.

April 18, 1999:

    Released version 2.0 alpha 3.

    Faster than previous version.

    Added screen shot support.

    Added the ability to recieve from the virtual

      calculator.

    Added virtual linking.

    Fixed bugs when Windows is set to use "large fonts".

February 19, 1999:

    Released version 2.0 alpha (restricted).

    Added support for TI-82, TI-83, TI-85, and TI-86.

    No longer uses DirectInput (now Windows NT 4

      compatible).

January 10, 1999:

    Released version 1.01 beta.

    Fixed ROM dump problem with COM ports other than 1.

    Added support for multiselection in send dialog box.

    Restriction to actual speed is now an option.

    Added ability to redefine keys for non-US keyboards.

December 24, 1998:

    Initial public release (version 1.0 beta).

Conclusion

Virtual TI is the next best thing to actually owning a TI calculator. You can send your assembled Asm program to the Emulator and test it there. If the progrtam has bugs in it, it will turn off and reset it self which is not half as bad as having your real calculator reset=)

Tutorial 14

This help file has been produced using helpMATIC Pro V1.22 Shareware

http://members.aol.com/harbsg/

The above message will not appear in the registered version


Tutorial 15

We're going to make a game!!!

Overview

We are going to make a game that plays a simple game of Tic Tac Toe! This game will not use sprites, unless you consider a cursor that moves about the board a sprite:) Special thanks to Robert Senser for providing this program!

Preparation

First I will explain the _grfufclr and _grbufcpy ROM calls.  _Grfufclr clears the graph buffer and all 768 bytes in the plotsscreen are set to zero. The _grbufcpy will display what is stored in the plotsscreen buffer.

Programming

The program below is long, but really isn't anything more than we've learned already. Get Ready... Set... Program!

empty	.equ	0

oh	.equ	1

ohwin	.equ	3	;oh * 3!

ex	.equ	4

exwin	.equ	12	;ex * 3!

false	.equ	0

true	.equ	1

keyquit	.equ	$40

keyins	.equ	$0B

keyup	.equ	$03

keydn	.equ	$04

keyrght	.equ	$01

keyleft	.equ	$02

keyentr	.equ	$05

#define B_CALL(xxxx)  rst 28h \ .dw xxxx	;We'll only be using B_CALL

_RunIndicOff	=4570h

_grbufclr 	= 4BD0h

_grbufcpy	= 486Ah

plotsscreen	= 9340h

_getkey	= 4972h

_puts	= 450Ah

_putc	= 4504h

_newline	= 452Eh

_clrlcdfull	= 4540h

_clrscrf	= 4546h

_homeup	= 4558h

appTextSave 	.equ	1

appFlags    	.equ	13

textInverse	.equ	3

textflags	.equ	5

.org	$9D95

B_CALL(_RunIndicOff)	; Turning off the Run Indicator

B_CALL(_grbufclr)	; clear the buffer

ld	hl,picture	; get address of splash screeen

ld	de,plotsscreen  	; get address of TI graphic buffer

ld	bc,768          	; set number of bytes to copy (96*64)/8

ldir	; copy the bytes

B_CALL(_grbufcpy)	; bind the graphic image

; set the flip-flip flag

ld	a,false

ld	(flag),a

ld	(skip),a

; start of game

newgme	B_CALL(_getkey)	; wait for a key to be pressed

cp	keyquit

jp	z,bye	; exit

newgme2 ld	a,empty	; clear the playing grid

ld	(grid0),a

ld	hl,grid0

ld	de,grid0+1

ld	bc,8

ldir

ld	a,true	; preset the cursor grid

ld	(cur0),a

ld	a,false

ld	(cur0+1),a

ld	hl,cur0+1

ld	de,cur0+2

ld	bc,8

ldir

; pick symbol for person and ti

ld	a,(flag)

cp	true

jr	z,new1

ld	a,true

ld	(flag),a

ld	a,ex

ld	(person),a

ld	a,oh

ld	(tisymb),a

ld	a,false

ld	(skip),a

ld	hl,youex

jr	main2

new1	ld	a,false

ld	(flag),a

ld	a,oh

ld	(person),a

ld	a,ex

ld	(tisymb),a

ld	a,true

ld	(skip),a

ld	hl,youoh

jr	main2

; main processing loop

main	ld	hl,nomsg

main2	call show	; show the current grid

ld	a,(skip)

cp	true

jp	z,aihere	; let the ti go first

B_CALL(_getkey)	; get the next key input

cp	keyquit

jp	z,bye	; exit

cp	keyins

jp	z,newgme2

cp	keyup

jr	nz,trydn	; up pushed

call	up3

jp	main

trydn	cp	keydn

jr	nz,tryrght	; down pushed

call	dn3

jp	main

tryrght cp	keyrght

jr	nz,tryleft	; right pushed

call	rght3

jp	main

tryleft	cp	keyleft

jr	nz,tryentr	; left pushed

call	left3

jp	main

tryentr cp	keyentr

ld	hl,badmsg

jp	nz,main2	; enter pushed, other keys ignored

; find the current cursor location

ld	hl,cur0

ld	b,9

fdloop	ld	a,(hl)

cp	true

jr	nz,fdnext

; found cursor location!

ld	bc,-9

add	hl,bc	; back into the grid

; see if empty

ld	a,(hl)

cp	empty

jr	nz,fderr

; if so, insert symbol

ld	a,(person)

ld	(hl),a

call	chkwin

cp	true

jp	z,newgme

jr	aihere

fderr	ld	hl,badloc

jp	main2

; CAUTION -- AI at work here!!!

aihere	ld	a,false

ld	(skip),a

call	timove

call	chkwin

cp	true

jp	z,newgme

ld	a,(flag)

cp	true

jr	z,fdmsg

ld	hl,youoh	;show oh msg

jp	main2

fdmsg	ld	hl,youex	;show ex msg

jp	main2

fdnext  inc	hl

djnz    fdloop

jp	z,main	; something is wrong...

; ignore error

jp	main

; main exit point

bye

call	clrhme	; clear screen

ld	hl,byemsg

B_CALL(_puts)

B_CALL(_newline)

ret	; return to being a mere calculator

;

clrhme	set	appTextSave,(iy+appFlags) ; get text shadow too

B_CALL(_clrlcdfull)	; clear lcd

B_CALL(_clrscrfull)	; clear scr

B_CALL(_homeup)	; home the cursor

ret

;TI GAME STRATEGY

; ti makes a move

; strategy:

; 1) Can ti win, if so then do it

; 2) Can "wet-ware" win, if so then take it the square first

; 3) Can ti take the center, if so then take it

; 4) Can ti take a corner, if so then take it

; 5) else, take an open spot

timove  ld	b,9

ld	hl,grid0

tiloop1	ld	a,(hl)

cp	empty

jr	nz,tinext1

push	hl

push	bc

ld	a,(tisymb)

ld	(hl),a

call	chkwin

pop	bc

pop	hl

cp	true

jr	z,tifnd	; winning move!

ld	a,empty

ld	(hl),a	; remove trial move

tinext1 inc	hl

djnz	tiloop1

;check for defensive move

ld	b,9

ld	hl,grid0

tiloop2	ld	a,(hl)

cp	empty

jr	nz,tinext2

push	hl

push	bc

ld	a,(person)

ld	(hl),a

call	chkwin

pop	bc

pop	hl

ld	d,a

ld	a,empty

ld	(hl),a

ld	a,d

cp	true

jr	z,tifnd	; good defensive move!

tinext2	inc	hl

djnz	tiloop2

;check the center

ld	hl,grid0+4

ld	a,(hl)

cp	empty

jr	z,tifnd

;check the corners (and center again)

ld	b,5

ld	hl,grid0

tiloop4 ld	a,(hl)

cp	empty

jr	z,tifnd

inc	hl	; +2 goes corner to corner ...

inc	hl

djnz	tiloop4

;try anyplace (could optimize, but....)

ld	b,9

ld	hl,grid0

tiloop5	ld	a,(hl)

cp	empty

jr	z,tifnd

inc	hl

djnz	tiloop5

jr	tiexit

tifnd	ld	a,(tisymb)

ld	(hl),a

tiexit	ret

; check for a winner, return true in a if so, else false

chkwin	ld	hl,chktab

push	hl

pop	ix	;table addr -> ix

;start outer loop

chkloop	ld	a,(hl)	;are we done?

cp	0

jr	z,chknaw	;yes, then no winner!

inc	hl	;get to address

ld	e,(hl)	;woaw!!!  (hl) -> hl

inc	hl	; woaw!!!

ld	d,(hl)	;  woaw!!!

push	de	;   woaw!!

pop	hl	; de -> hl

ld	d,0

ld	e,a	;de is increment value

ld	b,3	;b is loop count

ld	a,0	;a is sum	add	hl,de

;start inner loop

chk1 	add	a,(hl)

add	hl,de

djnz	chk1

cp	ohwin

jr	nz,chk1n

ld	hl,ohwins	; O wins!

jr	chkwinr

chk1n	cp	exwin

jr	nz,chkno

ld	hl,exwins	; X wins

jr	chkwinr

;end inner

chkno	push	ix

pop	hl	; ix -> hl

inc	hl	; add 3

inc	hl

inc	hl

push	hl

pop	ix	; hl -> ix

jr	chkloop	;no win this line

;end outer

; exit outer loop early, crow about success and mark win

chkwinr	call	show

ld	a,true

jr	chkbye

chknaw	ld	hl,grid0	;See about the cat

ld	b,9

chklop	ld	a,(hl)

cp	empty

jr	z,chkncat

inc	hl

djnz	chklop

ld	hl,catmsg	;Darn cat!

call	show

ld	a,true

jr	chkbye

chkncat	ld	a,false

chkbye	ret

; this routine works by summing values in grid, 8 possible cases

chktab	.db	1	;covers the 8 cases!

.dw	grid0

.db	1

.dw	grid1

.db	1

.dw	grid2

.db	3

.dw	grid0

.db	3

.dw	grid0+1

.db	3

.dw	grid0+2

.db	4

.dw	grid0

.db	2

.dw	grid0+2

.db	0	;end of table marker

; move "cursor" up

up3	ld	hl,cur0

ld	de,curx

call	mov3

ld	hl,cur1

ld	de,cur0

call	mov3

ld	hl,cur2

ld      de,cur1

call    mov3

ld	hl,curx

ld	de,cur2

call	mov3

ret

; move "cursor" down

dn3	ld	hl,cur0

ld	de,curx

call	mov3

ld	hl,cur2

ld	de,cur0

call	mov3

ld	hl,cur1

ld      de,cur2

call    mov3

ld	hl,curx

ld	de,cur1

call	mov3

ret

; helper routine

mov3	ld	bc,3

ldir

ret

; move "cursor" right

rght3	ld	hl,cur0

call	shtr3

ld	hl,cur1

call	shtr3

ld	hl,cur2

call	shtr3

ret

; helper routine

shtr3 	push	hl

ld	a,(hl)

inc	hl

ld	b,(hl)

inc	hl

ld	c,(hl)

pop	hl

ld	(hl),c

inc	hl

ld	(hl),a

inc	hl

ld	(hl),b

ret

; move "cursor" left

left3	ld	hl,cur0

call	shtl3

ld	hl,cur1

call	shtl3

ld	hl,cur2

call	shtl3

ret

; helper routine

shtl3	push	hl

ld	a,(hl)

inc	hl

ld	b,(hl)

inc	hl

ld	c,(hl)

pop	hl

ld	(hl),b

inc	hl

ld	(hl),c

inc	hl

ld	(hl),a

ret

; show the tic-tac-toe grid on the screen

show	push	hl	; keep possible message

call	clrhme	; clear/home screen

ld	hl,grid0	; process row 0

call	showrow

ld	hl,dashs

B_CALL(_puts)

B_CALL(_newline)

ld	hl,grid1	; process row 1

call	showrow

ld	hl,dashs

B_CALL(_puts)

B_CALL(_newline)

ld	hl,grid2	; process row 2

call	showrow

pop	hl	; process message if there

ld	a,(hl)

cp	0

jr	z,showby

push	hl

B_CALL(_newline)

B_CALL(_newline)

pop	hl

B_CALL(_puts)

showby	ret

showrow

push	hl

call	showspot	; show first spot

ld	a,(bar)

B_CALL(_putc)

pop	hl

inc	hl

push	hl

call	showspot	; show 2nd spot

ld	a,(bar)

B_CALL(_putc)

pop	hl

inc	hl

call	showspot	; show 3rd spot

B_CALL(_newline)

ret

; show the symbol at (hl), and handle cursor

showspot

push	hl	; need this later

ld	bc,9

add	hl,bc

ld	a,(hl)	; load cursor flag

pop	hl

cp	false

;	res	textInverse,(iy+textflags)

jr	z,shownch

set	textInverse,(iy+textflags)

shownch	; load actual item in spot

ld	a,(hl)

cp	empty

jr	nz,shownot1

ld	a,(space)

jr	showgun

shownot1

cp	oh

jr	nz,shownot2

ld	a,(leto)

jr	showgun

shownot2

ld	a,(letx)

showgun	bcall(_putc)

res	textInverse,(iy+textflags)

ret

; these are really variables

grid	.equ	*

grid0   .db	empty,empty,empty

grid1	.db	empty,empty,empty

grid2	.db	empty,empty,empty

; this must be 9 bytes past grid0 or else it will fail

cur0	.db	true,false,false

cur1	.db	false,false,false

cur2	.db	false,false,false

curx	.db	0,0,0

person	.db	0

tisymb	.db	0

flag	.db	0

skip	.db	0

; basically, these are constants

nine	.db	9

space	.db	" "

leto	.db	"O"

letx	.db	"X"

bar	.db	"|"

dashs	.db	"-----",0

; youmsg	.db	"Your move!",0

youex	.db	"Your move 'X'!",0

youoh	.db	"Your move 'O'!",0

ohwins	.db	"** O ** Wins!",0

exwins	.db	"** X ** Wins!",0

catmsg	.db	"* Cat got it *",0

nomsg	.db	0

badmsg	.db	"Invalid key!",0

badloc	.db	"Place taken!",0

byemsg	.db	"Game over.",0

picture:

#include "title.asm"    ; graphic image from file poets.asm

.end

END

This is the title.asm screen that will be displayed at the start of the program, start a new text file and copy this into it. Don't try to copy it by hand, it won't help you unless you know what it is. Name the text file "title.asm". Then make sure it is in the same folder as the Tic Tac Toe game when you assemble it.

;	title.asm

    .db     0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0

    .db     0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0

    .db     0,0,0,0,0,0,0,0,0,0,0,1,254,192,31,224,0,31,224,0,0,0,0,1,254,0,31,224,0,31,224

    .db     0,0,0,0,0,48,207,3,7,207,3,7,143,0,0,0,0,48,223,3,15,223,3,15,223,128,0,0,0,48,216

    .db     3,12,216,3,12,217,128,0,0,0,48,216,3,12,216,3,12,219,128,0,0,0,48,216,3,12,216,3,12,216,0

    .db     0,0,0,48,223,3,14,223,3,15,223,0,0,0,0,48,207,3,6,207,3,7,143,0,0,0,0,0,0,0,0

    .db     0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0

    .db     0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0

    .db     0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0

    .db     0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0

    .db     0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0

    .db     0,0,0,0,0,0,0,0,0,3,192,0,0,0,1,128,0,0,0,0,0,1,32,0,0,0,0,128,0,0,0

    .db     0,0,3,96,0,0,0,1,128,0,0,0,0,0,2,108,198,97,172,145,38,72,0,0,0,0,3,149,40,128,82

    .db     145,73,72,0,0,0,0,6,51,236,195,247,179,159,216,0,0,0,0,4,34,4,68,165,35,16,144,0,0,0,0

    .db     4,34,68,68,164,194,146,96,0,0,0,0,30,115,187,135,237,134,220,207,192,0,0,0,0,0,0,0,1,0,0

    .db     128,0,0,0,0,0,0,0,0,2,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0

    .db     0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0

    .db     0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0

    .db     0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0

    .db     0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,2,12,0,0,0,0,0,0,0,0,0,0,6

    .db     18,0,0,0,0,0,0,0,0,0,0,6,54,0,0,0,0,0,0,34,107,60,214,4,36,0,0,0,0,0,0

    .db     34,149,69,41,4,36,0,0,0,0,0,0,61,252,111,123,12,108,0,0,0,0,0,0,41,8,42,82,8,72,0

    .db     0,0,0,0,0,17,40,42,82,8,72,0,0,0,0,0,0,49,221,219,182,63,112,0,0,0,0,0,0,0,0

    .db     0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0

    .db     0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0

Conclusion

What do you think? Cool eh'? Pressing the "on" key seems to put the game into greyscale for some reason, oh well. If you think the title screen was cool, you can make them by using Bill Nagel's Pic83. Click here for instructions.

This will be the last tutorial in this version of TI-83 Plus Asm tutorials v1.01. Don't worry though ,if you finish this tutorial early, look out for version 2.01 very soon (2 weeks).

Tutorial 16

This help file has been produced using helpMATIC Pro V1.22 Shareware

http://members.aol.com/harbsg/

The above message will not appear in the registered version


www.geocities.com/SiliconValley/Peaks/3938/ - Exellent Home page devoted to the z80 processor including pictures and diagrams.

This help file has been produced using helpMATIC Pro V1.22 Shareware

http://members.aol.com/harbsg/

The above message will not appear in the registered version


www.geocities.com/SiliconValley/Mouse/2260/ - Programming For Poets is a great site by Robert Senser. It contains his method of assembling Asm Programs. It also contains a few sample programs and links to other great Web sites.

This help file has been produced using helpMATIC Pro V1.22 Shareware

http://members.aol.com/harbsg/

The above message will not appear in the registered version


www.ti.com\Calc - TI's calculator homepage, click on links for updates, programs, news, general information, and buying Calcs.

This help file has been produced using helpMATIC Pro V1.22 Shareware

http://members.aol.com/harbsg/

The above message will not appear in the registered version


www.zilog.com - the home page of the company who first designed the z80. You won't find TI information here, but you will find z80 info.

This help file has been produced using helpMATIC Pro V1.22 Shareware

http://members.aol.com/harbsg/

The above message will not appear in the registered version


Why is Notepad prefered? Notepad does not complete spellchecks of documents. Other word processors such as MS Word or WordPerfect do perform spell checks. This is not good for Assembly programming. Spell checks may not recognize Asm programming code and will therefore attempt to correct it.

This help file has been produced using helpMATIC Pro V1.22 Shareware

http://members.aol.com/harbsg/

The above message will not appear in the registered version


Tutorial 14

User Input via Key pad

Overview

For those of you who have had experience with TI-83 Asm programming, you will note that the below program looks familiar. That's because it is the exact same program from tutorial 7 in James Matthew's Asmguru! This proves that TI-83 Asm programs will run on a TI-83 Plus with just a few minor changes. Therefore I assume no responsibility for writing this program, just porting it. This program takes user input from the TI's key pad to move a dot about the screen. Sort of like a small sprite! This program uses Getkey(Tutorial 8) call. Only this time we've narrowed the area in which getkey scans the keyboard to the Arrow keys and the clear key.

Programming

Here we go...

#define B_CALL(xxxx)	rst 28h \ .dw xxxx

#define B_JUMP(xxxx)	call 50h \ .dw xxxx

_RunIndicOff	= 4570h

_IPoint	= 47E3h

_getkey	= 4972h

_clrlcdfull	= 4540h

_homeup	= 4558h

#DEFINE kLeft       02h

#DEFINE kRight      01h

#DEFINE kUp         03h

#DEFINE kDown       04h   	;All these guys are hex code

#DEFINE kEnter      05h     	;for keys on the Ti-keyboard.

#DEFINE kClear      09h

.org 9D95h

B_CALL(_clrLCDFull)	;Clear the screen.

ld b,47

ld c,47

ld d,1	;Set D to 1.

B_CALL(_IPoint)

B_CALL(_runIndicOff)	;Turn off run indicator.

GetKey:

B_CALL(_getKey)	;Asked for a key.

cp kLeft	;Compare key with code for left.

jp z,Left	;If equals 0, go to left.

cp kRight

jp z,Right

cp kUp

jp z,Up

cp kDown

jp z,Down

cp kClear

jp z,Quit

jp GetKey

Left:

ld d,0	;Set D to 0.

B_CALL(_IPoint)

dec b	;Decrement B

jp Draw

Right:

ld d,0

B_CALL(_IPoint)

inc b

jp Draw

Up:

ld d,0

B_CALL(_IPoint)

inc c

jp Draw

Down:

ld d,0

B_CALL(_IPoint)

dec c

jp Draw

Draw:

ld d,1

B_CALL(_IPoint)

jp GetKey	;Repeat

Quit:

ret	;Return to OS.

.end

END

Note: You may want to set your calc's graph to ZInteger because ZStandard may interfere with the axis.

New Commands

cp - Compares with accumulator.

jr - The ASM equivalent to If xx then jump to xxxxxx

jp - Same as above, except very different

_ipoint - Turns a point on/off/switch or tests.

What's the difference between Call and jp/jr? Call is a z80 instruction that jumps to a sub-routine, a label with specified calls and instructions. What about jp/jr? Well I'm going to let James Matthews explain that.

"What is the difference between jr and jp? There is one massive difference.  JR is a relative jump - meaning, when TASM compiles it, the instruction for the Z80 simply tells it how many bytes forward or backward to jump.  Thus, jr has a limited range.  jp on the other hand is an absolute jump - tells the Z80 the address to jump to.  The advantage of JR over JP is the file size is smaller and faster once compiled.  (Thank you to Mindless Productions for this information.)  Harper told me that jr is a small jump (up to 128 bytes), and jp is a large jump (up to 32K- the whole RAM, basically!)."

- James Matthews

Conclusion

Not yet comftorable with Registers? Take a look at Andy S.' 83 Asm tutorials in Tutorial 4! Or look in tutorial 17 in this help file.Now let's get moving!

Tutorial 15

This help file has been produced using helpMATIC Pro V1.22 Shareware

http://members.aol.com/harbsg/

The above message will not appear in the registered version


Andy S.' tutorials
Beginning 83 Asm

Tutorials by Andy S.

------ ASM Tutorial 1 -------

For: What you need to know

By: Andy_S

Original Date: 9/27/97

Last Update: 12/22/97

Version: 1.1

There are several things you should know or do before starting in assembly. First, you should get the two files ti83asm.inc and tokens.inc. These are include files, you will use them in almost every assembly program you write. After you get these, look over the beginning of ti83asm.inc so you can get a general idea of some romcalls. Romcalls are calls to already-made routines located in ROM, that you can use. Another good file to look at is the Z80 Hardware Reference (called z80href.txt). This file gives you an introduction to the registers (which are a kind of permanent variables) and instructions (which are the commands you program). You probably don't understand what it all means now, but it will help you later, when you start learning about the different registers and commands. Second, you should know the way to set up to start an assembly program. All programs start with

.NOLIST

#define equ .equ

#define EQU .equ

#define end .end

#include "ti83asm.inc"

#include "tokens.inc"

.LIST

.org 9327h

The defines make the include files work, and the include files let you use the built in calculator routines. The .org 9327h tells the program where to start. All TI-83 programs will start at that place. At the end of the program goes

.end

and if you get an error with that, try putting

.end

end

because the compiler needs to know where the code finishes. The next thing you'll need to do is get a compiler. For the PC, you can download a program called TASM, which will compile your programs. After you compile a program, you need to put it into the TI-83 format, and there is a nice program called 83lnk which will do that for you. (If you are using a Mac, the compiler is called CAZ, but I've heard it doesn't work.)

To compile a program with TASM, first download the zip file and unzip it to one directory. Then you probably want to make a batch file to run everything. So, start up a DOS Command prompt, and change to the directory that you put TASM in. After that, type 'edit asm.bat' (no quotes). You should get a simple editor. Type in this file:

tasm -i -80 %1.asm

and then save and close the file. To compile something after that, all you have to do is type (again no quotes) 'asm progname'. Make sure your file has an extension of .asm, but don't type it as part of the command. After you run that, it will tell you whether there were any compile errors. If not, run 83lnk, by typing:

83lnk xxxxxx.obj xxxxxx.83p XXXXXX

where xxxxxx is your filename (no .asm) and XXXXXX is the name you want it to have on the calculator (it MUST be in capital letters remember!). Then send the 83p file to your calculator and try it out.

Learn how to use the compiler by testing it with a complete source code. When that works, you'll be ready to start your assembly programming.

------ ASM Tutorial 2 -------

For: all about registers

By: Andy_S

Original Date: 12/23/97

Version: 1.0

Registers are used to hold values. They are like permanent variables, because you can't get rid of them, but they are more than just that. There are really 8 main registers. They are: a, b, c, d, e, f, h, and l. Unfortunately, you can't always just pick the letter you like best at that moment and use that register (but sometimes you can!). Some Z80 instructions require input from certain ones and return values to certain ones.

The register 'a' is the most important. It is also called the accumulator. When you use the command cp (which does a compare), it checks whether your value matches the one in the accumulator.

The registers b, c, d, e, h, and l are by themselves 8 bit registers. This means they can each hold one byte of information (which is any number from 0 to 255). However, if you need more than that, some can be combined to make 16 bit registers (from 0 to 65536). The ones that you can combine are b and c, d and e, and h and l. When you combine them you get the new registers named bc, de, and hl. They are now can be read as one value or the values of each separately. In other words, if you put 2 into b, and 3 into c, then bc is equal to 515. To explain why, you must understand a little about binary.

Binary is a way of writing numbers using only 0 and 1. To read a binary number, you have to look at it like this:

Number you're trying to read: 00100110

Imagine this in your head: 76543210

Now all you have to do is go (usually from the right) and see whether there is a one or zero in each place. If there is a one, take 2 to the power of the number under it that you're imagining. Then add all those answers together. The number above for example would be:

2^1 + 2^2 + 2^5 = 2 + 4 + 32 = 38

and so it is the number 38. Now back to the 2 and 3 example... The number 2 in binary is 00000010 and the number 3 is 00000011. so if you put those next to each other you get

0000001000000011

and then you read it the same as before except keep going from 7 to 8 to 9 and so on when you're imagining your numbers. If you do this, you get 515. But notice if you look at them individually, they are still 2 and 3. The 16 bit registers are good for holding memory addresses.

Instead of listing millions of examples you wouldn't understand yet, from now on, it will be noted if a command uses a specific register.

------ ASM Tutorial 3 -------

For: displaying text on

the home screen

By: Andy_S

Original Date: 9/26/97

Last Update: 12/22/97

Version: 1.1

Ok, to make a program to display text on the screen... First, put all the #includes and #defines that you should already know before reading this, and of course

.org 9327h

Next, you probably want to clear the screen, so you should put

call _clrlcdfull

as the first line in your program, unless you *don't* want to clear the screen, in which case you ignore it. Notice that the line with the .org is aligned on the left and the call isn't. Basically, any line that start with a '.' should have no space in front of it, and all other lines except labels (we'll get to them in a minute) should have some space before them (a tab works fine).

Positioning the text is the next important thing. You want to say where on the screen its going to go. You have a choice of eight rows and sixteen columns. To confuse you some, the numbers go from 0 to 7 for rows and 0 to 15 for columns, instead of going from 1 to 8 and 1 to 16, because row 0 is really row 1 and so on from there. The calculator stores the position of the cursor in 2 bytes called CURROW and CURCOL. The position you want for the row (which is how far down it is) goes in the first, the column goes in the second. However, luckily, they are one right after the other in memory. This means you only have to use one!

For an example, say you want to display text 3 rows down and 4 columns across. To do this you want a 2 (remember how you have to subtract 1) in CURROW and a 3 in CURCOL. To do this you need to use the register hl. So

ld hl,0203h

ld (CURROW),hl

would be the next part of the program. This tells the calculator to load the value 0203h (the h means hexidecimal) into hl. Then it loads hl into CURROW. Since hl can hold two bytes, it puts the first in CURROW and the second in the byte after it, which happens to be CURCOL.

After this you need to say what to display. So you load the address of your string, at this point we'll say your string is called "Str". Notice the string is only *called* Str, the string itself is not "Str". (Str itself is actually a label; we're very close to finding out just what a label is.) To load the string's address into hl, you put

ld hl,Str

as the next line. Easy enough? After that all you have to do is display it. To make it easy, there is just one call you need to do that.

call _puts

To end the program, you need a line that says

ret

which tells the calculator to go back to regular mode. The only thing left after that is the string itself. To set that up, you need a line like this

Str: .db "assembly",0

in your code. The "Str:" part is a label that says this string will be called "Str". (So *that's* what a label is! Don't forget there is no space before one.) The .db tells the calculator that you are about to need some room for a string. The "assembly" is the string, but can be replaced by whatever you want. The ",0" at the end tells _puts where to stop displaying. Finally, remember that you need

.end

at the bottom so the assembler knows where to stop. Then compile your code. It's done!

Assuming you followed all that, your full source should be:

.NOLIST

#define equ .equ

#define EQU .equ

#define end .end

#include "ti83asm.inc"

#include "tokens.inc"

.LIST

.org 9327h

call _clrlcdfull ; if you wanted a cleared screen

ld hl,0203h

ld (CURROW),hl

ld hl,Str

call _puts

ret

Str: .db "assembly",0

.end

------ ASM Tutorial 4 -------

For: the commands cp, call, and jp

By: Andy_S

Original Date: 9/26/97

Last Update: 12/22/97

Version: 1.0

Some people are probably wondering about the commands call and jp, and especially about the letters sometimes seen after them. Usually these letters are z or nz. To make it easier, z stands for zero and n for not. What all that means is another story. So here goes...

If you've programmed in any other language, you probably know about if-then statements. What an if-then statement usually says is if a variable is equal (or not equal) to a value, then "do something". That sounds complex, but an example will help.

if (x = 3) then goto Start

That line (which is not assembly, don't put it in your code!) says: if x is equal to 3 you go to Start. If x is *not* equal to 3, then the program will not go to Start. The assembly equivalent to this is:

ld a,(x)

cp 3

jp z,start

which seems weird because one line turned into three. It will make sense however when explained. First, x is loaded into a (also known as the accumulator). The cp 3 line means "compare 3 with a" (notice it always compares your value with what's in the accumulator!) so it checks whether x = 3. The jp z,start means "jump, if zero, to start". This is how the zero fits in: the way comparisons are made is to subtract. So, for example, lets say x *is* equal to 3. The cp statement would then do (without changing values) basically 3 minus 3. This is obviously equal to 0. If x was equal to 4, it would be 4 minus 3. This would not be zero. So, to check whether x is not equal to 3, you could do

ld a,(x)

cp 3

jp nz,start

which says "jump if not zero to start". In other words, use z if you want "equal to" and nz if you want "not equal to". Call works the same way, so if you want to make a call, rather than a jump, you would use call z, or call nz. Of course, to make a call you need to know more about what a label is for, and to load from a variable like x you need to know how to create variables. But you will learn that in another lesson.

------ ASM Tutorial 5 -------

For: getkey input

By: Andy_S

Original Date: 9/29/97

Last Update: 12/22/97

Version: 1.1

Almost every program needs some kind of user input so input is a good thing to know how to do. There are three ways of reading a key.

The first method is to use the romcall _getkey. This method waits for a keypress and returns the value in the accumulator (that is, a). The value returned is a hex value; to find these values, read the table (KEY CODES) TI has on its webpage (http://www.ti.com/calc/docs/83asmkey.htm) on returned values for input. The way you would use _getkey is this:

call _getkey

cp 05h

jr z,label

where label is where you want the program to go if key 05h is pressed (key 05h happens to be the Enter key), and of course there would be more to the program to say what to do if a different key was pressed. Using this routine causes the calculator to wait for a keypress so it is not helpful if you need to repeat something while waiting for a key. This method would mainly be used for a pause, when the key pressed is not important.

The second method is to use the romcall _getk. This routine does not wait for a keypress. It also returns the value to op2 (op1 and op2 are special locations in memory that many romcalls use as places to return a value) rather than the accumulator. A common way of using this routine is

keyloop:

call _getk

call _op2toop1

call _convop1

or a

jr z,keyloop

ret

The _op2toop1 moves the returned value to op1, and the _convop1 puts it in the accumulator, and then you can just do a cp like before. The line "or a" is a way of saying "cp 0", but it takes less memory (You check for zero because _getk returns zero if no key was pressed). The next to last statement repeats the loop if no key was pressed. The values returned with _getk are the same as the getkey command in TI-BASIC. Read the user's manual if you don't know how to find these values.

The loop presented here is not much better than _getkey, because it also waits for a keypress. However, if you take out the lines

or a

jr z,keyloop the routine will check for a key, and return the value in the accumulator, including 0 if no key was pressed, without looping. You can then go on with the rest of your loop, and call the routine again after it is done. This will allow you to keep looking for keypresses and still let the rest of the program to proceed.

The third method, known as direct input, is more complicated and will be discussed in a later tutorial.

------ ASM Tutorial 6 -------

For: displaying text on the graph and home screens

By: Andy_S

Original Date: 9/30/97

Last Update: 12/23/97

Version: 1.1

Ok, you figured out how to display a string on the home screen (see ASM Tutorial 1 if you didn't). Now you want to know how to display it on the graph screen using the smaller text. The first difference is instead of using CURROW and CURCOL, you use PENCOL and PENROW. Here's the confusing part. This time the column goes first and the row sceond. Again, you only have to use the first one. For example put

ld hl,0929h

ld (PENCOL),hl

to display text at 10 pixels across and 30 down (remember the first number is 0). Each row and column is one pixel now. Then you have the romcall to actually display the text. This call is

call _vputs

Remember, there needs to be a string in hl for _vputs. There are also other methods of displaying text. For example, if you want to display just one character, instead of _vputs, you can use _vputmap. The way you use this is to load the character you want into the accumulator (for example, 68 is the letter 'd') and call _vputmap. Like this

ld a,65 call _vputmap

That will display 'd' at (PENCOL, PENROW). The same method is available for homescreen text using the romcall _putc. This will be displayed at (CURROW, CURCOL). If you want just one blank space on the graph screen, you can use the romcall _vputblank. This just moves the cursor over two pixels.

Another way to display text, instead of having a string with ",0" at the end, there is a romcall for both types of text to have a fixed length. The way you do this on the homescreen is _putps. The length is the first byte, like

ld hl,str

call _putps

ret

str: .db 10, "abcdefghij"

With the graph screen text, it is not the first byte of the string, but the value in the register b, and the romcall is _vputsn.

ld hl,str

ld b,10

call _vputsn

ret

str: .db "abcdefghij"

Of course you have to still tell the program where you want it to display the text. This concludes the main ways of displaying text.

This help file has been produced using helpMATIC Pro V1.22 Shareware

http://members.aol.com/harbsg/

The above message will not appear in the registered version


Pic83

Using Pic83 and Neopaint

Introduction

This is a guide based off of James Matthew's Asmguru on how to convert .pcx files to .asm. You will need quite a few programs for this.  Pic83 by Bill Nagel, Neopaint by Neosoft, and Paintshop Pro.  The Pic83 you can get from the Ti-files or ti-calc.org archives. The other software is very easy to get through the web at Softseek.com.  Paintshop Pro is not necessary, any decent paint program will work.  Neopaint is necessary.

Instructions

1.) Open a picture in Paintshop Pro or make on in NeoPaint.  Resample the image to 96x64 pixels.  Then reduce the colours to 2 colours, using order diffusion.  You can change the other values to the settings that suit you best.

2.) Save this file in the Neopaint directory (for convience only).

3.) Open Neopaint, use the 640x480 256 colour mode.  Open your picture.

4.) Convert the picture to 256 colours on opening it.

5.) Save it.

6.) Use pic83.exe to convert the file.  The syntax is as follows:

pic83 <graphic name> <asm name>

7.) Copy the code and paste in to your program.

8.) Compile and send!

Conclusion

Cool eh'? Well this isn't nessasry to make pictures but it sves you time from hand doing it yourself. Now back to the lessons!

Back to Tutorial 15

This help file has been produced using helpMATIC Pro V1.22 Shareware

http://members.aol.com/harbsg/

The above message will not appear in the registered version


Tutorial 16

Text Formatting (2) Small text

Overview

I've put this tutorial off about as long as I could already. It's time I write it down before I forget. This tutorial will cover displaying small text. Displaying small text is not that much different from displaying normal or inverse text, it's all about loading the right values into the right coordinates.

First, you should know that the coordinates you will be using should be loaded into the X and Y values of the graph screen. They are Pencol and Penrow. How do you tell the difference from each? Well, think of Pencol as Pen Column (Y) and Penrow as Pen Row (X). Why load the coordinates to the graph screen? As you know, the text you can write on the graph screen using the TI-Basic command text( is smaller than the text you can write at the home screen. So the coordinates must be loaded into the Penrow and Pencol values.

Programming

This program will display small text above normal size text. You'll only need to use Pencol in this program. See  tutorial 18 for explanation.

#define B_CALL(xxxx)	rst 28h \ .dw xxxx

#define B_JUMP(xxxx)	call 50h \ .dw xxxx

_ClrLCDFull	=4540h

_GrBufClr	=4BD0h

_VPutS	=4561h

PENCOL          	=86D7h

CURROW	=800Ch

CURCOL	=800Dh

_puts	=450Ah

.org 9D95h

  B_CALL(_clrLCDFull)	;Clear the screen

  B_CALL(_GrBufClr)	;Clear all values in the graph buffer

  ld hl,0000h	;Load 0 to hl register

  ld (PENCOL),hl	;Load hl value to Pencol

  ld hl,str1	;Load text string

  B_CALL(_vputs)	;Call for displaying text on graph screen

  ld hl,0001h	;Same here, load 0 to hl register

  ld (CURROW),hl	;Load hl value to normal text coordinate

  ld hl,0000h

  ld (CURCOL),hl

  ld hl,str2

  B_CALL(_puts)	;Put text on homescreen

  ret

str1:	;Label for text

  .db "This is small writing.",0   ;Small text

str2:

  .db "This is big.     ",0	;Normal text

.end

END

New Commands

_GrBufClr - Clears the values stored in the graph buffer

_Vputs - Call for displaying text on the Graph screen

Pencol - Column coordinate for graph screen

Penrow - Row column coordinate

Conclusion

Well, what a great way to kick off the new version of this help file. This version fixes bugs, adds new information to the existing tutorials, and includes brand new tutorials.

Tutorial 17

This help file has been produced using helpMATIC Pro V1.22 Shareware

http://members.aol.com/harbsg/

The above message will not appear in the registered version


Tutorial 17

Registers - What are they?

Overview

Many people have e-mailed me telling me that they are unclear with registers. Chances are if you are new to programming, or computers in general, you probably aren't clear on the concept of registers either. In that case, I have dedicated the next few tutorials to registers, their uses, and their specific functions.

What are Registers

You have probably learned from past experiences, that most data is stored in the user-memory (RAM) of the calculator. This is true, but lets say you wanted to manipilate (add/subtract/multiply/divide/etc.) a number you stored in user-memory. It's possible, but it is hard and access to the user-memory is rather slow. So the computer people decided to create fast-access areas of memory in the CPU itself just for storing data and variables in. They called these areas of memory "Registers".

There are many kinds of registers for the Z80. No, you can't pick the one you like the most at the moment and you that one, well, sometimes you can. The names of the most common individual registers are - a, b, c, d, e, h, l. Each register (the one lettered ones) are themselves 8-bit. This means you can store 1 byte of information in them. For example, you can store decimal numbers 0-255 in them. The "a" register is special. It is also called the accumulator. When you use the cp command, it checks this register. The "a" register will be used in many commands.

You have also probably seen af, hl, de, bc used instead of a, b, c, d, e, h, I. These are 2 one letter registers, just combined. If you wanted to hold numbers greater than 255 (Decimal numbers 0-65536) , you would use these registers because they are 16-bit registers. They can store 2 bytes of data.

Here's a brief description of the registers:

A,B,C,D,E            8-bit registers

AF                   16-bit register containing A and flags

BC                   16-bit register containing B and C

DE                   16-bit register containing D and E

HL                   16-bit register used for addressing

F                    8-bit Flag register

I                    8-bit Interrupt Page address register

IX,IY                16-bit index registers

PC                   16-bit Program Counter register

R                    8-bit Memory Refresh register

SP                   16-bit Stack Pointer register

Syntax for Values

Let's say you wanted to load the value 4 into the "a" register, the syntax would be:

ld     a,4

The ld, command stands for load. So you are loading the value 4 into the "a" register. The same syntax goes for loading values into any other register.

Now lets say you wanted to load 0235 into the register "hl". You would think this -  ld     hl,0235. That's right, sort of. "0235" could be a decimal, hex, or binary(maybe not) value. When assembling programs, TASM needs to know what kind of value it is. So you need to include an h for hexadecimal value, d for decimal, or b for binary after the value. So let's say the value "0235" was hexadecimal, the syntax would be:

ld      hl,0235h

Notice the h at the end. Or, instead of putting letters behind the value, you can out symbols in front of them to tell TASM what kind of values they are. You can put a % for binary values, and a $ for hexadecimal. So to use symbols, it would look like this for hexadecimal:

ld      hl,$0235

This is what loading a binary number would look like:

ld      hl,%0100101

Notice that you leave out the letter when using symbols. When using decimal (Integers, whole numbers) no symbol or letter is needed before or after the value. This is because TASM will assume if no format is specified, that the value is a decimal value.

Tutorial 18

This help file has been produced using helpMATIC Pro V1.22 Shareware

http://members.aol.com/harbsg/

The above message will not appear in the registered version


Disclaimer

Legal Stuff

You've probably seen hundreds of disclaimers in Asm related programs, articles, and well... stuff! Well, this is just another one of them. Here's the legal stuff:

By opening and using these tutorials you hereby discredit me from any responsiblilty if your calculator or computer crashes or blows up from the use of these tutorials.

What I'm trying to say here is that if anything BAD happens to your calculator by using the program examples in this help file, I'm not responsible for it. They should be bug free by now, I've tested and had other people test them. They're fine now. I'm also not responsible for anything BAD happens to your computer through the use of the ObjHex program. I've also tested it many times, it will work.

Though all this "disclaimer" stuff, you probably think I won't help you fix the problem. Nope that's not the case. I will gradly help you resolve the problem but will not be held responsible for it. This ends the dreaded disclaimer. =)

This help file has been produced using helpMATIC Pro V1.22 Shareware

http://members.aol.com/harbsg/

The above message will not appear in the registered version


Tutorial 18

Registers - Their uses

Overview

From the previous tutorial, you learned you can load values into registers. What about loading registers to registers? How about CURCOL, CUROW, PENCOL, and PENROW? What is Cp?

Register > Register

You can't actually load a register into another register, but you can load the data value in another register to a register. Here's what it looks like:

ld    b,a

In this example, I loaded whatever was in register a into register b. You can do this with any single letter registers.

Curcol, Currow, Pencol, Penrow

As I told you before, Curcol and Currow are the text coordinates on the home screen. Pencol and Penrow are text coordinates on the graph screen. These are the memory adresses for these coordinates:

PENCOL          	=86D7h	;Notice the memory adress similarities...

PENROW      =86D8h

CURCOL	=800Dh	;Same here...

CURROW	=800Ch

If you noticed, Pencol and Penrow are right next to each other in memory. Same goes with Curcol and Currow. Notice how I loaded the coordinates into Pencol in tutorial 16. It looked like this:

ld hl,0000h

ld (PENCOL),hl

As you can see, I loaded 00 to Pencol. But what about Penrow? 0000h is a 16-bit value. And hl is a 16-bit register. Pencol and Penrow are both 8-bit. Thus if I loaded 0000h into hl, then loaded hl into Pencol, the other half of the value is automatically loaded into Penrow. So in the end, this is what each coordinate is:

Pencol = 00

Penrow = 00

Note: this is not actual Asm code, so don't put it in your programs.

Pencol is earlier in memory than Penrow. So make sure you load the value into Pencol if you want it automatically loaded into Penrow. You can do the same thing as you did with Pencol and Penrow with Curcol and Currow. Try it out! If you wanted to load 00 to Pencol and 05 to Penrow, the code would look like this:

ld  hl,0005h

ld  (PENCOL),hl

What is Cp?

Cp is a Z80 instruction that stands for Compare. This instruction compares a value to the value in the "a" register. In tutorial 14,  we used Getkey to scan for for a keypress on the keyboard. Getkey then stored the key code into the "a" register. We then compared the key code with the defined keycodes from the beginning of the program. If they were equal, it moved the dot.

Tutorial 19

This help file has been produced using helpMATIC Pro V1.22 Shareware

http://members.aol.com/harbsg/

The above message will not appear in the registered version


Tutorial 19

Registers - Their uses (Part 2)

Overview

This tutorial will cover the more complicated in depth uses of the ld instruction.

Ld, ld, ld!

More complicated uses of ld involve moving data between the memory and the registers. As you know, the memory is accessed through addresses. The ld instruction is used to load data between a register and a memory location specified by an address. This address can be a raw value:

ld   a, ($80DF)

This will load the value stored at memory location $80DF and put it into register a. The parentheses around the number indicates that the number is being used as an address, not as a value.

In the previous example, loading a single register from memory using a specific address, we have to use register A. This means that we cannot load any other register directly from memory. Instead, we have to load from memory into A and then from A into the register:

ld   a, ($80DF)

ld   c, a

We can also load two bytes of data from memory at once:

ld   bc, ($80D3)

This loads two bytes of data from ($80D3) into register pair bc. Actually, it loads from two memory locations - ($80D3) into b and ($80D4) into c. When loading a pair like this, we can use any pair we want.  Another method is to use the register pair hl to hold the address for us:

ld   hl, $80DF

ld   a, (hl)

The first ld loads a value into hl. The second one uses that value in hl as an address, and loads data from that address into a. It has exactly the same effect as the previous ld example. Notice that $80DF does not have parentheses around it. In the first ld, $80DF is only a value, not an address. Only in the second ld is it an address, so we put parentheses around hl to show its value is an address. We can load from memory into any register, but we cannot load into a register pair or use any other register besides hl to hold the address.

Now let's move data from the registers back into memory. The simplest way is to use an immediate value for the address:

ld   ($80DF), a

This loads the value in register A into memory location $80DF. When moving data from register into memory this way, we are restricted to using the A register. In other words, we can't load register C or any other directly into memory - we have to load the register into A, and then A into the memory.

We can also store a register pair into two memory locations:

ld   ($80DF), bc

Again, this loads into two different memory locations. We can use any register pair here.

As above, we can use a register pair to hold the address we are using:

ld   (hl), 123

This loads the value 123 into the memory location whose address is stored in HL. We can only use HL for this.

ld   (hl), a

ld   (hl), e

ld   (bc), a

Here are three examples of loading a register into memory whose address is not immediate. We can use HL to store the address and load from any register or we can use any register pair and load from A. We cannot do both, like:

ld   (bc), d     ; You can't do this

You have to use either hl for the address or a for the data.

Conclusion

This is all you need to know about registers up to now. Other tutorials will be written later as needed. If you still have questions e-mail me.

Tutorial 20

This help file has been produced using helpMATIC Pro V1.22 Shareware

http://members.aol.com/harbsg/

The above message will not appear in the registered version


Z80 Insructions (Complete)
Z80 Insruction Set (Complete)

The most Comprehensive resource on Z80 Insructions!

Mnemonic:	Description:

ADC	ADD WITH CARRY

ADD	ADD

AND	LOGICAL AND

BIT	BIT TEST

CALL	CALL SUB ROUTINE

CCF	COMPLEMENT CARRY FLAG

CP	COMPARE

CPD	COMPARE AND DECREMENT

CPDR	COMPARE DECREMENT AND REPEAT

CPI	COMPARE AND INCREMENT

CPIR	COMPARE INCREMENT AND REPEAT

CPL	COMPLEMENT ACCUMULATOR

DAA	DECIMAL ADJUST ACCUMULATOR

DEC	DECREMENT

DI	DISABLE INTERRUPTS

DJNZ	DEC JUMP NON-ZERO

EI	ENABLE INTERRUPTS

EX	EXCHANGE REGISTER PAIR

EXX	EXCHANGE ALTERNATE REGISTERS

HALT	HALT, WAIT FOR INTERRUPT OR RESET

IM	INTERRUPT MODE 0 1 2

IN	INPUT FROM PORT

INC	INCREMENT

IND	INPUT, DEC HL, DEC B

INDR	INPUT, DEC HL, DEC B, REPEAT IF B>0

INI	INPUT, INC HL, DEC B

INIR	INPUT, INC HL, DEC B, REPEAT IF B>0

JP	JUMP

JR	JUMP RELATIVE

LD	LOAD DATA TO/FROM REGISTERS/MEMORY

LDD	LOAD DECREMENT

LDDR	LOAD DECREMENT AND REPEAT

LDI	LOAD AND INCREMENT

LDIR	LOAD INCREMENT AND REPEAT

NEG	NEGATE ACCUMULATOR 2'S COMPLEMENT

NOP	NO OPERATION

OR	--

OTDR	OUTPUT, DEC HL, DEC B, REPEAT IF B>0

OTIR	OUTPUT, INC HL, DEC B, REPEAT IF B>0

OUT	OUTPUT TO PORT

OUTD	OUTPUT, DEC HL, DEC B

OUTI	OUTPUT, INC HL, DEC B

POP	POP FROM STACK

PUSH	PUSH INTO STACK

RES	RESET BIT

RET	RETURN FROM SUB ROUTINE

RETI	RETURN FROM INTERRUPT

RETN	RETURN FROM NON MASKABEL INTERRUPT

RL	ROTATE LEFT register

RLA	ROTATE LEFT ACUMULATOR

RLC	ROTATE LEFT THROUGH CARRY register

RLCA	ROTATE LEFT THROUGH CARRY ACCUMULATUR

RLD	ROTATE LEFT DIGIT

RR	ROTATE RIGHT register

RRA	ROTATE RIGHT ACCUMULATOR

RRC	ROTATE RIGHT CIRCULAR register

RRCA	ROTATE RIGHT CIRCULAR ACCUMULATOR

RRD	ROTATE RIGHT DIGIT

RST	RESTART

SBC	SUBTRACT WITH CARRY

SCF	SET CARRY FLAG

SET	SET BIT

SLA	SHIFT LEFT ARITHMETIC register

SRA	SHIFT RIGHT ARITHMETIC register

SRL	SHIFT RIGHT LOGICAL register

SUB	SUBTRACTION

XOR	EXCLUSIVE OR

Detailed info ADC

ADD WITH CARRY

Detailed info ADD

Detailed info AND

LOGICAL AND

Detailed info BIT

BIT TEST

Detailed info CALL

CALL a subroutine

Detailed info CCF

Opperation: CY = Inv CY

Instruction Format:

Opcode: CCF

OBJ: 3Fh

Description:

The Carry flag in the flags register is inverted.

Tstates: 4.

Flags:

S: Not affected.

Z: Not affected.

H: Pprevious carry will be copied to H.

P/V: Not affected.

N: Reset.

C: Set if carry was 0 before operation, reset otherwise.

Detailed info CP

COMPARE

Detailed info CPD

COMPARE AND DECREMENT

Detailed info CPDR

COMPARE DECREMENT AND REPEAT

Flags: CY Z  PV S  N  H

       .  ~  ~  ~  1  ~ (~ = changes, . = no change)

And the flags: if byte found: Z=1; HL - address of next byte;

                                   BC - figure out by yourself.

                   not found: Z=0

Detailed info CPI

COMPARE AND INCREMENT

Detailed info CPIR

COMPARE INCREMENT AND REPEAT

Flags: CY Z  PV S  N  H

       .  ~  ~  ~  1  ~ (~ = changes, . = no change)

And the flags: if byte found: Z=1; HL - address of next byte;

                                   BC - figure out by yourself.

                   not found: Z=0

I believe, that if on exit BC=0 then PV=0 else PV=1, that's so with CPI

(CPD) command, so why shouldn't it be with CPIR (CPDR)?

So the difference between if a byte, is or is not found, is expressed

by the Zero flag. Sorry, don't know exactly how are S and H affected...

Detailed info CPL

COMPLEMENT ACCUMULATOR

Detailed info DAA

Instruction Format:

OPCODE                    CYCLES

--------------------------------

  27h                       4

Description:

This instruction conditionally adjusts the accumulator for BCD addition

and subtraction operations. For addition (ADD, ADC, INC) or subtraction

(SUB, SBC, DEC, NEC), the following table indicates the operation performed:

--------------------------------------------------------------------------------

|           | C Flag  | HEX value in | H Flag | HEX value in | Number  | C flag|

| Operation | Before  | upper digit  | Before | lower digit  | added   | After |

|           | DAA     | (bit 7-4)    | DAA    | (bit 3-0)    | to byte | DAA   |

|------------------------------------------------------------------------------|

|           |    0    |     0-9      |   0    |     0-9      |   00    |   0   |

|   ADD     |    0    |     0-8      |   0    |     A-F      |   06    |   0   |

|           |    0    |     0-9      |   1    |     0-3      |   06    |   0   |

|   ADC     |    0    |     A-F      |   0    |     0-9      |   60    |   1   |

|           |    0    |     9-F      |   0    |     A-F      |   66    |   1   |

|   INC     |    0    |     A-F      |   1    |     0-3      |   66    |   1   |

|           |    1    |     0-2      |   0    |     0-9      |   60    |   1   |

|           |    1    |     0-2      |   0    |     A-F      |   66    |   1   |

|           |    1    |     0-3      |   1    |     0-3      |   66    |   1   |

|------------------------------------------------------------------------------|

|   SUB     |    0    |     0-9      |   0    |     0-9      |   00    |   0   |

|   SBC     |    0    |     0-8      |   1    |     6-F      |   FA    |   0   |

|   DEC     |    1    |     7-F      |   0    |     0-9      |   A0    |   1   |

|   NEG     |    1    |     6-F      |   1    |     6-F      |   9A    |   1   |

|------------------------------------------------------------------------------|

Flags:

C: See instruction.

N: Unaffected.

P/V: Set if Acc. is even parity after operation, reset otherwise.

H: See instruction.

Z: Set if Acc. is Zero after operation, reset otherwise.

S: Set if most significant bit of Acc. is 1 after operation, reset otherwise.

Example:

If an addition operation is performed between 15 (BCD) and 27 (BCD), simple decimal

arithmetic gives this result:

    15

   +27

   ----

    42

But when the binary representations are added in the Accumulator according to

standard binary arithmetic:

   0001 0101  15

  +0010 0111  27

  ---------------

   0011 1100  3C

The sum is ambiguous. The DAA instruction adjusts this result so that correct

BCD representation is obtained:

   0011 1100  3C result

  +0000 0110  06 +error

  ---------------

   0100 0010  42 Correct BCD!

Detailed info DEC

DECREMENT

Detailed info DI

DISABLE INTERRUPTS

Detailed info DJNZ

DEC JUMP NON-ZERO

Detailed info EI

ENABLE INTERRUPTS

Detailed info EX

EXCHANGE REGISTER PAIR

ASM: EX  DE,HL

OBJ: EBh

Tstates : 4.

ASM: EX  AF,AF'

OBJ: 08h

Tstates : 4.

Description:

The 16bit value in the two registers are exchanged.

note: register pair AF consists of register A and the flags register F

ASM: EX  (SP),HL

OBJ: E3h

Tstates : 19.

Description:

The low order byte contained in register pait HL is exchanged with the contents

of the memory address spefified by the contents of register pair SP (Stack Pointer),

and the high order byte of HL is exchanges with the next highest memory address (SP+1).

H <-> (SP+1) , L <-> (SP)  this will not affect the contents of SP.

ASM: EX  (SP),IX

OBJ: DDh, E3h

Tstates : 23.

ASM: EX  (SP),IY

OBJ: FDh, E3h

Tstates : 23.

Description:

Does the same as above.

eg:  IXH <-> (SP+1), IXL <-> (SP)  IXH = IX height byte, IXL = IX low byte..

Detailed info EXX

EXCHANGE ALTERNATE REGISTERS

ASM: EXX

OBJ: D9h

Tstates : 4.

Description:

Each 16bit value in register pairs BC, DE, HL is exchanged with the 16bit value in BC', DE', HL' respectively.

eg:

BC <-> BC'

DE <-> DE'

HL <-> HL'

Detailed info HALT

HALT, WAIT FOR INTERRUPT OR RESET

ASM: HALT

OBJ: 76h

Tstates : 4.

Description:

The HALT instruction suspends CPU operation until a interrupt or reset is received.

While in the halted state, the processor will execute NOP's to maintain memory refresh logic.

Detailed info IM

INTERRUPT MODE 0 1 2

Detailed info IN

INPUT FROM PORT

Detailed info INC

INCREMENT

Detailed info IND

Instruction Format:

OPCODE        CYCLES

-------------------------------

 ED  AA         16

Description:

The contents of register C are placed on the bottom half (A0-A7) of the address

bus to select the I/O device. Register B may be used as a byte counter, and its

contents are placed on the top half (A8-A15) af the address bus at this time.

Then one byte from the selected port is placed on the data bus and written to the

CPU. The contents of the HL register pair are pointer to store the redden byte

in memory. The register pair HL is decremented, the byte counter B is decremented.

Flags:

C: Not affected.

N: Set.

P/V: UnKnown.

H: UnKnown.

Z: Set if B-1=0, reset otherwise.

S: UnKnown.

Example:

Reg C=07h

Reg B=10h

Reg HL=1000h

IO port nr. 07h contain data 7Bh

Then after the execution of

IND

The HL register pair will contain 0FFFh, and register B will contain 0Fh,

and memory location 1000h will contain 7Bh.

Detailed info INDR

Instruction Format:

OPCODE                   CYCLES

--------------------------------------------

 ED  BA         16 if B=0    21 if B >< 0

Description:

The contents of register C are placed on the bottom half (A0-A7) of the address

bus to select the I/O device. Register B is used as a byte counter, and its

contents are placed on the top half (A8-A15) af the address bus at this time.

Then one byte from the selected port is placed on the data bus and written to the

CPU. The contents of the HL register pair are pointer to store the redden byte

in memory. The register pair HL is decremented, the byte counter B is decremented.

If decrementing causes B to go to zero, the instruction is terminated. If B is not

zero, the instruction is repeated.

Flags:

C: Not affected.

N: Set.

P/V: UnKnown.

H: UnKnown.

Z: Set.

S: UnKnown.

Example:

Reg C=07h

Reg B=03h

Reg HL=1000h

IO port nr. 07h contain data 51h, A9h, 03h

Then after the execution of

INDR

The HL register pair will contain 0FFDh, and register B will contain zero,

and memory locations will have contents as follows:

Location:    Contents:

0FFEh        03h

0FFFh        A9h

1000h        51h

Detailed info INI

Instruction Format:

OPCODE        CYCLES

---------------------

 ED  A2         16

Description:

The contents of register C are placed on the bottom half (A0-A7) of the address

bus to select the I/O device. Register B may be used as a byte counter, and its

contents are placed on the top half (A8-A15) af the address bus at this time.

Then one byte from the selected port is placed on the data bus and written to the

CPU. The contents of the HL register pair are pointer to store the redden byte

in memory. Finally the byte counter B is decremented and register pair HL is incremented.

Flags:

C: Not affected.

N: Set.

P/V: UnKnown.

H: UnKnown.

Z: Set if B-1=0, reset otherwise.

S: UnKnown.

Example:

Reg C=07h

Reg B=12h

Reg HL=1000h

IO port nr. 07h contain data 7Bh

Then after the execution of

INI

Memory location 1000h will contain 7Bh, the HL register pair will contain

1001h, and register B will contain 11h.

Detailed info INIR

Instruction Format:

OPCODE                   CYCLES

--------------------------------------------

 ED  B2         16 if B=0    21 if B >< 0

Description:

The contents of register C are placed on the bottom half (A0-A7) of the address

bus to select the I/O device. Register B is used as a byte counter, and its

contents are placed on the top half (A8-A15) af the address bus at this time.

Then one byte from the selected port is placed on the data bus and written to the

CPU. The contents of the HL register pair are pointer to store the redden byte

in memory. The register pair HL is incremented, the byte counter B is decremented.

If decrementing causes B to go to zero, the instruction is terminated. If B is not

zero, the instruction is repeated.

Flags:

C: Not affected.

N: Set.

P/V: UnKnown.

H: UnKnown.

Z: Set.

S: UnKnown.

Example:

Reg C=07h

Reg B=03h

Reg HL=1000h

IO port nr. 07h contain data 51h, A9h, 03h

Then after the execution of

INIR

The HL register pair will contain 1003h, and register B will contain zero,

and memory locations will have contents as follows:

Location:    Contents:

1000h        51h

1001h        A9h

1002h        03h

Detailed info JP

JUMP to address.

Detailed info JR

JUMP to address, Relative

Detailed info LD

Instruction Format:

OPCODE  r    r'                             CYCLES

----------------------------------------------------

  01   ddd  sss     LD   r,r'    dst,src      4

Introductory note -- Binary form of opcodes

  Example:   LD r,r'

The 8-bit binary opcode is

        r  r'

     01dddsss

   ...where "ddd" is a three-bit field specifying the destination,

  and "sss" is a three-bit field specifying the source.

the value for ddd and sss is shown below:

Registers

--------------

 A = 111

 B = 000

 C = 001

 D = 010

 E = 011

 H = 100

 L = 101

Operation: dst <-- src

The contest of the source operand are loaded into the destination operand. The contents of the source operand are not affected.

Flags:

C: Unaffected.

N: Unaffected.

P/V: Unaffected.

H: Unaffected.

Z: Unaffected.

S: Unaffected.

Example: If register E, contains the value 10h, The statement:

ASM: LD H,E

OBJ: 63h

Loads the value 10H into register H.

Detailed info LDD

Instruction Format:

OPCODE          CYCLES

-----------------------------

 ED  A8           16

Description:

This instruction transfers a byte of data from memory location addressed

by the register pair HL, to the memory location addressed by the register pair DE.

Then both af these register pairs including the BC (byte counter) register pair

are decremented.

Flags:

C: Not affected.

N: reset.

P/V: Set if BC-1 is not 0, reset otherwise.

H: Reset.

Z: Not affected.

S: Not affected.

Detailed info LDDR

Instruction Format:

OPCODE          CYCLES

-----------------------------

 ED  A8           16

Description:

This instruction transfers a byte of data from memory location addressed

by the register pair HL, to the memory location addressed by the register pair DE.

Then both af these register pairs including the BC (byte counter) register pair

are decremented.

Flags:

C: Not affected.

N: reset.

P/V: Set if BC-1 is not 0, reset otherwise.

H: Reset.

Z: Not affected.

S: Not affected.

Detailed info LDI

LOAD AND INCREMENT

Detailed info LDIR

LOAD INCREMENT AND REPEAT

Detailed info NEG

NEGATE ACCUMULATOR 2'S COMPLEMENT

Detailed info NOP

NO OPERATION, not the most complicated instruction :-)

Detailed info OR

Detailed info OTDR

OUTPUT, DEC HL, DEC B, REPEAT IF B>0

Detailed info OTIR

OUTPUT, INC HL, DEC B, REPEAT IF B>0

Detailed info OUT

OUTPUT TO PORT

Detailed info OUTD

OUTPUT, DEC HL, DEC B

Detailed info OUTI

OUTPUT, INC HL, DEC B

Detailed info POP

POP FROM STACK

Detailed info PUSH

PUSH INTO STACK

Detailed info RES

RESET BIT

Detailed info RET

RETURN FROM SUB ROUTINE

Detailed info RETI

RETURN FROM INTERRUPT

Detailed info RETN

RETURN FROM NON MASKABEL INTERRUPT

Detailed info RL

Instruction Format:

ASM: RL B

OBJ: CBh, 10h

Tstates : 8.

ASM: RL C

OBJ: CBh, 11h

Tstates : 8.

ASM: RL D

OBJ: CBh, 12h

Tstates : 8.

ASM: RL E

OBJ: CBh, 13h

Tstates : 8.

ASM: RL H

OBJ: CBh, 14h

Tstates : 8.

ASM: RL L

OBJ: CBh, 15h

Tstates : 8.

ASM: RL A

OBJ: CBh, 17h

Tstates : 8.

ASM: RL (HL)

OBJ: CBh, 16h

Tstates : 15.

ASM: RL (IX+D)

OBJ: DDh, CBh, XX, 16h

Tstates : 23.

ASM: RL (IY+D)

OBJ: FDh, CBh, XX, 16h

Tstates : 23.

XX is the offset value.

Detailed info RLA

Instruction Format:

ASM: RLA

OBJ: 17h

Tstates : 4.

Detailed info RLC

Instruction Format:

ASM: RLC B

OBJ: CBh, 00h

Tstates : 8.

ASM: RLC C

OBJ: CBh, 01h

Tstates : 8.

ASM: RLC D

OBJ: CBh, 02h

Tstates : 8.

ASM: RLC E

OBJ: CBh, 03h

Tstates : 8.

ASM: RLC H

OBJ: CBh, 04h

Tstates : 8.

ASM: RLC L

OBJ: CBh, 05h

Tstates : 8.

ASM: RLC A

OBJ: CBh, 07h

Tstates : 8.

ASM: RLC (HL)

OBJ: CBh, 06h

Tstates : 15.

ASM: RLC (IX+D)

OBJ: DDh, CBh, XX, 06h

Tstates : 23.

ASM: RLC (IY+D)

OBJ: FDh, CBh, XX, 06h

Tstates : 23.

XX is the offset value.

Detailed info RLCA

Instruction Format:

ASM: RLCA

OBJ: 07h

Tstates : 4.

Detailed info RLD

Instruction Format:

ASM: RLD

OBJ: EDh, 6Fh

Tstates : 18.

Detailed info RR

Instruction Format:

ASM: RR B

OBJ: CBh, 18h

Tstates : 8.

ASM: RR C

OBJ: CBh, 19h

Tstates : 8.

ASM: RR D

OBJ: CBh, 1Ah

Tstates : 8.

ASM: RR E

OBJ: CBh, 1Bh

Tstates : 8.

ASM: RR H

OBJ: CBh, 1Ch

Tstates : 8.

ASM: RR L

OBJ: CBh, 1Dh

Tstates : 8.

ASM: RR A

OBJ: CBh, 1Fh

Tstates : 8.

ASM: RR (HL)

OBJ: CBh, 1Eh

Tstates : 15.

ASM: RR (IX+D)

OBJ: DDh, CBh, XX, 1Eh

Tstates : 23.

ASM: RR (IY+D)

OBJ: FDh, CBh, XX, 1Eh

Tstates : 23.

XX is the offset value.

Detailed info RRA

Instruction Format:

ASM: RRA

OBJ: 1Fh

Tstates : 4.

Detailed info RRC

Instruction Format:

ASM: RRC B

OBJ: CBh, 08h

Tstates : 8.

ASM: RRC C

OBJ: CBh, 09h

Tstates : 8.

ASM: RRC D

OBJ: CBh, 0Ah

Tstates : 8.

ASM: RRC E

OBJ: CBh, 0Bh

Tstates : 8.

ASM: RRC H

OBJ: CBh, 0Ch

Tstates : 8.

ASM: RRC L

OBJ: CBh, 0Dh

Tstates : 8.

ASM: RRC A

OBJ: CBh, 0Fh

Tstates : 8.

ASM: RRC (HL)

OBJ: CBh, 0Eh

Tstates : 15.

ASM: RRC (IX+D)

OBJ: DDh, CBh, XX, 0Eh

Tstates : 23.

ASM: RRC (IY+D)

OBJ: FDh, CBh, XX, 0Eh

Tstates : 23.

XX is the offset value.

Detailed info RRCA

Instruction Format:

ASM: RRCA

OBJ: 0Fh

Tstates : 4.

Detailed info RRD

Instruction Format:

ROTATE RIGHT DIGIT

ASM: RRD

OBJ: EDh, 67h

Tstates : 18.

Detailed info RST

Instruction Format:

OPCODE   CALL ADDRESS   MNEMONIC    CYCLES

----------------------------------------------------

  C7h    0000h          RST 0

  CFh    0008h          RST 8

  D7h    0010h          RST 16

  DFh    0018h          RST 24

  E7h    0020h          RST 32

  EFh    0028h          RST 40

  F7h    0030h          RST 48

  FFh    0038h          RST 56

Detailed info SBC

SUBTRACT WITH CARRY

Detailed info SCF

Opperation: CY = 1

Instruction Format:

Opcode: SCF

OBJ: 37h

Description:

The Carry flag in the flags register is set (1).

Tstates: 4.

Flags:

S: Not affected.

Z: Not affected.

H: Reset

P/V: Not affected.

N: Reset.

C: Set

Detailed info SET b, r

Operation: rb = 1

Instruction Format:

CBh

Bit b in register r is set. Operands b and r are specified as follows:

Bit   b        Register   r

 0   000          B      000

 1   001          C      001

 2   010          D      010

 3   011          E      011

 4   100          H      100

 5   101          L      101

 6   110          A      111

 7   111

Tstates: 8.

Flags: None Affected

Example:

ASM: SET 3,D

OBJ: CBh, DAh

Detailed info SET b, (HL)

Operation: (HL)b = 1

Instruction Format:

CBh

Bit b in the memory location addressed by the contents of register pair HL is set. Operands b is specified as follows:

Bit   b

 0   000

 1   001

 2   010

 3   011

 4   100

 5   101

 6   110

 7   111

Tstates: 15.

Flags: None Affected

Example:

ASM: SET 5,(HL)

OBJ: CBh, EEh

Detailed info SET b, (IX+d)

Operation: (IX+d)b = 1

Instruction Format:

DDh

CBh

Bit b is set, in the memory location addressed by the sum of the contents of register IX and the two's complement integer d. (d = adr. offset)

Operands b is specified as follows:

Bit   b

 0   000

 1   001

 2   010

 3   011

 4   100

 5   101

 6   110

 7   111

Tstates: 23.

Flags: None Affected

Example:

ASM: SET 0,(IX+3h)

OBJ: DDh, CBh, 03h, C6h

If the contents of index Register IX are 2000h, then bit 0 in memory location 2003h will be 1 (set).

Bit 0 is the least significant bit)

Detailed info SET b, (IY+d)

Operation: (IY+d)b = 1

Instruction Format:

FDh

CBh

Bit b is set, in the memory location addressed by the sum of the contents of register IY and the two's complement integer d. (d = adr. offset)

Operands b is specified as follows:

Bit   b

 0   000

 1   001

 2   010

 3   011

 4   100

 5   101

 6   110

 7   111

Tstates: 23.

Flags: None Affected

Example:

ASM: SET 0,(IY+47h)

OBJ: DDh, CBh, 47h, C6h

If the contents of index Register IX are 2000h, then bit 0 in memory location 2047h will be 1 (set).

Bit 0 is the least significant bit)

Detailed info SLA

Instruction Format:

ASM: SLA B

OBJ: CBh, 20h

Tstates : 8.

ASM: SLA C

OBJ: CBh, 21h

Tstates : 8.

ASM: SLA D

OBJ: CBh, 22h

Tstates : 8.

ASM: SLA E

OBJ: CBh, 23h

Tstates : 8.

ASM: SLA H

OBJ: CBh, 24h

Tstates : 8.

ASM: SLA L

OBJ: CBh, 25h

Tstates : 8.

ASM: SLA A

OBJ: CBh, 27h

Tstates : 8.

ASM: SLA (HL)

OBJ: CBh, 26h

Tstates : 15.

ASM: SLA (IX+D)

OBJ: DDh, CBh, XX, 26h

Tstates : 23.

ASM: SLA (IY+D)

OBJ: FDh, CBh, XX, 26h

Tstates : 23.

XX is the offset value.

Detailed info SRA

Instruction Format:

ASM: SRA B

OBJ: CBh, 28h

Tstates : 8.

ASM: SRA C

OBJ: CBh, 29h

Tstates : 8.

ASM: SRA D

OBJ: CBh, 2Ah

Tstates : 8.

ASM: SRA E

OBJ: CBh, 2Bh

Tstates : 8.

ASM: SRA H

OBJ: CBh, 2Ch

Tstates : 8.

ASM: SRA L

OBJ: CBh, 2Dh

Tstates : 8.

ASM: SRA A

OBJ: CBh, 2Fh

Tstates : 8.

ASM: SRA (HL)

OBJ: CBh, 2Eh

Tstates : 15.

ASM: SRA (IX+D)

OBJ: DDh, CBh, XX, 2Eh

Tstates : 23.

ASM: SRA (IY+D)

OBJ: FDh, CBh, XX, 2Eh

Tstates : 23.

XX is the offset value.

Detailed info SRL

Instruction Format:

ASM: SRL B

OBJ: CBh, 38h

Tstates : 8.

ASM: SRL C

OBJ: CBh, 39h

Tstates : 8.

ASM: SRL D

OBJ: CBh, 3Ah

Tstates : 8.

ASM: SRL E

OBJ: CBh, 3Bh

Tstates : 8.

ASM: SRL H

OBJ: CBh, 3Ch

Tstates : 8.

ASM: SRL L

OBJ: CBh, 3Dh

Tstates : 8.

ASM: SRL A

OBJ: CBh, 3Fh

Tstates : 8.

ASM: SRL (HL)

OBJ: CBh, 3Eh

Tstates : 15.

ASM: SRL (IX+D)

OBJ: DDh, CBh, XX, 3Eh

Tstates : 23.

ASM: SRL (IY+D)

OBJ: FDh, CBh, XX, 3Eh

Tstates : 23.

XX is the offset value.

Detailed info SUB

Operation: A = A - s

The s operand is subtracted from the contents of the accumulator, and the result is stored in the Accumulator.

ASM: SUB B

OBJ: 90h

Tstates : 4.

ASM: SUB C

OBJ: 91h

Tstates : 4.

ASM: SUB D

OBJ: 92h

Tstates : 4.

ASM: SUB E

OBJ: 93h

Tstates : 4.

ASM: SUB H

OBJ: 94h

Tstates : 4.

ASM: SUB L

OBJ: 95h

Tstates : 4.

ASM: SUB A

OBJ: 97h

Tstates : 4.

ASM: SUB n

OBJ: D6h, n

Tstates : 7.

ASM: SUB (HL)

OBJ: 96h

Tstates : 7.

ASM: SUB (IX+d)

OBJ: DDh, 96h, d

Tstates : 19.

ASM: SUB (IY+d)

OBJ: FDh, 96h, d

Tstates : 19.

Flags:

S: Set if result is negative, reset otherwise.

Z: Set if result is Zero, reset otherwise.

H: Set if borrow from Bit4, reset otherwise.

P/V: Set if overflow, reset otherwise.

N: Reset.

C: Set if borrow, reset otherwise.

Example: If Accumulator contains 29h, and register D contains 11h, after the execution of:

ASM: SUB D

OBJ: 92h

The Accumulator will contain 18h.

Detailed info XOR

Operation: A = A xor s

A logical exclusive-OR opperation is performed between the byte specified by the s opperand and the byte contained in the Accumulator, the result is stored in the Accumulator.

ASM: XOR B

OBJ: A8h

Tstates : 4.

ASM: XOR C

OBJ: A9h

Tstates : 4.

ASM: XOR D

OBJ: AAh

Tstates : 4.

ASM: XOR E

OBJ: ABh

Tstates : 4.

ASM: XOR H

OBJ: ACh

Tstates : 4.

ASM: XOR L

OBJ: ADh

Tstates : 4.

ASM: XOR A

OBJ: AFh

Tstates : 4.

ASM: XOR n

OBJ: EEh, n

Tstates : 7.

ASM: XOR (HL)

OBJ: AEh

Tstates : 7.

ASM: XOR (IX+d)

OBJ: DDh, AEh, d

Tstates : 19.

ASM: XOR (IY+d)

OBJ: FDh, AEh, d

Tstates : 19.

Flags:

S: Set if result is negative, reset otherwise.

Z: Set if result is Zero, reset otherwise.

H: Reset.

P/V: Set if parity even, reset otherwise.

N: Reset.

C: Reset.

Example: If the Accumulator contains 96h (10010110), and register D contains 5Dh (01011101) , after the execution of:

ASM: XOR D

OBJ: AAh

The Accumulator will contain CBh (11001011).

This help file has been produced using helpMATIC Pro V1.22 Shareware

http://members.aol.com/harbsg/

The above message will not appear in the registered version


Tutorial 20

Using an Include File

Overview

Now that you are familiar with Z80 Asm, I will now introduce the concept of Include files. An Include file is simply a file with predefined ROM calls in it. In other words, you won't have to define every ROM call you use in your programs because they will have already been defined! This tutorial will cover how to use an include file and what is in an include file.

The Include File

To include an include file or any other file in to your program, you must use the #include statement. Those of you who are familiar with C or C++ will know that #include statement simply includes a file into the program. To use the include file, you must also define equ, EQU, end, and END. TASM is case sensitive about these things. This simply tells the assembler that EQU is the same thing as equ, and end is the same thing as END! Now, when using the Include file, the HEADER and DEFINES and EQUATES part of your program must be left out because they are included in the include file. I recommend that you use the TI83PlusAsm.inc file included with this help file. It is the TI83Plus include file provided by TI only adapted for use with TASM and optimized for TI-83 Plus Assembler programming by me. You must also type .NOLIST and .LIST before and after the the header. This is what the start of a program would look like if you used an Include file:

.NOLIST	;Defines what isn't code

#define     equ              .equ

#define     EQU             .equ

#define     END             .end

#include "Ti83PlusAsm.inc"	;assuming you used my include file

.LIST	;Defines what is code

Remeber, the above source will replace the HEADER and DEFINES and EQUATES section, there is no need to include them anymore. Although you still need the PROGRAM START, BODY, and END.

Example

Here is an example of a program that uses and include file:

.NOLIST

#define     equ              .equ	;The Include File to be used must be in the same folder as the program being assembled.

#define     EQU             .equ

#define     END             .end

#include "Ti83PlusAsm.inc"

.LIST

.org	9D95h	;This tells the calculator that the program will start at the mem adress 9D95h

B_CALL(_homeup)	;Bringing up the home screen

B_CALL(_clrlcdfull)	;Clearing the screen

ret	;Returning to TI-OS

.end

END

Conclusion

The #include statement isn't always used to include include files. It can also be used any where in the program to include picture source, other programs, etc. For example, in tutorial 15, we used it to include the source for the title screen. It simply took everything that was in the title.asm file and pasted it to that part of the program. Using include files will help us because now that you are more comftorable with Asm, we will learn even more ROM calls. Who has time to define each one by hand?

Tutorial 21

This help file has been produced using helpMATIC Pro V1.22 Shareware

http://members.aol.com/harbsg/

The above message will not appear in the registered version


Tutorial 21

Enabling Lowercase letters

Overview

Are you tired of typing only uppercase letters at the homescreen, program editor, etc. on the TI-83 Plus? I am. So let's make a program to solve this problem. The following program will enable the TI-83 Plus' lowercase Alpha feature.

Programming

.NOLIST

#define     equ             .equ

#define     EQU             .equ

#define     END             .end

#include "ti83plusAsm.inc"	;Remember, we're using an include file, though in this program, an include file is not nessasary because no ROM calls are used.

.LIST

.org 9D95h

set 3,(iy+$24)	;Set the lowercase alpha

ret	;Return from program

.end

END

Now when you hit the Alpha key twice, the cursor becomes an "a" instead of the "A". Thus when you type with a lowercase Alpha key enabled, the letters you type will be lowercase.

But what if you want to reset the lowercase alpha key if you don't want to type in lowercase? Simple, use the "res" command to reset that flag. Here, I'll show you:

.NOLIST

#define     equ             .equ

#define     EQU             .equ

#define     END             .end

#include "ti83plusAsm.inc"

.LIST

.org 9D95h

res 3,(iy+$24)	;Notice that we are Reseting this text flag.

ret

.end

END

Then, you can run this program to reset the lowercase alpha. Or you could just reset your defaults form your Mem Mgmt screen. =)

Tutorial 22

This help file has been produced using helpMATIC Pro V1.22 Shareware

http://members.aol.com/harbsg/

The above message will not appear in the registered version


Tutorial 23

Assembly Language Shells - Using Ion

Introduction

Shells are calculator programs that make it easier to setect and run assembly language shells. Some shells, such as Ion, provide the user with a few special routines, which may make a programmers life easier.

What is Ion?

Ion is an Assembly Language Shell for the TI-83 and TI-83 Plus written by Joe Wingbermuehle. Some special features about Ion is that you are able to use routines unique only to Ion! Another good thing about Ion is that programs assembled for Ion will run on both the TI-83 and TI-83 Plus. This tutorial will show you how to make a program that runs under Ion.

Thngs to Know

Ion is TI-83 Plus Asm. Ion is a shell that runs Asm programs. For Ion to detect an Asm program, it must have the following header at the top of the program. If you look at some very well written Ion games/programs, you will see that there may not be any obvious header. This is okay, as long as the contents is somewhere in there. Ion programs must also use the Ion include file. This is because special Ion routines are located there and using the Ion include file allows the user to assemble the program for the TI-83 and TI-83 Plus. Ion programs also use the bcall() macro to call ROM calls rather than the more familiar B_CALL() macro.

Programming

All programs that you want displayed by Ion should have the following header at the beginning of every program:

.nolist

#include "ion.inc" 	;This is the Ion include file that must be used with Ion.

   	#ifdef TI83P

.org    progstart-2	;Program start - 9D95h - As defined in the Ion include file.

.db     $BB,6D

#else

.org    progstart	;Program start for the TI-83 - 9237h

#endif

ret

jr      nc,Start	;Jump to start label of program

.db     "program name",0	;This is the name Ion displays

Start: 	;Your program begins here

Here is a sample program written for Ion that displays text on the screen:

.nolist

        #include "ion.inc"

        .list

#ifdef TI83P

        .org    progstart-2

        .db     $BB,6D

#else

        .org    progstart

#endif

        ret

        jr      nc,Start

        .db     "Display text",0	;Name of Program

Start: 	;Start of the program

bcall(_clrlcdf)	;Clear Screen

bcall(_homeup) 	;Bring up the home screen

ld	a,0	;Load 0 to the a register

ld	(CURCOL),a	;Load coordinates to CURCOL

ld	a,0

ld	(CURROW),a

ld	hl,txtDisplay

bcall(_puts)

bcall(_getkey)	;Wait for keypress

bcall(_clrlcdf)

ret

txtDisplay:

.db	"This is the text "

.db	"that this prgrm"

.db	"will display.      "

.db	"Each line can be"

.db	"16 characters  "

.db	"long, and can  "

.db	"only be 7 lines ",0

.end

END

Assembling Ion programs

Ion programs, unlike TI-OS Asm programs, need to be compiled using Devpac83 and the Asm.bat batch file included with Ion. More information can be found in the Ion documentation included with Ion.

Conclusion

Ion is very useful, especially when it comes to assembling Asm programs compatible with both the TI-83 and TI-83 Plus. More advanced uses of Ion's libraries can be found in Matt Hernandez's IonGuru!

Tutorial 24

This help file has been produced using helpMATIC Pro V1.22 Shareware

http://members.aol.com/harbsg/

The above message will not appear in the registered version


Tutorial 22

Porting

What is Porting?

Porting, in our case, is the act of converting TI-83 Plus Asm code to TI-83 Asm, and vice versa.

Porting - TI-83 > TI-83 Plus

Let's say you wanted to port the Asm source code of a TI-83 program, to TI-83 Plus Asm source. To do so, you must change some things.

1. You must include an include file that defines ROM calls for the TI-83 Plus.

2. You must change a call macros in the source that are calling ROM calls to B_CALL.

3. Change the program start address from 9327h to 9D95h.

Porting - TI-83 Plus > TI-83

To port a TI-83 Plus Asm program to TI-83 Asm code, do the following:

1. Change all B_CALL  macros to call and do not enclose the ROM call in parentheses.

2. Include the ti83asm and the tokens include files instead of the ti83PlusAsm include file.

3. Change the program start from 9D95h to 9327h.

4. Make sure the TI-83 Plus program does not use SafeRAM areas the TI-83 dosn't have.

Example

In this example, I'm converting TI-83 source to TI-83 Plus source.

TI-83 Source:

.NOLIST	; Defines area which isn't code.

#define end .end

#define END .end

#define equ .equ

#define EQU .equ

#include "ti83asm.inc"

#include "tokens.inc"

.LIST	; Defines area which IS code.

.org 9327h

call _clrLCDFull

ret

.end

END

Here's the TI-83 Plus source after porting:

.NOLIST	; Defines area which isn't code.

#define end .end

#define END .end

#define equ .equ

#define EQU .equ

#include "ti83PlusAsm.inc"

.LIST	; Defines area which IS code.

.org 9D95h

B_CALL( _clrLCDFull)

ret

.end

END

Conclusion

Now that you know this, you can port your favorite TI-83 Games (Programs) to TI-83 Plus Asm and vice versa. Assuming you have the source code of course.

Tutorial 23

This help file has been produced using helpMATIC Pro V1.22 Shareware

http://members.aol.com/harbsg/

The above message will not appear in the registered version


Tutorial 24

Program creating programs

Overview

This proves the power of Asm. This tutorial will cover the uses of the _CreateProg (_CreateProg = 4339h) and  _CreateProtProg (_CreatProtProg = 4E6Dh) ROM calls. Both these ROM calls create programs on the TI-83 Plus. The difference between the two ROM calls is that _CreateProg creates a program that can be edited on the calculator and _CreateProtProg creates a program that cannot be edited on the calculator.

Programming

This program will create an Asm Getkey program and a TIBasic program to run the Getkey program.

.NOLIST	;This program may look long, but most of it is the required stuff.

#define     equ             .equ

#define     EQU             .equ

#define     END             .end

#include "ti83PlusAsm.inc"

.LIST

.org        9D95h

  B_CALL(_clrLCDFull)

  B_CALL(_Homeup)  	;Clear screen.

  ld   hl,prgmcreate	;Load the Text under the PrgmCreate label

  B_CALL(_puts)

  B_CALL(_Newline)

  ld   hl,asmcreate	;Load the Asmcreate text

  B_CALL(_puts)	;Display the text

  B_CALL(_zeroop1)    	;Set Op1 to zero

  ld hl,progname1   	;the name of the prog

  ld de,op1         	;copy it to op1

  ld bc,5           	;5 chars in name

  ldir              	;copying name...

  ld hl,241          	;length of program (in bytes)

  B_CALL(_createprog)  	;create it unprotexted program (can be edited on calculator)

  inc de            	;skip 1st length byte

  inc de            	;skip 2nd length byte

  ld hl,prog1       	;program data under prog1 label (Asm program data)

  ld bc,241          	;program data length

  ldir              	;copy program data

  ld   hl,basiccreate	;Load text from Basiccreate label

  B_CALL(_puts)

  B_CALL(_zeroop1)

  ld hl,progname2   	;the name of the prog

  ld de,op1         	;copy it to op1

  ld bc,7           	;7 chars in name

  ldir              	;copying name...

  ld hl,6           	;length of program (in bytes)

  B_CALL(_createprog)  	;create it

  inc de            	;skip 1st length byte

  inc de            	;skip 2nd length byte

  ld hl,prog2       	;program data

  ld bc,6           	;program data length

  ldir              	;copy data

  ret

progname1:

   .db PROGOBJ,"ASM",0	;"ASM" is the name of the Asm Getkey program

prog1:	;Asm progam data

   .db t2bytetok,tAsmPrgm,tEnter	;See Tokens section below for explanation

   .db "EF4045EF5845",tEnter

   .db "21EC9DEF0A45",tEnter

   .db "EF7249F5EF40",tEnter

   .db "45EF584521F8",tEnter

   .db "9DEF0A45F1CD",tEnter

   .db "BC9DEF7249EF",tEnter

   .db "2E45C9F5E6F0",tEnter

   .db "1F1F1F1F6F26",tEnter

   .db "0011DC9DD519",tEnter

   .db "7EEF0445D1F1",tEnter

   .db "E60F6F260019",tEnter

   .db "7EEF0445C930",tEnter

   .db "313233343536",tEnter

   .db "373839414243",tEnter

   .db "444546507573",tEnter

   .db "682061206B65",tEnter

   .db "792E004B6579",tEnter

   .db "20636F64653A",tEnter

   .db "2000"

progname2:

   .db PROGOBJ,"BASIC",0	;Basic program name

prog2:

   .db t2bytetok,tAsm,tProg,"ASM"	;Basic program data

prgmcreate:

   .db "Program Creator!",0

asmcreate:

   .db "Creating ASM...",0

basiccreate:

   .db "Creating BASIC...",0

.end

END

If you wanted to create programs that can't be edited on the calc, replace _createprog with  _createprotprog.

New Commands

_CreateProg - Creates a program that can be edited

_CreateProtProg - Creates a program that cannot be edited

ldir - Loads data from one place to another

Tokens

The hardest thing about making program creating programs is surprisingly the tokens. Think of the TIBasic commands Clrhome and Disp. They are tokens. So are Cos( and Sin( and Tan( and everything else you paste to the TI's screen by pressing a button or looking in a menu. We all know that each text character you type is 1 byte each. How much memory does the Calculator have? Not much compared to my computer's Hard Drive. So instead of saving the commands (Clrhome, Disp, Cos(, Sin(, Tan(, etc.) by each character, Texas Instruments was smart and saved each of these commands to 1 byte each. Thus, the command stored in the calculators memory is called a Token. What!? We used tEnter, tprog, etc. in the program! Those are the Asm names of the tokens. The "t" stands for Token. Thus tEnter would be the equivalent of pressing Enter, or in our case, creating a new line. For a complete list of TI-83 Plus Tokens, look in the ti83PlusAsm.inc include file.

Almost every TI-83 Plus Token is 1 byte with the exception of a few. This is where even I needed help. I asked Matthew Roberts for the answer. After a few days, Voila! He had the answer. If you look at the tokens ">" and "tAsm", they have the same addresses in memory. This is because tAsm is a 2 byte token. Thats why if you assemble the program with just tAsm, the output would be ">". So to get the Asm( command instead of ">", we had to use the t2ByteTok token. This defines the token as 2 bytes. If you want to know which tokens are 2 byte, look in the ti83PlusAsm.inc include file under 2byteTokens.

 Another thing to know about program data, you must tell the calculator exactly how big the program it's making is. You would load that value to the bc register because that's where the _createprog ROM call looks fof the program size. How do you know how big your program data is? Well that's easy. Count how many Tokens and Characters you use inside quotes. Add that up and the total is your program data size in bytes. =)

Conclusion

Again, I want to thank Matthew Roberts for his help with the 2 byte tokens. Where would I be without him? Don't answer that. On to Checking your memory via an Asm program!

Tutorial 25

This help file has been produced using helpMATIC Pro V1.22 Shareware

http://members.aol.com/harbsg/

The above message will not appear in the registered version


Ti83PlusAsm include file
Ti83PlusAsm.inc

TI-83 Plus include file by TI. Edited and optimized by Jeff Chai

;======================================================================

; TI-83 Plus include file

; Adapted by Jeff Chai for use with TASM

; Optimized for TI-83 Plus Asm programming

; Please view the attached Readme file

;======================================================================

; Include File for the TI-83 Plus

; Last Updated by TI 10/27/1999

;

; Copyright (c) 1999 Texas Instruments: The Licensed Materials are

; copyrighted by TI. LICENSEE agrees that it will

; not delete the copyright notice, trademarks or

; protective notices from any copy made by LICENSEE.

;

; Warranty: TI does not warrant that the Licensed Materials will

; be free from errors or will meet your specific requirements.

; The Licensed Materials are made available "AS IS" to LICENSEE.

;

; Limitations: TI MAKES NO WARRANTY OR CONDITION, EITHER EXPRESS

; OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY IMPLIED

; WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE,

; REGARDING THE LICENSED MATERIALS.  IN NO EVENT SHALL

; TI OR ITS SUPPLIERS BE LIABLE FOR ANY INDIRECT, INCIDENTAL

; OR CONSEQUENTIAL DAMAGES, LOSS OF PROFITS, LOSS OF USE OR DATA,

; OR INTERRUPTION OF BUSINESS, WHETHER THE ALLEGED DAMAGES ARE

; LABELED IN TORT, CONTRACT OR INDEMNITY.

;

;======================================================================

;	ROM Call calling Macros

;======================================================================

#define B_CALL(xxxx)	rst 28h \ .dw xxxx

#define B_JUMP(xxxx)	call 50h \ .dw xxxx

;

;======================================================================

;           System Variable Equates

;======================================================================

;       Entry Points : RclSysTok, StoSysTok

;

XSCLt	EQU  2

YSCLt	EQU  3

XMINt	EQU  0Ah

XMAXt	EQU  0Bh

YMINt	EQU  0Ch

YMAXt	EQU  0Dh

TMINt	EQU  0Eh

TMAXt	EQU  0Fh

THETMINt	EQU  10h

THETMAXt	EQU  11h

TBLMINt	EQU  1Ah

PLOTSTARTt	EQU  1Bh

NMAXt	EQU  1Dh

NMINt	EQU  1Fh

TBLSTEPt	EQU  21h

TSTEPt	EQU  22h

THETSTEPt	EQU  23h

DELTAXt	EQU  26h

DELTAYt	EQU  27h

XFACTt	EQU  28h

YFACTt	EQU  29h

FINNt	EQU  2Bh

FINIt	EQU  2Ch

FINPVt	EQU  2Dh

FINPMTt	EQU  2Eh

FINFVt	EQU  2Fh

FINPYt	EQU  30h

FINCYt	EQU  31h

PLOTSTEPt	EQU  34h

XRESt	EQU  36h

;======================================================================

;           Run indicators

;======================================================================

busyPause	EQU	10101010b

busyNormal	EQU	11110000b

;======================================================================

;           Common subroutine RST numbers

;======================================================================

rOP1TOOP2	EQU  08h

rFINDSYM	EQU  10h

rPUSHREALO1	EQU  18h

rMOV9TOOP1	EQU  20h

rFPADD	EQU  30h

;SYMBOLIC_DEBUG_START

;======================================================================

;           Entry points

;======================================================================

_AbsO1O2Cp	EQU 410Eh

_AbsO1PAbsO2	EQU 405Ah

_ACos	EQU 40DEh

_ACosH	EQU 40F0h

_ACosRad	EQU 40D2h

_AdrLEle	EQU 462Dh

_AdrMEle	EQU 4609h

_AdrMRow	EQU 4606h

_AllEq	EQU 4876h

_AllocFPS	EQU 43A5h

_AllocFPS1	EQU 43A8h

_Angle	EQU 4102h

_AnsName	EQU 4B52h

_ApdSetup	EQU 4C93h

_AppGetCalc	EQU 4C78h

_AppGetCbl	EQU 4C75h

_Arc_Unarc	EQU 4FD8h

_ASin	EQU 40E4h

_ASinH	EQU 40EDh

_ASinRad	EQU 40DBh

_ATan	EQU 40E1h

_ATan2	EQU 40E7h

_ATan2Rad	EQU 40D8h

_ATanH	EQU 40EAh

_ATanRad	EQU 40D5h

_BinOPExec	EQU 4663h

_Bit_VertSplit	EQU 4FA8h

_BufClr	EQU 5074h

_BufCpy	EQU 5071h

_CAbs	EQU 4E97h

_CAdd	EQU 4E88h

_CanAlphIns	EQU 4C69h

_CDiv	EQU 4E94h

_CDivByReal	EQU 4EBBh

_CEtoX	EQU 4EA9h

_CFrac	EQU 4EC1h

_CheckSplitFlag	EQU 49F0h

_ChkFindSym	EQU 42F1h

_CIntgr	EQU 4EC4h

_CircCmd	EQU 47D4h

_CkInt	EQU 4234h

_CkOdd	EQU 4237h

_CkOP1C0	EQU 4225h

_CkOP1Cplx	EQU 40FCh

_CkOP1FP0	EQU 4228h

_CkOP1Pos	EQU 4258h

_CkOP1Real	EQU 40FFh

_CkOP2FP0	EQU 422Bh

_CkOP2Pos	EQU 4255h

_CkOP2Real	EQU 42DFh

_CkPosInt	EQU 4231h

_CkValidNum	EQU 4270h

_CleanAll	EQU 4A50h

_ClearRect	EQU 4D5Ch

_ClearRow	EQU 4CEDh

_CLine	EQU 4798h

_CLineS	EQU 479Bh

_CLN	EQU 4EA0h

_CLog	EQU 4EA3h

_CloseEditBufNoR	EQU 476Eh

_CloseProg	EQU 4A35h

_ClrGraphRef	EQU 4A38h

_ClrLCD	EQU 4543h

_ClrLCDFull	EQU 4540h

_ClrLp	EQU 41D1h

_ClrOP1S	EQU 425Eh

_ClrOP2S	EQU 425Bh

_ClrScrn	EQU 4549h

_ClrScrnFull	EQU 4546h

_ClrTxtShd	EQU 454Ch

_CMltByReal	EQU 4EB8h

_CmpSyms	EQU 4A4Ah

_CMult	EQU 4E8Eh

_Conj	EQU 4EB5h

_ConvDim	EQU 4B43h

_ConvDim00	EQU 4B46h

_ConvLcToLr	EQU 4A23h

_ConvLrToLc	EQU 4A56h

_ConvOP1	EQU 4AEFh

_COP1Set0	EQU 4105h

_Cos	EQU 40C0h

_CosH	EQU 40CCh

_CpHLDE	EQU 400Ch

_CPoint	EQU 4DC8h

_CPointS	EQU 47F5h

_CpOP1OP2	EQU 4111h

_CpOP4OP3	EQU 4108h

_CpyO1ToFPS1	EQU 445Ch

_CpyO1ToFPS2	EQU 446Bh

_CpyO1ToFPS3	EQU 4477h

_CpyO1ToFPS4	EQU 4489h

_CpyO1ToFPS5	EQU 4483h

_CpyO1ToFPS6	EQU 447Dh

_CpyO1ToFPS7	EQU 4480h

_CpyO1ToFPST	EQU 444Ah

_CpyO2ToFPS1	EQU 4459h

_CpyO2ToFPS2	EQU 4462h

_CpyO2ToFPS3	EQU 4474h

_CpyO2ToFPS4	EQU 4486h

_CpyO2ToFPST	EQU 4444h

_CpyO3ToFPS1	EQU 4453h

_CpyO3ToFPS2	EQU 4465h

_CpyO3ToFPST	EQU 4441h

_CpyO5ToFPS1	EQU 4456h

_CpyO5ToFPS3	EQU 4471h

_CpyO6ToFPS2	EQU 4468h

_CpyO6ToFPST	EQU 4447h

_CpyStack	EQU 4429h

_CpyTo1FPS1	EQU 4432h

_CpyTo1FPS10	EQU 43F3h

_CpyTo1FPS11	EQU 43D8h

_CpyTo1FPS2	EQU 443Bh

_CpyTo1FPS3	EQU 4408h

_CpyTo1FPS4	EQU 440Eh

_CpyTo1FPS5	EQU 43DEh

_CpyTo1FPS6	EQU 43E4h

_CpyTo1FPS7	EQU 43EAh

_CpyTo1FPS8	EQU 43EDh

_CpyTo1FPS9	EQU 43F6h

_CpyTo1FPST	EQU 4423h

_CpyTo2FPS1	EQU 442Fh

_CpyTo2FPS2	EQU 4438h

_CpyTo2FPS3	EQU 4402h

_CpyTo2FPS4	EQU 43F9h

_CpyTo2FPS5	EQU 43DBh

_CpyTo2FPS6	EQU 43E1h

_CpyTo2FPS7	EQU 43E7h

_CpyTo2FPS8	EQU 43F0h

_CpyTo2FPST	EQU 4420h

_CpyTo3FPS1	EQU 442Ch

_CpyTo3FPS2	EQU 4411h

_CpyTo3FPST	EQU 441Dh

_CpyTo4FPST	EQU 441Ah

_CpyTo5FPST	EQU 4414h

_CpyTo6FPS2	EQU 43FFh

_CpyTo6FPS3	EQU 43FCh

_CpyTo6FPST	EQU 4417h

_CpyToFPS1	EQU 445Fh

_CpyToFPS2	EQU 446Eh

_CpyToFPS3	EQU 447Ah

_CpyToFPST	EQU 444Dh

_CpyToStack	EQU 4450h

_Create0Equ	EQU 432Ah

_CreateAppVar	EQU 4E6Ah

_CreateCList	EQU 431Bh

_CreateCplx	EQU 430Ch

_CreateEqu	EQU 4330h

_CreatePair	EQU 4B0Dh

_CreatePict	EQU 4333h

_CreateProg	EQU 4339h

_CreateProtProg	EQU 4E6Dh

_CreateReal	EQU 430Fh

_CreateRList	EQU 4315h

_CreateRMat	EQU 4321h

_CreateStrng	EQU 4327h

_CRecip	EQU 4E91h

_CSqRoot	EQU 4E9Dh

_CSquare	EQU 4E8Bh

_CSub	EQU 4E85h

_CTenX	EQU 4EA6h

_CTrunc	EQU 4EBEh

_Cube	EQU 407Bh

_CursorOff	EQU 45BEh

_CursorOn	EQU 45C4h

_CXrootY	EQU 4EACh

_CYtoX	EQU 4EB2h

_DarkLine	EQU 47DDh

_DarkPnt	EQU 47F2h

_DataSize	EQU 436Ch

_DataSizeA	EQU 4369h

_DeallocFPS	EQU 439Fh

_DeallocFPS1	EQU 43A2h

_DecO1Exp	EQU 4267h

_DelListEl	EQU 4A2Fh

_DelMem	EQU 4357h

_DelRes	EQU 4A20h

_DelVar	EQU 4351h

_DelVarArc	EQU 4FC6h

_DelVarNoArc	EQU 4FC9h

_DisableApd	EQU 4C84h

_Disp	EQU 4F45h

_DispDone	EQU 45B5h

_DispEOL	EQU 45A6h

_DispHL	EQU 4507h

_DisplayImage	EQU 4D9Bh

_DispOP1A	EQU 4BF7h

_DivHLBy10	EQU 400Fh

_DivHLByA	EQU 4012h

_DrawCirc2	EQU 4C66h

_DrawCmd	EQU 48C1h

_DrawRectBorder	EQU 4D7Dh

_DrawRectBorderClear	EQU 4D8Ch

_DToR	EQU 4075h

_EditProg	EQU 4A32h

_EnableApd	EQU 4C87h

_EnoughMem	EQU 42FDh

_EOP1NotReal	EQU 4279h

_Equ_or_NewEqu	EQU 42C4h

_EraseEOL	EQU 4552h

_EraseRectBorder	EQU 4D86h

_ErrArgument	EQU 44ADh

_ErrBadGuess	EQU 44CBh

_ErrBreak	EQU 44BFh

_ErrD_OP1_0	EQU 42D3h

_ErrD_OP1_LE_0	EQU 42D0h

_ErrD_OP1Not_R	EQU 42CAh

_ErrD_OP1NotPos	EQU 42C7h

_ErrD_OP1NotPosInt	EQU 42CDh

_ErrDataType	EQU 44AAh

_ErrDimension	EQU 44B3h

_ErrDimMismatch	EQU 44B0h

_ErrDivBy0	EQU 4498h

_ErrDomain	EQU 449Eh

_ErrIncrement	EQU 44A1h

_ErrInvalid	EQU 44BCh

_ErrIterations	EQU 44C8h

_ErrLinkXmit	EQU 44D4h

_ErrMemory	EQU 44B9h

_ErrNon_Real	EQU 44A4h

_ErrNonReal	EQU 4A8Ch

_ErrNotEnoughMem	EQU 448Ch

_ErrOverflow	EQU 4495h

_ErrSignChange	EQU 44C5h

_ErrSingularMat	EQU 449Bh

_ErrStat	EQU 44C2h

_ErrStatPlot	EQU 44D1h

_ErrSyntax	EQU 44A7h

_ErrTolTooSmall	EQU 44CEh

_ErrUndefined	EQU 44B6h

_EToX	EQU 40B4h

_Exch9	EQU 43D5h

_ExLp	EQU 4222h

_ExpToHex	EQU 424Fh

_Factorial	EQU 4B85h

_FillRect	EQU 4D62h

_FillRectPattern	EQU 4D89h

_Find_Parse_Formula	EQU 4AF2h

_FindAlphaDn	EQU 4A47h

_FindAlphaUp	EQU 4A44h

_FindApp	EQU 4C4Eh

_FindAppDn	EQU 4C4Bh

_FindAppNumPages	EQU 509Bh

_FindAppUp	EQU 4C48h

_FindSym	EQU 42F4h

_FiveExec	EQU 467Eh

_FixTempCnt	EQU 4A3Bh

_FlashToRam	EQU 5017h

_ForceFullScreen	EQU 508Fh

_FormBase	EQU 50AAh

_FormDCplx	EQU 4996h

_FormEReal	EQU 4990h

_FormReal	EQU 4999h

_FourExec	EQU 467Bh

_FPAdd	EQU 4072h

_FPDiv	EQU 4099h

_FPMult	EQU 4084h

_FPRecip	EQU 4096h

_FPSquare	EQU 4081h

_FPSub	EQU 406Fh

_Frac	EQU 4093h

_GetBaseVer	EQU 4C6Fh

_GetCSC	EQU 4018h

_GetKey	EQU 4972h

_GetLToOP1	EQU 4636h

_GetMToOP1	EQU 4615h

_GetTokLen	EQU 4591h

_GrBufClr	EQU 4BD0h

_GrBufCpy	EQU 486Ah

_GrphCirc	EQU 47D7h

_HLTimes9	EQU 40F9h

_Homeup	EQU 4558h

_HorizCmd	EQU 48A6h

_HTimesL	EQU 4276h

_IBounds	EQU 4C60h

_IBoundsFull	EQU 4D98h

_ILine	EQU 47E0h

_IncLstSize	EQU 4A29h

_InsertList	EQU 4A2Ch

_InsertMem	EQU 42F7h

_Int	EQU 40A5h

_Intgr	EQU 405Dh

_InvCmd	EQU 48C7h

_InvertRect	EQU 4D5Fh

_InvOP1S	EQU 408Dh

_InvOP1SC	EQU 408Ah

_InvOP2S	EQU 4090h

_InvSub	EQU 4063h

_IOffset	EQU 4C63h

_IPoint	EQU 47E3h

_JError	EQU 44D7h

_JErrorNo	EQU 4000h

_JForceCmdNoChar	EQU 4027h

_JForceGraphKey	EQU 5005h

_JForceGraphNoKey	EQU 5002h

_KeyToString	EQU 45CAh

_LineCmd	EQU 48ACh

_LnX	EQU 40ABh

_Load_SFont	EQU 4783h

_LoadCIndPaged	EQU 501Dh

_LoadDEIndPaged	EQU 501Ah

_LoadPattern	EQU 4CB1h

_LogX	EQU 40AEh

_Max	EQU 4057h

_MemChk	EQU 42E5h

_MemClear	EQU 4C30h

_MemSet	EQU 4C33h

_Min	EQU 4054h

_Minus1	EQU 406Ch

_Mov10B	EQU 415Ch

_Mov18B	EQU 47DAh

_Mov7B	EQU 4168h

_Mov8B	EQU 4165h

_Mov9B	EQU 415Fh

_Mov9OP1OP2	EQU 417Dh

_Mov9OP2Cp	EQU 410Bh

_Mov9ToOP1	EQU 417Ah

_Mov9ToOP2	EQU 4180h

_MovFrOP1	EQU 4183h

_Newline	EQU 452Eh

_OneVar	EQU 4BA3h

_OP1ExOP2	EQU 421Fh

_OP1ExOP3	EQU 4219h

_OP1ExOP4	EQU 421Ch

_OP1ExOP5	EQU 420Dh

_OP1ExOP6	EQU 4210h

_OP1ExpToDec	EQU 4252h

_OP1Set0	EQU 41BFh

_OP1Set1	EQU 419Bh

_OP1Set2	EQU 41A7h

_OP1Set3	EQU 41A1h

_OP1Set4	EQU 419Eh

_OP1ToOP2	EQU 412Fh

_OP1ToOP3	EQU 4123h

_OP1ToOP4	EQU 4117h

_OP1ToOP5	EQU 4153h

_OP1ToOP6	EQU 4150h

_OP2ExOP4	EQU 4213h

_OP2ExOP5	EQU 4216h

_OP2ExOP6	EQU 4207h

_OP2Set0	EQU 41BCh

_OP2Set1	EQU 41ADh

_OP2Set2	EQU 41AAh

_OP2Set3	EQU 4198h

_OP2Set4	EQU 4195h

_OP2Set5	EQU 418Fh

_OP2Set60	EQU 4AB0h

_OP2Set8	EQU 418Ch

_OP2SetA	EQU 4192h

_OP2ToOP1	EQU 4156h

_OP2ToOP3	EQU 416Eh

_OP2ToOP4	EQU 411Ah

_OP2ToOP5	EQU 414Ah

_OP2ToOP6	EQU 414Dh

_OP3Set0	EQU 41B9h

_OP3Set1	EQU 4189h

_OP3Set2	EQU 41A4h

_OP3ToOP1	EQU 413Eh

_OP3ToOP2	EQU 4120h

_OP3ToOP4	EQU 4114h

_OP3ToOP5	EQU 4147h

_OP4Set0	EQU 41B6h

_OP4Set1	EQU 4186h

_OP4ToOP1	EQU 4138h

_OP4ToOP2	EQU 411Dh

_OP4ToOP3	EQU 4171h

_OP4ToOP5	EQU 4144h

_OP4ToOP6	EQU 4177h

_OP5ExOP6	EQU 420Ah

_OP5Set0	EQU 41B3h

_OP5ToOP1	EQU 413Bh

_OP5ToOP2	EQU 4126h

_OP5ToOP3	EQU 4174h

_OP5ToOP4	EQU 412Ch

_OP5ToOP6	EQU 4129h

_OP6ToOP1	EQU 4135h

_OP6ToOP2	EQU 4132h

_OP6ToOP5	EQU 4141h

_OutputExpr	EQU 4BB2h

_PagedGet	EQU 5023h

_ParseInp	EQU 4A9Bh

_PDspGrph	EQU 48A3h

_PixelTest	EQU 48B5h

_Plus1	EQU 4069h

_PointCmd	EQU 48B2h

_PointOn	EQU 4C39h

_PopOP1	EQU 437Eh

_PopOP3	EQU 437Bh

_PopOP5	EQU 4378h

_PopReal	EQU 4393h

_PopRealO1	EQU 4390h

_PopRealO2	EQU 438Dh

_PopRealO3	EQU 438Ah

_PopRealO4	EQU 4387h

_PopRealO5	EQU 4384h

_PopRealO6	EQU 4381h

_PosNo0Int	EQU 422Eh

_PtoR	EQU 40F3h

_PushOP1	EQU 43C9h

_PushOP3	EQU 43C3h

_PushOP5	EQU 43C0h

_PushReal	EQU 43BDh

_PushRealO1	EQU 43BAh

_PushRealO2	EQU 43B7h

_PushRealO3	EQU 43B4h

_PushRealO4	EQU 43B1h

_PushRealO5	EQU 43AEh

_PushRealO6	EQU 43ABh

_PutC	EQU 4504h

_PutMap	EQU 4501h

_PutPS	EQU 4510h

_PutS	EQU 450Ah

_PutTokString	EQU 4960h

_PutToL	EQU 4645h

_PutToMat	EQU 461Eh

_RandInit	EQU 4B7Fh

_Random	EQU 4B79h

_Rcl_StatVar	EQU 42DCh

_RclAns	EQU 4AD7h

_RclGDB2	EQU 47D1h

_RclN	EQU 4ADDh

_RclSysTok	EQU 4AE6h

_RclVarSym	EQU 4AE3h

_RclX	EQU 4AE0h

_RclY	EQU 4ADAh

_Rec1stByte	EQU 4EFAh

_Rec1stByteNC	EQU 4EFDh

_RecAByteIO	EQU 4F03h

_RedimMat	EQU 4A26h

_Regraph	EQU 488Eh

_ReloadAppEntryVecs	EQU 4C36h

_RestoreDisp	EQU 4870h

_RName	EQU 427Fh

_RndGuard	EQU 409Fh

_RnFx	EQU 40A2h

_Round	EQU 40A8h

_RToD	EQU 4078h

_RToP	EQU 40F6h

_RunIndicOff	EQU 4570h

_RunIndicOn	EQU 456Dh

_SaveDisp	EQU 4C7Bh

_SendAByte	EQU 4EE5h

_SetAllPlots	EQU 4FCCh

_SetFuncM	EQU 4840h

_SetNorm_Vals	EQU 49FCh

_SetParM	EQU 4849h

_SetPolM	EQU 4846h

_SetSeqM	EQU 4843h

_SetTblGraphDraw	EQU 4C00h

_SetupPagedPtr	EQU 5020h

_SetXXOP1	EQU 478Ch

_SetXXOP2	EQU 478Fh

_SetXXXXOP2	EQU 4792h

_SFont_Len	EQU 4786h

_Sin	EQU 40BDh

_SinCosRad	EQU 40BAh

_SinH	EQU 40CFh

_SinHCosH	EQU 40C6h

_SqRoot	EQU 409Ch

_SrchVLstDn	EQU 4F12h

_SrchVLstUp	EQU 4F0Fh

_SStringLength	EQU 4CB4h

_StMatEl	EQU 4AE9h

_StoAns	EQU 4ABFh

_StoGDB2	EQU 47CEh

_StoN	EQU 4ACBh

_StoOther	EQU 4AD4h

_StoR	EQU 4AC5h

_StoRand	EQU 4B7Ch

_StoSysTok	EQU 4ABCh

_StoT	EQU 4ACEh

_StoTheta	EQU 4AC2h

_StoX	EQU 4AD1h

_StoY	EQU 4AC8h

_StrCopy	EQU 44E3h

_StrLength	EQU 4C3Fh

_Tan	EQU 40C3h

_TanH	EQU 40C9h

_TanLnF	EQU 48BBh

_TenX	EQU 40B7h

_ThetaName	EQU 427Ch

_ThreeExec	EQU 4675h

_Times2	EQU 4066h

_TimesPt5	EQU 407Eh

_TName	EQU 428Eh

_ToFrac	EQU 4657h

_Trunc	EQU 4060h

_UCLineS	EQU 4795h

_UnLineCmd	EQU 48AFh

_UnOPExec	EQU 4672h

_VertCmd	EQU 48A9h

_VPutMap	EQU 455Eh

_VPutS	EQU 4561h

_VPutSN	EQU 4564h

_VtoWHLDE	EQU 47FBh

_XftoI	EQU 4804h

_Xitof	EQU 47FEh

_XName	EQU 4288h

_XRootY	EQU 479Eh

_YftoI	EQU 4801h

_YName	EQU 428Bh

_YToX	EQU 47A1h

_Zero16D	EQU 41B0h

_ZeroOP	EQU 41CEh

_ZeroOP1	EQU 41C5h

_ZeroOP2	EQU 41C8h

_ZeroOP3	EQU 41CBh

_ZmDecml	EQU 484Fh

_ZmFit	EQU 485Bh

_ZmInt	EQU 484Ch

_ZmPrev	EQU 4852h

_ZmSquare	EQU 485Eh

_ZmStats	EQU 47A4h

_ZmTrig	EQU 4861h

_ZmUsr	EQU 4855h

_ZooDefault	EQU 4867h

;

;======================================================================

;           System-defined RAM Variable Address Equates

;======================================================================

;

ramStart             EQU  8000h

appData              EQU  8000h

ramCode              EQU  8100h

ramCodeEnd           EQU  822Fh

baseAppBrTab         EQU  8230h

bootTemp             EQU  8251h

appSearchPage        EQU  82A3h

tempSwapArea         EQU  82A5h

appID                EQU  838Dh

ramReturnData        EQU  83EDh

arcInfo              EQU  83EEh

savedArcInfo         EQU  8406h

appInfo              EQU  8432h

appBank_jump         EQU  843Ch

appPage              EQU  843Eh

kbdScanCode          EQU  843Fh

kbdKey               EQU  8444h

kbdGetKy             EQU  8445h

keyExtend            EQU  8446h

contrast             EQU  8447h

apdSubTimer          EQU  8448h

apdTimer             EQU  8449h

curTime              EQU  844Ah

curRow               EQU  844Bh

curCol               EQU  844Ch

curOffset            EQU  844Dh

curUnder             EQU  844Eh

curY                 EQU  844Fh

curType              EQU  8450h

curXRow              EQU  8451h

prevDData            EQU  8452h

lFont_record         EQU  845Ah

sFont_record         EQU  8462h

tokVarPtr            EQU  846Ah

tokLen               EQU  846Ch

indicMem             EQU  846Eh

indicCounter         EQU  8476h

indicBusy            EQU  8477h

OP1                  EQU  8478h

OP1M                 EQU  847Ah

OP2                  EQU  8483h

OP2M                 EQU  8485h

OP2EXT               EQU  848Ch

OP3                  EQU  848Eh

OP3M                 EQU  8490h

OP4                  EQU  8499h

OP4M                 EQU  849Bh

OP5                  EQU  84A4h

OP5M                 EQU  84A6h

OP6                  EQU  84AFh

OP6M                 EQU  84B1h

OP6EXT               EQU  84B8h

progToEdit           EQU  84BFh

nameBuff             EQU  84C7h

equ_edit_save        EQU  84D2h

iMathPtr1            EQU  84D3h

iMathPtr2            EQU  84D5h

iMathPtr3            EQU  84D7h

iMathPtr4            EQU  84D9h

iMathPtr5            EQU  84DBh

chkDelPtr1           EQU  84DDh

chkDelPtr2           EQU  84DFh

insDelPtr            EQU  84E1h

upDownPtr            EQU  84E3h

fOutDat              EQU  84E5h

asm_data_ptr1        EQU  84EBh

asm_data_ptr2        EQU  84EDh

asm_sym_ptr1         EQU  84EFh

asm_sym_ptr2         EQU  84F1h

asm_ram              EQU  84F3h

asm_ind_call         EQU  8507h

textShadow           EQU  8508h

textShadCur          EQU  8588h

textShadTop          EQU  858Ah

textShadAlph         EQU  858Bh

textShadIns          EQU  858Ch

cxMain               EQU  858Dh

cxPPutAway           EQU  858Fh

cxPutAway            EQU  8591h

cxRedisp             EQU  8593h

cxErrorEP            EQU  8595h

cxSizeWind           EQU  8597h

cxPage               EQU  8599h

cxCurApp             EQU  859Ah

cxPrev               EQU  859Bh

monQH                EQU  85AAh

monQT                EQU  85ABh

monQueue             EQU  85ACh

onSP                 EQU  85BCh

promptRow            EQU  85C0h

promptCol            EQU  85C1h

promptIns            EQU  85C2h

promptShift          EQU  85C3h

promptRet            EQU  85C4h

promptValid          EQU  85C6h

promptTop            EQU  85C8h

promptCursor         EQU  85CAh

promptTail           EQU  85CCh

promptBtm            EQU  85CEh

varType              EQU  85D0h

varCurrent           EQU  85D1h

varClass             EQU  85D9h

menuActive           EQU  85DCh

menuAppDepth         EQU  85DDh

MenuCurrent          EQU  85DEh

ProgCurrent          EQU  85E8h

userMenuSA           EQU  85FEh

ioPrompt             EQU  865Fh

dImageWidth          EQU  8660h

ioFlag               EQU  8670h

sndRecState          EQU  8672h

ioErrState           EQU  8673h

header               EQU  8674h

ioData               EQU  867Dh

ioNewData            EQU  8689h

bakHeader            EQU  868Bh

penCol               EQU  86D7h

penRow               EQU  86D8h

rclQueue             EQU  86D9h

rclQueueEnd          EQU  86DBh

errNo                EQU  86DDh

errSP                EQU  86DEh

errOffset            EQU  86E0h

saveSScreen          EQU  86ECh

bstCounter           EQU  89EEh

flags                EQU  89F0h

statVars             EQU  8A3Ah

anovaf_vars          EQU  8C17h

infVars              EQU  8C4Dh

curGStyle            EQU  8D17h

curGY                EQU  8D18h

curGX                EQU  8D19h

curGY2               EQU  8D1Ah

curGX2               EQU  8D1Bh

freeSaveY            EQU  8D1Ch

freeSaveX            EQU  8D1Dh

XOffset              EQU  8DA1h

YOffset              EQU  8DA2h

lcdTallP             EQU  8DA3h

pixWideP             EQU  8DA4h

pixWide_m_1          EQU  8DA5h

pixWide_m_2          EQU  8DA6h

lastEntryPTR         EQU  8DA7h

lastEntryStk         EQU  8DA9h

numLastEntries       EQU  8E29h

currLastEntry        EQU  8E2Ah

curInc               EQU  8E67h

uXmin                EQU  8E7Eh

uXmax                EQU  8E87h

uXscl                EQU  8E90h

uYmin                EQU  8E99h

uYmax                EQU  8EA2h

uYscl                EQU  8EABh

uThetMin             EQU  8EB4h

uThetMax             EQU  8EBDh

uThetStep            EQU  8EC6h

uTmin                EQU  8ECFh

uTmax                EQU  8ED8h

uTStep               EQU  8EE1h

uPlotStart           EQU  8EEAh

unMax                EQU  8EF3h

uu0                  EQU  8EFCh

uv0                  EQU  8F05h

unMin                EQU  8F0Eh

uu02                 EQU  8F17h

uv02                 EQU  8F20h

uw0                  EQU  8F29h

uPlotStep            EQU  8F32h

uXres                EQU  8F3Bh

uw02                 EQU  8F44h

Xmin                 EQU  8F50h

Xmax                 EQU  8F59h

Xscl                 EQU  8F62h

Ymin                 EQU  8F6Bh

Ymax                 EQU  8F74h

Yscl                 EQU  8F7Dh

ThetaMin             EQU  8F86h

ThetaMax             EQU  8F8Fh

ThetaStep            EQU  8F98h

TminPar              EQU  8FA1h

TmaxPar              EQU  8FAAh

Tstep                EQU  8FB3h

PlotStart            EQU  8FBCh

nMax                 EQU  8FC5h

u0                   EQU  8FCEh

v0                   EQU  8FD7h

nMin                 EQU  8FE0h

u02                  EQU  8FE9h

v02                  EQU  8FF2h

w0                   EQU  8FFBh

PlotStep             EQU  9004h

XresO                EQU  900Dh

w02                  EQU  9016h

un1                  EQU  901Fh

un2                  EQU  9028h

vn1                  EQU  9031h

vn2                  EQU  903Ah

wn1                  EQU  9043h

wn2                  EQU  904Ch

fin_N                EQU  9055h

fin_I                EQU  905Eh

fin_PV               EQU  9067h

fin_PMT              EQU  9070h

fin_FV               EQU  9079h

fin_PY               EQU  9082h

fin_CY               EQU  908Bh

cal_N                EQU  9094h

cal_I                EQU  909Dh

cal_PV               EQU  90A6h

cal_PMT              EQU  90AFh

cal_FV               EQU  90B8h

cal_PY               EQU  90C1h

smallEditRAM         EQU  90D3h

XFact                EQU  913Fh

YFact                EQU  9148h

Xres_int             EQU  9151h

deltaX               EQU  9152h

deltaY               EQU  915Bh

shortX               EQU  9164h

shortY               EQU  916Dh

lower                EQU  9176h

upper                EQU  917Fh

XOutSym              EQU  918Ch

XOutDat              EQU  918Eh

YOutSym              EQU  9190h

YOutDat              EQU  9192h

inputSym             EQU  9194h

inputDat             EQU  9196h

prevData             EQU  9198h

TblMin               EQU  92B3h

TblStep              EQU  92BCh

plotSScreen          EQU  9340h

seed1                EQU  9640h

seed2                EQU  9649h

cmdShadow            EQU  966Eh

cmdShadCur           EQU  96EEh

cmdShadAlph          EQU  96F0h

cmdShadIns           EQU  96F1h

cmdCursor            EQU  96F2h

editTop              EQU  96F4h

editCursor           EQU  96F6h

editTail             EQU  96F8h

editBtm              EQU  96FAh

editSym              EQU  9706h

editDat              EQU  9708h

winTop               EQU  97A5h

winBtm               EQU  97A6h

winLeftEdge          EQU  97A7h

winLeft              EQU  97A8h

winAbove             EQU  97AAh

winRow               EQU  97ACh

winCol               EQU  97AEh

fmtDigits            EQU  97B0h

fmtString            EQU  97B1h

fmtConv              EQU  97F2h

fmtLeft              EQU  9804h

fmtIndex             EQU  9806h

fmtMatSym            EQU  9808h

fmtMatMem            EQU  980Ah

EQS                  EQU  980Ch

tSymPtr1             EQU  9818h

tSymPtr2             EQU  981Ah

chkDelPtr3           EQU  981Ch

chkDelPtr4           EQU  981Eh

tempMem              EQU  9820h

fpBase               EQU  9822h

FPS                  EQU  9824h

OPBase               EQU  9826h

OPS                  EQU  9828h

pTempCnt             EQU  982Ah

cleanTmp             EQU  982Ch

pTemp                EQU  982Eh

progPtr              EQU  9830h

newDataPtr           EQU  9832h

pagedCount           EQU  9834h

pagedPN              EQU  9835h

pagedGetPtr          EQU  9836h

pagedPutPtr          EQU  9838h

pagedBuf             EQU  983Ah

appErr1              EQU  984Dh

appErr2              EQU  985Ah

flashByte1           EQU  9867h

flashByte2           EQU  9868h

freeArcBlock         EQU  9869h

arcPage              EQU  986Bh

arcPtr               EQU  986Ch

appRawKeyHandle      EQU  9870h

appBackUpScreen      EQU  9872h

customHeight         EQU  9B72h

localLanguage        EQU  9B73h

cursorHookPtr        EQU  9B7Ch

rawKeyHookPtr        EQU  9B84h

getKeyHookPtr        EQU  9B88h

fontHookPtr          EQU  9B9Ch

restartClr           EQU  9BD0h

localTokStr          EQU  9D65h

keyForStr            EQU  9D76h

keyToStrRam          EQU  9D77h

sedMonSp             EQU  9D88h

bpSave               EQU  9D8Ah

userMem              EQU  9D95h

symTable             EQU  0FE66h

;SYMBOLIC_DEBUG_END

;

;

;======================================================================

;           System and State Flags

;======================================================================

;

trigFlags	EQU  0	;Trigonometry mode settings

trigDeg 	EQU    2	; 1=degrees, 0=radians

kbdFlags	EQU  0	;Keyboard scan

kbdSCR	EQU    3	; 1=scan code ready

kbdKeyPress	EQU    4	; 1=key has been pressed

doneFlags	EQU  0	;display "Done"

donePrgm	EQU    5	; 1=display "Done" after prgm

ioDelFlag	EQU  0

inDelete	EQU    0	;1 = DELETE SCREEN

;----------------------------------------------------------------------

editFlags	EQU  1

editOpen	EQU    2	; 1=edit buffer is open

monFlags	EQU  1	;monitor flags

monAbandon	EQU    4	; 1=don't start any long process

; in put away (#715)

;----------------------------------------------------------------------

plotFlags	EQU  2	;plot generation flags

plotLoc 	EQU    1	; 0=bkup & display, 1=display only

plotDisp	EQU    2	; 1=plot is in display, 0=text in display

grfModeFlags	EQU  2	;graph mode settings

grfFuncM	EQU    4	; 1=function graph

grfPolarM	EQU    5	; 1=polar graph

grfParamM	EQU    6	; 1=parametric graph

grfRecurM       EQU    7        ; 1=RECURSION graph

graphFlags	EQU  3

graphDraw	EQU    0	; 0=graph is valid, 1=redraw graph

grfDBFlags	EQU  4

grfDot	EQU    0	; 0=line, 1=dot

grfSimul	EQU    1	; 0=sequential, 1=simultaneous

grfGrid 	EQU    2	; 0=no grid, 1=grid

grfPolar	EQU    3	; 0=rectangular, 1=polar coordinates

grfNoCoord	EQU    4	; 0=display coordinates, 1=off

grfNoAxis	EQU    5	; 0=axis, 1=no axis

grfLabel	EQU    6	; 0=off, 1=axis label

textFlags	EQU  5	;Text output flags

textEraseBelow	EQU    1	; 1=erase line below small char

textScrolled	EQU    2	; 1=screen scrolled

textInverse	EQU    3	; 1=display inverse bit-map

textInsMode	EQU    4	; 0=overstrike, 1=insert mode

ParsFlag2	EQU  7	;PARSER flags

numOP1	EQU    0	; 1=RESULT IN OP1, 0=NO RESULT

newDispF        EQU  8	;Derivative mode flags

preClrForMode   EQU    0	; 1=HELP BLINK ON MODE SCREEN

apdFlags	EQU  8	;Automatic power-down

apdAble 	EQU    2	; 1=APD enabled

apdRunning	EQU    3	; 1=APD clock running

web_err_mask    EQU  60h

onFlags 	EQU  9	;on key flags

onInterrupt	EQU    4	; 1=on key interrupt request

statFlags	EQU  9	;statistics flags

statsValid	EQU    6	; 1=stats are valid

fmtFlags	EQU  10	;numeric format flags

fmtExponent	EQU    0	; 1=show exponent, 0=no exponent

fmtEng	EQU    1	; 1=engineering notion, 0=scientific

fmtHex	EQU    2	; 1=hexadecimal

fmtOct	EQU    3	; 1=octal

fmtBin	EQU    4	; 1=binary

;

numMode         EQU  10

fmtReal         EQU    5

fmtRect         EQU    6

fmtPolar        EQU    7

realMode        EQU    5

rectMode        EQU    6

polarMode       EQU    7

;	;   if Hex and Oct both = 1

;	;   then Bin=0 means >Frac

;	;	 Bin=1 means >DMS

fmtBaseMask     EQU  00011100B	; mask to base flags

fmtBaseShift    EQU  2	; offset to base flags

;

;       CHECK IF THESE ARE USED BY NUMFORM,

;

;               EQU  6

;               EQU  7

fmtOverride	EQU  11	;copy of fmtFlags with conversion override

fmtEditFlags	EQU  12	;numeric editing flags

fmtEdit 	EQU    0	; 1=format number for editing

curFlags	EQU  12	;Cursor

curAble 	EQU    2	; 1=cursor flash is enabled

curOn	EQU    3	; 1=cursor is showing

curLock 	EQU    4	; 1=cursor is locked off

appFlags	EQU  13	;application flags

appWantIntrpt	EQU    0	; 1=want ON key interrupts

appTextSave	EQU    1	; 1=save characters in textShadow

appAutoScroll	EQU    2	; 1=auto-scroll text on last line

appMenus	EQU    3	; 1=process keys that bring up menus

; 0=check Lock menu flag

appLockMenus	EQU    4	; 1=ignore menu keys

; 0=switch to home screen and bring up menu

appCurGraphic	EQU    5	; 1=graphic cursor

appCurWord	EQU    6	; 1=text cursor covers entire word

appExit 	EQU    7	; 1=application handles [EXIT] key itself

appWantIntrptF	EQU	1<<appWantIntrpt

appTextSaveF	EQU	1<<appTextSave

appAutoScrollF	EQU	1<<appAutoScroll

appMenusF	EQU	1<<appMenus

appLockMenusF	EQU	1<<appLockMenus

appCurGraphicF	EQU	1<<appCurGraphic

appCurWordF	EQU	1<<appCurWord

appExitF	EQU	1<<appExit

seqFlags        EQU  15              ; Sequential Graph flags

webMode         EQU    0             ; 0 = NORMAL SEQ MODE, 1 = WEB MODE

webVert         EQU    1             ;

sequv           EQU    2             ; U vs V

seqvw           EQU    3             ; V vs W

sequw           EQU    4             ; U vs W

promptFlags	EQU  17	;prompt line flags

promptEdit	EQU    0	; 1=editing in prompt buffer

indicFlags	EQU  18	;Indicator flags

indicRun	EQU    0	; 1=run indicator ON

indicInUse	EQU    1	; indicator save area in use=1, free=0

indicOnly	EQU    2	; interrupt handler only checks run indicator

shiftFlags	EQU  18	;[2nd] and [ALPHA] flags

shift2nd	EQU    3	; 1=[2nd] has been pressed

shiftAlpha	EQU    4	; 1=[ALPHA] has been pressed

shiftLwrAlph	EQU    5	; 1=lower case, 0=upper case

shiftALock	EQU    6	; 1=alpha lock has been pressed

shiftKeepAlph	EQU    7	; 1=cannot cancel alpha shift

tblFlags        EQU  19	;table flags.

autoFill        EQU    4	; 1=prompt, 0=fillAuto

autoCalc        EQU    5	; 1=prompt, 0=CalcAuto

reTable         EQU    6	; 0=table is ok, 1=must recompute table.

sGrFlags	EQU  20

grfSplit        EQU    0	; 1=Split Graph, 0=Normal

vertSplit       EQU    1	; 1=Vertical (left-right) Split

grfSChanged     EQU    2	; 1=Graph just changed Split <-> normal

grfSplitOverride EQU   3	; 1 = ignore graph split flag if set

write_on_graph  EQU    4	; 1 = TEXT OR EQU WRITING TO GRAPH SCREEN

g_style_active  EQU    5	; 1 = GRAPH STYLES ARE ENABLED, USE THEM

cmp_mod_box     EQU    6	; 1 = DOING MOD BOX PLOT COMPUTATION

textWrite       EQU    7

;

newIndicFlags   EQU  21

extraIndic      EQU    0

saIndic         EQU    1

smartFlags      EQU  23

;

;----------------------------------------------------------------------

; Note: Fix these Equates if smartFlags are moved

;----------------------------------------------------------------------

;

smarter_mask    EQU  3

smarter_test    EQU  1

smartGraph      EQU  0

smartGraph_inv  EQU  1

;----------------------------------------------------------------------

;           Available for ASM programming

;----------------------------------------------------------------------

asm_Flag1       EQU  33          ; ASM CODING

asm_Flag2       EQU  34          ; ASM CODING

asm_Flag3       EQU  35          ; ASM CODING

;----------------------------------------------------------------------

;

getSendFlg	EQU  36

comFailed	EQU  1	      ; 1 = Get/Send Communication Failed

;

appLwrCaseFlag  EQU  36

lwrCaseActive   EQU  3

;

apiFlg3	EQU  42

;

apiFlg4	EQU  43

fullScrnDraw	EQU    2	; DRAW INTO LAST ROW/COL OF SCREEN

groupFlags	EQU  38

inGroup	EQU  1	;1 = IN GROUP CONTEXT

xapFlag0        EQU  46      ; external app flags

xapFlag1        EQU  47

xapFlag2        EQU  48

xapFlag3        EQU  49

fontFlags	EQU  50

fracDrawLFont	EQU    2

fracTallLFont	EQU    3

customFont	EQU    7

plotFlag3	EQU  60

bufferOnly	EQU    0

useFastCirc	EQU    4

;

varTypeMask	EQU  1FH

varGraphRef	EQU    6

;

;======================================================================

;           Character Font equates

;======================================================================

;

LrecurN         EQU     001h

LrecurU 	EQU	002h

LrecurV 	EQU	003h

LrecurW	EQU	004h

Lconvert	EQU	005h

LsqUp	EQU	006h

LsqDown	EQU	007h

Lintegral	EQU	008h

Lcross	EQU	009h

LboxIcon 	EQU     00Ah

LcrossIcon 	EQU     00Bh

LdotIcon 	EQU     00Ch

LsubT   	EQU     00Dh	;small capital T for parametric mode.

LcubeR  	EQU     00Eh	;slightly different 3 for cubed root.

LhexF	EQU	00Fh

Lroot	EQU	010h

Linverse	EQU	011h

Lsquare	EQU	012h

Langle	EQU	013h

Ldegree	EQU	014h

Lradian	EQU	015h

Ltranspose	EQU	016h

LLE	EQU	017h

LNE	EQU	018h

LGE	EQU	019h

Lneg	EQU	01Ah

Lexponent	EQU	01Bh

Lstore	EQU	01Ch

Lten	EQU	01Dh

LupArrow	EQU	01Eh

LdownArrow	EQU	01Fh

Lspace	EQU	020h

Lexclam	EQU	021h

Lquote	EQU	022h

Lpound	EQU	023h

Lfourth	EQU     024h

Lpercent	EQU	025h

Lampersand	EQU	026h

Lapostrophe	EQU	027h

LlParen	EQU	028h

LrParen	EQU	029h

Lasterisk	EQU	02Ah

LplusSign	EQU	02Bh

Lcomma	EQU	02Ch

Ldash	EQU	02Dh

Lperiod	EQU	02Eh

Lslash	EQU	02Fh

L0	EQU	030h

L1	EQU	031h

L2	EQU	032h

L3	EQU	033h

L4	EQU	034h

L5	EQU	035h

L6	EQU	036h

L7	EQU	037h

L8	EQU	038h

L9	EQU	039h

Lcolon	EQU	03Ah

Lsemicolon	EQU	03Bh

LLT	EQU	03Ch

LEQ	EQU	03Dh

LGT	EQU	03Eh

Lquestion	EQU	03Fh

LatSign	EQU	040h

LcapA	EQU	041h

LcapB	EQU	042h

LcapC	EQU	043h

LcapD	EQU	044h

LcapE	EQU	045h

LcapF	EQU	046h

LcapG	EQU	047h

LcapH	EQU	048h

LcapI	EQU	049h

LcapJ	EQU	04Ah

LcapK	EQU	04Bh

LcapL	EQU	04Ch

LcapM	EQU	04Dh

LcapN	EQU	04Eh

LcapO	EQU	04Fh

LcapP	EQU	050h

LcapQ	EQU	051h

LcapR	EQU	052h

LcapS	EQU	053h

LcapT	EQU	054h

LcapU	EQU	055h

LcapV	EQU	056h

LcapW	EQU	057h

LcapX	EQU	058h

LcapY	EQU	059h

LcapZ	EQU	05Ah

Ltheta  EQU     05Bh

Lbackslash	EQU	05Ch

LrBrack	EQU	05Dh

Lcaret	EQU	05Eh

Lunderscore	EQU	05Fh

Lbackquote	EQU	060h

La	EQU	061h

Lb	EQU	062h

Lc	EQU	063h

Ld	EQU	064h

Le	EQU	065h

Lf	EQU	066h

Lg	EQU	067h

Lh	EQU	068h

Li	EQU	069h

Lj	EQU	06Ah

Lk	EQU	06Bh

Ll	EQU	06Ch

Lm	EQU	06Dh

Ln	EQU	06Eh

Lo	EQU	06Fh

Lp	EQU	070h

Lq	EQU	071h

Lr	EQU	072h

Ls	EQU	073h

Lt	EQU	074h

Lu	EQU	075h

Lv	EQU	076h

Lw	EQU	077h

Lx	EQU	078h

Ly	EQU	079h

Lz	EQU	07Ah

LlBrace	EQU	07Bh

Lbar	EQU	07Ch

LrBrace	EQU	07Dh

Ltilde	EQU	07Eh

LinvEQ	EQU	07Fh

Lsub0	EQU	080h

Lsub1	EQU	081h

Lsub2	EQU	082h

Lsub3	EQU	083h

Lsub4	EQU	084h

Lsub5	EQU	085h

Lsub6	EQU	086h

Lsub7	EQU	087h

Lsub8	EQU	088h

Lsub9	EQU	089h

LcapAAcute	EQU	08Ah

LcapAGrave	EQU	08Bh

LcapACaret	EQU	08Ch

LcapADier	EQU	08Dh

LaAcute	EQU	08Eh

LaGrave	EQU	08Fh

LaCaret	EQU	090h

LaDier	EQU	091h

LcapEAcute	EQU	092h

LcapEGrave	EQU	093h

LcapECaret	EQU	094h

LcapEDier	EQU	095h

LeAcute	EQU	096h

LeGrave	EQU	097h

LeCaret	EQU	098h

LeDier	EQU	099h

LcapIAcute	EQU	09Ah

LcapIGrave	EQU	09Bh

LcapICaret	EQU	09Ch

LcapIDier	EQU	09Dh

LiAcute	EQU	09Eh

LiGrave	EQU	09Fh

LiCaret	EQU	0A0h

LiDier	EQU	0A1h

LcapOAcute	EQU	0A2h

LcapOGrave	EQU	0A3h

LcapOCaret	EQU	0A4h

LcapODier	EQU	0A5h

LoAcute	EQU	0A6h

LoGrave	EQU	0A7h

LoCaret	EQU	0A8h

LoDier	EQU	0A9h

LcapUAcute	EQU	0AAh

LcapUGrave	EQU	0ABh

LcapUCaret	EQU	0ACh

LcapUDier	EQU	0ADh

LuAcute	EQU	0AEh

LuGrave	EQU	0AFh

LuCaret	EQU	0B0h

LuDier	EQU	0B1h

LcapCCed	EQU	0B2h

LcCed	EQU	0B3h

LcapNTilde	EQU	0B4h

LnTilde	EQU	0B5h

Laccent	EQU	0B6h

Lgrave	EQU	0B7h

Ldieresis	EQU	0B8h

LquesDown	EQU	0B9h

LexclamDown	EQU	0BAh

Lalpha	EQU	0BBh

Lbeta	EQU	0BCh

Lgamma	EQU	0BDh

LcapDelta	EQU	0BEh

Ldelta	EQU	0BFh

Lepsilon	EQU	0C0h

LlBrack 	EQU     0C1h

Llambda	EQU	0C2h

Lmu	EQU	0C3h

Lpi	EQU	0C4h

Lrho	EQU	0C5h

LcapSigma	EQU	0C6h

Lsigma	EQU	0C7h

Ltau	EQU	0C8h

Lphi	EQU	0C9h

LcapOmega	EQU	0CAh

LxMean	EQU	0CBh

LyMean	EQU	0CCh

LsupX	EQU	0CDh

Lellipsis	EQU	0CEh

Lleft	EQU	0CFh

Lblock	EQU	0D0h

Lper	EQU	0D1h

Lhyphen	EQU	0D2h

Larea	EQU	0D3h

Ltemp	EQU	0D4h

Lcube	EQU	0D5h

Lenter	EQU	0D6h

LimagI	EQU	0D7h

Lphat	EQU	0D8h

Lchi	EQU	0D9h

LstatF	EQU     0DAh

Llne	EQU	0DBh

LlistL	EQU	0DCh

LfinanN 	EQU	0DDh

L2_r_paren 	EQU	0DEh

LblockArrow     EQU     0DFh

LcurO   	EQU     0E0h

LcurO2  	EQU     0E1h

LcurOcapA       EQU     0E2h

LcurOa  	EQU     0E3h

LcurI   	EQU     0E4h

LcurI2  	EQU     0E5h

LcurIcapA       EQU     0E6h

LcurIa  	EQU     0E7h

LGline          EQU     0E8h    ; = 0

LGthick         EQU     0E9h    ; = 1

LGabove         EQU     0EAh    ; = 2

LGbelow         EQU     0EBh    ; = 3

LGpath          EQU     0ECh    ; = 4

LGanimate       EQU     0EDh    ; = 5

LGdot           EQU     0EEh    ; = 6

LUpBlk          EQU     0EFh    ;Up arrow and Block in solver

LDnBlk          EQU     0F0h    ;Down arrow and Block in solver

LcurFull        EQU     0F1h    ;note: must be last char (PutMap checks)

;

;======================================================================

;           Keypress Equates

;======================================================================

;           Keyboard key names

;

;

kRight          EQU       001h

kLeft           EQU       002h

kUp             EQU       003h

kDown           EQU       004h

kEnter          EQU       005h

kAlphaEnter     EQU       006h

kAlphaUp        EQU       007h

kAlphaDown      EQU       008h

kClear          EQU       009h

kDel            EQU       00Ah

kIns            EQU       00Bh

kRecall         EQU       00Ch

kLastEnt        EQU       00Dh

kBOL            EQU       00Eh

kEOL            EQU       00Fh

;

kSelAll         EQU       010h

kUnselAll       EQU       011h

kLtoTI82        EQU       012h

kBackup         EQU       013h

kRecieve        EQU       014h

kLnkQuit        EQU       015h

kTrans          EQU       016h

kRename         EQU       017h

kOverw          EQU       018h

kOmit           EQU       019h

kCont           EQU       01Ah

kSendID         EQU       01Bh

kSendSW         EQU       01Ch

kYes            EQU       01Dh

kNoWay          EQU       01Eh

kvSendType      EQU       01Fh

kOverWAll       EQU       020h

;

kNo             EQU       025h

kKReset         EQU       026h

kApp            EQU       027h

;

kDoug           EQU       028h

kListflag       EQU       029h

menuStart       EQU       02Bh

;

kAreYouSure     EQU       02Bh

kAppsMenu       EQU       02Ch

kPrgm           EQU       02Dh

kZoom           EQU       02Eh

kDraw           EQU       02Fh

kSPlot          EQU       030h

kStat           EQU       031h

kMath           EQU       032h

kTest           EQU       033h

kChar           EQU       034h

kVars           EQU       035h

kMem            EQU       036h

kMatrix         EQU       037h

kDist           EQU       038h

kAngle          EQU       039h

kList           EQU       03Ah

kCalc           EQU       03Bh

kFin            EQU       03Ch

;

menuEnd         EQU       kFin

;

kCatalog        EQU       03Eh

kInputDone      EQU       03Fh

kOff            EQU       kInputDone

;

kQuit           EQU       040h

appStart        EQU       kQuit

;

kLinkIO         EQU       041h

kMatrixEd       EQU       042h

kStatEd         EQU       043h

kGraph          EQU       044h

kMode           EQU       045h

kPrgmEd         EQU       046h        ; PROGRAM EDIT

kPrgmCr         EQU       047h        ; PROGRAM CREATE

kWindow         EQU       048h        ; RANGE EDITOR

kYequ           EQU       049h        ; EQUATION EDITOR

kTable          EQU       04Ah        ; TABLE EDITOR

kTblSet         EQU       04Bh        ; TABLE SET

kChkRAM         EQU       04Ch        ; CHECK RAM

kDelMem         EQU       04Dh        ; DELETE MEM

kResetMem       EQU       04Eh        ; RESET MEM

kResetDef	EQU	  04Fh        ; RESET DEFAULT

kPrgmInput      EQU       050h        ; PROGRAM INPUT

kZFactEd        EQU       051h        ; ZOOM FACTOR EDITOR

kError          EQU       052h        ; ERROR

kSolveTVM       EQU       053h        ; TVM SOLVER

kSolveRoot	EQU	  054h        ; SOLVE EDITOR

kStatP          EQU       055h        ; stat plot

kInfStat 	EQU	  056h	      ; Inferential Statistic

kFormat         EQU       057h        ; FORMAT

kExtApps        EQU       058h        ; External Applications.     NEW

kNewApps        EQU       059h        ; New Apps for Cerberus.

;

append          EQU       kNewApps

;

echoStart1      EQU       05Ah

;

kTrace          EQU       05Ah

kZFit           EQU       05Bh

kZIn            EQU       05Ch

kZOut           EQU       05Dh

kZPrev          EQU       05Eh

kBox            EQU       05Fh

kDecml          EQU       060h

kSetZm          EQU       061h

kSquar          EQU       062h

kStd            EQU       063h

kTrig           EQU       064h

kUsrZm          EQU       065h

kZSto           EQU       066h

kZInt           EQU       067h

kZStat          EQU       068h

;

echoStart2      EQU       069h

;

kSelect         EQU       069h

kCircl          EQU       06Ah

kClDrw          EQU       06Bh

kLine           EQU       06Ch

kPen            EQU       06Dh

kPtChg          EQU       06Eh

kPtOff          EQU       06Fh

kPtOn           EQU       070h

kVert           EQU       071h

kHoriz          EQU       072h

kText           EQU       073h

kTanLn          EQU       074h

;

kEval           EQU       075h

kInters         EQU       076h

kDYDX           EQU       077h

kFnIntg         EQU       078h

kRootG          EQU       079h

kDYDT           EQU       07Ah

kDXDT           EQU       07Bh

kDRDo           EQU       07Ch

KGFMin          EQU       07Dh

KGFMax          EQU       07Eh

;

;

EchoStart       EQU       07Fh

;

kListName       EQU       07Fh

kAdd            EQU       080h

kSub            EQU       081h

kMul            EQU       082h

kDiv            EQU       083h

kExpon          EQU       084h

kLParen         EQU       085h

kRParen         EQU       086h

kLBrack         EQU       087h

kRBrack         EQU       088h

kShade          EQU       089h

kStore          EQU       08Ah

kComma          EQU       08Bh

kChs            EQU       08Ch

kDecPnt         EQU       08Dh

k0              EQU       08Eh

k1              EQU       08Fh

k2              EQU       090h

k3              EQU       091h

k4              EQU       092h

k5              EQU       093h

k6              EQU       094h

k7              EQU       095h

k8              EQU       096h

k9              EQU       097h

kEE             EQU       098h

kSpace          EQU       099h

kCapA           EQU       09Ah

kCapB           EQU       09Bh

kCapC           EQU       09Ch

kCapD           EQU       09Dh

kCapE           EQU       09Eh

kCapF           EQU       09Fh

kCapG           EQU       0A0h

kCapH           EQU       0A1h

kCapI           EQU       0A2h

kCapJ           EQU       0A3h

kCapK           EQU       0A4h

kCapL           EQU       0A5h

kCapM           EQU       0A6h

kCapN           EQU       0A7h

kCapO           EQU       0A8h

kCapP           EQU       0A9h

kCapQ           EQU       0AAh

kCapR           EQU       0ABh

kCapS           EQU       0ACh

kCapT           EQU       0ADh

kCapU           EQU       0AEh

kCapV           EQU       0AFh

kCapW           EQU       0B0h

kCapX           EQU       0B1h

kCapY           EQU       0B2h

kCapZ           EQU       0B3h

kVarx           EQU       0B4h

kPi             EQU       0B5h

kInv            EQU       0B6h

kSin            EQU       0B7h

kASin           EQU       0B8h

kCos            EQU       0B9h

kACos           EQU       0BAh

kTan            EQU       0BBh

kATan           EQU       0BCh

kSquare         EQU       0BDh

kSqrt           EQU       0BEh

kLn             EQU       0BFh

kExp            EQU       0C0h

kLog            EQU       0C1h

kALog           EQU       0C2h

kToABC          EQU       0C3h

;

kClrTbl         EQU       0C4h

;

kAns            EQU       0C5h

kColon          EQU       0C6h

;

kNDeriv         EQU       0C7h

kFnInt          EQU       0C8h

kRoot           EQU       0C9h

;

kQuest          EQU       0CAh

kQuote          EQU       0CBh

kTheta          EQU       0CCh

kIf             EQU       0CDh

kThen           EQU       0CEh

kElse           EQU       0CFh

kFor            EQU       0D0h

kWhile          EQU       0D1h

kRepeat         EQU       0D2h

kEnd            EQU       0D3h

kPause          EQU       0D4h

kLbl            EQU       0D5h

kGoto           EQU       0D6h

kISG            EQU       0D7h

kDSL            EQU       0D8h

kMenu           EQU       0D9h

kExec           EQU       0DAh

kReturn         EQU       0DBh

kStop           EQU       0DCh

kInput          EQU       0DDh

kPrompt         EQU       0DEh

kDisp           EQU       0DFh

kDispG          EQU       0E0h

kDispT          EQU       0E1h

kOutput         EQU       0E2h

kGetKey         EQU       0E3h

kClrHome        EQU       0E4h

kPrtScr         EQU       0E5h

kSinH           EQU       0E6h

kCosH           EQU       0E7h

kTanH           EQU       0E8h

kASinH          EQU       0E9h

kACosH          EQU       0EAh

kATanH          EQU       0EBh

kLBrace         EQU       0ECh

kRBrace         EQU       0EDh

kI              EQU       0EEh

kCONSTeA        EQU       0EFh

kPlot3          EQU       0F0h

kFMin           EQU       0F1h

kFMax           EQU       0F2h

kL1A            EQU       0F3h

kL2A            EQU       0F4h

kL3A            EQU       0F5h

kL4A            EQU       0F6h

kL5A            EQU       0F7h

kL6A            EQU       0F8h

kunA            EQU       0F9h

kvnA            EQU       0FAh

kwnA            EQU       0FBh

;

;======================================================================

;       THIS KEY MEANS THAT IT IS A 2 BYTE KEYCODE

;       THERE ARE 2 OF THESE KEYS; BE CAREFUL WITH USAGE

;======================================================================

;

kExtendEcho2    EQU       0FCh

;

;======================================================================;

;       THIS KEY MEANS THAT THE KEY PRESS IS ONE THAT ECHOS

;       INTO A BUFFER, AND IT IS A 2 BYTE KEY CODE, GO LOOK AT

;       (EXTECHO) FOR THE KEY VALUE

;======================================================================

;

kExtendEcho     EQU       0FEh

;

kE1BT           EQU       0

kDrawInv        EQU       kE1BT

kDrawF          EQU       kE1BT+1

kPixelOn        EQU       kE1BT+2

kPixelOff       EQU       kE1BT+3

kPxlTest        EQU       kE1BT+4

kRCGDB          EQU       kE1BT+5

kRCPic          EQU       kE1BT+6

kSTGDB          EQU       kE1BT+7

kSTPic          EQU       kE1BT+8

kAbs            EQU       kE1BT+9

kTEqu           EQU       kE1BT+10    ; ==

kTNoteQ         EQU       kE1BT+11    ; <>

kTGT            EQU       kE1BT+12    ; >

kTGTE           EQU       kE1BT+13    ; > =

kTLT            EQU       kE1BT+14    ; <

kTLTE           EQU       kE1BT+15    ; < =

kAnd            EQU       kE1BT+16

kOr             EQU       kE1BT+17

kXor            EQU       kE1BT+18

kNot            EQU       kE1BT+19

kLR1            EQU       kE1BT+20

kXRoot          EQU       kE1BT+21

kCube           EQU       kE1BT+22

kCbRt           EQU       kE1BT+23    ; Cube ROOT

kToDec          EQU       kE1BT+24

;

kCubicR         EQU       kE1BT+25

kQuartR         EQU       kE1BT+26

;

kPlot1          EQU       kE1BT+27

kPlot2          EQU       kE1BT+28

;

kRound          EQU       kE1BT+29

kIPart          EQU       kE1BT+30

kFPart          EQU       kE1BT+31

kInt            EQU       kE1BT+32

kRand           EQU       kE1BT+33

kNPR            EQU       kE1BT+34

kNCR            EQU       kE1BT+35

kXFactorial     EQU       kE1BT+36

kRad            EQU       kE1BT+37

kDegr           EQU       kE1BT+38    ; DEGREES CONV

kAPost          EQU       kE1BT+39

kToDMS          EQU       kE1BT+40

kRToPo          EQU       kE1BT+41    ; R

kRToPr          EQU       kE1BT+42

kPToRx          EQU       kE1BT+43

kPToRy          EQU       kE1BT+44

kRowSwap        EQU       kE1BT+45

kRowPlus        EQU       kE1BT+46

kTimRow         EQU       kE1BT+47

kTRowP          EQU       kE1BT+48

kSortA          EQU       kE1BT+49

kSortD          EQU       kE1BT+50

kSeq            EQU       kE1BT+51

kMin            EQU       kE1BT+52

kMax            EQU       kE1BT+53

kMean           EQU       kE1BT+54

kMedian         EQU       kE1BT+55

kSum            EQU       kE1BT+56

kProd           EQU       kE1BT+57

kDet            EQU       kE1BT+58

kTransp         EQU       kE1BT+59

kDim            EQU       kE1BT+60

kFill           EQU       kE1BT+61

kIdent          EQU       kE1BT+62

kRandm          EQU       kE1BT+63

kAug            EQU       kE1BT+64

kOneVar         EQU       kE1BT+65

kTwoVar         EQU       kE1BT+66

kLR             EQU       kE1BT+67

kLRExp          EQU       kE1BT+68

kLRLn           EQU       kE1BT+69

kLRPwr          EQU       kE1BT+70

kMedMed         EQU       kE1BT+71

kQuad           EQU       kE1BT+72

kClrLst         EQU       kE1BT+73

kHist           EQU       kE1BT+74

kxyLine         EQU       kE1BT+75

kScatter        EQU       kE1BT+76

kmRad           EQU       kE1BT+77

kmDeg           EQU       kE1BT+78

kmNormF         EQU       kE1BT+79

kmSci           EQU       kE1BT+80

kmEng           EQU       kE1BT+81

kmFloat         EQU       kE1BT+82

kFix            EQU       kE1BT+83

kSplitOn        EQU       kE1BT+84

kFullScreen     EQU       kE1BT+85

kStndrd         EQU       kE1BT+86

kParam          EQU       kE1BT+87

kPolar          EQU       kE1BT+88

kSeqG           EQU       kE1BT+89

kAFillOn        EQU       kE1BT+90

kAFillOff       EQU       kE1BT+91

kACalcOn        EQU       kE1BT+92

kACalcOff       EQU       kE1BT+93

kFNOn           EQU       kE1BT+94

kFNOff          EQU       kE1BT+95

kPlotsOn        EQU       kE1BT+96

kPlotsOff       EQU       kE1BT+97

kPixelChg       EQU       kE1BT+98

kSendMBL        EQU       kE1BT+99

kRecvMBL        EQU       kE1BT+100

kBoxPlot        EQU       kE1BT+101

kBoxIcon        EQU       kE1BT+102

kCrossIcon      EQU       kE1BT+103

kDotIcon        EQU       kE1BT+104

kE2BT           EQU       kE1BT+105

kSeqential      EQU       kE2BT

kSimulG         EQU       kE2BT+1

kPolarG         EQU       kE2BT+2

kRectG          EQU       kE2BT+3

kCoordOn        EQU       kE2BT+4

kCoordOff       EQU       kE2BT+5

kDrawLine       EQU       kE2BT+6

kDrawDot        EQU       kE2BT+7

kAxisOn         EQU       kE2BT+8

kAxisOff        EQU       kE2BT+9

kGridOn         EQU       kE2BT+10

kGridOff        EQU       kE2BT+11

kLblOn          EQU       kE2BT+12

kLblOff         EQU       kE2BT+13

kL1             EQU       kE2BT+14

kL2             EQU       kE2BT+15

kL3             EQU       kE2BT+16

kL4             EQU       kE2BT+17

kL5             EQU       kE2BT+18

kL6             EQU       kE2BT+19

;

;======================================================================

;           These keys are layed on top of existing keys to

;           enable localization in the inferential stats editor

;======================================================================

;

kinfData        EQU       kL1

kinfStats       EQU       kL1+1

kinfYes         EQU       kL1+2

kinfNo          EQU       kL1+3

kinfCalc        EQU       kL1+4

kinfDraw        EQU       kL1+5

kinfAlt1ne      EQU       kL1+6

kinfAlt1lt      EQU       kL1+7

kinfAlt1gt      EQU       kL1+8

kinfAlt2ne      EQU       kL1+9

kinfAlt2lt      EQU       kL1+10

kinfAlt2gt      EQU       kL1+11

kinfAlt3ne      EQU       kL1+12

kinfAlt3lt      EQU       kL1+13

kinfAlt3gt      EQU       kL1+14

kinfAlt4ne      EQU       kL1+15

kinfAlt4lt      EQU       kL1+16

kinfAlt4gt      EQU       kL1+17

kinfAlt5ne      EQU       kL1+18

kinfAlt5lt      EQU       kL1+19

kinfAlt5gt      EQU       kL1+20

kinfAlt6ne      EQU       kL1+21

kinfAlt6lt      EQU       kL1+22

kinfAlt6gt      EQU       kL1+23

;

;

kMatA           EQU       kE2BT+20

kMatB           EQU       kE2BT+21

kMatC           EQU       kE2BT+22

kMatD           EQU       kE2BT+23

kMatE           EQU       kE2BT+24

kXmin           EQU       kE2BT+25

kXmax           EQU       kE2BT+26

kXscl           EQU       kE2BT+27

kYmin           EQU       kE2BT+28

kYmax           EQU       kE2BT+29

kYscl           EQU       kE2BT+30

kTmin           EQU       kE2BT+31

kTmax           EQU       kE2BT+32

kTStep          EQU       kE2BT+33

kOmin           EQU       kE2BT+34

kOmax           EQU       kE2BT+35

kOStep          EQU       kE2BT+36

ku0             EQU       kE2BT+37

kv0             EQU       kE2BT+38

knMin           EQU       kE2BT+39

knMax           EQU       kE2BT+40

kDeltaY         EQU       kE2BT+41

kDeltaX         EQU       kE2BT+42

kZXmin          EQU       kE2BT+43

kZXmax          EQU       kE2BT+44

kZXscl          EQU       kE2BT+45

kZYmin          EQU       kE2BT+46

kZYmax          EQU       kE2BT+47

kZYscl          EQU       kE2BT+48

kZTmin          EQU       kE2BT+49

kZTmax          EQU       kE2BT+50

kZTStep         EQU       kE2BT+51

kZOmin          EQU       kE2BT+52

kZOmax          EQU       kE2BT+53

kZOStep         EQU       kE2BT+54

kZu0            EQU       kE2BT+55

kZv0            EQU       kE2BT+56

kZnMin          EQU       kE2BT+57

kZnMax          EQU       kE2BT+58

kDelLast        EQU       kE2BT+59

kSinReg         EQU       kE2BT+60

kConstE         EQU       kE2BT+61

kPic1           EQU       kE2BT+62

kPic2           EQU       kE2BT+63

kPic3           EQU       kE2BT+64

kDelVar         EQU       kE2BT+65

kGetCalc        EQU       kE2BT+66

kRealM          EQU       kE2BT+67

kPolarM         EQU       kE2BT+68

kRectM          EQU       kE2BT+69

kuv             EQU       kE2BT+70    ; U vs V

kvw             EQU       kE2BT+71    ; V vs W

kuw             EQU       kE2BT+72    ; U vs W

kFinPMTend      EQU       kE2BT+73

kFinPMTbeg      EQU       kE2BT+74

;

kGraphStyle     EQU       kE2BT+75

;

kExprOn         EQU       kE2BT+76

kExprOff        EQU       kE2BT+77

kStatA          EQU       kE2BT+78

kStatB          EQU       kE2BT+79

kStatC          EQU       kE2BT+80

kCorr           EQU       kE2BT+81

kStatD          EQU       kE2BT+82

kStatE          EQU       kE2BT+83

kRegEq          EQU       kE2BT+84

kMinX           EQU       kE2BT+85

kQ1             EQU       kE2BT+86

kMD             EQU       kE2BT+87

kQ3             EQU       kE2BT+88

kMaxX           EQU       kE2BT+89

kStatX1         EQU       kE2BT+90

kStatY1         EQU       kE2BT+91

kStatX2         EQU       kE2BT+92

kStatY2         EQU       kE2BT+93

kStatX3         EQU       kE2BT+94

kStatY3         EQU       kE2BT+95

kTblMin         EQU       kE2BT+96

kTblStep        EQU       kE2BT+97

kSetupLst       EQU       kE2BT+98

kClrAllLst      EQU       kE2BT+99

kLogistic       EQU       kE2BT+100

kZTest          EQU       kE2BT+101

kTTest          EQU       kE2BT+102

k2SampZTest     EQU       kE2BT+103

k2SampTTest     EQU       kE2BT+104

k1PropZTest     EQU       kE2BT+105

k2PropZTest     EQU       kE2BT+106

kChiTest        EQU       kE2BT+107

k2SampFTest     EQU       kE2BT+108

kZIntVal        EQU       kE2BT+109

kTIntVal        EQU       kE2BT+110

k2SampTInt      EQU       kE2BT+111

k2SampZInt      EQU       kE2BT+112

k1PropZInt      EQU       kE2BT+113

k2PropZInt      EQU       kE2BT+114

kDNormal        EQU       kE2BT+115

kInvNorm        EQU       kE2BT+116

kDT             EQU       kE2BT+117

kChi            EQU       kE2BT+118

kDF             EQU       kE2BT+119

kBinPDF         EQU       kE2BT+120

kBinCDF         EQU       kE2BT+121

kPoiPDF         EQU       kE2BT+122

kPoiCDF         EQU       kE2BT+123

kun             EQU       kE2BT+124

kvn             EQU       kE2BT+125

kwn             EQU       kE2BT+126

kRecn           EQU       kE2BT+127

kPlotStart      EQU       kE2BT+128

kZPlotStart     EQU       kE2BT+129   ; recursion n

kXFact          EQU       kE2BT+130   ; PlotStart

kYFact          EQU       kE2BT+131   ; ZPlotStart

kANOVA          EQU       kE2BT+132   ; XFact

kMaxY           EQU       kE2BT+133   ; YFact

kWebOn          EQU       kE2BT+134   ; MinY

kWebOff         EQU       kE2BT+135   ; MaxY

kTblInput       EQU       kE2BT+136   ; WEB ON

kGeoPDF         EQU       kE2BT+137   ; WEB OFF

kGeoCDF         EQU       kE2BT+138   ; WEB OFF

kShadeNorm      EQU       kE2BT+139

kShadeT         EQU       kE2BT+140

kShadeChi       EQU       kE2BT+141

kShadeF         EQU       kE2BT+142

kPlotStep       EQU       kE2BT+143

kZPlotStep      EQU       kE2BT+144

kLinRegtTest    EQU       kE2BT+145

KMGT	EQU	  kE2BT+146   ; VERT SPLIT

kSelectA        EQU       kE2BT+147

kZFitA          EQU       kE2BT+148

kE2BT_End       EQU       kZFitA

;

;

;======================================================================

;           More 2 Byte Keys

;======================================================================

kE2BT2	EQU       0

kGDB1	EQU       kE2BT2

kGDB2	EQU       kE2BT2+1

kGDB3	EQU       kE2BT2+2

kY1	EQU       kE2BT2+3

kY2	EQU       kE2BT2+4

kY3	EQU       kE2BT2+5

kY4	EQU       kE2BT2+6

kY5	EQU       kE2BT2+7

kY6	EQU       kE2BT2+8

kY7	EQU       kE2BT2+9

kY8	EQU       kE2BT2+10

kY9	EQU       kE2BT2+11

kY0	EQU       kE2BT2+12

kX1T	EQU       kE2BT2+13

kY1T	EQU       kE2BT2+14

kX2T	EQU       kE2BT2+15

kY2T	EQU       kE2BT2+16

kX3T	EQU       kE2BT2+17

kY3T	EQU       kE2BT2+18

kX4T	EQU       kE2BT2+19

kY4T	EQU       kE2BT2+20

kX5T	EQU       kE2BT2+21

kY5T	EQU       kE2BT2+22

kX6T	EQU       kE2BT2+23

kY6T	EQU       kE2BT2+24

kR1	EQU       kE2BT2+25

kR2	EQU       kE2BT2+26

kR3	EQU       kE2BT2+27

kR4	EQU       kE2BT2+28

kR5	EQU       kE2BT2+29

kR6	EQU       kE2BT2+30

kGDB4	EQU       kE2BT2+31

kGDB5	EQU       kE2BT2+32

kGDB6	EQU       kE2BT2+33

kPic4	EQU       kE2BT2+34

kPic5	EQU       kE2BT2+35

kPic6	EQU       kE2BT2+36

kGDB7	EQU       kE2BT2+37

kGDB8	EQU       kE2BT2+38

kGDB9	EQU       kE2BT2+39

kGDB0	EQU       kE2BT2+40

kPic7	EQU       kE2BT2+41

kPic8	EQU       kE2BT2+42

kPic9	EQU       kE2BT2+43

kPic0	EQU       kE2BT2+44

kStatN	EQU       kE2BT2+45

kXMean	EQU       kE2BT2+46

kConj	EQU       kE2BT2+47

kReal	EQU       kE2BT2+48

kFAngle	EQU       kE2BT2+49

kLCM	EQU       kE2BT2+50

kGCD	EQU       kE2BT2+51

kRandInt	EQU       kE2BT2+52

kRandNorm	EQU       kE2BT2+53

kToPolar	EQU       kE2BT2+54

kToRect	EQU       kE2BT2+55

kYMean	EQU       kE2BT2+56

kStdX	EQU       kE2BT2+57

kStdX1	EQU       kE2BT2+58

kw0	EQU       kE2BT2+59

kMatF	EQU       kE2BT2+60

kMatG	EQU       kE2BT2+61

kMatRH	EQU       kE2BT2+62

kMatI	EQU       kE2BT2+63

kMatJ	EQU       kE2BT2+64

kYMean1	EQU       kE2BT2+65

kStdY	EQU       kE2BT2+66

kStdY1	EQU       kE2BT2+67

kMatToLst	EQU       kE2BT2+68

kLstToMat	EQU       kE2BT2+69

kCumSum	EQU       kE2BT2+70

kDeltaLst	EQU       kE2BT2+71

kStdDev	EQU       kE2BT2+72

kVariance	EQU       kE2BT2+73

kLength	EQU       kE2BT2+74

kEquToStrng	EQU       kE2BT2+75

kStrngToEqu	EQU       kE2BT2+76

kExpr	EQU       kE2BT2+77

kSubStrng	EQU       kE2BT2+78

kInStrng	EQU       kE2BT2+79

kStr1	EQU       kE2BT2+80

kStr2	EQU       kE2BT2+81

kStr3	EQU       kE2BT2+82

kStr4           EQU       kE2BT2+83

kStr5           EQU       kE2BT2+84

kStr6           EQU       kE2BT2+85

kStr7           EQU       kE2BT2+86

kStr8           EQU       kE2BT2+87

kStr9           EQU       kE2BT2+88

kStr0           EQU       kE2BT2+89

kFinN           EQU       kE2BT2+90

kFinI           EQU       kE2BT2+91

kFinPV          EQU       kE2BT2+92

kFinPMT         EQU       kE2BT2+93

kFinFV          EQU       kE2BT2+94

kFinPY          EQU       kE2BT2+95

kFinCY          EQU       kE2BT2+96

kFinFPMT        EQU       kE2BT2+97

kFinFI          EQU       kE2BT2+98

kFinFPV         EQU       kE2BT2+99

kFinFN          EQU       kE2BT2+100

kFinFFV         EQU       kE2BT2+101

kFinNPV         EQU       kE2BT2+102

kFinIRR         EQU       kE2BT2+103

kFinBAL         EQU       kE2BT2+104

kFinPRN         EQU       kE2BT2+105

kFinINT         EQU       kE2BT2+106

kSumX           EQU       kE2BT2+107

kSumX2          EQU       kE2BT2+108

kFinToNom       EQU       kE2BT2+109

kFinToEff       EQU       kE2BT2+110

kFinDBD         EQU       kE2BT2+111

kStatVP         EQU       kE2BT2+112

kStatZ          EQU       kE2BT2+113

kStatT          EQU       kE2BT2+114

kStatChi        EQU       kE2BT2+115

kStatF          EQU       kE2BT2+116

kStatDF         EQU       kE2BT2+117

kStatPhat       EQU       kE2BT2+118

kStatPhat1      EQU       kE2BT2+119

kStatPhat2      EQU       kE2BT2+120

kStatMeanX1     EQU       kE2BT2+121

kStatMeanX2     EQU       kE2BT2+122

kStatStdX1      EQU       kE2BT2+123

kStatStdX2      EQU       kE2BT2+124

kStatStdXP      EQU       kE2BT2+125

kStatN1         EQU       kE2BT2+126

kStatN2         EQU       kE2BT2+127

kStatLower      EQU       kE2BT2+128

kStatUpper      EQU       kE2BT2+129

kuw0            EQU       kE2BT2+130

kImag           EQU       kE2BT2+131

kSumY           EQU       kE2BT2+132

kXres           EQU       kE2BT2+133

kStat_s         EQU       kE2BT2+134

kSumY2          EQU       kE2BT2+135

kSumXY          EQU       kE2BT2+136

kuXres          EQU       kE2BT2+137

kModBox	EQU       kE2BT2+138

kNormProb	EQU       kE2BT2+139

kNormalPDF      EQU       kE2BT2+140

kTPDF           EQU       kE2BT2+141

kChiPDF         EQU       kE2BT2+142

kFPDF           EQU       kE2BT2+143

kMinY           EQU       kE2BT2+144   ; MinY

kRandBin        EQU       kE2BT2+145

kRef            EQU       kE2BT2+146

kRRef           EQU       kE2BT2+147

kLRSqr          EQU       kE2BT2+148

kBRSqr          EQU       kE2BT2+149

kDiagOn         EQU       kE2BT2+150

kDiagOff        EQU       kE2BT2+151

kun1            EQU       kE2BT2+152   ; FOR RCL USE WHEN GOTTEN FROM 82

kvn1            EQU       kE2BT2+153   ; FOR RCL USE WHEN GOTTEN FROM 82

;

k83_00End       EQU	kvn1            ;end of original keys...

kArchive        EQU     k83_00End + 1

kUnarchive      EQU     k83_00End + 2

kAsm            EQU     k83_00End + 3   ; Asm(

kAsmPrgm        EQU     k83_00End + 4   ; AsmPrgm

kAsmComp        EQU     k83_00End + 5   ; AsmComp(

;

kcapAAcute	EQU       k83_00End + 6

kcapAGrave	EQU       k83_00End + 7

kcapACaret	EQU       k83_00End + 8

kcapADier	EQU       k83_00End + 9

kaAcute	EQU       k83_00End + 10

kaGrave	EQU       k83_00End + 11

kaCaret	EQU       k83_00End + 12

kaDier	EQU       k83_00End + 13

kcapEAcute	EQU       k83_00End + 14

kcapEGrave	EQU       k83_00End + 15

kcapECaret	EQU       k83_00End + 16

kcapEDier	EQU       k83_00End + 17

keAcute	EQU       k83_00End + 18

keGrave	EQU       k83_00End + 19

keCaret	EQU       k83_00End + 20

keDier	EQU       k83_00End + 21

kcapIAcute	EQU       k83_00End + 22

kcapIGrave	EQU       k83_00End + 23

kcapICaret	EQU       k83_00End + 24

kcapIDier	EQU       k83_00End + 25

kiAcute	EQU       k83_00End + 26

kiGrave	EQU       k83_00End + 27

kiCaret	EQU       k83_00End + 28

kiDier	EQU       k83_00End + 29

kcapOAcute	EQU       k83_00End + 30

kcapOGrave	EQU       k83_00End + 31

kcapOCaret	EQU       k83_00End + 32

kcapODier	EQU       k83_00End + 33

koAcute	EQU       k83_00End + 34

koGrave	EQU       k83_00End + 35

koCaret	EQU       k83_00End + 36

koDier	EQU       k83_00End + 37

kcapUAcute	EQU       k83_00End + 38

kcapUGrave	EQU       k83_00End + 39

kcapUCaret	EQU       k83_00End + 40

kcapUDier	EQU       k83_00End + 41

kuAcute	EQU       k83_00End + 42

kuGrave	EQU       k83_00End + 43

kuCaret	EQU       k83_00End + 44

kuDier	EQU       k83_00End + 45

kcapCCed	EQU       k83_00End + 46

kcCed	EQU       k83_00End + 47

kcapNTilde	EQU       k83_00End + 48

knTilde	EQU       k83_00End + 49

kaccent	EQU       k83_00End + 50

kgrave	EQU       k83_00End + 51

kdieresis	EQU       k83_00End + 52

kquesDown	EQU       k83_00End + 53

kexclamDown     EQU       k83_00End + 54

kalpha          EQU       k83_00End + 55

kbeta           EQU      k83_00End +  56

kgamma          EQU      k83_00End +  57

kcapDelta       EQU      k83_00End +  58

kdelta          EQU      k83_00End +  59

kepsilon        EQU      k83_00End +  60

klambda         EQU      k83_00End +  61

kmu             EQU      k83_00End +  62

kpi2            EQU      k83_00End +  63

krho            EQU      k83_00End +  64

kcapSigma       EQU      k83_00End +  65

ksigma          EQU      k83_00End +  66

ktau            EQU      k83_00End +  67

kphi            EQU      k83_00End +  68

kcapOmega       EQU      k83_00End +  69

kphat           EQU      k83_00End +  70

kchi2           EQU      k83_00End +  71

kstatF2         EQU      k83_00End +  72

kLa	EQU     k83_00End + 73

kLb	EQU     k83_00End + 74

kLc	EQU     k83_00End + 75

kLd	EQU     k83_00End + 76

kLe	EQU     k83_00End + 77

kLf	EQU     k83_00End + 78

kLg	EQU     k83_00End + 79

kLh	EQU     k83_00End + 80

kLi	EQU     k83_00End + 81

kLj	EQU     k83_00End + 82

kLk	EQU     k83_00End + 83

kLl	EQU     k83_00End + 84

kLm	EQU     k83_00End + 85

kLsmalln	EQU    k83_00End +  86

kLo	EQU    k83_00End +  87

kLp	EQU    k83_00End +  88

kLq	EQU    k83_00End +  89

kLsmallr	EQU    k83_00End +  90

kLs	EQU    k83_00End +  91

kLt	EQU    k83_00End +  92

kLu	EQU    k83_00End +  93

kLv	EQU    k83_00End +  94

kLw	EQU    k83_00End +  95

kLx	EQU    k83_00End +  96

kLy	EQU    k83_00End +  97

kLz	EQU    k83_00End +  98

kGarbageC	EQU  k83_00End +  99 ; GarbageCollect

;

kE2BT2_End	EQU     kGarbageC

;

;======================================================================

;           TI-83 Plus Context Equates

;======================================================================

;

cxCmd           EQU     kQuit                   ;home screen

cxMatEdit       EQU     kMatrixEd               ;matrix editor

cxPrgmEdit      EQU     kPrgmEd                 ;program editor

cxEquEdit       EQU     kYequ                   ;equation editor

cxGrRange       EQU     kWindow                 ;graph range editor

cxGrZfact       EQU     kZFactEd                ;graph zoom factors editor

cxGraph         EQU     kGraph                  ;graph mode

cxStatEdit      EQU     kStatEd                 ;statistics list editor

cxPrgmInput     EQU     kPrgmInput              ;programmed input

cxError         EQU     kError                  ;error handler

cxLinkIO        EQU     kLinkIO                 ;LINK I/O interface

cxMem           EQU     kResetMem               ;reset memory

cxDefMem        EQU     kResetDef               ;reset default

cxRAMApp        EQU     kChkRAM                 ;RAM usage screen

cxMode          EQU     kMode                   ;mode settings screen

cxErase         EQU     kDelMem                 ;memory erase

cxPrgmCreate    EQU     kPrgmCr                 ;PROGRAM CREATE

cxTableEditor   EQU     kTable                  ;TABLE EDITOR

cxTableSet      EQU     kTblSet                 ;TABLE SET UP

cxStatPlot      EQU     kStatP                  ;STAT PLOTS

cxInfStat	EQU	kInfStat	;Inferential Statistic

cxFormat        EQU     kFormat                 ;FORMAT CONTEXT

cxSolveTVM      EQU     kSolveTVM               ;Solve TVM

cxSolveRoot     EQU     kSolveRoot              ;Solve Root

lastOldApp      EQU     kExtApps                ;external applications

cxextapps       EQU     kExtApps

cxNewApps       EQU     kNewApps                ;new cerberus applications

cxGroup         EQU     cxNewApps+0             ;1st new app.

cxUnGroup       EQU     cxNewApps+1             ;2nd new app.

lastNewApp      EQU     cxUnGroup               ;last new app for this ver

;

;======================================================================

;           Scan Code Equates

;======================================================================;

skDown          EQU	01h

skLeft          EQU	02h

skRight         EQU	03h

skUp            EQU	04h

skEnter         EQU	09h

skAdd           EQU	0Ah

skSub           EQU	0Bh

skMul           EQU	0Ch

skDiv           EQU	0Dh

skPower         EQU	0Eh

skClear         EQU	0Fh

skChs           EQU	11h

sk3             EQU	12h

sk6             EQU	13h

sk9             EQU	14h

skRParen        EQU	15h

skTan           EQU	16h

skVars          EQU	17h

skDecPnt        EQU	19h

sk2             EQU	1Ah

sk5             EQU	1Bh

sk8             EQU	1Ch

skLParen        EQU	1Dh

skCos           EQU	1Eh

skPrgm          EQU	1Fh

skStat          EQU	20h

sk0             EQU	21h

sk1             EQU	22h

sk4             EQU	23h

sk7             EQU	24h

skComma         EQU	25h

skSin           EQU	26h

skMatrix        EQU	27h

skGraphvar      EQU	28h

skStore         EQU	2Ah

skLn            EQU	2Bh

skLog           EQU	2Ch

skSquare        EQU	2Dh

skRecip         EQU	2Eh

skMath          EQU	2Fh

skAlpha         EQU	30h

skGraph         EQU	31h

skTrace         EQU	32h

skZoom          EQU	33h

skWindow        EQU	34h

skYEqu          EQU	35h

sk2nd           EQU	36h

skMode          EQU	37h

skDel           EQU	38h

;

;======================================================================

;           Tokens

;======================================================================

;

EOSSTART        EQU       0

;

;

;   DISPLAY CONVERSIONS COME IMMEDIATELY BEFORE 'TSTORE'

;

DCONV   EQU     01h

;

tToDMS          EQU       DCONV       ; 01h

tToDEC          EQU       DCONV+1     ; 02h

tToAbc          EQU       DCONV+2     ; 03h    > A b/c

;

tStore          EQU       DCONV+3     ; 04h Lstore                01

;

tBoxPlot        EQU       05h

;

BRACKS          EQU       06h

;

tLBrack         EQU       BRACKS      ; 06h '['

tRBrack         EQU       BRACKS+1    ; 07h ']'

tLBrace         EQU       BRACKS+2    ; 08h '{'

tRBrace         EQU       BRACKS+3    ; 09h '}'

;

tPOST1          EQU       BRACKS+4

;

tFromRad        EQU       tPOST1       ; 0Ah Lradian

tFromDeg        EQU       tPOST1+1     ; 0Bh Ldegree

tRecip          EQU       tPOST1+2     ; 0Ch Linverse

tSqr            EQU       tPOST1+3     ; 0Dh Lsquare

tTrnspos        EQU       tPOST1+4     ; 0Eh Ltranspose

tCube           EQU       tPOST1+5     ; 0Fh '^3'

;

tLParen         EQU       10h         ; 10h '('

tRParen         EQU       11h         ; 11h ')'

;

;

IMUN            EQU       12h

;

tRound          EQU       IMUN        ; 12h 'round'

tPxTst          EQU       IMUN+1      ; 13h 'PXL-TEST'

tAug            EQU       IMUN+2      ; 14h 'aug'

tRowSwap        EQU       IMUN+3      ; 15h 'rSwap'

tRowPlus        EQU       IMUN+4      ; 16h 'rAdd'

tmRow           EQU       IMUN+5      ; 17h 'multR'

tmRowPlus       EQU       IMUN+6      ; 18h 'mRAdd'

tMax            EQU       IMUN+7      ; 19h 'max'

tMin            EQU       IMUN+8      ; 1Ah 'min'

tRToPr          EQU       IMUN+9      ; 1Bh 'R>Pr

tRToPo          EQU       IMUN+10     ; 1Ch 'R>Po

tPToRx          EQU       IMUN+11     ; 1Dh 'P>Rx

tPToRy          EQU       IMUN+12     ; 1Eh 'P>Ry

tMedian         EQU       IMUN+13     ; 1Fh 'MEDIAN

tRandM          EQU       IMUN+14     ; 20h 'randM'

tMean           EQU       IMUN+15     ; 21h

tRoot           EQU       IMUN+16     ; 22h 'ROOT'

tSeries         EQU       IMUN+17     ; 23h 'seq'

tFnInt          EQU       IMUN+18     ; 24h 'fnInt'

tNDeriv         EQU       IMUN+19     ; 25h 'fnIr'

tEvalF          EQU       IMUN+20     ; 26h

tFmin           EQU       IMUN+21     ; 27h

tFmax           EQU       IMUN+22     ; 28h

;

tEOSEL          EQU       IMUN+23

;

tSpace          EQU       tEOSEL       ; 29h   ' '

tString         EQU       tEOSEL+1     ; 2Ah  '"'

tComma          EQU       tEOSEL+2     ; 2Bh  ','

;

;

tii             EQU       2Ch         ; i

;

;======================================================================

;           Postfix Functions

;======================================================================

;

tPost           EQU       2Dh

;

tFact           EQU       tPost       ; 2Dh '!'

;

tCubicR         EQU       2Eh

tQuartR         EQU       2Fh

;======================================================================

;           Number Tokens

;======================================================================

;

NUMS            EQU       30h

;

t0              EQU       NUMS        ; 30h

t1              EQU       NUMS+1      ; 31h

t2              EQU       NUMS+2      ; 32h

t3              EQU       NUMS+3      ; 33h

t4              EQU       NUMS+4      ; 34h

t5              EQU       NUMS+5      ; 35h

t6              EQU       NUMS+6      ; 36h

t7              EQU       NUMS+7      ; 37h

t8              EQU       NUMS+8      ; 38h

t9              EQU       NUMS+9      ; 39h

tDecPt          EQU       NUMS+10     ; 3Ah

tee             EQU       NUMS+11     ; 3Bh

;

;======================================================================

;            BINARY OP

;======================================================================

;

tOr             EQU       3Ch         ; 3Ch  '_or_'

tXor            EQU       3Dh         ; 3Dh

;

tColon          EQU       3Eh         ; 3Eh ':'

tEnter          EQU       3Fh         ; 3Fh  Lenter

;

tAnd            EQU       40h         ; 40h  '_and_'

;

;======================================================================

;            LETTER TOKENS

;======================================================================

;

LET             EQU       41h

;

tA              EQU       LET         ; 41h

tB              EQU       LET+1       ; 42h

tC              EQU       LET+2       ; 43h

tD              EQU       LET+3       ; 44h

tE              EQU       LET+4       ; 45h

tF              EQU       LET+5       ; 46h

tG              EQU       LET+6       ; 47h

tH              EQU       LET+7       ; 48h

tI              EQU       LET+8       ; 49h

tJ              EQU       LET+9       ; 4Ah

tK              EQU       LET+10      ; 4Bh

tL              EQU       LET+11      ; 4Ch

tM              EQU       LET+12      ; 4Dh

tN              EQU       LET+13      ; 4Eh

tO              EQU       LET+14      ; 4Fh

tP              EQU       LET+15      ; 50h

tQ              EQU       LET+16      ; 51h

tR              EQU       LET+17      ; 52h

tS              EQU       LET+18      ; 53h

tT              EQU       LET+19      ; 54h

tU              EQU       LET+20      ; 55h

tV              EQU       LET+21      ; 56h

tW              EQU       LET+22      ; 57h

tX              EQU       LET+23      ; 58h

tY              EQU       LET+24      ; 59h

tZ              EQU       LET+25      ; 5Ah

tTheta          EQU       LET+26      ; 5Bh

;

;======================================================================

;   THESE VAR TOKENS ARE 1ST OF A DOUBLE TOKEN

;======================================================================

;

vToks   EQU     LET+27    ;

;

;       USER MATRIX TOKEN, 2ND TOKEN NEEDED FOR NAME

;

tVarMat         EQU       vToks       ; 5Ch

;

;       USER LIST TOKEN, 2ND TOKEN NEEDED FOR NAME

;

tVarLst         EQU       vToks+1     ; 5Dh

;

;       USER EQUATION TOKEN, 2ND TOKEN NEEDED FOR NAME

;

tVarEqu         EQU       vToks+2     ; 5Eh

tProg           EQU       vToks+3     ; 5Fh

;

;       USER PICT TOKEN, 2ND TOKEN NEEDED FOR NAME

;

tVarPict        EQU       vToks+4     ; 60h

;

;       USER GDB TOKEN, 2ND TOKEN NEEDED FOR NAME

;

tVarGDB         EQU       vToks+5     ; 61h

tVarOut         EQU       vToks+6     ; 62h

tVarSys         EQU       vToks+7     ; 63h

;

;

;======================================================================

;            Mode Setting Commands

;======================================================================

;

MODESA          EQU       vToks+8     ; 64h

;

tRad            EQU       MODESA      ; 64h 'Radian'

tDeg            EQU       MODESA+1    ; 65h 'Degree'

tNormF          EQU       MODESA+2    ; 66h 'Normal'

tSci            EQU       MODESA+3    ; 67h 'Sci'

tEng            EQU       MODESA+4    ; 68h 'Eng'

tFloat          EQU       MODESA+5    ; 69h 'Float'

;

CMPS            EQU       6Ah

;

tEQ             EQU       CMPS        ; 6Ah '=='

tLT             EQU       CMPS+1      ; 6Bh '<'

tGT             EQU       CMPS+2      ; 6Ch '>'

tLE             EQU       CMPS+3      ; 6Dh LLE

tGE             EQU       CMPS+4      ; 6Eh LGE

tNE             EQU       CMPS+5      ; 6Fh LNE

;

;======================================================================

;            BINARY OP

;======================================================================

;

tAdd            EQU       70h         ; 70h '+'

tSub            EQU       71h         ; 71h '-'

tAns            EQU       72h         ; 72h

;

;======================================================================

;            Mode Setting Commands

;======================================================================

;

MODES           EQU       73h

;

tFix            EQU       MODES       ; 73h 'Fix_'

tSplitOn        EQU       MODES+1     ; 74h

tFullScreen     EQU       MODES+2     ; 75h

tStndrd         EQU       MODES+3     ; 76h 'Func'

tParam          EQU       MODES+4     ; 77h 'Param'

tPolar          EQU       MODES+5     ; 78h 'Pol'

tSeqG           EQU       MODES+6     ; 79h

tAFillOn        EQU       MODES+7     ; 7Ah 'AUTO FILL ON

tAFillOff       EQU       MODES+8     ; 7Bh

tACalcOn        EQU       MODES+9     ; 7Ch

tACalcOff       EQU       MODES+10    ; 7Dh 'AutoFill OFF

;

;       GRAPH FORMAT TOKENS ARE 2 BYTE TOKENS

;

tGFormat        EQU       MODES+11    ; 7Eh

;

tBoxIcon        EQU       7Fh

tCrossIcon      EQU       80h

tDotIcon        EQU       81h

;

;======================================================================

;            (More) BINARY OP

;======================================================================

;

tMul            EQU       82h         ; 82h  '*'

tDiv            EQU       83h         ; 83h  '/'

;

;======================================================================

;            SOME GRAPH COMMANDS

;======================================================================

;

GRCMDS          EQU       84h

;

tTrace          EQU       GRCMDS      ; 84h 'Trace'

tClDrw          EQU       GRCMDS+1    ; 85h 'ClDrw'

tZoomStd        EQU       GRCMDS+2    ; 86h 'ZStd'

tZoomtrg        EQU       GRCMDS+3    ; 87h 'Ztrg'

tZoomBox        EQU       GRCMDS+4    ; 88h 'ZBOX'

tZoomIn         EQU       GRCMDS+5    ; 89h 'ZIn'

tZoomOut        EQU       GRCMDS+6    ; 8Ah 'ZOut'

tZoomSqr        EQU       GRCMDS+7    ; 8Bh 'ZSqr'

tZoomInt        EQU       GRCMDS+8    ; 8Ch 'ZInt'

tZoomPrev       EQU       GRCMDS+9    ; 8Dh 'ZPrev'

tZoomDec        EQU       GRCMDS+10   ; 8Eh 'ZDecm'

tZoomStat       EQU       GRCMDS+11   ; 8Fh 'ZStat

tUsrZm          EQU       GRCMDS+12   ; 90h 'ZRcl'

tPrtScrn        EQU       GRCMDS+13   ; 91h 'PrtScrn'

tZoomSto        EQU       GRCMDS+14   ; 92h  ZOOM STORE

tText           EQU       GRCMDS+15   ; 93h

;

;======================================================================

;           BINARY OP  (Combination & Permutation)

;======================================================================

;

tnPr            EQU       GRCMDS+16   ; 94h '_nPr_'

tnCr            EQU       GRCMDS+17   ; 95h '_nCr_'

;

;======================================================================

;           MORE GRAPH COMMANDS

;======================================================================

;

tYOn            EQU       GRCMDS+18   ; 96h 'FnOn_'

tYOff           EQU       GRCMDS+19   ; 97h 'FnOff_'

tStPic          EQU       GRCMDS+20   ; 98h 'StPic_'

tRcPic          EQU       GRCMDS+21   ; 99h 'RcPic_'

tStoDB          EQU       GRCMDS+22   ; 9Ah 'StGDB_'

tRclDB          EQU       GRCMDS+23   ; 9Bh 'RcGDB_'

tLine           EQU       GRCMDS+24   ; 9Ch 'Line'

tVert           EQU       GRCMDS+25   ; 9Dh 'Vert_'

tPtOn           EQU       GRCMDS+26   ; 9Eh 'PtOn'

tPtOff          EQU       GRCMDS+27   ; 9Fh 'PtOff'

;

;======================================================================

;           TOKEN A0 CANNOT BE AN EOS FUNCTION

;           SINCE LOW MULT=A0 ALREADY

;======================================================================

;

tPtChg          EQU       GRCMDS+28   ; A0h 'PtChg'

tPXOn           EQU       GRCMDS+29   ; A1h

tPXOff          EQU       GRCMDS+30   ; A2h

tPXChg          EQU       GRCMDS+31   ; A3h

tShade          EQU       GRCMDS+32   ; A4h 'Shade'

tCircl          EQU       GRCMDS+33   ; A5h 'Circl'

tHorz           EQU       GRCMDS+34   ; A6h 'HORIZONTAL'

tTanLn          EQU       GRCMDS+35   ; A7h 'TanLn'

tDrInv          EQU       GRCMDS+36   ; A8h 'DrInv_'

tDrawF          EQU       GRCMDS+37   ; A9h 'DrawF_'

;

tVarStrng       EQU       0AAh

;

;======================================================================

;           Functions with No Arguments

;======================================================================

;

NOARG   EQU     0ABh

;

tRand           EQU       NOARG       ; ABh 'rand'

tPi             EQU       NOARG+1     ; ACh  Lpi

tGetKey         EQU       NOARG+2     ; ADh 'getKy'

;

;

tAPost          EQU       tGetKey+1   ; APOSTROPHY

tQuest          EQU       tAPost+1    ; QUESTION MARK

;

;

UNARY   EQU     tQuest+1              ; B0h

;

tChs            EQU       UNARY       ; B0h

tInt            EQU       UNARY+1     ; B1h

tAbs            EQU       UNARY+2     ; B2h

tDet            EQU       UNARY+3     ; B3h

tIdent          EQU       UNARY+4     ; B4h

tDim            EQU       UNARY+5     ; B5h

tSum            EQU       UNARY+6     ; B6h

tProd           EQU       UNARY+7     ; B7h

tNot            EQU       UNARY+8     ; B8h

tIPart          EQU       UNARY+9     ; B9h

tFPart          EQU       UNARY+10    ; BAh

;

;

;======================================================================

;           NEW 2 BYTE TOKENS

;======================================================================

;

t2ByteTok       EQU       0BBh         ;

;

;

UNARYLR EQU     UNARY+12

;

tSqrt           EQU       UNARYLR     ; BCh

tCubRt          EQU       UNARYLR+1   ; BDh

tExp            EQU       UNARYLR+3   ; BFh

tLog            EQU       UNARYLR+4   ; C0h

tALog           EQU       UNARYLR+5   ; C1h

tSin            EQU       UNARYLR+6   ; C2h

tASin           EQU       UNARYLR+7   ; C3h

tCos            EQU       UNARYLR+8   ; C4h

tACos           EQU       UNARYLR+9   ; C5h

tTan            EQU       UNARYLR+10  ; C6h

tATan           EQU       UNARYLR+11  ; C7h

tSinH           EQU       UNARYLR+12  ; C8h

tASinH          EQU       UNARYLR+13  ; C9h

tCoshH          EQU       UNARYLR+14  ; CAh

tACosH          EQU       UNARYLR+15  ; CBh

tTanH           EQU       UNARYLR+16  ; CCh

tATanH          EQU       UNARYLR+17  ; CDh

;

;======================================================================

;           SOME PROGRAMMING COMMANDS

;======================================================================

;

PROGTOK EQU     UNARYLR+18

;

tIf             EQU       PROGTOK     ; CEh

tThen           EQU       PROGTOK+1   ; CFh

tElse           EQU       PROGTOK+2   ; D0h

tWhile          EQU       PROGTOK+3   ; D1h

tRepeat         EQU       PROGTOK+4   ; D2h

tFor            EQU       PROGTOK+5   ; D3h

tEnd            EQU       PROGTOK+6   ; D4h

tReturn         EQU       PROGTOK+7   ; D5h

tLbl            EQU       PROGTOK+8   ; D6h   'Lbl_'

tGoto           EQU       PROGTOK+9   ; D7h   'Goto_'

tPause          EQU       PROGTOK+10  ; D8h   'Pause_'

tStop           EQU       PROGTOK+11  ; D9h   'Stop'

tISG            EQU       PROGTOK+12  ; DAh   'IS>'

tDSL            EQU       PROGTOK+13  ; DBh   'DS<'

tInput          EQU       PROGTOK+14  ; DCh   'Input_'

tPrompt         EQU       PROGTOK+15  ; DDh   'Prompt_'

tDisp           EQU       PROGTOK+16  ; DEh   'Disp_'

tDispG          EQU       PROGTOK+17  ; DFh   'DispG'

;

tOutput         EQU       PROGTOK+18  ; E0h    'Outpt'

tClLCD          EQU       PROGTOK+19  ; E1h    'ClLCD'

tConst          EQU       PROGTOK+20  ; E2h    'Fill'

tSortA          EQU       PROGTOK+21  ; E3h    'sortA_'

tSortD          EQU       PROGTOK+22  ; E4h    'sortD_'

tDispTab        EQU       PROGTOK+23  ; E5h    'Disp Table

tMenu           EQU       PROGTOK+24  ; E6h    'Menu'

tSendMBL        EQU       PROGTOK+25  ; E7h    'SEND'

tGetMBL         EQU       PROGTOK+26  ; E8h    'GET'

;

;======================================================================

;           STAT PLOT COMMANDS

;======================================================================

;

statPCmd        EQU       PROGTOK+27

;

tPlotOn         EQU       statPCmd    ; E9h     ' PLOTSON'

tPlotOff        EQU       statPCmd+1   ; EAh     ' PLOTSOFF

;

tListName       EQU       0EBh        ; LIST DESIGNATOR

;

tPlot1          EQU       0ECh

tPlot2          EQU       0EDh

tPlot3          EQU       0EEh

;

tUnused01       EQU       0EFh        ;        available?

;

tPower          EQU       0F0h        ;        '^'

tXRoot          EQU       0F1h        ;        LsupX,Lroot

STATCMD         EQU       0F2h

;

tOneVar         EQU       STATCMD     ; F2h    'OneVar_'

tTwoVar         EQU       STATCMD+1   ; F3h

tLR             EQU       STATCMD+2   ; F4h    'LinR(A+BX

tLRExp          EQU       STATCMD+3   ; F5h    'ExpR_'

tLRLn           EQU       STATCMD+4   ; F6h    'LnR_'

tLRPwr          EQU       STATCMD+5   ; F7h    'PwrR_'

tMedMed         EQU       STATCMD+6   ; F8h

tQuad           EQU       STATCMD+7   ; F9h

tClrLst         EQU       STATCMD+8   ; FAh    'CLEAR LIST

tClrTbl         EQU       STATCMD+9   ; FBh    CLEAR TABLE

tHist           EQU       STATCMD+10  ; FCh    'Hist_'

txyLine         EQU       STATCMD+11  ; FDh    'xyline_'

tScatter        EQU       STATCMD+12  ; FEh    'Scatter_'

tLR1            EQU       STATCMD+13  ; FFh    'LINR(AX+B

;

;======================================================================

;           2ND HALF OF GRAPH FORMAT TOKENS

;======================================================================

;           Format settings commands

;

GFMT            EQU       0

;

tSeq            EQU       GFMT        ; 'SeqG'

tSimulG         EQU       GFMT+1      ; 'SimulG'

tPolarG         EQU       GFMT+2      ; 'PolarGC'

tRectG          EQU       GFMT+3      ; 'RectGC'

tCoordOn        EQU       GFMT+4      ; 'CoordOn'

tCoordOff       EQU       GFMT+5      ; 'CoordOff'

tDrawLine       EQU       GFMT+6      ; 'DrawLine'

tDrawDot        EQU       GFMT+7      ; 'DrawDot'

tAxisOn         EQU       GFMT+8      ; 'AxesOn'

tAxisOff        EQU       GFMT+9      ; 'AxesOff'

tGridOn         EQU       GFMT+10     ; 'GridOn'

tGridOff        EQU       GFMT+11     ; 'GridOff'

tLblOn          EQU       GFMT+12     ; 'LabelOn'

tLblOff         EQU       GFMT+13     ; 'LabelOff'

tWebOn          EQU       GFMT+14     ; 'WebOn'

tWebOff         EQU       GFMT+15     ; 'WebOFF'

tuv             EQU       GFMT+16     ; U vs V

tvw             EQU       GFMT+17     ; V vs W

tuw             EQU       GFMT+18     ; U vs W

;

;======================================================================

;           2ND HALF OF USER MATRIX TOKENS

;======================================================================

;

tMatA           EQU       00h         ; MAT A

tMatB           EQU       01h         ; MAT B

tMatC           EQU       02h         ; MAT C

tMatD           EQU       03h         ; MAT D

tMatE           EQU       04h         ; MAT E

tMatF           EQU       05h         ; MAT F

tMatG           EQU       06h         ; MAT G

tMatH           EQU       07h         ; MAT H

tMatI           EQU       08h         ; MAT I

tMatJ           EQU       09h         ; MAT J

;

;======================================================================

;           2ND HALF OF USER LIST TOKENS

;======================================================================

;

tL1             EQU       00h         ; LIST 1

tL2             EQU       01h         ; LIST 2

tL3             EQU       02h         ; LIST 3

tL4             EQU       03h         ; LIST 4

tL5             EQU       04h         ; LIST 5

tL6             EQU       05h         ; LIST 6

;

;======================================================================

;           2ND HALF OF USER EQUATION TOKENS

;======================================================================

;

;       "Y" EQUATIONS HAVE BIT 4 SET

;

tY1             EQU       10h         ; Y1

tY2             EQU       11h         ; Y2

tY3             EQU       12h         ; Y3

tY4             EQU       13h         ; Y4

tY5             EQU       14h         ; Y5

tY6             EQU       15h         ; Y6

tY7             EQU       16h         ; Y7

tY8             EQU       17h         ; Y8

tY9             EQU       18h         ; Y9

tY0             EQU       19h         ; Y0

;

;       PARAM EQUATIONS HAVE BIT 5 SET

;

tX1T            EQU       20h         ; X1t

tY1T            EQU       21h         ; Y1t

tX2T            EQU       22h         ; X2t

tY2T            EQU       23h         ; Y2t

tX3T            EQU       24h         ; X3t

tY3T            EQU       25h         ; Y3t

tX4T            EQU       26h         ; X4t

tY4T            EQU       27h         ; Y4t

tX5T            EQU       28h         ; X5t

tY5T            EQU       29h         ; Y5t

tX6T            EQU       2Ah         ; X6t

tY6T            EQU       2Bh         ; Y6t

;

;       POLAR EQUATIONS HAVE BIT 6 SET

;

tR1             EQU       40h         ; R1

tR2             EQU       41h         ; R2

tR3             EQU       42h         ; R3

tR4             EQU       43h         ; R4

tR5             EQU       44h         ; R5

tR6             EQU       45h         ; R6

;

;       RECURSION EQUATIONS HAVE BIT 7 SET

;

tun             EQU       80h         ; Un

tvn             EQU       81h         ; Vn

twn             EQU       82h         ; Wn

;

;======================================================================

;           2ND HALF OF USER PICTURE TOKENS

;======================================================================

;

tPic1           EQU       00h         ; PIC1

tPic2           EQU       01h         ; PIC2

tPic3           EQU       02h         ; PIC3

tPic4           EQU       03h         ; PIC4

tPic5           EQU       04h         ; PIC5

tPic6           EQU       05h         ; PIC6

tPic7           EQU       06h         ; PIC7

tPic8           EQU       07h         ; PIC8

tPic9           EQU       08h         ; PIC9

tPic0           EQU       09h         ; PIC0

;

;======================================================================

;           2ND HALF OF USER GRAPH DATABASE TOKENS

;======================================================================

;

tGDB1           EQU       00h         ; GDB1

tGDB2           EQU       01h         ; GDB2

tGDB3           EQU       02h         ; GDB3

tGDB4           EQU       03h         ; GDB4

tGDB5           EQU       04h         ; GDB5

tGDB6           EQU       05h         ; GDB6

tGDB7           EQU       06h         ; GDB7

tGDB8           EQU       07h         ; GDB8

tGDB9           EQU       08h         ; GDB9

tGDB0           EQU       09h         ; GDB0

;

;======================================================================

;           2ND HALF OF STRING VARS

;======================================================================

;

tStr1           EQU       00h

tStr2           EQU       01h

tStr3           EQU       02h

tStr4           EQU       03h

tStr5           EQU       04h

tStr6           EQU       05h

tStr7           EQU       06h

tStr8           EQU       07h

tStr9           EQU       08h

tStr0           EQU       09h

;

;======================================================================

;           2ND HALF OF SYSTEM OUTPUT ONLY VARIABLES

;======================================================================

;

;

;   OPEN        EQU       00h

;

tRegEq          EQU       01h         ; REGRESSION EQUATION

;

tStatN          EQU       02h         ; STATISTICS N

;

tXMean          EQU       03h         ; X MEAN

tSumX           EQU       04h         ; SUM(X)

tSumXSqr        EQU       05h         ; SUM(X^2)

tStdX           EQU       06h         ; STANDARD DEV X

tStdPX          EQU       07h         ; STANDARD DEV POP X

tMinX           EQU       08h         ; Min X VALUE

tMaxX           EQU       09h         ; Max X VALUE

;

tMinY           EQU       0Ah         ; Min Y VALUE

tMaxY           EQU       0Bh         ; Max Y VALUE

tYmean          EQU       0Ch         ; Y MEAN

tSumY           EQU       0Dh         ; SUM(Y)

tSumYSqr        EQU       0Eh         ; SUM(Y^2)

tStdY           EQU       0Fh         ; STANDARD DEV Y

tStdPY          EQU       10h         ; STANDARD DEV POP Y

;

tSumXY          EQU       11h         ; SUM(XY)

tCorr           EQU       12h         ; CORRELATION

tMedX           EQU       13h         ; MED(X)

tQ1             EQU       14h         ; 1ST QUADRANT OF X

tQ3             EQU       15h         ; 3RD QUADRANT OF X

tQuadA          EQU       16h         ; 1ST TERM OF QUAD POLY REG/ Y-INT

tQuadB          EQU       17h         ; 2ND TERM OF QUAD POLY REG/ SLOPE

tQuadC          EQU       18h         ; 3RD TERM OF QUAD POLY REG

tCubeD          EQU       19h         ; 4TH TERM OF CUBIC POLY REG

tQuartE         EQU       1Ah         ; 5TH TERM OF QUART POLY REG

tMedX1          EQU       1Bh         ; x1 FOR MED-MED

tMedX2          EQU       1Ch         ; x2 FOR MED-MED

tMedX3          EQU       1Dh         ; x3 FOR MED-MED

tMedY1          EQU       1Eh         ; y1 FOR MED-MED

tMedY2          EQU       1Fh         ; y2 FOR MED-MED

tMedY3          EQU       20h         ; y3 FOR MED-MED

;

tRecurn	EQU       21h	; RECURSION N

tStatP          EQU       22h

tStatZ          EQU       23h

tStatT          EQU       24h

tStatChi        EQU       25h

tStatF          EQU       26h

tStatDF         EQU       27h

tStatPhat       EQU       28h

tStatPhat1      EQU       29h

tStatPhat2      EQU       2Ah

tStatMeanX1     EQU       2Bh

tStatStdX1      EQU       2Ch

tStatN1         EQU       2Dh

tStatMeanX2     EQU       2Eh

tStatStdX2      EQU       2Fh

tStatN2         EQU       30h

tStatStdXP      EQU       31h

tStatLower      EQU       32h

tStatUpper      EQU       33h

tStat_s         EQU       34h

tLRSqr          EQU       35h         ; r^2

tBRSqr          EQU       36h         ; R^2

;

;======================================================================

;       These next tokens are only used to access the data

;       they are display only and the user cannot access them at all

;======================================================================

;

tF_DF    EQU     37h       ; ANOFAV FACTOR DF

tF_SS    EQU     38h       ; ANOFAV FACTOR SS

tF_MS    EQU     39h       ; ANOFAV FACTOR MS

tE_DF    EQU     3Ah       ; ANOFAV ERROR DF

tE_SS    EQU     3Bh       ; ANOFAV ERROR SS

tE_MS    EQU     3Ch       ; ANOFAV ERROR MS

;

;

;======================================================================

;           2ND HALF OF SYSTEM INPUT/OUTPUT VARIABLES

;======================================================================

;      SYSTEM VARIABLE EQUATES

;

tuXscl       EQU  0

tuYscl       EQU  1

tXscl        EQU  2

tYscl        EQU  3

tRecuru0     EQU  4        ; U 1ST INITIAL COND

tRecurv0     EQU  5        ; V 1ST INITIAL COND

tun1         EQU  6        ; U(N-1)    ; NOT USED

tvn1         EQU  7        ; V(N-1)    ; NOT USED

tuRecuru0    EQU  8        ;

tuRecurv0    EQU  9        ;

;

tXmin        EQU  0Ah

tXmax        EQU  0Bh

tYmin        EQU  0Ch

tYmax        EQU  0Dh

tTmin        EQU  0Eh

tTmax        EQU  0Fh

tThetaMin    EQU  10h

tThetaMax    EQU  11h

tuXmin       EQU  12h

tuXmax       EQU  13h

tuYmin       EQU  14h

tuYmax       EQU  15h

tuThetMin    EQU  16h

tuThetMax    EQU  17h

tuTmin       EQU  18h

tuTmax       EQU  19h

tTblMin      EQU  1Ah

tPlotStart   EQU  1Bh

tuPlotStart  EQU  1Ch

tnMax        EQU  1Dh

tunMax       EQU  1Eh

tnMin        EQU  1Fh

tunMin       EQU  20h

;

tTblStep	EQU  21h

tTStep	EQU  22h

tThetaStep	EQU  23h

tuTStep	EQU  24h

tuThetStep	EQU  25h

;

tDeltaX	EQU  26h

tDeltaY	EQU  27h

;

tXFact	EQU  28h

tYFact	EQU  29h

;

tTblInput       EQU       2Ah

;

tFinN           EQU       2Bh

tFinI           EQU       2Ch

tFinPV          EQU       2Dh

tFinPMT         EQU       2Eh

tFinFV          EQU       2Fh

tFinPY          EQU       30h

tFinCY          EQU       31h

;

tRecurw0        EQU       32h         ; w0(1)

tuRecurw0       EQU       33h

;

tPlotStep       EQU       34h

tuPlotStep      EQU       35h

;

tXres           EQU       36h

tuXres          EQU       37h

;

tRecuru02       EQU       38h         ; u0(2)

tuRecuru02      EQU       39h

tRecurv02       EQU       3Ch         ; v0(2)

tuRecurv02      EQU       3Dh

tRecurw02       EQU       3Eh         ; w0(2)

tuRecurw02      EQU       3Fh

;

;======================================================================

;           2nd byte of t2ByteTok tokens

;======================================================================

;

tFinNPV         EQU       00h         ;

tFinIRR         EQU       01h         ;

tFinBAL         EQU       02h         ;

tFinPRN         EQU       03h         ;

tFinINT         EQU       04h         ;

tFinToNom       EQU       05h         ;

tFinToEff       EQU       06h         ;

tFinDBD         EQU       07h         ;

tLCM            EQU       08h         ;

tGCD            EQU       09h         ;

tRandInt        EQU       0Ah         ;

tRandBin        EQU       0Bh         ;

tSubStrng       EQU       0Ch         ;

tStdDev         EQU       0Dh         ;

tVariance       EQU       0Eh         ;

tInStrng        EQU       0Fh         ;

tDNormal        EQU       10h         ;

tInvNorm        EQU       11h         ;

tDT             EQU       12h         ;

tChI            EQU       13h         ;

tDF             EQU       14h         ;

tBINPDF         EQU       15h         ;

tBINCDF         EQU       16h         ;

tPOIPDF         EQU       17h         ;

tPOICDF         EQU       18h         ;

tGEOPDF         EQU       19h         ;

tGEOCDF         EQU       1Ah         ;

tNormalPDF      EQU       1Bh         ;

tTPDF           EQU       1Ch         ;

tChiPDF         EQU       1Dh         ;

tFPDF           EQU       1Eh         ;

tRandNorm       EQU       1Fh         ;

tFinFPMT        EQU       20h         ;

tFinFI          EQU       21h         ;

tFinFPV         EQU       22h         ;

tFinFN          EQU       23h         ;

tFinFFV         EQU       24h         ;

tConj           EQU       25h         ;

tReal           EQU       26h         ;

tImag           EQU       27h         ;

tAngle          EQU       28h         ;

tCumSum         EQU       29h         ;

tExpr           EQU       2Ah         ;

tLength         EQU       2Bh         ;

tDeltaLst       EQU       2Ch         ;

tRef            EQU       2Dh         ;

tRRef           EQU       2Eh         ;

tToRect         EQU       2Fh         ;

tToPolar        EQU       30h         ;

tConste         EQU       31h         ;

tSinReg         EQU       32h         ;

tLogistic       EQU       33h         ;

tLinRegTTest    EQU       34h         ;

tShadeNorm      EQU       35h         ;

tShadeT         EQU       36h         ;

tShadeChi       EQU       37h         ;

tShadeF         EQU       38h         ;

tMatToLst       EQU       39h         ;

tLstToMat       EQU       3Ah         ;

tZTest          EQU       3Bh         ;

tTTest          EQU       3Ch         ;

t2SampZTest     EQU       3Dh         ;

t1PropZTest     EQU       3Eh         ;

t2PropZTest     EQU       3Fh         ;

tChiTest        EQU       40h         ;

tZIntVal        EQU       41h         ;

t2SampZInt      EQU       42h         ;

t1PropZInt      EQU       43h         ;

t2PropZInt      EQU       44h         ;

tGraphStyle     EQU       45h         ;

t2SampTTest     EQU       46h         ;

t2SampFTest     EQU       47h         ;

tTIntVal        EQU       48h         ;

t2SampTInt      EQU       49h         ;

tSetupLst       EQU       4Ah         ;

tFinPMTend      EQU       4Bh         ;

tFinPMTbeg      EQU       4Ch         ;

tRealM          EQU       4Dh         ;

tPolarM         EQU       4Eh         ;

tRectM          EQU       4Fh         ;

tExprOn         EQU       50h         ;

tExprOff        EQU       51h         ;

tClrAllLst      EQU       52h         ;

tGetCalc        EQU       53h         ;

tDelVar         EQU       54h         ;

tEquToStrng     EQU       55h         ;

tStrngToEqu     EQU       56h         ;

tDelLast        EQU       57h         ;

tSelect         EQU       58h         ;

tANOVA          EQU       59h         ;

tModBox         EQU       5Ah         ;

tNormProb       EQU       5Bh         ;

;

;

tMGT            EQU       64h         ; VERTICAL SPLIT

tZFit           EQU       65h         ; ZOOM FIT

tDiag_on        EQU       66h         ; DIANOSTIC DISPLAY ON

tDiag_off       EQU       67h         ; DIANOSTIC DISPLAY OFF

tOkEnd2v0       EQU       67h         ;end of 2byte tokens for version 0.

tArchive        EQU       68h         ;archive

tUnarchive      EQU       69h         ;unarchive

tasm	EQU	  6Ah

tasmComp	EQU	  6Bh	      ; asm compile

tasmPrgm	EQU	  6Ch	      ; signifies a program is asm

tasmCmp 	EQU	  6Dh	      ; asm program is compiled

;

tLcapAAcute     EQU       6Eh

tLcapAGrave     EQU       6Fh

tLcapACaret     EQU       70h

tLcapADier      EQU       71h

tLaAcute        EQU       72h

tLaGrave        EQU       73h

tLaCaret        EQU       74h

tLaDier         EQU       75h

tLcapEAcute     EQU       76h

tLcapEGrave     EQU       77h

tLcapECaret     EQU       78h

tLcapEDier      EQU       79h

tLeAcute        EQU       7Ah

tLeGrave        EQU       7Bh

tLeCaret        EQU       7Ch

tLeDier         EQU       7Dh

;

tLcapIGrave     EQU       7Fh

tLcapICaret     EQU       80h

tLcapIDier      EQU       81h

tLiAcute        EQU       82h

tLiGrave        EQU       83h

tLiCaret        EQU       84h

tLiDier         EQU       85h

tLcapOAcute     EQU       86h

tLcapOGrave     EQU       87h

tLcapOCaret     EQU       88h

tLcapODier      EQU       89h

tLoAcute        EQU       8Ah

tLoGrave        EQU       8Bh

tLoCaret        EQU       8Ch

tLoDier         EQU       8Dh

tLcapUAcute     EQU       8Eh

tLcapUGrave     EQU       8Fh

tLcapUCaret     EQU       90h

tLcapUDier      EQU       91h

tLuAcute        EQU       92h

tLuGrave        EQU       93h

tLuCaret        EQU       94h

tLuDier         EQU       95h

tLcapCCed       EQU       96h

tLcCed          EQU       97h

tLcapNTilde     EQU       98h

tLnTilde        EQU       99h

tLaccent        EQU       9Ah

tLgrave         EQU       9Bh

tLdieresis      EQU       9Ch

tLquesDown      EQU       9Dh

tLexclamDown    EQU       9Eh

tLalpha         EQU       9Fh

tLbeta          EQU      0a0h

tLgamma         EQU      0a1h

tLcapDelta      EQU      0a2h

tLdelta         EQU      0a3h

tLepsilon       EQU      0a4h

tLlambda        EQU      0a5h

tLmu            EQU      0a6h

tLpi            EQU      0a7h

tLrho           EQU      0a8h

tLcapSigma      EQU      0a9h

;

;

tLphi           EQU      0aBh

tLcapOmega      EQU      0aCh

tLphat          EQU      0aDh

tLchi           EQU      0aEh

tLstatF         EQU      0aFh

;

tLa      EQU     0b0h

tLb      EQU     0b1h

tLc      EQU     0b2h

tLd      EQU     0b3h

tLsmalle EQU     0b4h

tLf      EQU     0b5h

tLsmallg EQU     0b6h

tLh      EQU     0b7h

tLi      EQU     0b8h

tLj      EQU     0b9h

tLk      EQU     0bAh

;

tLl      EQU     0bCh

tLm      EQU     0bDh

tLn      EQU     0bEh

tLo      EQU     0bFh

tLp      EQU     0c0h

tLq      EQU     0c1h

tLsmallr EQU     0c2h

tLs      EQU     0c3h

tLsmallt EQU     0c4h

tLu      EQU     0c5h

tLv      EQU     0c6h

tLw      EQU     0c7h

tLx      EQU     0c8h

tLy      EQU     0c9h

tLz      EQU     0cAh

tLsigma         EQU      0cbh

tLtau           EQU      0cch

tLcapIAcute     EQU      0cdh

;

;

tGarbagec EQU    0Ceh

LastToken       EQU      0Ceh         ;tLAST TOKEN IN THIS VERSION...

;

;======================================================================

;           Data Type Equates

;======================================================================

;

RealObj         EQU       0

ListObj         EQU       1

MatObj          EQU       2

EquObj          EQU       3

StrngObj        EQU       4

ProgObj         EQU       5

ProtProgObj     EQU       6

PictObj         EQU       7

GDBObj          EQU       8

UnknownObj      EQU       9

UnknownEquObj   EQU       0Ah

NewEquObj       EQU       0Bh

CplxObj         EQU       0Ch

CListObj        EQU       0Dh

UndefObj        EQU       0Eh

WindowObj       EQU       0Fh

ZStoObj         EQU       10h

TblRngObj       EQU       11h

LCDObj          EQU       12h

BackupObj       EQU       13h

AppObj	EQU	  14h	;application, only used in menus/link

AppVarObj	EQU	  15h	;application variable

TempProgObj     EQU       16h           ;program, home deletes when finished

GroupObj        EQU       17h           ;group.

;

;======================================================================

;           I/O equates

;======================================================================

;

D0D1_bits	EQU  03h

D0LD1L	EQU  03h

D0LD1H	EQU  01h

D0HD1L	EQU  02h

D0HD1H	EQU  00h

bport	EQU  0	; 4-BIT LINK PORT (I/O)

;

;======================================================================

;           DEVICE CODES

;======================================================================

;

;

TI82DEV	EQU  82h

PC82DEV	EQU  02h

MAC82DEV	EQU  12h

;

LINK83FDEV	EQU  23h

;

TI83DEV	EQU  83h

PC83DEV	EQU  03h

MAC83DEV	EQU  13h

;

TI85DEV	EQU  95h      ; DIFF THEN REAL 85 SO ME TALK

PC85DEV	EQU  05h

MAC85DEV	EQU  15h

;

TI73DEV	EQU  74h      ; Device x3 is always an 83

PC73DEV	EQU  07h

MAC73DEV	EQU  17h

;

TI83FDEV	EQU  73h

LINK73FDEV	EQU  23h

PC83FDEV	EQU  23h

;

;======================================================================

;           System Error Codes

;======================================================================

;

E_EDITF	EQU	7	;allow re-entering application

E_EDIT	EQU	1<<E_EDITF

E_Mask	EQU	7Fh

E_Overflow	EQU	1+E_EDIT

E_DivBy0	EQU	2+E_EDIT

E_SingularMat	EQU	3+E_EDIT

E_Domain	EQU	4+E_EDIT

E_Increment	EQU	5+E_EDIT

E_Break	EQU	6+E_EDIT

E_NonReal       EQU     7+E_EDIT

E_Syntax        EQU     8+E_EDIT

E_DataType      EQU     9+E_EDIT

E_Argument      EQU     10+E_EDIT

E_DimMismatch   EQU     11+E_EDIT

E_Dimension     EQU     12+E_EDIT

E_Undefined     EQU     13+E_EDIT

E_Memory        EQU     14+E_EDIT

E_Invalid       EQU     15+E_EDIT

E_IllegalNest   EQU     16+E_EDIT

E_Bound         EQU     17+E_EDIT

E_GraphRange    EQU     18+E_EDIT

E_Zoom          EQU     19+E_EDIT

E_Label         EQU     20

E_Stat          EQU     21

E_Solver        EQU     22+E_EDIT

E_Singularity   EQU     23+E_EDIT

E_SignChange    EQU     24+E_EDIT

E_Iterations    EQU     25+E_EDIT

E_BadGuess      EQU     26+E_EDIT

E_StatPlot      EQU     27

E_TolTooSmall   EQU     28+E_EDIT

E_Reserved      EQU     29+E_EDIT

E_Mode          EQU     30+E_EDIT

E_LnkErr        EQU     31+E_EDIT

E_LnkMemErr     EQU     32+E_EDIT

E_LnkTransErr   EQU     33+E_EDIT

E_LnkDupErr     EQU     34+E_EDIT

E_LnkMemFull    EQU     35+E_EDIT

E_Unknown       EQU     36+E_EDIT

E_Scale         EQU     37+E_EDIT

E_IdNotFound    EQU     38

E_NoMode        EQU     39+E_EDIT

E_Validation    EQU     40

E_Length        EQU     41+E_EDIT

E_Application   EQU     42+E_EDIT

E_AppErr1       EQU     43+E_EDIT

E_AppErr2       EQU     44+E_EDIT

E_ExpiredApp	EQU	45

E_BadAddr	EQU	46

E_Archived      EQU     47+E_EDIT

E_Version       EQU     48

E_ArchFull      EQU     49

E_Variable      EQU     50+E_EDIT

E_Duplicate     EQU     51+E_EDIT

HigErrNum       EQU     51

; obsolete error numbers34              ;first LINK error

E_LinkIOChkSum	EQU	34

E_LinkIOTimeOut	EQU	35

E_LinkIOBusy	EQU	36

E_LinkIOVer	EQU	37

;

;======================================================================

;           EQUATES TO RAM LOCATIONS FOR STAT VARS

;======================================================================

;

;

FPLEN	EQU	9	;Length of a floating-point number.

StatN   EQU     statVars

XMean   EQU     StatN      + FPLEN

SumX    EQU     XMean      + FPLEN

SumXSqr EQU     SumX       + FPLEN

StdX    EQU     SumXSqr    + FPLEN

StdPX   EQU     StdX       + FPLEN

MinX    EQU     StdPX      + FPLEN

MaxX    EQU     MinX       + FPLEN

MinY    EQU     MaxX       + FPLEN

MaxY    EQU     MinY       + FPLEN

YMean   EQU     MaxY       + FPLEN

SumY    EQU     YMean      + FPLEN

SumYSqr EQU     SumY       + FPLEN

StdY    EQU     SumYSqr    + FPLEN

StdPY   EQU     StdY       + FPLEN

SumXY   EQU     StdPY      + FPLEN

Corr    EQU     SumXY      + FPLEN

MedX    EQU     Corr       + FPLEN

Q1      EQU     MedX       + FPLEN

Q3      EQU     Q1         + FPLEN

QuadA   EQU     Q3         + FPLEN

QuadB   EQU     QuadA      + FPLEN

QuadC   EQU     QuadB      + FPLEN

CubeD   EQU     QuadC      + FPLEN

QuartE  EQU     CubeD      + FPLEN

MedX1   EQU     QuartE     + FPLEN

MedX2   EQU     MedX1      + FPLEN

MedX3   EQU     MedX2      + FPLEN

MedY1   EQU     MedX3      + FPLEN

MedY2   EQU     MedY1      + FPLEN

MedY3   EQU     MedY2      + FPLEN

PStat   EQU     MedY3      + 2*FPLEN

ZStat   EQU     PStat      + FPLEN

TStat   EQU     ZStat      + FPLEN

ChiStat EQU     TStat      + FPLEN

FStat   EQU     ChiStat    + FPLEN

DF      EQU     FStat      + FPLEN

Phat    EQU     DF         + FPLEN

Phat1   EQU     Phat       + FPLEN

Phat2   EQU     Phat1      + FPLEN

MeanX1  EQU     Phat2      + FPLEN

StdX1   EQU     MeanX1     + FPLEN

StatN1  EQU     StdX1      + FPLEN

MeanX2  EQU     StatN1     + FPLEN

StdX2   EQU     MeanX2     + FPLEN

StatN2  EQU     StdX2      + FPLEN

StdXP2  EQU     StatN2     + FPLEN

SLower  EQU     StdXP2     + FPLEN

SUpper  EQU     SLower     + FPLEN

SStat   EQU     SUpper     + FPLEN

F_DF	EQU     anovaf_vars

F_SS	EQU     F_DF + FPLEN

F_MS	EQU     F_SS + FPLEN

E_DF	EQU     F_MS + FPLEN

E_SS	EQU     E_DF + FPLEN

E_MS	EQU     E_SS + FPLEN

This help file has been produced using helpMATIC Pro V1.22 Shareware

http://members.aol.com/harbsg/

The above message will not appear in the registered version


Tutorial 25

Checking your TI-83 Plus' Memory via Asm Progam

Introduction

This tutorial will show you how to create a RAM checking program. This program will make good use of the _Memchk(_Memchk = 42E5h) and _Disphl(Disphl = 4507h) ROM calls.

Programming

.NOLIST

#define     equ             .equ

#define     EQU             .equ

#define     END             .end

#include "ti83PlusAsm.inc"

.LIST

.org 9D95h

B_CALL(_ClrLCDfull)

ld hl,Mem	;Load Text

B_CALL(_puts)

B_CALL(_Memchk)	;Check RAM

B_CALL(_DispHL)	;Display contents of HL

ret

Mem:

.db "RAM free (bytes)"

.end

END

How the Program Worked

This is a fairly simple program. The _Memchk ROM call checks the amont of memory available in RAM. It hen stores that value to the HL register. _DispHL then displays the contents of HL on the screen.

New Commands

_MemChk - Checks amount of memory in RAM, outputs value to hl.

_Disphl - Displays contents of HL

Conclusion

This wasn't hard. =) Amount of Free RAM may vary due to hidden system variables not marked dirty. This may alter the Free RAM returned by a few bytes.

This help file has been produced using helpMATIC Pro V1.22 Shareware

http://members.aol.com/harbsg/

The above message will not appear in the registered version