SD: How to patch a shell...


[Prev][Next][Index][Thread]

SD: How to patch a shell...




Here is an Article/Column that I wrote for ticalc about a week ago, which
they never posted.  I guess they are opposed to the idea of new shells being
developed.  Figures, doesn't it? 
 
This should tell you guys how I got the custom menu working for my shell,
MISh v0.82.  By the way, I'm planning to release 1.0 soon... 
 
I had originally planned to write 3-4 lessons, but I may not now.  If I do,
I'll post them here.  Here it is: 
 
Lesson #1 
Topic: Patching a New Shell the easy way on the TI-85 
 
There are several ways to patch a shell on the TI-85.  I will only be
discussing one method: using Mem Mess 3.0, written by Mike Baker, to replace an
existing shell.  You should be able to find Mem Mess on Ticalc. 
 
What you need for this: 
 1-TI-85 (of course) 
 2-Calc-Computer link, and software (Serial, Parallel, or Graph Link) 
 3-Code for your shell in a string file 
 4-A backup of ZShell 4.0 (Others might work, but I've only tried it with
ZShell and my own shell) 
 5-Mem Mess 3.0 (another version might work, but I don't know) 
 
The steps are, in order: (They will be explained in much better detail
lower down) 
        1-Put ZShell (or something compatible) on your calculator.  I've
found this method to work great with a ZShell 4.0 backup, because the custom
pointer data is at the beginning of the file. 
 
 2-Put Mem Mess on. 
 
        3-Make a backup of your memory at this point.  Crashes are frequent
when patching shells.  NOTE: If you are squeamish about crashing your calc,
shell programming is not for you.  Crashes are VERY frequent, especially if
you make a lot of mistakes in your program. 
 
 4-Turn the shell variable in to a program, using MemMess. 
 
        5-Edit your new program, and delete everything after the Mu symbol
(it looks like a strange shaped lower-case u, which is the equivalent of a
Z80 ASM jp command). 
 
        6-Patch your shell string in, by pressing [2nd] [STO>], then type
the name of the string variable that the data is in.  DO NOT RUN THE
RESULTING PROGRAM!!!!  Doing so will tokenize it, and corrupt the data. 
 
        7-You should be able to run your shell at this point, but you can
use Mem Mess to change the variable back in to a string, or whatever type you
want (only Strings, Programs, Graphing Data Bases, Equations, Pics, and
Range variables use the same length info.  The others will leave the data
vulnerable to damage, or crash your calculator). 
 
 8-Have a party: your shell is patched!!!!!!! 
 
 
STEP ONE:  Send ZShell to your calculator.  Most of you should already know
how to do this, so I won't go in to it.  The above process works with ZShell
4.0, but in a pinch you could substitute Tiny Phat, by Mike Baker, or MISh
v0.82.  All three have their custom pointers in the same place, but I'm not
sure about Tiny Phat. 
 
STEP TWO: Get Mem Mess 3.0 on you calculator.  As I said before, it should
be available for download on Ticalc.  There are instructions for this
process in it's documentation, but they aren't as complete as these, and don't
give you a few pieces of vital information. 
 
STEP THREE: Make a backup at this point.  Crashes happened VERY often while
I was working on MISh v0.82.  If you have a backup, it helps immensely,
especially if you are like me, a programmer that makes a lot of mistakes that
have to be debugged. 
 
STEP FOUR: Now we use Mem Mess, and this is where it will start to get
technical.  When you start it, you should see two columns.  One should have
variable names, and the other should have data about the highlighted variable. 
At the bottom of the screen, you should see a black bar with menu items. 
The up/down arrows change which variable you are pointed at.  The first
variable in the list should be the shell.  Make sure it is highlighted before you
begin, then hit F3 (The variable type changer).  That should highlight the
variable type indicator in the upper right hand corner.  If the variable is a
string, it should be a 12.  Use the up and down keys to increment/decrement
the type of the variable.  We want to change this value to an 18, a program
variable.  Once that is done, you can exit Mem Mess. 
 
STEP FIVE: Edit the shell's program variable.  At the top line, if it is
ZShell, or MISh, you should see a bunch of funny characters.  The sixth
character on the top line should be a strange looking lower-case u.  That is a Mu
symbol.  What you do is delete everything after that symbol.  This can
easily be done, by highlighting the next character, and then pressing [2nd]
[DEL].  That should put it in insert mode.  Now press [ENTER].  That will drop it
all down to the next line.  Hitting [CLEAR] at this point should clear
everything but the data we need.  If it doesn't, make sure you erase everything
but the first line of data that we made sure we preserved.  Next, put the
cursor to the right of the Mu symbol, and hit [DEL], until there are no colons
after the first line.  Now, exit the program editor.  Note: the data that we
kept was custom menu data, so we don't have to fiddle with putting it in
ourselves. 
 
STEP SIX: Transmit the string that you have compiled on your computer to
your calculator.  You can put it in any kind of ZShell/other format you want
with string 85, just as long as all the running data is there.  Edit your
shell's program file, and move to the end of the first line.  Highlight the
space after the Mu symbol, and press [2nd] [STO>].  Then manually type in the
name of your string that has the data for your shell.  Hit [ENTER], and it
should copy the contents of the string directly in to your program.  Next, you
have to remove the quotes at the end, then go back up to the first line. 
Highlight the spot right after the Mu symbol, and hit delete until you come
across another Mu symbol.  The Mu symbol will only be there if you put the
custom pointer at the top of your source code, as a jump to the right place in 
your program.  I make sure I use a jump, so I can use the Mu symbol as a
marker to look for as I delete things.  Make sure you delete the second Mu
symbol, then exit the editor.  Your shell should now be in the correct place in
RAM, and should be runnable.  For an example of a simple shell to practice
patching with, look at the bottom of this lesson.  I'm including the shell I
originally tested this process with.  By the way, if your custom menu shows
a bunch of garbage at this point, DO NOT run any of the pointers.  It will
most likely result in a crash.  STEP SEVEN: If your shell is ZShell 4.0
compatible, you can now run Mem Mess again, and change the shell's variable back
in to a string, or whatever type you want.  Only Strings (type 12), Programs
(18), Graphing Data Bases (13-16), Equations (10), Pics (17), Range
variables (11 & 19), and hidden files (20) use the correct type of length data.  The
others will leave the data vulnerable to damage, or crash your calculator. 
I don't suggest leaving it as a program, because some idiot out there is
likely to try running it as a normal program.  That will tokenize the data, and
corrupt the shell. 
 
STEP EIGHT: A party, you know, pizza, chips, soda, etc. 
 
Now for the Tester Shell.  This shell should scroll the screen down one
line whenever you execute it from the custom menu. 
 
#include "ti-85.h" 
 
.org $8BFF                              ;This line MUST be here 
 
MenuPt: 
        jp Start                        ;the jp is the Mu symbol that needs
to be lined up correctly 
.db "Scroll",0 
 
Start: 
 push AF 
 push BC 
 push DE 
 push HL 
 set 1,(IY+0D) 
 call $3D82  ;Scrolling ROM call 
 pop HL 
 pop DE 
 pop BC 
 pop AF 
        jp $462                 ;$462 is the Home Screen 
.end 
 
If you need any more information, or just have a question, you can contact
me at: 
RichardLewis@CedarCity.net