| WINDOWS MAGIC TRICKS ¢ HARD DRIVE BASICS

KNOCKOUT NOTEBOOKS!

PLUS!

U.S, $2.95 3

Ml od

71486'02193

0 5)

64/128 VIEW

If you've submitted a program recently

and are still waiting to

hear from us, please be patient.

Tom Netsel

here is good news and bad news to report this month. The good news is that we've been swamped with excellent type-in submissions. The bad news is that we've been swamped with excel- lent type-in submissions.

| made a pitch for pro- grams in this column and in fillers elsewhere in the mag- azine encouraging submis- sions. Boy, did they work!

In fact, they've worked al- most too well. For the past few months we've been del- uged with good and great programs. We now have a large stack of them waiting to be reviewed, This has led to a new problem: Since it takes time to evaluate a pro- gram properly, we've been slow in mailing out contracts and rejection notices.

If you've submitted a pro- gram and haven't heard from us, please be patient. The quality as well as the quantity of submissions has been excellent this year, and we want to buy as many programs as we can. It just takes time to go through them all. When we've selected the pro- grams that we plan to use in an issue and then come across another good pro- gram, we hate to reject it. We'll often hold it and use it the following month. But when we start holding too many programs, the system backs up. We'll get things moving shortly.

Actually, | love having too many submissions—so please keep them coming! With your help, we've been able to publish some great programs, and we want to continue the practice. A cou- ple that come to mind from

last month are two SpeedScript spelling check- ers for the 64 and 128.

| normally don’t have two such similar programs in the same issue, but | thought that each spelling program would offer advantages to 64 and 128 users.

In this issue, we have a couple of programs that'll help programmers who work with sprites. These pro- grams are geared more for the intermediate-to-ad- vanced programmer who is already familiar with sprites and some of the problems associated with them.

MOB Master, by Hong Pham, adds ten new graph- ic commands to the 64 that make programming sprites much easier. Programming sprites on a 64 usually re- quires a lot of code filled with POKEs, but MOB Mas- ter gives the 64 many of the same features and sprite commands found in BASIC 7.0 on the 128. With these commands, you'll find it much easier to define, posi- tion, and animate sprites.

Most people know that the 64 is capable of produc- ing 16 different colors, but how would you like to boost that number to 136? You can with 136 Colors, a pro- gram by David Kwong.

Machine language pro- grammers who use a 128 will want Bassem 128. Long a popular assembler for the 64, the 128 version is too large to type in, but it's avail- able as this month's Gazette Disk bonus program.

| hope you'll find these and the other Gazette pro- grams to be entertaining and informative. Be sure to let us know which programs you like or dislike. a

GAZETTE

64/128 VIEW G-1

Great submissions flood Gazette office. By Tom Netsel.

SID SIMPLIFIED G-3

Cut through the confusion of programming the Sound Interface Device. By Larry Cotton.

REVIEWS

Arachnophobia, Fun Graphics Machine, and DweeziLabel.

FEEDBACK

Questions and comments from our readers.

MACHINE LANGUAGE

Programming for speed, economy, or both? By Jim Butterfield.

BEGINNER BASIC G-20 Try a little machine language when your program needs a burst of speed.

By Larry Cotton.

G-10

G-16

G-18

D’IVERSIONS G-21 Just call me Captain Future!

By Fred D'Ignazio.

GEOS G-22 Assembling the ultimate GEOS system.

By Steve Vander Ark.

PROGRAMMER’S PAGE G-24 Great tips from readers.

By Randy Thompson.

PROGRAMS

MOB Master G-25 136 Colors G-29 Tunnel Trap G-33 BASIC Move and Save G-36 Noah’s Reader G-38 Locate G-38 Bug-Swatter G-40

NOVEMBER 1992 COMPUTE G-1

PUMP UP

YOUR PRODUCTIVITY!

Harness the potential of your, The rl il le 64 and 128 with these get

Do it all with Commodore

graphics! power ul pr ogr ‘ams. Here's what's on it— Get more work out of your 64 and 128 Se with these two new disk products from 128 Graphics Compactor,

64 Animator, VDC Graphics, Dissolve 128, Super Slideshow, 128 Animator, 1526 PrintScreen,

COMPUTE 's Gazette the 1992 Best of Gazette Utilities, and

the Gazette Graphics Grab Supratechnic, Medium-Resolution Bag! Graphics, Screen Maker, GAS!64— The 1992 Best of Special Edition, GAS!128-Special

Edition.

Gazette Utilities

Seize control of your operating system and your world!

Here's what's on it-MetaBASIC 64, MetaBASIC 128, Quick, Sprint Il, Ultrafont+, RAMDisk 64, RAMDisk 128, BASSEM, SciCalc 64, List Formatter, MegaSqueeze.

Extend Your Computer Power With This Powerful Software!

___ Check or Money Order _ MasterCard _ VISA | want to pump up my productivity! Please send me the | @ disks checked below at $11.95 each. Credit Card No. Exp. Date oy Signature The 1992 Best of Gazette Utilities (Required) ___ The Gazette Graphics Grab Bag Daytime Telephone No. _— Subtotal ama ___ Sales Tax (Residents of NC and NY please add appropriate sales tax for your | area. Canadian orders, add 7% goods and services tax.) Address ___ Shipping and Handling ($2.00 U.S. and Canada, $3.00 surface mail, $5.00 City airmail per disk.) State/Province === ZIP/Postal Code ___ Total Enclosed | | Mail this coupon to COMPUTE's 1991 Utilities, 324 West Wendover Ave., Ste. 200, MasterCard and VISA accepted on orders with subtotal over $20. Greensboro, NC 27408.

EN = se es

= THE J3 souND

BeINTERFACE

CIRCUIT CHIP FONDLY : | KNOWN AS SID, RESIDES DEEP IN THE ELECTRONIC INNARDS OF THE

COMMODORE 64 AND 128 COMPUTERS.

IT HAS THE ABILITY TO LET YOUR

| COMPUTER PLAY, SING, MOAN, TALK, RING, THUMP, SCREAM, AND WHISPER. THIS CHIP ALONE HAS BEEN AT LEAST PARTIALLY RESPONSIBLE FOR THE FACT THAT ¢ COMMODORE STILL BUILDS THE 64 ALMOST NINE YEARS AFTER ITS SPLASHY INTRODUCTION— A COMPUTER LONGEVITY RECORD.

DEVICE, 2 AN} INTEGRATED

With all SID’s capabilities, program- ming it in BASIC 2.0 remains an exer- cise in tedium, because of the many POKEs required to access the chip. (BASIC'’s POKE puts a number from 0 to 255 into a specific location in the

computer.) Fortunately for 128 owners, Commodore included with that

machine a much-advanced BASIC 7.0, which does support SID and makes programming sounds much easier.

This article will attempt to cut through the confusion of programming SID and show you, step by step, how to access this marvelous chip. I'll con- fine my remarks to BASIC 2.0's com- mands, common to both the 64 and 128, and I'll show you how to cut down drastically on the number of POKEs. We'll start with the very simplest exer- cises and progress to the more advanced. If you'll stay with me from the beginning, you'll be pleased with the results.

If you're confused about program- ming SID, it will first be necessary to power down your own mind to rid it of all past frustrating programming ses- sions. Start from scratch. Remember that we're talking about only 29 of the 64's 64,000 or so memory registers. How complicated can they be?

Voices A human being has only 1 voice; a saxophone has only 1 voice. A six- string guitar has 6; a piano, 88, SID has 3. Think of SID as a three-string guitar. That is, up to three notes can be played simultaneously, each under separate control (except for volume). We'll limit our initial discussions to voice 1, which occupies SID's first seven memory registers. Remember that number, 7; it'll crop up again.

Order of POKEs

Here's a subject rarely addressed and, | think, fairly critical to the suc- cess of SID programming: the order that the memory registers are poked. Here is the normal order for playing a simple sound.

1. Clear the chip.

2. Turn up the volume. 3. Wait.

4, Set a frequency.

5. Set an envelope.

6. Turn on a waveform.

Clear the Chip

SID occupies memory registers 54272 through 54300. All those registers (except the last four, which cannot be poked) should always be cleared of

G-4 COMPUTE NOVEMBER 1992

SID Chip

CANNOT BE

their contents near the beginning of every BASIC program which uses sound. Here's how.

10 $=54272: FORJ=S TO S+24: POKEJ,0: NEXT: REM CLEAR SID

SID's first memory register should be defined as a constant; we'll use S. Then every other register may be defined as an offset of S. A FOR-NEXT loop pokes a 0 into each of the SID memory registers, effectively silencing the chip and preparing it for action.

Turn Up the Volume

SID's last pokable register is the vol- ume control. Its range varies from 0 to 15, with O being the quietest setting. Let’s turn the volume wide open with the following statement.

20 POKES+24,15: REM FULL VOLUME

Any memory register will accept values from 0 to 255, but 54296 uses only values from 0 (silent) to 15 (loud) to control volume. Normally, S+24 can keep a value of 15 throughout a BASIC program.

Wait

Turning up SID's volume makes a popping noise in the TV or monitor's speaker, and this can interfere with your carefully crafted sound. Always introduce a period of silence after first

ONE MEMORY REGISTER

turning up SID’s volume. We'll show a do-nothing time delay, but ordinarily at this point in a program you'd be preparing the screen, reading data, setting variables, and so forth.

30 FORT=1 TO 1000: NEXT

Set a Frequency

SID needs several other values poked to it before it will speak up. For instance, it needs a frequency. A fre- quency controls a note’s pitch.

40 POKES+1,16: REM FREQUENCY

SID's voice 1 memory location 54273 (S+1) can use all values from 0 to 255. A value of, say, 5 produces sounds of low pitch (like a tuba). A value of 200 produces a high- pitched sound (like a piccolo).

Set an Envelope

What's an envelope? Nothing more complicated than how the volume of a single particular note (or sound effect) changes as it plays.

Think about the way a single guitar string sounds as it’s being plucked. The guitar makes no sound at first, but its sound level rises from silence to maximum volume immediately after the string is plucked. That's called attack. The sound then gradually fades away to silence. This is called decay.

TENE Iinioduices: WORLD'S LOWEST Amiga 500 Computer AMIGA

Basic Package

a ities! Limited Quantities = sistas, Oreo Roe

500 Basic Package Power Pack eAmiga. ‘Monitor

ages! _ TENEX 500 Basic Package vamiga 1084S Stereo Plus 3 Great Value Packag saioere Bundle #1 “Gornwore Bundle #1

Free .

#2 & Joystick NEX Bonus Pack sSoftware Bundle #2 & Joystick «Software Bundle 2 Ten pamiga 500 Bosic Package *Free Lemmings! sfree Lee ory Expansion Software Bundle #1 «TV Adapter eTENEX 500 9.75 . a Lemmings! eTENEX 500 Memory Expansion Total at Reg. Price eH 5 x sv Adapter soa TotolatReg Price S998 Low TENEX Package PIC® «$54.80 Morel . b je TRE aoe Price $339.95 Low TENEX ieesh ys Save $70.75 More! Low 90 Morel You Save $24.

é F-40 Pursuit ludes: Mosterlype Miniature Golf

Bundle # 2 inc! . software Bundle #1 includes: Tetris, Where In SoA Hol 'WnatiWhen\Where!, and Hole-in-One

the World s Carmen Sandiego, and Textcraft

Commodore 64 Computer

Hot Paneae Vales a Onl y C2) $179 95 $136 99 $1499

STAR NX-1020 RAINBOW

Enj i oa c a

iz ominen en Ose eh easy Tris on got Mu ee provid high-speed cheno 2aseps ea ¢ Of 60s versatility at a great Price, Quietly print In andl nearletter-quoniyg 7cps, Featuce * Near-letter-quality at 75cps, Choose top or

Include a big 16KByte buffer, six Tes ar Paper paths and fi

K ; ident Di il ive resident fonts-

enient f raft, Courier, Sans Serif, the Obilty to print on four pen ono. Download 192 chara ond Otator 1 & 2. Panel interface for interference-tieg case Custom fonts and logos, ae veratltits extended further with the abili to ¥ cl

Qs 265 characters for creating unique logos 4kByte buffer with the push of eta Ae

and fonts, You get E Two-year warranty, i 1541 Il Proprehs: Y Qu.get Epson FX and IBM NXTO01'Mialafone SugeRetal $249.00 CO e ; Disk Drive

OTHER PRINTERS CARDPRINT G-W1z INT n Star NX-2420 Rai . T G-WIZ INTERFACE, Star Lagernacceraeoes pea et Connect any printer to your C64/128, Dumps

Star NX-2430 Multi-f high-res screens up to 18 times f Panason cKX-P21 80 Wee eae Competitive interfaces without bien one $ 95 Panasonic KP180; AG8584 $159.98 warranty. From Supra, Sug. Retail $69.95 nic KX-P2123 A72449 $240.98 G-Wir Interface 34484 9 Panasonic eae 124i AS7112 $289.95 sia sonic KX-P1123 A Y Panasonic KX-P4410 Laser A73e8 sleee

$649.95

Don’t miss out on the lowest prices on the Amiga 500, plus a full line of Commodore and Amiga hardware, software, and accessories. Call today to receive your FREE catalog with the greatest prices on the most popular hardware and software!

= dag eos

Shipping, Handling, Insurance

3 z Order Amount Charge

: ee | less than $19.99 $4.95

56800. Magnetic Drive : Se) $5.95

Mishawaka, IN 46545 $7500800.89 3795

—S (219)259-7051 FAX (219)259-0300 Sree nee

dette’ ae ane ae We gladly accept mail orders! : : $300.00-$499.00 $12.95 Computer EXPress Cirle Reader Service Number 170. © Sonon seas sere Order Today! Call 1-800-PROMPT-1 " @ 4) $10008 Over 2.8% of Order

(1-800-776-6781)

COMMODORE 64 and COMMODORE 128 are registered trademarks of Commodore Electronics, Ltd, AMIGA is a registered trademark of Commodore Amiga Inc., NOTE: Due to publishing lead-times, product prices and specifications are subject to change without notice. "APO, FPO, AK, HI, CN, VI, GU, and foreign orders are subject to additional shipping charges.

Rep

SID can create sounds quickly, like a guitar, or slowly, more like a bowed violin. It can also do two more things to a sound which a guitar can't. It can prolong a sound's volume at a particu- lar level. This is called sustain. SID can also cause the sound to stop ata controllable rate with a process called release,

So, there you have it. The sound's envelope is made of attack, decay, sustain, and release. Each of these properties is controllable. For now though, the properties we'll use are attack and decay. A value of 12, in fact, poked to the envelope simulates the plucking of a guitar string. Later, we'll see how to determine values to poke. Where do we poke that enve- lope value? We poked the frequency into S+1, so the envelope must be poked into S+2, right? I'm afraid not; S+2 and S+3 are reserved for fine-tun- ing the pulse wave. S+4? Nope. That turns on voice 1. S+5 (54277) is voice 1's main envelope-controlling register.

50 POKES+5,12: REM ATTACK /DECAY

If you want to experiment with sustain and release, add this line.

52 POKES+6,4: REM SUSTAIN/RELEASE

SID AND VARIABLES

Using a variable such as F, instead of a number like 16, yields a whole new world of sounds. Here's an example which emulates a warning siren.

10 $=54272: FORJ=STOS+24: POKEJ,0: NEXT: REM CLEAR SID 20 F=16: REM DEFINE VARIABLE 30 POKES+24,15: REM FULL VOLUME 40 FORT=1T0200: NEXT: REM SHORT PAUSE 50 POKES+1,F: POKES+8,F*1.3: REM COARSE FREQUENCIES 60 POKES, 195: POKES+7,31: REM FINE- TUNE FREQUENCIES 70 POKES+5,12: POKES+12,12: REM ATTACK/DECAY 80 POKES+6,255: POKES+13,255: REM SUSTAIN/RELEASE TO MAXIMUM 90 POKES+3,8: POKES+10,8: REM SHAPE OF PULSE 100 POKES+4,65; POKES+11,65: REM TURN ON PULSE WAVEFORM 110 F=F+1: REM INCREMENT FREQUENCY VARIABLE 120 IFF=36THENF=16: REM CHECK FOR UPPER FREQUENCY LIMIT

G-6 COMPUTE NOVEMBER 1992

Turn On a Waveform

Last, but certainly not least, the sound needs a waveform. The 64 and 128 both feature four waveforms, each with a characteristic timbre. The triangle’s sound is soft and mellow, the sawtooth mimics a saxophone, the pulse is hol- low, and the noise is, well, noisy.

To actually begin the sound, we use voice 1's control register, S+4, We usually poke one of four particular val- ues to produce the desired waveform.

Triangle siV¢ Sawtooth 33 Pulse 65 Noise 129

Here's the way we'll select a waveform in our program. For this example, let's select a triangle waveform and poke its value into S+4,

60 POKES+4,33: REM TURN ON SAWTOOTH WAVEFORM

| like waveform 33, the triangle; it has a nice bite to it. If you’ve been entering the lines as presented, you can now run the program. You should be rewarded with a nice strong note that begins suddenly and gradually dies out. (Be sure to turn up the vol-

130 POKES+1,F: POKES+8,F*1.3: REM CHANGE FREQUENCIES BOTH VOICES 140 GOTO110

We're using the variable F (defined in line 20) instead of the number 16 for the coarse frequen- cy. The coarse frequency pops up first at line 50. In line 130, voice 2's frequency is calculated as a multi- ple (1.3 times) of voice 1's. Why? We do it to keep the interval between the two voices’ frequen- cies roughly constant for a more authentic siren sound.

In line 110, we increase variable F by 1. Try different increments or try decreasing, instead of increas- ing, F. Line 120 limits the upper value of F. Try other limits or values less than 16 if you're decreasing F.

Once a limit is reached, F is reset to its original value. Line 130 once again pokes new values to both voices’ frequency registers. Voice 1 gets newly increased F; voice 2 gets a multiple of F. Line 140 sends control back to line 110, which increases F again. The pro- gram stays in a loop from line 110 through line 140 until you stop it by pressing the Run/Stop key.

SID Wave Forms

Triangle

ume on your TV or monitor. The 15 that we poked to 54296 ensures that a good strong signal leaves the comput- er, but it won't be heard if your monitor volume is too low.)

Six lines to create a sound; that's not too bad, is it? Just remember the order.

1. Clear the chip (S through S+24). 2. Turn up the volume (S+24).

3. Wait.

4. Set voice 1's frequency (S+1).

5, Set voice 1's envelope (S+5).

6. Turn on voice 1's waveform (S+4).

Other Registers

We produced sound with only three of voice 1's memory registers; we didn't use registers S, S+2, S+3, and S+6. Let's look at them now.

S is the register that fine-tunes voice 1's frequency, which was coarsely set with S+1. If you wanted just a noise or a beep of no particular frequency, S+1 would be enough fre- quency control. To accurately pro- duce musical notes, however, we must also poke a value to S.

What value? For frequencies of musical notes, the values are listed in your User's Guide in a table appropri- ately called Music Note Values. For nonmusical sounds, such as drums, it's mostly a matter of trial and error. Let's fine-tune the frequency we poked into S+1 in line 40. Add this line to the program to give us an exact

D/FOR THE C64 ANDIG 6128 1M 64 MODEL) (ce Ses

New * Big Blue Reader 128/64 - 4.0

Transfers word processing, text, ASCII, and binary files between (64/128 and IBM PC compatible 360K 5.25" and 720K 3.5" disks.

New Version 4.0 features: Transfers ASCII, PET ASCII and Screen Code files including: WordWriter, PocketWriter, SpeedScript, PaperClip, WriteStuff, GEOS, EasyScript, Fleet System and most others.

Supports drives # 8-30. New Backup (C128) and Format (1571/1581)

ATEN programs. Reads MS-DOS sub-directories, uses joystick, and more. Includes C128 & C64 programs. Requires 1571 -or- 1581 Disk Drive. OO Te Big Blue Reader 128/64 - 4.0 only $44.95

Version 4.0 upgrade, send original BBR disk plus $18.

Bible Search 3.2

. Complete Old & New Testament text on (4) 1541/71 or (2) 1581 disks . An Exhaustive English Concordance on (2) 1541/71 or (1) 1581 disks KEYBOARD OVERLAY -~-$3,50 EA Includes more than 700,000+ references. OR C64 IS SHIPPED | 3 five (5) second look-up time, per/word, per/disk

. Instant, automatic spell checking of more than 12,800 words . Wildcard and Boolean AND, OR & NOT search options . Search the entire Bible in 5 seconds with 1581 or HD (version 3.52)

Money Back Guarantee! Features: C64 & C128 programs; screen, printer and disk output users guide, disk case. Available on (7) 1541/71, or (4) 1581 disks

KJV $49.95 | NIV $59.95 | Both $90

tx Any questions? Call or write for more information.

Cs SUPPORTS MULTIPLE ORIVES GEOS SCREE COMPUTER T!

2 E+ ron

NOOERW

Gm CLIP ART VOL.1 GRAPHICS ~ FGM CALENDAR TEMPLATE ONTHLY ~~~ FGM OVERLAY TEMPLATE mi D_ OVERLAYS STATE COMPUTER FOR OVER C64 1S SENT--$5,.00 FGM UPDATE DISK V6.4 U GM V6,4--$2.00

JEBBH RHEE RHEE BHE BBE HEBHEBREHHORREEBBEHEBEBHEHBHBBBEHBBE PLEASE ADD FOR SHI A ----$3.50 FOREIGN ORDERS: F FOLLOWS}

CANAD AME ICO 0; ERS $5.00

Order by check, money order, or COD, US funds only. es’ FREE shipping in US. No Credit Card orders Canada & Mexico add $4 S/H, Overseas add $10 S/H ($5 BBR)

SOGWAP Software @ (219)724-3900

115 Bellmont Road; Decatur, Indiana 46733

The FGM Connection, P.0.Box 2206, Roseburg, OR. 97470

FOR MORE INFORMATION CALL 503-673-2234

“Gazette Gallery,” where each month we present the very best in original 64 and 128 artwork.

So don’t waste another moment. Subscribe to- day to COMPUTE’s Gazette Disk and get 12 issues for only $49.95. You save almost 60% off the single- issue price. Clip or photocopy and mail completed coupon today.

Individual issues of the disk are available for $9.95 (plus $2.00 shipping and handling) by writing to COMPUTE, 324 West Wendover Avenue, Suite 200, Greensboro, North Carolina 27408.

YES! Start my one-year subscription to COMPUTE’s Gazette Disk right away for only $49.95.*

O Payment enclosed (check or money order)

OCharge OMasterCard O Visa

Yes, save time and money! Subscribe to the Gazette Disk and get all the exciting, fun-filled Gazette pro- grams for your Commodore 64 or 128—already on disk!

| | | | | | | Subscribe today, and month after month you'll get all the latest, most challenging, and fascinating 1 programs published in the corresponding issue of cca NG Exp: Date COMPUTE. | Signature | | | | I | | |

New on the Gazette Disk! In addition to the Name pai programs that appear in the magazine, you'll also Addrabs get outstanding bonus programs. These programs, ; which are often too large to offer as type-ins, are Sea) ZIP/ available only on disk—they appear nowhere else. Province Postal Code

Mail to COMPUTE's Gazette Disk, P.O. Box 3250, Harlan, IA 51593-2430

"Residents of NC and NY, please add appropriate sales tax for your area. Canadian orders, add 7% goods and services tax.

As another Gazette Disk extra, check out

pitch of middle C on the piano. 45 POKES,195: REM FINE-TUNE FREQUENCY

Shaping the Pulse

While S+2 and S+3 control the shape of voice 1's pulse waveform, S+2 is rarely used. Poking a value of 8 to S+3 will give the pulse waveform a nice, even shape. It's not necessary, how- ever, to shape a pulse waveform unless you plan to use it. To hear what the pulse sounds like, add line 55 and change line 60 as follows.

55 POKES+3,8: REM SHAPE OF PULSE 60 POKES+4,65: REM TURN ON PULSE WAVE FORM

Run the program again, and listen to the difference in the sound. Now exper- iment. Try waveforms 17 (triangle) and 129 (noise). Try various frequencies and envelopes. A reminder: Don't con- fuse voices with waveforms. SID has three voices (remember our three-string guitar?) and four waveforms (triangle, sawtooth, pulse, and noise).

Voices 2 and 3

So much for voice 1. If you want to play more than one voice at a time, each must be set up independently.

G-8 COMPUTE NOVEMBER 1992

For instance, let's add another note to harmonize with the last one. Modify lines 40-60.

40 POKES+1,16: POKES+8,21 45 POKES, 195: POKES+7,31 50 POKES+5, 12: POKES+12,12 55 POKES+3,8: POKES+10,8 60 POKES+4,65: POKES+11,65

Voice 2's values follow the colon in each line. To program voice 2, just add 7 to voice 1's memory registers. In line 40, S+1 for voice 1 becomes $+8 for voice 2; in line 45, voice 1's S becomes voice 2's S+7; and so on.

Notice that in this example I've poked all voice 2 registers with the same values—except frequency in lines 40 and 45. Frequency values 21 and 31 (from the Music Note Values table) are needed to produce E above middle C on the piano. You may, if you like, set different envelopes for each voice (line 50) or different waveforms (line 60). If you run the program now, you'll hear a two-note chord in perfect harmony.

As you've probably noticed by now, SID's three voices are arranged within the chip in groups of seven registers each. Thus the control registers for voices 1, 2, and 3 are 54276, 54283,

3 You PATHETIC TECHNO- MORON.

and 54290, respectively. The attack/decay portion of the three envelopes is set in registers 54277, 54284, and 54291, respectively. Therefore, to program voice 3, just off- set the memory registers by 7 again.

As promised, here’s how to reduce the proliferation of POKEs for this par- ticular program. This technique won't always be applicable, but it may give you some ideas. Begin by copying lines 10 and 30 from the above pro- gram. Then delete the remaining lines. Now add these lines.

40 FORG=1 TO 10: READL,D:POKES+L,D

50 NEXT:END

100 DATA 1,16,8,21,0,195,7,31, 5,12,12,12,3,8,10,8,4,65,11,65

That's it! All SID's offsets from S (54272) and the pokable values have been compressed into one data line. One FOR-NEXT loop does the rest of the work.

While this simple program touches on only a few of the SID chip's won- derful possibilities, you can have fun experimenting with changing wave- forms, frequency values, and voices. | hope programmers will be encour- aged to further explore the sound capabilities of their 64s and 128s. O

SBIT "al

LINDENHURST NY 11757-0542 DON’T LET A SPILL CAUSE A COMMODORE

MELTDOWN

5 ONE SMALL MISTAKE COULD DESTROY 1: ASST. (StarTrek*+) | yQUR COMMODORE COMPUTER FOREVER 4: GAMES (Tetris +) \Ciaealcon comewhen Cacan malted for earl tel 5: DEMOS/MOVIES | these sels fit over every key 20 precisely that you won't 6: PRODUCTIVITY | even know it’s there... you spill something, that is! 7: GEOS CLIPART | Keep out accidental spills, dirt, dust, and ashes! Never Again Wear Off The Priat On Your Keys! Save Your Commodore for ONLY $ 19.00 8 Order # VS64 .......fits your Commodore 64 or Vic 20 Been”) | Order # VS64C........ufts your Commodore 64C D: ART GALLERY | Oder # VS12B......een+.00ennfits your Commodore!28

Ee Ehc at 5 1000| | COMMERCIAL SOFTWARE ! CALL FOR ITEM AVAILABILITY !

You must sign that DIEHARD <4 ed BLOCKOUT PARADROD..

CLUBHOUSE SPORTS 1.8 5.00 aipeGere| | SEGA ARCADE SPACK.....$ 15.00 Jovstick. |__| (Includes Out Run, AfterBurner, Shinobi, ONLY $5.00 Alien Syndrome, and Thunderblade !)

MANY ITEMS ARE CLOSEOUT ITEMS ONLY, AND THE AMOUNT OF STOCK MAY BE LIMITED! CALL OUR OFFICE TO VERIFY AVAILABILITY !

SHIPPING $2.00 For First Item + $1.00 cach additional item

°U.S. Funds Oaly! “SORRY NOC.O.D.’s OR CREDIT CARD FOR A FREE COPY OF OUR CATALOG, CALL: (516)-957-1110 MONDAY - FRIDAY 10am to 5pm EST

Circle Reader Service Number 162

Create a Requires:

Wester Print Shop Style Graphics, Borders, and Fonts for the Print Shop . Version 2.0 or with your Print Shop fo Version 1.0 Commodore with the

64/128 Companion 4 or

Computer \G Print Shop

: Version 1.0

WESTERN é : with the

Holiday

HERITAGE Edition

Cantte..$ 9.00

AK Hin-$ 6.00 ‘APO, FPO...5 6.00 Wa, Ran Tun $1.92 tae GRAPHICS

For more info, ‘Version for the Commodore 64/128 Includes 9 Pia and 7 Pia Pristers,

509-276-6928 Neocon’

Over 140 New Ways to Create a Total Western Environment with 90 Graphics, 42 Borders and 10 Fonts for the Print Shop.

* Create Westem Style Stationery, Cards and Invitations.

«Invite Your Friends to a Wester Birthday Party, Bar-B-Q or Card Game. * Make 10 Gunfighters of the Old West, Wanted Posters.

+lmpress Your Club with Western Posters, Banners and Calendars. *Make posters for Your Favorite Wester Event, Horse Show, Hay Ride. +Designs for over 50 Western Business Activities and Club Events. «Kids Share Secret Messages with Your Friends.

tiny f LF LIRR eA SS GRAPHICS = Horse Feathers Graphics Inc., N. 27310 Short Road, Deer Park, Wa. 99006-9712

Circle Reader Service Number 234

GRAPEVINE GROUP - COMMODORE UPGRADES ~

SPECIALS

COMPUTER SAVER: This C-64 Protection System saves you costly repairs.

1 Over 52% of C-64 failures are caused by malfunctioning power supplies that destroy your computer. Installs in seconds between power supply & C-64. No soldering. 2 year warranty. An absolute must and great seller .. $17.95

® PRINTER PORT ADAPTER by Omnitronix. Avoid obsolescence. Allows you to use any Commodore (C-64) printer on any PC compatible or clone. Does not work with Amiga. . sssaee $34,95

512K RAM EXPANDERS

By special arrangement with Commodore, we are able to purchase ata fantastic price 400 of the original 512K 1750 RAM expander units for your C64 or C128 computer. Now keep up with the latest technology. Upgrade to 512K with a simple plug-in module. Completely compatible and comes with software. If you have a C64 you will need a heavier power supply (4.3 amp), which we will give you for $31.00, C128 users do not need this power supply. This Is the original Commodore unit with over 800,000 sold. $99.95 Super 1750 REU CLone (512k). Does not require a larger power supply..$142.50

COMMODORE DIAGNOSTICIAN II

Originally developed as a software package, then converted to a readable format, the Diagnostician has become a fantastic seller. With over 38,000 sold worldwide, Diagnostician II utilizes sophisticated cross-reference grids to locate faulty components (ICs) on all C-64 and C1541 computers (C-128/64 mode). Save money and downtime by promptly locating what chip(s) have failed. (No equipment of any kind needed.) Success rate {rom diagnosis-to-repair is 98%. Includes basic schematic $6.95 (Available for Amiga compi .95).

NEW POWER SUPPLIES

© Asuper-heavy, repairable, “not sealed” C-64 power supply with an output of

4.3 amps (that's over 3x as powerful as the original). Featuring 1 year warranty,

ext, fuse, schematics, UL approve: 37.95 (Includes bonus Commodore Diag @ $6.95)

© Our Biggest Seller © 1.8 amp repairable heavy duty supply for C-64, (Over

120,000 sold.)..... easttnaueetsasiersegeaO5

REPLACEMENT/UPGRADE CHIPS & PARTS

9 4164 (C-64/RAM).. C-128 ROMs Upgrade (set 3) C1571 ROM Upgrade (310654-05). C-64 Keyboard (new) C64 Cabinet (new)... Interface Cables: #690 C64 to 1541/1571 disk drive.

#693 C64 to 3 pin RCA (eg. 1084) ......4.. 1541/1571 Drive Alignment eaeeeeee Super Graphics by Xetec a Service Manuals for C64, C128, 1802, 1084SP, 1541

+ EMERGENCY STARTUP KITS +

Save a lot of time and money by repairing your own Commodore computer. All chips are direct socket plug-ins (no soldering). Each kit includes all you need to “start up"/revive your broken computer. Originally blister packed for the government PXs worldwide, this series is now available to you. Total cost savings per kit far exceeds purchasing chips on an individual basis

KIT #3 (Part #DIA 15) for C64 Symptoms: No power up ® Screen lock up ® Flashing colors * Game cartridge problems Contains: ICs. #PLA/82S100/906114, 6526, Commodore Diagnositician, Fuse, Chip Puller, 8 RAMs, Schematic, Utility Cartridge & special diagnostic test diskette with 9 programs ‘An $87.50 value for only $29.95

KIT #4 (Part #DIA 16) for C64 Symptoms: Control Port ¢ Sound ® Keyboard ® Serial device problems Contains: ICs #6526, 6581, 8 RAMs, Commodore Diagnostician, Fuse, Chip Puller, Basic Schematic, Utility Cartridge & special diagnostic test diskette with 9 programs A $79.80 value for only $29.95

KIT #5 (Part #DIA 17) for 1541/1571 Symptoms: Drive runs continuously ® Motor won't stop ® Read errors © No power up Contains: ICs #6502, 6522, Fuse Chip Puller, Basic Schematic, Commodore Diagnostician & special diagnostic test diskette with 9 programs An $70.10 value for only $29.95

ae! Send For Free Catalog 4 3 CHESTNUT ST., SUFFERN, NY 10901 Order Line 1-800-292-7445 Fax 914-357-6243 Customer Service: 914-368-4242 International Order Line: 914-357-2424 We Ship Worldwide Prices subject to change Hours: 9-6 E.T. M-F 15% Restocking Charge

Tell a friend you've heard it through the Grapevine.

Circle Reader Service Number 145

REVIEWS

ARACHNOPHOBIA

A deadly spider from South America has _ migrated north, laying her loathsome eggs in hundreds of homes, schools, buildings, barns, and cemeteries. In a frighten- ingly short time, her off- spring have hatched and have begun to reproduce.

Thus begins the arach- nids' reign of terror in commu- nities across America. This Disney arcade game for the 64 closely follows the basic premise of the studio's hit movie Arachnophobia.

Homes are overrun, citi- zens terrorized, and whole communities abandoned. Residents have tried every- thing to rid themselves of the unwanted guests, but nothing seems to stop these creepy crawlers. The eight-legged enemy is upon us. It’s enough to make your skin crawl.

As a last resort, the U.S. Department of Agriculture sends a frantic plea to Delbert McClintock, owner of the McClintock Infestation Management Company. McClintock is the inventor of a patented insecticide, Toxi- Max, which is said to be strong enough to kill the arachnids. Fearless Delbert loads his bugmobile with the lethal Toxi-Max and a supply of bug bombs, and sets out to free his country from the invading horde.

You won't need a lot of practice to get into the swing of playing this game, nor will you need to refer to the instruction manual throughout play. Disney does recommend that you make a backup of the game's double-sided disk be- fore playing and use the backup for play. The game is compatible with most Fast Load cartridges, too. Since there's enough variety

G-10

in Arachnophobia's sharp, colorful graphics to keep you playing for hours, you'll find using a Fast Load car- tridge will save you a lot of time, since you must flip sides during the game. When you load Arachno- phobia, you'll see the bugmo- bile as it drives past homes,

sense of timing and your joystick skills.

Spider webs are a real nui- sance. Blundering into one will slow you down to half speed and make you more vulnerable until you break free.

A single spray of deadly Toxi-Max is enough to kill a

Delbert McClintock is the nation’s last line of defense against hordes of invading spiders from South America.

farms, schools, and cemeter- ies. Pick the building you want to enter; then use your joystick to guide the bugmo- bile there.

When you stop at a loca- tion, the screen changes to an interior scene showing Delbert. Your mission is to help him clear the infested rooms by hunting down and destroying all the spiders and the egg sack that's hid- den in every structure. Sound easy? Don't be so sure,

Spiders are everywhere. They'll do all they can to guard their egg _ sack. Sneaky ones drop from the ceiling to land on you; oth- ers slither down web strands and bite you from be- hind. You'll be attacked at ground level, too. Often, the soldier spiders work in groups, testing both your

COMPUTE NOVEMBER 1992

soldier spider within spray- ing distance. It only takes a few spider bites to slay you, however, so keep your eyes open for first-aid kits. These will restore your strength. There's at least one kit in eve- ry building.

Don't forget you're wear- ing heavy work boots, too. You can stomp on some of the creepy crawlers, conserv- ing your limited supply of insecticide.

The quickest way to clear a room is to use a bug bomb. You start the game with only three of these, so use them wisely. Other items you find as the game progresses are almost as useful as bug bombs. Match- es and aerosol cans can be fashioned into nifty flame- throwers, which have a bet- ter range than your insecti- cide sprayer. More impor-

tant, the homemade flame- throwers can clear an entire floor or ceiling of a room with just one pass.

When you've cleared a structure, you can safely re- turn to the bugmobile. But there's no time for you to rest. The battle has only be- gun! There are more build- ings and towns needing your bug-slaying skills. Just guide your bugmobile to an- other building and start exter- minating spiders.

Every building in every town is filled with hordes of vicious spiders, defending an egg sack. Only one struc- ture in each town hides a queen spider. The queen is the same size as the original South American spider. You'll know this mean mama by the distinctive yellow mark- ings on her legs. Watch out! She's tougher than her sol- diers and can even bite af- ter she’s been stunned. Slay- ing her will transport you to another city with yet another queen spider to roust.

Allin all, this is a challeng- ing game that's designed to give you a real workout. If you succeed in besting the queen spider in every town, you'll have saved the coun- try and proved yourself a he- ro. As a reward, the United Nations will give you a se- cret assignment in the Ama- zon rain forest. The mon- strous arachnids there will make you wish you'd been a little less successful.

To aid you during play, the bottom of the screen dis- plays status information. There’s an amusing picture of Delbert that monitors the state of your health. It chang- es from smiling to frowning to screaming in pain, de- pending on how many times you've been bit. First- aid kits will restore Delbert’s smile.

Next to Delbert’s picture

The Gazette Productivity Manager

(Formerly PowerPak)

Harness the productivity power of your 64 or 128!

Turn your Commodore into

a powerful workhorse, keep track of finances, generate reports in a snap, manage your money in minutes—

all with the new 1991 Gazette Productivity Manager! Look at all your 64/128 Productivity Manager disk contains.

ORDER YOUR 1991 GAZETTE PRODUCTIVITY MANAGER TODAY!

GemCalc 64 & 128—

A complete, powerful, user-

friendly spreadsheet with all the features you’d expect in an expensive commercial package (separate 64 and 128 versions are included). Most commands can be performed with a single keypress!

Memo Card—Unleashes the power of a full-blown database without the fuss! Nothing’s easier—it’s a truly simple computerized address file. Just type in your data on any one of the index cards. Need to edit?

Just use the standard Commodore editing keys. (MasterCard and Visa accepted on orders with subtotal over $20). Finished? Just save the data to floppy. What could be | © © © © easier? DYES! please send me Productivity Manager disk(s)

($14.95 each),

Subtotal

Sales Tax (Residents of NC and NY please add appro- priate sales tax for your area. Canadian orders, add 7% goods and services tax.)

——— Shipping and Handling ($2.00 U.S. and Canada, $3.00 surface mail, $5.00 airmail per disk.)

—— Total Enclosed

—Check or Money Order MasterCard VISA

|

|

| Financial Planner—Answers all of those questions ! I | l | | I | 1 Credit Card No. | I ! | | | | | I I | | 1

concerning interest, investments, and money manage- ment that financial analysts charge big bucks for! You can plan for your children’s education and know exactly how much it will cost and how much you need to save every month to reach your goal. Or, decide whether to buy or lease a new car. Use the compound interest and savings function to arrive at accurate

Signature

estimates of how your money will work for you. (Required) Compute the answer at the click of a key! seme ee

Address DON’T MISS OUT ON THIS | 2 Taw

Send your order to Gazette 1991 Productivity Manager, 324 W. Wendover Ave., Ste. 200, Greensboro, NC 27408.

POWERFUL WORKHORSE!

“1991 Gazette Index

Everything’s included! Features, games, reviews, education/home applications, programming, bugswatter, feedback, and columns!

A superb interface includes pull-down menus, help screens, and keyboard,

joystick, or mouse control. Features in-

clude super-fast searching and sorting capabilities. An options screen allows you to choose text colors, drive num- ber, and input device. And there's full documentation on disk.

Choose from three modes of opera- tion—browse for quick scanning, view for detailed information and descrip- tions, and edit for adding items from upcoming issues—and print to any printer. There’s even a turbo-load op- tion for maximum disk-access speed.

ORDER YOUR 1991 GAZETTE INDEX TODAY!

(MasterCard and Visa accepted on orders with subtotal over $20.)

To order, send $7.95 per disk, the quantity of disks ordered, check or money order,” your name and com- plete street address:

1991 Gazette Index

324 West Wendover Avenue Suite 200

Greensboro, NC 27408

*Please add $2 shipping & handling ($5 foreign) for each disk (residents of NC, NJ, NY please add appli-

cable sales tax; Canadian orders, add 7% goods and services tax).

All payments must be in U.S. funds. Please allow 4 weeks for delivery.

REVIEWS

is an indicator showing how much Toxi- Max insecticide remains in your spray tank. It refills automatically whenever you return to the bugmobile. (Beware! You can leave a building at any time for refills, but all the spiders will return while you're out.)

A counter at the bottom of the screen shows how many bug bombs you have. You start with three but earn another every time you clear a struc- ture. Last, but definitely not least, is the Bugometer. This compasslike device in- dicates the direction in which to travel to find the queen in each city.

| prefer to play Arachnophobia with the sound turned down, but my son likes to hear Delbert’s bug-fighting com- ments and the sizzle of his flamethrow- er. | like to go through houses system- atically rousting arachnids; he zeroes in on the queen. Even though our styles vary, however, we both agree that this is the best arcade game we've played in a long while. MARTI PAULIN

Commodore 64 or 128—$29.95

WALT DISNEY COMPUTER SOFTWARE 500 S. Buena Vista St.

Burbank, CA 91521

(818) 841-3326

Circle Reader Service Number 341

FUN GRAPHICS MACHINE

Fun Graphics Machine is a great way to create and manipulate graphics and hi-res screens on a 64. My introduction to the program was a free demo that’s available on QuantumLink. | was amazed at the ways that | could work with the designs on the screen: flip, flop, reverse, stretch, shrink, crop, ro- tate, fasten, copy, and print the results. The demo won't allow you to save and print features, but the asking price for the registered version makes it a real must-have bargain. The reference man- ual is the first good feature.

The spiral-bound manual lies flat, so you can really use it. Some of the in- structions are duplicated, but that stops the page flipping when you need to refer back to some detail that has slipped your memory.

The manual itself was produced with FGM. It even shows step-by-step instructions of how various pages were composed. This is not a drawing program. It doesn't have lines, circles, or squares, and there are no colors— just a white screen (or rather, three white screens) to work with.

The program uses color in a useful way. The cursor and borders change color to let you know what mode you're in. Blue cursor is text, gray is grab, pur- ple is adjust, and so on.

You work on a 40-column screen, and the screens can be linked both across and down. By combining two screens across, you have your 80-col- umn format for printing a full page. You can use a third screen as a workplace. Link the screens down for as many as you need. Print a banner of any length.

Save your work with a simple meth- od of coding, and then use one instruc- tion to print all of your work.

FGM is really a collection of pro- grams, not just one. With the program disk in one drive, it'll recognize the pres- ence of any other two drives. Create lets you do your own thing. Demo runs demos that are available on the pro- gram disk or replays those that you cre- ate and save. Clip-Art uses artwork found in other programs like The Print Shop, The Newsroom, and Doodle. Printer sends your work to your printer. You can print your work to disk in files that others can view without hav- ing to run FGM. You can design and send greeting cards or draw screens 0 be used as titles on your VCR.

FGM has its own department on Q- Link. Download a file with 50 different fonts, and you can type in just about any style that you like. FGM contains a customizer, which will design or modi- y a font. Updates are always being added. If you have a question, some- one online will have the answer, and samples of what users have done are always interesting to study.

If you're using a 128 and have the re- set switch, you'll discover something remarkable. Suppose you're running a program in 64 mode and see a graph- ic on the screen that you'd like to save. Hit the reset switch. The program will be gone, but then load and run FGM. On most occasions the graphic will be available on one of FGM's screens. Now you can save it, grab part of it, and paste it on another screen. Have fun; that's what the pro- gram is all about—having fun with graphics.

Since you can edit at the pixel level, you can do some finely detailed work, and a smoothing technique takes away some of the rough spots on captured pictures. With the overlay method of grabbing and pasting, you can design and save different templates and then use them for various projects. A simple template with a musical symbol font and score lines is useful for writing mu- sical scores. A grid pattern can be over- laid with needlework designs.

Playing with FAM can become addic- tive. Searching for different graphics to manipulate, adding new eyes to a face from a Print Shop cartoon, using part of a picture as the cover for a greet- ing card, and designing your own let- terhead are just some of the fun you can have working with graphics.

In text mode you can link two screens across, use word-wrap, select a font, set the margins, and type your document. The size of the cursor can be changed with a single keypress. And with that size change, the size of your font changes, all the way to a full screen.

Great graphic work on the screen can be work wasted if you can't send it to a printer. FGM supports most print- ers, and it gives you the option of tell- ing your printer to perform various ef- fects. You can select dots-per-inch density; single or double height; single, double, or triple width; various mar- gins; and so on.

Try printing the same screen with dif- ferent options, and you'll be surprised by the results. Not only does FGM let you design and work with your own graphics, but you have the ability to load files from other programs. The possibilities are endless. You have com- plete control over every pixel on the screen. Artwork can be stretched, shrunk, slanted, rotated, overlaid with shadows, and more. By using two screens and flipping between them, you can create simple automation for your demos.

Learning to use the program can take time, but you don't have to learn it all at once. If you go too far, a cou- ple of keystrokes will always take you back to where you started. There’s no need to remember filenames.

Selections are made from a screen menu, and a disk directory is always available. You can use up to three drives with FGM, and the program will ask you which one you want to access. You can customize your program disk so that it will default to your particular printer.

If you'd like the cursor and borders 0 be different colors, you can change hem. Copy the program disk and hen customize the copy with your most used fonts, character sets, and graphics for a program default to suit your own needs.

FGM is always being updated on Q- Link. The author, whose Q-Link handle is RonH8, is often online in the Starving Artists' Cafe. He is always offering new hints and suggestions.

Q-Link members can download an FGM demo and try it before buying. But once you try FGM, you'll be hooked on graphics—and spoiled. No

more having a graphic that won't fit in the space you need on your docu- ment. With FGM you can copy it, shrink it, expand it, paste it, and then smile at the results.

Discover that your 64 is a real fun ma- chine. Then surprise your friends with your newly discovered artistic talent. You won't go wrong with Fun Graphics Machine.

ESTHER OLSON

Commodore 64 or 128—$24.95, plus $3.50 ship- ping and handling

THE FGM CONNECTION P.O. Box 2206 Roseburg, OR 97470 (503) 673-2234

Circle Reader Service Number 342

DWEEZILABEL

If Dweezil is anything like the program that bears his name, he must be one clever dog. Once again, Dave Fer- guson, GEOS programmer extraordi- naire and human who lives with Dweez- il, has released an intriguing and useful GEOS program with a picture of a dog in a party hat on the label.

DweeziLabel is everything a GEOS user could want in a label program. Well, to be fair, it's everything Ferguson would want in a label program. He'll be the first to admit that the program evolved more as an answer to his spe- cific needs than as a general-purpose label maker. Even so, it includes enough features to function as a minidatabase, a minipublisher, and who knows what else.

In the course of running Quincy Soft- works, Ferguson needs to keep track of customers from all over the world and to keep notes on what they've or- dered, how much they've paid, and so on. DweeziLabel emerged as his ideal multipurpose low-end business applica- tion. You can find it on Dweezil Disk #3, which includes MYgeoDIARY and geoWORDS.

Since Ferguson runs his business ex- clusively with GEOS products, data from DweeziLabel is compatible with applications such as geoMerge and geoCalc. Text scraps and numeric da- ta can be neatly clipped in formatted chunks to fit those GEOS applications.

An even better example of DweeziL- abel's versatility is the way it handles da- ta. The program works with files of up to 50 records, similar to a card file da- tabase, These files can be created from within DweeziLabel, geoWrite, or geoFile. Ferguson wanted room in those records for more than just names and addresses. He wanted to keep notes about what products peo- ple had ordered and the amount of

Can Your Computer Make

m>) YOU 4\"$1,000,0007

» WITH LOTTERY PC vile NEXT TICKET COULD BE WORTH MILLIONS!

LOTTERY uses the raw power and storage of your Computer to determine and refine the number saiecion methods that will win the various lottery games play. Don't be limited to the one or two methods tt t other programs use, they might not work in your state. There is no better system available!

Join the growing list of winners using our system. SPECIFY: Lottery 64(C64/128) Lottery PC IBM PC/XT/AT and compatibles Commodore64/128 & Plus/4 are esse! trademarks of Commodore Int

IBM PC/XT/AT ate registered trademarks of International Business Machines Inc

To order, send 20 95 for each plus $3.00 postage & handling per order to

(Illinois residents add 6% sales tax

(Grders outside North America add $3.00)

VISA

C.O.D. orders call: (708) 566-4647

Superior Micro Systems, Inc, D) aS 26151 N. Oak Ave. (ae S Mundelein, IL 60060 Ys, s\ \—4

Circle Reader Service Number 221

DISKS O'PLENTY INC 7958 PINES BLVD. SUITE 270A PEMBROKE PINES FL 33024 (305) 963-7750 Call or write for free descriptive catalog of C64/128 Public Domain & Shareware Choose from over 900 Disks Adult list of over 50 Disks available

to those 18 or over. 021MU SID MUSIC UTILITIES 019GR_ PRINTSHOP UTILITIES 019ED JRHIGH EDUCATION O62ED HIGHSCHOOL EDUC. 033ED TYPING / SPANISH 031ED COMPUTER SCIENCE 010UT PIRATES TOOLBOX 119GA. FOREIGN ARCADE 022GA CASINO-BOARD GAMES 021GE GEOS FONTS 002MS LOTTERY PROGRAMS 003MS COLLECTORS CORNER

Circle Reader Service Number 253

Choose 6 for $5.00 LIMITED OFFER

THE AMERICAN HEART ASS@IATION MEMONAL OE

US OOSISAP SN)

2. @aAmericanteart Association

This space provided as a public service.

NOVEMBER 1992 COMPUTE G-13

REVIEWS

money they'd paid, so he added sev- eral extra data lines for that express pur- pose, data that the labeler part of the program doesn't print unless you want it to. So far, that's pretty tame stuff, but this is no wimpy Rolodex.

Tucked away in the Text menu is a series of search commands that let you sail through your data with ease. The six possible lines of data could be names and addresses. You could store shoe sizes and a recipe for Pan Galactic Gargle Blasters in there if you wanted, but DweeziLabel restricts you to the number of spaces you can use. In fact, aside from the size limit and the lack of the trivial feature of saving a graphic to a record, DweeziLabel can hold its own with geoFile for useful- ness. As | said before, it even creates merge files for geoMerge.

But, hey, what about labels? Yes, DweeziLabel does labels, any kind of labels. It produces any kind of printed output that is 2 inches tall, for that mat- ter, on pages up to a full 11 inches tall. Using a technique called layering in the work window, you can put togeth- er combinations of graphics and text to create just about any kind of label you can imagine.

By paging through the database, you can select label text that can be modified however you like. You can use any GEOS font you might have available (on either disk, up to the file selector's limit—no six or seven font maximum here) and any style, includ- ing reverse. The work window is conven- iently sized to fit Ferguson's premier graphics desk accessories, NewTools and geoStamp (available on other Dweezil Disks). This means you can stamp yourself a border around a label or curve and angle graphics and text to your heart's delight.

All this power doesn't come as easi- ly as it could, however. The documenta- tion provided on disk is extensive but a bit thin in spots. The entire process of layering a graphics label is not par- ticularly intuitive, which is not necessar- ily bad, but a step-by-step tutorial for this process would save the user some trial and error.

The words scrap and label appear of- ten, sometimes meaning one thing and sometimes another. While these varia- tions are defined in the short glossary,

G-14. COMPUTE NOVEMBER 1992

they do get confusing. Maybe since this program has become second na- ture to Ferguson, he's lost the perspec- tive of a neophyte. The documentation should've been written from the per- spective of the user who hasn't a clue about how this program operates—but it wasn’t. As a result, this program runs the risk of being tossed aside af- ter a half hour of frustration by casual users who don't care to figure out things on their own.

That would be a shame. DweeziLa- bel is too powerful an application to be missed by anyone who has some hon- est-to-goodness work to do with GEOS. The results are worth the extra effort it takes to master the intricacies of the interface. Heck, when used in conjunction with NewTools and geo- Stamp, DweeziLabel might be, as the ads claim, the “hottest GEOS label pro- gram to come along in years!”

STEVE VANDER ARK

Commodore 64 or 128, GEOS—$15.95

QUINCY SOFTWORKS

9479 E. Whitmore Ave.

Hughson, CA 95326-9745

Circle Reader Service Number 343 a]

TYPING AIDS

MLX, our machine language entry pro- gram for the 64 and 128, and The Auto- matic Proofreader are utilities that help you type in Gazette programs without making mistakes. To make room for more programs, we no longer include these labor-saving utilities in every is- sue, but they can be found on each Ga- zette Disk and are printed in all issues of Gazette through June 1990.

If you don't have access to a back issue or to one of our disks, write to us, and we'll send you free printed copies of both of these handy pro- grams for you to type in. We'll also in- clude instructions on how to type in Ga- zette programs. Please enclose a self- addressed, stamped envelope. Send a self-addressed disk mailer with appropri- ate postage to receive these programs on disk.

Write to Typing Aids, COMPUTE's Gazette, 324 West Wendover Avenue, Suite 200, Greensboro, North Carolina 27408.

In addition to the type-in pro- grams found in each issue of the magazine, Gazette Disk offers bo- nus programs. Here's a special program that you'll find only on this month's disk.

BASSEM 128

By Fernando Buela Sanchez Querétaro, QRO

Mexico

Symbolic label-based assem- blers are the most convenient way to write machine language programs. You enter instructions as source code, and they are lat- er assembled into object code. Rather than using memory loca- tions, you can use meaningful la- bels.

Many programmers have used—and raved about—Bas- sem for the 64, and now there's an improved version for the 128. Bassem 128 works in conjunction with BASIC 7.0, and because of the 128’s larger memory, it can store larger source code pro- grams, With the addition of new commands, you can also devel- op your programs with less effort.

Bassem 128 and complete instructions are available only on disk. You can have this program and all the others that appear in this issue by ordering the Novem- ber Gazette Disk. The price is $9.95 plus $2.00 shipping and handling. Send your order to Ga- zette Disk, COMPUTE Publica- tions, 324 West Wendover Ave- nue, Suite 200, Greensboro, North Carolina 27408.

HEL PREVENT HEART ATACK WITH A STROKE

Any type of aerobic exercise program can help reduce your risk of heart attack and stroke. The only hard part is diving in. To learn more, contact the American Heart Association, 7272 Greenville Avenue, Box 47, Dallas, TX 75231-4596.

You can help prevent heart disease and stroke. We can tell you how.

American Heart Association

This space provided as a public service. © 1992, American Heart Association

DISK MAGAZINES FOR 64 & 128 Great programs & articles from both sides of the Atlantic. C64 ALIVE! is U.S. produced. LIGHT DISK and clubLIGHT are UK produced. C64 ALIVE! Sample disk $3 (£1.50): S issues ending 12/92 $20 (£10); 6 issues starting 1/93 $25 (£12.50) clubLIGHT Single issue $5 (£2.20): __12 issues starting 9/92 $50 (£23.40)

LIGHT DISK (only 4 issues) 8 Disks $30 (£15) LIGHT DISK and clubLIGHT are for 64/128 C64 ALIVE! is 64 only FOR DELIVERY: IN U.S.: Jack Vander White, C64 ALIVE!, P.O, Box 232115, Sacramento, CA 95823 IN UK: Datasphere Publications, 7 Fallowfield Close, Valley Drive, Norwich, NR1 4NW Outside North America and UK write for prices.

Circle Reader Service Number 154

({@ GRAFIX GALORE SS Original Printshop Graphics }--—¢ Over 80 super graphics to add sparkle to your Printshop projects! Everything from sports to spys and pirates to pizza. Send $11.95 (inc. s/h) add $3 if outside N. America. Specify C-64 or IBM version. REQUIRES PRINTSHOP OR GRAPHICS COMPATIBLE PROG.

Cel CLIP ART CUPBOARD P. O. BOX 317774 ® CINCINNATI, OH 45231

SEC CHECK REGISTER 128

Manages personal or small business checking in a fast/efficient manner. Fast data entry, many bank transactions predefined. Unlimited recurring payees. Up to 750 active file transactions. History files allow an on going record. Up to 999 reference (account) numbers. Easy editing with many powerful commands. Reports printed by, Outstanding Transaction, Transaction, Reference Number, Reference Number & Date. Random Reference Number, or Payee. Print any type of personal or for Supports all 15XX and Hard Drives. Compatible with all currently available DOS cartridges and ROM chips. Custom video fonts. Spiral bound lay flat manual and much more. System requirements: C=128 with 80 column RGB or Mono. monitor. FREE with each order SEC Financial Cale. 128 TO ORDER: Send Check or Money Order for $24.95 + $3.00 S&H to:

SPARKS ELECTRONICS, 5316 So. 9th, St. Joseph, MO 64504-1802 Circle Reader Service Number 252

Commopore 64 PuBLic DomAIN

Highest Quality Since 1987* Games, Education, Business, Utilities, GEOS, Music, Graphics & More. As low as 90¢ per collection. 1 stamp for complete catalog or $2.00 for catalog AND 30 sample programs (refundable). 24 hour shipping.

64 DISK CONNECTION

(* Formerly RVH Publications) Circle Reader Service Number 254

KeyDOS ROM Version 2 is here!

The KeyDOS ROM is a chip for the empty socket inside your C128 that adds more than 40 powerful features. KeyDOS is available instantly as soon as you switch on your 128! KeyDOS is loaded with useful tools to simplify file access on multiple drive systems without typ- ing file names—all major DOS functions included. Select multiple files for copying, viewing, printing, renaming or scratching. ASCII/CBM/Screen code converter. Full support for 1581

subdirectories. Built-in RAMDOS for REUs up to 2MB. New GEOS SupeRBoot Alarm clock. Disk editor. Powerful debugger.

Only $32.50. Satisfaction Guaranteed! Write for more information. Enhance your system with the speed and convenience that KeyDOS provides! Antigrav Toolkit, PO Box 1074, Cambridge, MA 02142 Shipping outside of US, Canada and Mexico add $3

Circle Reader Service Number 244

Questions and answers

about computer memory,

onscreen messages,

G-16

FEEDBACK

More Memor

What exactly is the purpose of expanding the 64's memo- ry, using cartridges such as the 1750? On an IBM, certain amounts of memory are re- quired to use certain soft- ware, Is there any software for the 64 that requires more memory than the 64 has?

JOHN VEILLEUX ORRINGTON, ME

There's no software that we know of which requires more memory of the 64 than what is native to the machine. On the other hand, several soft- ware packages, such as GEOS, can make use of RAM expansion if it's available. Many programs—games in Pparticular—use the disk drive for virtual storage when either the program or its data is too large to be loaded and main- tained in memory at one time. If more of the game can be stored in memory, then the game runs faster and the us- er doesn't have to wait for the computer to access the data stored on disk.

Large spreadsheets and da- tabases are two reasons why business applications benefit from larger memories. Pro- grammers can use more mem- ory, which allows for code that is more highly developed and interpreters or compilers that are more sophisticated. More memory is also a boon to graphics, especially anima- tion, where several scenes must reside in memory at once for smooth screen up- dates. A computer can do great things with digitized sound, but a lot of storage space is needed to contain reasonable sound samples.

Where speed isn’t a critical factor, disk drives are a prac- tical means of extending the 64's 64K limit. But where speed and quick responses are needed, more memory is very handy indeed.

COMPUTE NOVEMBER 1992

Flashing Message

I've been working on some games for the 64 and have run up against a problem. There are certain messages, such as DANGER, that I'd like to have flash on the screen. How do | do this?

CAL BODWIN GREENSBORO, NC

You could flash a message in BASIC by alternately printing in normal and reverse mode again and again. The pro- gram would have to stop while the message blinked, however. When the program continued, the flashing would stop.

Here's a machine lan- guage solution. The following program will flash in black any message that is printed on the screen. Other colors will print normally.

10 FOR A=828 TO 914: READB: POKEA,B: C=C+B: NEXT: IFC <>8545THENPRINT ‘DATA ERROR”: STOP

15 POKE 6,0:SYS828 :POKES3281,1: POKES3280,1: PRINT {CLRH3 DOWN}15 RIGHT}BLK}DANGER!”

20 DATA 120,169,81,141,20,3, 169,3,141,21 r

30 DATA 3,169,0,141,147,3,

141 ,148,3,88 G

40 DATA 96,206,148,3,16,58, 169,10,141,148

50 DATA 3,169,0,133,2,133,4, 169,4,133

60 DATA 3,169,216,133,5,162,4, 160,0,177

70 DATA 4,41,15,197,6,208,9, 77,2,41

80 DATA 127,13,147,3,145,2,200, 208,236,230

90 DATA 3,230,5,202,208,227, 173,147,3,73 { -

100 DATA 128,141,147,3,76,

49,234

If you want a different color to flash, poke its color code (0-15) into location 6. The speed of the flashing can be adjusted by poking location

855 with a number from O to 255; the smaller the number, the slower the flash rate. SYS 828 enables the flashing mes- sages. To stop the flashing, press the Run/Stop key and tap the Restore key.

Sequential Files

Could you please explain what a sequential disk file is and how to create one?

JACK DEMEANOR CHARLESTOWNE, MA

A sequential file provides a way of keeping information separate from the program that uses it. This allows you to create general-purpose pro- grams that can act on differ- ent sets of information. In- stead of writing one program to keep track of a stamp col- lection, for example, and a second program to list a col- lection of rare books, you could write (or buy) a general inventory program that stores data in sequential files. One file would contain notes about stamps, and another would have the data about the books.

A single program could han- dle two or more different files. Sequential files are like DATA statements because you start reading at the beginning and continue until the end.

To create a sequential disk file, open it for writing, write one or more pieces of informa- tion to it, and then close the file. It's important to close a file when you've finished us- ing it; otherwise, some of the information will be lost.

Reading the file requires an operation similar to that for writing. Open the file for read- ing, read the information, and then close the file.

Here's a short program that creates a sequential file.

10 PRINT “ENTER THREE NAMES” 20 PRINT'(PRESS RETURN AFTER

EACH ONE” 30 PRINT“OR SEPARATE THE FIRST TWO WITH COMMAS)” 40 INPUT A$,B$,C$ 50 OPEN 1,8,2,‘NAMES,S,W” 60 PRINT#1,A$: PRINT#1,BS: PRINT#1,C$ 70 CLOSE1

The three numbers after the OPEN command in line 50 are the logical file number, the device number, and the channel. The file number can be any number that’s not al- ready being used by a periph- eral. If you had previously opened a file to printer with OPEN 1,4 (file 1, device 4), you couldn't use logical file number 1 for opening the disk file. The logical file num- ber is important because it's the number used to read from and write to a file.

The second number after OPEN is the device number (a single disk drive is device 8). The third number is the channel to be used, There are 16 disk channels, num- bered 0-15. Channels 0 and 1 are used for loading and sav- ing, and 15 is the command channel, so that leaves chan- nels 2-14 for sequential files. It doesn't matter which chan- nel you use, as long as it's not being used by another disk file. You can open more than one disk file, but each must have a different logical file and channel number.

The “S,W" after the file- name means that the file will be sequential (S) and that you'll be writing (W) to. it. Note the five commas in line 50; they're all necessary to separate the various parts of the OPEN command.

When the file is open, the red light on the front of the 1541 (or green light on the front of the 1571) drive will turn on and stay on until the file is closed. In line 60, PRINT# writes information to the file. It must be followed by

the logical file number, a com- ma, and the information. If line 5060 had been OPEN 5,8,3, line 60 would have used PRINT#5 instead of PRINT#1. Line 70 closes the file. CLOSE is followed by the logical file number.

Now that we've written a file called NAMES, here's a program to read the data.

10 OPEN 5,8,4,""NAMES,S,R” 20 INPUT#5,A$,B$,C$

30 PRINT A$:PRINT B$:PRINT C$ 40 CLOSE 5

Since we're reading the file, there's an R, rather than a W, at the end of the OPEN command in line 10. In this in- stance, we're using logical file 5 and channel 4, although we could have used 1 and 2 as in the first program. IN- PUT# reads information from the file. Like PRINT#, it’s fol- lowed by the logical file num- ber and a comma. GET# acts like INPUT#, but it reads a sin- gle character at a time.

The programs have similar structures: They both INPUT from one source and PRINT to another. The first used IN- PUT/PRINT# to read the key- board and write to a file, while the second used IN- PUT#/PRINT to read from the file and write to the screen.

Double-Width Printing

| use SpeedScript with my Star NX-1000C printer, but the PRINT command for dou- ble-width characters does not work. Is there a way to modi- fy the program to use these commands, or should | use a Ctrl-£E command?

DON SYWASSINK SIERRA VISTA, AZ

A Cirl-£, or stage 2, command should do the trick. With SpeedScript, you can define printkeys that will print whatev- er codes your printer uses for features such as double-width

or emphasized mode.

To define a printkey, at the top of your document press Ctrl-£ (or Ctrl-3), followed by the key that you want to as- sign as the printkey. Then en- ter the equal sign (=) and the ASCII value to be substituted for the printkey during print- ing. Many systems use an es- cape (ESC) code to break out of the word processor, and then certain ASCII values to activate various print modes.

For convenience, Speed- Script has already set four printkeys. Printkey 1 is de- fined as the escape key (AS- Cll 27). (With some printers and interfaces, you must send two escape codes to by- pass the emulation.) Printkey 2 has a default value of 14, which is the ASCII code that puts most printers into double- width mode. Therefore, to switch to double-width mode, press Ctrl-£ and then press 1, press Ctrl-£ again, and then press 2. Next, enter the text you want printed in double- width mode.

Printkey 3 has a default val- ue of 15, which turns off dou- ble-width on some printers and selects condensed mode on others. Printkey 4 is defined as 18, which selects reverse field on Commodore printers and some interfaces in emulation mode. On other printers, it switches to con- densed mode. (See your print- er manual for exact codes.)

To print the word WIDE in double width in the following example and then revert back to normal printing, your screen should look like this.

This is FAWIDER printing.

Remember, some printers re- quire two escape codes. In that case, you would have in front of the word WIDE. Codes can vary from printer to printer, so check your manual for specific values. a)

How to create

‘and use sequential

double-width printing

with SpeedScript

NOVEMBER 1992 COMPUTE

G-17

When programming, there’s usually

the fastest way or the most compact

way. Here’s an attractive compromise.

G-18

MACHINE LANGUAGE

Jim Butterfield

CODING CHOICES

Recently, | saw the following message posted on a comput- er network: “| have a value in a single byte, and | want to calculate the remainder after dividing by 5. What code do you suggest?"

The remainder after division is often called the modulo; | don't know why the user want- ed to calculate this, but there are several methods available that we can try. In this column, we'll discuss a couple of meth- ods for solving the problem, and we'll also demonstrate the tradeoff between a program's speed and size. While we're at it, this might be a good time to gain some insight into hexa- decimal numbers.

The standard method for solving this problem would be to use a conventional division routine that would yield both quotient and remainder. There are methods, however, that are designed either to achieve maximum speed or to utilize minimum memory. One rarely finds a piece of code that offers both. Almost all cod- ing is a tradeoff between these two extremes.

A sample program called MODS, printed at the end of this column, provides us with three approaches. The first rou- tine offers speed, the second efficiency, and the third is a compromise of the two. You may want to examine the code of each one.

The fastest method is to look up the remainder in a ta- ble. Since a one-byte number can contain only 256 possible values, we can do this with a table of 256 bytes. This meth- od couldn't be faster. We put the original byte into the Y reg- ister, and do the translation with a single instruction: LDA TABLE, Y. You'll find this at hex address 2015 in the program at the end of this column.

The method wastes memo-

COMPUTE NOVEMBER 1992

ry, since we must devote 256 bytes to hold the table. The ta- ble could be loaded in, but it's quicker to calculate it when the program starts. You'll see this one-shot table build at ad- dresses $2000-$2011. If only a few values were to be cal- culated, we couldn't justify this extra work. On the other hand, if there were thousands of values, this program would be speed efficient.

If the byte in question con- tains a value of 5 or more, we could subtract 5 and then re- peat. Eventually, we end up with a value of 0 to 4; that's the remainder, The calculation loop, at addresses $202C- $2033, requires only four in- structions: compare to 5, branch out if less (BCC), sub- tract 5, and branch back to the loop (BCS). Serious stu- dents of code will be able to explain why we don't need to set the C (carry) flag before subtraction and why the BCS (Branch Carry Set) command always branches.

The code is compact, fitting within eight bytes, but it could be slow. Since the original val- ue could be as high as 255, the loop might be repeated as many as 51 times!

Most programs trade off speed against size. Programs that need to be fast will unfold their loops; this saves time but calls for more instructions. In this case, it really doesn't mat- ter much. We have plenty of memory, and even the slowest method runs plenty fast for our purposes.

| wanted to add one more method, however. This third piece of code is moderately compact and fast. More impor- tant, ithelps to show an interest- ing aspect of hex numbers.

It takes only a glance at a decimal number to tell wheth- er it divides evenly by 5 or what the remainder would be. The last digit of the number tells the story (5 is a factor of

10, the base of decimal num- bers). That's not true of hexa- decimal numbers. The last dig- it will signal whether the num- ber is divisible by 2, 4, 8 or 16, but it won't help you on the mod-5 question. Hex numbers such as 20 and 65 seem as if they should divide by 5, but they don't. Their decimal val- ues are 32 and 101.

There is, however, a quick way to inspect hex numbers to see whether or not they will di- vide by 5. It's similar to the method we use with decimal numbers in testing whether or not a number divides by 9 or by 3. Add the decimal digits to- gether; the total will have the same mod-9 value as the orig- inal number. Thus, decimal val- ue 1234 will have a remainder of 1 when divided by 9. Calcu- late 1424+3+4, giving 10, and the answer is a snap. The same holds true for division by 3, which is a factor of 9.

In hex, the sum of digits tells us about division by 15 or either of its factors (3 or 5), So, hex 23 will divide exactly by 5, and hex BC would have a re- mainder of 3. We know this be- cause 2+3 gives 5, B+C or 11+12 gives 23, which would leave a remainder of 3 when divided by 5,

How would we do this in a computer program? A hex dig- it corresponds to four bits. We can extract the value of the high hex digit by shifting the number right four places. We extract the low digit value with a simple AND #$0F. Add them together, and we have the sum of the two hex digits within a byte.

This sum cannot be greater than 30 (decimal), so we know that the simple subtrac- tion of method 2 will now loop not more than six times. Quite an improvement from a possi- ble 51 times around the loop.

Four LSR (Logical Shift Right) commands extract our high hex digit. We store the re-

sult and then call back the original val- ue; masking with AND #$0F isolates the low digit. Add them together (don't for- get to clear the carry flag first with CLC), and we can repeat the subtract loop of method 2. The whole thing goes from hex address 2040 to 205B. That's a bit longer than the previous method, but there's quite a speed advantage.

The program works on almost any Commodore 8-bit computer. It first pokes the machine language code into place. Then it does the mod-5 calcula- tion four times.

The first calculation is in BASIC, fol- lowed by each of the three above meth- ods. The values used for the calculation are from ROM, hex addresses E000 through E006. You'll get the same re- sults each time, of course.

You might want to use a machine lan- guage monitor to inspect the MODS code more closely. That'll give you an even better understanding of what's hap- pening in the different routines.

100 DATA 162,0,160,0,152,157, 0,33,200,192,5,144,2,160,0

110 DATA 232,208,242,188,0,224, 185,0,33,9,48,32,210,255

120 DATA 232,224,7,144,240,169, 13,76,210,255

130 DATA 162,0,189,0,224,201,5, 144,4,233,5,176,248,9,48

140 DATA 32,210,255,232,224,7, 144,235 ,176,226

150 DATA162,0,189,0,224,72,74, 74,74,74,141,255,32,104

160 DATA 41,15,24,109,255,32, 201,5,144,4,233,5,176,248

170 DATA 9,48,32,210,255,232, 224,7,144,220,176,186

200 FOR J=8192 TO 8295

210 READ X:T=T+X

220 POKE J,X

230 NEXT J

240 IF T<>12902 THEN STOP

400 PRINT “‘BASIC:”

410 FOR J=57344 TO 57350

420 X=PEEK(J):PRINT X-5*INT(XA);

430 NEXT J

440 PRINT

450 PRINTTABLE LOOKUP:”

460 SYS 8256

470 PRINT ‘SUBTRACT LOOP:”

480 SYS 8231

490 PRINT “HEX CHECKSUM:”

500 SYS 8256

510 PRINT “END.” a)

C64/128 PUBLIC DOMAIN SOFTWARE REQUEST FREE CATALOG or send $2 for sample disk and catalog (RE- FUNDABLE). Categories include education, utilities, games, business, PRINT SHOP graphics, pre-tested programs and more. Rent for 75¢ or buy as low as $1.00 per disk side or for 80¢ for 70 or more, $20 order gets 4 free disks of your choice. NEXT DAY SHIPPING!

SINCE 1986

& CALOKE INDUSTRIES (Dept. GK) -=7ee t PO BOX 18477, RAYTOWN, MO 64133

Circle Reader Service Number 181

Commodore Accessories & Necessities

Ribbons! M3 Mouse

MPS 801 - 802 - 803 - 1525 - 1526 - 1000 - Modems

1200 - 1230 - 1250 Joysticks Commodore Printer (Comm. & PC Comp.) Icon Controller

C 64 C Computer * 1541-II Disk Drive: Cables 1802 Monitor Power Supply SOFTWARE: Educational - Productive - Fun » Commodore-Amiga Authorized Dealer & Service Center - 24-Hour Turnaround on Repairs - CALL for PRICING

= ELECTRO-TECH ELECTRONICS eB 677 East Main Street - Ventura,CA93001 + 805-648-5417

Circle Reader Service Number 148

Same Old Ad - Great New Price! NowgetCalcll, theleading C64 spreadsheet, The Fastest | for the special year-end price of $24.95, S&H included! The best now costs less - so Spreadsheet order now, while the price is right! for the US, CAN: $24.95 ($US/$CDN), check/money order Commodore OVERSEAS: $24.95 US, Intemational Money Order fr

PANKHURST PROGRAMMING mn . Box 49135 + Montreal « Quebec * Canada * H1N 376 Circle Reader Service Number 152

Realistic Nuclear Attack Sub Simulation C64 or 128 In 64 Mode Command Missions Under The Arctic Ice, Hunt Russian Typhoons In The North Sea Requires C64 GEOS 1.3 or 2.0 $19.95 Check or Money Order VMC Software PO Box 326 Cambria Hts. NY 11411

Circle Reader Service Number 171

Upgrade your Commodore system

Refurbished Hardware New APROTEK modems MONITORS DRIVES OTHER 64/128/AMIGA-2400 BAUD - $119 1701 -$235 1841 -$100 1660 -$30 1702-$255 1541-l1-$120 1670-$50 1801-$265 -1571-$165 C64 -$100 EXPANDER FOR THE 64/128- $40 1802-$285 1571-1-$185 640-$120 New CMD accessories 1901-$295 1581-$180 C128-$175 _JIFFYDOS 64/128 & ANYDRIVE "SYSTEM"- $85 1902-$305 1001SFD-$150 _C128D-$225 128D/ANY DRIVE *SYSTEM"- $95 10848-$325 1530 DATASETTE-$35 ADDITIONAL DRIVE ROMS - $45 MANY BOOKS- $10 SOFTWARE - $10-20 RAMLINK/RAMCARD C/W BATTERY (OMb) -$345

ASK FOR ANYTHING, IMIGHT HAVEITI 1Mb RAM SIMM - $75 4Mb RAM SIMM - $250

64/128/AMIGA-1200 BAUD - $89 APROSAND-4 SLOT CARTRIDGE

J.P. feu PRODUCTS BY MAIL SHIPPINGINCLUDED FORCANADA, USA +15%

BOX #1233, STATIONB WESTON, ONTARIO, MS9L2R9

15 DAY WARRANTY ON REFURBISHED GOODS TAX- Canada +7% GST, Ontario Res. + 8% PST

NOVEMBER 1992 COMPUTE

Q-19

G-20

When your BASIC programs need

a burst of speed, give them a

shot of machine language.

BEGINNER BASIC

Larry Cotton

ADDING ZIP TO BASIC

| get lots of requests for pro- gramming tips on ways to use BASIC with many applica- tions, ranging from games to databases. A typical question might be, “How do | write a fast subroutine for doing searches for a given name and address in BASIC?" Anoth- er might be, “How do | make the aliens move faster while monitoring the joystick port, keeping score, and moving background scenery?”

The answer to these ques- tions is simple: If you want to do it fast, forget BASIC. Any program can be written in BA- SIC (assuming it will fit the com- puter’s memory), but you might drop off to sleep waiting for something to happen.

Many articles have been writ- ten on maximizing BASIC's speed, and you can get some improvement using these tech- niques. However, none but the shortest, most elementary database programs should be written in BASIC. Any program that is more sophisticated is best written in some other pro- gramming language—prefer- ably machine language (ML). To learn more about those pro- gramming techniques, consult Jim Butterfield’s “Machine Lan- guage” column elsewhere in Gazette.

As for games, some can eas- ily be written in pure BASIC, es- pecially those that don't re- quire blinding speed. Some examples would be word- search, spelling, math-drill, and even simulated board games. These types of games don’t require much speed, and the user wouldn't notice if the computer slowed a little dur- ing execution.

Actually, BASIC and ML can be used together. One way is to use a BASIC pro- gram as an ML loader. Then a

COMPUTE NOVEMBER 1992

SYS command puts you into machine language to stay.

The other way is to incorpo- rate a speedy routine within a relatively slow BASIC pro- gram. Here’s an example of the latter.

Suppose you're writing a pick-a-card-any-card game. You need to shuffle a deck of 52 cards quickly. By generat- ing a nonrepeating list of 52 numbers, you could assign the numbers to an array of all the cards. The following pro- gram is one way to generate those numbers in BASIC.

BASIC RND

10 PRINT{CLRXDOWN}PRESS ANY KEY TO RANDOMIZE 52 NUMBERS

20 PRINT{DOWN} WITH OUT REPEATS.

30 GETAS:IFAS=" "THEN 30

40 PRINTCHRS(147)

50 Q=RND(-TI/101)

60 C=52:DIMRN(C)

70 FORX=1TOC

80 RN(X)=INT (C*RND(1))+1

90 FORT=XTO1STEP-1: IFRN(X)=RN(T-1) THEN8O

400 NEXT

110 PRINTRN(X),

120 NEXT

130 PRINT{DOWN) I’M SURE

YOU DON'T WANT A REPEAT!

Now, let's try doing the same thing using machine lan- gage. (Don't worry, Jim Butter- field. Your column is safe!)

ML RND

10 Q=RND(-TI/01): PRINTCHRS(147)

20 FORT=49152T049221: READD:POKET,D: NEXT

30 POKES4286,255: POKES4287,255: POKE54290, 128: REM SET UP VOICE 3

40 CB=49480

50 A=52:REM RANDOMIZES FROM 1 TO A WITHOUT REPEATS; MAX. VALUE OF A IS 255.

60 POKE49222,A

70 PRINT“{DOWN} PRESS ANY KEY TO RANDOM- IZE”A“NUMBERS

80 PRINT“{DOWN} WITH OUT

REPEATS.

90 GETAS:IFA$=""THENSO

100 PRINTCHR$(147): SYS49152

110 FORT=CB+1TOCB+A:

PRINT(PEEK(T)),: NEXT 120 PRINT:PRINT:PRINT “AGAIN? (Y=YES, N=NO)

130 GETAS: IFA$<>"Y” THENIFA

$<> “N"THEN130 140 IFAS="N”"THENEND 150 GOTO100 1000 DATA 172,70,192, 69,0,153, 72,193,136,208,250, 173, 70,192,170,160, 0,153,72

1010 DATA 192,200,240, 11,202, 138,208,246,173,70, 192, 170,76,17,192,173,70,192, 141

1020 DATA 71,192,173,27,212, 170,189,72,192,172,70, 192,217,72,193,240,241, 136,208

1030 DATA 248,172,71,192,153, 72,193,206,71,192,208, 227,96

Run both programs and ob- serve the difference in how long it takes to generate 52 nonrepeating numbers, Allow plenty of time in the BASIC ver- sion, especially for the last sev- eral numbers.

To use embedded ML sub- routines in a BASIC program, just SYS to the routine (see line 100 in ML RND). After the numbers are generated, they appear in memory registers 49481 through 49532 (for 52 numbers).

Here's an invitation to you programmers. I'd like to see your own versions of both BA- SIC and ML no-repeat random- izing programs. Please send them to me in care of COM- PUTE’s Gazette, 324 West Wendover Avenue, Suite 200, Greensboro, North Carolina 27408. If you keep them small enough to print on one page of the magazine, I'll pub- lish the best examples in a fu- ture column. a

D'IVERSIONS

Fred D'lgnazio

CAPTAIN FUTURE AND HIS POCKET COMMANDER

Hello. This is Captain Future. People used to call me Fred, but that's when | was station- ary, physical, and sitting in a real chair in a real office with real wires tying me to one spot. Now I’m Captain Future, I'm mobile. I'm cordless. I'm wire- less. I'm on the go. Where | call you from one minute is not where I'll be the next. You may be there (where you really are), but I'm only here in a met- aphorical sense. I'm totally vir- tual. | beam you up from my lit- tle pocket phone somewhere on the planet. You beam me up, and | might be on a rock cliff or in my minivan or under a giant sequoia.

The revolution in my person- al communications style oc- curred two months ago when | began renting my little Fujit- su. Pocket Commander phone. The phone weighs just a few ounces; it's about five inches long and two inches deep. | wear it in a little case on my belt.

When I'm wearing my Pock- et Commander, | feel like a new man. With that little phone strapped to my side, | pretend I’m James Bond with his shoulder holster, But in- stead of a warlike secret agent, I’m a peaceful agent, armed for the future, ready to communicate with the world.

As soon as the Fujitsu lady checked me out on my new phone, | placed my very first call to my wife. | found her in an unlikely spot: the kitchen. She picked up the kitchen phone and said, “Hello?”

“Hello, dear,” | said. “It's Captain Future, your husband.”

“Where are you?” asked my wife, not at all impressed with my new secret identity.

“Right outside the kitchen

door, dear," | answered proud- ly. “About five feet away from you, in the driveway.”

Next | called my mom. “Hel- lo, Mom,” | said. “It's your son, Captain Future.”

“Whois this really?" my moth- er asked suspiciously.

“Aw, Mom," | said. “I'm call- ing you with no wires. No ca- bles. Just thin air. And we're talking just like on a real phone. Isn't it grand?"

“I don't know any Captain Fu- ture,” my mother said. “And whoever this is, you sound like you're calling me from in- side a fish tank or a tin can. Please go away.” Clink!

After calling my mom, | called everyone else | could think of. | called people from restaurants, bowling alleys, baseball diamonds, petting zoos, and public marinas.

Suddenly, | realized that | had become an addictive com- municator. | first realized this after | installed the Fujitsu Pock- et Commander in a cellular dock inside my minivan. Now | had a boosted power source, acellular antenna cork- screwing up the side of my car, and an in-car speaker phone with a tiny mike clipped to the sun visor over the driver's seat. After | ran out of other people to call on my car phone, | began calling my wife again.

“Hello, dear!”

“Is that you, Fred?" my wife asked, from inside the house. “Where are you now?"

“Outside in the driveway, in Our Car.”

“If you're already home, why don't you come inside and talk, like a real person?”

“Because it's more fun to call you from the car. It's kind of like an intercom. Besides, I've got my laptop computer out here, and I'm trying to plug it into the car phone so | can call online bulletin boards and maybe even send faxes.”

“Why would you want to

send faxes from your car?" my wife asked. “Especially when you're parked in our drive- way?”

Since then, my wife has slow- ly warmed to pocket phones. For example, last week she and | were trekking around a rock quarry on the seacoast north of Boston. There wasn't another person for miles around. Nature was in bloom all around us. Suddenly, my wife reached for my belt.

“Dear!" | screamed, jump- ing backward. “What's got in- to you?”

“Your phone," she said. “I want your phone. | just remem- bered | have to call my office.”

While my wife sat on the quarry’s edge talking with her boss and her secretary, | be- gan climbing down the verti- cal wall of the quarry. After about 15 minutes, | made it down to the level of the water that filled the quarry's inner ba- sin. | took off my shoes and dangled my bare toes in the wa- ter, scaring away a couple of polliwogs that were sunning themselves on a big boulder just beneath the surface. | lis- tened to my wife as she talked on the cellular phone, her voice crystal clear high above.

“This is weird,” | thought. Somehow, my wife's phone call to her office didn’t seem out of place even here, deep in the heart of undisturbed na- ture. In addition, the call didn't stress me out or make me lose my sense of awe and appreciation for my surround- ings. Somehow, everything seemed to fit in.

It'll be amazing to see how this revolution changes the fu- ture face of work and leisure. Maybe in the future it'll be nor- mal to conduct business on a rock cliff while on a daylong trek into a remote granite quar- ry. As | gazed out at the deep blue quarry lake all around me, | thought that might be kind of nice. a

NOVEMBER 1992 COMPUTE

In this exciting episode, read how a mild-mannered magazine columnist is transformed into Captain Future.

G-21

Now that the holiday

season is fast

approaching, here’s

the GEOS system

I'd really like to find

G-22

under the tree.

GEOS

Steve Vander Ark

ULTIMATE GEOS

In an IBM magazine recently, a senior editor describes his quest for the ultimate PC. The cost of this system would buy a pretty nice sports car.

That started me thinking about the ultimate GEOS set- up. | wondered just how pow- erful GEOS could be with all the right gizmos hooked up to it. And, since Christmas is just about once again to take over prime time and the malls, | fig- ure this is a great time to make yet another GEOS wish list. While the total wouldn't buy a snazzy sports car, it might be enough to buy, oh, a used Ford Escort.

My dream GEOS setup has to start with a computer, of course. I'll go with the 128, since an 80-column screen is essential. Now, the 128D does have a detachable key- board, which is nice, and an extra 64K of video RAM, but | don't like the idea of having that darn 1571 permanently set up as drive 8. | have much better ideas for disk drives, so I'll stick with the flat 128.

One advantage to the Com- modore computer is that you don't have to spend heaps of money on extra cards to do things like create color screen displays. Our 128 has 40-col- umn and 80-column modes built right in; all we need to do is to choose a monitor which can display either mode on command. Since nothing but the best will do for our ultimate setup, I'll add a Commodore 1084S monitor.

Mode switching can be- come a constant chore when you work with GEOS on the 128; many programs, from lit- tle utilities like Blue Pencil to big utilities like geoPublish, run fine on the 128 but de- mand 40 columns. To make life a little easier, I'll add a 13- inch 40-column monitor on the side. You'd be surprised how

COMPUTE NOVEMBER 1992

handy this configuration can be. When you switch to 40- column mode, the image jumps from one monitor to the other, and the screen of the un- used monitor goes peacefully blank. If you can't afford a sec- ond monitor, a color TV works about as well. I'm going for broke here, though, so I'll pick up an 1802 monitor.

One or two more details are needed before we tackle the big question of drives and RAM expansion. We must, for example, have an input de- vice. Speaking from experi- ence, having used a joystick, mouse, KoalaPad, and light pen with an assortment of driv- ers, | strongly recommend a mouse. Speaking from the ex- perience of friends, the mouse of choice is the Com- modore 1351.

OK, let's talk disk drives. It would be nice to include drives to handle both 5%- inch and 3¥%-inch disks, For the 5%-inch disks, the best bet is the good old 1571, which can read single- or dou- ble-sided floppies. That's pret- ty much standard stuff.

Let's take a leap into the big leagues for the 3%%-inch drive. We have a couple of very impressive choices, now that Creative Micro Designs (CMD) has released a pair of high-density drives; the FD- 2000, with 1.6 megs per disk, and the FD-4000, with a whop- ping 3.2 megs of data on a flop- py! We're talking dream mate- rial here, folks! The ultimate GEOS system has to have an FD-4000.

That accounts for two of the drives. GEOS can effectively handle only three drives, so this next choice might be a lit- tle sticky. Some form of RAM expansion is a must with GEOS, but if it’s configured as a RAM drive, there goes the third drive. It's hard to imagine an ultimate system, however, without a hard drive. For now,

anyway, I'll just choose both.

The hard drive of choice will be one of the CMD HD- series drives, which are com- patible with GEOS and practi- cally everything else. Since money's no object, I'll take the HD-200 with 200MB capacity.

| do need RAM expansion as well, so let's take a look at the options. The Commodore 1751 RAM expansion unit can be upgraded to larger capac- ities than the stock 512K, but it's still a pretty bland unit. A much more exciting choice would be either the RAMLink or RAMDrive from CMD. Each has two invaluable features no RAM expansion device should be without: a separate power supply, which keeps the data intact when you shut down your system, and a bat- tery backup, which means that in the event of a power fail- ure, your data won't evaporate like spit on a hot skillet. Both are fine units. RAMLink can be upgraded to 16 megs, while RAMDrive is limited to 8 megs. RAMLink also can be fit- ted out with a realtime clock cir- cuit to set your clock in GEOS, and it also features a pass-through port that | just might need before this system is completed. I'll add RAM- Link, maxed out to 16 megs.

I'll have to decide how to configure all those drives when | pick a desktop pro- gram, but I'll do that next month when | talk about soft- ware. For now, let's recap my shopping list.

128 CPU (used) $ 200.00 1084S monitor $ 289.00 1802 monitor (recondi- $ 99.95 tioned)

1351 mouse $ 32,95 1571 disk drive $ 100.00 (used)

FD-4000 disk drive $ 300.00 HD-200 hard drive $ 1,099.95 RAMLink with battery $ 584.90 and 16MB RAM

TOTAL $2,706.75 0

NEW PRODUCTS From Makers of RAMDRIVE

Battery Back-up Ram Disk for GEOS 2.0 and GEOS 128, 2.0

Magnitudes faster than any floppy or

hard drive

2 MEG model has capacity of TEN 1541’s Includes GEOS application to select one of up to five 1571's

Supplied with wall mount power supply and battery cable and holder

Automatically detects power out and switches to back-up mode

Activity light indicates access

Battery used only when wall mount AC power supply off

INTRODUCTORY PRICE

BBG RAM

Reboots GEOS from BBG Ram quickly and quietly

BBU

Battery Back-up Interface

Module for Commodore

17xx REU’s and Berkley Softworks’ GEORAM 512

Reset button without data loss

Activity indicator light during access

Battery low voltage indicator

Wall-mounted power supply and battery holder and cable supplied

GEOS compatible, allows reboot to GEOS Automatic battery back-up, no switches to push Battery powers unit only when AC power off

BBU supplies power to 17xx REU’s and GEORAM. Commodore heavy power supply not required

INTRODUCTORY 00 PRICE S49

Call: 1-800-925-9774

° ° ° °

MODEL 512 1 MEG 2 MEG > Imostercard $799 $410° $439 GEOS registered Trademark of Berkley Softworks, Inc. aus [el Please Add: eo PERFORMANCE 5 Upper Loudon Road U.S. $6.00 S&H a Pe ESReiiPe ASE RAS fSiinc Loudonville, New York 12211 Canada $10.00 S&H $4.00 C.O.D.

Circle Reader Service Number 153

COMPUTE’s

SpeedScript Disk

A powerful word processing package for Commodore 64 and 128 owners

A Great Deal for Commodore Users!

° SpeedScript for the 64

° SpeedScript 128—80-column version * Spelling checkers

¢ Mail merge

° Date-and-time stamp

* 80-column preview for the 64

* Turbo save and load

¢ Plus more than a dozen other SpeedScript support utilities all on one disk (including full documentation)

YES! Send me _______ copies of COMPUTE's | SpeedScript Disk.

I've enclosed $11.95 plus $2.00 postage and handling. (Outside | U.S. and Canada add $1.00 for surface mail or $3.00 for | airmail.)

| ORDER NOW! |

Amount Sales Tax*

Total Name Address

City State

Mail personal check or money order to Commodore SpeedScript Disk 324 W. Wendover Ave., Ste. 200 Greensboro, NC 27408

| Residents of North Carolina and New York, add appropriate tax for your area. Canadian orders, add 7 good and services tax

Please allow 4-6 weeks for delivery. Program available only on 54-inch disks.

Readers take over

this month’s column

G-24

with a collection handy tips for the 64 and 128.

PROGRAMMER’S PAGE

Randy Thompson

READER’S GRAB BAG

From the mailbox to the print- er, this grab bag of program- ming gems comes from you, our readers. Keep 'em com- ing. We pay up to $50 for each tip we publish.

64 or 128? There's an easy way for your BASIC program to detect which 8-bit Commodore com- puter it’s running on. Simply check the variable DS$ in the first line of your program. If DS$ is equal to a null string (DS$="""), your program is running on a 64 or on a 128 operating in 64 mode. That's because in 128 mode, the DS$§ string returns the current status of the disk drive, where- as on a 64, DS$ doesn't hold anything until you define it. Incidentally, checking DS$ on a 128 that has no drive at- tached can crash your pro- gram, but how many driveless 128 owners do you know?)

ARTHUR MOORE ORLANDO, FL

Redefining Restore

This two-line program turns your Restore key into a com- puter reset button. After you type in and run the program, tapping (sharply, of course) the Restore key will yield the same results as the BASIC command SYS 64738.

10 FOR 1=32768 TO 32776: READD: POKEI,D: NEXT

20 DATA 248,252,226,252,195, 194,205,56,48

To disable your new reset key, turn the computer off and then on again.

Here’s how the program works. Whenever you press the Restore key, the comput- er checks memory locations 32772-32776 for the numbers 195, 194, 205, 56, and 48.

COMPUTE NOVEMBER 1992

These numbers are the PET- SCIl codes for the reversed capital letters CBM followed by the number 80. If that string is found, the computer jumps to the machine lan- guage subroutine pointed to by memory locations 32770 and 32771. The program list- ed above redirects this vector to point to the 64’s reset rou- tine found at 64738. Things get a bit tricky here, because the reset routine at 64738 al- so looks at memory locations 32772-32776 for the string CBMBDO. If it finds those char- acters, it jumps to the subrou- tine pointed to by the vector at 32768. To avoid such jumpy behavior, our Restore- reset routine sets this vector so that it points right back in- to the 64's reset routine, forc- ing the computer to continue the reset operation from where it left off.

One of the neat features of this program is that you can set the vector found at 32770 so that it points to your own machine language program— one that will execute every time you press Resiore. In the program above, this vector is set equal to the third and fourth numbers found in the DATA statement on line 20.

Note that this program dis- rupts the normal operation of the Run/Stop-Restore key combination. Now, pressing Run/Stop-Restore resets the computer, also, but it clears any program that may have been in memory.

LANCE SLOAN SWARTZ CREEK, MI

Convenient Comma Key

This hack is for 128 owners who enter a lot of data via their numeric keypads. It trans- forms the keypad’s Enter key into a comma key. Such a set- up is ideal for people who type in a lot of MLX listings.

10 FOR I=0 TO 28: READ D:

POKE 4864+1,D:C=C+D: NEXT

20 IF C<>3231 THEN PRINT “ERROR IN DATA STATE MENTS”: END

30 BANK 15: SYS 4864: PRINT “NUMERIC COMMA KEY ACTIVE”

40 PRINT “TO DISABLE: POKE 830,128:POKE 831,250”

50 PRINT “TO REACTIVATE: BANK 15:SYS 4864”

60 DATA 160,0,185,128,250, 153,29,19

70 DATA 200,192,89,208,245, 169,19,141

80 DATA 63,3,169,29,141, 62,3,169

90 DATA 44,141,105,19,96

EMIL HEYROVSKY PRAGUE, CZECHOSLOVAKIA

ReDIMing Arrays

If you ever want to erase and/ or redimension (DIM) your var- iable arrays, execute the fol- lowing two commands from within your program.

POKE 49,PEEK(47): POKE 50,PEEK(48)

This will erase all arrays. Un- like the CLR command, how- ever, these POKEs will not af- fect nonarray variables.

HELEN ROTH LOS ANGELES, CA

Monitoring 64 Code on the 128

The most popular area for pro- grammers to store machine language programs on the 64 is in the 4K area starting at 49152 ($CO00). Of course, this area is relatively useless on the 128 because 49152 is where editor ROM is mapped, but that doesn’t mean you'd never want to load your 64 code here. Be- cause RAM underlies 128 ed- itor ROM, 64 machine code can be stored here and worked on using the 128's built-in machine language monitor.

YANNICK TROTTIER BRIDGETOWN, NS CANADA a

PROGRAMS

MOB MASTER

By Hong Pham

Sprites (or movable object blocks) are large user-defined graphics that can be placed anywhere on your monitor's screen. The 128 has a powerful sprite con- troller that is built into its BASIC operating system to make sprite programming fair- ly easy. The 64, which has the same sprite capabilities as the 128, lacks the 128's sprite controller system. Program- ming sprites on a 64 usually requires many lines of code filled with awkward POKEs—but now there’s MOB Master.

MOB Master gives the 64 many of the same features and sprite commands that are found on a 128. It also has ex- tras, such as sprite animation and bound- ary-handling commands.

While this article explains how to use MOB Master’s commands, it doesn't pro- vide a complete tutorial for creating and using sprites. Programmers who already use sprites should have no trouble using MOB Master. Beginners can find more de- tailed descriptions of sprites and video banking in such reference books as Com- modore 64 Programmer's Reference Guide or Mapping the Commodore 64.

Getting Started

MOB Master is written entirely in ma- chine language. Use MLX, our ma- chine language entry program, to type it in. If you don’t have a copy of MLX, see “Typing Aids” elsewhere in this sec- tion. When MLX prompts, respond with the following values.

Starting address: 7D00 Ending address: 86EF

When you've finished typing in MOB Master, be sure to save it before exit- ing MLX.

To activate MOB Master, load it with the ,8,1 extension and then type SYS 32000. At this point you'll see a ti- tle screen that lets you know MOB Mas- ter has been activated. You may now begin writing your own sprite program. Instead of using cumbersome POKEs to control your sprites, however, you'll have a whole new library of commands at your disposal.

Ten Sprite Commands MOB Master adds ten new BASIC com-

mands for easier sprite definition, posi- tioning, movement, animation, and oth- er miscellaneous functions. The first three commands are similar to the 128's sprite commands of the same name.

Here's an important programming note to remember: When using a MOB Master command within a BASIC pro- gram, you must precede that com- mand with a slash (/). In immediate mode, however, you don’t need to use the slash.

SPRITE #, on/off, fgnd, priority, x-exp, y- exp, mode

The SPRITE command defines most of the characteristics of a sprite. Select the sprite number (#) with a value rang- ing from 0 to 7.

Use a 1 in the on/off parameter to turn on your sprite; use a O to turn it off.

The sprite foreground (fgnd) color is defined with a value between 0 and 16.

To make the sprite appear in front of Objects on the screen, set its priority parameter to 0. To make it appear be- hind the objects on the screen, set the parameter to 1.

The sprite can expand to twice its original size horizontally (x-exp) or ver- tically (y-exp) by setting the next two parameters to 1. Set these parameters to O to turn off sprite expansion.

Turn on multicolor mode with a 1 or turn it off with a 0.

MOVSPR #, x, y

MOVSPR either positions or moves the sprite. The first example plots the sprite anywhere on the screen, with x being any pixel number between 0 and 319 and y any number between 0 and 199. Unlike normal sprite program- ming, MOB Master lets you place sprites beyond the 255th pixel without additional programming.

MOVSPR #, direction # speed

This variation moves the sprite in a spe- cific direction and speed. The direction value can range from 0 to 255. This val- ue can be converted to degrees by mul- tiplying it by 45/32. To move the sprite up, use a value of 0. To move it to the

right, use a value of 64. To move down, use 128. To move left, use 192. Intermediate values will move the sprite at different angles across the screen.

The value for speed can range from 0 to 255, with 0 being fastest and 254 being slowest. A value of 255 means that the sprite is stationary.

The format for this command is sim- ilar to that used for positioning a sprite, but instead of using a comma to separate the values, use the # sign. For example, MOVSPR 0, 64 # 100 would move sprite 0 to the right at a fair- ly slow speed.

SPRCOLOR color 1, color 2

In multicolor mode, the two multicolor colors are shared among all eight sprites. The first parameter defines mul- ticolor 0, and the second parameter de- fines multicolor 1.

ANIMATE #, speed, mode, start frame, end frame

ANIMATE defines a sprite image or ani- mates the sprite by successively chang- ing its image pointers. The animation speed can range from 0 to 255, with 0 being fastest and 254 being slowest. A value of 255 means that the sprite has no animation. The mode parameter tells MOB Master how the sprite will be animated. A value of 0 means that the sprite will always be animated, and a 1 means that the sprite will be animated just once. Any other,value will stop the sprite from being animated.

Sprite data resides in blocks of 64 bytes each. These blocks are num- bered from 0-255. To calculate the lo- cation of a block of sprite data in mem- ory, multiply the block number by 64. The result gives you the location where the first byte of a sprite definition should be poked. If you define several sprites whose shapes differ slightly and then switch rapidly among these blocks with the ANIMATE command, the sprite will appear to move in an an- imated fashion.

The start frame parameter indicates the first sprite image or block for anima- tion. The end frame parameter indi- cates the ending block number for the animated sequence. Any sprite

NOVEMBER 1992 COMPUTE G-25

PROGRAMS

frames that are in between these will be automatically called.

BOUNDARY #, mode, top, bottom, left, right

Each sprite has its own individual screen boundaries. Once the sprite reaches a boundary that you set with a pixel number, the mode parameter in- dicates the action that the sprite will take. AO means that the sprite will wrap around and be placed on the op- posite boundary. A 1 indicates that the sprite will bounce off the boundary. A 2 indicates that the sprite will stop at the boundary. Any other value indi- cates that the sprite will be turned off when it reaches a boundary, discon- tinuing motion.

For convenience, MOB Master al- lows only the horizontal boundary to be accurate to within two pixels. The actu- al boundary occurs on every even pix- el. MOB Master will automatically di- vide the value that you have supplied with the boundary parameter by 2.

BOUNCE #, mode

BOUNCE bounces a sprite in a certain way, even if it's not at its boundary. Mode indicates how the sprite will bounce. A 0 argument means that the sprite will bounce vertically; a 1 indi- cates that the sprite will bounce later- ally. Any other value will reverse the sprite's direction.

SPLIT mode

MOB Master supports two different ras- ter-interrupt routines for flicker-free sprites. It accomplishes this task by up- dating its shadow registers when the raster scan is at a certain position on the screen. To select one of the two ras- ter-interrupt routines, set mode to ei- ther 0 or 1. The only difference is that the latter routine allows you to display sprites on the top and bottom borders. If no argument follows SPLIT, it will turn off the raster-interrupt routine.

Before attempting an input or output operation, especially with a disk drive, it's best that you turn off the raster- interrupt routine. If you don't turn off the routine, the computer may freeze un- til you hit the Run/Stop and Restore keys simultaneously.

G-26 COMPUTE NOVEMBER 1992

IRQ enableflisable When you move multiple sprites as if they were one sprite, one sprite may move ahead of the others, creating a gap. This is because MOB Master up- dates the sprites 60 times a second, and BASIC may be too slow to move all the sprites before MOB Master up- dates them. One sprite may be updat- ed before BASIC updates the others. To temporarily stop MOB Master from updating the sprites, use IRQ 0. Any other value will allow MOB Master to continue updating the sprites. Be careful not to hold the system for too long, or the computer may hang up.

ZAP ZAP clears all the sprite registers. KILL

KILL disables MOB Master and re- stores the previous interrupt and BA- SIC vectors.

Additional Notes

For all MOB Master statements, with the exception of IRQ, you can substi- tute an unknown parameter with an as- terisk (*). You can also use the asterisk if you don't want to make any changes to the current parameter. You don't have to supply all of the parameters of the command, but you must denote the sprite number. You cannot substi- tute an asterisk for the sprite number.

Collision Detection

Sprite-to-sprite or sprite-to-background collisions can be monitored by using the USR command. To return the stat- us of the last sprite-to-sprite collision, type in PRINT USR(Q). Likewise, to re- turn the status of the last sprite-to-back- ground status, type PRINT USA(1).

Shadow Registers

MOB Master updates its shadow regis- ters to the VIC-Il during a raster inter- rupt, or once every '/é0 of a second, to avoid sprite flickers. An advantage of this setup is that the sprites continue to move while your program does some- thing else. You shouldn't make a direct POKE to the VIC-II registers to define a sprite, because once a raster inter-

rupt occurs, MOB Master overwrites the VIC-II register with the contents of the shadow register. Therefore, poke to the shadow register instead. Below is the memory map of the shadow regis- ter and its VIC-II equivalent.

VIC-Il Equivalent Description

Loca- Shadow

tion Register

(Base + offset)

$DO00 Base + 1312 Sprite 0 x po-

(53248) sition

$D001 Base +1320 Sprite 0 ypo-

(53249) sition

$D010 Base + 1328 Most signifi-

(53264) cant bits of sprites 0-7 horizontal po- sitions

$D015 Base +1329 Sprite ena-

(53269) ble register

$D017 Base +1330 Sprite Y-Ex-

(53271) pand regis- ter

$D01D Base + 1331 = Sprite X-Ex-

(53277) pand regis- ter

$D01B Base + 1332 Sprite-to-fore-

(53275) ground prior- ity register

$D01C Base + 1333 Sprite multi-

(53276) color mode register

$D025 Base +1334 Sprite multi-

(53285) color regis- ter 0

$D026 Base +1335 Sprite multi-

(53286) color regis- ter 1

$D027 Base +1336 Sprite 0 col-

(53287) or register

$07F8 Base +1344 Sprite shape

(2040) data point- ers. The actu- al location of this register depends on the location of the video matrix.

The default base is $7D00 (32000).

MOB Master and Machine Language

MOB Master's sprite-handling ability is not restricted to BASIC programs. Ma- chine language programmers will find

MOB Master useful, as well. In fact, MOB Master and machine language are a great combination because you can do much more with machine lan- guage than you can with BASIC.

To make access to MOB Master's subroutines easier, MOB Master has a jump table. For all of MOB Master's sub- routines, enter it with a JSR instruction, and use the X register to denote the sprite number. The following is the mem- ory layout of the jump table.

Location

(Base + offset) Base

Base + 3 Base + 6 Base + 9 Base + 12

Base + 15

Base + 18

Base + 21

Base + 24

Base + 27

Base + 30 Base + 33 Base + 36

Base + 39

Base + 42

Description

Enable MOB Master's BASIC interface. Enable raster-interrupt routine 1.

Enable raster-interrupt routine 2.

Disable raster-inter- rupt routine.

Zap all sprite regis- ters.

Turn sprite on or off; C flag set = sprite is on.

Position sprite at x, y. AC = LSB of x posi- tion; C flag = MSB of X position; YR = y po- sition.

Set sprite color; put sprite color in AC.

Set sprite multicolor mode characteristics. C flag set = multicolor mode on. AC = multi- color 0; YR = multicol- or 1.

Set sprite to back- ground priority; C flag set = background has priority.

Set Y-expand; C flag set = expand sprite vertically.

Set X-expand; C flag set = expand sprite horizontally.

Set sprite speed; AC = sprite speed.

Set boundary action mode (similar to BA- SIC BOUNDARY state- ment).

Set sprite direction;

AC = sprite direction. Set animation speed and mode, AC = ani- mation speed; YR = mode.

Set animation start and end image point- ers, AC = start image location; YR = end im- age location.

Set top and bottom borders. AC = top bor- der; YR = bottom bor- der.

Set left and right bor- ders. AC = left bor- der; YR = right bor- der, Note: Divide bor- der value by 2, Bounce sprite vertical- ly.

Bounce sprite lateral- ly.

Reverse sprite direc- tion,

Base + 45

Base + 48

Base + 51

Base + 54

Base + 57 Base + 60 Base + 63

Note: C flag = Carry flag, AC = Accu- mulator, XR = X register, YR = Y reg- ister

If you're using MOB Master exclu- sively in machine language, you may delete the BASIC interface module start- ing at location $82CC (33484) or (base) + 1484 to $86EA 34538 or (base) + 2538.

MOB MASTER

7D60:4C CC 82 4C 7A 7D 4C 81 4D 7D68:7D 4C 88 7D 4C Al 7D 4C ED 7D1@:AB 81 4C 94 81 4C BC 81 4C 7D18:4C C2 81 4C D9 81 4C EA 37 7D206:81 4C FB 81 4C 60 81 4C B9 7D28:86 81 4C 69 81 4C 6D 81 7D 7D36:4C 75 81 4C 84 81 4C 8C F2 7D38:81 4C 12 81 4C 1F 81 4C 8F 7D4G:29 81 78 CD 14 63 D@ G5 6F 7D48:EC 15 93 F@ GE 48 AD 14 6F 7D50:03 8D DA 7D AD 15 G3 8D B8 7D58:DB 7D 68 8D 14 63 8E 15 65 7D66:03 A9 7F 8D OD DC AY 81 CO 7D68:8D 1A D@ AD 11 DG 29 7F 43 7D76:8D 11 D@ AD 1E DG AD 1F 1A 7D78:D@ 6@ AJ B9 A2 7D 4C 42 AA 7D80:7D A9 DC A2 7D 4C 42 7D 89 7D88:78 A9 81 8D GD DC AY BH 62 7D90:8D 1A D@ AD DA 7D 8D 14 C9 7D98:03 AD DB 7D 8D 15 03 58 F2 7DAG:66 A2 88 AOI BB 9D 26 82 58 7DA8:CA 10 FA A2 67 AQ FF 9D 13 7DBG:48 82 9D 78 82 CA 16 F7 63 7DB8:6@ AD 19 DG 8D 19 DG 29 1B 7DCG:61 FG 16 26 1E 7E AD 11 94 7DC8:DG 29 7F 8D 11 D@ AY FA 59

7DD6:8D 12 D@ 26 BC 7F 20 7DD8:7E 4C 31 EA AD 19 D@ 7DE6:19 DG 29 Gl FG 19 AQ 7DE8:D@ 21 28 1E 7E AD 11 7DF6:29 7F 69 G8 8D 11 DB 7DF8:F9 8D 12 D@ EE E7 7D 7EG6:BC 7F 26 76 7E 68 A8 7EG8:AA 68 46 AD 11 DO 29 7E16:8D 11 D@ AY BG 8D E7 7E18:8D 12 D@ 4C D9 7D A2 7E26:A@ GE BD 26 82 99 GG 7E28:BD 28 82 99 61 D@ BD 7E30:82 9D 27 D@ BD 40 82 7E38:F8 FF 88 88 CA 14 E3 7E40:30 82 8D 16 DO AD 31 7E48:8D 15 AD 32 82 8D 7E50:D@ AD 33 82 8D 1D DB 7E58:34 82 8D 1B D@ AD 35 7E60:8D 1C D@ AD 36 82 8D 7E68:D@ AD 37 82 8D 26 D@ 7E70:A2 07 BD 48 82 C9 FF 7E78:11 C9 40 96 14 BD 50 7E8G0:F@ GF DE 50 82 DG G3 7E88:9D 7E 20 83 7F CA 10 7E96:66 38 BD 48 82 E9 3F 7E98:58 82 4C 87 7E BD 58 7EAG:DD 66 82 FO 69 9D 6B 7EA8:20 2E 7F 9D 68 82 BD 7EBO:82 C9 20 96 21 C9 40 7EB8:26 C9 66 98 2B C9 80 7EC@:38 C9 AB 9B 35 C9 CB 7EC8:3A C9 EG 98 3F 26 45 7ED@:26 15 7F 4C 4E 7F 20 7ED8:7F 26 15 7F 4C 48 7F 7EEG:48 7F 26 15 7F 4C 45 7EE8:20 48 7F 20 15 7F 4C 7JEFO:7F 20 4B 7F 26 15 7F 7EF8:48 7F 20 4B 7F 20 15 7FO6:4C 4E 7F 26 4E 7F 20 7E@8:7F 4C 4B 7F 20 4E 7F 7F16:15 7F 4C 45 7F 26 2E 7F18:18 7D 68 82 C9 26 96 7F26:38 E9 26 9D 68 82 38 7F28:9D 68 82 68 68 66 BD 7F30:82 29 26 68 BD 58 82 7F38:1F 28 FG 08 8D 43 7F 7F40:A9 20 EO FF 60 AG GG 7F48:AG G1 2C AB G2 2C AG 7F56:BD 48 82 C9 40 BO 1E 7F58:A9 41 FD 48 82 26 DO 7F60:98 FG G9 88 FB G9 88 7F68:09 4C 98 86 4C Dl 7F 7F76:49 8G 4C 16 8G BD 48 7F78:38 E9 3F 9D 50 82 AQ 7F86:4C 5D 7F BD 98 82 30 7F88:BD 78 82 C9 FF FO G8 7F90:80 82 FG G4 DE 80 82 7F98:BD 78 82 9D 8@ 82 BD 7FAG:82 DD 98 82 FO O64 FE 7FA8:82 60 BD 98 82 FO G6 7EBO:FF 9D 98 82 64 BD 88 7FB8:9D 4G 82 68 AD 9@ DD 7FCO:93 AA AD 18 DG 29 FO 7FC8:4A 18 7D 1C 82 8D 39 7FDG:60 BD 28 82 DD AG 82 7FD8: 33 7FEG:1E 88 F@ GF AD 31 82 7FE8:14 82 8D 31 82 AQ FF 7EFG:48 82 68 BD AG 82 9D 7FF8:82 A9 FF 9D 48 82 69

NOVEMBER 1992 COMPUTE

G-27

PROGRAMS

8600:12 8008:9D 8010:E9 8618:82 8620:81 8628:03 8030:F6 80638:BD 8640:BD 8048:68 8058:55 8058:81 8060:03 8068:82 8070:CB 8078:26 8080:82 8088:AD 8090:90 8698:20 80A0:81 8GA8:FO 80BG:4C 80B8: 86 80CG:AD 80C8:BG 80D0:8D 80D8:80 80EG:3D 80E8:A9 80F0:8D 8O0F8:26 8100:8D 81068:AD 8110:82 8118:18 8120:06 8128:60 8130:82 8138:03 8146:82 8148:82 8150:C9 8158:4C 8160:9D 8168: 68 8176:98 8178:9D 8186:9D 8188:9D 8196:9D 8198:03 81A0:82 81A8:28 81B0:1D 81B8:8D 81C0:82 81C8:82 81D6:82 81D8:60 81EG:82 81E8:82 81FG:6C 81F8:32 8206:1D 8268:8D 8216:16 8218:EF 8226:00 8228:06

G-28

3F 66 28 82 88 TE 12 9D 69 86 G2 88 TE 82 cg 4c 81 69 cg BD 96 FO 20 82 EQ cg 8D 8G Da cg 6G 38 AD 1D AQ 9D 58 82 OA 2c AD 81 FF BD Ag 82 82 98 6G 60 60 2c F4 AD BB 6G AD 1D 36 82 3D 32 03 AD BG 66 86 TE oo Or)

COMPUTE NOVEMBER 1992

8236:06 8238:00 8240:008 8248:FF 8250:00 8258:00 8266:90 8268:00 8276:00 8278:FF 8280:00 8288:00 8296:00 8298:06 82AG:32 82A8:E5 82BG:0C 82B8:AG 82CG0:88 82C8: 06 82DG:Al 82D8:63 82EG:EE 82E8:82 82F0:7D 82F8:A9 8306:3A 8368:AB 831G:AG 8318:3A 832G:A6 8328:C9 8330:3B 8338:20 8340: 26 8348:B7 8350:20 8358:D0 8360: 28 8368:B0 8376: 26 8378:83 8380:86 8388:8D 8390:FO 8398:FF 83AG:AC 83A8:FO 83B@:AD 83B8:83 83CG:FE 83C8:8D 83D0:FO 83D8:90 83EG:A8 83E8:A2 83F0:12 83F8:AE 8400:85 8408:B7 8410:60 8418:06 8420:DA 8428:18 8430:26 8438:26 8440:86 8448:7D 8450:96 8458:DA

Go Oo 1) FF 06 96 UT) oo ao FF oo CT) 66 CT) 32 ES gc AG i) Go 85 8E 82 65 85 gD 86 A2 86 86 3A AD 83 73 86 85 ta F2 AS 2c De 26 8D 83 61 26 Da 12 36 4c 83 E9 26 69 BO RE 7D 43 26 8A 26 20 85 86 G6 1B Bo 26 26 85

Ur) Oo Go FF Ur) Uy) vr) Cl) 06 FF 06 ao oo oo 32 E5 gc AG ao oo Ag 12 85 OF 37 26 AQ 06 26 29 E8 Dd 4c CI) 27 AG 66 26 28 AG FQ ce} 8c 78 58 1F 1lF BD 82 D2 26 83 20 AE @5 20 26 86 ED AE LP gc 26 26 86 7D 06 DA gc 20

6G 06 Us) FF ao Cr) i) 0B 06 FF 06 ts) Ur) Ct) 32 E5 gC Ag GG Go 79 03 OF 98 86 D2 9B 20 1E 38 FO G6 93 AQ AG Cl) DL B7 cD ao 26 cl) 83 26 26 86 20 26 3D 83 E7 26 73 43 26 GF 73 20 85 43 86 86 66 15 BO 26 26 85 86 96

8460:0C 8468:0C 8476:35 8478: 03 8486:AC 8488:AB 8498:FO 8498:B7 84A0:85 84A8:7D 84BG:D0 84B8:CO B4CO:F4 84C8:26 8406: 8E 84D8: 06 84E6:78 84E8:BG 84FG:20 84F8:20 8500:82 8508:06 8510: 26 8518:20 8520:85 8528:86 8530:06 8538:A8 8540:BG 8548:20 8550:20 8558:1F 8566:86 8568:06 8576:3C 8578:66 8580:0F 8588:20 8598:D0 8598:97 85AG: 66 85A8:8E 85BG:85 85B8:FF 85CO:A9 85C8: 66 85D0:66 85D8:7A 85EG:3A 85E8:8A 85FO:7A 85F8:73 8606:C9 8608:E2 8616:8A 8618: 26 8620:F4 8628:66 8636: 46 8638:86 8648:D90 8648:53 8656:54 8658:4C 8660:54 8668:41 8670: 43 8678:06 8680:00 8688:83

8696:85 57 85 89 84 6C 7D 72 41 8698:85 73 84 4D 4F 42 26 4D BB 86AG:41 53 54 45 52 26 26 56 AB 86A8:32 2E 31 36 2F 39 32 36 76 86B0:33 34 39 OD OB GD 4D 4F 79 86B8:42 26 4D 41 53 54 45 52 75 86C0:28 44 49 53 41 42 4c 45 3E 86C8:44 2E OD GO 43 4F 58 59 76 86D0:52 49 47 48 54 26 31 39 85 86D8:39 32 26 26 42 59 26 48 15 86E0:4F 4E 47 26 50 48 41 4D 87 86E8:0D 68 GG GG GB BB GB BB 7c

Hong Pham, the author of Pixel Mover (May 1992), lives in Antigonish, Nova Scotia, Canada.

136 COLORS

By David Kwong

As most people know, the 64 is capable of producing 16 different colors. How would you like to increase that number to 136 colors?

You can with 136 Colors. This interest- ing program does it by placing different- ly colored pixels side by side to produce a third color. Since the 64 has 16 built-in colors, it would appear that you could cre- ate 256 colors by combining the 16x 16 color matrix. In reality, you get a total of 136 different hues, since 120 of them would be duplicated.

There are three programs built into the main 136 Colors program. The first pro- gram is an editor that will produce sprites capable of 136 colors. Addition- ally, each sprite character can have up to four colors simultaneously in high res- olution mode, The second program is an interrupt program designed to make pro- gramming in BASIC with 136 Colors a lot easier. The third program is also an inter- rupt program designed to be used with other programs to make 136 Colors avail- able for use.

Typing It In t Since 136 Colors is written entirely in machine language, enter it with MLX, our machine language entry program. See “Typing Aids” elsewhere in this sec- tion. When MLX prompts, respond with the following values.

Starting address: C79C Ending address: CFAB

Be sure to save a copy of the program before exiting MLX.

Program 1

Load the program with the ,8,1 exten- sion, and then type NEW. To activate the first program, type SYS 51200.

The first thing to do is to select a block number, indicated at the upper right corner. A block number is an ad- dress where sprites can be stored. Rec- ommended block numbers are 128- 255 (block numbers range from 0 to 255). To find the actual address where the sprite is stored, multiply the block number by 64.

After you've selected a block num- ber, a cursor appears in a grid that is used to create a sprite. The sprite that the grid represents is located at the up- per right of the screen. The keys used to move the cursor are displayed at the lower right of the screen. Press f1 to be- gin drawing. A menu at the bottom pro- vides other options. One option, NO DR/ER, means that the cursor will nei- ther draw nor erase. This option lets you move the cursor without affecting what's on the screen.

To change colors while in draw mode, press either 1, 2, or 3. To change a sprite into its 136-color shape, either exit or change the block number. The program will then ask you whether or not to change the sprite in- to 136-color mode. /f you elect to do so, the program then will ask you where to store the 136-color sprite.

Each 136-color sprite is composed of two normal sprites, one on top of the other. Sprite 1 is represented by color 1; sprite 2 is represented by color 2. Color 3 is divided between the two sprites. When the two sprites are over- lapped, color 3 is capable of produc- ing a color from the 136-color palette. The two sprites must have the same co- ordinates for them to overlap perfectly.

Program 2

The second program, which is an inter- rupt program, is activated or deactivat- ed by SYS 52600. When activated, you'll see a message onscreen that says 136 BAS ON.

This program provides 16 new sprite registers that will ease the usage of the four high-resolution sprites and 136 colors. There are only four high- resolution sprites, instead of the normal eight, because of the fact that each hi- res sprite requires two normal sprites.

This program defines hi-res sprite 1 as the overlap of sprites O and 1. Hi-res sprite 2 is the overlap of sprites 2 and 3, hi-res sprite 3 is the overlap of sprites 4 and 5, and so on.

The first eight registers from 52882 to 52889 provide the x- and y-coordi- nates of the four high-resolution sprites. The first high-resolution sprite can be moved by using the horizontal register 52882 and the vertical register 52883, much like the system used by the 64 to move the eight normal sprites. Therefore, every two registers provide the horizontal and vertical reg- isters of one hi-res sprite.

The next four registers, 52890 to 52893, provide the colors of each of the four hi-res sprites. The color num- bers range from 1 to 136.

The last four registers, 52894 to 52897, provide the block numbers for the four hi-res sprites.

This interrupt program supposes the block numbers for each hi-res sprite to be next to each other. Keep in mind that one hi-res sprite is composed of two normal sprites. Therefore, when you choose block number 200, the two overlapping sprites will be composed of blocks 200 and 201.

All registers are write-only registers. When you attempt to read them, they will return a 0. When the registers are 0, the interrupt program will not alter any sprites. Therefore, should you poke 52882,0, nothing will happen, meaning that if you originally poked 140, poking a 0 will not move it from lo- cation 140 to location 0.

In order to see the sprites you have produced, you must first set register 53269 to turn on the sprites you desire. Hi-res sprite 1 can be turned on with a POKE 53269, 3. POKE 53269, 12 turns on hi-res sprite 2. POKE 53269, 40 turns on sprite 3, and POKE 53269, 192 turns on sprite 4. To turn on more than one sprite, simply add up the pre- vious values.

Program 3 The third program is activated or deac- tivated by SYS 52900. When activated, you'll see 136C ON printed on the screen. This simple program is de- signed to work with other programs that can make use of the 136 colors. The only register provided is at NOVEMBER 1992 COMPUTE G-29

PROGRAMS

52844. This register is a 136-color reg- ister. By poking colors 1 to 136 into this register, 2 colors will be returned at locations 52898 and 52899. When the 2 colors are placed together, they'll combine to create 1 of the 136 avail- able colors.

Since machine language programs may be too fast for the interrupt to be effective, you must keep track of loca- tion 52844. After execution of the inter- rupt, 0 will be stored in location 52844. If using machine language, you may choose to poke the required color in 52844 and then JSR $CESA (make sure the interrupt is deactivated) to ob- tain the two colors in locations 52898 and 52899.

Technical Notes

This program takes up minimal space from $C79C (51100) to $CFAA (53162). Considering that 136 Colors is composed of three programs, applica- tions that require only one of these three programs may isolate that partic- ular program for usage.

The first program is located from $C79C (51100) to $CD77 (52599), the second program is located from $CD78 (52600) to $CFAA (53162), and the third program is located from $CESA (52826) to $CFAA (53162).

Since different color combinations may produce the same color, there may in fact be less than 136 colors. Fol- lowing is a color chart of the 136 col- ors. The colors are organized from brightest to darkest. (These colors were very difficult to organize. Please excuse some slight mistakes!)

White-Black (1-13) Gray 2 (14-16) Extra Gray (17-23) Brown 1 (24-32) Brown 2 (33-35) Brown 3 (36-38) Brown 4 (39-42) Red (43-51) Orange (52-57) Yellow (58-64) Tan (65-71) Green 1 (72-77) Green 2 (78-81) Green 3 (82-86) Green 4 (87-93) Green 5 (94-95) Cyan (96-102) G-30 COMPUTE NOVEMBER 1992

Blue (103-111) Purple 1 (112-118) Purple 2 (119-123) Purple 3 (124-127) Purple 4 (128-134) Purple 5 (135-136)

Seeing Is Believing The 136 Demo program is designed to show the various colors in action and to provide programmers with addition- al details on how to use 136 Colors. The demonstration consists of a BA- SIC program and machine language sprite data. To avoid typing errors, use The Automatic Proofreader to enter the BASIC portion. Use MLX to enter the sprite data. When MLX prompts, re- spond with the following values.

Starting address: 3200 Ending address: 347F

Before leaving MLX, save the sprites with the filename Sprites. When the demonstration runs, it loads 136 Colors and Sprites and looks for those file- names.

136 COLORS C79C:A2 66 C7A4:FD BD C7AC:91 FD C7B4:E8 15 C7BC:68 8D C7C4:67 49 C7CC:E4 CB C7D4:68 C7DC:65 C7E4:85 C7EC:FB C7F4:26 C7FC:52 C804:Dd C80C:62 C814:8D C81C:A9 C824:16 C82C:8D C834:A9 C83C:B9 C844:E4 C84C:67 C854:CC c8s5c:4c C864:8D C86C:8D C874:A9 C87C: 88 C884:29 C88Cc:Cc8 C894:68 c89c:18 C8A4:CD

AG 68 cB FO 52 67 ag BD 85 FO F8 88 60 OE 80 Da 26 8D

CT) cD ce 63 cD AB 1 21 FB 03 o7 Dg oo 8D 8D AQ D2 27 Ag B8 B5 OF D9 Ag 20 8D Ag CE 8D 65 8D EG 4E 18

C8AC:C8 C8B4:C

C8BC: 96 c8c4:91 c8cCc: 7B C8D4:CD C8DC:CD C8E4:C9 C8EC:4C C8F4:A5 C8FC:11 C9G4:FB c9gc:55 C914:4F C91C:4B C924:4D c92c:31 C934: 33 C93C:86 C944:88 c94C:42 c954:4C C9SC:E8 C964:A7 C96C:6F C974:C8 c97C:C9 C984:8D C98C:CA c994:91 c99C:9C C9A4:EA C9AC:17 C9OB4:FF C9BC: 62 c9C4:CD Cc9CC:6D C9D4:66 C9DC: 4C C9E4:6A C9EC:AE COF4:FB C9FC:31 CAG4: 06 CAGC:16 CA14:A9 CA1C:B8 CA24:6A CA2C:CB CA34:FB CA3C:F3 CA44:3E CA4C:CB CA54:CB CASC:A5 CA64:64 CA6C: 88 CA74:A3 CA7C:29 CA84:CA CA8C: 88 CA94:FB CA9C:FD CAA4:29 CAAC: 4C CAB4:67 CABC:11 CAC4: 66 CACC:CA CAD4:CA

CADC:CA CAE4:86 CAEC: 8C CAF4:CA CAFC:CA CBO4:CA CBOC:85 CB14:9D CB1C:9D CB24:FF CB2C:C9 CB34:E@ CB3C:C9 CB44:4C CB4C:CA CB54:64 CB5C:12 CB64:CB CB6C: 26 CB74:26 CB7C: 4C CB84:EA CB8C: 8D CB94:56 CB9C: GE CBA4:F6 CBAC:FB CBB4:68 CBBC: 86 CBC4:6D CBCC:6D CBD4:CB CBDC: 63 CBE4:A9 CBEC:E0 CBF4:F9 CBFC:CB CC4:31 ccéc:31 cc14:31 CC1C: 23 CC24:33 Cc2c:6C CC34:28 CC3C:29 CC44:63 CC4C: 38 CC54:65 CC5C:33 CC64:33 CC6C: 26 CC74:32 cc7c:19 Cc84:35 CC8C: OF Cc94:38 cc9c:39 CCA4:61 CCAC: 23 CCB4:95 CCBC: G5. ccc4:61 ccce: 61 CCD4:6F CCDC: 66 CCE4:63 CCEC: 3B CCF4:51 CCFC: 91 CDG4:D1

CA CA 4E 8D 4c i) A2 Ag 20 FO FO 96 G4 Ze 9D G2 20 AG AG 88 EA FO OF cD 88 FB 85 E8 7E ag 4c CB cB FO 64 4c 33 33 33 63 32 93 35 @5 32 32 9 36 12 33 13 OB 3A 69 @B 2c G3 oc G3 12 G4 O5 26 12 14 31 96 41 81 D8

CDGC:D8 CD14:DA CD1C:DB CD24:60 CD2C: 28 CD34: 28 CD3C: 88 CD44: 26 CD4C: 66 CD54:06 CD5C:4C CD64:EE CD6C: 8G CD74: 06 CD7C:E3 CD84:D0 CD8C: 43 CD94:A2 CD9C:E8 CDA4: 33 CDAC: 4F CDB4:F@ CDBC:78 cpc4:8D cpcc:CcDd CDD4:F5 CDDC: 42 CDE4: 00 CDEC:10 CDF4:CE CDFC: 48 CEG4:38 CEGC:18 CE14:9D CE1C:61 CE24:29 CE2C:10 CE34:D@ CE3C:6A CE44:68 CE4C:A2 CE54:9D CE5C:8D CE64:A2 CE6C: 60 CE74:C8 CE7C:69 CE84:68 CE8C:A9 CE94:FF CE9C:FF CEA4:AD CEAC:15 CEB4:16 CEBC:8D CEC4:CE CECC:F5 CED4:4F CEDC: 16 CEE4:78 CEEC: 8D CEF4:CE CEFC:F5 CFO4:4F CFOC: 28 CF14:08 CF1C: 66 CF24:76 CF2C: 0B CF34:57

CF3C:48 67 62 31 16 74 55 7B D5 CF44:3E 36 1E 2F 1D 1C 53 79 3F CF4C:1A 61 81 5F 6B 42 27 56 86 CF54:13 16 GF SE 69 GE 72 @7 BB CF5C:88 2D 73 75 71 7E 7D 14 E5 CF64:87 7C 4B 65 4F 54 51 45 5A CF6C:5D 5C 4A 63 5A 6D 28 7F AQ CF74:2A 7A 86 85 64 6C 83 3B 68 CF7C:3D 3F 3C 46 44 4E 11 41 35 CF84:36 38 35 23 22 52 78 21 92 CF8C:1F 37 26 25 58 29 47 2E 84 CF94:1B 19 43 77 18 69 G8 5B 38 CF9C:84 15 66 59 82 65 49 62 37 CFA4:58 6A 88 04 G6 6G GB 6B 5B

136 DEMO

EQ

16

26 36 46

45 58

68 76

80 96

REM COPYRIGHT 1992 ~ COM PUTE PUBLICATIONS INTL L TD ~ ALL RIGHTS RESERVED REM BY DAVID KWONG

REM POKE53281,0:POKE53280,0: POKE53269,0

IFPEEK (52720) =49THEN9G PRINTCHRS (147) "PLEASE WA IT... IFF=OTHENF=1:LOAD"136 CO LORS" ,8,1 IFF=1THENF=2: LOAD" SPRITE s",8,1

SYS5269G PRINTCHR$ (147) : POKE198,0

1086 POKE52882,150:POKE52884

116

126 136

135 136 146 156

166 176 186

196 206 210 220 230

246 258

1 174:POKE52886,198:POKE 52888,1 POKE52883,100:POKE52885 ,100:POKE52887,190:POKE 52889,1 POKE52894, 200: POKE52895 1202:POKE52896, 204 POKE52890,13:POKE52891, 13:POKE52892,13

IFPEEK (52896) <>@THEN135 POKE53269, 255 FORL=13TO1STEP-1 POKE5289@,L:POKE52891,L : POKE52892,L FORW=1T010:NEXTW

NEXTL

PRINT" {HOME} {1@ DOWN} {WHT }";

DIMCL (13,1)

FORL=1T013 READCL (L,@) ,CL(L,1) NEXTL

DATA 1,13,24,32,43,51,5 2,57,58,64,65,71,72,774 82,86,88,93,96,192,163, 111

DATA 112,118,128,134 C=INT (RND(1)*13)+1:D=1

268 LO=CL(C,9) 270 POKE52890,L0:POKE52891,

LO: POKE52892,L0

286 LO=LO+D 285 IFPEEK (198) >@ANDEN=1THE

NPOKE198,6:GOTO499 NOVEMBER 1992 COMPUTE G-31

PROGRAMS

G-32

296 300

316 326 330 340 358 360 376 380 406

416 426

430 44g 450 468 478 480 490 508 510 5208 536

548

556 566 576 588 596 608 616 620

630

646 656 660

678 689

766 716

GOSUB2600 IFLO=CL(C,1)THEND=~1:GO 70274

IFLO<CL(C,@) THEN250 GOTO270

DATA "COLORS*"

DATA "£12"

DATA "BY DAVID KWONG*" DATA "£12345678"

DATA "{BLU}*"

DATA "PRESS ANY KEY TO { SPACE }CONTINUE<" POKE53269,9

PRINTCHR$ (147) POKE52882,6:POKE52883,7 5: POKE52894, 206: POKES28 96,129

POKE53269,3 FORX=GTO174STEP2: POKE52 882,X:NEXTX EN=0:SNS=""; PRINT" {HOME}{7 DOWN} {GRN}" C=INT (RND (1) *136) +1 POKE52896,C

FORW=1T030

GOSUB2008

IFPEEK (198) >GANDEN=LTHE NPOKE198,6:GOTO70G NEXTW

GOTO468

DATA “IN ADDITION TO BE ING ABLE TO PRODUCE*" DATA "136 COLORS, THIS {SPACE}PROGRAM CAN ALSO *

DATA "CREATE 4 HIGH RES OLUTION (1 PIXEL RES-*" DATA "OLUTION) SPRITES, EACH WITH 4 COLORS.*" DATA "OF THOSE 4 COLORS , 1 COLOR IS CAPABLE*" DATA "OF 136 COLORS. TH E OTHER 3 COLORS ARE*" DATA "RESTRICTED TO THE 16 COLORS OF THE*" DATA "COMMODORE 64. H HIGH RESOLUTION*" DATA "SPRITE IS CREATED FROM TWO SPRITES.*" DATA "INCLUDED WITH THE PROGRAM IS AN EDITOR*" DATA "TO PRODUCE THESE {SPACE}4 HIGH RESOLUTIO Nee DATA "SPRITES. THERE AR E ALSO TWO INTERRUPT*" DATA "ROUTINES INCLUDED TO EASE THE USAGE*" DATA "OF 136 COLORS AND HI-RES SPRITES.*" DATA "{BLU}*" DATA "PRESS ANY KEY TO {SPACE }CONTINUE<" POKE53269,@: PRINTCHRS (1 47) POKE52882,138:POKE52884 1162: POKE52886,186:POKE 52888,219

EAC

COMPUTE NOVEMBER 1992

RE

MQ

726

736

746

745 758 754

755 756 768

778 786

798 800 816 815

816

826 830 840 856 860 876 880 896 9066 916 926

936 940

956

960 976 988 996 1068

16198 16208

1636

1046 2600 2016 2628 2636

POKE52883,75:POKE52885, 75: POKE52887,75:POKE528 89,75 POKE52894, 208: POKE52895 , 208: POKE52896, 288: POKE 52897,268 POKE52890,1:POKE52891,2 : POKE52892, 3: POKE52893, 4 IFPEEK (52897) <>@THEN745 POKE53269, 255 PRINT" {HOME}{1@ DOWN} {WHT }"; :EN=0:SNS="" GOSUB2906 IFEN=@THENGOTO755 PRINT" {HOME}{6 DOWN} {WHT}";TAB(15);"{" PRINT" {DOWN}";TAB (12) ;" COLOR" DIMC (3) :C(@)=1:C(1)=2:C (2) =3:C (3) =4:D=6 FORS=0T03 POKE52896+S,C(S) NEXTS PRINT" {HOME}{8 DOWN}";T AB(17);"{4 SPACES}" PRINT" {UP}";TAB(17) ;C(8 ) GETAS: IFAS=""THEN826 I" THEND=-1 "KTHEND=1 TO3 C (LR) =C(LR)+D IFC (LR) >136THENC (LR) =1 IFC (LR) <1THENC (LR) =136 NEXTLR:D=6 IFAS="E"THEN1G26 GOTO796 DATA "NOW, YOU MAY OBSE RVE THE 136 COLORS*" DATA "YOURSELF BY SCROL LING TO THE LEFT BY*" DATA "PRESSING 'J' AND {SPACE}SCROLLING TO THE RIGHT*"

DATA "BY PRESSING 'K'. {SPACE}TO END, PRESS 'E tem

DATA "YOU WILL NOTICE T

HAT THE COLORS ARE*" DATA “ORGANIZED INTO SE VERAL GROUPS. I HAVE*" DATA "ARRANGED EACH GRO UP FROM BRIGHTEST TO*" DATA "DARKEST. EACH SPR ITE HAS ITS OWN COLOR*"

DATA "ADDRESS IN WHICH

TO POKE ITS COLOR*" DATA "NUMBER. <"

PRINTCHRS (147) : POKE532

69,8

POKE53281,6: POKE53280,

14: POKE646,14

END

IFEN=1THEN2675

IFSNS<>""THEN2645 READSNS

IFLEFTS (SN$,1)="£"THE

HA 2046

2645 2056

FA HP

RM 2060 RG JE QJ GR

2076 2675 2886 2696

EB 2106

SPRITES

3266:08 3268206 3216:14 3218:00 3226:60 3228:14 3236:00 3238:A0 3246:66 3248366 3250:2A 3258: 608 3266:00 3268:2A 3270:00 3278:56 3280:66 3288:3A0 3296:00 3298300 32AG:A8 32A8:60 32BG0:0A 32B8:AG 32C6: 68 32C8:50 32D6: 06 32D8: 00 32E0:58 32E8:66 32F0:65 32F8:56 3300:00 3308:AG 3316:60 3318:0A 332G:AG 3328:60 3330:0A 3338:AG 3346:00 3348256 3356:68

N2680 L=LEN (SNS) :CH=@: PRINTT AB ((41-L) /2);

CH=CH+1 IFMIDS(SN$,CH,1)="*"TH ENSNS=""; PRINT: GOTO267 et IFMID$(SNS,CH,1)="<"TH

ENEN=1:GOT02675 PRINTMIDS (SNS,CH,1)7 RETURN

R=LEN (SN$) -1 FORRT=1TOR: PRINT: NEXTR

ny SNS=""3GOTO2675

Ut) C1) @6 14 Cl) Ui) 66 6G 14 G2 A8 @1 54 06 2A 66 14 Cr) 2A 60 77 05 55 56 62 28 90 14 Cl) G8 28 08 14 G2 GA 66 61 55 19 16 G6 08 @@ 55 GB 14 66 GA GB @1 55 06 G2 20 64 59 Ur) GA G8 14 G8 14 62 2A 66 ol 66 16 Go

3398:7F

ve

33AG:AA 33A8:15 33BG:62 33B8: 08 33C0:08 33C8:06 33D6:80 33D8:68 33E06:55

Cl) AA FF G oa FF EF 3F

5E 5D CA B8 27 9D 35 AE F6

33E8:EA 33F0:ED 33F8:96 340G:AA 3408:AA 3410:55 3418:AA 3420:AA 3428:55 3430:AA 3438:AA 34406:55 3448:55 3450:AA 3458:55 3466:55 3468:AA 3476:55 3478:55

AG 55 FF AA 55 55 AA 55 55 AA Cr) 55 AA AA 55 AA AA 55 Ct)

AG 29 7E ai} cs 23 2B DD 3B 43 AG FD SB GE 16 73 26 2E EG

David Kwong, 17, says he hopes this expanded palette program will gener- ate many new ideas and give the 64 a new look. He lives in Edmonton, Alber- ta, Canada.

TUNNEL TRAP

By Danny English

In the days of knights and castles, dis- putes could be settled by a sword fight, a joust, or a good game of Tunnel Trap. The first two activities have pretty much faded into obscurity, but you can still en- joy this game for the 64.

Challenge a friend to a heated battle in- side a 32-screen maze of tunnels. De- stroy your opponents by slingshot or by strategically set traps. Tunnel Trap fea- tures a realtime split screen and respon- sive controls.

Getting Started

Tunnel Trap is written entirely in ma- chine language. To enter it, use MLX, our machine language entry program. See “Typing Aids” elsewhere in this sec- tion. When MLX prompts, respond with the following values.

Starting address: 0801 Ending address: 1990

Be sure to save a copy of the program

before exiting MLX.

The Challenge

When you're ready to play, connect two joysticks to the computer. Although Tunnel Trap is written in machine lan- guage, it loads and runs like a BASIC program. When the title appears, you have the option of turning trap sensors on or off. Pressing f1 will enable trap sensors, and pressing f3 will disable them. They will be explained later in the article. Pressing the space bar be- gins the game.

The Split Screen Playing Tunnel Trap can be a bit con- fusing at first. The top screen belongs to player 1, and the bottom to player 2. Each player is controlled by joystick, and each player has a status line. The two views represent windows on different sections of a large maze. The two players begin their search for each other at opposite ends of the maze. Players control their knights with joysticks. Pressing the fire button launches slingshots. The shot fires in the last direction that the player moved. When the players enter the same screen, an image of each player appears in each window. The best way to avoid confusion is to look only at your own window.

The Deadly Traps

Besides being able to shoot at each oth- er, each player begins the game with 25 traps. Player 1 can dig a trap any- where in the tunnel by pressing f1; play- er 2 presses f7. Your enemy cannot see the traps you set, and you cannot see his. You cannot fall into your own traps. On the title screen, you have the option to enable trap sensors, These are state-of-the-art warning devices. When they're activated, a green light at the far right of the screen flashes a warning when you're near an enemy trap. The sensor won't pinpoint the trap's exact location, but it does warn you to take caution.

How to Win

On the left side of each player's status bar is a green stamina indicator. Each time a player is hit with a slingshot or falls into a trap, he loses one stamina point. When all points are gone, the oth-

er player wins that round. The game continues until someone wins three rounds. The victorious knight will be crowned champion of the day. To re- turn to the title screen at any time, press the Commodore key in the lower left corner of the keyboard.

TUNNEL TRAP

861:0B G809:37 6811:26 $819:3C @821:99 @829:B9 O831:F7 @839:2E 0841:20 G849:07 @851:05 6859:20 0861:16 @869:A2 9871:18 @879:A8 @881:F7 @889:A5 G891:E8 9899:20 G8A1:A6 @8A9:A5 @8B1:03 @8B9:DG G8C1:34 G8C9:G3 @8D1:63 98D9:34 68E1:18 @8E9:34 @8F1:03 G8F9:20 G901:A7 9969:26 G911:66 6919:85 @921:FF @929:FF G931:61 G939:22 @941:C6 G949:A8 G951:F7 @959:A9 G961:F8 6969:01 G971:6A 9979:62 @981:A2 0989:8F @991:CE 6999:E2 G9A1:B9 G9A9:66 99B1:90 @9B9:1A

69C9:AB G9D1:C4

NOVEMBER 1992 COMPUTE

20°

68 33 6c AQ 4c 87 c8 61 34 A2 a4 65 AS AS F8 20 34 18 FD 4c 1c 63 4c E6 63 69 83 18 34 a4 AT 48 FB 7] 58 AS F8 BG 88 FO 4c 60 45 05 1g 2c F8 48 61 61 gl 3A 79 6a

78 6G 26 99 63 68 3c Ci) 18 De 3 61 20 A2 a7 FF 85 34 63 AS 65 13 AG FO 5c A7 De o4 Dg 69 63 FB cé6 Bl 68 FE 97 4c F7 38 62 91 GA Ag 16 9E 66 BD F7 G8 AS 68 @8 2A 8D 8B 58 13

17 oo 26 F8 88 99 85 61 B9 F7 F9 FO 20 34 GA 85 85 EF $3 AG FC A7 gl 63 68 Gl 4c GA A8 GA G6 De FO FB FE A4 ce De 16 38 85 FC Bl 16 68 32 78 42 9A Bl 32 B6 FD 2A 18 4c 3B 13}

9E 20 20 Ur) De FF 2D 12 6E EE Dg 33 34 83 26 Ag F8 AS De 62 65 85 E8 84 A2 A2 5c E8 Dg A2 Dg E6 6c CA 85 FE E7 D8 68 ES F7 FD 98 iSE EC 68 36 i) G8 B7 31 co 61 E8 29 RE) 3F E2

cs

38 29 B9 68 a9 De 85 3c E8 EE G3 De OA 97 85 85 G3 FE 68 85 BY, 6C 63 26 34 34 20 93 20 34 68 85 2A Ag 08 cé6 A4 85 FO 63 ES Bl c4 E6 @8 E3 3E 03 32 oo 67 cs ED BD 1F 43 93 Ag

G2

G-33

PROGRAMS

09D9:87 EF A9 46 74 EB 82 73 11] 8CG9:69 5B GE 1B 38 GD CF AD 63 | GE39:01 64 22 04 44 4B OF 34 15 O9E1:E2 FG A8 B5 B2 26 83 G1 25] GC11:Cl 15 C@ AG BE BC DG OB B7 | OE41:26 22 44 BE 32 8D 88 BS CA O9E9:1D C5 C8 F5 3C 23 Fl 30 F6 | 6C19:02 2C 64 E4 85 C6 C6 G2 EE | OF49:2A 43 B9 18 69 G8 BD 28 B2 O9F1:8F 86 39 2D AA 4C 22 G1 33] BC21:A6 G2 G2 E6 BS G3 3C GA 72 | GE51:23 4C OF 44 20 2D 54 50 E6 G9F9:26 71 G1 G2 76 99 E6 2F 9F | 6C29:19 EB 9G 17 76 24 43 5E 75 | @£59:45 20 73 45 4C 91 45 40 56 GAG1:AC 82 36 E6 2D DG G2 E6 18 | BC31:CB 21 51 E4 G5 1C 12 E4 10 | BF61:B8 48 A4 4E 51 86 38 ED 68 GAG9:2E 82 EB ED C6 39 16 £9 56 | 6C39:39 12 1B D7 49 E4 @5 1C 57 | GE69:G1 89 SC GD 45 78 89 54 38 GA11:E8 5@ 2C DA G1 A9 37 85 83 | GC41:05 45 5E 106 3D C5 41 46 C3 | GE71:78 FO C9 EB 11 50 86 18 BC OA19:G1 58 20 G6 40 4C AE A7 FF | GC49:5E 68 D4 BO 91 17 D3 40 16 | GE79:6D B69 40 8D 81 8E GB BC 52 GA21:CF OD 84 EE A9 G4 2C AQ 3F | GC51:5A 6E 86 91 17 48 F8 3E 65 | OE81:54 G5 20 F9 44 AC FG CF 33 GA29:68 85 FF Bl 2F 91 2D C8 AG | 6C59:79 41 2C 14 85 C5 42 2D 36 | BE89:DC F4 21 1D 16 F3 50 67 CF GA31:C4 FF E8 2A 10 2D 21 11 EF | 6C61:53 11 26 65 2G 21 59 Al 95 | £91:74 14 33 CE 39 1D E2 3B 7F GA39:2D A5 2E 5D 44 2E AG 85 8A | BC69:3F 42 C6 G3 98 17 G2 E6 C6 | GR99:1D 75 D4 C9 4A 50 66 G6 3F GA41:68 E5 4C 2F 65 FF 85 2F B4 | @C71:03 5C 5E 58 78 38 40 SE F6 | GEA1:CF EE 05 CF AG 26 20 CB AB GA49:A5 30 OB 76 F9 30 4C 6G CD | GC79:DG 81 G1 11 1B GA 90 17 C4 | GEA9:44 88 DO FA 4C 06 47 FC D9 GA51:61 B9 00 EF 99 GG FF C8 E8 | GC81:76 66 Cl F4 61 F4 14 79 F4 | GEB1:3C 26 23 61 61 DC 29 19 CD GA59:D@ F7 CE DC @1 CE A3 BA C@ | 6C89:61 El 61 73 Dl 58 64 B4 9B | GEB9:33 41 AD 11 CF F4 9C 32 44 GA61:AD DF G1 C9 DF 80 66 2C FA | @C91:64 58 14 41 4C C3 64 G1 C3 | GEC1:32 GB AB C2 15 7E 206 F3 32 GA69:9F FE 80 96 13 7B SC C7 1D | 8C99:7C 87 26 67 AS 2E 18 2A 8C | GEC9:4E BA 16 F8 B9 AD 27 G6 26 GA71:48 1C G2 65 71 BD 33 G6 2A | GCA1:19 82 20 62 4C BB 41 13 F7 | GED1:68 GD 1A 6A 14 64 36 84 72 0A79:18 1E 4A 1B 26 1F 1B 1A 20 | @CA9:@1 32 91 8A 33 91 Bl 14 61 | GED9:4E 31 GE 2D 60 CE 4E 21 F9 @A81:2C OD 42 El BO Bl 38 DG E2| GCB1:18 13 A8 41 55 5E 1@ Bl BO | GEEL:AG 90 GC 60 EE SE G1 C8 BS GA89:28 D5 30 33 D2 El 3A 43 36 | @CB9:40 85 CB 76 2D O8 8D 58 B@ | GEE9:C9 FO AC 34 GC BE AF 22 1C GA91:Bl 78 23 CE 26 G8 44 62 F9| GCCl:11 4C 95 41 20 B3 2A D6 37 | GEF1:7E OF 18 56 EG DB 18 45 59 D2 98 9C 78 68 34 34 19] GcC9:42 20 F9 42 4C 17 43 26 D3 | GEF9:82 EE 43 38 B2 58 G1 8E G8 85 C3 C6 42 1c 13 19 Cl | @cD1:5C 24 2C A7 28 C3 GO F2 64 | OFO1:4E BO 2D 8E Gl FO D1 FB 69 Oc 8G 14 18 EC 38 C5 80 | GcD9:42 43 A4 93 1E 91 OB GF GE | GFO9:38 CE 72 G4 CO 20 FF FO FC 5C 26 45 1E 3B 62 73 1B | GCE1:3E C9 76 G2 CA 30 80 BC 8E | OF11:10 8F A4 C9 B5 9G G1 66 19 22 21 6D B8 21 67 A2 AD | OCE9:D@ 18 29 AC 42 7F 42 CB C@ | GF19:AD OD CF El 72 B4 6@ 4C DC 6D 41 OF 23 OA 20 67 48 | OCF1:2A E4 ES 88 23 2F 34 3A 76 | GF21:42 41 AD GO 41 FO G2 64 3C 80 30 96 Bl 21 1A D2 GA | BCF9:8A BC DO EB DB 68 ED AB 14 | OF29:29 G2 96 G2 B6 29 B8 90 4 CO 44 61 51 EC C4 BC 3D | @DG1:A3 G6 F2 G2 GE 9E EE 64 BO | GF31:02 GC 29 BA DO BD BE 4G 32 2D 17 52 C7 44 86 CA a8 | 6DG9:B9 B6 62 51 42 6B 2B CO DO | GF39:04 G1 E9 GB 96 G5 G6 G3 7E 33 8D 34 6C 78 99 34 87 | OD11:46 BG 62 32 12 OG 76 F2 5A | GF41:41 40 G7 76 2B F8 64 AG 17 7E 86 24 G6 GB 21 3D 94 | BD19:C2 BE 4F 23 9C BA G6 21 96 | BF49:AD 70 96 4A 63 AG 18 Cl 61 89 06 CB 8C B2 4F A5 71 | GD21:AC G1 9A OF BC BC CO BA G2 | OF51:DG 69 26 G4 GD 41 GB DO BB 3C 88 GB 19 67 OB 3E 78 | GD29:F9 BY AD 27 G6 F2 82 C4 9C | GF59:38 £9 78 50 B2 AD 61 54 85 40 21 7C 20 62 BC 22 FB | GD31:43 21 8E 27 C8 GB 42 GO 76 | GF61:09 G6 AY 33 BE 82 AO FF 41 26 G2 66 A2 21 £7 AE G4 | OD39:GE 84 C9 78 CA GB 38 AG DS | gF69:8D 3C 57 C3 CB 46 4C G6 42 18 85 48 6@ 26 C8 EF 8C | 6D41:83 40 33 GE CF 8A 23 GE 71 | OF71:47 DD G7 A2 E8 C8 CF 46 G6 64 49 A3 6D 36 64 68 4B | GD49:D0 82 EE 43 38 E2 C8 OB 68 | GF79:AB E8 C2 C3 GG 40 BA G4 56 E6 63 A2 06 CA DG FD GD | GD51:8C 8A 22 2F 34 38 8A BC DF | GF81:A2 C8 F2 8A 78 72 8A 15 El FO CF El 76 AG BO E8 5D | GD59:D8 EG CE 16 G1 30 C8 36 79 | GFB9:48 CB 20 AD B5 AB G2 BG SC 9B31:67 27 AB C4 99 98 D9 88 D1 | GD61:10 AD G8 31 33 C8 OB GC El | OF91:AD G6 40 BG 86 82 BO 15 CF 9B39:39 CB DO FG 58 2C B8 99 64 | GD69:9D BC 9G 1D 41 E6 6F 21 OB | GF99:CA 52 4G 12 AS 40 1D 29 6C 9B41:91 D9 99 31 DA 13 3C DG 49 | GD71:60 67 Al 36 G5 G4 G4 AG 83 GFA1:46 51 82 15 40 4C 15 47 7A 9B49:30 80 99 3F A9 57 GF 8D 15 | 9D79:04 EO FF 75 2A 28 41 21 BA | grag:44 G1 30 O8 G1 FA 84 FB AQ @B51:1D BC 80 C6 17 39 GO 4A 89 GFB1:AG 96 A2 58 G3 6E AG G7 95 Geer Eke i 8D 27 29 96 oi 61 OFB9:A2 20 20 4c 47 26 DA 49 B3 9B61:8C D2 40 6E 28 E6 2A CD ;

@B69:41 16 BO 60 30 46 BA 18 91 OFC9:79 80 97 26 84 AC 64 03 58 9B71:67 2B E6 2D 4@ DG 19 2c 29 GFD1:7E AC 25 AE 42 GA 20 8B EF 9B79:D@ 8D 2E DG AJ ES BD FC 2B OFD9:47 AD BG GG C4 8D BB AA 34 9B81:8B OB FD 88 FE 07 8D FF 97 @FE1:63 69 CF A2 EE 16 @1 AD 4F 9B89:00 6E GG BY 43 63 AD BA 13 OFE9:07 CF C9 G4 DG DA EG 89 36 9B91:60 10 02 AD BB 56 GG 20 4E GFF1:19 5F 96 58 86 FE 84 FF 45 6B99:65 BC F2 G1 20 OF BD 42 CA GFF9:AC 63 F7 AB 40 86 FC 84 83 9BA1:65 AD BE 40 85 04 AD BF D8 10G1:FD AA EG G6 FO 11 76 5C EF 9BA9:26 BC 02 DB AD CO 40 46 7D 1009:25 32 47 AS CA 4C 9A 47 8F GBB1:A3 86 66 G4 5B 6C 3A 07 BF 1011:4E 60 Cl Bl FC 91 FE C8 AG OBB9:7B 6C DA C9 20 E4 E4 52 51 1619:C@ GA DG F7 A5 FE E4 OC B4 OBC1:FG 4C 39 53 FO G3 DB 66 11 10621:28 85 FE AS FF CA FF DG EC @BC9:94 27 Bl 14 72 98 64 38 42 | GDF9:G1 74 28 22 3C 76 22 64 DC 1629:E@ 1A GA GE AE Dl E8 EG D1 GBD1:6C 99 8G C3 46 G8 61 96 34 | GEG1:44 AG 2c 22 F9 43 26 2F 5B | 1931:05 DB D6 EB D8 26 GE @4 G9 GBD9:C4 @5 43 B2 G1 3A 1A 24 70 | GEG9:62 41 66 OB AB BB 2C BC 88 | 1939:8D 43 £1 G1 GE AD DA 59 63 9BE1:19 GE 1B CF 84 41 12 OB CO | 6E11:9E 20 Cl 40 AE BA 43 60 G8 | 1941:17 AQ @6 74 67 58 4C 62 96 OBE9:OF 49 GA 3C 24 1B 7E Al GB | GE19:AA 2F C2 A2 ED Bl C8 68 G9 | 1g49:56 ag 53 16 6C 19 10 41 23 GBF1:41 92 El B@ 41 62 GE 1B DD | GE21:C9 BO 28 82 4C 3D CB G4 68 | 1951:FA 4F 9B 59 78 D4 C2 D1 3A GBF9:24 BC GD 49 5G 3C 15 19 12 | GE29:42 2c E1 72 54 AG GB 54 4E | 1959:1c 23 1B 1 43 30 92 31 C6 GCO1:D3 03 OF 4F GD 10 GE 18 77 | GE31:32 G4 26 C5 4c 35 82 26 2A | 1961:04 23 22 3B 46 52 BG 14 35

G-34 COMPUTE NOVEMBER 1992

6B 91 F8 77 78 Al ED 91 84 E7 76 G2 83 4C 46 51 DC 11 91 GF D9 1F 91 C4 1D 91 68 48 20 EB 47 CB D7 @B 43 32 16 26 FA FF A5 F9 C9 DB D@ Fl A5 46 C9 E8 DG EB 60 A8 AE B3 FA 4C 8B 5B 26 C@ 11 91 B5 48 6D D5 64 48 CD C5 @3 95 Al 5C El 61 75 43 GF 41 62 GE 53 63 4E 4C 1c 62 AD C2 @@ 51 DA Cl 38 42 DB 65 68 AD 14 10 41 FG 63 4C G6 49 82 31 BO DB 64 19 CB 9A G3 F7 GE C5 F6 85 06 4F 62 F2 4F 96 2C EC G1 41 @4 EE 23 AS @5 56 1E Al CE F3 AD 20 GC C9 AF 84 CE CG 56 79 BO 8D 2B G6 62 20 El 52 18 6D 65 71 Dl 42 4B 40 F2 4B A5 4C 79 13 4C 8D 42 46 8E C2 AG EG 26 54 49 88 CO BB 3C 62 77 3@ FC @4 23 AC DE Fl GA 2B 9E 46 17 E4 88 C2 G8 BB F@ 88 DA 68 AB 3D 1141:83 61 C3 83 61 A8 36 18 5D 1149:32 66 33 C2 36 66 33 C2 8B 1151:14 76 C2 32 38 84 2E 86 CC 1159:A9 @8 8D 2E DA E@ 7E 83 Cl 1161:CF 63 69 G4 F2 3C DB G8 D7 1169:64 41 A2 52 20 74 3C AG 73 1171:61 B4 63 E4 Al 20 3C 4A 406 1179:C7 BG El Cl 98 FF C3 58 66 @8 38 5A 49 48 46 5E 4B A2 53 47 12 CF 4C 47 DF 98 64 19 1D 4D 4D 63 CC F8 38 E9 61 85 F8 A5 83 E9 11 BF F9 92 E@ 22 57 C7 98 87 26 A8 85 12 4C 3c 12 EE C8 Bl F8 C9 Fl DO G3 EG 21 AG 29 68 D4 AS BG 64 1D 68 A5 4D CD 69 67 85 4D AS 4E 18 41 11D1:AF 1E 4E A6 23 A2 @@ 2B 56 11D9:8A 42 @8 C8 24 32 CH 47 D1

aN WONQSCSUWPWNMWAPrPNEBROLAL-

DNAPSONy,OY

1231:D3 93 El B@ Dl B3 31 58 7B 1239:F4 CO G1 F4 C4 97 D3 13 BE 1241:04 4F CF 04 4E 4F 1D 6C CB 1249:AG 31 G4 C9 53 DC 23 26 9B

1271:A@ 34 62 OB 91 4D 85 BA C6 1279:44 4E AY 93 62 A3 8C 82 FB 1281:8C 2E Fl 60 8C F9 87 8C A2 1289:FB 97 C®@ 99 1B DG C9 AS 8C 1291:F@ GA C9 5A F@ 11 8C EB 6G

12B1:D6 12B9:68

1311:D3 1319:E3

QOPOSUTSAIYRAOSCUrPAOAUOS

13B9:12 13C1:7C 13C9:21

URUBOOONUD

1419: 4F 1421:E8 1429:53 1431:54

ll BC

66 66 93 B2 65 4c GA 03 60 F9 Ag BA 28 69 9E DE 2E Bo DA 26 46 OF 43 2D 22 41 59 86 47 E4 31 54 53 BC 62 53 26

89 36

DG 34 26 AD Ag GA 39 63 68 07 4c 8E 39 41 4c 4D F2 8D 4A 3B 39 26 23 2E F8 2E 1c 54 E2 5B 5D 6E 3A 21 45 45 49

4E 8A

14 61 F6 AA 4D DF FO AG 52 3E E6 Dg 35 BB 12 E8 54 B2 cs 85 69 D6 Bl EB 3B DB F8 2F 1l 98 46 AF 43 EE 91 34 A7

1459:Bl 1461:8D 1469:67 1471:76 1479395 1481:26 1489:A9 1491:25 1499:D8 14A1:D4 14A9:F2 14B1:D0 14B9:FF 14C1:38

Fl 06 28 75 16 eB B4 8D 6c 62 99 4c 87 4E

F2 CF 67 Ag D8 86 8D 22 21 G4 19 26 4c 46

74 6A B3 ED c3 26 c3 Dili CF 94 EE 47 4F 57

14C9:4E 14D1:64 14D9:33 14E1:6C 14E9:78 14F1:19 14F9:72 15@1:7C 1569:14 1511:6C 1519:6F 1521:8D 1529:E1 1531:61 1539:98 1541:FA 1549:65 1551:FA 1559:FB 1561:34 1569:C9 1571:68 1579:61 1581:69 1589:99 1591:AD 1599:4C 15A1:A9 15A9:768 15B1:4E 15B9:64 15C1:F3 15C9:CE 15D1:20 15D9: 26 15E1:42 15E9:El 15F1:5B 15F9:8F 16G61:AF 1669:28 1611:F8 1619:55 1621:56 1629:65 1631:26 1639:74 1641:4E 1649:96 1651:16 1659:66 1661:44 1669:C2 1671:2D 1679:8B 1681:A4 1689:1A 1691:9A 1699: 28 16A1:9B 16A9: 03 16B1:63 16B9:EA 16C1:81 16C9:CD 16D1:49 16D9:84 16E1:0C 16E9:66 16F1:81

AS FO 85 FO 1D 2F 3E 3E BC 8D Al 1) 86 DG 54 D6 7D 84 AS BC 38 32 09 ol 12 8D E2 FF 4F 26 co CF 41 D7 35 26 88 46 1A 26 1) E3 FF E6 EA 6B 17 EQ 67 16 6B 48 E4 FF 21 64 81 A2 9A 35 63 9E 16 EE 68 Uy) 62 27 36 E2

41 G3 Cl) 11 G4

NOVEMBER 1992 COMPUTE

cg A7 19 Bl 18 GA 07 Ag 23 G2 D8 93 59 FE De 38 E8 31 FC FD 99 AS 27 A8 66 60 93 26 5A 16 8D 82 4B 46 AT 98 26 4F E3 c4 E8 55 AA 47 54 45 55 15 5D 55 G4 A8 A8 DB 98 25 9G 12 3D 46 cl 27 65 88 1l 92 E3 A3 8A G4

PROGRAMS

16F9:12 1761:9D 1769:98 1711:99 1719249 1721:81 1729:6B 1731:33 1739:68 1741:62 1749:64 1751:61 1759:64 1761:E4 1769:98 1771:6F 1779:96 1781:568 1789:66 1791:73 1799:87 17A1:22 17A9:54 17B1:C5 17B9:ED 17C1:B7 17C9:4A 17D1:29 17D9:48 17E1:E1 17E9:48 17F1:BG 17F9:Bl 1801:1E 18069:44 1811:21 1819:43 1821:2B 1829332 1831:13 1839:99 1841:08 1849:62 1851:C6 1859:1E 1861:1B 1869:42 1871:F8 1879:Cl 1881:8A 1889:81 1891:2A 1899:6A 18A1:4B 18A9:1C 18B1:AD 18B9:82 18C1:47 18C9:73 18D1:A8 18D9:21 18E1:41 18E9:83 18F1:6A

1969:E6 1911:E8 1919:28 1921:9E

G-36

GE 33 93 28 OF 92 61 1l 1l A2 A2 El 26 gc @l 88 22 1l El AC 47 F8 G6 OL AG cl 68 4E 1c cl E4 gat cl 73 co 32 26 26 FE 4B 29 61 63 16 G6 32 Dl 26 A7 9B BB 86 AA 2A 82 OF 48 c3 66 12 43 23 24 16 26 26 96 1A ic G3

12 AT Al 2: OF G2 Cl) o9 2A 27 2D g9 @5 2A Gl 91 oo 86 co DS 41 gc c7 51 6D 75 1c CF 63 B3 8E @D 98 76 24 68 56 21 oo 39 AG 16 45 pc 49 26 5c EA 78 47 gC A3 82 Al 8D 20 46 gc G2 4A FE AA 1D 2E 23 35 88 2c 96 G2

COMPUTE

E8 58 22 GE @D gc 6D E8 99 @D G2 G2 47 13 86 cl FB @5 23 28 1c G4 32 Bo 94 86 81 16 21 c8 c4 18 6c E5 2B cl 63 46 1D oo 48 47 42 7 8G 4E 5B 49 B9 66 A7 4D 96 2B 22 AG 4c 4B F9 Al BS Fl 7B FC 83 41 gC 31

64 63 OF OF oo oc 24 GA c8 5c 66 @D oo 13 14 A2 GA 16 4c B3 24 88 3c ED G4 31 D2 oD 92 92 2E 26 19 64 38 oc 46 67 c2 4B G4 20 8a 81 Uy) El 40 EA Fl B8 8c 82 F8 69 8c 1c 47 AS 4A E8 G6 C3 62 7c B4 A4 66 E9 91 c8

62 3c 2c 28 co @D 62 66 67 @5 16 G2 OB 26 E3 cl 99 OF 42 36 71 44 63 ES 96 26 G2 14 34 51 4E 16 46 E7 17 cl EC 76 G6 E3 36 7E EG g5 87 81 26 4D 38 DA 9A AG oo G2 96 OA 87 4D 22 4E G2 c3 AC GA 68 36 83 92 E2 28

NOVEMBER 1992

12 79 37 gc G8 A7 EB 66 G4 AG G4 E3 G4 96 Al 79 23 Al B7 4c 54 CE 74 26 cl 27 41 48 76 84 41 FO Gl AC SE 38 8G oo 14 3E 61 32 52 17 65 31 26 6F 7c¢ 76 7B SA 4c 48 4E @D 4c 47 4c 85 82 GE E3 Al 5A cs 16 98 22 8A

E4 89 FA Al 73 D6 31 27 @D 7A 2E 16 6G 17 F7 4B 12 6G 3A B2 G4 4P 72 95 98 7c CF 65 D6 58 42 eT DB 2B 23 BE 51 SB 59 6D F9 F3 B8 42 21 76 AS EF JE c2 15 D2 73 A8 35 4E 15 56 76 75 DB E6 3E 36 SF 66 3D G2 B3 68

E6 39 BC 1B 32 DS AG 81 97 AG 8c ES 68

2F 62 26 68 21 cc 28 85 8E 94 86 EA GB

41 1A 46 4 GA Bl 51 92 93 92 94 56 Cl)

DA 88 AG 44 3E 93 29 cD 41 81 BA FD oo

1929:28 1931:8D 1939:E9 1941:41 1949345 1951:FE 1959:72 1961:AG 1969:33 1971:1F 1979:96 1981:AG 1989:A8

12 8c 26 42 46 AG E3 96 26 BG 93 B2 oo

43 88 34 43 86 28 E4 8c 27 E3 AG BS 9G

Danny English is a frequent contributor who lives in Moreno Valley, California.

BASIC MOVE AND SAVE

By Daniel Lightner

Have you ever been in the middle of a great BASIC programming session when all of a sudden an OUT OF MEM- ORY ERROR message appears on the screen? Perhaps you've had a large pro- gram to halt in the middle of execution with a similar error message?

As a programmer, you may know that there's a 4K block of free RAM hidden un- der BASIC'’s ROM and RAM from 49152 to 53247. Wouldn't it be great if you could store some of your BASIC code there?

Well, you can with BAMOV and BA- SAV. These two utility programs for the 64 letyou use this block of RAM that's usu- ally reserved for machine language pro- grams. They are particularly useful when you're using programs that require a lot of sprite or character data.

Getting Started

BASAV and BAMOV are written in ma- chine language. To enter them, use MLX, our machine language entry pro- gram. See “Typing Aids” elsewhere in this section. When MLX prompts for starting and ending addresses for BA- SAV, respond with the following.

Starting address: COOD Ending address: COC7

When entering BAMOV, respond with these addresses.

Starting address: CF62 Ending address: D001

Be sure to save each program before leaving MLX.

A Few Rules

Before these programs can be used, certain techniques must be employed and certain rules followed. Your large BASIC program must be divided into two parts. The second part of the pro- gram will be called by the first part dur- ing execution.

It's important to note that program 2 must be at least 42 bytes shorter than program 1. In most cases you won't have any problems determining this size differential, but here’s a way to check. Load program 1 and type this line of code in direct mode.

PRINT INT(PEEK(46)*256)+PEEK(45)-2049

The value returned is the length of the Program in bytes, Load the second pro- gram and enter the line again. To de- termine the difference, subtract the val- ue given for program 2 from the value given for program 1, The number re- turned must be 42 or greater.

Special Coding

Program 1 must contain these or simi- lar lines of code at the end of the pro- gram, Just be sure the line numbers are high enough to place the code at the end of the listing.

50000 GOSUB 50005 50001 SYS 53090: RETURN 50005 SYS 53090: GOTO10

When you want program 1 to call pro- gram 2, read its data, or whatever, have it GOSUB to line 50000. When pro- gram 2 has finished executing, the pro- gram will return normally to the next statement following the GOSUB 50000. However, it's not mandatory that con- trol return to program 1.

Program 2 must also begin with what- ever line the GOTO in line 50005 of pro- gram 1 dictates. In the above example, it's line 10. Remember to keep this num- ber below 50000.

To pass contro! back to program 1, Program 2 must end with a RETURN that is not part of any GOSUB routine in program 2.

A Demonstration

Two short demo programs labeled Prg1 and Prg2 are included to demon- strate how BASAV and BAMOV work.

These programs are written entirely in BASIC. To help avoid typing errors, en- ter them with The Automatic Proofread- er. See “Typing Aids” again.

Running the Demos

Note that when Prg1 executes, it loads BAMOV and a file called Pro- gram2 into memory. Having the pro- gram load these two is not mandatory. You could load these two programs in direct mode before loading and run- ning Prg1. If you decide to load them in immediate mode, delete lines 25 and 30 of Prg1. This will be better un- derstood as we continue.

Load BASAV with the ,8,1 extension. Then type NEW and press Return. Now load Prg2 as you would any BA- SIC program. Before you go further, be sure there's a formatted disk in drive 8 in order to receive a relocated version of Prg2. Then type SYS 49152 and press Return. The program will run, and the file will be saved as BAS-TMP. After the file has been saved, enter the following line of code in direct mode.

OPEN1,8,15, “RO:PROGRAM2=BAS-TMP”: CLOSE1

It should be clear now that PRO- GRAN2 as listed in Prg1 is Prg2 relo- cated. Place a copy of BAMOV on the same disk as Program2. Reset the com- puter by either typing NEW or turning it off and on again. Load Prg1 and place the disk containing Program2 and BAMOV in drive 8. When you run the program, notice that control alter- nates between the two programs.

As its name implies, BAMOV is the BASIC mover. It pulls program 2 from beneath BASIC's ROM and places part of program 1 there. When activat- ed again, it does the reverse.

When control is passed to line 50000 in program 1, it does a GOSUB to line 50005 so that when a RETURN is encountered, it will return to the next set of commands. At line 50005, BAMOV is activated, pulling program 2 into BASIC's memory while removing program 1. After it returns from the SYS call, the program encounters the GOTO10 command, and BASIC pass- es control to line 10 of program 2.

Program flow continues from there un- til it encounters a RETURN. At that

point, control returns to line 50001 following the GOSUB in line 50000 of program 1.

Note that this line must remain at the same location in memory. This is the reason for making sure that program 2 is at least 42 bytes shorter than pro- gram 1. Next, BAMOV is called again, and program 1 is put back in place. The RETURN in liné 50001 returns con- trol to the line that originally called the GOSUB50000, in this case line 65. All the switching back and forth may sound confusing, but it should become clear when you run the programs.

BASIC programs that require sprite and character data can read the data into memory and then pass control to the second program. But remember that this can only work as long as the second program is shorter than the first program.

BASAV

CO@G:AD GE DC 29 FE 8D @E DC 31 C@G8:A5 61 29 FE 85 G1 AD GE 4B C@1G:DC 69 G1 8D BE DC AI Cl 34 CG18:8D 18 G3 AO 34 8D 14 G3 64 C62G:A5 2D 8D GG AG A5 2E 8D F6 CG628:61 AG AO G1 85 FB AO G8 GF C@30:85 FC A9 63 85 FD AOI AG 31 C638:85 FE A5 2D 8D B2 @2 AS A4 C@40:2E 8D B3 62 AG GO Bl FB 37 C@48:91 FD 28 9F AS FB CD 72 C@50:B2 62 D@ F2 A5 FC CD B3 65

C676:FE A9 6G 85 FD A9 AG 85 91 C@78:FE A9 FD 26 D8 FF AD GE D5 C68G:DC 29 FE 8D SE DC A5 @1 A3 C688:69 G1 85 Gl AD BE DC 89 F7 C690:G61 8D GE DC A9 47 8D 18 23 C698:63 AY 31 8D 14 63 66 18 BA C@AG:A5 FB 69 61 85 FB A5 FC 95 CGA8:69 G6 85 FC 18 A5 FD 69 1C CGB@:G1 85 FD A5 FE 69 66 85 51 COB8:FE 6@ 42 41 53 2D 54 4D 73 CGCG:58 GB BG BB GG GB GB BB 6A

BAMOV

CP62:AD GE DC 29 FE 8D GE DC Bl CF6A:A5 @1 29 FE 85 G1 AD GE CB CF72:DC 69 G1 8D GE DC A9 Cl B4 CF7A:8D 18 G3 A9 34 8D 14 G3 E4

CFCA:@1 85 @1 AD GE DC G9 G1 3E

CFD2:8D BE DC AY 47 8D 18 83 96 CFDA:A9 31 8D 14 63 68 18 AS FD CFE2:FB 69 @1 85 FB A5 FC 69 2D CFEA:@0 85 FC 18 AS FD 69 @1 G6 CFF2:85 FD A5 FE 69 96 85 FE CE CFFA:68 66 GG G@ GB GB BB BB CA

PRGI

EA 10 GJ 15

REM COPYRIGHT 1992

REM COMPUTE PUBLICATIONS INTL LTD

REM ALL RIGHTS RESERVED

X=X+1: IFX=]THENLOAD"PROG

RAM2",8,1 IFX=2THENLOAD"BAMOV", 8,1

PRINT" {CLR}": POKE53280,0 :POKE53281,0

PRINT"{2 DOWN}{2 RIGHT}

{7}THIS IS PROGRAM ONE O

F THE BAMOV DEMO."

PRINT" {DOWN} {2 RIGHT}PRO

GRAM TWO IS UNDER BASIC'

S ROM."

PRINT"{2 DOWN}{2

T WILL CLEAR THE {SPACE}AND"

PRINT"{2 DOWN} {2

HANGE THE SCREEN

DER COLORS"

PRINT"{2 DOWN}{2 RIGHT}W

HILE DISPLAYING A MESSAG

EL"

FORT=1T05006:NEXTT

GOSUB56606

POKE53280,0:POKE53281,0:

PRINT" {CLR}{2 DOWN}

{2 RIGHT}{7}BACK AT PROG

RAM ONE NOW!"

HE 80 END

RA 56666 GOSUB50005

RQ 56001 SYS53090:RETURN

MX 50005 SYS53699:GOTO1@

GM 26 HA 25

AP 36 AJ 35

HA 40

MQ 45

RIGHT }I SCREEN

DQ 5a

RIGHT }C AND BOR

CM 55 ES 68

FB 65 AX 76 PX 75

PRG2

EA 16 Gg 15

REM COPYRIGHT 1992 REM COMPUTE PUBLICATIONS INTL LTD REM ALL RIGHTS RESERVED PRINT" {CLR}":POKE53286,6 : POKE53281,6 PRINT"{2 DOWN}{2 RIGHT} {WHT}THIS IS PROGRAM TWO OF THE BAMOV DEMO." PRINT"{2 DOWN}{2 RIGHT}W HEN THIS PROGRAM FINISHE S, IT WILL" PRINT"{2 DOWN} {2 ETURN CONTROL TO 661" PRINT" {2 DOWN} {2 F PROGRAM ONE." FORT=1T05009:NEXTT RETURN

GM 26 EQ 25

PX 36

MX 35

RIGHT}R LINE 5@

HR 46

xc 45 RIGHT }O

PC 50 PDS)

Daniel Lightner, a frequent contributor, lives in Sidney, Montana.

NOVEMBER 1992 COMPUTE G-37

PROGRAMS

NOAH’S READER

By Daniel Lightner

Last year (July 1991) we published Noah's Arc, a program that creates self- dissolving archive (SDA) files. People who use that program will find this short utility program for the 64 valuable.

Archiving is a convenient method for combining a number of related files into one master file. This process is conven- ient for uploading and downloading pro- grams and instructions to and from a BBS. Many files and programs can be stored within one large file. When the SDA file is loaded and run, it dissolves in- to the original individual programs and saves them to disk.

The problem with archive files is that un- less you have the filenames written down, there isn’t any way of knowing the contents of the archived file. This is es- pecially true if you have just downloaded a new file from a BBS or have come across a forgotten SDA file in your library. Dissolving the file will do the trick, but it's time-consuming and a bit awkward.

Noah's Reader solves this problem. Noah's Reader reads the beginning of the SDA files from disk and lists the names of the files that are stored within the archive file.

Entering the Program

Noah's Reader is written in machine lan- guage and will have to be entered us- ing MLX, COMPUTE's machine lan- guage entry program. See “Typing Aids" elsewhere in this section. When MLX prompts for starting and ending ad- dresses, respond with these values.

Starting address: 0801 Ending address: O9F7

Make sure that you save a copy of Noah's Reader before you exit MLX.

Running the Program

Noah's Reader loads and runs like a BA- SIC program. The first thing it does is to ask for an SDA filename. It then searches drive 8 for that filename and reads information until it locates the var- ious filenames.

Noah's Reader then lists those files to the screen. The listing can be stopped by pressing any key. When the key is released, the listing contin- G38 COMPUTE NOVEMBER 1992

ues until it prints the names of all of the archived files.

Run Noah's Reader again to read an- other SDA file.

NOAH’S READER 9801:0B G8 GA BG 9E 32 39 36 2E G809:31 6G GG GG AG BB 8C 20 EF G811:D8 8C 21 DB BO 8F G9 CI C5 G819:FF FS 67 26 D2 FF C8 4C BC G821:15 G8 AG BG 26 FA G8 BO 88 9829:85 69 26 D2 FF C8 C@ GA IE G831:D6 F5 26 FA 68 AQ 3E 20 SE @839:D2 FF 26 15 @9 AC 34 G3 6E G841:A2 @G BD 81 89 99 35 G3 8E @849:EE 34 63 C8 E8 EG G5 DB 76 @851:Fl CE 34 63 AD 34 G3 A2 AB 9859:35 AG 03 20 BD FF AQ 62 D1 G861:A2 G8 AG B2 86 FC 20 BA 1C @869:FF 26 C@ FF 20 CC FF A5 73 @871:BA 26 B4 FF AQ 6F 85 BY 4D G879:26 96 FF 26 AS FF C9 36 32 9881:D@ GD 26 AS FF C9 30 DG F3 6889:06 2G AB FF 4C 96 98 20 97 9891:AB FF 4C E7 @8 A2 G2 26 6E @899:C6 FF 26 FA @8 AQ G1 85 2F G8Al1:FB 20 Fl G8 20 E4 FF 85 90 @8A9:FE 26 67 69 AS FB C9 BO 14 @8B1:D@ F2 A5 FC C9 G9 DB EC 6C 68B9:20 E4 FF 85 FD A2 8G 26 86 G8Cl1:E4 FF C9 2C FO G8 26 D2 FA @8C9:FF E8 E4 FD DG Fl AQ GD 3F @8D1:26 D2 FF 26 Fl 68 26 Fl 8A @8D9:08 26 E4 FF A5 CB C9 48 C2 G8E1:D@ FA C6 FE D@ D2 A2 66 FB G8E9:20 C6 FF A9 62 4C C3 FF 1F @8F1:26 E4 FF 26 E4 FF 4C E4 Fl @8F9:FF AQ GD 26 D2 FF 28 D2 Cl G961:FF AQ 9A 4C D2 FF 18 AS G2 @969:FB 69 61 85 FB A5 FC 69 C5 @911:96 85 FC 68 AG GB AI BO 82 @919:8D 34 63 26 E4 FF C9 8G IC @921:F8 F9 C9 14 FO 41 C9 7B 4G @929:BG Fl C9 11 FO ED C9 13 48 @931:F6 E9 C9 1D FO E5 C9 22 16 9939:F@ El C9 2C FO DD C9 GBD D7 G941:FG 19 AC 34 63 CO 14 FG DC 9949:D2 26 D2 FF 28 5E 69 4C FF @951:1C 69 AC 34 63 CO GG FG 98 @959:C2 26 D2 FF 66 AC 34 63 5G $961:99 35 @3 EE 34 93 66 AC F7 G969:34 63 CO 61 BB G3 4C 1C C4 @971:69 26 D2 FF 38 AD 34 @3 4E G979:E9 61 8D 34 63 4C IC 69 49 @981:2C 56 2C 52 46 49 4C 45 9D 9989:4E 41 4D 45 20 3F 93 9A DG G991:6D 26 26 26 20 26 26 4E 48 G999:4F 41 48 27 53 26 53 44 25 G9A1:41 2G 52 45 41 44 45 52 F2 G@9A9:GD 2G 20 26 28 20 26 28 32 G9B1:43 4F 56 59 52 49 47 48 67 G9B9:54 2G 31 39 39 32 BD 43 A7 @9Cl1:4F 4D 58 55 54 45 26 56 76 @9C9:55 42 4C 49 43 41 54 49 46 @9D1:4F 4E 53 26 49 4E 54 4C G4 @9D9:28 4C 54 44 8D 26 29 29 27 G9E1:26 2G 41 4C 4C 26 52 49 C9 G9E9:47 48 54 53 26 52 45 53 99 G9F1:45 52 56 45 44 OD FF 06 BG

Daniel Lightner is a frequent contribu- tor who lives in Sidney, Montana.

LOCATE

By Farid Ahmad Programmers who use BASIC are famil- iar with the various tricks for positioning text on a screen. Most use various PRINT statements and a lot of trial and er- ror, but now there's a better way. Locate is a short machine language routine for the 64 that provides BASIC pro- grammers with two commands for cursor positioning and text color adjustment. Al- though the program is written in BASIC, it stores its machine language subroutine in a BASIC REM statement. This tech- nique provides the speed of machine lan- guage with the convenience of BASIC.