ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ ÜÜÜÜÜ ÜÜÜ Ü Ü ÜÜÜÜÜ Ü Ü Üß Û ß Û Û Û Û Û Version 3.0 Üß ßßßÜ ÛßßßÛ Ûßß Û Û January 1995 ÛÜÜÜÜ ßÜÜÜß Û Û ÛÜÜÜÜ ÛÜÜÜÜ ÛÜÜÜÜ Copyright 1995 Dan Eble Internet: dan.eble@commlink.org ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ TABLE OF CONTENTS ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ PART ONE: FOR USERS ------------------- I. INTRODUCTION II. REQUIREMENTS III. PUTTING ZSHELL ON YOUR CALCULATOR IV. RUNNING ZSHELL V. RUNNING PROGRAMS FROM ZSHELL PART TWO: FOR PROGRAMMERS ------------------------- VI. DIFFICULTIES OF PROGRAMMING THE TI-85 VII. PROGRAMMING FOR THE ZSHELL OPERATING SYSTEM VIII. LISTS OF HELPFUL INFORMATION PART THREE: OTHER TOPICS ------------------------ IX. LEGAL STUFF X. REVISION HISTORY ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ PART ONE: FOR USERS ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ I. INTRODUCTION ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ ZShell is a program for the TI-85 graphing calculator that enables execution of Z80-compatible programs stored in string variables. ZShell is a shell and an operating system combined. The shell part provides an organized way to list and execute the string programs stored on the calculator. The operating system part provides functions necessary for the string programs to work properly with different ROM versions and in the quicksand environment of the TI-85's memory. ZSHELL30.ZIP -------------- ZSHELL .85B -- ZShell, Connect Four, Element List, Matricks, Memory, Minesweeper, Tiles, TILEPIC, and Tron. ZSHELL .DOC -- this file TI-GAMES.DOC -- game instructions TI-85 .H -- header file for TASM facilitating TI-85 programming. TASM is the Table Assembler, not Borland's product. STRING85.COM -- compiles binary Z80 code into an .85S file ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ II. REQUIREMENTS ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ You must have a Graph-Link or know someone who does or know someone who knows someone who does... For this version of ZShell, you must have ROM version 3.0A, 4.0, 6.0, or 8.0. To find out what version of ROM you have, press the following keys: [2nd] [MODE] [ALPHA] [S]. The sentence "Enter self test?" accompanied by a version number will appear. Hit any key EXCEPT [ENTER]. PRESSING [ENTER] WILL CAUSE YOUR MEMORY TO BE ERASED. ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ III. PUTTING ZSHELL ON YOUR CALCULATOR ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ ZShell itself is stored in a string variable. All you have to do to put it in your calculator is use your the Graph-Link and transfer a memory backup to your calculator. To do this without losing whatever is presently in your memory, follow these steps: 1) Transfer all of the data on your calculator to a group file on the computer. 2) Transfer the ZShell backup file to your calculator. 3) Transfer the group file back to your calculator. Don't overwrite any variables from the ZShell backup. ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ IV. RUNNING ZSHELL ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ To run ZSHELL, hit [CUSTOM] [F1]. Note that if you have a ROM version other than the ones listed in the "REQUIREMENTS" section (II), ZShell will not run. Programs made for ZShell 2.0 and 1.0 are incompatible with newer ones. ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ V. RUNNING PROGRAMS FROM ZSHELL ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ When you start ZShell, it displays a list of the string programs on your calculator, or "NO PROGRAMS" if it can't find any. Use the up and down arrow keys to select a program, [MORE] to see the next page of programs (if you have more than eight), [ENTER] to run a program, and [EXIT] to return to the home screen. ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ PART TWO: FOR PROGRAMMERS ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ VI. DIFFICULTIES OF PROGRAMMING THE TI-85 ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ 1) Different versions of ROM are very much alike, but differ slightly in the offset of most CALLs. 2) The calculator dynamically rearranges its memory, so there is never an sure way to pinpoint the location of a program in order to access data and do JUMPs and CALLs. One way to circumvent this problem is to recall a picture variable into the graphics memory (8641). 3) The PIC method of storing programs is convenient, but too inflexible. It limits (or augments) the size of a program to 1008 bytes and requires much pressing of keys to go between programs. ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ VII. PROGRAMMING FOR THE ZSHELL OPERATING SYSTEM ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ ZShell fixes the ROM CALL offset problem by providing a function that, given an address, adds the proper offset before calling a ROM routine. The address of this CALL_ROM routine is 8C09. My ROM version is 3.0A, so all CALLs to ROM functions must be to 3.0A addresses. Here is an example of how to clear the screen (the clear screen function is at 3DFC in ROM 3.0A): call $8C09 ; this is a call to the CALL_ROM function .dw $3DFC ; the following two bytes specify the address If your assembler can handle macros (I recommend TASM), then you could define some so that the above looks like this in your code: CALL_ROM(CLEARLCD) ; "Ah," you say, "Very nice." **You can get TASM at mrcnext.cso.uiuc.edu in /pub/pcsig as "disk0643.zip"** In order to do CALLs and JUMPs within your own program, there are functions that do add the program's offset in memory to the address you supply. In TI-85.H, I have defined these macros: ; Type of CALL or JUMP Address #DEFINE CALL_ROM(addr) call $8C09 \ .dw addr #DEFINE CALL_Z(addr) call $8C0C \ .dw addr #DEFINE CALL_(addr) call $8C0F \ .dw addr #DEFINE CALL_NZ(addr) call $8C12 \ .dw addr #DEFINE CALL_C(addr) call $8C18 \ .dw addr #DEFINE CALL_NC(addr) call $8C1E \ .dw addr #DEFINE JUMP_Z(addr) call $8C24 \ .dw addr #DEFINE JUMP_(addr) call $8C27 \ .dw addr #DEFINE JUMP_NZ(addr) call $8C2A \ .dw addr #DEFINE JUMP_C(addr) call $8C30 \ .dw addr #DEFINE JUMP_NC(addr) call $8C36 \ .dw addr Therefore, if you wanted to JUMP if the carry flag were set to location ABC relative to the beginning of your program, you would do this: call $8C30 ; address of JUMP_C .dw $0ABC ; address of where to JUMP Or, with the macros, JUMP_C($0ABC) A very simple, size efficient way to do fix the problem. In order to access data in your program, there are two solutions, one for temporary data (like players' scores) and one for permanent data (like title strings). When using temporary data, the best solution is to use the 168 bytes of the text memory at 80DF. ZShell automatically sets every byte in this range to 00 before running any program, so you don't have to worry about zeroing any matrices yourself, which saves space. To access permanent data, what you need to do is find your program's address in memory and add the relative offset of the data. Fortunately, ZShell provides the word at (8C3C), which is the address of the currently executing program. For example, if you needed to display the string at $246 from the start of your program, you would do this: ; without TI-85.H ; with TI-85.H ; ld hl, ($8C3C) ; ld hl, (PROGRAM_ADDR) ld de, $246 ; ld de, $246 add hl,de ; add hl, de call $8C09 ; CALL_ROM(D_ZT_STR) ; display zero-terminated .dw $3E68 ; ; normal text string Additionally, (8C3F) contains the ZShell version number. It is 3. ZShell 3.0 will also recalculate a string's checksum after it is run, so that permanent variables can be used with little hassle. To enable this feature, make sure bit 0 of (8C40) is set (1) when your program terminates. Here are important ZShell data locations: PROGRAM_ADDR =$8C3C ; program address ROM_VERS =$8C3E ; ROM version byte ZSHELL_VER =$8C3F ; ZShell version number ZS_BITS =$8C40 ; bit 0 set : checksum again In order to turn your assembled binary code into an .85S, all you have to do is run it through STRING85.COM. Here's the batch file I use to assemble, convert to strings, get ready to transfer my programs to my calculator: @echo off tasmb -80 -g3 -q -r8 -y %1.asm ; assemble source if errorlevel 1 goto errors ; stop batch on assembly error ren %1.obj %1 ; take extension off object file string85 %1 ; convert to string move %1.85s \link85 ; move to \link85 del %1.bak ; delete other files (I have a 40Mb hdd) del %1.lst del %1 cd\link85 ; switch to \link85 and run program link85 cd\tasm ; go back to \tasm goto done :errors echo ERRORS! :done Here are some important points about the structure of your programs: 1) You should use .ORG 0 or your calls and jumps will be messed up. 2) Immediately after .ORG 0, you should define a null-terminated string to display next to the name in the ZShell menu. ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ VIII. LISTS OF HELPFUL INFORMATION ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ The files TI-PORTS.TXT, TI-ROM.TXT, and TI-RAM.TXT contain information useful and necessary for writing good programs. These lists are nowhere near complete (and the RAM list is nowhere near organized :)), so I welcome corrections and additions. My Internet address is dan.eble@commlink.org. ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ PART THREE: OTHER TOPICS ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ IX. LEGAL STUFF ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ ZSHELL.85B and all the companion files are my work. I encourage their distribution as long as they are kept together, unmodified from the form in which I originally distributed them. ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ X. REVISION HISTORY ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ November 1994: First Release. January 1995: Version 2.0 Small optimizations. Cursor returns to last location after program exits. Cursor wraps from the bottom of the page to the top, and vice versa. Optional checksum after program termination. January 1995: Version 3.0 No need to recall ZShell into the graphics screen.