01.03.2014 Views

Section 2 - Commodore Computers

Section 2 - Commodore Computers

Section 2 - Commodore Computers

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

tvk:rv. 1Q82.lssue 24 COMPUTEI 153<br />

Moy. 1982. Issue 24 COMPUTE! 153<br />

"Garbage collection" reJers 10 the Long deLa.ys which can<br />

"Garbage collection" refers to the long delays which can<br />

occur while whiLe the computer cOllllmler rearranges strings. slrings. This is article (".tieLe<br />

shows how to 10 avoid these lhesf delays dela)'.' when you are a.re working<br />

riling<br />

with significant numbers of strings. The Th.e technique "~clmiq/l (J here h(lre<br />

is most lIIosllIseJll1 useful for J01' PET/CBM owners who have alder older<br />

machines. lIIachines. Newer machines with wilh BASIC 4.0 avoid these Ih ese<br />

problems. Inob/ellls.<br />

Screen Input<br />

Screen Input<br />

On The PET<br />

On The PET<br />

Elizabeth Deal<br />

Elizabeth Dea<br />

Malvern, PA<br />

Usin g the information placed on the screen as a<br />

Using the information placed on the screen as a<br />

source ofo f input inpul seems like a contradiction contradicLion in terms.<br />

Why should one bother inputting something when<br />

' Nh y should one bothe r inputtin g somethi ng when<br />

one alread y knows what it is' I stumbled upon one<br />

one already knows what it is? I stumbled upon one<br />

good reason and worked with it to a happy py ending:<br />

no garbage collecti on delays.<br />

no garbage collection delays.<br />

ThisT article runs through a series ofo f small<br />

experimments. Both BOlh tests and conclusions are based<br />

on work in the Upgrade PET. Users of ori gi nal<br />

on work in the Upgrade PET. Users of original<br />

ROMs and pre-Fat40 BASIC 4, 40 and 80 column<br />

systems are invited to try the tests. I suspect that<br />

the results will be the same. However, simple as it<br />

is, I just don't know how the whole thing will behave<br />

in anotherr PET. The concept of null input might<br />

be handled differently Ffe and, together with POKEing<br />

two system locations, it might crash the PET. This<br />

two system locations, it mi ght cras h the PET. T hi s<br />

mi ght mean it will need to be reset. There is no<br />

might mean it will need to be reset. There is no<br />

way of telling until you join the fun.<br />

Screen input, as described in thiss article, is<br />

most valuable in thee systems prior to 4.0 BASIC as<br />

it shows yet anotherr way of minimizingg characterr<br />

string handlingg in our questt towards a garbageless<br />

PET. My method is limited , however, to onl y certain<br />

PET. My method is limited, however, to only certain<br />

applications. The entire problem was explained<br />

ed<br />

a nd a more gene ral proced u re was proposed by<br />

and a more general procedure was proposed by<br />

Jim Butterfield in COMPUTE!, September, 1981, 1,<br />

##10. I O. BASICC 4 users, ooff course, don't sufferr fromm<br />

these problems.<br />

T he reason I became inte rested in screen<br />

The reason I became interested in screen<br />

input is twofold. . First. First, the suggestion aappears in<br />

the POWERW E R T~<br />

manual, aand it made me curious<br />

about the method's mutility. [POWER is a chil) chip which<br />

add, several commands 10 BASIC. It is sold b), ProJessional<br />

adds several commands to BASIC. It is sold by Professional<br />

SoJlware.] Software.] Secondly, I have a very nice ddisk utility<br />

which displays all the sorts of data about the con­<br />

tents ooff the noppy. floppy. TThe program carefullyy displays<br />

that information by use of ordinary PRIXT NT state tements<br />

(no reverse fi eld , no cursor controls, nothing,<br />

ments (no reverse field, no cursor controls, nothing.<br />

just plain letters). I needed to lift this data, put it<br />

just plain letters). I needed to lift this data, put it<br />

into va riabl es, a nd use it for other things, not ex­<br />

into variables, and use it for other things, not ex<br />

cluding a sorted n listing. It seemed like a simple<br />

task, until a seven minute long garbage collection<br />

tas k, until a seven minute lo ng garbage colleclion<br />

za pped me duri ng testing.<br />

zapped me during testing.<br />

The T garbage collection<br />

occurred because,<br />

although the program originally concatenated<br />

although the program ori ginall y concatenated<br />

(added) ) pieces of strings by use ofo f PRINT I statements<br />

in a loop, as in<br />

ments in a loop, as in<br />

PRINT#4,CHR$(X + +48);<br />

I had to change the code to<br />

I had to change the code to<br />

V$

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

Saved successfully!

Ooh no, something went wrong!