30.12.2013 Views

May June 1980 - Commodore Computers

May June 1980 - Commodore Computers

May June 1980 - Commodore Computers

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

MAY/JUNE, I JUNE. <strong>1980</strong>. 198O. ISSUE 4. COMPUTE. "5 115<br />

Relocate PET Monitor<br />

Almost Anywhere<br />

The Monitor program provided on tape to owners<br />

of PETs with the old ROMs occupies locations (in<br />

hex) $0400 to 5076B, S076B, right where the PET stores<br />

BASIC programs' programs! If you're only interested in working<br />

with 6502 machine language routines, that location<br />

for the Monitor poses no problem. .<br />

Unfortunately for me, I wanted to have the<br />

Monitor available at the same time as BASIC programs.<br />

Despite a variety of attempts, I was unable<br />

to find a combination that would allow me to enter<br />

and run BASIC programs while having the Monitor<br />

available in its original location.<br />

On the other hand, if the Monitor could be<br />

moved somewhere very near the highest available<br />

memory location with which the PET is equipped,<br />

then the end-of-memory pointer could be reset to<br />

protect the Monitor. Then a BASIC program could<br />

be run, and it would not interfere with the<br />

Monitor.<br />

Myy problem appeared to be solved when I found<br />

an article by Professor Harvey B. Herman of the<br />

University of North Carolina ("Move It", MICRO,<br />

September 1979). . Although a critical figure seemed<br />

to be missing from the article, it was not too difficult<br />

to puzzle out, since the technique was based on<br />

an article by Jim Butterfield in the PET User Notes<br />

(Issue I, 1, Vol. 2). Incidentally, Jim has been a key<br />

figure in unravelling the secrets of the PET, both<br />

publishing information himself and pointing others in<br />

the right direction. .<br />

Although a relocation technique is summarized<br />

in this article, the discovery that got me excited<br />

was a simple e but powerful extension to make ii it do<br />

many relocations, after the first one was completed.<br />

Why would anyone want to relocate the MonitorM to many different locations? The answer lies in the<br />

earlier observation that it would be desirable to<br />

locate it near the top end of available memory.<br />

With a 4k PET, a good location for the MonitorM would be starting at the 3k location. On an 8k PET,<br />

you would want to locate it from 7k up. If a 4k PET<br />

had ana n 8k memory extension attached, giving a total<br />

of 12k, the Monitor should be located at the Ilk<br />

point. Other combinations of PETs and external<br />

memories would lead us to want Monitors located<br />

ata t 15k, 19k, 23k, 27k and 31k.<br />

.<br />

With the approach described here, all of those<br />

Monitors can be created in little more time than it<br />

takes to SAVE each one.<br />

First, we must create one working Monitor<br />

relocated to a position where it does not conflict<br />

with the e original. Here's one way to do it:<br />

1. I. LOAD the e Monitor (Prim (Print STATUS; PEEK<br />

(630) to insure that the LOAD was good ...<br />

Roy Busdiec ker<br />

Roy Busdiecker<br />

Micro Software Systems<br />

PO P.O. Box 1442<br />

Woodbridge, VA 22193<br />

PET should print 0 0). Rewind the tape.<br />

2. Type SYS62894, then press RETURN. You<br />

will get the message PRESS PLAY ON<br />

CASSETTE #1. Insert the Monitor tape<br />

tape and press PLAY. The tape will run<br />

until the FOUND MONITOR message<br />

appears, then it will report READY. At<br />

this point the tape header has been found<br />

and loaded into locations 634 through 638,<br />

but the Monitor itself has not started loading.<br />

Here is the meaning of bytes 635<br />

through 638.<br />

635<br />

636 637 638<br />

10 lo byte<br />

First location that<br />

program tape will<br />

load into.<br />

hi byte 10 lo byte Last location that<br />

program tape will<br />

load into.<br />

hi byte<br />

3. By changing the values in these locations, we<br />

can make this second copy load into a<br />

different area of memory. For this exercise,<br />

let's put it into locations 3k (decimal 3072,<br />

hex OCOO) 0C00) and up. To do that,<br />

POKE 636, 12:POKE 638,15:SYS 62403<br />

The tape will run and PET will report<br />

LOADING until the MonitorM is in. . Rewind<br />

the tape and set it aside. At this point,<br />

you will have two identical copies of the<br />

Monitor. M One is located from $04000 to<br />

S076A ($ (S indicates a hex value), as shown<br />

in Figure 1. The other copy is in locations<br />

S0COO SOCOO to $0C6A SOC6A (see Figure 2 for the first<br />

128 locations). The second copy, of course,<br />

will not work because its addresses point to<br />

the wrong locations.<br />

4. In order to make the $0C00-0C6A $OCOO-OC6A copy<br />

of the Monitor usable, you must alter<br />

(patch) the contents of 84 memory locations.<br />

There area several ways to do this, but the<br />

straight-forward approach I used (outlined<br />

below) is about as easy as any other.<br />

a. TypeT SYS 1039 and a press RETURN.<br />

This transfers control to the $0400- S0400-<br />

$076B Monitor, M which will display<br />

PC SR AC XY YR SP<br />

C6ED 30 33 39 00 FE<br />

b. b . Consult Figure 1I to see which values<br />

are to be changed (the circled numbers).<br />

A circled value in line 0410 calls for a<br />

change in the corresponding position in<br />

line 0C10. OC Line 0500 corresponds to<br />

OD 10, 0600 to OEOO , and 0700 to<br />

0D10, 0600 to 0E00, and 0700 to

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!