ChipCenter Questlink
SEARCH CHIPCENTER
Search Type:
Search for:




Knowledge Centers
Product Reviews
Data Sheets
Guides & Experts
News
International
Ask Us
Circuit Cellar Online
App Notes
NetSeminars
Careers
Resources
FAQ
EE Times Network
Electronics Group Sites

AN HC11 FILE MANAGER


Circuit Cellar Online
THE MAGAZINE FOR COMPUTER APPLICATIONS
Circuit Cellar Online offers articles illustrating creative solutions
and unique applications through complete projects, practical
tutorials, and useful design techniques.

AN HC11 FILE MANAGER

Lessons from the Trenches Part 2ýAll of the Details
by Walter Krawec

Introduction ý Format() ý Install() ý Directory() ý Run() ý Menu() ý Saving Memory ý Interfacing to the File Manager ý Two Sample Programs ý Conclusion ý Sources and PDF

INSTALL()

The Install() procedure has two options: tell you where a program can be downloaded or set up the program. This procedure is a little complicated because of the amount of memory addressing, but I'll break it up into chunks and explain each.

The first thing the procedure does is ask you whether or not to set up a program or show where a program can be downloaded, then loops waiting for an input. When a character is given, the loop exits and the character is echoed back.

If you type "1," Install() scans through the program information table to find the last entry and prints out the end address for that entry. If you type "2," the block of information defined by the new program at 0xFF00 is copied to the next available slot in the program information table, the count of programs is increased by one, and the pointer to the next available table slot is updated.

First, a little title is printed. Then addr is loaded with 0xff00. If your 32 Kb of memory is at 0x0000, change that line to addr = 0x7f00. But, if you have 64 Kb of RAM, don't change it.

Before I continue, let me explain how a program will be loaded. First, you run the file manager and type "i" for install, then "1" to get the next memory location. You then have to convert that number into hex and enter it into your program. You'll have to put a block of information at the end of your program (at address 0xff00 or 0x7f00). This block of memory holds the start address, end address, and name and type of the program. Then, before compiling the program using WCC11, you have to make a new main header for the program using MHM. For the stack you can use 00ff and the number the file manager gave you earlier for the program start address.

I'll quickly go over installing a program. I assume you have your memory at 0x8000. Change the a000 to 4000 if the RAM starts at address 0x0000.

Compile test1.c using test1 as the main header. Then, edit test1.asm and look for the lines:

org $fffe

fdb _main

Erase those two lines. Now you just have to assemble test1.asm using AS11, and this program is ready to be installed into your ýHC11.

To download the program, use PCBug11 and download it as you normally would. Note the number it gives at the top of the screen; it should be 3E if you didn't change anything in test1.c. This number is the total amount of bytes test1.c used. While in PCBug11, type "mm ff02" or "mm 7f02" depending on where your RAM is, and press Enter. Next, type "A0" or "40" followed by Enter, type "3E" then Enter, then ESC. Notice that if you put the two numbers together you get A03E, which is the programýs start_address plus the number that PCBug11 gave you when you downloaded the program. All you're doing is telling the file manager where the program ends.

Run the file manger and type "i," then type "2" to install the program. When you type "d" your program's name should appear.

PREVIOUSý NEXT


Circuit Cellar provides up-to-date information for engineers. Visit www.circuitcellar.com for more information and additional articles.
For subscription information, call (860) 875-2199, subscribe@circuitcellar.com or subscribe online. ýCircuit Cellar, the Magazine for Computer Applications. Posted with permission.
Click here to get your listing up.

Copyright © 2003 ChipCenter-QuestLink
About ChipCenter-Questlink  Contact Us  Privacy Statement   Advertising Information  FAQ