BYTE Listings Apr Jun 1987

Byte

This book was produced in EPUB format by the Internet Archive.

The book pages were scanned and converted to EPUB format automatically. This process relies on optical character recognition, and is somewhat susceptible to errors. The book may not offer the correct reading sequence, and there may be weird characters, non-words, and incorrect guesses at structure. Some page numbers and headers or footers may remain from the scanned page. The process which identifies images might have found stray marks on the page which are not actually images from the book. The hidden page numbering which may be available to your ereader corresponds to the numbered pages in the print edition, but is not an exact match; page numbers will increment at the same rate as the corresponding print edition, but we may have started numbering before the print book's visible page numbers. The Internet Archive is working to improve the scanning process and resulting books, but in the meantime, we hope that this book will be useful to you.

The Internet Archive was founded in 1996 to build an Internet library and to promote universal access to all knowledge. The Archive's purposes include offering permanent access for researchers, historians, scholars, people with disabilities, and the general public to historical collections that exist in digital format. The Internet Archive includes texts, audio, moving images, and software as well as archived web pages, and provides specialized services for information access for the blind and other persons with disabilities.

Created with abbyy2epub (v.1.7.2)

Six great reasons to join BIX today

• Over 140 microcomputer-related cm terraces:

loin only those subjects that interest you arc charge selections at any time. Take part when it's conv e ni en t for you. Share information, opinions and ideas in focused discussions with other BIX users who share your interests. Easy commands and conference chests help you quickly locate important infonratxjr

• Monthly conference specials:

BIX specials connect you with invited experts in ieacing-edge topics—CD-ROM MIDI OS-9 arc ~:re They re all pan of your BIX member sh ip

• Microbytes daily:

Get up-to-the-mrute industry news and re* *' product information by joining Microbytes Daily and What s New Hardware and Software

• Public domain software.

Yours for the downloading, including programs from BYTE articles and a growing library of PD listings.

• Electronic mail:

Exchange private messages with BYTE editors and authors and other BIX users.

BIX User's Manual and Subscriber Agreement as Soon as We've Processed Your Registration. JOIN THE EXCITING WORLD OF BIX TODAY!

• Vendor support:

A growing number of microcomputer manufacturers use BIX to answer your questions about their products and how to use them for peak performance.

What BIX Costs. .How You Pay

ONE-TIME REGISTRATION FEE: S25

Hourly

Charges:

(Your Time of Accessl

Off-Peak

6PM-7AM

Weekdays Pius Weekends & Holidays

Peak

7AW-oP*i

Weetdays

Join BIX Right Now:

Set your computer's telecommunications program for full duplex. 8-bit characters, even parity. 1 stop bit OR 7-bit characters ever, parity 1 stop using 300 or 1200 baud

Ci ~ ~ ~z tiz: - z a ■: r.vs

zsssucrz ms C£T 3X leer—’ere

< > sagr. <CR>

: x <CR>

*-e. <CR>

Note 1

Note 2

Note 3

Note 4

Note 5

Note 6

Note 7

Note 8

Note 9

afrgry wrE/wi ly taken to

AeHXirereflrefere9BereriaB9Bi reagthe system

a;:: or caa Pa terrere I- - =. ...

r - . - i

: :: < j> asr -*■ <15 > s. re rrrr-pts.

El\

TABLE OF CONTENTS

April.5

May.55

June.153

1986 Editorial Index.183

WELCOME TO BYTE’S QUARTERLY LISTINGS SUPPLEMENT

The BYTE Listings Supplement is produced quarterly as a means of providing interested readers with a printed, source code version of those programs referenced in BYTE articles. It provides a for more extensive look into the techniques of coding and the potentialities of microcomputers than we have space for in each month’s BYTE.

Programs contained in this Supplement are referenced by the month the article appeared, the page on which their supporting article begins, and the name of the author who wrote the article.

For those who prefer programs already in electronic format, we have a companion service called Listings on Disk. If you have a modem, listings may be downloaded from the BYTEnet bulletin board and, if you are a member of BIX, the “Listings” area also contains programs referenced in BYTE.

If you live outside of the U.S., we’ve included the names, addresses and telephone numbers of bulletin boards that get program code from us. You’ll find the directory just inside the back cover of this Supplement.

The bulletin boards are updated monthly. Several countries have enough boards that the telephone charges for most callers should be the minimum possible.

Chapter Notes

BIX $9 S':2

Tymnet* S2 S6

TOTAL SI 1/hr. SI8hr.**

• Continental US. BIX is accessible via Tummt frm -s.rmgrou: :<y .5 z .-u-zs much less than regular long distance. Call the BIX helpline r iset aec* for the Tumnel number near you or Tymnet at 1-800-336-: ,i9

• * User is billed for time on system He. Vi Hr. Offbeat - Sr 1 : jnm

BIX and Tymnet charges billed by Visa or M aserca’i only.

BIX Helpline

(8:30 AM-11:30 PM Eastern Weekdays

U.S. (except NH1-1-800-2 2 7-BYTE Elsewhere i603| 924-7681

BYTE

EDITORIAL DIRECTOR, BYTE and BIX

Philip Lemmons

EXECUTIVE EDITOR, BYTE Frederic S. Lange

ASSISTANT MANAGING EDITOR

Qlenn Hartwig CONSULTING EDITORS Steve Ciarcia Jerry Pournelle Ezra Shapiro Bruce Webster SENIOR TECHNICAL EDITORS Cathryn Baskin, Reviews Q. Michael Vose, Themes Gregg Williams, Features TECHNICAL EDITORS Dennis Allen Richard Grehan Ken Sheldon George A. Stewart Jane Morrill Tazeiaar Tom Thompson Charles D. Weston Eva White Stanley Wszola

ASSOCIATE TECHNICAL EDITORS

Curtis Franklin Jr.

Margaret Cook Gurney, Book Reviews

COPY EDITORS

Lauren Stickler, Copy Administrator

Judy Connors-Tenney

Jeff Edmonds

Nancy Hayes

Cathy Kingery

Margaret A. Richard

Warren Williamson

ASSISTANTS

Peggy Dunham, Office Manager Martha Hicks L. Ryan McCombs JuneN. Sheldon

NEWS AND TECHNOLOGY

Gene Smarte, Bureau Chief. Costa Mesa

Jonathan Erickson, Senior Technical Editor.

San Francisco

Rich Malloy, Senior Technical Editor. New York Nicholas Baran, Associate Technical Editor.

San Francisco

Cindy Kiddoo, Editorial Assistant. San Francisco

ASSOCIATE NEWS EDITORS

Dennis Barker, Microbytes

Anne Fischer Lent, What's New

Stan Miastkowski, What's New. Best of BIX

CONTRIBUTING EDITORS Jonathan Amsterdam, programming projects Mark Dahmke, video, operating systems Mark Haas, at large

Rik Jadrnicek, CAD, graphics, spreadsheets Robert T. Kurosaka, mathematical recreations Alastair J.W. Mayer, software Alan R. Miller, languages and engineering Dick Fountain, U.K.

Roger Powell, computers and music Phillip Robinson, semiconductors Jon Shiell, high-performance systems

ART

Nancy Rice, Art Director

Joseph A. Gallagher, Assistant Art Director

Jan Muller, Art Assistant

Alan Easton, Drafting

PRODUCTION

David R. Anderson, Production Director Denise Chartrand Michael J. Lonsky Virginia Reardon

TYPOGRAPHY

Sherry McCarthy, Chief Typographer Selinda Chiquoine Donna Sweeney

EXECUTIVE EDITOR. BIX George Bond

SENIOR EDITOR

David Betz

ASSOCIATE EDITORS

Tony Lockwood

Donna Osgood, San Francisco

MICROBYTES DAILY

Dennis Barker, Coordinator. Peterborough

Gene Smarte, Bureau Chief. Costa Mesa

Nicholas Baran, San Francisco

Rick Cook, Phoenix

Jonathan Erickson, San Francisco

Martha Hicks, Peterborough

Anne Fischer Lent, Peterborough

Larry Loeb, Wallingford. CT

Rich Malloy, New York

Brock N. Meeks. La Mesa. CA

Jeff Merron, Peterborough

Stan Miastkowski, Peterborough

Lynne Nadeau, Peterborough

Wayne Rash, Washington. DC

William Webb. Peterborough

GROUP MODERATORS

David Allen, Applications

Frank Boosman, Artificial Intelligence

Leroy Casterline, Other

Marc Greenfield, Programming Languages

Jim Howard, Graphics

Gary Kendall, Operating Systems

Steve Krenek, Computers

Brock N. Meeks, Telecommunications

Barry Nance, New Technology

Donald Osgood, Computers

Sue Rosenberg, Other

Jon Swanson, Chips

BUSINESS AND MARKETING

Doug Wbbster, Director (603-924-9027)

Patricia Bausum, Secretary

Denise A. Greene, Customer Service

Brian Warnock, Customer Service

Tammy Burgess, Customer Credit and Billing

TECHNOLOGY

Clayton Lisle, Director

Business Systems Technology. MHIS

Bill Garrison, Business Systems Analyst

Jack Reilly, Business Systems Analyst

Officers of McGraw-Hill Informition Systems Company: President: Richard B. Miller. ■ ■nil Executive Vice Presidents: Frederick P. Jannott. Construction Information Group; Russell C. White. Computers and Communications Information Group; J. Thomas Ryan. Marketing and International. Senior Vice Presidents: Francis A. Shinal. Controller; Robert C. Violette, Manufacturing and Technology. Senior Vice Presidents and Publishers: Laurence Altman, Electronics; Harry L. Brown. BYTE; David J. McGrath. Construction Publications. Group Vice President: Peter B McCuen, Communications Information. Vice President: Fred O. Jensen, Planning and Development.

Officers of McGraw-Hill, Inc.: Harold W. McGraw, Jr.. Chairman; Joseph L. Dionne. President and Chief Executive Officer; Robert N. Landes. Executive Vice President and Secretary; Valter D. Serwatka. Executive Vice President and Chief Financial Officer. Shel F. Asen. Senior Vice President. Manufacturing. Robert J. Bahash. Senior Vice President. Finance and Manufacturing; Ralph R. Schulz. Senior Vice President. Editorial; George R. Elsinger, Vice President. Circulation; Ralph J. Webb. Vice President and Treasurer.

BYTE. Evn and The Small Systems Journal are registered trademarks of McGraw-Hill Inc.

EDITORIAL AND BUSINESS OFFICE: One Phoenix Mill Lane. Peterborough. New Hampshire 03458.(603)924-9281.

West Coast Offices: 425 Battery St., San Francisco. CA 94111, (415) 954-9718; 3001 Red Hill Ave.. Building #1. Suite 222. Costa Mesa. CA 92626, (714) 557-6292. New York Editorial Office: 1221 Avenue of the Americas. New York. NY 10020.(212)512-3175.

BYTEnet: (617) 861 -9764 (set modem at 8-1 *N or 7-1 -E. 300 or 1200 baud)

BYTE (ISSN 0360-5280) is published monthly with additional issues tn June and October by McGraw-Hill Inc Founder James H McGraw (1860-1948) Executive, editorial, circulation, and advertising offices: One Phoenix Mill Lane. Peterborough. NH 03458. phone (603) 924-9281 Office hours: Monday through Thursday 8:30 AM-4:30PM, Friday 8:30 AM-1:00 PM. Eastern Tune. Address subscriptions to BYTE Subscriptions P.O. Box 590. Martinsville. NJ 08836. Postmaster send address changes. USPS Form 3579. undeliveribk copies, and fulfillment questions to BYTE Subscriptions. P O Box 596. Martinsville. NJ 08836. Secondclass postage paid at Peterborough. NH 03458 and additional mailing offices. Postage paid at Winnipeg. Manitoba Registration number 9321. Subscriptions are S22 for one year. $40 for two years, and S58 foe three years in the U.S. and its possessions. In Canada and Mexico. S25 for one year. $45 for two years. S65 for three years. $69 for one year air delivery to Europe 31.000 yen for one year air delivery to Japan. 15.600 yen for one year surface delivery to Japan, $37 surface delivery elsewhere. Air delivery to selected areas at additional rates upon request Single copy price is $3.50 in the U.S. and its possessions. $4 25 in Canada and Mexico. $4.50 in Europe, and $5 elsewhere. Foreign subscriptions and sales should be remitted in U.S. funds drawn on aUS bank Please allow six to eight weeks for delivery of first issue Printed in the United States of America

Address editorial correspondence to: Editor. BYTE. One Phoenix Mill Lane. Peterborough. NH 03458. Unacceptable manuscripts will be returned if accompanied by sufficient postage. Not responsible fix lost

manuscripts or photos. Opinions expressed by the authors are not necessarily those of BYTE

Copyright © 1987 by McGraw-Hill Inc. All rights reserved Trademark registered in the United States Patent and Trademark Office. Where necessary. permission is granted by the copy right ow ner for libraries and others registered with the Copyright Clearance Center (CCC) to photocopy any article herein for the fiat fire of $1 50 per copy of the article or any part thereof Correspondence and pay ment should be sent directly to the CCC. 29 Congress St.. Salem. MA 01970. Specify ISSN 0360-5280 83. $1.50 Copying done for other than personal or internal reference use without the permission of McGraw -Hill Inc. is prohibited Requests for special permission or bulk orders should be addressed to the publisher. BYTE is available in microform from University Microfilms International. 300 North Zeeb Rd.. Dept PR. Ann Arbor. Ml 48106 or 18 Bedford Row. Dept. PR. London WC1R 4EJ. England. Subscription questions or problems should be addessed to: BYTE Subscriber Service. P.O Box 328. Hancock. NH 03449

2 BYTE LISTINGS SUPPLEMENT • APRIL-JUNE, 1987

INDEX

April

386 TXT.5

BOYER LSP. 16

BROWSE LSP.23

DERTV LSP.26

DESTRUCT LSP.26

DIV LSP.27

EXE LSP.28

FRPOLY LSP.29

10 LSP.31

LISTING BIX.12

LOOP LSP.32

PUZZLE LSP.36

READ ME.16

SIEVE ASM.6

SIEVE386 ASM.9

TAK LSP.38

TIMING LSP.48

TRAVERSE LSP.50

TRIANG LSP.52

May

ADVAVL H 56

ADVAVL C 87

ADVCOM H .55

ADVCOM C .59

ADVDBS H .57

ADVDBS C .99

ADVEXE C .109

ADVEXP C .79

ADVFCN C .67

ADVFIO C 89

ADVINT H 90

ADVINT C .106

ADVJUNK C .108

ADVMSG C .91

ADVPRS C . 95

ADVSCN C .75

ADVSYS DOC.114

ADVTRM C .92

LIST1 PS .147

LIST2 PS .147

LIST3 PS .148

LIST4 PS .148

LIST5 PS .149

LISTINGS DOC.135

OBJECTS ADI.128

OSAMPLE ADV.126

PULLDOWN C .136

README 1ST.55

June

BENCH OBJ.180

CLOCKSET ASM.156

COMPRESS PAS.177

EXPAND PAS.177

LISTING 1 BAS.153

LISTING2 BAS.154

LISTING3 BAS.155

LISTING4 BAS.156

POLYFIT BAS.178

TIMESET ASM.171

1986 Index

.183

BYTE LISTINGS SUPPLEMENT • APRIL-JUNE. 1987 3

386.TXT Contributed by: Rick Grehon

TEXT from "Reviewer’s Notebook," April 1987, page 201. Explanatory text, including a discussion of benchmarks developed by Rick Grehan.

HIGH C FROM METAWARE AND 80386 SOFTWARE DEVELOPMENT SERIES FROM PHAR LAP

The High C compiler from MetaWare, Inc. (903 Pacific Ave., Suite 201, Santa Cruz, CA 95060-4429) is now in release 1.3 that produces code for execution on an 80386 In protected mode. I tested the compiler on a Compaq Deskpro 386 running Compaq’s DOS version 3.10.

High C programs may be configured to generate a variety of memory models: small, compact, medium, big, and large. On the low end, the small model requires that the code generated be less than 64K bytes (the code segment register remains fixed) - likewise, the program’s data (including stack and heap) must fit within a 64K-byte segment. The large model permits the code segment register to be mobile, so that executable code may be greater than 64K bytes. Also, the DS (data segment) and ES (extra segment) registers are dynamic, permitting greater than 64K worth of data and heap space (only the stack is limited to 64K), The models between small and large incorporate combinations of static and dynamic code and data segments, so that from this selection, you should be able to choose a model that best suits your application. (The 80386 version of the compiler we tested currently only incorporates a version of the small memory model.)

The list of Hich C’s features are quite extensive, and include:

* The ability to generate source code that can be tailored for use with assemblers.

* Provides extensive compiler checking normally found in "lint" programs. Also includes type checking as specified in ANSI C.

* Includes support for the 8087 and the 80287 math coprocessor chips. Special routines in the compiler detects the presence of a math coprocessor and sets a toggle that can be used to control compilation.

* There are two object files provided with the High C compiler that, when linked with your program, generate post mortem dumps. One file contains code to dump the contents of the heap in the event of an error condition - the other will display the call-chain of currently active functions.

* High C programs can make use of ’pragmas* - statements for controlling compiler parameters. For example, you can specify a directory search path, alter or re-instate compiler switches, perform conditional source-file includes, and more.

Documentation for High C consists of a thick three-ring binder divided into three general sections: a programmer’s guide, a library reference manual, and a language reference manual. Each section is well indexed, and there appear to be a fair number of code fragments Included as examples. (The software we received came with a demonstration .BAT file that compiled and executed three example programs.)

To execute code in protected mode, we used Phar Lap Software’s 386LINK and RUN386 programs. Execution time was so small that it was obvious the Compaq was spending more time loading the programs than executing them.

386LINK and RUN386 are part of Phar Lap Software, Inc.’s (60 Aberdeen Ave., Cambridge, MA 02138) 80386 Software Development Series. This package consists of the 386ASM assembler, the 386LINK linker, the MINIBUG debugger, and RUN386 runtime environment. Versions of this package are available for the IBM PC, IBM PC/AT, VAX/VMS and a number of UNIX systems; the version we tested was running on a Compaq 386 Deskpro running Compaq’s DOS version 3.10.

386ASM is a full-featured macro assembler with enough option switches to allow generation of code for practically every Intel processor since the 8088 (8088, 8086, 80186, 80286, and 80386). You can also assemble Instructions for either the 80287 or 8087 numeric coprocessors. In operation, 386LINK acts much like any other linker, combining object files to create an MS-DOS .EXE file (you can optionally output the program In Intel hex file format).

continued

BYTE LISTINGS SUPPLEMENT • APRIL-JUNE. 1987 5

April

The MINIBUG debugger allows debugging of 80386 programs In either real mode or protected mode. It can be run on MS-DOS, can manage up to 4 breakpoints, and boasts commands similar to the standard MS-DOS/PC-DOS DEBUG program, Additonolly, MINIBUG Incorporates an online help screen that Is Invoked by entering a questIonmark.

RUN386 creates an 80386 protected-mode runtime environment within MSDOS. This means that programmers may work within the familiar MS-DOS world, creating applications that make full use of the 80386*8 power plus enjoy access to the standard MS-DOS system calls. (Some system calls are not supported: specifically, those Involving memory allocation and Interrupt vector manipulation.) RUN386 initializes necessary descriptors, loads the application Into memory, switches Into protected mode, and passes control to the application program. RUN386 will also transfer command line arguments to the application, and intercept all hardware interrupts to pass them along to standard interrupt handlers.

We rewrote the C version of the sieve program Into 80386 assembler and ran it through 386ASM, 386LINK, and RUN386. Assemble time was less than 4 seconds, link time was less than 2, and execute time was so short that in order to make measurements we had to Increase the number of iterations from 10 to 50. We then measured the program's execution time at 3.5 seconds.

Phar Lap * 8 386ASM manual was in second draft when we received It, and weighed In at 238 pages with no index (we sincerely hope they include one).

The 386LINK, MINIBUG, and RUN386 manuals were In better shape - being 62. 54, and 21 pages, respectively (and with indices).

TABLE 1

CompiIe/LInk F1 Ie S1 ze Time (sec) (bytes)

Execute Time (sec)

Sieve 14/21 34896 <1

Sort 15/21 30888 1

Table 1. Peformance benchmarks for High C compiler. The generated code was executed using Phar Lap Software, Inc.’s RUN386 program that allows 80386 protected-mode programs to run within an MS-DOS environment.

SIEVE.ASM Contributed by: Rick Grehan

TEXT "Reviewer's Notebook," April 1987, page 201. This is one of the benchmarks developed by Rick Grehan.

80386 assembly version of sieve program.

Prints out the number of primes found in hexadecimal. (Printing out the number of primes found in decimal is left as an exercise for the reader.)

Table captionFirst define constants

ITERVAL

equ

50 -.Iteration count

TRUE

equ

1

FALSE

equ

0

ASIZE

equ

8190 ;Array size

assume

cs:sieve , ds:sdata

s i eve

segment

para public use32 'code*

pub 1ic

_start_

; *** ENTRY

POINT ***

_start_

proc

near

Tell user we are beginning the program

lea ebx,startmsg

cal I printmsg

6 BYTE LISTINGS SUPPLEMENT • APRIL-JUNE. 1987

;Number of Iteration*

April

; Setup loop counter

mov ax,ITERVAL

mov Iter,ax

Table captioni

Table caption; Initialize counter for number of primes

L0:

xor

eax.eax

mov

count,ax

t

; Set al1

flags

true

1 ea mov

ebx,f1ags ecx,ASIZE+1

LI:

mov

Inc

byte ptr[ebx],TRUE ebx

loop

LI

$

; Primary

loop

mov

index,eax

L2:

mov

mov

or

J2

ebx,index al,flags[ebx] al ,al

L5

;Is It a prime?

5 Found a prime

mov eax,ebx ;Twice Index plus 3

odd eax,ebx

add eax,3

; Kill

all multiples

L3:

add

cmp

J9

Jmp

:

; Count

number of pr

L4:

Inc

L5:

Inc

Table captioncmp

Table captionJne

S

; Do another Iteration dec jnz

ebx,eax

ebx.ASIZE

L4 mov

L3

word ptr count

dword ptr index

dword ptr index,ASIZE+1

L2

word ptr Iter L0

Print out number of primes For now, In hex

lea ebx.npmsg

ca11 prIntmsg

mov ax,count

call hwout

Terminate process mov int

ax,04C00h 21H

byte ptr fIagsfebx].FALSE

_start_ endp

THE FOLLOWING CODE WAS INCLUDED WITH THE PHAR LAP 386ASM/ 386LINK PACKAGE AS PART OF DEMO SOFTWARE.

prlntmsg - Print a message to the screen

ebx - Points to the message to must be null terminated.

prlntmsg proc

near

push

edx

pml: mov

d 1, [ebx]

or

d 1 ,d 1

Je

pm3

be printed out. The message

; Save EDX.

; Load the next character Into DL and ; branch if null.

continued

BYTE LISTINGS SUPPLEMENT • APRIL-JUNE, 1987 7

mov

int

ah,02h

21h

; Output the character.

•

cmp

jne

mov

mov

int

byte ptr [ebx],0ah pm2

ah,02h d1,0dh

21h

; If the character is a LF, then ; also output a CR.

•

S

S

pm2:

pm3:

add

Jmp

pop

ret

ebx, 1

pml

edx

; Increment the message pointer and ; loop.

; Restore EDX and return.

»

prlntmsg endp

i

•

»

•

•

hwout

- Output the hex word

In AX to the screen

hwout

proc

near

•

push ror ca 1 1

ax

ax .8 hbout

; Output the high byte of the word.

•

i

pop cal 1

ax

hbout

; Output the low byte of the word.

!

ret

; Return.

hwout

endp

i

i

•

i

hbout

- Output the hex byte

In AL to the screen

hbout

proc

near

•

push ror ca 11

ax

ax, 4 hdout

; Output the high digit of the byte

•

s

pop cal 1

ax

hdout

; Output the low digit of the byte.

s

ret

; Return.

hbout

endp

hdout - Output the hex digit in AL to the screen

hdout

proc

near

hdl:

and

cmp

J9

add

add

ax,0fh ax,10 hdl

al,*0'-*A , +10 a 1,•A*-10

Zap any extra bits and translate to ASCII.

push

mov

int

pop

dx

d 1, a 1

21h

dx

Call MS-DOS to output the digit, mov ah,2h

ret

; Return.

hdout

endp

s i eve

ends

8 BYTE LISTINGS SUPPLEMENT • APRIL-JUNE. 1987

sdata

segment

para public use32 'data'

startmsg

db

'Beginning sieve.',0dh.0ah,0

npmsg

db

'Number of primes:',0

f 1 ags

db

ASIZE+1 dup (?)

index

dd

?

i ter

dw

?

count

dw

?

sdata

ends

_stack

segment

byte stack use32 'stack*

db

8000 dup (?)

_stack

ends

end

SIEVE386.ASM Contributed by: Rick Grehan

TEXT "Reviewer * s Notebook," April 1987, page 201. Another of the benchmarks developed by Rick Grehan.

80386 assembly version of sieve program.

Prints out the number of primes found in hexadecimal. (Printing out the number of primes found In decimal is left as an exercise for the reader.)

Table captionFirst define constants

ITERVAL

equ

50 iteration count

TRUE

equ

1

FALSE

equ

0

ASIZE

equ

8190 ;Arroy size

assume

cs:8leve,ds:sdata

s i eve

segment

para public use32 'code'

publIc

_start_

; *** ENTRY

POINT ***

_8tart_

proc

near

Table caption»

Table caption; Tell user we are beginning the program;

Table captionlea ebx,8tartmsg

Table captioncall printmsg

; Setup loop counter mov mov

ax,ITERVAL iter,ax

;Number of Iterations

; Initialize counter for number of primes L0: xor eax,eax

mov count,ax

; Set all fIags true I ea mov

LI: mov

tnc loop

i

; Primary loop

mov

L2: mov

mov or

J*

ebx,fIags

ecx,ASIZE+1

byte ptr[ebx],TRUE

•bx

LI

index.eax ebx,index al,fIags[ebx] al ,al L5

;Is It a prime?

continued

BYTE LISTINGS SUPPLEMENT • APRIL-JUNE. 1987 9

; Found a prime

mov eax.ebx ;TwIce Index plus 3

add eax.ebx

add eax,3

Table caption•

Table caption; Kill all multiples

L3:

add

ebx,sax

cmp

ebx,ASIZE

Jg

L4

mov

byte ptr f1ags[ebx].FALSE

Jmp

L3

•

; Count number of primes

L4:

Inc

word ptr count

L5:

Inc

dword ptr Index

cmp

dword ptr Index,ASIZE+1

Jne

L2

•

; Do another Iteration

dec

word ptr Iter

Jn2

L0

1

; Print out

number of

primes

; For now,

In hex

lea

ebx.npmsg

cal 1

pr tntmsg

mov

ax,count

cal 1

hwout;

; Terminate

process

mov

ax,04C00h

Int

21H

.start.

endp

THE FOLLOWING CODE WAS INCLUDED WITH THE PHAR LAP 386ASM/

386LINK PACKAGE AS PART OF DEMO SOFTWARE.

prlntmsg - Print a message to the screen

ebx - Points to the message to be printed out. The message must be null terminated.

Table captionprlntmsg proc near

push

edx

pml:

mov

d1,[ebx]

or

d 1, d I

J*

pm3

mov

ah,02h

21h

Int

cmp

byte ptr [ebx],0ah

Jne

pm2

mov

oh,02h

mov

dl,0dh

Int

21h

pm2:

add

ebx, 1

Jmp

pml

pm3:

pop

ret

edx

prlntmsg endp

Save EDX.

Load the next character Into DL and branch If null.

Output the character.

If the character Is a LF, then also output a CR.

«

Increment the message pointer and loop.

Restore EDX and return.

hwout - Output the hex word In AX to the screen

10 BYTE LISTINGS SUPPLEMENT • APRIL-JUNE, 1987

hwout proc near

hwout

push ror ca I I

pop cal I

ret

endp

ax

ax. 8 hbout

ax

hbout

; Output the high byte of the word.

i

i

; Output the low byte of the word.

»

; Return.

hbout - Output the hex byte in AL to the screen

hbout

proc

near

i

push

ax

; Output the high digit

of the byt<

ror

ax, 4

!

call

hdout

1

pop

ax

; Output the low digit of the byte

cal 1

hdout

*

ret

; Return.

hbout

endp

»

•

»

hdout

- Output

the hex

digit in AL to the screen

hdout

proc

near

and

ax,0fh

; Zap any extra bits and

1 translate

cmp

ax, 10

; to ASCII.

Jg

hdl

»

add

a 1, *0*

’A* + 10

•

hdl:

add

al,’A’

10

•

push

dx

; Call MS-DOS to output

the digit.

mov

dl ,al

•

mov

ah ,2h

•

int

21 h

»

pop

dx

•

ret

; Return.

hdout

endp

s i eve

ends

sdata

segment

para public use32 ’data’

startmsg

db

’Beginning sieve.’,0dh,0ah,0

npmsg

db

’Number

of primes:*,0

f lags

db

ASIZE+1

dup (?)

index

dd

?

iter

dw

?count

dw ?

sdata

ends

.stack

segment

byte stack use32 ’stack*

db

8000 dup (?)

.stock

ends

end

continued

BYTE LISTINGS SUPPLEMENT • APRIL-JUNE, 1987 11

LISTING.BIX Contributed by: Mukkof S. KrIshnamoorthy and Snorri Agnarsson TEXT Programming Project: "Concurrent Programming in Turbo Pascal," by Mukkai S. Krishnamoorthy and Snorri Agnarsson,

April, 1987. All the files associated with this article.

{ NAME: newprocess EXAMPLE CALL:

p:-NewProcess(Ofs(proc),1000);

proc Is the parameter I ess procedure, from which the new process is created. The stack of the ^ new process p is 1000 bytes.

function NewProcess(prog: Integer; size: integer): Process;

var stack: ^integer;

begin

GetMem(stack,size);

MemWTSeg(stack*):0fs(stack*)+size-10]:*prog;

MemW[Seg(stack*):0fs(stack*)+slze-12]:-0fs(stack*)+size-12;

NewProcess:«Ptr(Seg(stack*),0fs(stack*)+size-12);

end;

[ Listing 1. ]

; procedure transfer(var p1,p2: Process);

cseg

segment 'cgroup* assume cs:cseg

transfer

proc near

•

push

bp ;

Turbo 1

mov

bp»sp ;

—

*

pop

bp

: Al [bp]+4

les

bp.dword ptr

mov

ax.es:Tbpl+2 bx.es:[bp]

•

mov

i

mov

bp, sp

les

bp.dword ptr

[bp]+8

mov

es:[bpl,sp es:[bp]+2,ss

•

mov

•

mov

ss, ax

»

mov

sp.bx

s

mov

bp, sp

i

•

mov

sp.bp

; i

pop

bp

i

ret

8

•

»

transfer

endp

cseg

ends

Turbo Pascal generated prolog

; get address of p2 get segment part of p2 get offset part of p2 ; bp - point to parm's ; get address of pi store sp in offset part store ss In segment part new stack segment from p2 new stack pointer from p2 re-establish bp for epilog

; Turbo Pascal generated epilog

[ Listing 2a ]

procedure transfer(var p1,p2: process);

begin

iniine(

$50/ $C4/ $6E/ $04/ $26/ $88/ $46/ $02/ $26/ $8B/ $5E/ $00/ $88/ $EC/ $C4/ $6E/ $08/ $26/ $89/ $66/ $00/ $26/ $80/ $56/ $02/ $8E/ $D0/ $88/ $E3/ $8B/ $EC); end;

[ Listing 2b ]

cseg segment *cgroup*

assume cs:cseg

Inthandler proc near

Jmp start ; jump over data area

12 BYTE LISTINGS SUPPLEMENT • APRIL-JUNE, 1987

di

getbase:

cal I base: pop ret

; data area: newdsword stkoffeet stksegment procoffset

base ; subroutine to get base of data area.

pop address return with

of base Into di. offset of base in

di,

calloffset calIsegment savessword savespword newds newsp newss hand Ier cal Ier savess savesp start: push cal I mov mov mov mov push push push push push push push push mov

dw ? dw ? dw ? dw ?

dw ? dw ? dw ? dw ? ; word to save

equ newdsword-base equ stkoffset-base equ stksegment-base equ procoffset-base equ calloffset-base equ savessword-base equ savespword-base

data segment register for pascal offset of stack segment of stack for pascal offset of interrupt handler procedure ; segment of handler must be calIsegment offset of routine that makes short call segment of routine that makes short call word to save ss into sp into

offset from base to newdsword offset from base to stkoffset offset from base to stksegment offset from base to procoffset offset from base to calloffset offset from base to savessword offset from base to savespword

ptr

di

getbase word ptr cs word ptr cs ss.word ptr sp.word ax bx cx dx bp si es ds

ds.word bx.word

:[d! : [di cs: cs:

; save di

; get base of data area In di +saves8,ss ; save ss

♦savesp.sp ; save sp

di1+newss ; get new ss

dij+newsp ; get new sp

; save the rest of the registers

ptr

ptr

;[

di1+newds diJ+handler

mov

call dword ptr cs:[dl]+caI Ier

pop ds

pop es

pop s i

pop bp

pop dx

pop cx

pop bx

pop ax

caI I getbase

mov ss.word ptr cs

mov sp.word ptr cs

pop di

I ret

Inthandler endp

cseg ends

get ds for pascal get offset of handler long call to short caller restore alI registers and return from Interrupt

•i

di l+savess dij+savesp

Listing 3 ]

cseg

segment

’cgroup

assume

cs: cseg

shortcaller

proc

far

cal 1

bx

shortca11er

ret

endp

cseg

ends

[ Listing 4 ]

{ NAME: newioprocess EXAMPLE CALL:

p:■NewloProcess(Ofs(proc),1000); proc i8 the parameter I ess procedure, from which the new loprocess is created. The stack of the new loprocess p is 1000 bytes.

continued

BYTE LISTINGS SUPPLEMENT • APRIL-JUNE, 1987 13

I

function newioprocess(proc: Integer; size: integer): loprocess

procedure shortcutler;

begin

Iniine($FF/$D3/$CB); end;

const Inthandler: array[1..85] of (

$EB, $16, $90. $E8, $00, $00, $5F,

$ 00 , $ 00 . $ 00 , $ 00 . $ 00 , $ 00 , $ 00 ,

$57. $E8, $E7, $FF, $2E, $8C, $55,

$2E, $8E, $55, $06, $2E, $8B, $65.

$55. $56, $06, $1E, $2E, $8E, $5D,

$2E, $FF, $50, $0A, $1F, $07, $5E,

$E8, $88, $FF, $2E, $8E, $55. $0E,

$CF);

Table captionbyte

$C3.

$00.

$00,

$00.

$00.

$00,

$00.

$00.

$00.

$00,

$0E,

$2E.

$89,

$65.

$10.

$04,

$50.

$53.

$51,

$52,

$02,

$2E,

$8B,

$5D,

$08,

$50.

$5A,

$59.

$5B,

$58,

$2E,

$8B,

$65.

$10,

$5F,

Table captionvar area: ‘"'integer;

Table captionbegin

Table captionGetMem(area,sIze+85);

Movei

(inthandler,area^,85);

memw

[Segl

[area^l

1:Of 8(

Jarea^J

1+ 8’

memw

LSegl

Jarea^1

!:0fs<

farea^

1+10'

memw|

[Seg (

[area^J

!: 0 f s (

Jarea^

1+12'

memw

[Seg(

Jarea^l

1:Of 8(

Jareo^

1+14

memw

[Seg(

Jarea^j

):Of s(

area^l

>+16

memw|

[Seg(

Jarea^j

1 :0f s(

Jarea^j

1+18

Table captionnewloprocess:*area; end;

:«Dseg;

■Of s far ea^+s ize+85; ■Seg(area^);

■proc;

■Ofs(shortcaller)+12; ■Cseg;

[ Listing 5 ]

} NAME: IoAttach PARAMETERS:

‘Intnum* is an Interrupt number ^ ‘proc* is an loprocess created by newioprocess

procedure IoAttach(intnum: byte; proc: loprocess); var regs: record

ax,bx,cx,dx,bp,si,dl,ds,es,flags: Integer end;

begin

with regs do begin

ax:*$2500 + Intnum; | DOS function 25H sets an } ds:*Seg(proc^; } interrupt vector.

dx:*0fs(proc A ); end;

MsDos(regs); } request DOS function }

end;

[ Listing 6 ]

{$K-( j turn off checking for stack overflow } program multi test; type Process-^integer;

... | definitions of NewProcess k transfer \

var p1,p2: process;

procedure progl; begin

while true do begin wrlteln(*HI*); transfer(pi,p2); wr iteln(*He*); transfer(pi,p2); end; end;

14 BYTE LISTINGS SUPPLEMENT • APRIL-JUNE, 1987

procedure prog2; begin

while true do beg i n

wrIteIn(’Ho'); transfer(p2,p1); end; end;

var p0: process;

procedure main; begin

pi:«newprocessfofsfprog1 ) t 1000}; p2:«newprocess(ofs(prog2;,1000); transfer(p0,pi); end;

begin main end.

[ Listing 7a ]

Resulting output:

HI

Ho

He

Ho

HI

Ho

[ Listing 7b ]

|$K—| { turn of checking for stack overflow \

program Interrupttest; type IoProcess - ^Integer;

var count: integer;

var timerhandler: IoProcess;

... { definitions of NewloProcess and IoAttach }

procedure Incrementer; begin

count:*succ(count); end;

beg I n

timerhandIer:«NewIoProcess(Ofs(incrementer),1000);

count:=0;

IoAttach($1C,timerhandIer) while true do begin

wr iteln(count);

DeIay(100); end; end.

| attach timerhandler to user | timer Interrupt ( ICh )

{ delay 100 milliseconds (

continued

BYTE LISTINGS SUPPLEMENT • APRIL-JUNE, 1987 15

[ Listing 8a ]

Resulting output:

0

1

3

5

7

8 10 12

[Listing 8b]

READ.ME Contributed by: Ernest R. Tello

TEXT "The GCLISP 286 Developer," by Ernest R. Tello. April 1987, page 242.

These benchmarks are for Gold HI I I Common LISP 286 Developer.

This LISP implementation runs on an IBM PC AT; the Interpreter requires at least 1.5 megabytes of memory; the compiler requires at least 3 megabytes of memory. You should first load the file TIMING.LSP. This file contains functions for loading, compiling, and running the benchmarks.

BOYER.LSP Contributed by: Ernest R. Tello

TEXT "The GCLISP 286 Developer," by Ernest R. Tello. April 1987, page 242.

; BOYER

i defvar unlfy-subst) defvar temp-temp)

(DEFUN ADD-LEMMA (TERM)

(COND ((AND (NOT (ATOM TERM))

(EQ (CAR TERM)

(QUOTE EQUAL))

(NOT (ATOM (CADR TERM))))

;; This change lets you run setup several times.

(unless (member term (get (car (cadr term)) ‘lemmas) :test #’equal) (SETF (GET (CAR (CADR TERM)) (QUOTE LEMMAS))

(CONS TERM (GET (CAR (CADR TERM)) (QUOTE LEMMAS))))))

(T

(error "Add lemma did not like term")

)))

(DEFUN ADD-LEMMA-LST (LST)

(COND ((NULL LST)

T)

(T (ADD-LEMMA (CAR LST))

(ADD-LEMMA-LST (CDR LST)))))

(DEFUN APPLY-SUBST (ALIST TERM)

(COND ((ATOM TERM)

(COND ((SETQ TEMP-TEMP (ASSOC TERM ALIST))

(CDR TEMP-TEMP))

(T TERM)))

(T (CONS (CAR TERM)

(APPLY-SUBST-LST ALIST (CDR TERM))))))

16 BYTE LISTINGS SUPPLEMENT • APRIL-JUNE, 1987

(DEFUN APPLY-SUBST-LST (ALIST LST)

(COND ((NULL LST)

NIL)

(T (CONS (APPLY-SUBST ALIST (CAR LST))

(APPLY-SUBST-LST ALIST (COR LST))))))

(DEFUN FALSEP (X LST)

(OR (EQUAL X (QUOTE (F)))

(MEMBER X LST)))

(DEFUN ONE-WAY-UNIFY (TERM1 TERM2)

(PROGN (SETQ UNIFY-SUBST NIL)

(ONE-WAY-UNIFY1 TERM1 TERM2)))

(DEFUN ONE-WAY-UNIFY1 (TERM1 TERM2)

(COND ((ATOM TERM2)

(COND ((SETQ TEMP-TEMP (ASSOC TERM2 UNIFY-SUBST)) (EQUAL TERM1 (CDR TEMP-TEMP)))

(T (SETQ UNIFY-SUBST (CONS (CONS TERM2 TERM1)

UNIFY-SUBST))

„ T)»

((ATOM TERM1)

NIL)

((EQ (CAR TERM1)

(CAR TERM2))

(ONE-WAY-UNIFY1-LST (CDR TERM1)

(CDR TERM2)))

(T NIL)))

(DEFUN ONE-WAY-UNIFY1-LST (LST1 LST2)

(COND ((NULL LST1)

T)

((ONE-WAY-UNIFY1 (CAR LST1)

(CAR LST2))

(ONE-WAY-UNIFY1-LST (CDR LST1)

(CDR LST2)))

(T NIL)))

(DEFUN REWRITE (TERM)

(COND ((ATOM TERM)

TERM)

(T (REWRITE-WITH-LEMMAS (CONS (CAR TERM)

(REWRITE-ARGS (CDR TERM))) (GET (CAR TERM)

(QUOTE LEMMAS))))))

(DEFUN REWRITE-ARGS (LST)

(COND ((NULL LST)

NIL)

(T (CONS (REWRITE (CAR LST))

(REWRITE-ARGS (CDR LST))))))

(DEFUN REWRITE-WITH-LEMMAS (TERM LST)

(COND ((NULL LST)

TERM)

((ONE-WAY-UNIFY TERM (CADR (CAR LST)))

(REWRITE (APPLY-SUBST UNIFY-SUBST (CAODR (CAR LST))))) (T (REWRITE-WITH-LEMMAS TERM (CDR LST)))))

(DEFUN SETUP ()

(ADD-LEMMA-LST

(QUOTE ((EQUAL (COMPILE FORM)

(REVERSE (CODEGEN (OPTIMIZE FORM)

(NIL))))

(EQUAL (EQP X Y)

(EQUAL (FIX X)

(FIX Y)))

(EQUAL (GREATERP X Y)

(LESSP Y X))

(EQUAL (LESSEQP X Y)

(NOT (LESSP Y X)))

(EQUAL (GREATEREQP X Y)

(NOT (LESSP X Y)))

continued

BYTE LISTINGS SUPPLEMENT • APRIL-JUNE, 1987 17

(EQUAL

(EQUAL

(EQUAL

(EQUAL

(EQUAL

(EQUAL

(EQUAL

(EQUAL

(EQUAL

(EQUAL

(EQUAL

(EQUAL

(EQUAL

(EQUAL

(EQUAL

(EQUAL

(EQUAL

(BOOLEAN X) (OR (EQUAL X (EQUAL X (IFF X Y) (AND “

P)l>]

(IMPLIES X Y1 (IMPLIES Y X] (EVEN1 X)

IF '

))

(ZEROP X)

(T)

(ODD (1- X)»)

(COUNTPS- L PRED) (COUNTPS-LOOP L PRED (ZERO))) (FACT- I)

(FACT-LOOP I 1))

(REVERSE- X)

(REVERSE-LOOP X (NIL))) (DIVIDES X Y)

(ZEROP (remainder Y X))) (ASSUME-TRUE VAR ALIST)

(CONS (CONS VAR (T))

ALIST))

(ASSUME-FALSE VAR ALIST)

(CONS (CONS VAR (F))

ALIST))

(TAUTOLOGY-CHECKER X) (TAUTOLOGYP (NORMALIZE X) (NIL)))

(FALSIFY X)

(FALSIFY1 (NORMALIZE X) x (NIL)))

(PRIME X)

(AND

(AND P (IF P (IF

NOT (ZEROP X))

NOT (EQUAL X (ADD1 (ZERO)))) PRIME1 X (1- X))))

Q)

Q (T)

(F))

(OR

(IF

(F)))

P Q)

P (T)

(IF Q

(r»r H

(T)

(F)

(NOT P) (IF P '

, (T))) (IMPLIES (IF P

P Q)

(IF Q (T)

(T))) F))

(FIX X)

(if (NUMBERP X) X

(EQUAL

(EQUAL

(EQUAL

(EQUAL

(EQUAL

(EQUAL

(ZERO)))

(IF (IF ABC)

D E)

(IF A (IF B D E)

(IF C D E)))

(ZEROP X)

(OR (EQUAL X (ZERO)) (NOT (NUMBERP X)))) (PLUS (PLUS X Y)

Z)

(PLUS X (PLUS Y Z))) (EQUAL (PLUS A B) (ZERO))

(AND (ZEROP A)

(ZEROP B))) (DIFFERENCE X X)

(ZERO))

(EQUAL

(EQUAL

PLUS A B' (PLUS A C’ (FIX B) (FIX C)))

I)

18 BYTE LISTINGS SUPPLEMENT • APRIL-JUNE, 1987

(EQUAL

(EQUAL

(EQUAL

(EQUAL

(EQUAL

(EQUAL

(EQUAL

(EQUAL

(EQUAL

(EQUAL

(EQUAL

(EQUAL

(EQUAL

(EQUAL

(EQUAL

(EQUAL

(EQUAL

(EQUAL

(EQUAL

(EQUAL

(EQUAL

(EQUAL

(EQUAL

X Y))

(EQUAL (ZERO)

(DIFFERENCE X Y))

(NOT (LESSP Y X)))

(EQUAL X (DIFFERENCE X Y))

(AND (NUMBERP X)

(OR (EQUAL X (ZERO))

(ZEROP Y))))

(MEANING (PLUS-TREE (APPEND A)

(PLUS (MEANING (PLUS-TREE X)

A)

(MEANING (PLUS-TREE Y)

A)))

(MEANING (PLUS-TREE (PLUS-FRINGE X)) A)

(FIX (MEANING X A)))

(APPEND (APPEND X Y)

Z)

(APPEND X (APPEND Y Z)))

(REVERSE (APPEND A B))

(APPEND (REVERSE B)

(REVERSE A)))

(TIMES X (PLUS Y Z))

(TIMES

(EQUAL

(OR

)

Y 2))) Y)

(PLUS (TIMES X Y)

(TIMES X Z)

(TIMES (TIMES X Y)

Z)

X (TIMES (TIMES X (ZERO))

(ZEROP X)

(ZEROP Y)))

(EXEC (APPEND X Y)

PDS ENVRN)

(EXEC Y (EXEC X PDS ENVRN) ENVRN))

(MC-FLATTEN X Y)

(APPEND (FLATTEN X)

Y))

(MEMBER X (APPEND A B))

(OR (MEMBER X A)

(MEMBER X B)))

(MEMBER X (REVERSE Y)) (MEMBER X Y))

(LENGTH (REVERSE X)) (LENGTH X))

(MEMBER A (INTERSECT B C))

(AND (MEM8ER (MEMBER (NTH (ZERO)

(ZERO)]

(EXP I (TIMES

c]))

PLUS J K)) EXP I J)

EXP I K))) TIMES J K))

J)

(EXP I (EXP (EXP I «))

(REVERSE-LOOP X Y)

(APPEND (REVERSE X)

Y))

(REVERSE-LOOP X (NIL))

(REVERSE X))

(COUNT-LIST Z (SORT-LP X Y)) (PLUS (COUNT-LIST Z X)

(COUNT-LIST Z Y)))

(EQUAL (APPEND A B)

(APPEND A C))

(EQUAL B C))

(PLUS (REMAINDER X Y)

(TIMES Y (QUOTIENT X Y))) (FIX X))

continued

BYTE LISTINGS SUPPLEMENT • APR1L-JUNE. 1987 19

(EQUAL

(EQUAL

(EQUAL

(EQUAL

(EQUAL

(EQUAL

(EQUAL

(EQUAL

(EQUAL

(EQUAL

(EQUAL

(EQUAL

(EQUAL

(EQUAL

(EQUAL

(EQUAL

(EQUAL

(EQUAL

(EQUAL

(EQUAL

(EQUAL

(EQUAL

(EQUAL

(POWER-EVAL (BIG-PLUS 1 L I BASE)

BASE)

(PLUS (POWER-EVAL L BASE)

I))

(POWER-EVAL (BIG-PLUS X Y I BASE)

BASE)

(PLUS I (PLUS (POWER-EVAL X BASE)

(POWER-EVAL Y BASE)))) (REMAINDER Y 1)

(ZERO))

(LESSP (REMAINDER X Y)

Y)

(NOT (ZEROP Y)))

(REMAINDER X X)

(ZERO))

(LESSP (QUOTIENT I J)

I)

(AND (NOT (ZEROP I))

(OR (ZEROP J)

(NOT (EQUAL J 1)))))

(LESSP (REMAINDER X Y)

X)

(AND (NOT (ZEROP Y (NOT (ZEROP X (NOT (LESSP X Y))))

(POWER-EVAL (POWER-REP I BASE)

BASE)

(FIX I))

(POWER-EVAL (BIG-PLUS (POWER-REP I BASE^

ii

(PLUS I J)) (GCD X Y) (GCD Y X)) (NTH (APPEND

I)

(APPEND (NTH

BASE)

(POWER-REP (ZERO) BASE)

J BASE

A B) A I)

(NTH B (DIFFERENCE I (LENGTH A))))) (DIFFERENCE (PLUS X Y)

(FIX Y))

(difference

!>

X)

(PLUS Y X)

X)

(FIX Y))

(difference (PLUS X Y (plus X z

(DIFFERENCE Y Z))

(TIMES X (DIFFERENCE C W))

(DIFFERENCE (TIMES C X)

(TIMES W X)))

(REMAINDER (TIMES X Z)

Z)

^DIFFERENCE (PLUS B (PLUS A C)) A)

(PLUS B C))

(DIFFERENCE (ADD1 (PLUS Y Z))

Z)

(ADD1 Y))

(LESSP (PLUS X Y)

(PLUS X Z)

LESSP Y Z))

3 )

LESSP (TIMES X Z] (TIMES Y Z) (AND (NOT (ZEROP 2 (LESSP X Y))) (LESSP Y (PLUS X Y)) (NOT (ZEROP X)))

(GCD (TIMES X Z) (TIMES Y Z)) (TIMES Z (GCD XV))) (VALUE (NORMALIZE X) A)

(VALUE X A))

20 BYTE LISTINGS SUPPLEMENT • APRIL-JUNE. 1987

(EQUAL

(EQUAL

(EQUAL

(EQUAL

(EQUAL

(EQUAL

(EQUAL

(EQUAL

(EQUAL

(EQUAL

(EQUAL

(EQUAL

(EQUAL

(EQUAL

(EQUAL

(EQUAL

(EQUAL

(EQUAL

(EQUAL

(EQUAL

(EQUAL (FLATTEN X)

(CONS Y (NIL)))

(AND (NLISTP X)

(EQUAL X Y)))

(LISTP (GOPHER X))

(LISTP X))

(SAMEFRINGE X Y)

(EQUAL (FLATTEN X)

(FLATTEN Y)))

(EQUAL (GREATEST-FACTOR X Y) (ZERO))

(AND (OR (ZEROP Y)

(EQUAL Y 1))

(EQUAL X (ZERO))))

(EQUAL (GREATEST-FACTOR X Y)

1 )

(EQUAL XI))

(NUMBERP (GREATEST-FACTOR X Y)) (NOT (AND (OR (ZEROP Y)

(EQUAL Y 1))

(NOT (NUMBERP X))))) (TIMES-LIST (APPEND X Y))

(TIMES (TIMES-LIST X)

(TIMES-LIST Y))) (PRIME-LIST (APPEND X Y))

(AND (PRIME-LIST X)

(PRIME-LIST Y)))

(EQUAL Z (TIMES W Z))

(AND (NUMBERP Z)

(OR (EQUAL Z (ZERO))

(EQUAL W 1))))

i GREATEREQPR X Y)

NOT (LESSP X Y)))

EQUAL X (TIMES X Y))

OR (EQUAL X (ZERO))

(AND (NUMBERP X)

(EQUAL Y 1)))) (REMAINDER (TIMES Y X)

Y)

(EQUAL (TIMES A B)

1 )

(AND (NOT (EQUAL A (ZERO))) (NOT (EQUAL B (ZERO))) (NUMBERP A)

(NUMBERP B)

(EQUAL (1- A)

(ZERO))

(EQUAL (l- B)

X L))

(ZERO))))

(LESSP (LENGTH (DELETE (LENGTH L))

(MEMBER X L))

(SORT2 (DELETE X (DELETE X (SORT2 (DSORT X)

(SORT2 X))

(LENGTH (CONS XI

(CONS X2

(CONS X3 (CONS X4

(CONS X5

91 ,

(PLUS 6 (LENGTH X7))) (DIFFERENCE (ADD1 (ADD1 X))

2 )

(FIX X))

(QUOTIENT (PLUS X (PLUS X Y))

2 )

(PLUS X (QUOTIENT Y 2))) (SIGMA (ZERO)

I)

(QUOTIENT (TIMES I (ADD1 I))

2 ))

(CONS X6 X7)))))))

continued

BYTE LISTINGS SUPPLEMENT • APRIL-JUNE. 1987 21

(EQUAL

(EQUAL

(EQUAL

(EQUAL

(EQUAL

(EQUAL

(EQUAL

(EQUAL

(EQUAL

(EQUAL

(EQUAL

(EQUAL

(PLUS X (ADD1 Y))

(IF (NUMBERP Y)

(ADD1 (PLUS X Y)) (addi X)))

(EQUAL (DIFFERENCE X Y) (DIFFERENCE Z Y) (LESSP X Y)

(NOT (LESSP Y Z))

(IF

IF

Y. X))

(LESSP Z Y)

(NOT (LESSP (EQUAL (FIX X)

(FIX Z)))))

(MEANING (PLUS-TREE (DELETE X Y))

A)

(IF (MEMBER X Y)

(DIFFERENCE (MEANING (PLUS-TREE A)

(MEANING X A)) (MEANING (PLUS-TREE Y)

(ADD^Y^)

(TIMES X (IF (NUMBERP Y) (PLUS X (TIMES (FIX X)))

(NTH (NIL)

I)

X Y))

(IF

I)

(ZEROP (NIL)

, (zero)))

(LAST (APPEND (IF '

A B))

(LISTP 8)

(LAST B)

(IF (LISTP A)

(CONS (CAR (LAST A))

(EQUAL (LESSP X Y)

, , Z)

(IF (LESSP X Y)

(EQUAL T Z)

(EQUAL F Z)))

(ASSIGNMENT X (APPEND A B)) (IF (ASSIGNEDP X A) (ASSIGNMENT X A)

(assignment x b)))

(CAR (GOPHER X))

(IF (LISTP X)

(CAR (FLATTEN X)) (ZERO)))

(FLATTEN (CDR (GOPHER X))) (IF (LISTP X)

(CDR (FLATTEN X))

(CONS (ZERO)

, (NIL))))

(QUOTIENT (TIMES Y X)

Y)

(IF (ZEROP Y)

(ZERO)

(FIX X)))

(GET J (SET I VAL MEM))

(IF (EQP J I)

VAL

(GET J MEM)))))))

Y)

(DEFUN TAUTOLOGYP (X TRUE-LST FALSE-LST)

(COND ((TRUEP X TRUE-LST)

T)

((FALSEP X FALSE-LST)

NIL)

((ATOM X)

NIL)

((EQ (CAR X)

(QUOTE IF))

(COND ((TRUEP (CADR X)

TRUE-LST)

(TAUTOLOGYP (CADDR X)

TRUE-LST FALSE-LST))

22 BYTE LISTINGS SUPPLEMENT • APRIL-JUNE. 1987

(T NIL)))

(DEFUN TAUTP (X)

(TAUTOLOGYP (REWRITE X) NIL NIL))

(DEFUN TEST NIL

(PROG (ANS TERM)

(SETQ TERM

(APPLY-SUBST (QUOTE ((X

((FALSEP (CADR X)

FALSE-LST)

(TAUTOLOGYP (CAr (cDDDR X))

TRUE-LST FALSE-LST))

(T (AND (TAUTOLOGYP (CADDR X)

(CONS (CADR X) TRUE-LST) FALSE-LST)

(TAUTOLOGYP (CAr (cDDDR X)) TRUE-LST (CONS (CADR X)

FALSE-LST))))))

(Y F (Z F

B)

(ZERO)))) A B)

B)

Z U)

(PLUS (PLUS (PLUS

(TIMES (TIMES

(PLUS C D)))

(REVERSE (APPEND (APPEND A (NIL))))

(U EQUAL (PLUS A B)

(DIFFERENCE X Y))

(W LESSP (REMAINDER A B)

(MEMBER A (LENGTH B)))))

(QUOTE (IMPLIES (AND (IMPLIES X Y)

(AND (IMPLIES Y Z)

(AND (IMPLIES

(IMPLIES U W)))) (IMPLIES X W)))))

(SETQ ANS (TAUTP TERM))))

(DEFUN TRANS-OF-IMPLIES (N)

(LIST (QUOTE IMPLIES)

(TRANS-OF-IMPLIES1 N)

(LIST (QUOTE IMPLIES)

0 N)))

(DEFUN TRANS-OF-IMPLIES1 (N)

(COND ((EQUAL N 1)

(LIST (QUOTE IMPLIES)

0 1 ))

(T (LIST (QUOTE AND)

(LIST (QUOTE IMPLIES)

(1- N)

, N)

(TRANS-OF-IMPLIES1 (1- N))))))

(DEFUN TRUEP (X LST)

(OR (EQUAL X (QUOTE (T)))

(MEMBER X LST)))

(SETUP)

(defIne-tlmer boyer "Boyer" (test)) (qo-ottempt "boyer" (test) nil)

BROWSE.LSP Contributed by: Ernest R. Tello

TEXT "The GCLISP 286 Developer," by Ernest R. Tello. April 1987, page 242.

; BROWSE

; Benchmark to create and browse through an AI—like data base of units

continued

BYTE LISTINGS SUPPLEMENT • APRIL-JUNE. 1987 23

(defvar rand 21.)

#-GCLIsp

(defmacro charl (x) '(aref (symbol-name ,x) 0))

#+GCLisp ; Hack, hack. Don’t cons up strings to get first charl (defmacro charl (x)

'(mult Ip I e-value-bind (.off. .seg.) (sys::%pointer ,x)

(sys::%contents .seg. (+& .off. 21))))

(defun Inlt (n m npats Ipats)

(let ((I pats (copy-tree Ipats)))

(do ((p ipats (cdr p)))

((null (cdr p)) (rplacd p ipats)))

(do (fn n (1- n))

0 m (cond ((■ I 0) m)

, , I'M- '»)>

(name (gensym) (gensym))

(a ()))

((* n 0) a)

S push name a) do m i (i- i)))

. ((- \ 0 ))

(setf (get name (gensym)) ()))

(setf (get name 'pattern)

(do ((1 npats (1- I))

(Ipats ipats (cdr ipats))

,

(push (car ipats) a)))

(do m (- mi) (1- J)))

, ((- J 0))

(setf (get name (gensym) ) ())))))

(defun browse-random () (setq rand (mod (* rand 17.) 251.)))

(defun randomize (I)

(do (to ()))

((nuII I) a)

(let ((n (mod (browse-random) (length I))))

(cond ((» n 0)

(push (car I) a)

(setq I (cdr I);)

(t

(do ((n n (1- n))

(x I (cdr x)))

((- n 1)

(push (cadr x) a)

(rplacd x (cddr x)))))))))

(defun match (pat dat alist)

(cond ((nuI I pat)

(null dat))

((nulI dat) ())

((or (eq (car pat) ’?)

(eq (car pat)

(car dat)))

(match (cdr pat) (cdr dat) alist))

((eq (car pat) '*)

(or (match (cdr pat) dat alist)

(match (cdr pat) (cdr dat) alist)

(match pat (cdr dat) alist)))

(t (cond ((atom (car pat))

(cond ((eq (charl (car pat)) #\?) ; long story

(let ((vaI (assoc (car pat) alist)))

(cond (val (match (cons (cdr val)

(cdr pat)) dat alist))

(t (match (cdr pat)

(cdr dat)

(cons (cons (car pat)

(car dat)) al1st))))))

((eq (charl (car pat)) #\*)

(let ((val (assoc (car pat) alist)))

(cond (val (match (append (cdr val)

(cdr pat;) dat al1st))

24 BYTE LISTINGS SUPPLEMENT • APRIL-JUNE, 1987

(t

(do ((I () (nconc I (list (car d))))

(e (cons () dot) (cdr e))

(d dot (cdr d)))

((null «) ())

(cond ((match (cdr pat) d

(cons (cons (car pat) I) al 1st))

, . (return t))))))))))

(t (and

(not (atom (car dat)))

(match (car pat)

(car dat) al1st)

(match (cdr pat)

(cdr dot) allst)))))))

(defun browse ()

(setf rand 21)

(investigate (randomize

(inlt 100. 10. A . *((a a a b b b b a a a a a b b a a a) (aabbbbaa (a a)(b b))

(a a a b (b a) b a b a))))

((*a ?b *b ?b a *a a *b *a)

(*a *b *b *a (*a) (*b))

(? ? * (b a) * ? ?))))

(defun investigate (units pats)

(do ((units units (cdr units)))

((nuII units))

(do ((pats pats (cdr pats)))

((nuI I pats))

(do ((p (get (car units) 'pattern)

((null p))

(match (car pats) (car p) ())))))

(define-timer browse "Browse" (browse))

(qa-attempt "Browse" (browse) nil)

DERIV.LSP Contributed by: Ernest R. Tello

TEXT “The GCLISP 286 Developer," by Ernest R. Tello. April 1987, page 242.

; DERIV

(DEFUN derlv-aux (A) (LIST '/ (DERIV A) A))

(DEFUN DERIV (A)

(COND

((ATOM A)

(COND ((EQ A *X) 1) (T 0)))

((EQ (CAR A) '+)

(CONS ’ + (MAPCAR #’DERIV (CDR A))))

((EQ (CAR A) *-)

(CONS *- (MAPCAR I’DERIV (CDR A))))

((EQ (CAR A) ’*)

(LIST ’*

A

(CONS '+ (MAPCAR *derlv-oux (CDR A))))) ((EQ (CAR A) 7)

(list •

(LIST 7

(DERIV (CADR A))

(CADDR A))

(LIST 7

(CADR A)

(LIST •*

(CADDR A)

(CADDR A)

(DERIV (CADDR A))))))

continued

BYTE LISTINGS SUPPLEMENT • APRIL-JUNE, 1987 25

April

(T ’ERROR)))

(DEFUN RUN-derIv () (DO ((l 0 (1+ I ) ((« I 1000.)) f-GCLisp (DECLARE (DERIV ’(+ (* 3 X (DERIV *(+ (* 3 X (DERIV •(+ *3X

(DERIV '(+ (*3X

(type FIXNUM X) (* A X X) X * A X X) X) (* A X x) X) (* A X X)

0)

(* B

(* B

(* B (* B

X)

X)

X)

X)

(DERIV ’(+ (* 3 X X) (* A X X) (* B X) 5))

define-tlmer derlv "Derlv" (run-derlv)) qo-attempt "Derlv" (run-derlv) nil)

;;; 3.11 DDERIV

(DEFUN dderIv-aux (A) (LIST ’/ (DDERIV A) A))

(DEFUN +DDERIV (A)

(CONS ’+ (MAPCAR #’DDERIV A)))

(DEFUN -DDERIV (A)

(CONS ’- (MAPCAR #•DDERIV A)))

(DEFUN *DDERIV (A)

(LIST ’* (CONS ’* A)

(CONS •+ (MAPCAR #’dderIv-aux A))))

(DEFUN /DDERIV (A)

(LIST

(LIST '/

(DDERIV (CAR A))

(CADR A))

(LIST V

(CAR A)

(LIST ’*

(CADR A)

(CADR A)

(DDERIV (CADR A))))))

(DEFUN DDERIV (A)

(COND

((ATOM A)

(COND ((EQ A ’X) 1) (T 0)))

(T (LET ((DDERIV (GET (CAR A) ’DDERIV)))

(COND (DDERIV (FUNCALL DDERIV (COR A)))

(T ’ERROR))))))

(defun setup-dderlv ()

(mapc #’(lambda (op fun)

(setf (get op ’dderiv) (symbol-function fun))) *(+ " * /)

’(+dderiv -dderiv *dderiv /dderiv)))

(setup-dderlv)

(DEFUN RUN-dderiv ()

(K> !(I! 1S.W

#-GCUsp (DECLARE (type FIXNUM I))

(DDERIV ’(+ (* 3 X X) (* A X X) (* B X) 5))

(DDERIV ’(+ (* 3 X X) (* A X X) (* B X) 5))

(DDERIV •(+ (* 3 X X) (* A X X) (* B X) 5))

(DDERIV ’(+ (* 3 X X) (* A X X) (* B X) 5))))

(DDERIV •(+ (* 3 X X) (* A X X) (* B X) 5))

deflne-timer dderiv "DDeriv" (run-dderiv)) qa-attempt "DDerlv" (run-dderIv) nil)

26 BYTE LISTINGS SUPPLEMENT • APRIL-JUNE, 1987

DESTRUCT.ISP Contributed by: Ernest R. Tello

TEXT "The GCLISP 286 Developer," by Ernest R. Tello. April 1987, page 242.

DESTRUCT

Destructive operation benchmark

(defun destructive (n m) (let ((I (do ((i 10. (1

(do

(

(0 n (1- i))) ((- i 0))

»>)

a () (push 0 a))) I 0) a))))

(cond ((hull (cor I))

(do ((I I (cdr I)))

((null I))

(or (car I)

(rplaca I (cons () ())))

(nconc (car I)

(do ((J m (1- j))

(a () (push Q a)))

((«* j 0) a))))$

(t

(do ((II I (cdr II))

(12 (cdr I) (cdr 12)))

((null 12))

(rplacd (do ((j (floor (length (car 12)) 2) (1- j)) (a (car 12) (cdr a)))

((- J 0) o)

(rplaca a I))

(let ((n (floor (length (car II)) 2)))

(cond ((« n 0) (rploco II ())

(car II))

(t

(do ((J n (1- j))

(a (car II) (cdr a)))

((“ j D

(progl (cdr a)

(rplacd o ())))

(rplaca a I))))))))))))

(defIne-tImer destruct "Destruct" (destructive 600. 50.))

(qa-attempt "Destruct" (destructive 600. 50.) nil)

DIV.LSP Contributed by: Ernest R. Tello

TEXT "The GCLISP 286 Developer," by Ernest R. Tello. April 1987, page 242.

; DIV2

; Dividing by 2 using lists of n ()’s

(defun create-n (n)

(do ((n n (1- n))

(a () (push () a)))

((« n 0) a)))

(defvar d!v2-l )

(setq dlv2-l (create-n 200.))

(defun iteratlve-div2 (I)

(do ((I I (cddr I))

(a () (push (car I) a)))

((null I) a)))

continued

BYTE LISTINGS SUPPLEMENT • APRIL-JUNE. 1987 27

April

(defun recursive-div2 (I)

[^(cons^car I) (recursIve-div2 (cddr I))))))

(defun 1terative-div2-test (I) (do ((i 300. (1- 0))

((« I 0))

(iterative-div2 I)

(iteratIve-div2 I) citerative-div2 I)

(1terative-div2 I)))

(defun recursive-div2-test (I) (do ((1 300. (1- 1)))

((» l 0))

(recursive-div2 I) (recursIve-div2 I) (recursive-div2 I) (recursive-dlv2 l)))

s

!

deflne-tlmer dlv2qa-attempt "Dlv2,

1 “Oiv2, Iterative" (Iterative-div2-te8t div2-l Iterative" (Iteratlve-dlv2-test div2-l) nil)

))

defIne-tlmer dlv2-2 “DIv2. Recursive" C recur sive-dlv2-test qa-attempt "Div2, Recursive" (recursive-div2-test div2-l;

dlv2-l)) nil)

EXE.LSP Contributed by: Ernest R. TEXT "The GCLISP 286 Developer," by

Tel lo

Ernest R. Tello. April

1987, page 242.

t stream)))

stream))

nil stream)

(defun show-exe (file)

(setq file (merge-pathnames file .LXb (with-open-fI Ie (stream file tdirectlon :lnput (format t "&%EXE file header of ")

(show-pathname file)

(format t ":%%") , ,

(let ((signature (show-dbyte "Link signature

(If signature #x5A40) (format t (correct) )

(format t " (Incorrect)"))) flet ((leftover (show-dbyte Image length mod 512 ni (pages (show-dbyte "Image length/512" nil

(format t "fclmage length: D" (+ (* pages 512) leftover))) (show-dbyte "Relocation table length" nil stream)

(show-dbyte "Header size (paragraphs)" nil stream) .

(show-dbyte "Minimum extra memory (paragraphs) nil stream) (show-dbyte "Maximum extra memory (paragraphs)

(show-dbyte "Stock segment offset" t stream)

(show-dbyte "Initial SP" t stream)

(show-dbyte "Checksum" t stream)

(show-dbyte "Initial IP" t stream)

(show-dbyte “Code segment offset t stream)

(show-dbyte "Relocation table offset" nil stream) (show-dbyte "Overlay number" nil stream)))

(defun show-dbyte (what hex? stream)

(let* ((bl (read-byte stream))

(b2 (read-byte stream))

(dbyte (loglor (ash b2 8) bl)))

(format t "&A: " what) .

(If hex? (format t "Xh" dbyte) (format t "0“ dbyte))

dbyte))

(defun show-pathname (pathname)

(format t "A\\" (pathname-device pathname))

(let ((dlrs (pathname-directory pathname)))

(when (IIstp dlrs)

(setq dlrs (rest dlrs))

(do () ((null dlrs))

element-type ’unsigned-byte)

2H IIYTK LISTINGS SUIMM.IIMHNT • APRIL JUNR. 1987

format t "A\\" (first dlrs)) setq dirs (rest dlrs))))

(format t "A" (pathname-name pathname))

(If (pathname-type pathname) (format t ".A' 1 (pathname-type pathname)))))

FRPOLY.LSP Contributed by: Ernest R. Tello

TEXT "The GCLISP 286 Developer," by Ernest R. Tello. April 1987, page 242.

; FRPOLY

(defvar *v*) (defvar *X*) (defvar *alpha*) (defvar *A*) (defvar *B*) (defvar *B*) (defvar * I ) (defvar *p} (defvar q*) (defvar u*) (defvar *var) (defvar *y*) (defvar *R*) (defvar *r2*) (defvar *r3*)

;(declare (localf pcoefadd pcplus pcplusl pplus ptlmes ptlmesl ; ptimes2 ptimes3 pslmp pctlmes pctimesl

; pplusl))

(defmacro polntergp (x y) '(> (get ,x 'order)(get ,y ’order))) (defmacro pcoefp (e) '(atom ,e))

(defmacro pzerop (x) '(and (numberp ,x) (zerop ,x)))

; true

for 0 or 0.0 ;(defmacro pzero () 0)

(defmacro cplus (x y) '(+ ,x ,y)}

(defmacro ctimes (x y) '(* ,x ,y))

(defun pcoefadd (e c x)

(if (pzerop c) x

(cons e (cons c x))))

(defun pep I us (c p)

( I f (pcoefp p)

(cplus p c)

(pslmp (car p) (pcplusl c (edr p)))))

(defun pcplusl (c x)

(cond ((nuII x)

(cond ((pzerop c) nil) (t (cons 0 (cons c nil)))))

! (pzerop (car x}) (pcoefadd 0 (pplus c (cadr x;) niH) t (cons (car x) (cons (cadr x) (pcplusl c (eddr x)))))))

(defun pctlmes (c p) (cond ((pcoefp p) (ctimes c p))

(t (pslmp (car p) (pctimesl c (edr p))))))

(defun pctimesl (c x)

(cond ((nulI x) nil)

(t (pcoefadd (car x)

(ptlmes c (cadr x))

(pctimesl c (eddr x))))))

continued

BYTE LISTINGS SUPPLEMENT • APRIL-JUNE, 1987 29

April

(defun pplus (x y) (cond

i!

(defun pplusl (cond I

(pcoefp x) (pcplus x y pcoefp y) (pcplus y x) eq (car x) (car y))

v psimp (car x) (pplusl (cdr y) (cdr x)))) ((polntsrgp (car x) (car y))

(psimp (car x) (pcplusl y (cdr x))))

(t (psimp (car y) (pcplusl x (cdr y))))))

(x y)

(nuII x| y|

((nulI y) x)

((=» (car x) (car y))

(pcoefadd (car x)

(pplus (cadr x) (cadr y))

(pplusl (cddr x) (cddr y))))

((> (car x) (car y))

(cons (car x) (cons (cadr x) (pplusl (cddr x) y))))

(t (cons (car y) (cons (cadr y) (pplusl x (cddr y)))))))

(defun psimp (cond

(var x)

(nulI x} 0) (atom x) x) (zerop (car x (t (cons var

«»!)

(cadr x))

(defun ptlmes (x y) (cond

for (pzerop x) (pzerop y)) 0)

[pcoefp x) (pet Imes x y)

[pcoefp y) (petimes y x))

(eq (car x) (car y))

[psimp (car x) (ptlmesl (cdr x) (cdr y)))) ((polntergp (car x) (car y))

(psimp (car x) (pctlmesl y (cdr *))))

(t (psimp (car y) (pctlmesl x (cdr y))))))

(defun ptlmesl (*x* y) (prog (u* *v*) ...

(setq *v* (setq u* (ptimes2 y)))

a (setq *x* (cddr *x*))

(cond ((null *x*) (return u*))) (ptlmes3 y)

(go a)))

(defun pt!mes2 (y) (cond ((null y) nil)

(t (pcoefadd (+ (car *x*) (car y )

(ptlmes (cadr *x*) (cadr y)) (ptImes2 (cddr y))))))

(defun ptImes3 (y)

(prog (e u c)

al

fcond [setq f setq [cond

((nul I y) (return niI))) e (+ (car *x*) (car y)))

(ptlmes (cadr y) (cadr *x*l ))

pzerop c) (setq y (cddr y)) (go al)) or (null *v*) (> e (car *v*))) setq u* (setq *v* (pplusl u* (list e c)))) setq y (cddr y)) (go al))

((- e (car *v*))

setq c (ppI us c (cadr *v*))) . # v g www

cond ((pzerop c) (setq u* (setq *v* (pdifferl u* (list (car*v*) (cadr *v*))))))

(t (rplaca (cdr *v*) c))) fsetq y (cddr y))

a (cond ((and°(cddr *v*) (> (caddr ♦v^) e)) (setq *v* (cddr »v*)) (go a)))

(setq u (cdr *v*))

b (cond ((or (null (cdr u)) (< (cadr u) e))

(rplacd u (cons e (cons c (cdr u))j) (^o e)))

(cond ((pzerop (setq c (pplus (caddr u) c)))

(t (rplaca (cddr u) c))) setq u (cddr setq y (cddr v)) cond ((nulI y) (return n11 ( setq e (+ (car *x*) (car y) ww Setq c (ptlmes (cadr y) (cadr *x*))) cond ((and (cdr u) (> (cadr u) e))

(setq u (cddr u)) (go c)))

(go b)))

)) (rplacd u (edddr u)) (go d))

m

30 BYTE LISTINGS SUPPLEMENT • APRIL JUNE, 1987

;; pdifferl is referred to above but not defined. RPG says it is never cal led.

(defun pdifferl (x y) x y (error "pdiffer2 called"))

(defun pexptsg (p n)

(do ((n (floor n 2) (floor n 2))

(s (cond ((oddp n) p) (t 1))))

((zerop n) s)

(setq p (ptimes p p))

(and (oddp n) (setq s (ptimes s p))) ))

(defun setup-frpoly nil

i setf (get 'x 'order ) 1} setf (get 'y 'order ) 2 j setf (get 'z 'order ; 3)

setq *r* (pplus '(x 1101) (pplus '(y 1 1) '(z 1 1)))) setq *r2* (ptimes *r* 100000)) ;r2 » 100000*r setq *r3* (ptimes *r* 1.0)); r3

r* x+y+z+1 r with floating point coefficients

(setup-frpoly)

(define-timer frpoly2r "FRPoly, Power » 2, r=x+y+z+1" (pexptsq *r* 2)) (define-timer frpoly2r2 "FRPoly, Power - 2, r2 - 1000r" (pexptsq *r2* 2))

(defIne-timer frpoly2r3 "FRPoly, Power =2, r3 ■ r in flonums" (pexptsq *r3*2))

(qa-attempt "FRPoly, Power « 2, r - x + y + z + 1" (pexptsq *r* 2)

Z 2 1 1 (Y 1 2 0 (X 1 2 0 2)) 0 (Y 2 1 1 (X 1 2 0 2) 0 (X 2 1 1 3 0 1))))

(aa-attempt "FRPoly, Power - 2, r3 - r In flonums" (pexptsq *r3* 2)

(Z 2 1.0 1 (Y 1 2.0 0 (X 1 2.0 0 2.0)) 0

(Y 2 1.0 1 (X 1 2.0 0 2.0) 0 (X 2 1.0 1 3.0 0 1.0)))) fdefIne-tImer frpoly5r "FRPoly, Power » 5, r « x + y + z + 1" (pexptsq *r* 5)) (define-tImer frpoly5r2 "FRPoly, Power - 5, r2 - 1000r" (pexptsq *r2* 5))

(define-timer frpoly5r3 "FRPoly. Power - 5, r3 - r In flonums" (pexptsq *r3*

5 ))

(defIne-tlmer frpoly10r "FRPoly. Power - 10, r «* x + y + z + 1" (pexptsq *r*

10 ))

fdefine-tImer frpoly10r2 "FRPoly, Power - 10, r2 - 1000r" (pexptsq *r2* 10))

(defIne-timer frpoly10r3 "FRPoly, Power - 10. r3 - r in flonums" (pexptsq *r3*

10))

(defIne-tlmer frpoly15r "FRPoly. Power - 15. r = x + y + z + 1" (pexptsq *r* 15))

(defIne-tImer frpoly15r2 "FRPoly, Power - 15. r2 - 1000r" (pexptsq *r2* 15))

(defIne-timer frpoly15r3 "FRPoly. Power - 15, r3 - r in flonums" (pexptsq *r3*

15))

IO.LSP Contributed by: Ernest R. Tello

TEXT "The GCLISP 286 Developer," by Ernest R. Tello. April 1987, page 242.

(

; FPRINT

; Benchmark to print to a file.

(defvar test-atoms *(abcdef12 cdefgh23 efgh!j34 ghljkl45 IJklmn56 klmnop67

mnopqr78 opqrst89 qrstuv90 stuvwx01 uvwxyz12

wxyzab23 xyzabc34 123456ab 234567bc 345678cd

456789de 567890ef 678901fg 789012gh 890123hi))

(defun fprlnt-inlt (m n atoms)

(let ((atoms (copy-tree atoms)))

(do ffa atoms (cdr a)))

((null (cdr a)) (rplacd a atoms))) (fprInt-lnIt1 m n atoms)))

continued

BYTE LISTINGS SUPPLEMENT • APRIL-JUNE, 1987 31

April

(defun fprint-initl (m n atoms)

(cond ((= m 0) (pop atoms))

(t (do ((I n (- i 2))

s [< m ,

(push (pop atoms) a)

(push (fprint-lnltl (1- m) n atoms) a))))) (defvar test-pattern (fprtnt-lnlt 6. 6. test-atoms))

(defparameter fprlnt—test—fIle "FPRINT.TST")

OIUI1 IVI V/ . .\\\

(let ((f (open fprtnt-test-f11e idlrectlon :output))) (print test-pattern f)

(close f)))

(defIne-tlmer fprlnt "FPrint" (fprlnt)) ; FREAD

; Benchmark to read from a file.

(defun freed () (let ((f (open (read f) (close f)))

fprInt-test-fIle)))

(define-tlmer freed "FRead" (fread))

; TPRINT

; Benchmark to print and

read to the terminal

(defvar test-atoms

•(abcl cde2 efg3 ghi4 IJk5 klm6 mno7 opq8 qrs9 stu0 uvwl wxy2 xyz3 123a 234b 345c 456d 567d 678e 789f 890g))

(defun tprInt-lnlt (m n atoms)

(let ((atoms (copy-tree atoms)))

(do ((a atoms (edr a)))

((null (edr a)) (rplacd a atoms))) (tprlnt-lnltl m n atoms)))

(defun tprlnt-lnltl (m n atoms)

(cond ((■ m 0) (pop atoms))

(t (do ((I n (- I 2))

(o ())) x ((< I 1) o)

(push (pop atoms) a)

(push (tprint-lnltl (1- m) n atoms) a))))) (defvar test-pattern (tprlnt-lnlt 6. 6. test-atoms))

(defIne-tlmer tprint "TPrint" (print test-pattern))

LOOP.LSP Contributed by: Ernest R. Tello

TEXT "The GCLISP 286 Developer," by Ernest R. Tello. April 1987, page Z4Z

; the LOOP Macro (In-package *SYS)

(defmacro loop (&body body) , . x

(If (symbolp (first bodv)) (loop-translate body)

(l®t ((tag (gensym))) ......

‘(block nil (tagbody .tag ,@body (go .tag))))))

(defmacro I (ibody body) (pprlnt (loop-translate body)) nil)

32 BYTE LISTINGS SUPPLEMENT • APRIL-JUNE, 1987

(defvar * Ioop-coI Iect-keywords* ’(•'APPEND" "APPENDING" "COLLECT" "COLLECTING" "NCONC" "NCONCING"))

(defvar ♦loop-keywords* ’("APPEND" "APPENDING" "AS" "COLLECT" "COLLECTING" "DO" "DOING" "FINALLY" "FOR" "IF" "INITIALLY"

"NAMED" "NCONC" "NCONCING" "UNLESS" "UNTIL"

"WHEN" "WHILE" "WITH"))

(defun loop-keyword? (object)

(and (symbolp object)

(member (string object) * loop-keywords* :test #’strfng-equal)))

(defmacro loop-finish () ’(go loop-exit-tag))

(defun add-loop-bindings (bindings variable value)

(setf (first bindings)

(nconc (first bindings)

(cond ((not (listp variable))

(list (list variable value)))

((relatively-atomic value)

(generate-loop-destructuring variable value))

(t (let ((temp (gensym)))

! add-loop-bindings (rest bindings) temp value) generate-loop-destructurIng variable temp)))))))

(defun relatIvely-atomic (form)

(or (symbolp form)

(and (member (first form) ’(car cdr caar cadr cdar cddr caaar caadr

cadar caddr cdaar cdadr cddar cdddr)) (relatively-atomic (second form))

(nuI I (cddr form)))))

(defun generate-loop-destructurIng (variables values)

(cond ((null variables} ())

((atom variables) (list (list variables values)))

(t (nconc (generate-loop-destructuring

(car variables) (if (null values) nil '(car .values))) (generate-loop-destructuring

(cdr variables) (if (null values) nil '(cdr .values)))))))

(defun add-for-bindings (bindings forms variable value)

(nconc forms

(cond ((not (listp variable)) '((setf .variable .value)))

((relatIvely-atomic value)

(list (generate-for-destructuring variable value)))

(t (let ((temp (gensym)))

(add-loop-bindings bindings temp nil)

(list '(setf .temp .value)

(generate-for-destructuring variable temp)))))))

(defun generate-for-destructurIng (variable value)

(let ((bindings (generate-Ioop-destructurIng variable value)))

(If (■ (length bindings) 1) (cons 'setf (first bindings))

(cons ’psetf (apply #’nconc bindings)))))

(eval-when (eval compile)

(defmacro Ippop (x) '(If (null ,x) (error "LOOP expression terminates unexpectedly.") (pop

(defun loop-collect-form (key symbol expression) (setf key (aref key 0))

(cond ((char-equal key #\C) ; COLLECT

'(nconc .symbol (list .expression))) ((char-equal key #\A) ; APPEND '(append .symbol .express Ion))

(t ; NCONC

'(nconc .symbol .express Ion))))

(defun Ioop-for-transI ate (bindings preset-forms reset-forms body for?) (let ((key (Ippop body)) (temp nil) (temp2 nil) (var nil))

(tagbody

continued

BYTE LISTINGS SUPPLEMENT • APRIL-JUNE. 1987 33

April

next (unless (symbolp key) (go sot))

(when (loop-keyword? key) (go exit))

(when (string-equal (string key) "AND")

(setf key (Ippop body))

(setf temp (string key))

(If (string-equal temp "FOR") (setf for? *t)

(If (string-equal temp "AS") (setf for? nil)))

(go next))

set (setf vor key)

(setf key (tppop bodv))

(unless (symbolp key)

(add-loop-bindings bindings vor nil) (go next;;

(setf temp (string key))

(when (string-equal temp "AND")

(add-loop-bindings bindings var nil) (go next))

(when (loop-keyword? temp)

(odd-loop-bindings bindings var nil) (go exit))

(cond ((string-equal temp "■") ;; "FOR/AS X ■"

(setf key (Ippop body))

(add-loop-bindings bindings var key)

(unless for? ;; "AS X ■"

(setf reset-forms

(odd-for-blndlngs bindings reset-forms var key))

(setf key (Ippop bodv)) (go next))

(setf key (Ippop body))

(unless (and (symbolp key)

(string-equal (string key) "THEN"))

(go next)) ;; "FOR X - Y THEN"

(setf key (Ippop body))

(setf reset-forms ,

(odd-for-blndlngs bindings reset-forms var key))

(setf key (Ippop body))

(go next))

((member temp '("FROM" "DOWNFROM" "UPFROM")

:te8t #'strIng-equal)

(unless for? (error "Bod LOOP phrase: AS S A" vor temp))

(let ((by (cond ((string-equal temp "UPFROM") 1)

((string-equal temp "DOWNFROM") -1) ...

(t nil)))) (setf key (Ippop body))

(add-loop-bindings bindings var key)

(setf key (Ippop body))

(unless (symbolp key)

(setf reset-forms

(add-for-blndings bindings reset-forms var •(+ .var .(or by 1))))

(go next))

(setf temp2 (string key))

(setf key (Ippop body))

(when (string-equal temp2 "BY")

(when by (error "Ill-formed LOOP FOR:

var temp))

(setf reset-forms

(add-for-bindlngs bindings reset-forms var •(+ ,var .key)))

(go next))

(unless (member temp2 ‘("TO" "DOWNTO" "UPTO"

V V "BELOW" “ABOVE")

:test string-equal)

(setf reeet-forms

(odd-for-blndlngs bindings reset-forms var

*(+ .var .(or by 1))))

(go next))

(BREAK)))

((string-equal temp "IN")

(setf key (Ippop body))

(setf temp (gensym))

(add-loop-bindings bindings temp key)

(setf preset-forms

(nconc preset-forms

•((if (null ,temp) (loop-finish)))))

(setf preset-forms .

(odd-for-blndlngs bindings preset-forms var (car,temp)))

S A BY

34 BYTK LISTINGS SUPPLEMENT • APRIL-JUNE, 1987

f setf key (Ippop body))

cond ((and (symbolp key) (string-equal (string key) "BY")) (setf key (Ippop body))

(setf reset-forms

(add-for-blndlngs bindings reset-forms temp ‘(funcall .key .temp)))

(setf key (Ippop body)))

(t (setf reset-forms

(add-for-blndlngs bindings reset-forms temp *(cdr .temp)))))

(go next))

(t (error "FOR/AS keyword expected In LOOP expression: S"

% key)))

exit)

(values preset-forms reset-forms body key)))

Loop name.

LET bindings to be made.

Loop Initialization forms. Loop finish forms.

Loop prepass var reset forms. Loop pass var reset forms. Next keyword to process.

Of

(defun loop-transI ate (body)

(do ((name nil)

(bindings ())

(inlt-forms ())

(exit-forms ())

(preset-forms Q)

(reset-forms ())

(key (Ippop body))

(temp nil))

((nuI I body)

(do ((answer ‘(tagbody ,©Inlt-forms loop-enter-tag

,©preset-forms ,©forms .©reset-forms (go loop-enter-tag)

Ioop-exIt-tag .©exlt-forms)

(let ((binding (pop bindings)))

(If (null binding) answer

‘(let .binding .answer)))))

((null bindings) ‘(block .name .answer))))

S not (symbolp key))

error "Random form where LOOP keyword expected: S" key))

(setf key (string key))

(cond ((string-equal key "NAMED")

(If name (error "LOOP body contains two NAMED keys."))

(setf name (Ippop body))

(unless (symbolp name) (error "Bad LOOP name: S" name)) (setf key (Ippop body)))

((strIng-equal key "INITIALLY")

(loop (setf key (Ippop body))

(if (loop-keyword? key) (return nil))

(setf Inlt-forms (nconc inlt-forms (list key))) (unless body (return nil))))

((string-equal key "FINALLY")

(loop (setf key (pop body))

(if (loop-keyword? key) (return nil))

(when (and (symbolp key)

(string-equal (string key) "RETURN"))

(setf exit-forms

(nconc exit-forms ‘((return .(Ippop body)))))

! setf key (Ippop body)) return nil))

(setf exit-forms (nconc exit-forms (list key))) (unless body (return nil))))

((string-equal key "WHILE")

(setf temp (Ippop body))

(setf key (Ippop body))

(setf forms (nconc forms ‘((unless .temp (loop-finish)))))) ((string-equal key "UNTIL")

(setf temp (Ippop body))

(setf key (Ippop body))

(setf forms (nconc forms ‘((when .temp (loop-finish)))))) ((string-equal key "WITH")

(when forms (error "WITH before executable in LOOP BODY.")) (setf bindings (list* () () bindings))

(setf key (Ippop body))

(tagbody

next (unless (symbolp key) (go set))

(when (loop-keyword? key) (go exit))

(when (string-equal (string key) "AND")

(setf key (Ippop body)) (go next))

(forms ())

continued

BYTE LISTINGS SUPPLEMENT • APRIL-JUNE, 1987 35

April

temp)))

set (setf temp key)

(setf key (Ippop body)) , . . „ t,, v s «_*n

(cond ((ond (symbolp key) (string-equal (string key) ))

(setf key (Ippop body))

(odd-loop-bind Inge bindings temp key)

(setf key (Ippop bo<J y))) n ,u

(t (odd-loop-blndInge bindings temp nil)))

(go next)

((o* X (eetf temp (etrIng-equol key "FOR")) (etring-equol key "AS")) (setf bindings (list* () () bindings))

imu 111pIe-vo1ue-setq (preset-forms reset-forms body key)

1 (loop-for-trone I ate bindings preset-forms reset-forms body

((or (string-equal key “DO") (string-equal key "DOING"))

(loop (setf key (pop body))

(If (loop-keyword? key) (return nil))

(setf forms (nconc forms (list key)))

(unless body (return nil)))) _ . ,

((member key *loop-collect-keywords* :test # string-equal)

(setf temp key) ..

(setf bindings (list* () () bindings))

(let ((exp (Ippop body)) (symbol (gensym)))

(setf key (pop body))

ciu* •(-.«• "into")

:test |'strIng-equal ))

(setf symbol (Ippop body))

(setf key (pop body)))

(add-loop-blndlngs bindings symbol nil)

(setf forms

(nconc forms

•((setf .symbol \\\\\

.(loop-collect-form temp symbol exp)))))

(setf ®*^* n *°™® t _ forins ( M8 t (list 'return symbol))))))

)))

PUZZLE.LSP Contributed by: Ernest R. Tello TEXT "The GCLISP 286 Developer, 1 ' by Ernest R.

Tello. Apr I I

1987, page 242.

; PUZZLE

(defconstant size 511.) (defconstant classmax 3. (defconstant typemax 12.

(defconstant true t) (defconstant false ()) (defvar 1110)

(defvar kount 0) (defvar *d* 8.)

(defvar

(defvar

(defvar

(defvar

plscscount (maks-array (1+ classmax) : nItl< class (moka-array (1+ typemax) :lnltial-e si plecemox (make-array (1+ tyoemax) :Initial

Initial-element 0)) ement 0)) ement 0))

(make-array (1+ size)))

(defun fit (I J) (let ((end (aref

(do

[fend

&

0 (1+ k))) k end) true) (cond ((aref *p* I

plecemax I)))

k)

'(cond ((aref puzzle (+ (return false)))

%

BYTE LISTINGS SUPPLEMENT • APRII.-JUNE. W87

(defun place (I J)

(let ((end (are? piecemax I)))

(do ((k 0 (H k)))

((> k end))

(cond ((aref *p* I k)

(setf (aref puzzle (+ j k)) true))))

(setf (aref piececount (aref class I)) (- (aref plececount (aref class I)) 1)) (do C Ck J (14* k)))

((> k size)

terpri)

prInc "Puzzle f11 led")

0 )

(cond ((not (aref puzzle k))

(return k))))))

(defun puzzle-remove (I j)

(let ((end (aref piecemax I)))

(do Uk 0 (1+ k)))

((> k end))

(cond ((aref *p* I k) (setf (aref puzzle (4* J k)) fal 8*))))

(setf (arsf plececount (aref class I)) (+ (aref plececount (aref class I)) 1))))

(defun trial (J) (let ((k 0))

(do

[!i

0 <H i)))

I typemax) (setq kount (1+ kount)) false (cond ((not (- (aref plececount (aref class I J)

k (place I j cond ((or |trlal k

(cond ((fit I (setq

0 »

, , k 0));

(format t "%Piece 4D at 4D." (4* (setq kount (4- kount 1)) (return true))

(t (puzzle-remove I J))))))))))

I 1) (+ k 1))

(defun deflnepiece ((class II II kk)

(let ((index 0))

(do (I 0 (U I)))

((> I 10)

(do ((J 0 (HJ)))

((> J JJ))

(do ffk 0 <H k)))

((> k kk))

(setq Index (4- I (* *d* (4- J (* *d* k))))) (setf (aref ♦p^ III Index) true))))

(setf (aref class ill) (class)

(setf (aref piecemax III) Index)

(cond ((not (- III typemax))

(setq ill (+ Mi 1))))))

(defun start ()

(do ((m 0 (14- m)))

((> m size);

(setf (aref puzzle m) true))

(do ((! 1 (14* I)))

((> 1 5))

(do ((j 1 (14* J)))

((> J 5))

(do ffk 1 (H k)))

, ((> k 5))

(setf (aref puzzle (4* I (* *d* (+ j (* *d* k))))) false)))) (do ((I 0 (U I)))

((> I typemax))

(do ((m 0 (14* m)))

((> m size))

(setf (aref *p* I m) false)))

i setq III 0) defInePIece 0310) deflnePlece 0103) defInePlece 0031) deflnePlece 0130) deflnePlece 0301) deflnePlece 0013)

continued

BYTE LISTINGS SUPPLEMENT • APRIL-JUNE, 1987 37

April

(definePiece 1200) (definePiece 1020) (definePiece 1002)

(definePiece 2110) (definePiece 2101) (definePiece 2011)

(definePiece 3111)

13.

3 )

:s

(setf (aref pieceCount 0 (setf (aref pieceCount 1 (setf (aref pieceCount 2 (setf (aref pieceCount 3, let ((m (+ 1 (* *d* (+ 1 *<!*)))) (n 0)(kount 0))

((fit 0 m) '

(t (format ((trial n)

(format t (t (format

(cond

(cond

(setq n (place 0 m))) t "XError.")))

“XSuccess in 40 tria t "XF a I lure.")))))

Is." kount))

deflne-tlmer puzzle "Puzzle" (start)) qa-attempt "Puzzle" (start) nil)

TAK.LSP Contributed by: Ernest R. Tello TEXT "The GCLISP 286 Developer," by Ernest R.

Tello. April

1987, page 242.

; TAK

(defun tak (x y z)

(declare (type fixnum x y z)) (if (not (< y x))

(tak (tak (1- x (tak (l- y (tak (l- z

)))

; TAK with the tall recursion taken out. (defun trtak (x y z)

(declare (type fixnum x y z))

(loop (If (not (< y x))

(return z)

)

(tak i

1- X)

y

(tak

1- yj

z

x <

(tak

(i- 0

X

y)

;xy

(deflne-tlmer tak “Tak" (tak 18. 12. 6.)) .

(deflne-tlmer trtak M Tak with Tail Recusion eliminated (trtak 18. 12. 6.;;

qa-attempt "Tak" (tak 18. 12. 6.) 7) /. . . iq io 6 ) 7)

qa-attempt “Tak with Tail Recusion eliminated (trtak 18. 12. 6.) 7)

STAK

; TAK using special binding in place of parameter passing.

(defvar *x*) fdefvar *y*)

(defvar *z*)

(proclaim '(type fixnum *x* ♦y^ *z*))

(defun stak (*x* *y» *z*)

(stak-aux))

38 BYTE LISTINOS SUPPLEMENT • APRIL JUNE. I9K7

(defun stak-aux ()

(If (not (< *y* *x*))

*z*

(let ( (*x* (let ((*x* (1- *x*) )

(*y* *y*)

(*z* *Z*) ) (stak-aux)))

(*y* (let ((*x* (1- *y*))

(*y* *z*)

(*z* *x*)) (stak-aux)))

(*z* (let ( (*x* (1- *z*))

(*y* *x*)

(*z* *y*)) (stak-aux)))) (stak-aux))))

(defIne-tImer stak "STak" (stak 18. 12. 6.)) (qa-attempt "STak" (stak 18. 12. 6.) 7)

; CTAK

; TAK using CATCH/THROW.

(defun ctak (x y z)

(declare (type flxnum x y z)) (catch ’ctak (ctak-aux x y z)))

(defun ctak-aux (x y z)

(declare (type flxnum x y z)) (cond ((not (< y x))

(throw ’ctak z))

(t (ctak-aux

(catch ’ctak

(ctak-aux (1- x)

h)

(catch ’ctak

(ctak-aux (1- y)

x ) }

(catch ’ctak

(ctak-aux (1- z)

y) )))))

deflne-tlmer ctak "CTak M (ctak 18. 12. 6.)) qa-attempt "CTak" (ctak 18. 12. 6.) 7)

; TAKL

;xy

;xy

(defun IIstn (n)

(If (not (- 0 n)) (cons n (I Istn (defvar 181 )(setq 181 (defvar 121 )(setq 121 (defvar 61 )(setq 61

(1- n)))))

(IIstn 18)) (IIstn 12)) (IIstn 6))

(defun mas (x y z)

(declare (type list x y z))

(If (not (shorterp y x)) z

(mas (mas (cdr x) y z)

(mas (cdr y) z x)

(mas (cdr z) x y))))

(defun shorterp (x y)

(declare (type list x y))

(and y (or (nu11 x)

(shorterp (cdr x)

(cdr y)))))

deflne-tlmer takl "TakL M (mas 181 121 61)) qa-attempt "TakL M (mas 181 121 61) (765432 1))

*

continued

BYTE LISTINGS SUPPLEMENT • APRIL-JUNE, 1987 39

April

; TAKR

; Gross Version to try to trash cache.

(defIne-tiroer takr "TakR" (tak0 18. 12. 6.)) (qa-attempt "TakR" (tak0 18. 12. 6.) 7)

(DEFUN TAK0 (X Y Z)

(declare (type fixnum x v z (COND ((NOT (< Y X)) Z)

(T (TAXI (TAK37 (1(TAK11 (1(TAK17 (1

(DEFUN TAXI (X Y Z)

(declare (type fixnum x y 2 (COND ((NOT (< Y X)) Z)

(T (TAX2 (TAX74 (1(TAK22 (1(TAX34 (l

(DEFUN TAX2 (X Y Z)

(declare (type fixnum x v z (COND ((NOT (< Y X)) Z)

(T fTAX3 fTAX11 (1

))

))

X) Y 1)

Y) Z X)

Z) X Y)))))

(TAX3 (TAX11 (TAX33 (TAX51

(DEFUN TAX3 (X Y Z)

(declare (type fixnum x (COND ((NOT (< Y

))

X) Y Z)

Y) Z X)

Z X Y)))))

*))

(DEFUN TAK4 (X Y Z) (declare (COND

(TAK48 i

; i_

Y Z)

(TAK44 j

1- Y)

Z X)

(TAK68 1

(1- Z) X Y)

Table caption))))

(type fixnum x y 2 )) NOT (< Y X)) Z) (TAX5 (TAX85 (1(TAX55 (1(TAX85 (l

(DEFUN TAX5 (X Y Z)

X) Y Z)

y x ’

z) X Y)))))

(declare (COND

(type fixnum x NOT (< Y X)) Z (TAX6 (TAX22

It

Z))

(DEFUN TAX6 (X Y Z) (declare (type fixnum

(TAX66 . (TAX2 (1- Z)

I!:?!

X Y)))))

(COND ((NOT (< Y (T (TAX7 '

(DEFUN TAX7 (X Y Z)

x)) X z

TAK59

TAK77

TAK19

z))

s

X) Y Z

Y) Z X

Z) X Y

))))

(declare (COND

(type fixnum x y z)) NOT (< Y X)) Z)

(TAX8

(DEFUN TAX8 (X Y Z) (declare (COND

(TAX96

(TAX88

(TAX36

(type fixnum x y z)) NOT (< Y X)J_ZJ

II

(TAK9

(DEFUN TAK9 (X Y Z)

(TAK33

(TAK99

CTAK53

It

X) Y Z

Y) Z X

Z) X Y

))))

(declare

(COND

(type fixnum x y NOT (< Y X)) Z)

z»

II

(TAK10

(DEFUN TAK10 (X Y Z)

TAK70

TAK10

TAK70

(declare (COND

(type fixnum x y NOT (< Y X)) Z)

I!

(taxii

(TAX7 (1(TAX21 (1 (TAX87 (l

x) Y Z)

- Y1 Z XI

- Z) X Y)

))))

40 BYTE LISTINGS SUPPLEMENT • APKIL-JUNE, 1987

(DEFUN TAK11 (X Y Z)

(declare (type fixnum x y z)) (COND ((NOT (< Y X)) Z)

(T (TAK12 (TAK44 (1- X) (TAK32 (1- Y) (tAK4 (1- Z)

(DEFUN TAK12 (X Y Z)

(declare (type fixnum x (NOT (< Y X)) (TAK13

Y Z) Z X X Y)

)>

))

(COND

y *))

(TAK81

(1- X)

Y

Z)

(TAK43

(1- Y)

Z

X)

(TAK21

(1- Z)

X

Y)

(COND

’ S v

if"

(DEFUN TAK13 (X Y Z)

(declare (type fixnum x y z)) (NOT (< Y X)) Z) (TAK14 (TAK18 (TAK54 (TAK38

(DEFUN TAK14 (X Y Z)

(declare (type fixnum x y z)) (COND ((NOT (< Y X)) Z)

(T (TAK15

Table caption))))

(TAK55

X)

Y

(TAK65

(1- y)

Z

(TAK55

(1- Z)

X

2 ))

z))

(DEFUN TAK15 (X Y Z)

(declare (type fixnum x y (COND ((NOT (< Y X)) Z)

(T (TAK16 (TAK92 (TAK76 (TAK72

(DEFUN TAK16 (X Y Z)

(declare (type fixnum x y (COND ((NOT (< Y X)) Z)

(T (TAK17 (TAK29 (TAK87 (TAK89

(DEFUN TAK17 (X Y Z)

(declare (type fixnum x y z)) (NOT (< Y X)) Z)

(TAK18 (TAK66 (1- X) (TAK98 (1- Y) (TAK6 (1- Z)

(DEFUN TAK18 (X Y Z)

(declare (type fixnum x y z)) (COND ((NOT (< Y X)) Z)

(T (TAK19

Z)

vi))))

))))

(COND

It"

(DEFUN TAK19 (X Y Z)

TAK3 (1- X) TAK9 (1- Y) TAK23 (1- Z)

(dec I are (COND

if'

type fixnum x y NOT (< Y X)) Z) (TAK20 (TAK40 (TAK20 (TAK40

(DEFUN TAK20 (X Y Z)

(declare (type fixnum x y '(NOT (< Y X)) Z) (TAK21 (TAK77 (TAK31 (TAK57

2 ))

Y Z Z X)

X Y)))))

))))

(COND

if fc

2 ))

(DEFUN TAK21 (X Y Z)

(declare (type fixnum "(NOT (< Y (TAK22

(COND

(DEFUN TAK22 (X Y Z)

urn x y X)) Z) TAK14 TAK42 TAK74

2 ))

(dec I are (COND

if

type fixnum x v NOT (< Y X)) ZJ

2 ))

(TAK23

TAK51

TAK53

TAK91

))))

))))

))))

continued

BYTE LISTINGS SUPPLEMENT • APRIL-JUNE, 1987 41

April

(DEFUN TAK23 (X Y Z)

(declare (type flxnum x

(COND

a

z))

NOT (< Y X)) Z5 (TAK24 (TAK88 (1- X) (TAK64 (1- Y)

(DEFUN TAK24 (X Y Z) (declare (COND ,,

(TAK25

(type flxnum x NOT (< Y X)) Z

8

TAK25 'TAK75 (TAK25

(DEFUN TAK25 (X Y Z)

(declare (type flxnum x v (COND ((NOT (< Y X)) Z) (T (TAK26 (TAK62 (TAK86 (TAK42

(DEFUN TAK26 (X Y Z) (declare (COND ,,

(TAK27

(TAK8 (1- Z) X Y)))))

r”

(type flxnum x y NOT (< Y X)) Z) (TAK99 (TAK97 (TAK59

it

(DEFUN TAK27 (X Y Z)

£type flxnum x

(declare (COND

8

NOT (< Y X)) Z?

(TAK28 (TAK36 (1- X)

(TAK8 (1- Y) Z X) (TAK76 (1- Z) X Y)))))

Y Z)

(DEFUN TAK28 (X Y Z)

(declare (type flxnum x

(COND

8

NOT (< Y X)) Z, (TAK29 (TAK73 (1

(TAK19 (TAK93

(DEFUN TAK29 (X Y Z)

(declare (type flxnum x v (COND ((NOT (< Y X)) Z) (T (TAK30 (TAK10 (TAK30 (TAK10

(DEFUN TAK30 (X Y Z) (declare (type flxnum

(COND

9

NOT (< Y X)) z (TAK31 (TAK47 (TAK41 (TAK27

(DEFUN TAK31 (X Y Z)

(declare (type flxnum x

(COND

K 1

not (< Y X)) z^ (TAK32 (TAK84 (1(TAK52 (TAK44

(DEFUN TAK32 (X Y Z)

(declare (type flxnum x y (COND ((NOT (< Y X)) Z)

(T (TAK33 (TAK21 (1- X (TAK63 (1- Y (TAK61 (1- Z

(DEFUN TAK33 (X Y Z)

(declare (type flxnum x y z))

- (NOT (< Y X)) Z)

(TAK34

(COND

» S 1

Sl K

(DEFUN TAK34 (X Y Z)

(declare (type flxnum x v (COND £(NOT (< Y X)) Z)

(TAK58 1

[1- X)

Y Z)

(TAK74 1

1- Y)

Z X)

(TAK78 l

1- Z)

X Y)

(TAK35

TAK95

TAK85

TAK95

z))

1- X 1- Y 1- Z

Table caption))))

42 BYTE LISTINGS SUPPLEMENT • APRIL-JUNE, 1987

(COND

(COND

if

if

Z»

(DEFUN TAK35 (X Y 2)

(declare (type fixnum x y (NOT (< Y X)) Z)

(TAK36 (TAK32 (TAK96 (TAK12

(DEFUN TAK36 (X Y Z)

(declare (type fixnum x y 2 )) (NOT (< Y X)) Z)

(TAK37 (TAK69 (1- X)

))))

. Y Z) (TAK7 (1- Y) Z X) (TAK29 (1- Z) X Y)))))

(DEFUN TAK37 (X Y Z)

(declare (type fixnum x y 2 )) (COND £(NOT (< Y X)) Z)

(TAK38 (TAK6 (l- X) Y Z)

(TAK18 (TAK46

(DEFUN TAK38 (X Y Z)

(declare (type fixnum x

il: 3 i 3

(COND £(NOT (< Y X))Z)

Y z))

(TAK39 (TAK43 (1

(TAK29

[TAK63

(DEFUN TAK39 (X Y Z)

(declare (type fixnum x y 2 )) (COND ((NOT (< Y X)) Z)

(T (TAK40 (TAK80 (1- X (TAK40 (1 (TAK80 (1

(DEFUN TAK40 (X Y Z)

(declare (type fixnum x y

))))

))))

NOT (< Y X)) Z) (TAK41 (TAK17 (TAK51 (TAK97

(DEFUN TAK41 (X Y Z)

(declare (type fixnum x y (NOT (< Y X)) Z) (TAK42 (TAK54

(COND

(COND

$

if

z))

z))

(TAK62 (TAK14

(DEFUN TAK42 (X Y Z)

(declare (type fixnum x y (COND ((NOT (< Y X)) Z) (T (TAK43 (TAK91 (TAK73 (TAK31

(DEFUN TAK43 (X Y Z)

(declare (type fixnum x y (NOT (< Y X)) Z) (TAK44 (TAK28 (TAK84 TAK48

z))

(COND

if

z))

(DEFUN TAK44 (X Y Z)

(declare (type fixnum x y

- (NOT (< Y X)) Z)

(TAK45

))))

))))

(COND

' S '

if

z))

x)) 2)

(TAK65 (TAK95 (TAK65

(DEFUN TAK45 (X Y Z)

(declare (type fixnum x y 2 )) (NOT (< Y X)) Z) (TAK46 (TAK2 ' (TAK6 (TAK82

(COND

if

(DEFUN TAK46 (X Y Z)

it 3,

( 1 - z)

(declare (COND (0

(type fixnum x v (NOT (< Y X)) Z) (TAK47 (TAK39 (TAK17 (TAK99

z))

Y Z Z X)

x Y)))))

))))

continued

BYTIi LISTINGS SUPPLEMENT • APRIL-JUNE, I9S7 43

April

(DEFUN TAK47 (X Y Z)

(declare (type flxnum x y (COND ((NOT (< Y X)) Z)

(T (TAK48 (TAK76 (TAK28 (TAK16

(DEFUN TAK48 (X Y Z)

(declare (type flxnum x y (COND ((NOT (< Y X)) Z)

(T (TAK49 (TAK13 (TAK39 (TAK33

(DEFUN TAK49 (X Y Z)

(declare (type flxnum x y (COND ((NOT (< Y X)) Z)

(T (TAK50 (TAK50 (TAK50 (TAK50

(DEFUN TAK50 (X Y Z)

(declare (type flxnum x y (COND ((NOT (< Y X)) Z)

(T (TAK51 (TAK87 (TAK61 (TAK67

(DEFUN TAK51 (X Y Z)

(declare (type flxnum x y (COND ((NOT (< Y X)) Z)

(T (TAK52 (TAK24 (TAK72 (TAK84

(DEFUN TAK52 (X Y Z)

(declare (type flxnum x y (COND ((NOT (< Y X)) Z)

(T (TAK53 (TAK61 (1- X) Y Z) (TAK83 (1- Y) Z X) (TAK1 (1- Z) X Y)))))

(DEFUN TAK53 (X Y Z)

(declare (type flxnum x y z))

(COND ((NOT (< Y X)) Z)

(T (TAK54 (TAK98 (1- X (TAK94 (1- Y (TAK18 (l- Z

(DEFUN TAK54 (X Y Z)

(declare (type flxnum x y z))

(COND ((NOT (< Y X)) Z)

(T (TAK55 (TAK35 (1- X)

(TAK5 (1- Y)

(TAK35 (1- Z)

(DEFUN TAK55 (X Y Z)

(declare (type flxnum x y (COND ((NOT (< Y X)) Z)

(T (TAK56 (TAK72 (TAK16 (TAK52

(DEFUN TAK56 (X Y Z)

(declare (type flxnum x y (COND ((NOT (< Y X)) Z)

(T (TAK57 (TAK9 (1- X)

(TAK27 (1- Y)

(TAK69 (1- Z)

(DEFUN TAK57 (X Y Z)

(declare (type flxnum x y (COND ((NOT (< Y X)) Z)

(T (TAK58 (TAK46 (TAK38 (TAK86

(DEFUN TAK58 (X Y Z)

(declare (type flxnum x y

(COND ((NOT (< Y X)) Z) w

(T (TAK59 (TAK83 (1- X) Y Z) (TAK49 (1- Y) Z X) (TAK3 (1- Z) X Y)))))

Y Z)

2 X)

X Y)))))

44 BYTE LISTINGS SUPPLEMENT • APRIL-JUNE, 1987

(DEFUN TAK59 (X Y Z)

(declare (type fixnum x y 2 )) (COND ((NOT (< Y X)) Z)

(T (TAK60 (TAK20 (TAK60 (TAK20

(DEFUN TAK60 (X Y Z)

(declare (type fixnum x y (NOT (< Y X)) Z)

(COND

If

*))

*))

(TAK61 (TAK57 (TAK71 (TAK37

(DEFUN TAK61 (X Y Z)

(declare (type fixnum x y (COND ((NOT (< Y X)) Z)

(T (TAK62 (TAK94 (TAK82 (TAK54

(DEFUN TAK62 (X Y Z)

(declare (type fixnum x y (NOT (< Y X)) Z) (TAK63 (TAK31 (TAK93 (TAK71

(DEFUN TAK63 (X Y Z)

(declare (type fixnum x y 2 )) (NOT (< Y X)) Z) (TAK64

(COND

if"

z))

))))

))))

))))

(COND

if*

TAK68 (1- X) Y Z)

TAK4 (1- Y) Z X)

TAK88 (1- Z) X Y)))))

)i

(COND

if*

(DEFUN TAK64 (X Y Z)

(declare (type fixnum x y 2 ))

(COND ((NOT (< Y X)) Z)

(T (TAK65 (TAK5 (1- X) Y Z) (TAK15 (1- Y) Z X (TAK5 (1- Z) X Y"

(DEFUN TAK65 (X Y Z)

(declare (type fixnum x y 2 ))

(NOT (< Y X)) Z)

(TAK66 (TAK42 (1- X) (TAK26 (1- Y) (TAK22 (1- ZJ

(DEFUN TAK66 (X Y Z)

(declare (type fixnum x y 2 ))

(COND ((NOT (< Y X)) Z)

(T (TAK67 (TAK79 (TAK37 (TAK39

(DEFUN TAK67 (X Y Z)

(declare (type fixnum x y 2 ))

(NOT (< Y X)) Z)

(TAK68 (TAK16 TAK48 TAK56

)))

))))

(COND

if*

(OEFUN TAK68 (X Y Z)

(declare (type fixnum x y

(CONO

NOT (< Y X)) Z) (TAK69 (TAK53 (TAK59 (TAK73

(DEFUN TAK69 (X Y Z)

(declare (type fixnum x y (COND ((NOT (< Y X)) Z) (T (TAK70 (TAK90 (TAK70 (TAK90

(DEFUN TAK70 (X Y Z)

if

z))

))))

z))

(declare (COND

(type fixnum x y NOT (< Y X)) Z)

if

z))

(TAK71 (TAK27 (1- X) (TAK81 (1- Y) (TAK7 (1- Z)

continued

BYTE LISTINGS SUPPLEMENT • APRIL-JUNE, 1987 45

(DEFUN TAK71 (X Y Z)

(declare (type fixnum x y (COND ((NOT (< Y X)) Z) (T (TAK72 (TAK64 (TAK92 (TAK24

(DEFUN TAK72 (X Y Z)

(declare (type fixnum x y (COND ((NOT (< Y (T (TAK73

z))

))))

z))

X)) Z)

TAK1 (1- X) Y Z)

TAK3 (l- Y) Z X)

TAK41 (1- Z) X Y)))))

(DEFUN TAK73 (X Y Z)

(declare (type fixnum x y z)) (COND ((NOT (< Y X)) Z)

(T (TAK74 (TAK38 (1- X) (TAK14 (1- Y) (TAK58 (1- Z)

(DEFUN TAK74 (X Y Z)

(declare (type fixnum x y z)) (COND ((NOT (< Y (T (TAK75

8

Y)))))

1- X 1- Y 1- Z

z))

))))

X)) z]

(TAK75 (TAK25 (TAK75

(DEFUN TAK75 (X Y Z)

(daclare (typ© fixnum x y (COND ((NOT (< Y X)) Z)

(T (TAK76 (TAK12 (TAK36 (TAK92

(DEFUN TAK76 (X Y Z)

(declare (type fixnum x y z))

(COND ((NOT (< Y X)) Z)

(T (TAK77 (TAK49 (1- X)

(TAK47 (1- Y)

(TAK9 (1- Z) X Y)))))

(DEFUN TAK77 (X Y Z)

(declare (type fixnum x y z))

(COND ((NOT (< Y X)) Z)

(T (TAK78

TAK86

TAK58

TAK26

(DEFUN TAK78 (X Y Z) (declare (type fixnum x (COND '

))))

((NOT (< Y (T (TAK79 I

z))

*))

z))

X)) z]

TAK23 TAK69 (TAK43

(DEFUN TAK79 (X Y Z)

(declare (type fixnum x y (COND ((NOT (< Y X)) Z)

(T (TAK80 (TAK60 (TAK80 (TAK60

(DEFUN TAK80 (X Y Z)

(declare (type fixnum x y (COND ((NOT (< Y X)) Z)

(T (TAK81 (TAK97 (TAK91 (TAK77

(DEFUN TAK81 (X Y Z)

(declare (type fixnum x y (COND ((NOT (< Y X)) Z)

(T (TAK82 (TAK34 (1- X) Y Z) (TAK2 (1- Y) Z X) (TAK94 (1- Z) X Y)))))

(DEFUN TAK82 (X Y Z)

(declare (type fixnum x y (COND ((NOT (< Y X)) Z)

(T (TAK83 (TAK71 (TAK13 (TAK11

))))

))))

z))

z))

1_

1- Y

1- z)

))))

46 BYTE LISTINGS SUPPLEMENT • APRIL JUNE, 1987

(DEFUN TAK83 (dec lore (COND

(X Y Z)

! type flxnum x v NOT (< Y X)) Z)

if

2 »

(TAK84 (TAK8 (l- X) Y Z) (TAK24 ‘ ‘

(COND

’ V »■

ir

(TAK28

(DEFUN TAK84 (X Y Z)

(declare (type flxnum x v

- '(NOT (< Y X)) 2)

(TAK85 (TAK45 (TAK35 (TAK45

(DEFUN TAK85 (X Y Z)

(type fixnum x y (NOT (< Y X)) Z) (TAK86 (TAK82 (TAK46 (TAK62

(1- Y) (1- Z)

' 2))

(dec I are (COND ((f

2))

(DEFUN TAK86 (declare (COND

(X

(type flxnum x (NOT (< Y X)) Z (TAK87

if

Y Z) flxnum

*»

(TAK19 (TAK57 (TAK79

(DEFUN TAK87 (X Y Z) (declare (COND ((NOT (< Y X)) Z)

(T (TAK88 (TAK56 (1(TAK68 (1(TAK96 (1

(DEFUN TAK88 (X Y Z)

(type

X)

Y) ))))

))))

))))

I))))

flxnum x

y *))

?!

z)

(declare (COND

type flxnum x y 2 )) NOT (< Y X)) Z)

(TAK89

(DEFUN TAK89 (X Y Z)

TAK93

TAK79

TAK13

?!

Y)))))

))))

(declare (COND

(type flxnum x y NOT (< Y X)) Z)

i ? 1

*))

(TAK90

(DEFUN TAK90 (X Y Z) (declare (type flxnum

TAK30

TAK90

TAK30

(COND

if

*))

NOT (< Y X)) Z^

(TAK91 (TAK67 (1- X) Y Z) (TAK1 (1- Y) Z X)

TAK47 (1- Z) X Y)))))

(DEFUN TAK91 (X Y Z)

! type flxnum x NOT (< Y X)) Z

(declare (COND

if*

*))

(TAK92 (TAK4 (l- X) Y Z) (TAK12 ‘

(TAK64

(DEFUN TAK92 (X Y Z)

(declare (type flxnum x - (NOT (< Y X)) Z

il: ?! I ?!,.

(COND

if'

(TAK93

2 ))

(DEFUN TAK93 (X Y Z)

TAK41

TAK23

TAK81

(declare (COND

(type flxnum x v NOT (< Y X)) Z]

if

*))

(TAK94

JTAK78

TAK34

TAK98

(DEFUN TAK94 (X Y Z)

(declare (type flxnum x

(COND

if

NOT (< Y (TAK95 I

X)) Z) TAX 15 TAK45 TAK15

2 ))

>))

))))

))))

))))

continued

BYTE LISTINGS SUPPLEMENT • APRIL-JUNE. 1987 47

(DEFUN TAK95 (X Y Z)

(declare (type fixnum x y z))

(COND ((NOT (< Y X)) Z)

(T (TAK96 (TAK52 (1- X) Y Z)

(TAK56 (1- Y) Z X)

(TAK32 (1- Z) X Y)))))

(DEFUN TAK96 (X Y Z)

(declare (type fixnum x y z))

(COND ((NOT (< Y X)) Z)

(T (TAK97 (TAK89 (1- X) Y Z)

(TAK67 (1- Y) Z X)

(TAK49 (1- Z) X Y)))))

(DEFUN TAK97 (X Y Z)

(declare (type fixnum x y z))

(COND ((NOT (< Y X)) Z)

(T (TAK98 (TAK26 (1- X) Y Z)

(TAK78 (1- Y) Z X)

(TAK66 (1- Z) X Y)))))

(DEFUN TAK98 (X Y Z)

(declare (type fixnum x y z))

(COND ((NOT (< Y X)) Z)

(T (TAK99 (TAK63 (1- X) Y Z)

(TAK89 (l- Y) Z X)

(TAK83 (1- Z) X Y)))))

(DEFUN TAK99 (X Y Z)

(declare (type fixnum x y z))

(COND ((NOT (< Y X)) Z)

(T (TAK0 (TAK0 (1- X) Y Z)

(TAK0 (I" Y) Z X)

(TAK0 (1- Z) X Y)))))

TIMING.LSP Contributed by: Ernest R. Tello

TEXT "The GCLISP 286 Developer," by Ernest R. Tello. April

1987, page 242.

; timlmg routines

(defconstont Internal-time-unlts-per-second 100)

(defun get-lnternal-run-tIme ()

(multlple-volue-blnd (Ignorel lgnore2 lgnore3 cx dx)

(sy8:Xsyslnt #x21 ^x2c00 000)

(+ (* (Ish cx -8) 60 60 100)

(* (logand cx #xFF) 60 100)

(* (Ish dx -8) 100)

(logand dx #xFF))))

(defun timed-duration (fn)

(let ((start-run (get-lnternal-run-tIme)))

(funcall fn)

(let ((end-run (get-lnternal-run-time))) vvsvv

(float (/ (- end-run start-run) Internal-time-unlts-per-second)))))

(defporameter *mintmum-tests* 1)

(defparameter emlnlmum-duratlon* 10.0)

(defun mu 11Iple-tImed-duratIon (fn)

flet* ((total-run-tIme (timed-duration fn))

(repeats (max *mlnfmum-tests*

(celling *mlnlmum-duratIon*

(If (zerop total-run-tIme) 1 total-run-tIme)))))

(do ((count repeats (- count 1)))

((< count 2) (values total-run-time repeats)^

(Incf total-run-tIme (timed-duration fn)))))

J defvar *all-tlmer8* nil) defvar *bad-tlmere* *(tak boyer))

4K BYTE LISTINGS SUPPLEMENT • APRIL JUNE, 1987

(defmacro define-tlmer (name documentation &body body)

'(progn (pushnew ’.name *aIl-tImers*)

(setf (get ',name 'timina-function)

, (i f (and (- (length body) 1) (= (length (first body)) 1))

(list *quote (first (first body)))

‘#'(lambda () . ,body)))

(setf (get '.name 'timing-documentation) .documentation)))

(defun run-tests (&optional file)

(If (null file) (run-testsl 't)

(with-open-file (stream file direction :output) (run-testsl stream))))

(defun run-testsl (stream)

! describe-implementation stream) do ((tests *all-timers* (cdr tests))) ((null tests) '*)

(cond ((member (first tests) *bad-timers*)

(format stream "&Run of A punted due to stack group reset.%"

(get (first tests) 'timing-documentation)))

(t ?sys::gc)

(multIple-value-bind (answer error?)

(ignore-errors (run-one (first tests) stream))

(if error? (format stream "% ERROR: A%" error?)))))))

(defun run-one (name icoptional (stream ♦terminal-lo*))

(unless (get name 'timing-documentation)

(error "isThere's no such benchmark as S.%" name))

(format stream "^Running A . . . M (get name 'timing-documentation)) (multiple-value-bind (time n-runs)

(multiple-timed-duration (get name 'timing-function))

(format stream "% time: D seconds (based on D call"

(/ time n-runs) n-runs)

(unless (- n-runs 1) (write-char #\s stream))

(format stream ")%" time n-runs)))

(defun descrIbe-lmpIementation (^optional (stream *standard-output*))

= i

(format stream "&Llsp Type: A

(format stream "&Llsp Version: A #+:Large-Memory

J format stream "&Machine Type: IBM-PC/AT") -:Large-Memory

[format stream "ScMachlne Type:

[format stream "^Features

if

Iisp-lmpIementation-type))

Iisp-impIementatlon-version))

IBM-PC/XT")

A" (car ^features*))

! cdr *features*) (format stream ", "))

(features (cdr ♦features*) (cdr features))

(offset (+ 17 (length (string (car *features*))))))

((null features))

(let* ((feature (string (car features))) (Ith (length feature))) (cond ((> (setq offset (+ offset 2 lth))76)

(setq offset (+ 15 Ith))

(format stream "& A" feature))

(t (format stream "A" feature)))

(when (cdr features)

(setq offset (+ offset 2))

(format stream ", *'))))

(format stream "%%"))

(defvar *benchmark-f1 Ies* '("DESTRUCT"

" 10 "

"FRPOLY"

"TRIANG"

; "PUZZLE"

; "FFT"

"DIV"

"DERIV"

"TRAVERSE"

"BROWSE"

"BOYER"

"TAK"

))

(defmacro qa-attempt (&body stuff) (list 'quote stuff))

continued

BYTE LISTINGS SUPPLEMENT • APRIL-JUNE, 1987 49

(defun benchmark-file (file) (merge-pathnames "C:>GCLISP2> n file))

(defun load-benchmark-files () jf#i

(mapc #’(lambda (file) (load (benchmark-file file))) *benchmark-fiIes*))

(defun compile-benchmark-files (fcoptional load?)

(mapc #'(lambda (file) (compile-file (benchmark-file file) :load load?)) ♦benchmark-fIles*))

TRAVERSE.LSP Contributed by: Ernest R. Tello

TEXT "The GCLISP 286 Developer," by Ernest R. Tello. April

1987, page 242.

; TRAVERSE

; Benchmark to create once and traverse a Structure

(defstruct node

I parents ()) sons ()) sn (snb)) entryl ()) entry2 ()) entry3 ()) entry4 ()) entry5 ()) entry6 (}) mark ()))

(defvar sn 0)

(defvar rand 21.)

(defvar count 0)

(defvar marker nil)

(defvar root)

(defun snb () (setq sn (1+ sn)))

(defun seed () (setq rand 21.))

(defun traverse-random () (setq rand (mod (* rand 17.) 251.)))

(defun traverse-remove (n q)

(cond ((eq (cdr (car q)) (car q))

(prog2 () (caar q) (rplaca q ()))) ((« n 0)

(prog2 () (caar q)

iii

(do ((p (car q) (cdr p)'

((«q (cdr p) (car q)

(rplaca q

(rplacd p (cdr (car q))))))))

(t (do ((n n (1- n))

(q (car q) (cdr q))

(p (cdr (car q)) (cdr p)))^ vvnvvvn

((« n 0) (prog2 () (car q) (rplacd q p)))))))

(defun traverse-select (n q) (do ((n n (1- n))

(q (car q) (cdr q))) ((- n 0) (car q))))

(defun add (a q)

(cond ((null q)

‘(.(let ((x '(.a)))

(rplacd x x) x)))

((nuI I (car q))

(let ((x *(.a)))

(rplacd x xj (rplaca q x)))

(t (rpIaca q

(rplacd (car q) *(.a ..(cdr (car q))))))))

Ml BVTIi LISTINQS SUPPLEMENT • APRIL-JUNE, 1987

(defun create-structure (n)

(let ((a *(,(make-node)))) (do ((m (1- n) (1- m))

m 0) (seta a ‘(.(rplacd p a)))

(do ((unused a)

i used (add (traverse-remove 0 a) ()))

x) (y))

(nuI I (car unused))

find-root (traverse-select 0 used) n)) setq x (traverse-remove (rem (traverse-random)n) setq y (traverse-select (rem (traverse-random)n) add x used)

setf (node-sons y) ' (,x (node-sons y)))

(setf (node-parents x) *(,y ..(node-parents x))))) (push (make-node) a))))

unused))

used))

(defun find-root (node n)

(do ((n n (1- n)))

((* n 0) node)

(cond ((null (node-parents node))

(return node))

(t (setq node (car (node-parents node)))))))

(defun travers (node mark)

(cond ((eq (node-mark node) mark) ())

(t (setf (node-mark node) mark)

(setq count (1+ count))

(setf (node-entryl node

(node-entry2 node) (node-entry3 node) ?node-entry4 node) fnode-entry5 node) (node-entry6 node)

(setf (setf [setf (setf

[setf „ . , ,

[do ((sons (node-sons node) (cdr sons))) ((nulI sons) ())

(travers (car sons) mark)))))

not

not

not

not

not

not

(node-entryl node! (node-entry2 node) node-entry3 node) node-entry4 node) node-entry5 node) node-entry6 node)

(defun traverse (root)

(let ((count 0))

(travers root (setq marker (not marker))) count))

(qa-attempt "Traverse init" (setq root (create-structure 100.)) nil)

(qa-attempt "Traverse"

(do ((i 50. (1- i)))

((- I 0)) x

(traverse root)

(traverse root)

(traverse root)

(traverse root)

(traverse root))

nil)

(defIne-timer traverse "Traverse, Traverse"

(do ((i 50. (1- I)))

((• i 0)) v

! traverse root) traverse root)

S traverse root)

traverse root) (traverse root)))

(define-timer traverse-in 11 "Traverse, Initialize" (prog2 (setq root (create-structure 100.)) ()))

continued

BYTE LISTINGS SUPPLEMENT • APRIL-JUNE, 1987 51

April

TRIANG.LSP Contributed by: Ernest R. Tello

TEXT "The GCLISP 286 Developer," by Ernest R. Tello. April 1987, page 242.

; TRIANG

(defvar board *#(1 1111011 (defvar sequence (make-array 14. (defvar *a* 1 24356136

4 7 11. 8. 12. (defvar *b* *jf(2 4 7 5 8. 9. 3 6 2 4 7 5 8. 9. 3

11111111 ))

•:In!11 al-elament 0 2 5 4 11. 12. 13. 7 13. 6 10. 15. 9. 14 10. 5 9. 8. 12. 13. 6 10. 5 9. 8. 12.

(defvar *c* ’#(4 7 11. 8. 12. 13. 6 10. 15. 9. 14. 13. 13 12435613625411. 12. 13. 7 8.

(defvar answer)

(defvar final)

(defun last-position ()

(do ((I 1 (1+ !)))

((» 1 16 .) 0 )

(If (* 1 (aref board I))

(return I))))

))

8. 4

13. 13. 14. 14. 8. 9. 5 13. 14. 8. 9.

14. 15. 4 4))

15. 9. 10. 66))

5 ))

9. 10. 6

(defun try (I depth)

(cond ((■ depth 14)

(let ((Ip (last-position)))

(unless (member Ip final) (push Ip final)))

! push (cdr (coerce sequence and (« 1 (aref board (aref

1 (aref board (aref *b* (■ 0 (aref board (aref *c* (aref board (aref board (aref board (aref sequence depth)

(j 0 (1+ J))

(depth (1+ depth)))

(or (- j 36.)

(try j depth)) ()))

(aref board (aref board (aref board

[aref ♦a* [aref *b* [aref *c*

answer)

())))

t)

(defun gogogo ( I )

(dotimes (J 16)

(setf (aref board j) 1))

(setf (aref board 5) 0)

(let ((answer ())

(final ()))

(try I 1)))

(define-timer triang "Triang" (gogogo 22.)) (qa-attempt "Triang" (gogogo 22.) nil)

(defun triang-test ()

(dotimes (j 16)

(setf (aref board j) 1)) (setf (aref board 5) 0)

(let ((answer ())

(final ()))

(try 22. 1)

(■ (length answer) 775.)))

52 BYTE LISTINGS SUPPLEMENT • APRIL-JUNE, 1987

BYTE LISTINGS SUPPLEMENT • APRIL-JUNE, 1987

53

README.1ST Contributed by: David Betz

TEXT "An Adventure Authoring System," David Betz, May 1987, page 125.

Table captionDocumentation

README

1ST

860

3-08-87

11:49a

ADVSYS

DOC

30536

7-20-86

12:15p

Sample adventure source

OSAMPLE

ADV

4355

7-20-86

2:15p

OBJECTS

ADI

13193

7-20-86

2:16p

Definitions

(used by ADVCOM and ADVINT)

ADVDBS

H

5584

7-20-86

12:48p

Compi1er

source code (ADVCOM)

ADVCOM

H

1399

7-20-86

12:48p

ADVAVL

H

782

7-20-86

12:49p

ADVCOM

C

15476

7-20-86

12:40p

ADVFCN

C

14285

7-20-86

12:41 p

ADVSCN

C

6362

7-20-86

12:41p

ADVEXP

C

10829

7-20-86

12:42p

ADVAVL

C

3750

7-20-86

12:42p

ADVFIO

C

998

7-20-86

12:42p

Interpreter

source code

(ADVINT)

ADVINT

H

383

7-20-86

12:50p

ADVMSG

C

2682

7-20-86

12:43p

ADVTRM

C

3243

7-20-86

12:43p

ADVPRS

C

7269

7-20-86

12:43p

ADVDBS

C

11051

7-20-86

12:44p

ADVINT

C

2569

7-20-86

12:44p

ADVJUNK

C

1848

7-19-86

7:24p

ADVEXE

C

6202

7-20-86

12:44p

ADVCOM.H Contributed by: David Betz

TEXT "An Adventure Authoring System," David Betz, May 1987, page 125.

/* advcom.h - adventure compiler definitions */

/*

Copyright (c) 1986, by David Michael Betz All r1ghts reserved

*/

^Include <stdio.h>

^include <ctype.h>

/* limits */

#deflne TKNSIZE

50

/* maximum

#deflne OSIZE

104

/* maximum

#deflne OPMAX

50

/* maximum

^define WMAX

500

/* maximum

^define OMAX

500

/* maximum

#deflne AMAX

200

/* maximum

token size */

object size (0_SIZE/2 + 0PMAX*2) */

# properties/object */

number of words */

number of objects */

number of actions */

continued

BYTE LISTINGS SUPPLEMENT • APRIL-JUNE, I9K7 55

May

fdefine DMAX 16384

fdefine CMAX 16384

fdefine FMAX 20

/* useful definitions */ ijldefine TRUE 1

fdefine FALSE 0

fdefine EOS ’\0’

/* token definitions */ fdefine T.OPEN 1

(((define T.CLOSE 2

fdefine T_STRING 3

(((define T_IDENTIFIER 4

fdefine T.NUMBER 5

fdefine T_EOF 6

/* symbol types */

(((define ST_OBJECT 1

(((define ST_ACTION 2

#define ST_VARIABLE 3

fdefine ST_CONSTANT 4

fdefine ST.PROPERTY 5

/* symbol structure */ typedef struct symbol j char *s_name; int s_type; int s.value; struct symbol *s__next; \ SYMBOL;

/* maximum data space */ /* maximum code space */ /* file name maximum */

/

/* symbol name */

/* symbol type */

/* symbol value */

/* next symbol In table */

/* function argument structure */ typedef struct argument {

char *arg_name; /* argument name */

struct argument *arg_next; /* next argument */ } ARGUMENT;

ADVAVL.H Contributed by: David Betz TEXT "An Adventure Authoring System,"

David Betz, May 1987,

page 125.

/* advavl.h - avl tree definitions */

/ *

Copyright (c) 1986, by David Michael Betz AI I rights reserved

typedef struct tree {

struct tnode *tr_root; int tr_cnt;

\ TREE;

/* root node */

/* count of entries */

typedef struct tnode { int tn_b;

struct tnode *tn_lllnk; struct tnode *tn_rlink; char *tn_key; int tn_word;

| TNODE;

/* balance flag */ /* left subtree */ /* right subtree */ /* word */

/* word number */

^define LLINK(n) ^define RLINK(n) ^define KEY(n) ^define WORD(n) fjfdef ine B(n)

^define tentries(t)

M n )~ >tn - r 1 ink ' n)->tnj<ey)

i(n)->tn_word)

\( n )“ > tn_b)

((t)->tr_cnt)

56 BYTE LISTINGS SUPPLEMENT • APRIL JUNE, 1987

ADVDBS.H Contributed by: David Betz

TEXT "An Adventure Authoring System," David Betz, May 1987, page 125.

/* advdbs.h - adventure database definitions */ /*

Copyright (c) 1986, by David Michael Betz All rights reserved

*/

Table caption/* useful constants */

Idefine T -1

{define NIL 0

idefine WRDSIZE 6

/* data structure version number *

^define VERSION

102

A file header offsets

*/

Idefine HDR_LENGTH

0

a

^define HDR_MAGIC

2

a

#define HDR.VERSION

8

a

idefine HDR ANAME

10

a

Idefine HDRJWERSION

28

a

Idefine HDR.WTABLE

30

a

idefine HDR_WTYPES

32

a

#define HDR.OTABLE

34

A

idefine HDR_ATABLE

36

A

idefine HDR_VTABLE

38

A

idefine HDR_DBASE

40

A

#define HDR_CBASE

42

A

idefine HDR.DATBLK

44

A

idefine HDR_MSGBLK

46

A

idefine HDR_INIT

48

A

/(define HDRJJPDATE

50

A

#define HDR.BEFORE

52

A

#deflne HDR_AFTER

54

A

/(define HDR_ERROR

56

A

idefine HDR SAVE

58

A

/(define HDR_SLEN

60

A

/(define HDR_SIZE

62

A

A word types */

/(define WT_UNKNOWN

0

Idefine WT_VERB

1

Idefine WT_NOUN

2

/(define WT_ADJECTIVE

3

idefine WT_PREPOSITION

4

Idefine WT_CONJUNCTION

5

idefine WT_ARTICLE

6

/* object fields */ #define 0_CLASS #define 0_N0UNS ^define OBJECTIVES #define 0_NPROPERTIES ^define O.PROPERTIES #def!ne 0_SIZE

/* action fields */ ^define ADVERBS ^define A.PREPOSITIONS ^define A_FLAG #define A_MASK #define A_CODE ^define A_SIZE

/* link fields */ ^define L_DATA #define L_NEXT ^define L_SIZE

/* property flags */ ^define P_CLASS

0

2

4

6

8

8

0x8000 /* class property */

continued

BYTE LISTINGS SUPPLEMENT • APRIL JUNE, 1987 57

May

/* action flags */ ijfdef ins A_ACTOR 0x01

Idefine A.DOBJECT 0x02

Idefine A_IOBJECT 0x04

/* opcodes */|def ine OP_BRT |define OP.BRF 0x02

Idefine OP_BR 0x03

Idefine OP_T 0x04

Idefine OP_NIL 0x05

Idefine OP_PUSH 0x06

Idefine OP_NOT 0x07

Idefine OP_ADD 0x08

Idefine OP_SUB 0x09

Idefine OP_MUL 0x0A

Idefine OP.DIV 0x0B

Idefine OP_REM 0x0C

Idefine OP.BAND 0x00

Idefine OP_BOR 0x0E

Idefine OP.BNOT 0x0F

Idefine OP_LT 0x10

Idefine OP_EQ 0x11

Idefine OP_GT 0x12

Idefine OP_LIT 0x13

{ define OP_VAR 0x14

define OP_GETP 0x15

Idefine OP.SETP 0x16

Idefine OP_SET 0x17

Idefine OP_PRINT 0x18

Idefine OP_TERPRI 0x19

{ define OP.PNUMBER 0x1A

define OP_FINISH 0x1B

Idefine OP_CHAIN 0x1C

Idefine OP_ABORT 0x1D

{ define OP.EXIT 0x1E

define OP.RETURN 0x1F

Idefine OP_CALL 0x20

Idefine OP.SVAR 0x21

Idefine OP_SSET 0x22

Idefine OP_SPLIT 0x23

Idefine OP_SNLIT 0x24

Idefine OP.YORN 0x25

Idefine OP_SAVE 0x26

Idefine OP_RESTORE 0x27

Idefine OP_ARG 0x28

Idefine OP_ASET 0x29

Idefine OP_TMP 0x2A

Idefine OP_TSET 0x2B

Idefine OP_TSPACE 0x2C

Idefine OP_CLASS 0x2D

Idefine OP_MATCH 0x2E

Idefine OP_PNOUN 0x2F

Idefine OP_RESTART 0x30

Idefine OP_RAND 0x31

idefine OP_RNDMIZE 0x32

Idefine OP_SEND 0x33

Idefine OP.XVAR 0x40

Idefine OP.XSET 0x60

Idefine OP.XPLIT 0x80

Idefine OP_XNLIT 0xC0

/* but I tin variables */ Idefine V_ACTOR 1

Idefine V^ACTION 2

Idefine V_DOBJECT 3

idefine V_NDOBJECTS 4

Idefine V.IOBJECT 5

Idefine V.OCOUNT 6

/* actor ♦/

/* direct object */

/* indirect object */

0x01 /* branch on true */

/* branch on false */

/* branch unconditionally */

/* load top of stack with t */

/* load top of stack with nil */

/* push nil onto stack */

/* logical negate top of stack */

/* add two numeric expressions */

/* subtract two numeric expressions */

/* multiply two numeric expressions */

/* divide two numeric expressions */

/* remainder of two numeric expressions */

/* bitwise and of two numeric expressions */ /* bitwise or of two numeric expressions */

/* bitwise not of two numeric expressions */ /* less than */

/* equal to */

/* greater than */

/* load literal */

/* load a variable value */

/* get the value of an object property */

/* set the value of an object property */

/* set the value of a variable */

/* print messages */

/* terminate the print line */

/* print a number */

/* finish handling this command */

/* chain to the next handler */

/* abort this command */

/* exit the program */

/* return from interpreter */

/♦call a function */

/♦ short load a variable */

/* short set a variable */

/* short load a positive literal */

/* short load a negative literal #/

/* yes-or-no predicate */

/* save data structures */

/* restore data structures */

/* load an argument value */

/* set an argument value */

/* load a temporary variable value */

/* set a temporary variable */

/* allocate temporary variable space */

/* get the class of an object */

/* match a noun phrase with an object */

/* print a noun phrase */

/* restart the current game */

/* generate a random number */

/* seed the random number generator */

/* send a message to an object */

/# extra short load a variable */

/* extra short set a variable */

/* extra short load a positive literal */

/* extra short load a negative literal */

/* actor noun phrase number */

/* action from parse */

/* first direct object noun phrase number */ /* number of direct object noun phrases */

/♦ Indirect object noun phrase number */

/* total object count */

5* BYTE LISTINGS SUPPLEMENT • APRIL JUNE. I‘)H7

ADVCOM.C Contributed by: David Betz

TEXT "An Adventure Authoring System," David Betz, May 1987, page 125.

/* advcom.c - a compiler for adventure games */

/*

Copyright (c) 1986, by David Michael Betz All rights reserved

*/

^Include "advcom.h" finclude "advavl.h"

^include "advdbs.h"

/* symbol tables ★/

SYMBOL ★symbols;

ARGUMENT ★arguments;

ARGUMENT ★temporaries;

/★ adventure Id information ★/ char aname[19]; int aversion;

/♦ word table ★/

int wtabIe[WMAX+1],wcnt;

/* object table */ int otabI e[0MAX+1],ocnt;

/♦ action table */ int atable[AMAX+1],acnt;

/★ constant, variable and property symbol counts ★/ int cent,vent,pent;

/★ data and code space ♦/ char ★data,★code; int dptr.cptr;

/★ buffer for building an object ★/ int objbuf[OSIZE];

int nprops;

/★ global variables ★/ char If1 Ie[FMAXl; char of 1Ie[FMAXJ;

FILE *ifp;

unsigned int msgoff;

TREE *words;

int curwrd;

int curobj;

int curact;

int def_flag;

int def_mask;

/* input file name ♦/

/♦ output file name ★/

/♦ input file pointer ♦/

/♦ message section offset ♦/

/* word tree ★/

/♦ current word number ♦/

/★ current object ★/

/★ current action ♦/

/* default action flag value ★/

/★ default action mask value */

/* header Information Int h_InIt; int h_update; int h_before; in t h_a f t e r;

Int h_error;

variables ★/

/★ Initialization code ★/ /* update code ★/

/★ before handler code */ /♦ after handler code */ /♦ error handling code */

/★ external routines ★/ extern char ★mallocQ; extern char ★calloc(); extern TREE ★tnew();

/★ external variables ★/ extern int erreount; extern int t_value; extern char t_token[l; extern char ★t_names[j; extern long ad_foff;

/* error count ♦/

/★ token value ♦/

/* token string ★/

/* token names ★/

/★ data file offset ★/

continued

BYTE LISTINGS SUPPLEMENT • APRIL-JUNE. 1987 59

May

/* forward declarations */ SYMBOL *sfind();

SYMBOL *senter(); char *save();

/* main - the main routine */ main(argc,argv)

int argc; char *argv[];

I

int tkn.obj.l;

/* initialize */

#1fdef MAC

macinit(IfIle,of1le);

#else x .

pr Int f("ADVCOM vl.2 - Copyright (c) 1986, by David Betz\n");

#endif

went » oent • aent » cent - vent - pent - msgoff - 0; symbols * NULL; arguments - temporaries ■ NULL;

h_1 nit » h_update * h_before - h_after ■ h_error « NIL;

def_flaa » def_mask ■ 0; aname[0J - 0;

8 i n i 10 •

/* setup the code and data space */

If ((data « caI Ioc(1,DMAX)) -■ 0) faiI("insufficient memory");

If ((code - caI Ioc(1,CMAX)) •- 0) falI("insufficient memory");

dptr « cptr - 1; /* make sure nothing has a zero offset */

/* get the file name */

#ifndef MAC

If (argc < 2)

falI("usage: advcom <flle> [ <oflle> strcpyfif i le,argv[1]); streatpf * le,".adv strcpy(ofiIe,(argc < 3 ? argv[1] : argv[2 #endif

8treat(of 1le.".dat")

/♦ open the input file */ if ((ifp - fopen(IfIle,"r")) — NULL) faiI("can*t open input file");

/* create and initialize the output file */ ad_create(ofile);

for (I « 0; I++ < 512; ad_putc(*\0'))

/♦ create the word tree */ words - tnew();

/♦ enter builtin constants */ center("t",-1); center("n11",0);

/* enter the builtin variables */

venter("$actor");

venterf"$action");

venter("$dobJect");

venter("$ndobjects");

venter("$iobject");

venter("jocount");

/* enter the preposition "to" */ add_word("to",WT_PREPOSITION);

/♦ process statements until end of file */ while ((tkn - tokenQ) — T.OPEN) { frequI re(TRIDENTIFIER);

/♦ identification statement */

If (match("adventure")) do_adventure();

/* vocabulary statements */ else If (match("adject 1ve")) do_word(WT_ADJECTIVE);

60 BYTE LISTINGS SUI’PLF.MHNT • APHIL-JUNH. 1987

else If (match("prepositIon")) do_wo r d(WT_PREPOSITION); else If (match("conjunction")) do_wor d(WT_CONJUNCTION); else If (match("artIcle")) do_word(WT^ARTICLE); else If (matchf"synonym")) do_synonym();

/* constant, variable, function and default definition statements */ else If (match("define")) '

do_deflne();

else If (match("varlab Ie")) do_var lableQ; else if (matchf"default")) do_defauIt();

/* property definition statement */ else If (match("property")) do_defproperty();

/* handle the Init, before and after code statements */ else if (match("init"))

h_inlt » do_code(t_token); else If (match("update"))

h_update =• do_code(t_token); else If (match("before"))

h_before * do_code(t_token); else If (match("after"))

h_after * do_code(t_token); else if (match("error"))

h_error « do_code(t_token);

/* action definition statement */ else If (match("action")) do_actlon();

/* object definition statements */ else if (match("object")) do_object(t_token,NIL);

/* object instance definition statements */ else if (obj = oflnd(t_token)) do_ob ject(t_token,obj);

/* error, unknown statement */ e I se

error("Unknown statement type"); require(tkn,T_EOF);

/* close the Input file */ fclose(lfp);

/* output the data structures ♦/ output();

/* close the output file */ ad_close();

/* getvalue - get a value */ Int getvalue()

SYMBOL *sym;

switch (token()) j case T.IDENTIFIER:

case T_NUMBER: case T_STRING: defauIt:

i

if (sym - sfind(t_token )) return (sym->s_vaIue); return foenter(t_token)); return lt_value}; return (t_value);

error("Expecting identifier, number or string"); return (0);

continued

BYTE LISTINGS SUPPLEMENT • APRIL-JUNE. 1987 61

May

/* dalloc - allocate data space */

Int dalloc(size) int size;

^ if ((dptr += size) > DMAX)

fail("out of data space”); return (dptr - size);

I

/* add_word - add a word to the dictionary */ int add_word(str.type) char *str; int type;

^ if ((curwrd =* tfind(words,str)) «* NIL) } if (went < WMAX) \ curwrd ■ ++wcnt; wtablefcurwrd] - type; tenter(words,str);

$ ,

else |

error("too many words*'); curwrd « 0;

i

else if (wtabIe[curwrd] — WT_UNKNOWN) wtabIe[curwrd] - type;

else if (type != WT_UNKNOWN && type !« wtabIe[curwrdj) error("Ambiguous word type"); return (curwrd);

I

/* add_synonym - add a synonym to a word */ int add_synonym(str,wrd) char *str; int wrd;j curwrd * wrd;

return (tenter(words,str));

I

/* getword - get a word from an object field */

Int getword(off) int off;

* return ((dota[off] & 0xFF) | (dato[off+1] « 8));

\

/* putword - put a word into an object field */ putword(of f,dot) int off.dat;

dataToff] ■ dat; data[off+1] ° dat » 8;

J

/* getbyte - get a byte from an object field */ int getbyte(off) int off;

return (data[off]);

\

/* putbyte - put a byte into an object field */ putbyte(of f »dat)

Int off,dat;

data[off] - dat;

I

/* output — output the output()

Int woff,wsize; int ooff,osize; int aoff.asize; int toff.tsize; int vof f,vs Ize; int soff.ssize;

binary data structures */

/* word table offset and size */

/* object table offset and size */

/* action table offset and size */

/* word type table offset and size */ /* variable table offset and size */ /* save area offset and size */

Int dsize; /* data size without dictionary */

Int dbase,cbase,size,mblk,dblk,I;

/* make sure the adventure Id Information Is present */

I f (aname[0] == 0) j

xerror("no adventure Identification Information"); s t r cpy(an ame,"ADVENTURE"); aversion * 0;

i

/* pad the remainder of this message block */

while (msgoff & 0X007F) j ad_putc(*\0’); ad_putc(*\0');

ad_putc(*\0*); ad_putc(*\0*);msgoff++; \

/* save the size of the data area before the dictionary */ dsize - dptr;

/* Insert the vocabulary into the data array */ woutput(words->tr_root);

/* compute table offsets */

woff * 0; wsize * tentries(words) * 2 + 2;

toff * woff + wsize; tsize - went;

ooff * toff + tsize; osize = oent *2+2;

aoff * ooff + osize; aslze « aent *2+2;

voff = aoff + aslze; vsize « vent *2+2;

dbase = voff + vsize;

ebase * dbase + dptr;

/* compute the resident structure size */ size ■ wsize+tsIze+osIze+asIze+vsize+dptr+eptr;

/* set the save area parameters */ soff = voff; sslze =* vsize + dsize;

/* compute the first block for message text */ mb Ik « 1;

dblk - (int)(ad_foff » 9);

/* output the word table */ word_out(tentrIes(words)); wtoutput(words->tr_root);

/* output the word type table */ for (I « 1; I <* went; I++) byte_out(wtable[i]);

/* output the object table */ word_out(oent); for (1*1; I <» oent; i++) j if (otable[l] *==* NIL) undef_object(i); word__out(otable[i ];;

/* output the action table */ word_out(aent); for (i - 1; I <* aent; I++) word_out(atab Ie[i]);

/* beginning of saveable data */

/* output the variable table */ word_out(vent); for (1*1; I <* vent; I++) word_out(NIL);

/* output the data space */ for (1-0; I < dptr; ) byte_out(data[1++]);

/* end of saveable data */

/* output the code space */ for (1-0; I < cptr; ) byte_out(code[!++]);

continued

BYTE LISTINGS SUPPLEMENT • APRIL-JUNE, 1987 63

May

/* output the file header ♦/ ad_seek(0L); word_out(size); str out("ADVSYS",6) word_out(VERSION^; str_out(aname,18); word_out(avers Ion); word_out(wof' v word_out(tof word_out(oof word_out(aoff ); word_out(voff); word_out (dbase); word_out(cbase); word_out(dblk); word_out(mb Ik); word_out(h_init); word_out(h_update); word_out(h_before); wo r d_ou t(h_a f t e r); word_out(h_error); word_out(soff); word_out(ssize);

/♦ resident structure size ♦/

;/♦ magic information ♦/

/* data structure version number /♦ adventure name */

/* adventure version number */ /* word table offset */

/* word type table offset */

/* object table offset */

/* action table offset */

/* variable table offset */

/* base of data */

/* base of code */

/* first data block */

/* first message text block */ /* initialization code */

/* update code */

/* before handler code */

/* after handler code */

/* error handling code */

/* save area offset */

/* save area size */

*/

/* show statistics */

pr intf( pr intf ' pr intf pr intf pr Intf pr intf printf pr intf pr I ntf pr 1ntf(" pr intf ("

§ifdef MAC

macpause(); |endif

words: word types; objects: act ions: variabIes: data: code:

dictionary: text:

save area: errors:

%d

%d

%d

%d

%d

%d

%d

%d

% I d

%d

%d

\n M ,tentries(words));

\n",wcnt);

\n",ocnt);

\n",acnt);

\n",vcnt);

\n",dsize);

\n",cptr);

\n",dptr-dsize);

]\n M ,(long) msgoff * 4L); ]\n",ssize); j\n M ,errcount);

/♦ woutput - output the word data */ woutput(node)

TNODE *node;} int wnum,wrd;

if (node) }

woutput(LLINK(node)); wnum “ WORD(node);

wrd » WORD(node) ■ dalloc(strIen(KEY(node ))+3); putword(wrd,wnum); s t rcpy (data-fwrd+2, KEY (node));

If (wtabIe[wnum] — WT.UNKNOWN)

printf("Type of word %s is unknown\n".KEY(node)); woutput(RLINK(node));

/* wtoutput - output the word table */ wtoutput(node)

TNODE ♦node;

^ if (node) { / . xv

wtoutput(LL INK (node)); word_out(WORD(node)); wtoutput(RL INK (node));

/♦ undef_object - complain about an undefined object ♦/ undef_ob j ect(n)

Int n;

char msg[100];

SYMBOL ♦sym;

for (sym - symbols; sym !■ NULL; sym - sym->s_next)

If (sym->s_type *« $T_OBJECT && n sym->s_vaIue) { sprlntf(msg,"Object %s Is undefIned",sym->s_name); xerror(msg); break;

/* str_out - output a string ♦/ str_out(str,len) char *str; int len;

while (len—)

byte_out(*str++);

/♦ word_out - output a word ♦/ word_out(dat)

Int dat;

I

byte_out(dat); byte_out(dat » 8);}

/♦ byte_out - output a byte ♦/ byte_out(dat)

Int dat;

I

ad_putc((dat - 30) & 0xFF);

/* oenter - enter an object Into the symbol table ♦/ Int oenter(name) char ♦name;

I

SYMBOL ♦ sym;

If (sym - sflnd(name)) {

If (sym->8_type l- ST_OBJECT) error("Not an object"); return (sym->s_vaIue);

If (ocnt < OMAX) {

senter(name,ST_OBJECT,++ocnt);

^ otablefocnt] « NIL;

else

error("too many objects"); return (ocnt);

/* oflnd - find an object In the symbol table ♦/ Int oflnd(name) char ♦name;

SYMBOL ♦sym;

If (sym ■ sflnd(name)) {

If (sym->s_type I- ST_OBJECT) return (NIL); return (sym->s_value);

return (NIL);

/♦ aenter - enter an action Into the symbol table ♦/ Int aenter(name) char ♦name;

i

SYMBOL ♦sym;

If (sym - sflnd(name)) J

If (sym->s_type I- ST_ACTION) error("Not an action"); return (sym->s_vaIue);

continued

BYTE LISTINGS SUPPLEMENT • APRIL-JUNE, 1987 65

May

\

If (ocnt < AMAX) { senter(name.ST_ J ACTION.++ocnt);

atable[acntJ ■ NIL;

\

else

I

error("too many actions )j return (acnt);

/. venter - enter o variable Into the symbol toble */ lot venter(name) char *name;

* SYMBOL *sym;

If (sym - sfInd(name)) | .

If (sym->s_type I

error("Not a variable"); return (sym->s_value);

I

\

•enter(name.St.VARIABLE,++vcnt); return (vent);

/* penter - enter a property Into the symbol table */

Int penter(name) char *name;

* SYMBOL *sym;

If (sym ■ efInd(name)) { x

If (sym->s_type 1* ST_PROPERTY) error("Not a property"); return (sym->s_value);

senter(name ,ST_PROPERTY,++pcnt);

return (pent);

I

/* center - enter a constant Into the symbol table */ center(name,value)

char *name; Int value;

* If (sfInd(name)) J

error("Already defined"); return;

senter(name,ST_CONSTANT.vaIue);

I

/* sflnd - find a symbol In the symbol table */

SYMBOL *efInd(name) char *name;

?^ B (i y r- m ; y mbol.; sym I- NULL; sym - sym->._next)

if (strcmp(name,sym->e_name) — 0;

break;

return (eym);

\

/* senter - enter a symbol Into the symbol table */

SYMBOL *senter(nome,type,value) char *name; Int type,value;

{

SYMBOL *sym;

If ((sym - (SYMBOL *)molloc(slzeof(SYMBOL))) — NULL)

fall("out of memory");

eym->s_nome ■ save(nome); sym->e_type - type; eym->s_value ■ value; sym->s_next - symbols; symbols ■ sym; return (eym);

i \

/* frequlre - fetch a token and check It */ frequlre(rtkn)

Int rtkn;

\

require(token(),rtkn);

/* require - check for a required token */ require(tkn.rtkn)

Int tkn.rtkn;

char msg[100];

If (tkn !- rtkn) J

sprIntf(msg/‘Expect Ing %s", t_names[rtkn]); error(m8g);

/* save - allocate memory for a string */ char *save(str) char *str;

char *new;

If ((new * malloc(strlen(str)+1)) =* NULL) fall("out of memory"); strcpy(new,str); return (new);

/* match - compare a string with the current token */ Int match(8tr) char *str;{

return (strcmp(str,t_token) — 0);

/* fail - print an error message and exit */ faiI(msg) char *msg;

prIntf("%s\n",msg);

#ifdef MAC

macpause();

#endlf

ex 11();

ADVFCN.C Contributed by: David Betz

TEXT "An Adventure Authoring System," David Betz, May 1987, page 125.

/* advfcn.c - functions for the adventure compiler */ /*

Copyright (c) 1986, by David Michael Betz All rIghts reserved

*/

^Include "advcom.h"

^Include "advdbs.h"

/* external variables */ extern char aname[]; extern Int aversion; extern int cptr; extern Int objbuf[]; extern int nprops; extern int t_value; extern char t_token[l; extern char *t..names[]i

/* adventure name */

/* adventure version number */

/* code space pointer */

/* object staging buffer */

/* number of properties in current object */ /* token value */

/* token string */

/* token names */

continued

BYTE LISTINGS SUPPLEMENT • APRIL-JUNE, 1987 67

May

extern Int otoble[]; extern Int curobj; extern int curoct; extern Int otable[],acnt; extern ARGUMENT .arguments; extern ARGUMENT .temporaries; extern Int def_flag; extern Int def_mask;

/* external routine* */ extern char *malloc(); extern char *eave();

/* do.adventure - handle the <ADVENTURE name verelon-number> statement */ do_odventure()

i /* get the adventure name */ frequlre(T_IDENTIFIER); strncpy(aname.t_token,18); aname[18] - 0;

/* get the adventure version number */ frequlre(T_NUMBER); aversion ■ t_value;

/* check for the closing paren */ frequIre(T_CLOSE);

l

/. do_word - enter words of a particular type */ do_word(type)

\

Int tkn;

while ((tkn - token()) — ^IDENTIFIER) add_word(t_token.type); requIr*(tkn,T_CLOSE):

I

/* do.synonym - handle the <SYNONYMS ... > statement ./ do_synonym()

Int tkn.wrd;

frequlre(T_IDENTIFIER); wrd - add_word(t_token,WT_UNKNOWN); while ((tkn - token()) — T_IDENTIFIER) add_synonym(t_token,wrd); requlre(tkn,T_CLOSE);

I

/* do_.de f Ine - handle the <DEFINE ... > statement */ do_.de f ine()

char name[TKNSIZE4*1 ] ;

Int tkn;

If ((tkn - token()) — T.OPEN) return (do_functlon()); stoken(tkn);

while ((tkn - token()) — T_IDENTIFIER) * strcpyfname,t_token);

center(name,getvaIue()); require(tkn,T_CLOSE);

I

/* do_varlable - handle the VARIABLE ... > statement */ do_variable() j Int tkn;

while ((tkn - token()) — ^IDENTIFIER) venter(t_token);

requlre(tkn,T_CL0SE)5

I

/* object table */

/* current object number */

/* current action offset */

/* action table and count */

/* function argument list */

/* function temporary variable list */ /* default action flag value */

/* default action mask value */

6N BYTE LISTINGS SUPPLEMENT • APRIL JUNE, 1987

/* do_defproperty - handle the <PROPERTY ... > statement */ do_defproperty()

Int tkn;

while ((tkn - tokenQ) — T.IDENTIFIER) penter(t_token); r equIre(tkn,T_CLOSE);

/* do_default — handle the <DEFAULT ... > statement */ do_default()

{

Int tkn;

/* process statements until end of file */ while ((tkn - tokenQ) ■« T_OPEN) j frequlre(T_IDENTIFIER);

If (match(“actor“)) do_dfIag(A_ACTOR); else If (match("dlrect-object")) do.dflog(A_DOBJECT); else If (match("Indlrect-object")) do_dfIag(A_IOBJECT);

else

^ error(“Unknown default definition statement type");

requlre(tkn,T_CLOSE);

\

/* do_dflag - handle ACTOR, DIRECT-OBJECT, and INDIRECT-OBJECT statements */ do_dflag(flag)

Int flag;

I

Int tkn;

If ((tkn - tokenQ) — T_IDENTIFIER) {

If (match(“requ!red")) \ def_flag |« flag; def_mask flag;

i

else If (match(“forbldden“)) } def_flag &■ flag; def_mask flag;

else If (match(“optlonal”)) def_mask |* flag;

•Ise error(“Expect Ing: REQUIRED, FORBIDDEN or OPTIONAL”);

^ tkn ■ tokenQ;

else {

def^flag |« flag;

def_mask &« flag;

requlre(tkn,T_CLOSE);

/* do_object - handle object (LOCATION,OBJECT,ACTOR) definitions */ Int do_obJect(cname,class) char ♦cname; Int class;

I

Int tkn,obj,obase,osize,I,p;

prlntf("[ %s: ”,cname);

frequI re(TRIDENTIFIER); prIntf(“Xs ]\n“,t_token);

obj - curobj - oenter(t_token);

/* Initialize the object */

ob Jbuf objbuf objbuf objbuf

0_CLASS/2] - class; 0_N0UNS/2J - NIL;

0_ADJECTIVES/2] - NIL; 0_NPR0PERTIES/2] - nprops

0 ;

continued

BYTE LISTINGS SUPPLEMENT • APRIL-JUNE, 1987 69

May

/* copy the property list of the class object */ if (class) {

obase * otabIe[cI ass];

osize ■ getword(obase+0_NPR0PERTIES);

for (i ■ p « 0; I < osize; i++, p +“ 4)

If ((getword(obase+0_PROPERTIES+p) & P__CLASS) addprop(getword(obase+0_PR0PERTIES+p), 0, getword(obase+0_PR0PERTIES+p+2));

/* process statements until end of file */ while ((tkn - token()) -» T_OPEN) | frequire(T_IDENTIFIER); if (match("noun")) do_noun();

else if (match("adJectIve")) do_adJective(); else If (match ("property")) do_property(0);

else If (match("cI ass-property")) do_property(P_CLAS$); else if (match("method")) do_method();

e I so

error ("Unknown object definition statement type");

requIre(tkn,T_CLOSE);

/* copy the object to data memory */

osize - 0_SIZE/2 + nprops*2;

obase ® da Iloc(osize*2);

for (I » p * 0; I < osize; i++, p +* 2)

putword(obase+p,objbuf[ i ] ) ; otable[obJ] ° obase; curobj * NIL;

/* return the object number */ return (obj);

l

/* do_noun - handle the <NOUN ... > statement */ do_noun()

int tkn,new;

while ((tkn - token()) — T.IDENTIFIER) \ new « dalloc(L_SIZE);

putword(new+L_DATA,add_word( t_token ,WT_ NOUN));

pu t wo r d(new+L_NEXT,ob j bu f[0_N0UNS/2]); objbuf[0_N0UNS/2] - new;

requIre(tkn,T_CLOSE);

/* do_adJective - handle the <ADJECTIVE ... > statement */ do_adjectIve()

int tkn,new;

whi

le ((tkn - token()) « ^IDENTIFIER) {

putword(new+L_DATA,add_word(t — token,WT_ADJECTIVE)); pu twor d(new+L^NEXT,obibuf[0_ADJECTIVES/2]); obJbuf[0_ADJECTIVES/2J - new;

require(tkn,T_CLOSE);

/* do_property - handle the <PROPERTY ... > statement */ do_property(flags)

Int flags;

\

int tkn,name,value;

while ((tkn name ■

- token()) — T_IDENTIFIER || tkn -- T.NUMBER) j (tkn -- T_IDENTIFIER ? penter(t_token) : t_value);

70 IIYTK LISTINOS SUPPLEMENT • APRIL-JUNE. 1987

value - getvalue();

se tprop (name ,fIags ,va I ue);

requIre(tkn ,T_CLOSE);

/* do_m«thod - handle <METHOD (FUN ...) ... > statement */do_method()

Int tkn.name,tent;

/* get the property name */ frequ!re(T_OPEN); frequIre(T_IDENTIFIER); prIntf("[ method: %s ]\n",t_token);

/* create a new property */ name ■» penter(t_token);

/* allocate a new (anonymous) action */

I f (aent < AMAX)

++acnt;

e I se

error("too many actions");

/* store the action as the value of the property */ setprop(name,P_CLASS,aent);

/* initialize the action */

curact « otabIe[acnt] - da Iloc(A_SIZE);

putword(curact+A_.VERBS .NIL);

putword(curact+A_PREPOSITIONS.NIL);

arguments - temporaries « NULL;

tent - 0;

/* enter the "self" argument */ addargument(^arguments,"self"); addargument(^arguments,"(dummy)");

/* get the argument list */ while ((tkn - tokenQ) !- T_CLOSE) { require(tkn,T_IDENTIFIER); if (match("iaux")) break;

^ addargument(^arguments,t_token);

/* check for temporary variable definitions */ if (tkn — T_IDENTIFIER)

while ((tkn » tokenQ) !■ T.CLOSE) } requ1re(tkn.TRIDENTIFIER); addargument(fttemporarIes.t_token); tcnt++;

\

/* store the code address */ putword(curact+A_CODE.cptr);

/* allocate space for temporaries */

If (temporaries) {

putcbyte(OPJTSPACE); putcbyte(tcnt); j

/* compile the code */ do_code(NULL);

/* free the argument and temporary variable symbol tables */ freelist(arguments); free Iist(temporarIes); arguments - temporaries - NULL;

/* setprop - set the value of a property */ setprop(prop,fIogs,vaIue) int prop,flags.value;

Int I;

continued

BYTE LISTINGS SUPPLEMENT • APRIL-JUNE, 1987 71

May

/* look for ths property */ for (I « 0; I < nprops; I++)

if ( (objbuf [0 PROPERTIES/2 + 1*2] & P_CLASS) « objbuf [0 — PROPERTIES/2 + 1*2 + 1] - value; return;

addprop(prop,fI age,value);

prop) {

/* addprop - add a property to the current object’s property list */

addprop(prop,flags,value) lot prop.flags,value;

*

If (nprops >■ OPMAX) J

prIntf(“too many properties for

this object\n“);

return;

objbuf[0_PR0PERTIES/2 + nprops*2] - prop|flags; obJbuf[0_PR0PERTIES/2 + nprops*2 + 1] - value; obJbuf[0_NPR0PERTIES/2] - ++nprops;

/* do.code - comDlle code for an expression */ int do_code(type) char *type;

Int adr.tkn;

if (type) prIntf("[ compiling %s code adr ■ putcbyte(OP_PUSH); while ((tkn - tokenQ) I- T_CL0SE) } stoken(tkn); do_expr();

putcbyte(OP_RETURN); return (adr);

]\n“,type);

/* do_octIon - handle <ACTI0N ... > statement */ do_actlon()

\

Int tkn.act;

/* get the action name */ frequIre(T_IDENTIFIER); prlntf("[ action: %s ]\n M ,t_token);

/* create a new action */

act - aenter(t_token);

curact * atabIe[act] ■ da Iloc(A_SIZE);

putword(curact+A_VERBS,NIL); putword(curact+A_PREPOSITIONS,NIL);

putbyte(curact+A_FLAG»def_fIag); putbyte(curact+A_MASK,def_mask); putword(curact+A_CODE, NIL);

/* process statements until end of file */ while ((tkn - tokenQ) — T_0PEN) j f requ I re (^IDENTIFIER); lf (match("actor")) do_flag(A_ACTOR); else If (match("verb")) do_verb();

else if (match("dIrect-obJect")) do_fIag(A_D0BJECT); else If (match("preposItIon")) do_preposlt!on();

else If (match("Indlrect-obJect")) do_fIag(A_I0BJECT };

else If (match("code M )) .

pu twor d(cur act+A__C0DE, do — .code (NULL));

e,S6 error("Unknown action definition statement type"); requIre(tkn,T_CL0SE);

72 BYTE USTINOS SUPPLEMENT • APRIL-JUNE, 1987

/* do_flag - handle ACTOR, DIRECT-OBJECT, and INDIRECT-OBJECT statements */ do_flag(flag) int flag;

Int tkn;

If ((tkn = token()) — T_IDENTIFIER) J If (match("requlred")) \

putbytefcuract+A_FLAG,getbyte(curact+A_FLAG) putbyte(curact+A_MASK,getbyte(curact+A_MASK)

else If (match("forbldden")) J

putbyte(curact+A_FLAG,getbyte(curact+A_FLAG) putbyte(curact+A_MASK,getbyte(curact+A_MASK)

else If (match("opt Iona I"))

putbyte(curact+A_}rfASK,getbyte(curact+A_MASK)

e I se

error("Expect Ing: REQUIRED. FORBIDDEN or OPTIONAL"); tkn * token();

else {

putbytefcuract+A_FLAG,getbyte(curact+A_FLAG) | flag); putbyte(curact+A_MASK,getbyte(curact+A_MASK) k flag);

requIre(tkn,T_CLOSE);

/* do_verb - handle the <VERB ... > statement */ do_verb()

Int tkn,new,1st;

while ((tkn « token()) «« ^IDENTIFIER || tkn -- T_OPEN) J new * dalloc(L_$IZE);

putword(new+L_NEXT,getword(curact+A_VERBS)); putword(curact+A_VERBS,new);

1st - dalloc(L_SIZE); putwordfI st+L__NEXT,NIL); putword(new+L_DATA,1st); if (tkn «= ^IDENTIFIER)

putword(Ist+L_DATA,add_word(t_token,WT_VERB)); else {

If ((tkn * token()) ^IDENTIFIER)

putword( lst+L.J)ATA,add_word(t_token,WT_VERB));

e I se

error("ExpectIng verb"); while ((tkn - tokenQ) — ^IDENTIFIER) } new » da Iloc(L_SIZE);

putword(new+L_DATA,add_word(t_token.WTJJNKNOWN)); putwordfnew+L_NEXT,NIL); putword(I st+LJMEXT.new);

1st - new;

i

requIre(tkn,T_CLOSE);

requIre(tkn,T_CLOSE);

/* do_preposItIon - handle the <PREPOSITION ... > statement */ do_prepo8Ition()

{

Int tkn,new;

while ((tkn - token()) «« ^IDENTIFIER) { new ■ da Iloc(L_SIZE);

putword(new+L_DATA,add_word(t_token,WT_PREPOSITION)); putwordinew+LJMEXT,getword(curact+A_PREPOSITIONS)); putword(curact+A_PREPOSITIONS.new); l requIre(tkn,T_CLOSE);

/* do_functlon - handle <DEFINE (FUN ...) ... > statement */ do_functlon()

1

I flag);

k flag);

k flag); k flag);

I flag);

continued

BYTE LISTINGS SUPPLEMENT • APRIL-JUNE, 1987 73

int tkn.act.tent;

/* get the function name */ frequlre(T_IDENTIFIER); printf("[ function: %s ]\n M ,t_token);

/* create a new action */ act ■ aenter(t_token);

/* Initialize the action */

curact - atablefact] - dalloc(A_SIZE);

putword(curact+A_VERBS,NIL);

putword(curact+A_PREPOSITIONS.NIL);

arguments - temporaries - NULL;

tent - 0;

/* get the argument list */ while ((tkn - tokenQ) !- T.CLOSE) f requlre(tkn.T_IDENTIFIER);

1f (match("&aux")) break;

addargument(^arguments,t_token);

$

/* check for temporary variable definitions */ If (tkn — T.IDENTIFIER)

while ((tkn - token()) I- T.CLOSE) } requIre(tkn,T_IDENTIFIER); addargument(&temporarIes,t_token); tcnt++;

I

/* store the code address */ putword(curact+A_CODE,cptr);

/* allocate space for temporaries */

If (temporaries) {

putcbyte(OP_TSPACE); putcbyte(tcnt);

/* compile the code */ do_code(NULL);

/* free the argument and temporary variable symbol tables */ freelIst ( arguments); freelist(temporaries); arguments ■ temporaries ■ NULL;

/* addargument - add a formal argument */ addargument(list.name)

ARGUMENT **list; char *name;

{

ARGUMENT *arg;

If ((org - (ARGUMENT *)malIoc(sizeof(ARGUMENT))) — NULL) fall("out of memory"); arg->arg_name « save(name); arg->arg_next - *llst;

•list - arg;

/* freelist - free a list of arguments or temporaries */ freeltst(arg)

ARGUMENT *arg;

I

ARGUMENT *nxt;

while (arg) {

nxt ■ arg->arg_next; free(arg->arg_name); free(arg); arg - nxt;

74 BYTE LISTINGS SUPPLEMENT • APRIL-JUNE, 1987

/♦ findorg - find an argument offset ♦/

Int fIndarg(name) char ♦name;

I

ARGUMENT ♦arg; int n;

for (n - 0, arg - arguments; arg; n++, arg - arg->arg_next) if (strcmp(name,arg->arg_name) ■■ 0) return (n); return (-1);

\

/♦ findtmp - find a temporary variable offset ♦/ int findtmp(name) char ♦name;

I

ARGUMENT ♦tmp; int n;

for (n - 0, tmp * temporaries; tmp; n++, tmp - tmp->arg_next) If (strcmp(name,tmp->arg_name) — 0) return (n); return (-1);

i

ADVSCN.C Contributed by: David Betz

TEXT "An Adventure Authoring System," David Betz, May 1987, page 125.

/♦ advscn.c - a lexical scanner for the adventure compiler ♦/ /*

Copyright (c) 1986, by David Michael Betz Al I rights reserved

^Include "advcom.h"

/♦ useful definitions ♦/

^define maplower(ch) (isupper(ch) ? tolower(ch) : ch)

/♦ global variables ♦/

Int errcount«0; /♦

int t_value; /♦

char t_token[TKNSIZE+1];/♦ char ♦t_names[] * j 0 .

”C\

M ) M »

"STRING",

"IDENTIFIER".

"NUMBER",

"EOF"

h

/♦ external

variables

*/

extern

FILE

*lfp;

/*

extern

int

msgoff;

/*

/♦ local variables ♦/

statIc

Int

savetkn ■ 0

i /*

static

Int

savech * 0;

/*

static

char

fname[200]

i /*

static

char

11ne[200];

/*

statIc

char

♦Iptr;

/*

static

Int

Inum;

/*

static

Int

1 eof;

/*

static

Int

save_lnum;

/*

error count ♦/ numeric value ♦/ token string ♦/

Table captionInput file poInter ♦/ message section offset ♦/

look ahead token ♦/ look ahead character ♦/ incIude file name ♦/ current input line ♦/

Iine pointer ♦/

Iine number ♦/

input end of file flag ♦/

saved Inum ♦/

continued

BYTH LISTINGS SUPPLEMENT • APRIL-JUNH, 1987 75

static FILE *save.Jfp; /* saved Ifp */

static Int sent; /* count of characters In string */

/* slnlt - initialize the scanner */

/* setup the line buffer */ Iptr * IIne; ♦Iptr - 0;

Inum ■ 0;

/* no Include file yet */ save_lfp - NULL;

/* no lookahead yet */ savech - 0; savetkn * 0;

/* not eof yet */ ieof - FALSE;

/* token - get the next token */ Int token()

int tkn;

If (tkn ■ savetkn) savetkn « 0;

else

tkn - rtoken(); return (tkn);

/* etoken - save a token */ stoken(tkn)

Int tkn;

\

savetkn - tkn;

\

/* rtoken - read the next token */ int rtoken()

Int ch;

/* check the next character */ for (;;)

switch (ch ■ sk IpspacesQ) j

case EOF case •(• case •)• case case *;* defauIt:

I

return (T_EOF); strcpy(t_token, M ( M ) strcpy(t_token, M ) M ) return (getstringQ while (aetch() !■ * return (getld(ch));

; return (T_OPEN);

; return (T_CLOSE);

); v

\n'); break;

/* getstrlng - get a string */ int getstring()

int ch,sflag;

t_value ■ msgoff; sflag - FALSE; sent - 0; while ((ch - getchQ) I- EOF kk ch !- •**•) if (tsspace(ch)) sflag - TRUE; else |

if (ch — *\V)

switch (ch - getch()) j case *n # : ch - *\n*; break; case ’t': ch - *\t*; break;

If (sflag)

{ wputc(* ’); sflag - FALSE; ( wputc(ch);

76 BYTE LISTINGS SUPPLEMENT • APRIL-JUNE, 1987

If (sflog)

wputc(* *); strdone();

strcpy(t_token,"Jstrlng{"); return (T_STRING);

/* getld - get an Identifier */

Int getld(ch)

Int ch;

i

char *p;

p - t_token; *p++ ■ map lower(ch);

while ((ch ■ getch()) !■ EOF kk Isldebar(ch))

*p++ ■ maplower(ch);

*p » EOS; savech • ch*

return (isnumber(t_token,&t_value) ? T_NUMBER : T_IDENTIFIER);

/* Isnumber - check If this string Is a number */

Int Isnumber(str,pvaI) char *str; Int epval;

Int digits; char *p;

/* Initialize */ p * str; digits - 0;

/* check for a sign */

if (* p .. • + • || * p .. *-•)

P++;

/* check for a string of digits */ whlle (Isdlglt(*p)) p++, dig!ts++;

/* make sure there was at least one digit and this Is the end */ If (digits 0 || *p) return (FALSE);

/* convert the string to an Integer and return successfully */

If (*str ■■ *+*) ♦♦str;

*pval ■ atol(str); return (TRUE);

/* wputc - put a character Into the output file */ wputc(ch)

Int ch;

ad_putc(encode(ch)); ecnt-M-;

/* strdone - finish a string */ strdone()

i

wputc(’\0’); while (sent k 3) wputc('\0'); msgoff ♦■ sent » 2;

/* sklpspace9 - skip leading spaces */ sk IpspacesQ

Int ch;

while ((ch - getch()) kk Isspace(ch)) I

return (ch);

continued

BYTE LISTINGS SUPPLEMENT • APRIL-JUNE, 1987 77

/* isIdchar - is this an identifier character */ int i8ldchar(ch)

Int ch;

* return (!Isspace(ch) && ch !» '(* && ch !- ')* && ch !

\

/* getch - get the next character */

Int getch()

* FILE *fp;

Int ch;

/* check for a lookahead character */

If (ch « savech) savech « 0;

/* check for a buffered character */ else If (ch - elptr) lptr++;

/* check for end of file */ else If (leof) ch ■ EOF;

/* read another line */ else {

/* read the line */ _ . . , . \ .

for (Iptr - line; (ch - getchrQ) 1- EOF &«c (*lptr++ - ch) I

♦Iptr - 0;

Inum++;

/* check for an included file */ if (Iine[0] — ’®’) {

/* open the file*/

strcpy(fname,&lIne[l]); fname[strIen(fname)-1] - 0 ; If (( f p - fopen(fname» "r ")) “ NULL) \

printf(“Can't open Include file: %s\n ,fname;; exit();

printf("[ Including %s ]\n M # fname);

/* setup Input from the file */ 8ave_lnum ■ Inum;

8ave_ifp ■ ifp; ifp - fp;

/* setup for the first line */

Iptr - line; *lptr - 0;

Inum ■ 0;

$

/* otherwise this must be an input line */ else {

/* terminate the line with a newline */

*lptr++ - *\n'; *lptr - 0;

/* check for end of file */ if (ch -- EOF) leof ■ TRUE;

/* update the line number and setup for the new line *, Iptr - Iine;

/* get a character */ ch - getch();

/* return the current character */ return (ch);|

- An'; )

78 BYTE LISTINGS SUPPLEMENT • APRIL-JUNE, 1987

/♦ getchr - get a character checking for end of file ♦/ Int getchr()

I

Int ch;

If ((ch » getc(lfp)) «* EOF || ch — •\032*) )

If (8ave_lfp) \

pr intf("[ end of %s ]\n",fname);

fclose(lfp);

Inum « save_Jnum;

Ifp ■ save^lfp; save_J fp - NULL; ch » getchr();

else

ch ■ EOF;

else If (ch **« # \r’) ch - getchr(); return (ch);

I

/♦ encode - encode a single character ♦/

Int encode(ch)

Int ch;

return ((ch - 30) k 0xFF);

i

/* error - report an error In the current line ♦/ error(msg) char ♦msg;

{

char *p;

pr Intf ("»> %s «<\n»> In I Ine %d <«\n%s M ,msg, Inum, I Ine for (p ■ line; p < Iptr; p++)

, f (* p - ’\f)

putchar( *\t *);

e I se

putchar(* *); pr Intf ( ,,A \n**);

#

t

errcount++; Ifdef MAC

macpause(); endl f

):

/* xerror - report an error In the current line ♦/ xerror(msg) char ♦msg;

^ pr Intf ("»> %s «<\n” ,msg); errcount++;

\

ADVEXP.C Contributed by: David Betz

TEXT "An Adventure Authoring System," David Betz, May 1987, page 125.

/♦ advexp.c - expression compiler for adventure games ♦/ /♦

Copyright (c) 1986, by David Michael Betz All rIghts reserved

^Include "advcom.h" flnclude "advdbs.h"

continued

BYTE LISTINGS SUPPLEMENT • APRIL-JUNE, 1987 79

/* external routines */ extern SYMBOL *sfind();

/* external variables */ extern char t_token[]; extern Int t_value; extern Int curobj; extern char *code; extern Int cptr;

/* forward declarations */

Int do_condH ,do_and() ,do_or() , do_l f () ,do_whi I eQ ,do_progn();

Int do_setq()»do_return(),do_send(),do_sndsuper();

Table caption/* opcode tables */ static struct { char

*nt_name; Int nt_code,nt_args; \ *nptr,ntab[] ■ \

i:

"not".

OP_NOT,

i.

II . II

T I

OPJ<DD t

2.

ll_.ll

•

OP_SUB,

2.

II* *1 * »

OP_MUL.

2.

V".

OP_DIV,

2,

"X".

OP_REM.

2.

OP.BAND,

2.

“l\

0P_80R,

2.

»i ii

•

OP_BNOT,

1.

OP_LT,

2.

n b n

1

OP_EQ,

2.

">",

OP_GT,

2.

”getp M ,

OP_GETP,

2.

"setp",

OP.SETP,

3.

"class”.

OP_CLASS,

1.

“match",

OP_MATCH,

2.

"print".

OP_PRINT,

1.

"print-number

", OP_PNUMBER.

1.

"print-noun",

OP_PNOUN,

1.

"terpri".

OP_TERPRI,

0.

"finish".

OP_FINISH,

0.

"abort",

OPJVBORT,

0.

"exit".

OP_EXIT,

0.

"save",

OP_SAVE,

0.

"restore",

OP_RESTORE,

0.

"restart",

OP_RESTART,

0.

"yes-or-no".

OP_YORN,

0.

"rand",

OPERAND,

1.

"randomize",

0

OP_RNDMIZE,

0.

itruct { char

*ft_name; Int (*ft.

-fcn)();

"cond".

do_cond.

"and",

do_and,

"or",

do_or,

"If",

do_If,

"while",

do_whlie,

"progn".

do_progn,

"setq",

do_setq,

"return".

do_return,

"send",

do_send,

"send-super",

0

do.sndsuper,

Table caption"chain",

OP_CHAIN,

0 >

h

/* do_expr - compile do_expr()

Int tkn;

Table captiona subexpression */

switch (token()) { case T_OPEN:

switch (tkn - tokenQ) { case T_IDENTIFIER:

If (in_ntab() || tn_ftab()) break;

default:

8token(tkn); do_calI();

BYTE LISTINGS SUPPLEMENT • APRIL-JUNE, 1987

I

break;

case T.NUMBER: do_literal(); break;

case T_STRING: do_lIteral(); break;

case T_IDENTIFIER: do_Identifler(); break; default:

^ error("ExpectIng expression");

/* In_ntab - check for a function in ntab */

Int in_ntab()

for (nptr ■ ntab; nptr->nt_name; ++nptr)

if (strcmp(t_token,nptr->nt_name) *= 0) { do_nary(nptr->nt_code,nptr->nt_args); return (TRUE);

\

return (FALSE);

/* In_ftab - check for a function in ftab */ int ln_ftab()

for (fptr « ftab; fptr->ft_name; ++fptr)

If (strcmp(t_token,fptr->ft_name) — 0) j (*fptr->ft_fcn)(); return (TRUE);

\

return (FALSE);

/* do_cond - compile the (COND ... ) expression */ do_cond()

Int tkn,nxt,end;

/* initialize the fixup chain */ end - NIL;

/* compile each COND clause */ while ((tkn - token()) I- T_CLOSE) { requI reftkn,T_OPEN); do_expr(); pu t cbyt e(OP_BRF); nxt * putcword(NIL); while ((tkn - token()) I- T_CLOSE) { stoken(tkn); do_expr();

putcbyte(OP_BR); end ■ putcword(end); fIxup(nxt,cptr);

/* fixup references to the end of statement */ If (end)

flxup(end,cptr);

e I se

putcbyte(OP_NIL);

/* do_and - compile the (AND ... ) expression */ do_and()

j Int tkn.end;

/* Initialize the fixup chain */ end - NIL;

continued

BYTE LISTINGS SUPPLEMENT • APRIL-JUNE, 1987 81

/* compile each expression */ while ((tkn * token()) l- T_CLOSE) { stoken(tkn); do_expr(); putcbyte(OP_BRF); end « putcword(end);

\

/* fixup references to the end of statement */ if (end)

flxup(end,cptr);

e I se

putcbyte(OP_NIL);

/* do_or - compile the (OR ... ) expression */ do_or()

I

Int tkn,end;

/* initialize the fixup chain */ end * NIL;

/* compile each expression */ while ((tkn * token()) != T_CLOSE) { stoken(tkn); do_expr(); putcbyte(OP_BRT); end « putcword(end);

\

/* fixup references to the end of statement */ If (end)

fIxup(end.cptr);

e I se

putcbyte(OPJT);

/* do_if - compile the (IF ... ) expression */

int tkn,nxt,end;

/* compile the test expression */ do_expr();

/* skip around the ‘then* clause if the expression Is false */ putcbyte(OP_BRF); nxt « putcword(NIL);

/* compile the 'then* clause */ do_expr();

/* compile the 'else* clause */ if ((tkn - tokenQ) I- T.CLOSE) \ putcbyte(OP_BR); end « putcword(NIL); fIxup(nxt.cptr); stoken(tkn); do_expr(); frequire(T_CLOSE); nxt - end;

/* handle the end of the statement */ fixup(nxt,cptr);

/* do_whI Ie - compile the (WHILE ... ) expression */ do_wh11e()

int tkn,nxt,end;

/* compile the test expression */

nxt ■ cptr;

do_expr();

82

BYTE LISTINGS SUPPLEMENT • APRIL-JUNE, 1987

/* skip around the ’then* clause If the expression Is false */

putcbyte(OP_BRF);

end ■ putcword(NIL);

/* compile the loop body */ while ((tkn - tokenQ) !« T_CLOSE) { stoken(tkn); do_expr();

/* branch back to the start of the loop */ putcbyte(0PJ3R); putcword(nxt);

/* handle the end of the statement */ fixup(end,cptr);

/* do_proan - compile the (PROGN ... ) expression */ do_progn()

Int tkn,n;

/* compile each expression */ for (n - 0; (tkn ■ token()) !- T_CLOSE; ++n) j stoken(tkn); do_expr();

/* check for an empty statement list */

If (n *- 0)

putcbyte(OP_NIL);

/* do_setq - compile the (SETQ v x) expression */ do_8etq()

char name[TKNSIZE+1];

Int n;

/* get the symbol name */ frequI re(T_IDENTIFIER); strcpy(name,t_token);

/* compile the value expression */ do_expr();

/* check for this being a local symbol */

If ((n ■ fIndarg(name)J) >■ 0) code_.se t argument(n); else If ((n - fIndtmpfname)) >- 0) code_settemporary(n); else {

n ■ venter(name); code_setvoriable(n);

frequire(T.CLOSE);

/* do_return - handle the (RETURN [expr]) expression */ do_return()

Int tkn;

/* look for a result expression */

If ((tkn - token()) I- T.CLOSE) \

8token(tkn); do_expr(); frequIre(T_CLO$E);

/* otherwise, default the result to nil */ e I se

putcbyte(OP_NIL);

continued

BYTE LISTINGS SUPPLEMENT • APRIL-JUNE. 1987 83

May

/* insert the return opcode */ putcbyte(OP_RETURN);

/* do_send - handle the (SEND obj msg [expr]...) expression */ do_send()

/* start searching for the method at the object Itself */ putcbyte(OP_NIL)

/* compile the object expression */

putcbyte(OP_PUSH);

do_expr();

/* call the general message sender */ sender();

I

/* do_sndsuper - handle the (SEND-SUPER msg [expr]...) expression */ do_sndsuper()

/* start searching for the method at the current class object */ code_J Itera I(curobj);

/* pass the message to "self" */ putcbyte(OP_PUSH); code_argument(flndarg("self"));

/* call the general message sender */ sender();

/* sender - compile an expression to send a message to an abject */ sender()

Int tkn,n;

/* compile the selector expression */ putcbyte(OP_PUSH);

do_expr(); '

i

/* compile each argument expression 4/ for (n ■ 2; (tkn * tokenQ) !■ T_CLOSE; ++n) { stoken(tkn); putcbyte(OP_PUSH); do_expr();

putcbyte(OP_SEND); j

putcbyte(n);

/* do_call - compile a function call */ do_calI()

int tkn.n;

/* compile the function itself */ do_expr();

/* compile each argument expression */ for (n ■ 0; (tkn - token()) l- T_CLOSE; ++n) { stoken(tkn);

putcbyte(OP_PUSH); do_expr();

putcbyte(OP_CALL); putcbyte(n);

/* do.nary - compile nary operator expressions */

do_nary(op,n) int op,n;

* while (n~) { do_expr();

If (n; putcbyte(OP_PUSH);

i

84 BYTE LISTINGS SUPPLEMENT • APRIL-JUNE, 1987

putcbyte(op); f r equIr e(T_CLOSE);

May

I

/* do.literal - compile a literal */ do_l iteralQ

code.llteral(t.value);

/* do.identIfler - compile an identifier */ do.Identlfier()

SYMBOL *sym;

Int n;

if (match("t"))

putcbyte(OP.T); else if (match( M nlI")) putcbyte(OP.NIL);

else If ((n - findarg(t.token)) >« 0) code.argument(n);

else If ((n ■ flndtmp(t_token)) >- 0) code.temporary(n); else If (sym - sfInd(t.token)) {

If (sym->s_type — ST.VARIABLE) code.varIabIe(sym->s_volue);

else

code.lIteral(sym->s_value);

e I so

code_J Iteral(oenter(t.token));

/* code.argument - compile an argument reference */ code.argument(n)

Int n;

putcbytefOP_ARG); putcbyte(n);

/* code.setargument - compile a set argument reference */ code.setargument(n)

Int n;

pu t cbyt e fOP^ASET); putcbyte(n);

\

/+ code.temporarv - compile an temporary reference */ code_temporary(n;

Int n;

putcbyte(OP.TMP); putcbyte(n);

/* code.settemporarv - compile a set temporary reference */ code.settemporary(n) int n;

putcbyte(OP.TSET); putcbyte(n);

I

/* code.varlable - compile a variable reference */ code.varlable(n)

Int n;

If (n < 32)

pu t cbyt e(OP.XVAR+n); else if (n < 256)

J putcbyte(OP.SVAR); putcbyte(n); \

continued

BYTE LISTINGS SUPPLEMENT • APRIL-JUNE, 1987 85

else

{ putcbyte(OP_VAR); putcword(n); }

i

/* code_setvarlable - compile a set variable reference */ code_setvarlable(n)

Int n;

* If (n < 32)

putcbyte(OP_XSET+n); else If (n < 256)

j putcbyte(OP_SSET); putcbyte(n); \

e I se

} putcbyte(OP_SET); putcword(n); \

/* code_llteral - compile a literal reference */ code_lIteraI(n) int n;

^ If (n >- 0 kk n < 64)

putcbyte(OP__XPLIT+n); else if (n < 0 kk n > -64) putcbyte(OP_XNLIT-n); else If (n >- 64 kk n < 256)

} putcbyte(OP_SPLIT); putcbyte(n); \ else if (n <« -64 kk n > -256)

{ putcbyte(OP_SNLIT); putcbyte(-n); }

else

{ putcbyte(OP_LIT); putcword(n); }

\

/* do_op - insert an opcode and look for closing paren */ do_op(op) int op;

putcbyte(op); frequ1re(T_CLOSE);

/* putcbyte - out a code byte into data space */ Int putcbyte(b) int b;

* If (cptr < CMAX)

code[cptr++J » b;

else

error(*'Insuf f iclent code space"); return (cptr-1);

/* putcword - put a code word into data space */ Int putcword(w)

Int w;

i

putcbyte(w); putcbyte(w » 8); return (cptr-2);

/* fixup - fixup a reference chain */ fixup(chn,val) int chn.val;

Int hval,nxt;

/* store the value into each location In the chain */ for (hval - val » 8; chn !• NIL; chn - nxt) j If (chn < 0 || chn > CMAX-2) return;

nxt ■ (code[chn] k 0xFF) | (code[chn+1] « 8); codeTchn] - val; codefchn-fl] ■ hval;

I 1

86 BYTE LISTINGS SUPPLEMENT • APRIL-JUNE, 1987

ADVAVL.C Contributed by: David Betz

TEXT "An Adventure Authoring System," David Betz, May 1987, page 125.

/♦ advavi.c - avl tree manipulation routines ♦/

/*

Copyright (c) 1986, by David Michael Betz AlI rights reserved

*/

#include "advavl.h"

^Include "advdbs.h"

#deflne TRUE 1

fdefine FALSE 0

^define NULL 0

/♦ external routines ♦/ extern char *save(); extern char ♦mallocQ;

/♦ external variables ♦/ extern char *data; extern int curwrd; extern int dptr;

/♦ local variables ♦/ static TREE ♦curtree; static char th1skey[WRDSIZE+1];

/♦ tnew - allocate a new avl tree ♦/

TREE *tnew()

TREE ♦tree;

/♦ allocate the tree structure ♦/ if ((tree - (TREE *)maIloc(sizeof(TREE))) — NULL) return (NULL);

/♦ Initialize the new tree ♦/ tree->tr_root * NULL; tree->tr_cnt * 0;

/♦ return the new tree */ return (tree);

/* tenter - add an entry to an avl tree */

Int tenter(tree,key)

TREE *tree; char ♦key;

int h; curtree - tree;

strncpyfthIskey,key,WRDSIZE); thiskey[WRDSIZE] » 0; return (tenter 1(&tree->tr_root,&h));

/♦ tenterl - internal insertion routine ♦/ int tenterl(pnode.ph)

TNODE ♦♦pnode; Int ♦ph;

i

TNODE ♦p,^q,^r; int val,c;

/♦ check for the subtree being empty ♦/

If ((p - ♦pnode) «* NULL) j

if (p « (TNODE ♦Jmalloc(sIzeof(TNODE))) { curtree->tr_cnt++;

KEY(p) - save(thIskey);

WORD(p) - curwrd;

LLINK(p) « RLINK(p) « NULL;

B(p) - 0;

♦pnode » p;

continued

BYTE LISTINGS SUPPLEMENT • APRIL-JUNE, 1987 87

*ph - TRUE; return (WORD(p));

else \

♦ph = FALSE;

return (NIL);

}

}

/* otherwise, check for a match at this node ♦/ else If ((c * strcmp(thiskey,KEY(p))) «« 0) { ♦ph ** FALSE; return (WORD(p));

/♦ otherwise, check the left subtree ♦/ else if (c < 0) {

val • tenter 1(&LLINK(p),ph); if (♦ph)

switch (B(p)) { case 1:

B(p) « 0;

♦ph = FALSE; break; case 0:

B(p) - -1; break; case -1:

q - LLINK(p);

If (B(q) — -1) {

LLINK(p) - RLINK(q); RLINK(q) - p;

B(p) - 0;

p “ q: »

else {

r - RLINK(q);

RLINKfq) - LLINK(r);

LLINKfr

LLINK(p

RLINKfr

RLINK(r);

RLINK(r) - p:

B(p) - (B(r) — -1 ? 1 : 0); B(q) - (B(r) — 1 ? -1 : 0);

r;

$

B(p) = 0; ♦pnode « p; ♦ph « FALSE; break;

\

/♦ otherwise, check the right subtree ♦/ else j

val ■ tenter 1(&RLINK(p),ph); if (♦ph)

switch (B(p)) { case -1;

B(p) - 0;

♦ph « FALSE; break; case 0:

B(p) - i; break; case 1:

q - RLINK(p);

If (B(q) --J) I.

RLINK(p) LLINK(q) ■ B(p) - 0;

p - q;

LLINK(q);

p;

else )

r ■

LLINKfq

RLINKir

RLINK(p

LLINK(q);

RLINK(r);

q;

LLINK(r);

88 BYTE LISTINGS SUPPLEMENT • APRIL-JUNE, 1987

LLINK(r) =

p;

8(p) - (Bf

r) == 1 ? -1 : 0)

B(q) = (B(

r) — -1 ? 1 : 0)

\

B(p) - 0; ♦pnode « p; *ph « FALSE; break;

/* return the node found or Inserted */ return (val);

/* tflnd - find an entry In an avl tree */ int tfInd(tree,key)

TREE *tree; char *key;

strncpyfthIskey,key,WRDSIZE); thIskey[WRDSIZE] = 0; return (tfIndl(tree->tr_root));

/* tflndl - Internal lookup routine */

Int tflndl(node)

TNODE *node;

i

Int c;

/* check for the subtree being empty */

If (node ~ NULL) return (NIL);

/* otherwise, check for a match at this node */ else If ((c - strcmp(th!skey,KEY(node))) « 0) return (WORD(node));

/* otherwise, check the left subtree */ else If (c < 0)

return (tflndl(LLINK(node)));

/* otherwise, check the right subtree */ e I se

return (tflndl(RLINK(node)));

ADVFIO.C Contributed by: David Betz

TEXT "An Adventure Authoring System," David Betz, May 1987, page 125.

/* advflo.c - file l/o routines for the adventure compiler */ /*

Copyright (c) 1986, by David Michael Betz Al I rights reserved

*/

#deflne BSIZE 8192

/* global variables */ long ad_foff;

/* external routines */ extern long lseek();

/* local variables */ static char buf[BSIZE]; static Int boff; static Int fd;

continued

BYTE LISTINGS SUPPLEMENT • APRIL-JUNE, 1987 89

ad_create(name) char *name;

/* create the file */ if ((fd « creat(name,0666)) < 0)

falI("can’t create output file");

/* Initialize the buffer and file offset */ ad_foff ■ 0L; boff - 0;

ad_cIose()

ad_fIush(); close(fd);

ad_putc(ch)

Inc ch;

\

buf(boff++] * ch; ad_foff++; if (boff >* 0SIZE) ad_flush();

ad_seek(pos) long pos;

ad_fIush();

if (Iseek(fd,pos,0) !« pos)

faiI("error positioning output file"); ad_foff * pos;

ad_flush()

* if (boff) \

If (wrlte(fd,buf,boff) I* boff)

falI("error writing to output file"); boff « 0;

\

ADVINT.H Contributed by: David Betz

TEXT "An Adventure Authoring System," David Betz, May 1987, page 125

/* advint.h - adventure interpreter definitions */ /♦

Copyright (c) 1986, by David Michael Betz Al I rights reserved

^Include <stdio.h> ^Include <ctype.h>

/* useful definitions

*/

^define TRUE

1

^define FALSE

0

^define EOS

'\0‘

/* program limits */

^define STKSIZE

500

/* code completion codes */

^define FINISH

1

^define CHAIN

2

^define ABORT

3

90 BYTE LISTINGS SUPPLEMENT • APRIL-JUNE, 1987

ADVMSG.C Contributed by: David Betz

TEXT "An Adventure Authoring System," David Betz, May 1987, page 125.

/* advmsg.c - adventure interpreter message routines */

/*

Copyright (c) 1986, by David Michael Betz All rIghts reserved

*/

^include <stdio.h>

/* cache size */ jfdefine CSIZE 8

/* external routines */ extern char *malloc();

/* message block cache */ static char *mbuffer[CSIZE]; static int mb!ock[CSIZE]; static int mnext[CSIZE]; static Int mhead.mtall;

/* message file variables */

static int mbase; static int mfd;

/* current message variables */

static int mblk; /* current block */static char *mbuf; /* current buffer */

static Int moff; /* current buffer offset */

/* msg_Jnit - initialize the message routines */ msg_Jn 11 (fd,base) int fd.base;

\

char *p; int i;

/* remember the message file descriptor and base */ mbase * base; mfd * fd;

/* initialize the cache */ if ((p « maI Ioc(CSIZE * 512)) « NULL) error("Insufficient memory"); for (I - 0; i < CSIZE; 1++) { mbuffer[i] - p; p +- 512; mblock[i] - -1; mnext[i] - 1+1;

^ mhead * 0; mtall * CSIZE-1; mnext[mtail] ■ -1;

/* msg_open - open a message */

Int msg_open(msg) unsigned int msg;

/* save the current message block */ mblk - msg » 7;

/* make sure the first block is in a buffer */ get_block(mblk);

/* setup the initial offset into the block */ moff - (msg k 0x7F) « 2;

/* megabyte - get a byte from a message */ int msg_byte()

/* message text block cache buffers */

/* message text block cache block numbers */ /* next most recently used block */

/* head and tail of Iru list */

/* message base block */

/* message file descriptor */

continued

BYTE LISTINGS SUPPLEMENT • APRIL-JUNE. 1987 91

/* check for end of block and get next block */ if (moff >- 512) \

get_block(++mblk); moff * 0;

\

/* return the next message bvte */ return (decode(mbuf[moff++]));

/* decode - decode a character */ int decode(ch)

Int ch;{

return ((ch ♦ 30) k 0xFF);

\

/* get.block - get a block of message text */ get_block(blk)

unsigned Int blk;

{

Int last,n; long loff;

/* first check the cache */

for (n « mhead; n I- -1; last ■ n, n - mnext[nj) If (blk -- mblock[n]) {

If (n I- mhead) } x

If ((mnext[Iast] - mnext[nj) — -1) mtaiI * Iast; mnext[n] - mhead; mhead - n;

mbuf ■ mbuffer[n]; return;

\

/* overwrite the least recently used buffer */ mblock[mta!I] - blk;

loff ■ ((long) mbase ♦ (long) blk) « 9; lseek(mfd,loff,0);

If (read(mfd,mbuffer[mtalI],512) !■ 512) error("error reading message text");

/* get the block */ get_block(blk);

ADVTRM.C Contributed by: David Betz

TEXT "An Adventure Authoring System," David Betz, May 1987, page 125.

/* advtrm.c - terminal i/o routines */

/*

Copyright (c) 1986, by David Michael Betz Al I right* reserved

*/

^include <stdlo.h>

/* useful definitions */ jfdef 1 ne TRUE 1

Ideflne FALSE 0

fdeflne EOS ‘\0'

jjldef I ne LINEMAX 200#deflne WORDMAX 100

/* global variables */ char Ilne[LINEMAX+1];

/* local variables */

static Int col.maxcoI,row.maxrow;

92 BYTIi LISTINGS SUPPLEMENT • Al’RIL-JUNE, I9S7

static int sent,went;

static char word[W0RDMAX+1],*wptr;

static FILE *logfp - NULL;

/* forward declarations */ char *trm_line();

/* trm_Init - initialize the terminal module */ t rm_ln11(rows,coIs,name) int rows,cols; char *name;

/* initialize the terminal i/o variables */

maxcol ■ cols-1; col « 0;

maxrow » rows-1; row ■ 0;

wptr » word; went - 0;

sent * 0;

/* open the log file */

if (name kk (logfp - fopen(name, M w M )) -- NULL) error("can*t open log file");

/* trm_done - finish terminal I/o */ trm_done()

If (went) trm_word();

If (l°9^P) fclose(logfp);

/* trm_get - get a line */ char *trm_get(IIne) char *1ine;

If (went) trm_word(); while (sent—) putchr(* *); row - col * sent ■ 0; return (trm_lIne(IIne));

/* trm_str - output a string */ trm_str(str) char *str;

while (*str)

trm_chr(*str •*■■►);

/* trm_xstr - output a string without logging or word wrap */ trm_xstr(str) char *str;

while (*str)

putch(*str++,stdout);

/* trm_chr - output a character */ trm_chr(ch)

Int ch; )

switch (ch) { case * 1 :

if (went)

trm_word(); scnt-M-; break; case *\t*:

If (went)

trm_word(); sent ■ (col + 8) k 7; break; case *\n':

If (went)

trm_word(); trm_eol();

continued

BYTE LISTINGS SUPPLEMENT • APRIL-JUNE, 1987 93

sent » 0; break;

def au11:

If (went < WORDMAX) } ♦wptr++ - eh; wcnt++;

\

break;

/♦ trm_word - output the current word ♦/ trm_word()

if (col + sent + went > maxcol) trm_eoI();

else

while (sent—)

{ putchr(' ’); col++; } for (wptr - word; went—; col++) putchr(^wptr++)5 wptr « word; went * 0; sent * 0;

/♦ trm_eol - end the current line ♦/ trm_eol()

{ putchr(*\n•);

If (++row >■ maxrow)

j trm_walt(); row » 0; \ col * 0;

/* trm_wait - wait for the user to type return ♦/ trm_walt()

* trm_xstr(" « MORE »\r");

waltch();

trm_xstr(" \r");

/♦ trm_llne - aet an input line ♦/ char *trm_line(I Ine) char ♦line;

I

char ♦p;

Int eh;

p - IIne;

while ((eh - getchr()) !« EOF kk eh !- # \n’) switch (ch) j case '\W: case *\010':

if (p !» line) j

If (ch I- ’\010*) putchr(*\010\stdout); putchrf* * ,stdout); putchr('\010*.stdout);

P—5

I

break;

defauIt:

if ((p - line) < LINEMAX)

♦p++ - ch; break;

\

*P - 0;

return (ch ** EOF ? NULL : line);

/♦ getchr - Input a single character ♦/ int getchr()

Int ch;

94 BYTE LISTINGS SUPPLEMENT • APRIL-JUNE, 1987

if ((ch - getch()) I- EOF && logfp) putch(ch,logfp); return (ch);

/* putchr - output a single character */ putchr(ch)

Int ch;j

If (logfp) putch(ch,logfp); putch(ch,stdout);

ADVPRS.C Contributed by: David Betz

TEXT "An Adventure Authoring System." David Betz, May 1987, page 125.

/★ advprs.c - adventure parser */

/*

Copyright (c) 1986, by David Michael Betz All rIghts reserved

♦/

^include "advlnt.h"

^include "advdbs.h"

/* parser result variables */

int nouns[20];

int *adjectIves[20];

static int actor,act ion,dobject.ndobjects,iobject; static int flag;

/* external routines */ extern char *trm_get();

Table caption/* external variables */

extern

char 1ine[];

/*

/* local variables */

static

char *lptr;

/*

statIc

int

words[100];

/*

static

char *wtext[100]

1;/*

static

int

*wptr;

/*

static

int

went;

/*

static static

int

int

verbs[3]; nnums[20];

/*

/*

static

Int

nptr;

/*

static

int

ad js[100];

/*

static

Int

anums[100];

/*

static

int

optr;

/*

Table captionIine buffer */

Iine pointer */ word table */ word text table */ word pointer */ word count */

words in the verb phrase */

noun word numbers */

noun pointer (actually, an index) */

adjective I ists */

adjective word numbers */

adjective pointer (actually, an index) */

/* parse - read and parse an input line */ int parse()

if (lparse1())

return (FALSE); setvaIue(\CACTOR,actor); setvaIue(V_ACTION,act ion); setvaluecVJDOBJECT,dobject); setvaluefV_NDOBJECTS,ndobjects); setvaIue(V_IOBJECT,lobject); return (TRUE);

/* next - get the next command (next direct object) */ int next()

If (getvaIuefV_NDOBJECTS) > 1) { setvaIue(V_ACTOR,actor); setvaIue(V^ACTION,act Ion);

continued

BYTE LISTINGS SUPPLEMENT • APRIL-JUNE, 1987 95

May

setvoluefV DOBJECT,getvolue(V_DOBJECT) + 1); setvaIue(V_NDOBJECTS,g«tvalu«(V_NDOBJECTS) - 1); setvalue(V_IOBJECT,iobject); return (TRUE);

\

e I se

roturn (FALSE);

\

/* parsel - the main parser */

Int parselQ

Int nouni,cnt1,noun2,cnt2; int preposition,flag;

/* initialize */

nouni ■ noun2 - NIL; cntl - cnt2 - 0; nptr - aptr - 0; preposition * 0; flag * 0;

/* initialize the parser result variables */ actor * action ** dobject ■ iobject * NIL; ndobjects - 0;

/* get an input line */ if (!get_line()) return (FALSE);

/* check for actor */ v . ,

if (wtype(*wptr) — WT_ADJECTIVE |l wtype(*wptr) — WT_NOUN) } If ((actor - getnoun()) — NIL) return (FALSE); flag |“ A_,ACTOR;

/* get verb phrase */ if (IgetverbO)

return (FALSE);

/* direct object, preposition and Indirect object */ If (*wptr) \

/* get the first set of noun phrases (direct objects) */ nouni » nptr+1; for (;;) {

/* get the next direct object */ if (getnoun() — NIL) return (FALSE);

++cnt1;

I

/* check for more direct objects if (*wptr — NIL || wtype(*wptr) break; wptr++;

*/ N !■ WT_CONJUNCTION)

/* get the preposition and indirect object */ If (*wptr) {

/* get the preposition */ if (wtype(*wptr) — WT_PREPOSITION) preposition - *wptr++;

/* get the second set of noun phrases (indirect object) */ noun2 - nptr+1; for (;;) {

/* get the next direct object */

If (getnounf) — NIL) return (FALSE);

++cnt2;

/* check for more direct objects If (*wptr — NIL || wtype(*wptr) break;

l- WT_CONJUNCTION)

% BYTE LISTINGS SUPPLEMENT • APRIL-JUNE. 1987

wptr++;

May

\

\

/* make sure this is ths end of the sentence */ If (*wptr) J

parse_error(); return (FALSE);

/* setup the direct and Indirect objects */ If (preposition) {

If (cnt2 > 1) { parse_error(); return (FALSE);

dob Ject - nouni; ndobjects « cntl;

^ lobject - noun2;

else if (noun2) (

If (cntl > 1) { parse_error(); return (FALSE);

preposition - flndword("to"); dobject « noun2; ndobjects ■ cnt2;

^ I object * nouni;

else }

dob ject ■ nouni; ndobjects - cntl;

/* setup the flags for the action lookup */

If (dobject) flag I- AJDOBJECT;

If (lobject) flag |- A_IOBJECT;

/* find the action */

If ((action « fIndactlon(verbs,preposition,flag)) « NIL) \ parse_error(); return (FALSE);

/* return successfully */ return (TRUE);

/* getverb - get a verb phrase and return the action it refers to */ Int getverbQ

/* get the verb */

if (*wptr — NIL || wtype(*wptr) !« WT_VERB) $ parse_error(); return (NIL);

verbs[0l * *wptr++; verbs[1J - NIL;

/* check for a word following the verb */ If (*wptr) |

verbsMl « *wptr; verbs[2] - NIL;

If (checkverb(verbs)) wptr++; else {

verbs[l] ■ words[wcnt-1];

I f (checkverb(verb8)) words[—went] » NIL; else {

verbs[1] » NIL;

if (Icheckverb(verbs)) j

continued

BYTE LISTINGS SUPPLEMENT • APRIL-JUNE, 1987 97

May

\

parse_error(); return (NIL);

I

I I

return (T);

I

/* getnoun - get o noun phraee and return the object It refere to */ Int getnoun()

* /* initialize tha adjective I let pointer */

adjectlves[nptr] ■ adje ♦ aptr;

/* get the optional article */

If (ewptr !• NIL kk wtype(ewptr) wptr++;

WT_ARTICLE)

/e get optional adject Ivee */ . ,

while (*wptr I- NIL kk wtype(*wptr) -* WT_ADJECTIVE) { adjs[aptr] - ewptr+4*; anumt[aptr] - wptr - worde - 1; aptr-M-;

adje[aptr*M*] ■ NULL;

/• get the noun ltee If */ v ,

If (*wptr NIL || wtype(ewptr) !■ WT_NOUN) { paree_error(); return (NIL;;

/* save the noun */ nounsTnptrl • *wptr++; nnums[nptrj - wptr - worde - 1; return (-M-nptr);

/* get.llne - get the Input line and lookup each word */ Int get_l lne()

/* read an Input line */ trm_chr(’ :’);

If T(lptr - trm_get(IIne)) — NULL) {

trm_str("Speak upl I can’t hear youl\n"); return (FALSE);

I

/* get each word on the line */ for (went ■ 0; sklp_spaces(); wcnt-M*) If (get_word() ■■ NIL) return (FALSE); words[wcnt] - NIL;

/♦ check for a blank line */ if (went -- 0) {

trm^str("Speak upl I can’t hear youl\n M ); return (FALSE); |

/* point to the first word and return successfully */ wptr « words; return (TRUE);

/* sklp_spaces - skip leading spaces */ Int sklp.spacesO

while (spacep(*Iptr))

Iptr-M-;

return (elptr !■ EOS);

/* ehow_noun - show a noun phrase */ show_noun(n) int n;

{

98 BYTE LISTINGS SUPPLEMENT • APRIL-JUNE, 1987

int adj,*p;

May

/* print the adjectives */

for (p - adject Ives[n-1], adj - FALSE; *p; p++, adj - TRUE) J If (adj) trm_chr(* '); trm_str(wtext[anums[p-adjs]]);

/* print the noun */

If (adj) trm_chr(’ ’); trm_str(wtext[nnums[n-1]]);

\

/* get__word - get the next word */ Int get_word()

Int ch;

/* get the next word */

for (wtext[wcnt] - Iptr; (ch - *lptr) !- EOS && lspacep(ch);

*lptr++ - (isupper(ch) ? tolower(ch) : ch);

If (♦Iptr !- EOS) * Iptr++ - EOS;

/* look up the word */

If (words[wcnt] - fIndword(wtext[went])) return (words[wcnt]); else )

trm_str("I don't know the word \ ,,M ); trm_str(wtext[went]); trm_str("\"An"); return (NIL);

/* spacep - Is this character a space? */

Int 8pacep(ch) Int ch;

return (ch — 9 * || ch -- *,' || ch — ’.’);

/* parse_error - announce a parsing error */ parse_error()

trm_str("I don’t understand An");

AOVDBS.C Contributed by: David Betz

TEXT "An Adventure Authoring System," David Betz, May 1987, page 125.

/* advdbs.c - adventure database access routines */

/*

Copyright (c) 1986, by David Michael Betz All rIghts reserved

♦/

flnclude "advint.h"

^Include "advdbs.h"

#1 fdef MAC ^Include <fnctI.h>

#deflne RMODE (0_RD0NLY|0_BINARY)

jfe I se

^Include <setjmp.h>

^define RMODE 0 #end!f

/* global variables */

Int h_lnlt; /* Initialization code */

continued

BYTE LISTINGS SUPPLEMENT • APRIL-JUNE, 1987 99

Int h_update; Int h..before; Int h.after; Int h_error; Int dotafd;

/♦ update code ♦/

/♦ before handler code ♦/ /♦ after handler code ♦/

/♦ error handling code ♦/ /♦ data file descriptor ♦/

/♦ external variables ♦/ extern JmpJ>uf restart;

/♦ external routines ♦/ extern char ♦malloc();

/♦ table base addresses ♦/

char swtable; /♦ word table ♦/

char ♦wtypes; /♦ word type table ♦/

Int wcount; /♦ number of words ♦/

char notable; /♦ object table ♦/

Int ocount; /♦ number of objects ♦/ char eatable; /♦ action table ♦/

Int acount; /♦ number of actions ♦/ char evtable; /♦ variable table */

Int vcount; /* number of variables */

char ♦data; /* base of data tables */

char *base; /* current base address ♦/

char *dbase; /♦ base of the data space */

char debase; /* base of the code space */

int length; /* length of resident data structures

*/

/* data file header */ static char hdr[HDR_$IZE];

/* save parameters */

static long saveoff; /* save data file offset */

static char ♦save; /♦ save area base address ♦/

static Int slen; /♦ save area length ♦/

/♦ db_ln!t - read and decode the data file header ♦/ db_lnlt(name) char ♦name;

^ Int woff,ooff,aoff,voff,n; char fname[50];

/♦ get the data file name ♦/ strcpy(fname.name); ftfndef MAC

strcat(fname, M .dat M ); fend If

/♦ open the data file ♦/

If ((datafd - open (fname.RMODE)) ■■ -1) error( M can*t open data file");

/♦ read the header ♦/

If (read(datafd.hdr,HDR_SIZE) I- HDR_SIZE) error("bad data file H ); complement(hdr,HDR_$IZE); base ■ hdr;

/♦ check the magic Information ♦/

If (strncmp(&hdr[HDR_MAGIC],"ADVSYS",6^ 1- 0) error("not an adventure data file");

/♦ check the version number ♦/ If ((n - getword(HDR.VERSION)) error("wrong version number

< 101 || n > VERSION)

/♦ decode the resident data length header field ♦/ length ■ getword(HDR_LENGTH);

/♦ allocate space for the resident data structure ♦/ If ((data ■ malloc(length)) ■■ 0) error( M lnsuffIclent memory");

/♦ compute the offset to the data ♦/ saveoff ■ (Iong)getword(HDR_DATBLK) ♦ 512L;

100 BYTE LISTINGS SUPPLEMENT • APRIL-JUNE, 1987

/* read the resident data structure */ lseek(datafd,saveoff,0); if (read(datafd,data,length) !* length) error("bad data file"); complement(data,length);

/* get the table base addresses */ wtable ■ data + (woff - getword(HDR_WTABLE));

wtypes - data + getword(HDR_WTYPES) - 1;

otable - data + (ooff - getword(HDR_OTABLE));

atable - data + (aoff - getwordfHDR^ATABLE));

vtable - data + (voff - getword(HDR_VTABLE));

/* get the save data area */ saveoff +« (long)getword(HDR_SAVE); save * data + getword(HDR_SAVE); slen - getword(HDR_SLEN);

/* get the base of the data and code spaces */ dbase « data + getwordfHDR^DBASE); cbase - data + getword(HDR_CBASE);

/* initialize the message routines */ msg_init(datafd,getword(HDR_MSGBLK));

/* get the code pointers */

h_InIt - getword(HDR_INIT);

h__update -- get word (HDR_UPDATE) ; h_before - getword(HDR_BEFORE); h_after - getwordfHDR^AFTER); h_error ■ getword(HDR_ERROR);

/* get the table lengths */ base - data; wcount - getwordfwofM; ocount ■ getwordiooff); acount » getwordfaoff j; vcount « getword(voff);

/* setup the base of the resident data ♦/ base - dbase;

/* set the object count */ setvaIue(V_OCOUNT,ocount);

/* db_save - save the current database */ db_save(name) char *name;

\

return (advsave(&hdr[HDR_ANAME],20,save,slen) ? T : NIL);}

/* db_restore - restore a saved database */

Int db_restore(name) char *name;

I

return (advrestore(&hdr[HDR_ANAME],20,save,sIen) ? T ; NIL);

/* db_restart - restart the current game */ db_restart()

lseek(datafd,8aveoff,0);

If (read(datafd,save,8len) l- slen) return (NIL); complement(save,8 Ien); setvaIue(V_OCOUNT,ocount); longjmp(restart,1);

/* complement - complement a block of memory */ comp Iement(adr,len) char *adr; Int len;

continued

BYTE LISTINGS SUPPLEMENT • APRIL-JUNE, 1987 101

for (; len—; adr++)

♦adr * (*adr + 30);

I

/♦ flndword - find a word In the dictionary ♦/

Int findword(word) char ♦word;

char sword[WRDSIZE+1];

Int wrd,l;

/♦ shorten the word ♦/

strncpy(sword,word,WRDSIZE); sword[WRDSIZE] - 0;

/♦ look up the word ♦/ for (l « 1; i <* wcount; I++) { wrd «■ getwloc( i );

If (strcmp(base+wrd+2,sword) « 0) return (getword(wrd));

return (NIL);

\

/♦ wtype - return the type of a word ♦/

Int wtype(wrd)

Int wrd;

return (wtypes[wrd]);

\

/* match - match an object against a name and list of adjectives ♦/ int match(obJ,noun,adJs)

Int obj,noun,*adj8;

I

int *aptr;

i f (lha8noun(obj,noun)) return (FALSE);

for (aptr - adjs; *aptr !« NIL; aptr++) if (lhasadjective(obj,*aptr)) return (FALSE); return (TRUE);

\

/* checkverb - check to see if this is a valid verb */

Int checkverb(verbs) int *verb8;

1

int act;

/* look up the action */ for (act - 1; act <- acount; act++) if (hasverbfact.verbs)) return (act); return (NIL);

i

/* flndaction - find an action matching a description */ findaction(verbs,preposition,fIag) int ♦verbs,preposition,flag;

{

int act,mask;

/♦ look up the action ♦/

for (act - 1; act <« acount; act++) }

If (preposition kk lhaspreposition(act.preposition)) continue;

if (lhasverb(act,verbs)) continue;

mask - getabyte(act,A_MASK);

If ((flag k mask) «= (getabyte(act,A_FLAG) k mask)) return (act);

return (NIL);

J

102

BYTE LISTINGS SUPPLEMENT • APRIL-JUNE, I9K7

/* getp - gat the value of an object property */ Int getp(obJ.prop) int obj,prop;

Int p;

for (; obj; obj - getofleId(ob1,0_CLASS))

If (p - flndprop(obJ.prop); return (getofleId(obJ,p)); return (NIL);$

/* setp - set the value of an object property */ int setp(obJ.prop.val)

Int obj.prop,val;

int p;

for (; obj; obj - getofleId(obI,0_CLASS))

If (p - fIndprop(obJ.prop);

return (putofleId(obj,p,val)); return (NIL);

/* flndprop - find a property */ int fIndprop(obj.prop)

Int obj.prop;

int n.I.p;

n - getofleld(obj,0_NPR0PERTIES); for (l - p * 0; I < n; I++, p +- 4)

if ((getofIeId(obj,0_PR0PERTIES+p) k P_CLASS) — prop) return (0_PR0PERTIES+p+2); return (NIL);

/* hasnoun - check to see If an object has a specified noun */ Int ha8noun(obj.noun) int obj.noun;

while (obj) {

if (iniist(getofieId(obJ,0_N0UNS),noun)) return (TRUE);

obj - getofleId(obj,0_CLASS); return (FALSE);

/* hasadjective - check to see if an object has a specified adjective */ Int hasadjectIve(obJ.adjectIve)

Int obj.adjective;

while (obj) }

if (ini Ist (getof ie I d(ob J .OBJECTIVES), adject ive)) return (TRUE);

obj - getofIeId(obj,0_CLASS); return (FALSE);

/* hasverb - check to see if this action has this verb */ int hasverb(act.verbs)

Int act,*verbs; j int I ink,word,*verb;

/* get the list of verbs */ link - getafield(act,ADVERBS);

/* look for this verb */ while (link !- NIL) ( verb * verbs;

word - getword(I Ink+L_DATA);

while (everb I- NIL kk word !■ NIL) {

If (*verb !■ getword(word+L_DATA)) break;

continued

BYTE LISTINGS SUPPLEMENT • APRIL-JUNE, 1987 103

verb++;

word - getword(word+L_NEXT);

If (*verb «=■ NIL && word =» NIL) return (TRUE);

link « getword(Iink+L_NEXT); return (FALSE);

/* hasprepo8ition - check to see If an action has a specified preposition */ int hasprepositIon(act,prepositIon) int act.preposition;

return (iniist(getafield(act,A_PREPOSITIONS),preposit ion));

/* Ini 1st - check to see if a word is an element of a list */ int iniist(I ink.word) int I ink,word;

while (link 1- NIL) {

If (word «« getword(Iink+L_DATA)) return (TRUE);

link - getword(link+LJMEXT); return (FALSE);

/* getofleld - get a field from an object */ int getofield(obj.off)

Int obj.off;

return (getword(getoloc(obJ)+off));

/* putofield - put a field into an object */ int putofleld(obj,off,val)

Int obj,off,val;

return (putword(getoloc(obj)+off,val));

/* getafield - get a field from an action */ int getafield(act,off)

Int act,off;

return (getword(getaloc(act)+off));

/* getabyte - get a byte field from an action */ int getabyte(act,off) int act,off;

return (getbyte(getaloc(act)+off));

/* getoloc - get an object from the object table */ int getoloc(n)

Int n;

If (n < 1 || n > ocount)

nerror("object number out of range: %d",n); return (getdword(otabIe+n+n));

/* getaloc - aet an action from the action table */ int getaloc(n)

Int n;

If (n < 1 || n > acount)

nerror("act Ion number out of range: %d",n); return (getdword(atabIe+n+n));

104 BYTH LISTINGS SUPPLHMHNT • APRIL JUNB, 1987

/* getvalue - get the value of a variable from the variable table */ nt getvalue(n)

Int n;

If (n < 1 || n > vcount)

nerror("varlable number out of range: %d M ,n); return (getdword(vtabIe+n+n));

/* setvalue - set the value of a variable In the variable table */ nt setvaIue(n,v) int n,v;

If (n < 1 || n > vcount)

nerror("variable number out of range: %d",n); return (putdword(vtabIe+n+n,v));

/* getwloc - get a word from the word table */ nt getwloc(n) int n;

if (n < 1 || n > wcount)

nerror("word number out of range: %d",n); return (getdword(wtabIe+n+n));

/* getword - aet a word from the data array */ nt getword(n) int n;

return (getdword(base+n));

/* putword - put a word into the data array */ nt putword(n.w) int n,w;

return (putdword(base+n,w));

♦ getbyte - aet a byte from the data array */ nt getbyte(n)

Int n;

return (*(base+n) & 0xFF);

/* getcbyte - get a code byte */ Int getcbyte(n)

Int n;

return (*(cbase+n) k 0xFF);

/* getcword - get a code word */ int getcword(n; int n;

return (getdword(cbase+n));

/* getdword - aet a word from the data array */ int getdword(p) char *p;

return ((*p k 0xFF) | (*(p+1) « 8));

/* putdword - put a word into the data array */ int putdword(p.w) char *p; Int w;

continued

BYTE LISTINGS SUPPLEMENT • APRIL-JUNE, 1987 105

*p a w; *(p+1) - w » 8; return (w);

/* nerror - handle errors with numeric arguments nerror(fmt,n)

char *fmt; Int n;

char buf[100]; sprIntf(buf,fmt,n); error(buf);

\

*/

ADVINT.C Contributed by: David Betz

TEXT "An Adventure Authoring System," David Betz, May 1987, page 125.

/* advtnt.c - an interpreter for adventure games */

/*

Copyright (c) 1986, by David Michael Betz Al I rights reserved

*/

ftnclude "advlnt.h" finclude "advdbs.h" llfndef MAC finclude <setjmp.h> fendif

/* global variables */ jmp_buf restart:

/* external variables ♦/ extern int h_lnit; extern int h.update; extern Int h_before; extern Int h_after; extern int h_error;

/• main - the main routine */ main(argc,orgv)

Int argc; char *argv[];

char *fname,*lname; int rows,coIs,I;

#ifdef MAC

char name[50l; mac In 11(name); fname - name;

I name ■ NULL; rows - 20; cols - 80; felse

prIntf("ADVINT vl.2 - Copyright (c) 1986, by David Betz\n"); fname - NULL;

I name - NULL; rows - 24; cols - 80;

/* parse the command line */ for (1*1; I < argc; I-M-)

If (argv[I][0] —

switch (argv[l][1]) j case *r’: case 'R*:

rows • atol(&argv[1][2]); break;

case ’c*: case # C*:

106 BYTE LISTINGS SUPPLEMENT • APRIL-JUNE, 1987

cols ® atoI(&argv[i][2]); break; case •I•: case *L’:

Iname = &argv[I][2]; break;

i

e I se

fname ■ argv[I];

If (fname « NULL) {

prIntf("usage: advlnt [-r<rows>] [-c<columns>] [-l<log-fIIe>] <flle>\n");

exlt();

#endif

/* Initialize terminal I/o */ trm_InIt(rows,col8,Iname);

/* Initialize the database */ db_lnlt(fname);

/* play the game */ play();

/* play - the main loop */ play()

/* establish the restart point */ setJmp(re8tart);

/* execute the Initialization code */ execute(h_ln!t);

/* turn handling loop */

for (;:) }

/* execute the update code */ execute(h_update);

/* parse the next Input command */

If (parseQ) {

If (slngleO)

while (next() && slngle())

»

\

/* parse error, call the error handling code */ el se

execute(h_error);

/* single - handle a single action */

Int slngle()

/* execute the before code */

switch (execute(h_before)) J

case ABORT: /* before handler aborted sequence */ return (FALSE);

case CHAIN: /* execute the action handler */

if (executefgetafieId(getvaIue(V_ACTION),A_CODE)) — ABORT) return (FALSE);

case FINISH:/* execute the after code */

If (execute(h_after) ■■ ABORT) return (FALSE); break;

return (TRUE);

continued

BYTE LISTINGS SUPPLEMENT • APRIL-JUNE, 1987 107

/♦ error - print an error message and exit ♦/ error(msg) char ♦msg;

{

trm__str(msg);

trm_chr('\n');

exit();

ADVJUNK.C Contributed by: David Betz

TEXT "An Adventure Authoring System," David Betz, May 1987, page 125.

/♦ advjunk.c - operating system specific code for "advlnt" ♦/ finctude <stdio.h> long _seed ■ 1L; int rand()

..seed ♦■ 397204094L; return (_seed k 0x7FFF);|

srand(n) long n;

..seed - n;

\

Int getch()

I

Int ch;

If ((ch ■ bdos(1) k 0xFF) ■« ’\r*) j bdos(6,*\n*); ch « *\n # ; \ return (ch);

\

waltch()

bdos(7);

putch(ch,fp)

Int ch; FILE *fp;

aputc(ch,fp);

int odvsave(hdr,hlen,save,slen) char *hdr; Int hlen; char ♦save; Int slen;

char fname[50];

Int fd;

trm_str("FIle name? "); trm_get(fname);

/♦ add the extension ♦/ street(fname,".sav");

/♦ create the data file ♦/

If ((fd ■ creat(fname,0666)) «■ -1) return (0);

/♦ write the header ♦/

If (wrlte(fd,hdr,hlen) !- hlen) { close(fd); return (0);

I

108 BYTE LISTINGS SUPPLEMENT • APRIL-JUNE, 1987

/* write the data */

If (wrIteffd,save,slen) !■ slen) j close(fd); return (0);

\

/+ close the file and return successfully */

close(fd);

return (1);

\

Int advrestore(hdr,hlen,save,slen) char *hdr; Int hlen; char *save; Int slen;

char fname[50],hbuf[50],*p;

Int fd;

If (hlen > 50)

error("8ave file header buffer too small");

trm_str("FIle name? "); trm_get(fname);

/* add the extension */ street(fname, M .sav M );

/* create the data file */

If ((fd - open(fname,0)) — -1) return (0);

/* read the header */

If (read(fd,hbuf,hlen) !- hlen) | close(fd); return (0);

\

/* compare the headers */ for (p • hbuf; hlen—; )

If (*hdr++ !- *p++) {

trm_str("This save file does not match the adventure!\n"); return (0);

\

/* read the data */

If (read(fd,save,slen) !■ slen) { close(fd); return (0);

I

/* close the file and return successfully */

close(fd);

return (1);

$

ADVEXE.C Contributed by; David Betz

TEXT "An Adventure Authoring System," David Betz, May 1987, page 125.

/* advexe.c - adventure code executer */

/*

Copyright (c) 1986, by David Michael Betz AlI rights reserved

*/

{ Include "advlnt.h"

Include "advdbs.h"

/* external variables ♦/

continued

BYTE LISTINGS SUPPLEMENT • APRIL-JUNE, 1987 109

extern char IInefl;

extern int nouns[J,*adjectives[];

/* local variables */

Int pc,opcode,p2,p3,sts;

int stack[STKSIZE],*sp,*fp,*top;

long rseed ■ 1L;

/* external routines */ extern long time();

/* execute - execute adventure code */ Int execute(code) int code;

/* setup initial program counter */ if ((pc - code) — NIL) return (CHAIN);

/* initialize */

sp « fp « top - stack + STKSIZE;

/* execute the code */ for (sts - 0; 81s «« 0; ) exe_one();

return (sts);

/* exe_one - execute one Instruction */ exe_one()

/* get the opcode */ opcode - getcbyte(pc); pc++;

/* execute the Instruction */ switch (opcode) { case OP__CALL:

*—sp » getboperand();

*—«P - pc;

*—sp - (int)(top - fp); fp • sp;

pc ■ getafieId(fp[fp[2]+3],A_CODE); break;

case OP_$END: *—sp - getboperand();

*—sp - pc;

*—sp - (Int)(top - fp); fp - sp;

if (p2 - fp[fp[2]-f3])

p2 ■ getofieId(p2,0_CLASS);

e I se

p2 - f P [fp[2)+2];

If (p2 && (p2 - getp(p2,fp[fp[2]+1]))) | pc - getafieId(p2,A_CODE); break;

i

*sp ■ NIL;

/* return NIL if there is no method for this message ♦/ case OP_RETURN:

if (fp — top) sts - CHAIN; e I so {

p2 - *8p;

sp - fp;

fp - top - *sp++; pc ■ *sp++; p3 * *sp++; sp +- p3;

♦sp - p2;

break;

case OP_TSPACE:

sp — getboperand(); break;

case OP_TMP;

p2 - getboperand();

110 BYTE LISTINGS SUPPLEMENT • APRIL-JUNE, 1987

to

*ep » fp[-p2-1]; break;

case OP_TSET:

p2 » getboperand(); fp[-p2-1] - ♦sp; break;

case OP_ARG:

p2 ■ getboperand(); if ( P 2 >- fp[2])

error("too few arguments");

♦sp - fp[p2+3]; break;

case OP^ASET:

p2 « getboperand(); if (p2 >« fp[2])

error("too few arguments"); fp[p2+3) - ♦sp; break;

case OP_BRT:

pc ■ (♦sp ? getwoperand() : pc+2); break;

case OP_BRF:

pc ■ (♦sp ? pc+2 : getwoperand()); break;

case 0PJ3R:

pc - getwoperand(); break;

case OP_T:

♦sp ■ T; break;

case OP_NIL:

♦sp » NIL; break;

case OP_PUSH;

♦—sp - NIL; break;

case OP_NOT:

♦sp ■ (♦sp ? NIL : T); break;

case OP^ADD:

p2 - ♦sp**;

♦sp +- p2; break;

case OP_SUB:

p2 - ♦sp**;

♦8p — p2; break;

case OP_MUL:

p2 - ♦sp++;

♦sp ♦- p2; break;

case OP_DIV:

p2 ■ ♦sp++;

♦sp * (p2 ■■ 0 ? 0 : ♦sp / p2); break;

case OP_REM:

p2 ■ ♦sp-M-;

♦sp - (p2 —070: ♦sp X p2); break;

case OP_BAND:

p2 * ♦sp-f+;

♦sp p2; break;

case OP_BOR:

p2 - ♦sp-M-;

**P I- p2; break;

case OP.BNOT:

♦sp - ♦sp; break;

case OP_LT:

p2 ■ ♦sp+t;

♦sp - (♦sp < p2 ? T : NIL); break;

continued

BYTE LISTINGS SUPPLEMENT • APRIL-JUNE, 1987 111

case OP_EQ:

p2 * *sp++;

♦sp « (♦sp p2 ? T : NIL); break; case OP_GT: p2 « *sp++;

♦sp = (♦sp > p2 ? T : NIL); break;

case OP_LIT:

♦ sp « getwoperand(); break;

case OP_SPLIT:

♦sp = getboperand(); break;

case OP_$NLIT:

♦ sp ■ -getboperand(); break;

case OP_VAR:

*8p « getvalue(getwoperand()); break;

case OP_SVAR:

♦sp - getvalue(getboperand()); break;

case OP_SET:

8etvalue(getwoperand(),*sp); break;

case OP_SSET;

setvalue(getboperand(),*sp); break;

case OP_GETP:

p2 - *8p++;

*sp - getp(*sp,p2); break;

case OP_SETP:

p3 - *8p++;

p2 « *8p++;

♦ sp m setp(^sp,p2»p3); break;

case OP_PRINT:

prInt(♦sp); break;

case OP_PNUMBER:

pnumber(♦sp); break;

case OP_PNOUN:

8how_noun(*8p); break;

case OP_TERPRI:

trm_chr(*\n'); break;

case OP.FINISH:

818 - FINISH; break;

case OP_CHAIN:

sts - CHAIN; break;

case OP^BORT:

818 - ABORT;

break; case OPJiXIT:

#ifdef MAC

macpau8e();

#endlf

trm_done(); ox 11(); break;

case OP_YORN:

trm_get(line);

♦ sp - (Ilne[0] — *Y' || line[0] — V ? T : NIL) break;

case OP_CLASS:

♦sp ■ getofleld(*8p,0_CLASS); break;

case OP_MATCH:

p2 - ♦sp++;

♦sp - (match(^sp,nouns[p2-1],adjectIves[p2-1]) ? T break;

i

NIL);

112 BYTE LISTINGS SUPPLEMENT • APRIL-JUNE, 1987

case OP_SAVE:

*sp « db_save(); break;

cose OP_RESTORE:

*sp « db_restore(); break;

case OP_RE$TART:

*sp - db_restart(); break;

case OPERAND:

*sp * getrand(*sp); break;

case OP_RNDMIZE:

setrand(time(0L));

*sp - NIL; break;

default:

If (opcode >- OP_XVAR kk opcode < OP_XSET)

*sp ■ getvalue(opcode - OP_XVAR); else If (opcode >- OP_XSET kk opcode < OP_XPLIT) 8etvalue(opcode - OP_XSET»*sp); else If (opcode >« OP_XPLIT kk opcode < OP_XNLIT) *sp « opcode - OP_XPLIT; else If (opcode >« OP_XNLIT kk opcode < 256)

*sp ■ OP_XNLIT - opcode;

e I se

trm_8tr("Bad opcodeW); break;

/* getboperand - get data byte */ Int getboperand()

Int data;

data ■ getcbvte(pc); pc +■ 1; return (data);}

/* getwoperand - get data word */ Int getwoperand()

Int data;

data - getcword(pc); pc +« 2; return (data);

/* print - print a message */ prInt(msg)

Int msg;

Int ch;

msg_open(msg); while (ch ■ msa byte()) trm_chr(ch);

/* pnumber - print a number */ pnumber(n)

Int n;

i r ,

char buf[10];

sprlntffbuf,"%d".n); trm_str(buf);

/* getrand - aet a random number between 0 and n-1 */ Int getrand(n)

Int n;

i

long kl;

/* make sure we don’t get stuck at zero */

If (rseed ■■ 0L) rseed ® 1L;

continued

BYTE LISTINGS SUPPLEMENT • APRIL-JUNE, 1987 113

/* algorithm taken from Dr. Dobbs Journal, November 1985, page 91 */ kl - rseed / 127773L;

If ((rseed « 16807L * (rseed - kl * 127773L) - kl * 2836L) < 0L) rseed +*= 2147483647L;

/* return a random number between 0 and n-1 */ return ((Int)(rseed % (long)n));

I

/* setrand - set the random number seed */ setrand(n) long n;

rseed » n;

\

ADVSYS.DOC Contributed by: David Betz

TEXT "An Adventure Authoring System," David Betz, May 1987, page 125.

ADVSYS - An Adventure Writing System

Version 1.2

by David Betz 127 Taylor Road Peterborough, NH 03458 (603) 924-6936 (home)

July 14, 1986

Copyright (c) 1986, by David Betz AlI Rights Reserved

Permission is hereby granted for unrestricted non-commercial use

ADVSYS An Adventure Writing System Page 2

INTRODUCTION

ADVSYS is a special purpose programming language that was specifically designed to be used to write computer text adventure games. It includes a facility for defining the kinds of objects that are common in adventures. Some objects represent locations on the game map, some objects represent things that the player can find while exploring the adventure world, and some objects represent other characters that the adventurer can encounter during his or her journeys. The adventure language also provides a facility to define actions. Actions are short sections of code that determine what happens in response to a command from the player. These two concepts, "objects" and "actions" form the basis for the adventure Ianguage.

ACKNOWLEDGEMENTS

Although I have written all of the code associated with this adventure writing system, I must acknowledge the assistance of one individual without whom this project would probably never have reached completion. That person Is Gary McGath. Gary was interested In writing a commercial quality adventure game and I convinced him to write it using my system (which was as yet almost completely unspecified) instead of using a traditional programming language. The Input that Gary provided during the development of his game contributed significantly to the overall design of the system. I would like to thank Gary for that contrI but ion.

114 BYTE LISTINGS SUPPLEMENT • APRIL-JUNE, 1987

May

ADVSYS An Adventure Writing System Page 3

USING THE SYSTEM TO WRITE AN ADVENTURE

In order to write an adventure using this system, you need to write an adventure description. This is an ordinary ASCII text file containing definitions for all of the objects and actions in your adventure game. This file Is used as input to the adventure compiler. The compiler takes the adventure description and compiles it into a set of data structures.

In order to play an adventure written using this system, you need the data structure file that was produced by the compiler and the adventure interpreter program. The interpreter uses the Information produced by the adventure compiler to allow a player to play the adventure game. Notice that it is not necessary for the player to have access to the original adventure description file. All of the Information that is necessary to play the adventure game is contained within the data structure file that is produced by the compiler. This file is a binary file that cannot be simply "listed" to reveal the Internal workings of the adventure.

The adventure compiler is called ADVCOM and the interpreter is called ADVINT. These two programs in conjunction with this documentation are all that is required to write and play adventure games using this system.

ADVSYS An Adventure Writing System Page 4

RUNNING THE COMPILER

If you have created an adventure definition file called "MYADV.ADV", you can compile It with the command:

A>advcom myadv

Typing this command wilt invoke the adventure compiler and cause it to compile the file named "MYADV.ADV". The ".ADV" extension Is added to the file name by the compiler. During the process of compiling the file, many messages will be printed telling about the progress of the compiler. At the end of the compilation process, the compiler prints a set of statistics describing the resulting data structure file. This file will be called "MYADV.DAT". It contains the data structures needed by the adventure Interpreter to allow a player to play the adventure game.

Note: The "A>" In the line above is the MS-DOS prompt and should not be typed as part of the command.

RUNNING THE INTERPRETER

Assuming that you have a compiled adventure data file called "MYADV.DAT", you can play the adventure by typing the command:

A>advint myadv

This command will start the adventure. There will probably be some text printed at this point describing the adventure and the initial situation. You will then be prompted to type a command. The prompt Is the colon character. The format for commands is described under the section about the parser. After typing a command, you will be told what happened as a result of your command, your new situation will be described and you will begin the loop again.

continued

BYTE LISTINGS SUPPLEMENT • APRIL-JUNE, 1987 115

ADVENTURE DESCRIPTION FILE FORMAT

All adventure description files contain a collection of statements. These statements must be formed according to the foI lowing rules:

The adventure definition statement:

All adventure definitions should have an ADVENTURE statement. This statement gives the name of the adventure and the version number of the definition file. Each adventure should have a unique name. This name Is used to identify M saved position" files and insure that only files that correspond to the current adventure are restored. The version number allows the author to have many versions of the same adventure during development and guarantee that "save" files from one version aren't restored into another version.

(ADVENTURE name version)

Examp Ie:

(ADVENTURE sample 1)

Vocabulary statements:

These statements add words to the adventure vocabulary.

(ADJECTIVE word*)

(PREPOSITION word*)

(CONJUNCTION word*)

(ARTICLE word*)

(SYNONYM word synonym*)

Examp Ies:

(ADJECTIVE red blue)

(CONJUNCTION and)

(SYNONYM big large)

Note:

Words are also added to the vocabulary by the object and action definitions using the NOUN, ADJECTIVE, VERB and PREPOSITION statements.

BYTE LISTINGS SUPPLEMENT • APRIL-JUNE, 1987

May

ADVSYS An Adventure Writing System Page 6

Constant definition statement:

(DEFINE name value)

Examp Ies:

(DEFINE what "I don't understand what you're saylnglVn")

(DEFINE max-load 100)

Function definition statement:

(DEFINE (function-name [arg-name]* [&aux tmp-name*]) expr*)

Example:

(DEFINE (factorial n)

(IF (< n 2)

1

(* n (factorial (- n 1)))))

Variable definition statement:

(VARIABLE varlab I e-name*)

Example:

(VARIABLE score I j)

Property name definition statement:

(PROPERTY property-name*)

Example:

(PROPERTY weight value)

ADVSYS An Adventure Writing System Page 7

Comments:

Comments begin with a semi-colon and end with the end of the line.

Example:

; this is a comment

Include files:

Any line that begins with a "®" causes the inclusion of another file. The file name immediately follows the at-sign and extends to the end of the line. Only one level of Include is supported.

Example:

©basic.adv

continued

BYTE LISTINGS SUPPLEMENT • APRIL-JUNE. 1987 117

Handler definition statements:

(INIT expr*)

(UPDATE expr*)

(BEFORE expr*)

(AFTER expr*)

(ERROR expr*)

Examp Ie:

(INIT

(print "Welcome to the sample adventure!\n"))

Hand Iers:

All activity within an adventure game is controlled by a built-in handler loop. Each of the handlers in the loop contains code that Is provided by the adventure author. The sequencing from handler to handler is provided by the adventure system itself.

The first handler that is called In an adventure game Is the INIT handler. It prints some sort of introductory text and initializes all global variables in order to start the adventure game.

After the INIT handler has completed, the normal loop is entered. It starts with the UPDATE handler. The UPDATE handler prepares for the player's next turn. It should describe the player's location if It has changed since the I as t turn. After the UPDATE handler completes, the parser i8 called. It prompts the player for a command, parses the command, sets the built-in parser varaibles and exits. Then the BEFORE handler is called. It is called before the action associated with the command to allow the adventure author to inspect the parser variables before proceeding to the action itself. After the BEFORE handler completes, the action itself is called (or whatever action is stored In the built-in variable $ACTION when the BEFORE handler completes). When the action completes, the AFTER handler is cal led to give the author a chance to handle events that happen only at the end of a successful turn. The ERROR handler is called when the parser detects an error.

ADVSYS An Adventure Writing System Page 9

The handler loop:

INIT

i

v

UPDATE<_+

I

v

parse->ERROR-+

v

BEFORE

i

v

action

i

v

AFTER_—♦

BYTE LISTINGS SUPPLEMENT • APRIL-JUNE, 1987

ADVSYS

An Adventure Writing System

Page 10

May

The parser:

The parser handles all commands from the player. It prompts the player when It Is ready for a new command. The prompt Is the colon character. When the player has typed a command, the parser breaks the command Into phrases. The parser recognizes the following command forms:

actor, actor, actor, actor,

verb

verb dobjects

verb dobjects preposition lobject verb lobject dobjects

Where:

actor

verb

dobjects dobject prepositIon lobject noun phrase

Examp Ies:

■«> a noun phrase

««> the verb phrase (1 or 2 words)

«> dobject [conjunction dobject]*

«*> a noun phrase

=«> a preposition

«> a noun phrase

*«> [article] [adjective]* noun

Look

Take the red magic sword

Take the red sword and the blue bottle

Give the troll the red sword

Give the red sword to the troll

Troll, give me the sword

Notes:

Square brackets enclose optional phrases. An asterisk Indicates zero or more of the proceeding element.

The fourth form above is treated as if the player had typed:

[actor,] verb dobject "to" iobject

Once the parser has broken the command Into phrases, It assigns each noun phrase a number. It stores the number of the actor noun phrase in the built-in variable $ACTOR. It stores the first direct object noun phrase number in the variable $DOBJECT. It stores the number of direct objects In the variable $NDOBJECTS. It stores the Indirect object noun phrase number In the variable $IOBJECT. If any of the noun phrases Is missing from the command, the corresponding variable is set to NIL. The parser saves the verb phrase and preposition to use when determining which action to use to handle the command.

continued

BYTE LISTINGS SUPPLEMENT • APRIL-JUNE, 1987 119

May

Action definition statement:

Actions are used to handle player commands. Each time the parser finishes parsing a new command, it uses the verb phrase and the preposition to locate an action to handle the command. Each action specifies a kind of template that must match the command in order for the action to be called. The template consists of the words used in the verb phrase and preposition and the existance of the actor, direct object and Indirect object noun phrases. Once the parser finds an action that matches the command, it stores the action In the built-in variable $ACTION and exits.

(ACTION action-name astat*) astat:

(ACTOR [flag])

(VERB verb*)

(DIRECT-OBJECT [flag])

(PREPOSITION word*)

(INDIRECT-OBJECT [flag]) flag:

REQUIRED must have the corresponding np . OPTIONAL may have the corresponding np FORBIDDEN must not have the corresponding np

verb:

word

(word word)

Examp Ie:

(ACTION take

(VERB take (pick up))

(DIRECT-OBJECT)

(CODE

(print "You can’t take the ")

(print-noun $dobject)

(print "!\n")))

If the ACTOR. DIRECT-OBJECT or INDIRECT-OBJECT statements are left out entirely, the settings of the corresponding flags are taken from the action default definitions. If there is no action default definition, the value FORBIDDEN is assumed. If any of these statements is present, but no flag Is specified, it is treated as If the flag REQUIRED was spec!fled.

ADVSYS An Adventure Writing System Page 12

Action default definition statement:

This statement defines default values for the ACTOR, DIRECTOBJECT and INDIRECT-OBJECT flags.

(DEFAULT dstat*) dstat:

(ACTOR [flag])

(DIRECT-OBJECT [flag])

(INDIRECT-OBJECT [flag]) flag:

REQUIRED

OPTIONAL

FORBIDDEN

Examp Ie:

(DEFAULT

(ACTOR OPTIONAL))

120

BYTE LISTINGS SUPPLEMENT • APRIL-JUNE. 1987

ADVSYS

May

An Adventure Writing System Page 13

Object definition statements:

The object definition statements are used to define Individual objects and classes of objects. The most basic way of defining an object is using the (OBJECT ...) statement. This defines an object which has no parent class.

It is also possible to create a class of objects that share Information. A class is defined Just like a normal object.

It 18 given nouns, adjectives and properties. In addition, a class may have class properties. These are properties that are shared amongst all instances of the class. In

order to create an instance of a class, the (class-name )

form i8 used. This creates an instance of the named class.

An instance will inherit all nouns and adjectives from Its parent class. It will also inherit all class properties defined in the parent (and Its parents). Any normal properties defined In the parent class will be copied to the new object. The copies will have the same values that the parent has, but it Is possible for the Instance to have property definitions that override these values. Instances may also have additional nouns, adjectives and properties.

(OBJECT object-name ostat*)

(class-name object-name ostat*) ostat:

(NOUN word*)

(ADJECTIVE word*) (PROPERTY [property-name value]*)

(CLASS-PROPERTY [property-name value]*)

(METHOD (selector [arg-name]* [&aux tmp-name*]) expr*)

class-name:

the name of a previously defined object

Examp I as:

(OBJECT sword

S NOUN sword weapon) CLASS-PROPERTY 1s-weapon T) (PROPERTY weight 10 value 5 damage 20))

(sword red-sword (ADJECTIVE red) (PROPERTY damage 25))

continued

BYTE LISTINGS SUPPLEMENT • APRIL-JUNE. 1987 121

May

Expressions:

(+ expr expr] (- expr expr] (* expr expr' (/ expr expr] (% expr expr]

(k expr expr} f | expr expr) ( expr)

add

subtract

multiply

divide

remainder

bit-wise and bit-wise or bit-wise complement

These arithmetic functions operate on integers. As it turns out, every data type in the system is represented by an integer, so these functions will work with any type of arguments. They are probably only useful with integers, however.

(RANDOMIZE) reset the random number generator

(RAND expr) generate a random number

These functions enable the generation of pseudo-random numbers. The (RAND n) function takes a single argument and generates a random number between zero and n-1. (RANDOMIZE) resets the seed used by the random number function so that each invocation of a program results in a new sequence of random numbers.

(AND expr*) logical and (short circuits)

(OR expr*) logical or (short circuits)

(NOT expr)

logical not

These functions operate on logical values. In this system, any value that is not equal to NIL (or zero) is considered true. NIL and zero are considered false. AND and OR evaluate their arguments from left to right and stop as soon as the value of the entire expression can be determined. In other words, AND stops when it encounters a false value, OR stops when it encounters a true value.

(< expr expr] (=» expr expr! (> expr expr]

less than equal to greater than

These functions compare integers. They cannot be used to compare strings.

122 BYTE LISTINGS SUPPLEMENT • APRIL-JUNE. 1987

ADVSYS

An Adventure Writing System

May

Page 15

(GETP obj property-name) get the value of a property

(SETP obj property-name value) set the value of a property

These functions manipulate object properties. They are used to find the value of a property or to set the value of a property. They will also find and set the values of Inherited properties. If GETP Is used to find the value of a property that doesn't exist for the specified object* NIL Is returned. If SETP Is used to set the value of a property that doesn't exist* the operation Is Ignored.

(CLASS obj)

This function returns the class of an object. If the object was defined with an (OBJECT ...) statement, NIL will be returned. If the object was defined with the (class-name ...) statement* the class object will be returned.

(MATCH obj noun-phrase-number)

Th18 function matches an object with a noun phrase. An object matches a noun phrase If it includes all of the adjectives specified In the noun phrase and also Includes the noun mentioned. Both nouns and adjectives can be inherlted.

(YES-OR-NO) get a yes or no answer from the player

This function waits for the player to type a line. If the line begins with a 'Y' or a 'y', the function returns T. If the line begins with anything else* the function returns NIL.

(PRINT expr) print a string

(PRINT-NUMBER expr) print a number

(PRINT-NOUN noun-phrase-number) print a noun phrase

(TERPRI) terminate the print line

These functions perform various sorts of output. PRINT prints strings* PRINT-NUMBER prints numbers and PRINT-NOUN prints a noun phrase.

(FINISH)

(CHAIN)

(ABORT)

(RESTART)

(EXIT)

exit and continue with the AFTER handler exit and continue with the next handler exit and continue with the UPDATE handler exit and restart the current game exit to the operating system

These functions cause the immediate termination of the current handler. FINISH causes execution to proceed with the AFTER handler* CHAIN causes execution to proceed with the next handler In the normal sequence, ABORT causes execution to proceed with the UPDATE handler (effectively aborting the current turn), RESTART restores the game to Its

continued

BYTE LISTINGS SUPPLEMENT • APRIL-JUNE, 1987 123

May

ADVSYS

An Adventure Writing System

Page 16

original state and starts over with the INIT handler and EXIT causes an Immediate exit back to the operating system.

(SAVE) save the current game position

(RESTORE) restore a saved game position

These functions allow the player to save and restore positions in the game. They prompt the player for a file name and either read a saved game position from the file or write the current game position to the fils.

(function-name expr*)

This expression Invokes a user defined function. There should be one expression for each of the formal arguments of the user function. The value of the expression is the value of the Iast expression in the body of the user function or the value passed to a RETURN statement within the function.

(SEND object selector [expr]*)

This expression sends a message to an object. The “object M expression should evaluate to an object. The selector should match a method selector for that object or one of its super-classes. The matching method Is invoked with the specified expressions as arguments. Also, the Implied argument SELF will refer to the object receiving the message.

(SEND-SUPER selector [expr]*)

This expression sends a message to the super-class of the current object. It can only be used within a method and it will cause the message to be passed up the class heirarchy to the super-class of the object refered to by SELF.

(SETQ variable value)

This expression sets the value of a user variable.

(COND [(test expr*)l*)

(IF test then-expr [else-expr]) (WHILE test expr*)

(PROGN expr*)

(RETURN [expr])

execute conditionally traditional If-then-else conditional iteration block construct return from a function

These statements are control constructs.

124

BYTE LISTINGS SUPPLEMENT • APRIL-JUNE, 1987

ADVSYS

May

An Adventure Writing System Page 17

Primary expressions:

Integer

strIng

action-name

ob Ject-name

property-name

constant-name

variable-name

I d! 9118 proceeded by an optional sign) characters enclosed In double quotes) an action name) an object or class name) a property name) a defined constant or function) a variable name)

Since an adventure description contains a large quantity of running text, the format for specifying string constants Is somewhat extended from normal programming languages. In this system, a string Is enclosed In double quotes. If the end of line occurs before the closing quote within a string, It Is treated as If It were a space. Any number of consecutive spaces Is collapsed Into a single space. Also, the character pair M \n M Is used to represent the "end of line" character, the pair "\t" Is used to represent the tab character and the pair "\\" Is used to represent the backslash character.

Examp Ies:

"This Is a string.\n"

"This

Is

a

strIng.\n"

Both of the examples above represent the same string.

ADVSYS An Adventure Writing System Page 18

Definitions of symbols used above:

expr

value

test

then-expr eIse-expr obj

property-name noun-phrase-number varlab Ie T

NIL

an expression an expression

an expression (NIL means false, anything else Is true) an expression an expression

an expression that evaluates to an object

an expression that evaluates to a property name

an expression that evaluates to a noun phrase number

a variable name

true

fa I se

Built-in variables set by the parser:

$ACTOR

$ACTION

$DOBJECT

$NDOBJECTS

$IOBJECT

factor noun phrase number)

(action)

(first direct object noun phrase number) fnumber of direct object noun phrases) (Indirect object noun phrase number)

Other built-in variables:

$OCOUNT (total number of objects In the system)

CURRENT COMPILER LIMITS

500

words

500

objects

20

properties per object

200

actions or functions

16384

bytes of code

16384

bytes of data

262144

bytes of text

continued

BYTE LISTINGS SUPPLEMENT • APRIL-JUNE. 1987 125

OSAMPLE.ADV Contributed by: David Betz

TEXT “An Adventure Authoring System." David Betz, May 1987, page 125.

; OSAMPLE.ADV

; This is a VERY simple sample adventure that uses the "OBJECTS.ADI"

; runtime support code. It isn't interesting to play, but does illustrate ; most of the features of the adventure authoring system. Try compiling ; it using the command:

| A>ADVCOM OSAMPLE

; When the compile has finished, run the adventure using the command:

| A>ADVINT OSAMPLE

; You should then see the initial welcome message and a description of ; your initial location. You can use the direction names to move from ; one location to the next (or the abreviatlons N,S,E,W). You should try ; manipulating objects using TAKE and DROP. You can manipulate more than ; one at a time by using the conjunction AND. You can also GIVE an object ; to another creature like the DOG or CAT. You can Instruct another ; creature to perform an action like:

! CAT. GIVE THE DOG THE KEY

; You can also experiment with using adjectives to distinguish between ; objects (there is more than one KEY in this adventure).

(adventure sample 1)

(define welcome "Welcome to the sample adventure.\n")

©objects.adl

(actor adventurer (noun me)

(property

initial-location IIvingroom))

(actor dog (noun dog)

(adjective smaI I)

(property

description "There is a small dog here." short-description "a small dog"

Initial-location kitchen))

(actor cat (noun cat)

(property

description "There is a cat here." short-description "a cat" initial-location kitchen))

(location storage-room (property

description "You are in a small storage room with many empty shelves.

The only exit is a door to the west." short-description "You are In the storage room." west hallway) (method (leave obj dir)

(if (send obj carrying? rusty-key)

(send-super leave obj dir)

(print "You seem to be missing something!\n"))))

( locatIon ha I I way (property

description "You are In a long narrow hallway. There is a door to the

east into a small dark room. There are also exits on both the north and south ends of the hall." short-description "You are In the hallway."

126 BYTE LISTINGS SUPPLEMENT • APRIL JUNE, 1987

May

east storage-room north kitchen south IIvlngroom))

(location kitchen (property

description "This Is a rather dusty kitchen. There Is a hallway to the south and a pantry to the west." short-description "You are in the kitchen." south ha I Iway west pantry))

(location pantry (property

description "This is the kitchen pantry. The kitchen is through a doorway to the east."

short-description "You are in the pantry." east kitchen))

(location IIvlngroom (property

description "This appears to be the Iivlngroom. There is a hallway to the north and a closet to the west." short-description "You are in the livingroom." north ha IIway west closet south front-door-1))

(location out8ide (property

description "You are outside a small house. The front door is to the north."

short-description "You are outside." north front-door-2))

(portal front-door (noun door)

(adjective front)

(cl ass-property

short-descrIption "front door"

closed t

locked t

key rusty-key))

(front-door front-door-1 (property

In111 a I-1ocatIon livingroom other-side front-door-2))

(front-door front-door-2 (property

I n11ia I-1ocatIon outside other-side front-door-1))

(location closet (property

description "This Is the livingroom closet. The livingroom is through a doorway to the east." short-description "You are In the closet." east livingroom))

(thing rustv-key (noun key)

(adjective rusty)

(property

description "There is a rusty key here." short-descriptIon "a rusty key" in111a I-1ocation storage-room))

(thing si Iver-key (noun key)

(adjective small silver)

(property

description "There is a small silver key here." short-descriptIon "a small silver key"

Initial-location closet))

continued

BYTE LISTINGS SUPPLEMENT • APRIL-JUNE, 1987 127

OBJECTS.ADI Contributed by: Dovid Betz

TEXT "An Adventure Authoring System." Dovid Betz, May 1987, page 125.

; This is the object-oriented runtime package ; by David Betz ; July 19. 1986

Table caption• ******************** ; PROPERTY DEFINITIONS ; ********************

; These properties will

be U8<

(property

north

; the

south

; the

east

; the

up

; the

down)

; the

for connections between locations

Table captionlocation tocatIon location location location

to the to the to the above below

north

south

east

W081

; Basic object properties (property

initial-location ; the description ; the short-description) ; the

initial location of a "thing" "long" description of a location "short" description of a location

; Connection properties (property parent sibling child)

; the parent of an object ; the next sibling of an object ; the first child of an object

; Location properties (property visited)

true If location has been visited by player

; Portal properties (property closed locked key

other-side)

true If the portal is closed true If the portal is locked key to unlock the portal the other portal In a pair

; ********************** ; VOCABULARY DEFINITIONS

; **********************

; Some abbreviations for common commands

i synonym north n} synonym south s) synonym east e) synonym west w; synonym Inventory 1)

; Define the basic vocabulary

! conjunction and) article the that)

Table caption******************** VARIABLE DEFINITIONS ********************

(varlab 1e

curloc

; the

%actor

; the

%dob Ject

; the

%iobJect)

; the

Table captionlocation of the player character actor object direct object Indirect object

• *********************

; CONNECTION PRIMITIVES • *********************

; Connect an object to a parent (define (connect p c)

the location to the west

128 BYTE LISTINGS SUPPLEMENT • APRIL-JUNE. 1987

(setp c parent p)

(setp c sibling (getp p child)) (setp p child c))

; Connect all objects to their initial parents (define (connect-all &oux obj maxpl par)

(setq obj 1 )

(setq maxpl (+ $ocount 1 ))

(while (< obj maxpl)

(if (setq par (getp obj Initial-location))

(connect par obj))

(setq obj (+ obj 1 ))))

; Disconnect an object from its current parent (define (disconnect obj &aux this prev) fsetq this (getp (getp obj parent) child))

(setq prev nil)

(while this

(if (» this obj)

(progn (If prev

(setp prev sibling (getp this sibling))

(setp (getp this parent) child (getp this sibling))) (setp this parent nil)

(return)))

(setq prev this)

(setq this (getp this sibling))))

; Print the contents of an object (used by "look") (define (print-contents obj prop &aux desc)

(setq obj (getp obj child))

(wh11e obj

(If (setq desc (getp obj prop))

(progn

(print " M )

(print desc)))

(setq obj (getp obj sibling))))

» List the contents of an object (used for "inventory") (define (list-contents obj prop &aux desc)

(setq obj (getp obj child))

(while obj

(if (setq desc (getp obj prop))

(progn

(print "\t")

(print desc)

(tsrprI)))

(s«tq obj (getp obj sibling))))

; ************************

; OBJECT CLASS DEFINITIONS ; ************************

; * * **** >f * * * ** * * * * * * * * * * *

; The "basic-thing" class ; ***********************

(object basic-thing (property

parent nil ; the parent of this object

sibling nil)) ; the next sibling of this object

; *************************** ; The "location" object class ; ***************************

(object location (property

child nil ; the first object In this location

visited nil) ; has the player been here yet?

(method (knock? obj)

(method (enter obj)

(connect self obj)

T)

continued

BYTE LISTINGS SUPPLEMENT • APRIL-JUNE, 1987 129

(method (leove obj dir &aux loc)

.iO)

(if (setq loc (getp self dii (If (send loc knock? obj)

(progn

(disconnect obj)

(send loc enter obj)))

(progn

(print “There Is no exit In that directIon.\n“) nil)))

(method (describe)

(if (getp self visited)

(print (getp self short-description))

(progn

(print (getp self description))

(print-contents self description)

(setp self visited t)))

(terprl)))

******************

The “portal" class

(baslc-thing portal (method (knock? obj)

(if (getp self closed)

(progn

(print “The “)

(print (getp self short-description))

(print “ is closed!\n“) nil)

T)) (method (enter obj)

(connect (getp (getp self other-side) parent) obj)) (method (open)

(If (not (getp self closed))

(progn

(print “The “)

(print (getp self short-description))

(print “ is already openl\n“) nil)

(If (getp self locked)

(progn

(print “The “)

(print (getp self short-description))

(print “ is locked!\n“) nil)

(progn

(setp self closed nil)

T»» %

(method (close)

(if (getp self closed)

(progn

(print “The “)

(print (getp self short-description))

(print “ is already closedl\n“) nil)

(progn

(setp self closed T)

T)))

(method (lock thekey)

(if (not (getp self closed))

(progn

(print “The “)

(print (getp self short-description))

(print “ Is not closed!\n“) nil)

(If (getp self locked)

(progn

(print “The “)

(print (getp self short-description))

(print “ is already lockedI\n“) nil)

(If (not (- thekey (getp self key)))

(progn

(print "It doesn’t fit the lock!\n“) nil)

(progn

130 BYTE LISTINGS SUPPLEMENT • APRIL-JUNE, 1987

(setp s©If locked t)

, , T)))))

(method (unlock thekey)

(If (not (getp self closed))

(progn

(print “The “)

(print (getp self short-descrIpt ion)) (print Is already openi\n“) nil) (If (not (getp self locked))

(progn

(print "The ”)

(print (getp self short-description)) (print " Is not locked!\n") nil)

(If (not (■ thekey (getp self key))) (progn

(print “It doesn't fit the lock!\n“) nil)

(progn

(set^self locked nil)

; *****************

; The “actor" class ; *****************

(baslc-thing actor (property

child nil) ; the first "thing" carried by this actor

(method (move dir)

(send (getp self parent) leave self dir))

(method (take obj}

(disconnect obj;

(connect self obj))

(method (drop obj}

! disconnect obj;

connect (getp self parent) obj))

(method (carrying? obi)

(- (getp obj parent ) self))

(method (Inventory)

(cond ((getp %actor child)

(print “You are carrying:\n“)

(list-contents %actor short-descrIptIon))

(T (print “You are empty-handed.\n")))))

; *****************

; The "thing" class (things that can be taken) ; *****************

(basic-thlng thing (class-property takeable t))

; ****************************

; The "statlonary-thing" close (things that can't be moved) ; ****************************

(basic-thlng statlonary-thIng)

; ***********************

; MISCELLANEOUS FUNCTIONS ; ***********************

; Complain about a noun phrase (define (complain head n tall)

(print head)

(print-noun n)

(print tall)

(abort))

; Find an object In a location

(define (findobject loc n &aux this found)

(setq this (getp loc child))

(setq found nil)

(whlle this

(If (match this n)

continued

BYTE LISTINGS SUPPLEMENT • APRIL-JUNE, 1987 131

(If found

S comp lain "I don't know which " n " you mean!\n") setq found this)))

(setq this (getp this sibling))) found)

; Find an object in the player's current location ; (or in the player's inventory)

(define (in-location n *aux obj)

(if (or (setq obj (flndobject curloc n))

(setq obj (flndobject Xactor n))) obj

(complain "I don't see a M n " herel\n")))

; Find an object in the player's Inventory ; (or in the player's current location)

(define (in-pocket n &aux obj)

(If (or (setq obj (flndobject Xactor n))

(setq obj (flndobject curloc n)))

obj

(complain *'You don't have a M n H l\n")))

*************** ACTION DEFAULTS ***************

(default

(actor optional))

****************** ACTION DEFINITIONS

(action look

!! verb look) code

setp curloc visited nil) send curloc describe)))

(action a-take

! (verb take get (pick up))

(direct-object) (code

setq Xdobject (In-location $dobject)) if (getp Xdobject takeable)

(progn

(if (send Xactor carrying? Xdobject)

(complain "You are already carrying the " $dobject "!\n")) (send Xactor take Xdobject)

(print-noun $dobject)

(print " taken.\n"))

(complain "You can’t take the " $dobject "!\n"))))

(action take-err

( verb take get (pick up)) code

(print "Take what?\n")))

(action a-drop

(verb drop (put down))

(direct-object)

(code

(seta Xdobject (in-pocket $dobJect))

(If (send Xactor carrying? Xdobject)

(progn

(send Xactor drop Xdobject)

(print-noun $dobject)

(print " dropped.\n"))

(complain "You aren't carrying the

$dobject "I\n"))))

(action drop-err

! verb drop (put down)) code

(print "Drop what?\n")))

(action give (verb give)

132 BYTE LISTINGS SUPPLEMENT • APRIL-JUNE, 1987

(direct-object)

(preposition to)

(Indirect-object)

(code

Csetq %dobJect (In-pocket $dobject))

(setq Xlobject (in-locatlon $IobJect))

(If (send %actor carrying? Xdobject)

(progn

(send Xactor drop Xdobject)

(send Xlobject take Xdobject)

(print-noun $dobject)

(print M given.\n"))

(complain "You aren't carrying the M $dobJect M 1\n M ))))

(action glve-err (verb give)

(direct-object optional)

(code

(If $dobJect

(complain "Give the " $dobJect " to whom?\n"))

(print "Give what?\n"))) n

(action a-lnventory (verb Inventory)

(code

(send Xactor Inventory)))

; *************** ; PORTAL COMMANDS ; ***************

(action a-open (verb open)

(direct-object)

(code

(setq Xdobject (In-locatlon $dobJect)) (send Xdobject open)))

(action open-err (verb open)

(code

(print "Open whot?\n")))

(action a-close (verb close)

(dlrect-ob Ject) (code

(setq Xdobject (In-locatlon $dobject)) (send Xdobject close)))

(action close-err (verb close)

(code

(print "Close what?\n")))

(action a-lock (verb lock)

(direct-object)

(preposition with)

(Indirect-object)

(code

(setq Xdobject (In-locatlon $dobJect))

(setq Xlobject (in-pocket $!object))

(send Xdobject lock Xlobject)))

(action lock-err (verb lock)

(direct-object optional)

(code

(If $dobject

(complain "Lock the " $dobJect " with what?\n")) (print "Lock whot?\n")))

1

continued

BYTE LISTINGS SUPPLEMENT • APRIL-JUNE, 1987 133

May

(action a-unlock

(verb unlock) (direct-object) (preposition with)

(indlrect-object)

(code

(setq Xdobject (setq %iobJect (send %dobject unlock Xlobject)))

(In-location $dobject)) (in-pocket $iobiect))

(action unlock-err (verb unlock)

(direct-object optional)

(code

(If $dobject

(complain "Unlock the " $dobject (print "Unlock what?\n")))

with what?\n"))

; *********************

; GAME CONTROL COMMANDS ; *********************

(action save

! verb save) code

(sav*)))

(action restore

! verb restore) code

(restore)))

(action restart

! verb restart) code

(restart)))

(action quit

S verb quit) code

(print "Are you sure you want to quit? ") (If (yes-or-no)

(exit))))

; **************

; TRAVEL ACTIONS ; **************

(action go-north

! verb north (go north)) code

(send %actor move north)))

(action go-south

! verb south (go south)) code

(send %actor move south))) (action go-east

! verb east (go east)) code

(send %actor move east)))

(action go-west

i verb west (go west)) code

(send %actor move west)))

(action go-up

(verb up (go up))

(code

(send %actor move up)))

(action go-down

S verb down (go down)) code

(send %actor move down)))

134 BYTE LISTINGS SUPPLEMENT • APRIL-JUNE, 1987

; ******************* ; HANDLER DEFINITIONS ; *******************

May

(Inlt

(connect-alI)

(print welcome)

(setq curloc nil))

(update

(if (not (- (getp adventurer parent) curloc)) (progn

(s®tq curloc (getp adventurer parent)) (send curloc describe))))

(before

(sstq factor adventurer)

(if $actor (progn

(seta %actor (in-locatlon $actor))

(if (not (- (class Xqctor) actor))

(complain M You can't talk to a " $actor M I\n M )))))

LISTINGS.DOC Contributed by: Chris Crawford and Eva White TEXT The four benchmarks that run on Macintosh SCSI external hard disks as reviewed by Chris Crawford and Eva White, May 1987, page 237.

Listings for the four benchmarks run on Macintosh SCSI external hardisks review by Chris Crawford and Eva White.

10 REM LIneFileWrite

100 A$-■12345678123456781234567812345678 M 120 B$-A$+A$+A$+A$+A$+A$+A$+A$+A$+A$+A$+A$+A$+A$+A$+A$

160 OPEN "TEST" FOR OUTPUT AS #1 170 START-TIMER 180 FOR 1-1 TO 1024 200 PRINT #1, 8$

220 NEXT I 230 CLOSE

250 PRINT TIMER-START 260 PRINT "DONE"

300 REM LineFileRead

320 OPEN"TEST" FOR INPUT AS #1

330 START-TIMER

340 FOR 1-1 TO 1024

360 B$«INPUT$(512,1)

380 NEXT I 400 CLOSE

410 PRINT TIMER-START 420 PRINT "DONE"

10 REM FragFileWrlte

100 A$-"12345678123456781234567812345678•

110 B$-A$+A$+A$+A$+A$+A$+A$+A$+A$+A$+A$+A$+A$+A$+A$+A$

170 START-TIMER 175 FOR J-1 TO 64 180 FOR 1-1 TO 16 185 C$-"TEST"+STR$(I)

190 OPEN C$ FOR APPEND AS #1 200 PRINT #1, B$

210 CLOSE #1 220 NEXT I 230 NEXT J

250 PRINT TIMER-START 260 PRINT "DONE"

300 REM FragFileRead 330 START-TIMER

continued

BYTE LISTINGS SUPPLEMENT • APRIL-JUNE, 1987 135

335 FOR 1-1 TO 16 340 C$«“TEST“+STR$(I)

350 OPEN C$ FOR INPUT AS #1 360 B$«INPUT$(32767,1)

385 CLOSE #1

390 NEXT 1410 PRINT TIMER-START 420 PRINT "DONE"

PULLDOWN.C Contributed by: James L. Pinson

TEXT “Pull-Down Menus In C," by James L. Pinson. May 1987, page 109.

/* COPYRIGHT (C) 1986 */ /* BY JAMES L PINSON */ /* ALL RIGHTS RESERVED */

/* Compiled with Lattice C V2.14 */ /* Computer: IBM PC JR */ /* Text editor: Sidekick */ /* Last revision 3/16/1987 */

0 Include “stdio.h" finclude "ctype.h"

fdefine void int

fdefine BLACK 0 fdefine BLUE 1 fdefine GREEN 2 fdefine CYAN 3 fdefine RED 4 fdefine MAGENTA 5 fdefine BROWN 6 fdefine WHITE 7 fdefine L_BLUE 9 fdefine L_GREEN 10 fdefine YELLOW 14 fdefine IWHITE 15

/* THESE ARE FOR COLOR CARDS */

/* LIGHT-BLUE FOREGROUND ONLY */

/* LIGHT-GREEN FOREGROUND ONLY */

/* INTENSE-WHITE FOREGROUND ONLY*/

fdefine UNDERLINE 1 /* THESE ARE FOR MONOCHROME CARDS */

fdefine NORMAL 7 fdefine HI_INTEN 15 fdefine REVERSE 112

fdefine TRUE 1 fdefine FALSE 0

unsigned Int page; /* extern decl. for functions*/

unsigned int attribute; unsigned Int mon_type; char wrt_meth- ’f';

fdefine NU_MAIN 5 /* number of main menu options */

fdefine NU_SUB 5 /* number of sub menu options */

struct menu_str{ /* change this if you need more options */

char *heod; char *body[NU_SUB]; void f*funlH): void f*fun2)Q; void (*fun3)();

136

BYTE LISTINGS SUPPLEMENT • APRIL-JUNE, 1987

void f*fun4)H; void (*fun5;();

main(argc,argv)

Int argc; char **argv;

extern unsigned Int page; extern unsigned Int attribute; extern unsigned Int monotype;

char ch,ext;

Int I,hl_attr,nor_ attr;

int demoQ; int he I pQ;

static struct menu_str m_menu [NU_MAIN]*{

ii

ii

H

ii

ii

•i

File ", /*

Oir

Load ",

Save M ,

dElete Path

demo,

demo,

demo,

demo,

demo,

fINd

"All-words ", " First-word ",

"\e".

M \0".

**\0" i

The first menu option */

/* Menu sub options */

/* The functions each sub-option call */

/* these all call the same fake function */

/* The second menu option */

/* space filler for unused option names */

demo, demo,

0 » /* unused function pointer */

0 .

0 .

Configure ", /* The third option */

" Modem ",

" Screen ",

" Printer ",

M \0".

"\ 0 \

demo, demo, demo,

0 .

0 .

Output ", /* The fourth menu option */

" Screen ",

" Printer ",

" Disk " Modem M \0\

demo, demo, demo, demo,

0 .

" Help ",

" Instant help (really works) "\ 0 \

M \0 M *

M \0\

/♦ The fifth option */

ii

continued

BYTE LISTINGS SUPPLEMENT • APRIL-JUNE, 1987 137

May

h«lp.

0 .

0 .

0 .

0 .

/• was a slow writs rsqusstsd? */

., i_ t _ r 11\_u/rt

If (tolowsr (*orgv[1])~ ‘s') wrt_msth - 'S';

pags-O;

mon_typs ■(whot_mon());

If (mon_typ«-- 1 )|

•/ . . ,

/* FIND OUT IF YOU HAVE A COLOR CARD

hl.attr- s«t_color(BLACK.CYAN); /* AND SET ATTRIBUTES ACCORDINGLY */

nor_attr« sst_color(WHITE,BLACK);

else}

hl.ottr - REVERSE; nor_attr - NORMAL; \

attribute - nor_attr;

cursor(0); /* hide cursor */

win_save(*8*);

clt();

If (mon_type—1) make_help();

make.!net(); /* SHOW INSTRUCTIONS */

menu(m_menu,NU_MAIN,NU_SUB,hl_attr,nor_attr);

win_save(’r # ); /* restore text display*/

cursor(1); /* restore cursor */

Int menu (m_raenu,nu_maln,nu_sub,hi_attr,nor_attr) struct menu_str m_menu[];

Int nu_jnaln,nu_sub,hl_attr, nor_attr;

extern unsigned Int page; extern unsigned Int attribute; extern unsigned Int monotype;

Int I,J.k,cur_x,cur_y,cur_opt,found,expert-1; char ch, ext, Itr;

ch* * •;ext» # *; cur_opt« 0 ; found - 0 ;

If (monotype--1) attribute - set_color(YELLOW,BLACK); else attribute - nor_attr;

make_wlndow(1,1,78,1,1);

for(;;){ /* endless loop */

for( 1 - 0 ; l<nu_maln; !+♦){

If ( ch—Itr kk ch I- * found- TRUE; cur_opt - I;

If (ch—13)J found - TRUE; expert • FALSE;

\

138 BYTE LISTINGS SUPPLEMENT • APRIL-JUNE, 1987

to

ch*» *

cur_x=2;cur_y-2;

May

for(i-0;i< nu_main;I ++)\

lf(i -- cur_opt) attribute^ hl_attr; else attribute® nor__attr; pr int(cur_x,cur_y,m_menu[I].head);

cur_x- cur_x+strIen(m_menu[i].head)+3;

if (iexpert) found = TRUE;

If (found)J

ext -(puIl_down(m_menu,nu_sub,cur_opt)); /* pull-down options */

If (ext -s 27) expert * TRUE;

if (ext == *r* || ext -- *l # ) expert = FALSE;

If (ext--'r*) cur_opt = cur_opt+1; if (ext --’I*) cur_opt - cur_opt -1; ch- • •; ext- ’ *;

t

If(!found){ ch-' •;

get_key(&ch,&ext); ch-toupper(ch);

\

if (chs»27) return;

If (ext »»'r* l| ext -- *r) expert - 0; If (ext — * r’) cur_opt - cur_opt +1; if (ext ““ •l # ) cur_opt - cur_opt -1; if (cur_opt >- nu_main) cur_opt *0;

If (cur_opt < 0) cur_opt - nu_main-1;

ext« # •;

found*0;

| /* end for(;;) */

\ /* end function */

int pull_down(m_jnenu,nu_8ub,position) struct menu_str m_menu[];

Int position;

j

extern unsigned Int page;extern unsigned int attribute;

char ch-’ *, I tr ;

int ext-’ **hl_attr,nor_attr;

Int i.j.tx.ty,start,width,nu_opt,cur_opt-0, found- FALSE; nu_opt - nu_sub;

/* nu_sub - number of possible pull-down options */

/* find out how many are In use */

for (1-0; l<nu_opt; !■*•+) J

If (m_menu[posItion],body[I][0] — *\0*)} nu_opt - I; break;

\

\

continued

BYTE LISTINGS SUPPLEMENT • APRIL-JUNE, 1987 139

If (mon_type-«1)J hi_attr- eet_coI or(BLACK.CYAN); nor_attr- set_color(WHITE.BLACK);

6 I 861

hl.attr - REVERSE; nor_attr - NORMAL;

\

attribute - nor_attr;

start-2; /* figure where to draw pull-down box */

/* 2 Is column to start 1st box */

/* add up length of menu heads */

for(l-0; l< position; i++) start- start+strIen(m_menu[1],head)+3;

wldth-0; /* figure max length of window */

for (i-0;l< nu_opt;!+♦){

If (strlen(m_menu[posItIon].body[I]) > width)) width- strIen(m_menu[position].body[I]);

/* move box to left if */

/* it will spill off right side */

If(start+wldth+1>80) start - 80-width-2;

win_save (*s*);

if (mon.type —1) attribute - set_color (YELLOW.BLACK); moke_window(start++,3.wldth.nu_opt.0); /*make a window */ attribute - nor_attr;

tx-start;ty-4;

/* reposition for writing */

f° r (;:){

for(l-0;l< nu_opt;!++){

If(I -- cur_opt) attribute

hi_attr;

else attribute- nor_attr;

print(tx,ty++.m_menu[position].body[I]);

attribute - nor_attr;

lf(found ) i

wln_save(*r*); /* remove box */

/* If you want more than 5 menu options */ /* change this next switch statement */

switch (cur_opt)| case 0: (*m_menu case 1: (*m_menu case 2: (*m_menu case 3: i*m_menu case 4: (*m_menu

/*

posItIon positIon position posItion posItIon

cal I function */ .fun1)Q ;break; .fun2nj ;break; .fun3)() ;break; .fun4Hj ;break; .fun5)() ;break;

i

/* found - FALSE; */

if (kbhlt()) getch(); /* make sure keyboard buffer is clear */ return^ ’);

I

tx-start;ty-4;

get_key(&ch.&ext); ch-toupper(ch); /* get a character */

if (ext — ’d*) cur_opt - cur_opt If (ext -- *u*) cur_opt - cur_opt -1;

If (cur_opt >- nu_opt) cur_opt -0;

If (cur_opt < 0) cur_opt - nu_opt-1;

140 BYTE LISTINGS SUPPLEMENT • APR1L-JUNE, 1987

If (ch~ 13) found - TRUE;

for(i-0;l<nu_opt;!++)} /* dooe It match an option? */

J-0;

whlle(ltr ■ m_monu[po8ItIon].body[I][J++])}

If ( ch~ltr){ cur_opt - I; found - TRUE;

If f«xt—* I'M sxt—*r*) break;

If (ch—27){ /* EXIT IF ESCAPE KEY */ ext - ch;

break;

I

ext-* *;ch-’ *;

} /* end for(;;)*/ wln_eave(*r’); return (ext);

void make_help()

extern unsigned Int page.ottrIbute; page-1;

prlnt(1,1,"HELLO - THIS IS A SAMPLE OF AN INSTANT HELP SCREEN."); prlnt(l0,5."THIS SCREEN WAS PRINTEO TO THE SECOND PAGE OF GRAPHICS"); prInt(10,7,"WHILE YOU WERE LOOKING AT THE MAIN MENU."); prInt(10,9,"THIS HELP SCREEN CAN BE LEFT UNDISTURBED"); print(l0,11,"AND REDISPLAYED AT ANY TIME.");

print (1,20,"PLEASE TOUCH ANY KEY TO RETURN TO THE MAIN MENU.");

page-0;

\

void make.Jn8t() extern unsigned Int attribute;

If (monotype—1)

attribute- eet_coI or(GREEN,BLACK);

else

attribute - NORMAL; print (1,4, “INSTRUCTIONS: 11 ) ;

print (1,6,"EXPERT MODE: Select by touching the key which represents each option.");

print (15,7,"(the capital letter)");

print (1,10, "ASSIST MODE: Pull-down menu by touching 'enter* or a cursor key.");

print (14,11,"SeIect by highlighting with cursor keys- then touch return"); print (14,13,"Return to Expert mode by touching 'escape'");

\

print (1,15,"EXIT:

void mono_help()

Touch 'Escape* while In expert mode.");

a 11 rIbu t e-NORMAL; wln_save('s');

BYTE LISTINGS SUPPLEMENT • APRIL-JUNE, 1987

141

clear_w!ndow(1,4,80,21);

prInt(1,7,"THIS IS A DEMONSTRATION OF A HELP SCREEN");

prInti 1,9,"THIS TEXT WAS WRITTEN BY MEANS OF DIRECT MEMORY ADDRESS");

prIntel,10,"THE ORIGINAL SCREEN HAS BEEN SAVED AND WILL BE RESTORED ");

prInt(1,11,"WHEN YOU EXIT THIS 'HELP' SCREEN");

print(1,14,"PLEASE TOUCH ANY KEY TO CONTINUE");

getchQ; wln_save(*r *);

Int demo()

Int hit; wln_save(*8*); make_wlndow(20,10,40,5,1);

pr I nt(21,11,"Put your favorite routine here "); print (21,14,"touch any key to return to menu"); getch(hlt);

win_save(*r•);

Int help()

If (mon_type««1)J page*1;

d_page(); 9 «tch(); page=0;d_page();

} else mono_help();

\

/♦ SCREEN-FUNCTION LIBRAY ♦/

/♦ DECLARE THE EXTERN VARIABLES ♦/ /♦ PAGE.ATTRIBUTE AND MONOTYPE ♦/ /♦ (MONITOR TYPE) ♦/ /* IN YOUR MAIN PROGRAM */

/♦IF COLOR CARD FLIP PAGE TO ♦/ /♦SHOW TEXT ELSE WRITE TO CURRENT^/ /♦ SCREEN^/

/♦♦♦ GOTOXY ♦♦♦/ void gotoxy(x.y) unsigned Int x,y;

i

extern unsigned Int page;

/♦ PUTS CURSOR AT X,Y POSITION ♦/ /♦ ON SELECTED PAGE ♦/ /♦ 1,1 IS UPPER LEFT CORNER ♦/

Table captionstruct { unsigned Int ax,bx,cx,dx,sI,dl,ds,es; j reglst;

If

( x<1 !

I x>80)

return;

If

(y<i 1

! y>25)

return;

X—

;y—:

/♦ DOS starts co-ordinates at 0,0 ♦/

reglst.ax * 0x0200;

reglst.dx - (y«8) | x ;

regist.bx - page«8; Apage number^/

Int86(0x10, &reg!st,&regtst);

/♦♦♦ WHEREXY ♦♦♦/ /♦ RETURNS THE X,Y POSITION OF CURSOR ♦/

Int wherexy(x,y)

Int ex.ey;

142 BYTK LISTINGS SUPPLEMENT • APRIL-JUNE, 1987

extern unsigned Int page;

struct \ unsigned Int ax,bx,cx,dx,sI,dI,ds,es; } reglst;

\

reglst.ax - 0x0300;

reglst.bx - page«8; /*page number*/

Int86(0x10, fcreglst,&reglst);

*x*( (reglst.dx k 0x00ff)+1 );

*y- ( ( (reglst.dx k 0xf f00)»8)+1);

/*** d_page ***/ void d_page()

/* DISPLAYS THE PAGE INDICATED /* BY EXTER VAR PAGE /* USE ONLY WITH COLOR CARD

extern unsigned Int page;

struct { unsigned Int ax,bx,cx,dx,sI,dI,ds,es; \ reglst; reglst.ax * (0x0500|page);

Int86(0x10, &reglst,«regtst);

/*** WIN_SAVE ***/ void wln_save(actIon)

Int action;

j

extern unsigned int page; extern unsigned Int mon_type;

Int position; static Int ptr;

static struct { int x;

Int y;

unsigned Int buffer [4000]; } window[2];

/* SAVES OR RESTORES PRIMARY */ /* DISPLAY SCREEN. */ /* (PAGE 0 FOR COLOR DISPLAY) */ /* ‘s’ - SAVE */ /* *r' - RESTORE */ /* SAVES CURSOR POSITION TOO */ /* MAY MAKE SNOW ON CGA */

If (mon.type—1) posItIon-0xb800; /* COLOR CARD */

else positlon«0xb000; /* MONOCHROME */

if (action—*8’) [ /* SAVE */

If (Ptr>1)| ptr-2; return(0);

/* peek Is a lattice function */

/* could use pointer In larger */

/* memory model */

peek(positlon.0x00,&wlndow[ptrl.buffer,4000); /* SAVE SCREEN

wherexy(&wlndow[ptr].x,&wlndow[ptr].y); /* SAVE CURSOR

ptr++;

*/

LOC */

If (action—*r*) { /* RESTORE */

I f(ptr <1)J ptr - 0; return(0);

\

ptr— ;

poke(posltlon.0x00,4wIndow[ptr].buffer,4000); /* RESTORE SCREEN */ gotoxy(wlndow[ptr].x, wlndow[ptr].y); /* RESTORE CURSOR */

continued

BYTE LISTINGS SUPPLEMENT • APRIL-JUNE, 1987 143

I

\

/*** SET_COLOR ***/ /* CALL WITH FORGROUND */

/* AND BACKGROUND COLOR.*/ Int 8et_coI or(foreground, bockground.) /* RETURNS ATTRIBUTE. */ Int foreground,background;

return(background«41 foreground);

\

/*♦* CLEAR.WINDOW *♦*/

void clear_window(x,y,width,height )

unsigned int x,y,width,height;

I

extern unsigned Int page; extern unsigned int attribute; struct { unsigned Int ax,bx,cx,dx,s x —; y—;

/* CALL WITH X,Y OF UPPER LEFT /* CORNER OF WINDOW AREA.

/* CLEARS DOWN AND TO RIGHT /* FOR WIDTH AND HEIGHT.

/* CLEARED WITH ACTIVE ATTRIBUTE /★ USE ON DISPLAYED PAGE ONLY!

,di,ds,es; { regist;

regist.ax - 0x0600;

reglst.cx - (y«8) | x ;

regist.dx «(y+heIght-1) «8 |x + width-1 ;

regist.bx -(at tr Ibute«8);

int86(0x10, ftreglst,&regist);

%

%

*/

/*** box ***/

void box (x.y,width,height,type) /* type 0 - pull-down box */

Int x.y,width,height,type; /* type 1 - regular box */

i

Int I,J,ctr,u_rlght,u_left; char string[82];

If(type—0)j /* following sets corners */

u_left - *\xc2’;

u_rlght - *\xc2*;

If (type — 1)J u_left - *\xda*; u_rIght - Axht';

8trlng[0]- u_left;

for(l«1;I<—wIdth;I++) strlng[I]-*\xc4*; strlng[l++]»u_rIght; string[I]-'\0’; prInt(x,y++,&8trIng[0]);

for (1-0; Ichelght;!++)J

prlnt(x,y,“\xb3");

^ prlnt(x+width+1,y++,"\xb3");

strIng[0]-’\xc0’;

for(1-1;i<-wldth;I++) strlng[I]-*\xc4*; strIng[l++]-’\xd9';strlng[IJ-’\0'; print(x,y++.4strlng[0]);

Int whot_mon() /* RETURNS A 1 IF COLOR CARD PRESENT */

j /* RETURNS A 0 IF MONOCHROME CARD */

char mode; /* CHAR DEFINES AN 8 BIT INTEGER */

144 BYTE LISTINGS SUPPLEMENT • APRIL-JUNE. 19*7

May

peek(0x0040,0x0049, imode. 1);

If (mode==7) return(0);

^ else return(l);

void cls() /* SAME AS DOS CLS */

cIear.wlndow(1,1,80,25); aotoxy(l.l);

void moke w!ndow(x,y,width.height,type) /* DRAWS AND CLEARS A BOX */ unsigned Int x.y,width,height,type;

I

box(x++,y++,width,height,type); /* DRAW BOX */

j cleor_wlndow(x.y,width,height); /* CLEAR INTERIOR */

int cur8or(slze) int size;

i

/* SETS CURSOR SIZE */

/* 0- no cursor. 1 - normal, 2- big cursor */

struct J Int ox.bx.cx.dx.sl,dl.ds.es; { reglst; regfst.ax* 0x0100;

If (mon_type 1 ){ /* COLOR */

If (size — 0) reglst.cx - 0x0f0f;

If (size — 1) reglst.cx ■ 0x0607;

If (size — 2) reglst.cx - 0x0107;

If (monotype — If (size «■ 1) if (size «• 2)

reglst.cx ■ 0x0c0d; reglst.cx - 0x010d;

/* MONOCHROME */

if (size

Int86(0x10,&reg1st,&regist);

l

0) reglst.cx- 0x0f0f;

/*** PRINT ***/

void print(x,y,str) unsigned int x,y; char *str;

I

extern char wrt_meth;

/* A SWITCHER- ROUTES TO FAST WRITE */ /* OR TO DOS.PRT DEPENDING ON ARGV */ /* PASSED TO PROGRAM AND SORED IN */ /* EXTERN CHAR WRJ4ETH */

If (wrt_meth *■ *f*) if (wrt_meth -- 'f•)

fast_wr1te(x,y,str

FAST (DIRECT POKING) */

if (wrt meth — ’s’) f /* SLOW (DOS METHOD) */ gotoxy(x.y); dos_prt(str);

/*** DOS_PRT ***/

void dos_prt(str)

char *str;

{

extern unsigned int unsigned int x,y; int c;

/* ASKS DOS TO WRITE A STRING WITH ATTRIBUTE */ /* DEFINED. AN ALTERNATIVE TO FAST WRITE IN */ /* THAT IT IS "WELL BEHAVED"(GOES THROUGH DOS) */ /* SPECIFY PAGE AND SET CURSOR POSITION BEFORE */ /* CALLING */ '

page.attribute;

continued

BYTE LISTINGS SUPPLEMENT • APRIL-JUNE, 1987 145

struct | unsigned Int ax,bx,cx,dx,si,di,ds,es; \ reglst; wherexy(&x,&y;;

while (*st r) } /* WHILE NOT EOF LET DOS WRITE CHAR */

If (x>80)j x-1; y-y+1;

If (y>25) break; gotoxy(x++,y);

reglst.bx - (page«81 at t r I bute);

reglst.cx - 1;

reglst.ax « 0x0900| *$tr++;

!nt86(0x10, fcregist, Scregist);

( gotoxy(x.y); /* put cursor at end of string */

/***fast_write***/

void fast_wrIte(x*y,strIng) int x,y; char *strlng;

\

extern unsigned int page; extern unsigned Int attribute; extern unsigned int monotype;

Int posit Ion,offset,orIg;

If (page <*3 && page >»0) offset « 4000*page+96*page; orig » offset;

offset-offset+((y-1)*160)+(2*(x-1)); position »0xb800;

/* DIRECTLY POKES STRING AT X.Y POSITION */ /* USES ATTRIBUTE AND PAGE. */ /* MAY CAUSE SNOW ON SOME GRAPHIC CARDS */

/* MONITOR TYPE */

if (monotype ««0) posItIon-0xb000; whI I e(*strIng)j

poke(posIt!on,offset,strIng++,1); /* POKE CHARACTER */ poke(posItion,offset+1,&attrIbute,1); /* POKE ATTRIBUTE */ offset-offset+2;

offset - offset- orig; /* FIGURE WHERE I AM */ x- ((offset% 160)/2)+1 ;y- offset/160+1 ; /* AND MOVE CURSOR */ gotoxy (x.y);

I

/*** get_key ***/

Int get_key(ch,ext) char *ch;

Int *ext;

{

*ch«getch();

if(!*ch)| *ext-getch();

/* READ A CHAR */ /* RETURN CHARACTER IN CH */ /* IF IT IS A FUNCTION KEY */ /* RETURN FOLLOWING IN EXT */ /* UP-ARROW - *U' */ /* DOWN-ARROW - 'D* */ /* RIGHT-ARROW = ’R* */ /* LEFT-ARROW - *L* */

8Witch

(*ext){

case

*H' :*ext

—' u *

break;

/*

up

*/

case

’P' :*ext

-*d*

break;

/*

down

*/

case

*M* :*ext

-* r *

break;

/*

right

*/

case

*K* :*ext

-* r

break;

/*

left

*/

case

*G' :*ext

-■h 1

break;

/*

home

*/

case

*0* :*ext

— * e *

break;

/*

end

*/

case

*R* :*ext

-•r

break;

/*

Insert

*/

case

*$• :*ext

-•D'

break;

/*

de1ete

*/

146 BYTE LISTINGS SUPPLEMENT • APRIL JUNE. 19*7

LIST1.PS Contributed by: Denis G. Pell!

BINARY “Putting Postscript to Work/* by Denis G. Pel I I, May 1987, page 185.

%1

X Produce Figure 1

/preSloan {gsave currentpolnt translate 0.2 0.2 scale newpath 0 0 moveto 0 5 llneto 5 5 lineto 5 0 Iineto closepath clip newpath

1 setlinewidth 2 setllnecap 0 setlinejoin} def /postSloan {stroke grestore 2 0 rmoveto} def /R {preSloan 0.5 0.5 moveto 0 4 rIIneto 3.5 3.5 1 90 270 arcn

-3 0 rIIneto 4.44370 0 moveto -0.97547 2 rIIneto postSloan} def

/V {preSloan 0 6.34629 moveto 2.5 -6.25 rIineto 2.5 6.25

r I Ineto postSloan} def

50 700 moveto

40 40 scale

R

V

showpage

LIST2.PS Contributed by: Denis G. Pel 11

BINARY "Putting Postscript to Work," by Denis G. Pel II, May 1987, page 185.

X!

% Produce Figure 2 X path of face

/face {39 210 moveto 108 210 lineto 155 181 lineto 167

146 lineto 155 117 lineto 155 89 lineto 145 55 lineto 134 27 lineto 116 8 lineto 78 7 lineto 46 10 lineto 23 30 lineto 7 71 lineto 4 110 lineto

-3 136 lineto 4 174 lineto 39 210 lineto 1 130 moveto

36 143 llneto 57 162 lineto 71 182 lineto 85 160 lineto

112 141 llneto 158 126 llneto 24 121 moveto 45 127

lineto 60 125 llneto 24 108 moveto 34 116 lineto 52 116

lineto 61 109 lineto 52 101 llneto 35 101 lineto 24 108

lineto 105 107 moveto 115 115 llneto 131 115 llneto 141

107 llneto 134 99 lineto 117 98 lineto 105 107 lineto

131 126 moveto 110 126 llneto 100 122 llneto 92 113

lineto 87 97 lineto 89 83 lineto 92 67 lineto 61 44

moveto 71 37 lineto 79 39 lineto 91 36 lineto 98 40

lineto 107 37 lineto 112 43 lineto 75 52 moveto 84 56

lineto 94 52 llneto 102 57 lineto} def

X Draw high-pass ribbon

/draw { gsave 0 setgray stroke grestore

gsave current Iinewidth 2 div setlinewidth 1 setgray stroke grestore newpath} def

X Set up screen, etc.

120 currentscreen 3 -1 roll pop setscreen X best at 0.69 setgray cllppath fill 0 setgray X best at

X30 currentscreen 3 -1 roll pop setscreen X best at X0.58 setgray clippath fill 0 setgray X best at

1 set Iinecap 10 set IInewidth 30 560 translate

2540/inch 2540/inch 300/inch 300/inch

X Ever smaller faces across page 9{

continued

BYTE LISTINGS SUPPLEMENT • APRIL-JUNE, 1987 147

May

face

draw

190 0 transI ate .707 .707 scale } repeat

showpage

LIST3.PS Contributed by: Denis G. Pel 11

BINARY "Putting Postscript to Work," by Denis G. Pel II, May 1987, page 185.

%!

X Produce Figure 4 /Inch {72 mul| def /width 4.54 Inch def 50 400 translate

width width scale X make square Image of desired width /prInterresoIution

72 0 matrix defauItmatrlx dtransform dup mul exch dup mul add sqrt def

/screen prInterresolutIon 16 div def

screen 127 gt {/screen 127 defj if

screen currentscreen 3 -1 roll pop setscreen

/n width screen mul 72 div 2 sqrt mul 0.99 add cvl def X number of cells across Image /nx n 2 mul def /ny n 2 Idiv def

/fbase 0.5 n mul 1.0 nx div exp def /fa 360 nx div fbase In div def /c 1 def

/cbase 0.003 1.0 ny div exp def /$ nx string def

nx ny 8 [nx 0 0 ny 0 0]

}/c c cbase mul def /f fa def

0 1 nx 1 sub{S exch f sin c mul 1.0 add 126.5 mul cvl put /f f fbase mul def|for SjImage

showpage

LIST4.PS Contributed by: Denis G. Pell!

BINARY "Putting Postscript to Work," by Denis G. Pel II, May 1987, page 185.

XI

X Produce Figure 5

50 750 moveto

/width 250 def

/size width 6 div def

/cuberoot2 2 1 3 div exp def

width 2 div size -1.5 mul rmoveto

/showrow

{gsave

FontDirectory /Sloan known

! /Sloan findfont size scalefont setfontj /Helvetica findfont size 1.8 mul scalefont setfont| I false

dup 8tringwldth pop -2 div 0 rmoveto show

148 BYTE LISTINGS SUPPLEMENT • APRIL-JUNE, 1987

grestore

/size size cuberoot2 div def

0 size -2 mu I rmoveto } def

(2 C H) showrow (0 S H} showrow (H K N) showrow (0 2 S) showrow (D H Cj showrow (C N 0) showrow (K D Vj showrow CS H Oj showrow (D R H; showrow (K N Z) showrow (R H Kj showrow (C H 0) showrow (N K S j showrow (C Z R) showrow (S 0 lO showrow (0 N C; showrow (C H 0) showrow (R 0 H) showrow (S N D) showrow (0 C Hj showrow CZ H K) showrow (C V H) showrow (V N Z) showrow (S C K) showrow (N D C) showrow (C N D) showrow CO V N) showrow (Z H V) showrow (H S K) showrow CD N Oi showrow (N S Kj showrow CD C Z) showrow (V H K) showrow (S K V) showrow

R Kj showrow (V R Sj showrow (K Z N; showrow

showpage

LIST5.PS Contributed by: Denis G. Pelli

BINARY "Putting Postscript to Work." by Oonis G. Pslll, May 1987. pogs 185.

XI

% Produce Figure 6

50 750 moveto

/width 250 def

/size width 6 dlv def

width 2 div size -1.5 mul rmoveto

FontDirectory /Sloan known

j/Sloan flndfont size scalefont setfont)

{/He I vetica flndfont size 1.8 mul scalefont setfont}

Ifelee

/prInterresolutton

72 0 matrix defauItmatrlx dtransform dup mul exch dup mul add sqrt def

/screen prInterresolutIon 16 div def screen 127 gt {/screen 127 def} if screen currentscreen 3 -1 roll pop setscreen /c 1 def

/setcontrast {1 sub neg setgray} def

continued

BYTE LISTINGS SUPPLEMENT • APRIL-JUNE, 1987 149

May

/showrow

jgsove

dup strlngwldth pop -2 div 0 rmoveto c setcontrost show grestore /c c 2 dlv def 0 size -2 mu I rmoveto ( def

(n c r;

) showrow

(C H V

1 showrow

(2 R H

) showrow

(S H NJ

) showrow

(V 0 K

1 showrow

(N K Z

I showrow

(S Z 0

) showrow

(R D N

) showrow

(R Z S

\ showrow

(Z R N

l showrow

showpage

150

BYTE LISTINGS SUPPLEMENT • APRIL-JUNE, 1987

(

i

LISTING1.BAS Contributed by: Paul D. Bourke Programming Project: "A Contouring Subroutine.- by Paul D. Bourke. June, page 143.

REM

REM

REM

REM

REM

REM

REM

REM

REM

REM

Input variables to CONREC

d(0:lub.0:jub) 'Matrix for the data surface ’Index bounds of the data array ! Dat0 arr °y for column coordinates yt0:JubJ Data array for row coordinates nc 'Number of contour levels

VFrnMT -1 ) .A ’ Co " tour !«vels in Increasing order

False and T ^routine to plot the contour lines

raise and true boolean values

DIM ish(4) DIM xh(4) DIM yhi4) DIM im(3) lm(0)=0 : jm(3) B 0

DIM jn Jm(0)c

3. 1, 4, 3, 0, 9, 6, 7, 5, 2, 0, 8, 0, 0

conrec:

REM Local declarations for CONREC DIM h(4) 'Relative helahts of the box above contour Sign of h(J *x coordinates of box ’y coordinates of box

’Mapping from vertex numbers to x offsets im(1)-1 : lm(2)=1 : lm(3)=0

'Mapping from vertex numbers to y offsets - - - jm( 1 )=0 : jm(2)=1 : Jm(3)-1

DJM c astab(2.2’ 2 ) ’Case switch table DATA 0. 0. 8, 0. 2. 5. 7. 6. 9. 0. 3, 4 1 FOR k-0 TO 2 : FOR J=0 TO 2 : FOR 1-0 TO 2 READ castab(k,J, i )

NEXT i : NEXT J : NEXT k REM

REM Check the Input parameters for validitv prmerr-false 7

IF ( iub=<0 OR Jub-<0) THEN prmerr-true IF (nc<»0) THEN prmerr=true

FOR k-1 TO nc-1 : IF ( 2 (k)<-r(k-1)) THEN prmerr-true : NEXT k REM Prmerr nisg$»"Error in Input parameters” : RETURN

REM th * ° rray ’ top down ’ ,e,t to right

FOR j-Jub—1 TO 0 STEP -1

FOR 1=0 TO lub-1

REM Find the lowest vertex

tf j + P2 THEN <Jfni n-d(I. jl ELSE dmln=d(i. j+1)

!F (d(l+1.J)<dmin) THEN dmln=d(i+1,J) v ,J '

I p (d(l+1.J+1)<dmln) THEN dmln=d(1+1,j+ 1 )

REM Find the highest vertex

THEN dmax»d( I, j 1 ELSE dmax=d( i. j + 1)

) 1 + 1,j)>dmox) THEN dmax=d(1+1,J) '

J + 1. j+1)>dmax) THEN dmax=d(i+1,J+1 )

(dmax<z(0) OR dmln>z(nc-1)) THEN GOTO nonelnbox Draw each contour within this box FOR k=0 TO nc-1

FOR ( i=4 k TO d 0’sTEp R -1 Z(k)>dmaX)) THEN G ° T ° non6,ntr,

THEN ■ ELSE IF (h(,)<0) THEN l.h(.).g : ELSE

REM Scon each triangle In the box FOR m=1 TO 4

m1=m : m2=0 : m3=m+1 : IF (m3=5) THEN m3=1

case-CINT(ca8tab(lsh(m1).ish(m2).Ish(m 3 )))

IF (case=0) THEN GOTO case©

continued

BYTE LISTINGS SUPPLEMENT • APRIL-JUNE. 1987 15.1

ON case GOTO easel,case2,case3,case4,case5,case6,case7,case8,case9

REM Line between vertices ml and m2

easel: xl-xh(ml) : yl-yh(ml) : x2*xh(m2) : y2«yh(m2)

GOTO drawit

REM Line between vertices m2 and m3

case2: x1«xh(m2) : y1«yh(m2) : x2=xh(m3) :y2-yh(m3)

GOTO drawit

REM Line between vertices m3 and ml

case3: x1«xh(m3) : y1«yh(m3) : x2«xh(m1) : y2-yh(m1)

GOTO drawit

REM Line between vertex ml and side m2-m3 case4: xl-xh(ml) : yl-yh(ml)

x2«(h(m3)*xh(m2)-h(m2)*xh(m3))/(h(m3)-h(m2))

y2-(h(m3)*yh(m2)-h(m2)*yh(m3))/(h(m3)-h(m2))

GOTO drawit

REM Line between vertex m2 and side m3-m1 case5: x1*xh(m2) : y1-yh(m2)

x2-(h(m1)*xh(m3)-h(m3)*xh(m1))/(h(m1)-h(m3)) y2»(h(m1;*yh(m3)-h(m3;*yh(m1;)/(h(m1)-h(m3;)

GOTO drawit

REM Line between vertex m3 and side m1-m2 case6: x1-xh(m3) : y1«yh(m3)

x2-(h(m2)*xh(m1 )-h(m1 )*xh(m2))/(h(m2)-h(m1)) y2«(h(m2)*yh(m1)-h(m1)*yh(m2))/(h(m2)-h(m1))

GOTO drawit

REM Line between sides m1-m2 and m2-m3

case7: x1-(h(m2)*xh(m1)-h(m1)*xh(m2))/(h(m2)-h(m1))

y1-(h(m2}*yh(m1 )-h(m1 1*yh(m2))/(h(m2}-h(m1 ^ x2-(h(m3J*xh(m2)-h(m2}*xh(m3 j)/( hCm3J-h(m2n y2«(h(m3)*yh(m2)-h(m2)*yh(m3);/(h(m3)-h(m2))

GOTO drawit

REM Line between sides m2-m3 and m3-m1

case8: Xl-(h(m3)*xh(m2)-h(m2)*xh(m3))/(h(m3)-h(m2))

y1-(h(m3)*yh(m2)-h(m2)*yh(m3) )/( hfm3)-h(m2)) x2-(h(m1Wxh(m3)-h(m3)*xh(m1 j)/( hfm1J-h(m3)) y2«(h(m1)*yh(m3)-h(m3)*yh(m1})/(h(m1)-h(m3))

GOTO drawit

REM Line between sides m3-m1 and m1-m2 cased: x1-(h(m1)*xh(m3)-h(m3)*xh(m1))/(h(m1)-h(m3)) yl-fhfml }*yh(m3)-h(m3)*yh(m1 ))/( h(m1 x2»(h(m2 )*xh(m1)-h(m1)*xh(m2))/(h(m2}-h(m1n y2«(h(m2)*yh(m1)-h(m1)*yh(m2))/(h(m2;-h(m1))

drawit:

CALL vecout(x1,y1,x2,y2,z(k)) caseO: NEXT m noneintr1: NEXT k none inbox: NEXT i : NEXT j RETURN

LISTING2.BAS Contributed by: Paul D. Bourke

Programming Project: "A Contouring Subroutine," by Paul D. Bourke. June, page 143.

CLS: PRINT "CONREC example. Contour the function"

PRINT: PRINT "f(x,y)-sin((x*2+y*2)*.5) + ((x-c)*2+y*2)*-.5"

PRINT: PRINT "letting x and y range from -2 pi to +2 pi."

PRINT "Building the data set now. Please wait."

OPTION BASE 0 'Lower bound of zero for all array indices

pi-3.141592654#

true—1 : false=0

ilength-319 : jlength-199 'Dimensions of the output contour plot axes (full screen in CGA mode)

imin-0 :jmin-199 'Coordinates of the left bottom corner

lub-30 : jub-30 : nc»10 'Number of grid intervals and contour levels

DIM d(iub,iub),x(iub),y(Jub) 'Data array

DIM z(nc-1) 'Contour array

154 BYTE LISTINGS SUPPLEMENT • APRIL JUNE, 1987

June

REM Define the function and the coordinates FOR 1=0 TO tub 'Check at all x-grld levels

i^ 2 ! pi *^ 2 * ,_,ub )/ iub ,x ron 9«s from -2 pi to + 2 pi FOR j=0 TO jub 'Check at all y-grld levels

Jy“2*pi*( 2 *J-jub)/Jub 'jy ranges from -2 pi to + 2 r=SQR(lx 2+jy~2) W

d (l.J)-SIN(r)+.5/SQR((lx+3.05)~2+ly~2)

NEXT j

(I)=I * I1 ength/iub+1min 'Scale x(l) to span plot area FORJ-® TO Jub

^T y ^^" Jm,n_J * il ® ngth/ ^ ub ’ Scal « y(0 to span plot area NEXT J

FOR 1=0 TO nc-1

’Contour levels at -1.-.8.1

NEXT i

pi

CLS: SCREEN 1.0 'CGA screen 320 x 200 LINE (imln,jmin-jlength)-(lmln+i length, jmln), ,b GOSUB conrec

IF NOT(prmerr) THEN PRINT : WHILE LEN(INKEY$)=0 : WEND END

PRINT : PRINT msg$; 'Any key to stop

'Use a box for axes

LISTING3.BAS Contributed by: Paul D. Bourke

Programming Project: "A Contouring Subroutine." by Paul D. Bourke. June, page 143

CLS: PRINT "CONREC example. Graph the equIpotentiaI lines" print "around two charg particles by contouring the function" print: print M V(x,y)«q1/r1 - q2/r2" print "letting x and y range from -4 to 4."

OPTION BASE 0 'Lower bound of zero for all array indices pi-3.141592654# true«-1 : false-0

8creen h "n’cGA iidef^ 1 " ’ D,m#n8,on8 <> f th « °^put contour plot axes (ful lmln=0 :j"'In-199 ’Coordinates of the left bottom corner

;, n ^® /^ er 0f gr,d ,nt8rval « and contour levels DIM d( iub, Iub),x(iub),y(Jub) ’Data array DIM z(nc-1) 'Contour array REM

REM Define the function and the coordinates

FOR*?=0 ?<!"!ub q2 “" 4 ' Ch0r9e 91 " 0t 4,2 "* at + ° ix=4*(2*i-lub)/lub 'Range from -4 to 4 FOR J-0 TO Jub

Jy=4*(2*J-Jub)/jub 'Range from -4 to 4 r 1=SQR ( (I x-a ) ~2+ jy A 2 ) r2=SQR((lx+a)*2+Jy*2) d (I.J)“(q1/r1-q2/r2)

NEXT j

nfv/i 1 ^'* 1 ‘eigth/lub+lmln 'Scale x(l) to span plot area FOR J=0 TO Jub

NEXT y j^" Jmin ~ J * J,en9th/iUb ’ Scala yO) to 8 P an P lot area

FOR 1=0 TO nc-1 : z(I)=(1+1)/2 : NEXT I REM

CLS: SCREEN 1,0 'CGA screen 320 x 200

^cMi ,m,n ' Jn ’ ,n “ Jlen9th ^"^ ,m,n+,,angth >J m,n )** b 'Use a box for axes bOSUB conrec

IF NOT(prmerr) THEN PRINT : PRINT : PRINT msg$:

WHILE LEN(INKEY$)=0 : WEND 'Any key to stop CLS : WINDOW CLOSE 1 P

END

continued

BYTE LISTINGS SUPPLEMENT • APRIL-JUNE. 1987 155

LISTING4.BAS Contributed by: Paul D. Bourks

Programming Project: "A Contouring Subroutine," by Paul

D. Bourke. June, page 143.

REM User defined subroutine to plot vectors on whatever plotting

REM device Is aval liable

REM

SUB vecout(xstart,ystart,xstop,ystop,c1 eve 1) STATIC

LINE (xstart,ystart)-(xstop,ystop)

END SUB

** Total Includes 76112K for BRUN3087

CLOCKSET.ASM Contributed by: Tim G. Hunkier

"68000 Machines: Atari 520ST Projects," Tim G. Hunkier,

June, page 161.

******************

♦ *

* CLOCKSET.ASM * Set Time of Clock Cartridge

♦ * <-> PUBLIC DOMAIN 09-SEP-86 <->

******************

Table caption*** created: *

03-AUG-86 by Tim Hunkier / Solar Powered Software

ROM 3

equ

$FA0000

; R0M3 select

R0M4

equ

$FB0000

; R0M4 select

READ

equ

0

; control for

WRT

equ

64

; control for

Table caption* - Function call definitions for GEM/AES cal

Table caption*

APPL_INI

equ 0

Application initialization

APPL_EXI

equ 1

Application exit

OBJCJDRA

equ 2

Object draw

FORM_DO

equ 3

Form: Do

FORMEDIA

equ 4

Form: Dialog

FORM_ALE

equ 5

Form: Alert

FORM_CEN

equ 6

Form: Center

GRAFJrfOU

equ 7

Graphics: Mouse Form

Table caption* - Offset definitions for dynamic storage

*

params equ $0000 control equ $0018 global equ $0022 int_ln equ $0040 !nt_out equ $0060 addr_ln equ $006E addr__out equ $0072 buffer equ $0076 ap_ld equ $0026 stack equ $0486 xx equ $048A 8Z_stor equ $0492

table of array pointers

array of control counts

array of global variables

array of integers in

array of integers out

array of addresses in

array of addresses out

buffer to receive clock chip data

application ID, one of the globals

stack area (grows downward)

temp area to receive x,y,w,h Info

size of dynamic storage needs

* ...

* - PROGRAM ENTRY POINT

x: lea storage(pc),a5 ; load base of dynamic storage

lea stack(a5),sp ; establish a stack

*

* - release all memory not needed

156 BYTE LISTINGS SUPPLEMENT • APRIL-JUNE, 1987

move.I pea cl r .w move.w trap lea

♦

*

*

^ oc 2 / a9 \" X+256+sz ~ 8tor ^“^ 8p ^ : pu8h num bytos to keep * 7 25 o(po) ; push address of memory to keep

“(sp) ; push fI Iler

J 74,-(sp) ; push function code - memory shrink

1 ; cal I the system

12(sp),sp ; fix the stack

— Initialize GEM/AES parameter block

I ea lea lea I ea I ea I ea lea

params+24(a5),a6 control(a5),a0 global(a5),a1 lnt_ln(a5;,a2 lnt_outfa5),a3 addr_ln(a5),a4 addr_out(a5),a5

movem.l a0-a5,-(a6)

address end of block

first pntr

second pntr

third pntr

fourth pntr

fifth pntr

sixth pntr

fill data block

Table caption♦ - zero some areas In ^global*

Table caption*

moveq

#14,d0

$

zgb1: c1r,w

(a1)+

dbf

dO.zgbl

*

* - Initialize base and data

*

po

lea

x(pc).a6

1 ea

storage(pc),a5

♦

* - begin regular program code

♦

START: bsr

_oppl_ln

e

$

bsr

_mouse

•

P

♦

* - read Info

*

from the clock

car

rdcart: lea

buffer(a5),a2

i

bsr

r_clock

beq.s

hwok

e

$

♦

* - clock's time was bad or the

*

1 ea

warntng(pc),a0

•

bsr

*

_al«rt

i

* - process dialog menu

*

hwok: bsr

format

bsr

dialog

i

♦

* - determine

which exit button

♦

moveq

#1.d3

•

$

bsr

tstnclr

$

bne.s

rdcart

#

moveq

#12.d3

»

bsr

tstnclr

beq.s

I f 13

bsr

set_clk

bra.s

rdcart

If13: bsr

tstncir

; i

beq.s

rdcart

; i

*

* - exit this

program

*

bsr

-<*ppl_ex

; i

c 1 r .w

-(sp)

; i

trap

#1

; <

♦ ■■■■« w_clock

: writ* to clock ■

Table captionloop for 15 words clear entire array

A6 will be program base register A5 wl11 be data storage base register

Table captionInitialize application

Table captionchange mouse pointer to an arrow

Table captionload addr of buffer to be filled read time from the clock cartridge

Table captionaddress warning message and display the message

format time/date Into dialog strings display and process the dialog

outer box ■ object #1

was outer box selected?

yes, then update the time displayed

SET - object #12

was SET button selected?

no, branch

yes, change time

Table captionwas button - EXIT? no, then update menu

Table captionnotify GEM of application exit

Table captionfunction code ■ exit

Table captionTOS and never return!

continued

BYTE LISTINGS SUPPLEMENT • APRIL-JUNE, 1987 157

Table captiondata to be written

Table captionpointer to clock address latch pointer to clock chip select Increased by 2 data present prior to write set by D0

This subroutine Is used to write data to the clock chip. The data to be written is passed in the lower 4 bits of 00 and 2 times the clock register to be accessed In passed In 01.

♦

in:

D0.B «

♦

D1.W i

*

♦

out:

A3.L «

*

A4.L «

♦

D1.W i

*

00.W «

*

CC *8

*

*

changed:

A0.D2

w_c1ock:

lea

R0M3,a3

; LATCH address

lea

R0M4,a4

; CS low strobe

♦

*

form the

clock register

address

♦

weep:

I ea

0(a3,d1.w),a0

; form proper address

¥

mask off

4 bit data and

align it into bits 12..15

e

moveq

#15,d2

; load mask

and.w

d0,d2

; mask of 4 bit data Item

ror .w

#4.d2

; rotate to upper bits

* - latch address, data, and enable writes to the chip

*

move.b WRT(a0,d2.I),d0 ; read old data, latch new data

*

* - turn chip select on to start the write operation

* tst.w (a4) ; set chip select low

addq.w #2,d1 ; update register address

*

* - turn off write enable, turn off chip select, but hold data

*

tst.b READ(a0,d2.I) ; set chip select high

andi.w #$000F,d0 ; mask off 4 bit data and set cond codes

rts

r_clock : read from clock

in: A2.L * address of 16 byte buffer to be filled

out:

D0.L

CC *8

(A2)

0 If alI OK, else -1 set by D0

->

+ 1 +2 +3 +4 +5

+ 14 + 15

changed: A0,A4,D1,D2

flag bits day of week year x 10 year x 1 month x 10 month x 1 day x 10 day x 1 hour x 10 hour x minute minute second second .1 seconds junk byte

1

x 10 x 1 X 10

X 1

leap count, AM/PM, 12/24 hr. 1«Sunday

00 - 1980, 01 - 1981, etc.

This subroutine reads all time and date registers from the clock chip and fills a 16 byte buffer whose address was passed In A2. As the information is read it Is added up. Invalid sums typically indicate a dead battery or a clock cartridge which Is not present and are indicated by returning a -1 In register 00 and the condition codes.

158 BYTE LISTINGS SUPPLEMENT • APRIL JUNE, 1987

_

♦

*

♦

A data changed bit Is checked and If the operation was in progress the operation

time changed while the read is repeated.

r_clock:

I ea I ea I ea moveq

— preload

R0M4,a4 R0M3,a0 16(a2),a2 #0.d1

; set pointer for R0M4 strobe ; set pntr to register 0 ; point to end of buffer to fi ; set accumulator to zero

the register address in the latch

I

tst ,w

♦

♦ -loop and

moveq fetch: tst.w moveq and.w move.b add.w dbf

♦

* - retrieve

♦

(a0) +

set register selection to 0

read clock #15.d2

)«!<» (a0)+,d0 d0.-(a2) d0,d1 d2,fetch

registers 0..15*

; loop count ® 16 ; set chip select on ; load 4 bit data mask ; get data, set next addr, ; store data in buffer • add up all data values ; and repeat for 16 items

select off

data changed flag (zero indicates no change occurred)

*

*

*

tst.w

moveq

and.w

(°4) #8,d0 (o0),d0

; set CS low with register select = 0 ; load mask

; get flag, nxt addr « 2, select ® off

If no clock present we generally accumulate 16 x 15 ® 240

cmpi.w #125,dl

ble.s nwflg

moveq #-1,d0

*

* -— test data changed flag

nwflg: tst.w d0

bgt.s r_clock

rts

; does accumulation Indicate bad data? ; no, branch ; yes, set error flag

and reread the time if necessary

; was data changed (or an error)?

; yes, then repeat the time reading • no, exit with cond codes set

* forn,at clock dota buffer into dialog

*

*

♦

*

*

*

*

♦

*

*

*

in: out: changed:

A2.L - addr of 16 byte buffer returned by "r clock" none

A0.A1.A2.A3.D0.01,02.03

This subroutine takes the contents of the 16 byte buffer filled

Ienu y Ti7e'r k f0rmat '"formation In the dta og

menu. The 7 radio buttons which Indicote the day of the week are

fo!mott!rf d 2 y , 0f W * ek V0lu# of 1 *- 7 - T* 0 date is

formatted and the date string is formed. And also the time Is

formatted and the time string is formed.

format: lea tree(pc),a3

*

♦ clear radio buttons

*

moveq

moveq

fmtclr: bsr dbra

*

* -set radio

*

#6.d2 #5,d3 tstnc I r d2,fmtclr

button for

day of

address dialog tree

loop for 7 days of the week start with button for SUN clear buttons for SUN..SAT repeat till done

the week

moveq and.w addq .w bsr

*

* -form date

*

#7.d3 (a2)+,d3 #4.d3 setseI

load 3 bit mask get day of week, 1..7 convert to object number 5..11 set button for SUN..SAT

string: MM/DD/YY

I ea

move.b

s_date+4(Dc),a1 ; access date string (°2)+,(a1) ; copy tens digit of year

continued

BYTE LISTINGS SUPPLEMENT • APRIL-JUNE, 1987 159

add!.b

#8.(al)+ ;

modify for 1980 baseline

move.b

(a2)+,(al)+ ;

copy ones digit of year

subq.1

#6.o1 ;

back up to access month

move.b move.b

(o2U.(a1)+ ;

(a2)+.(al)+

move two digits of month

move.b

move.b

(a2)+,(al)+ ;

(a2)+.(al)+

move two digits of day-of-month

T

*

form time

string: HH:MM:SS

AM

moveq

#’A\d2 ;

preload AM/PM indicator as AM

moveq

#15.dO ;

load a mask

and.b mu lu

(o2)+,d0 ;

#10.d0

get tens digit of hour

add.b

(o2)+,d0 ;

add in ones digit, hours in D0.W

1 ea

s_tlme+2(pc),a1

; address minute field

move.b

move.b

(a2)+,(o1)+ ;

(o2)+,(ol)+

move two digits of minutes

move.b move.b

(a2)+,(olH ;

(a2)+,(al)+

move two digits of seconds

tst .w

d0 ;

Is It midnight to 1:00 am ?

bne.s

ampm ;

no, skip ahead

moveq bra. s

#12,d0 ;

AM

yes, change from 00:xx to 12:xx

ampm:

cmpl.w

#12.d0 ;

does hour Indicate PM?

bit.s

AM ;

for 00:00 to 11:59 no change

beq.s

noon ;

for 12:00 to 12:59 change flag to *PM #

subi.w

#12.d0 ;

for 13:00 to 23:59 reduce by 12 hours

noon:

moveq

#’P\d2 :

change flag to PM

AM:

move.b

d2,(al)+ ;

store A or P for AM/PM

subq.1

#7.a1 ;

point to hours field

divu

#10.d0 ;

split hour8 Into tens and ones digit

move.b

d0,(a1)+ ;

store tens digit

swap

d0 ;

access ones digit

move.b

d0.(a1) ;

store ones digit

subq.1

#1.al :

adjust pntr to time string

bsr .s

convrt ;

convert binary Into characters

1 ea

s_date(pc),o1 ;

adjust pntr to date string

convrt

: moveq

#5.d1 ;

do 6 digltscvt:

or I .b dbra r ts

#’0'.(o1)+ dl,cvt

convert byte Into ASCII

Table caption* BammmammmmmmmmmmmmmmmmmmmmBmmBmmmmtMmmmtammammmmmmmi

Table caption* sbsm set_clk : Set time/date In clock cartridge

Table caption* BmtimasMmmmmmmmmmmmmmwMmmmmmmmmmmmmmnmmmmmmmmmmmmmmmi

Table caption*

Table caption* In: A3.L - address of dialog tree

♦ out: none

♦ changed:

♦

♦ This subroutine uses the time and date present on the dialog

♦ menu to set the time and date for GEM and TOS. It then converts

♦ this Information Into the appropriate fields of the 16 byte table

♦ filled In by ’r_clock* and uses this table to alter the time and

♦ date of the MM58274 clock chip.

♦

set_cIk:

bsr bne. s

I ea bra

tsok: lea

move.b clr .b

set_tlme ; set time for TOS and GEM

tsok ; branch If all went ok

badtIme(pc),a0 ; address error message ..alert ; display alert then return

buffer-1(a5),a2 ; ; access byte prior to buffer

#1,(a2)+ ; Install command ■ %0001

(a2) + ; Install command - %0000

160 BYTE LISTINGS SUPPLEMENT • APR1L-JUNE, 1987

4c

* flguro out which day of tho week Is Indicated

moveq

sfdow: bsr

beq.s subq.w move.b

4c

#5,d3 tstnc 1 r sfdow #5.d3 d3.(a2)+

; select button - SUN ; Is it selected?

• no, then try next button ; convert SUN..SAT into 1..7 ; and store

4c —

4c

— convert

the date string

Into binary nibbles

1 ea

subq.b move. b move.b

8_date+4(pc), # 8 .(a 0 )

(o 0 )+,(o 2 )+ (a 0 )+,(a 2 )+

,a 0 ; access tens digit of year ; convert 1980 into 00 ; move two year digits

subq .1 move.b move.b

# 6 ,a 0

(a 0 )+.(a 2 )+ (a 0 )+,(a 2 )+

; access month ; move two month digits

4c

move.b

move.b

(a 0 W,(a 2 )+ (a 0 )+,(o 2 )+

; move two day digits

4c

4c

convert the time string

into binary nibbles

1 ea bsr

cmpi,b beq.s cmpi.w beq. 8 add!.w

s_time(pc), a 0

conv 2 dig

#'A\4(a0)

nnta

# 12 ,d 0

nnta

# 12 ,d 0

; access time string * convert hours Into binary ; Is AM or PM indicated?

; branch if AM

; is hour between 12:00 and 12 : 59 ? ; yes, then skip ; adjust 1:00 into 13:00

nnta:

divu

move.b

swap

move.b

# 10 .d 0 d 0 .(a 2 )+ d 0

d 0 ,(a 2 )+

; split hours into digits ; store tens digit of hours ; access ones digit • store ones digit of hours

move.b

move.b

(a 0 )+,(a 2 )+ (o 0 )+,(a 2 )+

; move two digits of minutes

4c

move.b move.b

(a 0 )+,(a 2 )+ (a 0 )+,(a 2 )+

; move two digits of seconds

4c

4c

trans 1 ate

ASCII digits Into binary

xcl r:

4c

moveq andi,b dbra

#13.d0 #15.-(o2) d 0 ,xclr

; loop 14 bytes

; convert ASCII digits to binary

4c

4c

begin clock update

1 ea

moveq

moveq

buffer+14(a5),

#5.d0

# 0 .d 1

a2 I address end of time data

; command • stop clock ; address n 0

bsr

w_c 1 ock

; write command to stop clock

moveq

moveq

bsr

# 1 .d 0 #30.dl w_c 1 ock

; command ■ set 24 hour mode ; addr ■ 15 ; write command

4c

moveq

moveq

bsr

#7.d0

#0.61

w_clock

; command ■ interrupts off ; addr * 0 ; write command

4c

4c

reprogram <

3 11 agisters from the table and start clock

sb 2 c:

moveq

moveq

move.b

bsr

dbra

#14.d3 #4.d1 -(a 2 ).d 0 w_clock d3,sb2c

; loop for 15 writes ; begin addr - 2 (seconds register)

; get next time digit ; change the time

Table captionrts

continued

BYTE LISTINGS SUPPLEMENT • APRIL-JUNE. 1987

161

conv2dig : convert decimal string Into binary

In: A0.L ■ address of string out: 00.L • binary value, range * 0. A0.L ■ Incremented by 2* changed: D1

.99

cc*8 : set by D0

This subroutine converts the two digit ASCII string pointed to by A0 Into a binary value of the range 0..99. The alternate entry

for ten's digit

* point *tenx'

forms D0.L ■

10*D0 + Dl

conv2dig:

moveq

#15.d0

; load i

moveq

#15.dl

; load i

and.b

(a0)+.d0

; retri

and.b

(a0)+,d1

; retri

h • 4

1

1

o

n

3

r+

y

•

result: 10*D0 + Dl

tenx: add.l

d0.d0

; 2x

add. 1

d0.d1

; form

add. 1

d0,d0

; 4x

add. 1

d0.d0

; 8x

add. 1 rts

dl »d0

; resul

digit

digit

+ y

■ 8x + 2x + y ■ 10x + y

■ chk_time : check time string

in: none

out: CD's : Z-1 If invalid string changed: a0,a1,d0,d1,d2

This subroutine checks the time and date strings of the dialog for valid digits. If any Invalid digit is present the condition codes are set accordingly before exit.

t_vld: dc.w $0003

dc.w $03f f

dc.w $000f

dc.w $03f f

dc.w $0300

dc.w $03f f

dc.w -1

dc.w $0003

dc.w $03f f

dc.w $003f

dc.w $03ff

dc.w $003f

dc.w $03f f

month x 10

0. .1*

month x 1

0. .9

date x 10

0. .3'

date x 1

0. .9

year x 10

8. .9'

year x 1 *

9 !

hour x 10

0. .1

hour x 1 ■

0. .9'

minute x 10 *

0. .5

minute x 1 ■

0. .9

second x 10

0. .5

second x 1 =

0. .9

*

chk_tIme:

lea lea moveq ct: moveq

and.b move.w bp I .s lea bra.s cx: btst

dbeq rts

e_date(pc),a0 t_vld(pc),a1 11.d2 15.d0 a0)+,d0 a1)+,d1 cx

s_t ime(pc),a0 ct

d0,d1

d2.ct

address the date string point to table loop count - 6 + 6 digits load mask

get lower nibble of digit

get validation bits

branch unless validation - -1

if -1, switch to time string

and continue

is digit valid?

loop If valid, stop If not

return with cc's set

set.time : set the time

in: none out: none changed:

162 BYTE LISTINGS SUPPLEMENT • APRIL-JUNE, 1987

Jond^v t,n ^ C *h Ck V^ time and dat8 8tr,n 9 8 of the d,a| 09 *n«nu for to a«nlrotA I thl h hi+ t r n98 * ar ° vo lid the informa tion In them Is used 1! + h b,t necessar y to tell GEM and TOS what the

caHs nd d<3te ° re Th ° n the tfm6 and date ° re chan 9 6d vla system

*

♦

Hr ♦

♦

*

*

set_time:

bsr .8 beq.s

♦

* - convert date Into BIOS format

*

chk_t Ime stxit

Is the time and date valid? no, then exit

lea

s_date(pc),a0

i

bsr .s

conv2dig

moveq

#$0F,d7

•

•

and.w

d0,d7

•

•

bsr .8

conv2d!g

andi.w

#$001F,d0

$

1 s 1 .w

#5.d7

•

or .w

d0,d7

i

bsr

conv2dig

;

sub I.w

#80,d0

and I.w

#$007F,d0

ror .w

#7,d0

.

or .w

d0,d7

i

swap

d7

•

Table caption♦

Table caption* — ♦

address the date string pull off the month load 4 bit mask 0000 0000 0000 mmmm

pull off the day of the month mask down to 5 bits shift month bits left 0000 000m mmmd dddd

pull off the year convert 80 into 00 mask down to 7 bits roll year to high end of word yyyy yyym mmmd dddd

; save 'date* in high order bits of D7 convert time into BIOS format

1 ea bsr

move.w

s_tIme(pc),a0 conv2dig d0,d7

; address time string ; get HH

; 0000 0000 000h hhhh

bsr

conv2dig

; get MM

cmpi.b cmpi.w beq.s add!.w

#'A\(a0)

#12.d7 useAM #12.d7

; are we AM or PM?

; are we 12:xx PM?

• yes. then don't correct ; else convert 1..11 into

beq.s useAM

13..23

useAM: Isl.w

andi.w or .w

♦

#6.d7

#$003F,d0

d0,d7

; shift bits to make room for minutes ; mask minutes down to 6 bits ; 0000 0hhh hhmm mmmm

* align time and set seconds to zero

♦

1 8 1 . W

*

#5.d7

; hhhh hmmm mmm0 0000

* -tel 1 GEM

♦

what the date and time Is

move.1 move.w trap addq.1

*

fc 4 . P

; pass [datertime] on stack ; function code ; tell GEM what date/time Is ; fix stack

♦-tell TOS

4c

what the time Is

move.w

move.w trap addq.1

d7.-(sp)

#45.-(sp)

#4.sp

; push "time"

; function code ; tell TOS what time Is ; fix stack

— tell TOS what the date is

swap d7

move.w d7,-(sp) move.w #43,-(sp) trap #1

addq.l #4,sp

reorder [datertime] to [timerdate]

push "date"

function code

tel I TOS what date Is

fix stack

; branch if AM

continued

BYTE LISTINGS SUPPLEMENT • APRIL-JUNE, 1987 163

moveq #-1,d7 ; set condition codes to Indicate OK

stxlt: rts

* mmmmm dialog : display dialog and await exit

*

* In: A3.L - address of tree

* out: D3.W * object ID causing exit

♦ changed: A0, D0, ?

*

* This subroutine reserves memory, draws the tree addressed by A3,

♦ processes the dialog, erases the dialog, sets the button which caused

* exit to non-seIected, and frees up the reserved memory. The object

♦ number of the button which caused exit Is returned In D3.

bsr

rsrv_wln ;

reserve window space

bsr

treedraw ;

draw the tree

bsr

wfbutton ;

wait for response

bra

free_wln ;

erase window

tstnclr

: Test and Clear

SELECTED bit ——

* In: A3.L ■ tree address

* D3.W - object ID

* out: D3.W ■ Incremented by 1

* D0.W ■ object's state word anded with 1

* cc’s : set by D0.W

* changed: A0

* This subroutine tests the SELECTED bit of the object number passed in

* D3 and increments D3. The state of the bit is used to set a

* condition code before exit.

tstnclr:

bsr .s

objba

; get address

moveq

#SELECTED,d0

; load mask

and.w

(o0),d0

; get bit

eor .w

d0.(a0)

; clear bit If set

addq.w

#1,d3

; update

tst . w

dO

; set condition codes

rts

objba

: object bit

a i a.

CL

“1

CO

CO

R

1

R

1

R

■

R

R

* input: A3.L - address of tree

* D3.W - object ID

* out: A0.L * address of object's state word

* changed: D0

* This subroutine Is used to form the address of the resource object's

* STATE word when given the resource tree address and object number.

objba: move.w d3,d0 ; copy object number

mulu #24,d0 ; form 24 byte offset per object

lea 10(a3,d0.I),a0 ; STATE word is 10 bytes Into object

rts

* mmmmmmmmmmmmmmmmmmxxmmmmmmmmmmmmmmammmmmmmmm

* «■— objbset : object bit set

*

* In: A3.L - address of tree

* 03.W - object id

* D4.W - bit mask

* out: A0.L - address of object's state word

♦ changed: none

*

* This subroutine is used to 'OR* a bit mask with the STATE word of an

* object In a resource tree. The alternate entry point 'setsel' is

* used when the 'SELECTED' bit is to be set.*

164

BYTE LISTINGS SUPPLEMENT • APRIL-JUNE, 1987

setsel: moveq #1,d4 objbset: bsr.s objba

or.w d4,(a0) rts

; load SELECTED bit mask ; form address ; sot bits by ORIng

* rsrv_wln : reserve window

*

* in: A3.L - address of tree about to be displayed

* out: none

* changed: D0,D1,A0,A1

*

* This routine first calls the FORM_CENTER routine to set the x.y.w.h

* needed to center the window. Then control drops into FREE_WIN which

* reserves the memory needed for the window size

*

; addr temp area to receive x,y,w,h ; calculate window center ; pass code for reserving space ; enter free__win routine

* =s=ss ““ free__win : free up memory reserved earlier *«=*

♦

* In: none

♦ out: none

* changed: D0.D1.A0.A1

♦

* This subroutine frees up memory which was reserved earlier. The

* x,y,w,h clip rectangle was earlier stored at 'xx*

*

free_wln:

moveq #3,d0 ; use code - 3,

fwep: Isa xx(o5).a0 ; load pointer to x.y.w.h area

bra.s _form_dl ; free memory

rsrv__win:

lea xx(a5),a1

bsr _form_ce

moveq #0.d0

bra.s fwep

* SSSBBaSBaSlCESaSBBaSBSZSUHSBBE

* ====» objdraw : draw an object

* =2sis = = = sszsaaao = ss = sas = ssassx = s:

*

in: A3.L « address of tree

D3.W - object to start with out: none changed: ?

This subroutine draws the resource tree starting at the object number given In 03 and for 5 levels of offspring. The alternate entry point treedraw starts at object number 0 for drawing an entire tree.

treedraw:

moveq #0,d3

lea xx(a5),a0

moveq #5,d1

move.w d3,d0

bra _objc_dr

• for trees set object number to zeroobjdraw: ; address x,y,w,h ; pass 5 levels ; pass object number in d0 ; draw

In:

out:

changed:

*

♦

♦

♦

*

*

♦

♦

*

♦

♦

♦

wfbutton:

moveq wftext: bsr.8 move.w rts

wfbutton : wait for a button

A3.L

D0.W

D3.W

?

tree address

object ID of editable text, 0 If none ID of button causing exit

This routine calls the F0RM__DO routine which processes the user interaction with a dialog. Upon exit the object number which was used to exit the dialog is returned in D3.

#0,d0

_form_do

d0,d3

set object number to 0 process dialog assign to exltobj

continued

BYTE LISTINGS SUPPLEMENT • APRIL-JUNE, 1987 165

♦ =*=*=» _APPL_IN : initialize =====

£ S = = 3KtCSS23S2:2K2S = = SC::= = = SS = = &= = = = 3 = S

♦

♦ in: none

♦ out: D0.W » ap_id or -1 if error

♦ cc's : set by D0.W

♦ changed:

♦

* Thl 9 routine notifies GEM of an application and allows GEM to set up

♦ some housekeeping. An application ID is assigned and we store it

♦ In our global variable area.

*

_appl_in:

moveq #APPL_INI,d1

bsr.s gem_ep

move.w d0,ap_id(a5) r ts

code * initialize call GEM

store application ID

* ««««« _APPL_EX : exit ===«

* »=««====*==================

*

* in: none

* out: d0.w » 0 on error

*

♦ This routine notifies GEM of our intention to terminate.

_appl_ex:

moveq #APPL_EXI,d1 ; code = exit

bra.s gem_ep ; call GEM

♦ ===== _OBJC__DR : Object Draw =====

* ===================================

♦

* in: d0.w - start obj

* dl.w » depth

* a0.l ■ address of x,y,w,h clip limits [4 words]

* a3.I - tree address

♦ out: d0.w * 0 if error occurred

*

_objc_dr:

lea Int_ln(a5),a1

move.w d0,(a1)+ move.w d1,(al)+ move. I (a0)+,(al)+ move.I (a0)+,(al)+ move.I a3,addr_ln(a5) moveq #OBJC_DRA,dl bra.s gem_ep

address integer input array store starting object store drawing depth store x and y store w and h

store address of resource tree set function code * object draw call GEM

* «»■«= _FORM_DO : Process Dialog =====

♦

♦ In: d0.w ■ start object, a3.l - tree address

* out: d0.w « exit object

4c

_form_do:

move.I a3,a0 ; pass tree address in A0

moveq #F0RM_D0,d1 ; function « FORM DO

bra.8 call.gem ; call GEM

* BBBBaaaBBBa«BBaBao«=BS==BSB=saaaBaBaBznBa=B

* ===== _FORM_DI : Dialog Housekeeping =====

* ==========================================

*

♦ in: d0.w « action [0«reserve, 1»grow, 2»shrink, 3«free]

* a0.l - address of x,y,w,h limits [4 words]

* out: d0.w = 0 If an error occurred

*

* This routine is used to reserve or release memory or to draw a

* growing or shrinking box. The operation code is passed in D0 and

* the second x,y,w,h dimensions are pointed to by a0. This routine

* is currently hard coded so that the first set of x,y,w,h points is

* always zero.

IM BYTE LISTINGS SUPPLEMENT • APRIL JUNE, 1987

.formed I:

lea !nt_ln(a5),a1 ; move.w d0,(a1)+ ; clr.l (a1)+ ; clr.l (alW ; move. I (a0;+,(alW ; move.I (a0)+,(al)+ ; moveq #FORM_DIA,dl ; bra.8 gem_ep ;

address Integer Input array

store operation code

xl ■ 0, yl * 0

wl - 0, hi - 0

store x2, y2

store w2, h2

function - FORMEDIALOG

cal I GEM

♦

*

♦

*

♦

♦

♦

♦

*

♦

*

*

_FORM_Al : Process Alert Boxes

In: d0.w » default exit button, a0 ■ alert string address

out: d0.w - exit button used, 1-flrst, 2«second, etc.

This routine displays and processes user Interaction with the alert bo *; . Th6 address of the string Is passed In A0 and the default

exit button If more than one Is present Is passed In D0. The alternate entry point *_alert' sets the default exit button to 1

..alert: moveq _form_al:

moveq bra. 8

#1.d0

#F0RM^ALE,d1 caIl_gem

; default exit button - 1 (leftmost)

; function code ; call GEM

In: out:

*

♦

♦

♦

♦

♦

*

*

♦

*

♦

♦

♦

_form_ce:

—FORM_CE : Calculate box centering

a3.1 al. I none

address of tree

addr of area to store x.y.w.h of centered tree

This

the

routine calculates the x and y coordinates necessary to center resource trees addressed by A3 on the screen. The x,y,w,h

T^ ,na i! 8 nece88ar y f ° r a c"p rectangle ore returned and stored at the address passed In Al.

move.I moveq bsr. 8 I ea

move.I move.I rts

a3,a0 ; #F0RM_CEN,d1 ; cal I ..gem ; lnt_out+2(a5),a0 (a0U,falU ; (a0)+,(a1)+ ;

pass tree address In A0 function ■ form center caI| gem

; access x,y,w,h returned store x,y store w,h

*

*

*

*

♦

♦

*

♦

♦

*

*

_GRAF_MO : Change Mouse Form

In: out: changed:

d0.w - code of mouse form desired d0.w - 0 If error

This routine changes the form of the mouse pointer used, be used to hide and unhide the mouse.

_mouse: moveq #0,d0 _graf_mo:

suba.l a0,a0

set mouse form to pointer moveq #GRAFJtfOU,d1

It can also

♦

♦

*

♦

♦

♦

*

♦

*

♦

call_gem : set up parameters for a gem call

In:

out:

changed:

D1.W - op code number D0.W - optional lnt_ln[0]

A0.L - optional addr_ln[0]

D0.W - returned value from lnt_out[0], If any

continued

BYTE LISTINGS SUPPLEMENT • APRIL-JUNE, 1987 167

This subroutine uses the op code number passed In D1 to look up the number of Integers and addresses in and out for the GEM call. This Information Is then stored In the 'CONTROL* array located In the dynamic storage area. Then GEM call Is then performed and a possible return code is loaded Into D0 before exit.

*

*

*

*

♦

*

caIl_gem:

move.I a0,addr_ln(a5) move.w d0,Int_ln(a5)

In case there's an address In In case there's an integer In

gem_ep: movem.I d2-d7/a1-a6,-(sp) add.w dl.dl add.w dl.dl

lea gemtbl(pc.dl.w),a0

; save registers ; function x 2 ; function x 4 ; form address of entry

transfer opcode, Integers In, integers out, and addresses

lea moveq

controI(a5),a1

HIV T #0.d0

movep.I d0,0(a1)

move.I (a0),d0

movep.I d0,1(al)

clr.w 8(a1)

perform the GEM/AES call

move.I a5,d1 ;

move.w #200,d0 ;

trap #2 ;

movem.I (sp)+,d2-d7/a1-a6

moveq #0,d0 ;

move.w lnt_out(a5),d0 ;

rts

address control array form a zero

clear upper bytes of controI[0..3] get bytes from table entry fill lower bytes of controI[0..3] set control[4] to zero

pass address of 'control* array In D1 pass special function number In D0 caI I the system ; restore registers clear upper portion of register retrieve a return value

♦

♦

♦

♦

♦

♦

♦

♦

Table of control parameters for AES calls

each entry has: AES/GEM function number

number of Integers (words) In number of integers (words) out number of address (longs) in

gemtbl:

dc.b

10,0,1,0

dc.b

19,0,1,0

dc.b

50,1,1,1

dc.b

51,9,1,0

dc.b

52,1.1.1

dc.b

54,0,5,1

dc.b

78,1.1.1

♦

* - strings

for alerts

♦

warning

: dc.b

'[3][ Clock •[3J[Bad Tii

badtime

: dc.b

♦

* - strings

for dialog

*

null:

dc.b

0

8_tI me:

dc.b

'122345A*,0

si:

dc.b

'TIME - ;

s2:

dc.b

'999999F',0

sedate:

dc.b

'071486',0

s4:

dc.b

'DATE - _/.

s5:

dc.b

*999999*.0

86:

dc.b

•SUN*,0

s7:

dc. b

'MON*,0

s8:

dc.b

'TUE'.0

s9:

dc.b

'WED'.0

s 10:

dc.b

'THU',0

811:

dc.b

'FRI',0

s12:

dc.b

'SAT',0

APPL_INIT

APPL_EXIT

FORMJDO

FORMJDIAL

FORM_ALERT

FORM_CENTER

GRAF_MOUSE

dc.b 42,6,1,1

OK ]\0

Jrf’.e

; OBJC.DRAW

IAN BYTE LISTINGS SUPPLEMENT • APRIL-JUNE. 1987

s13: dc.b

s14: dc.b

s15: dc.b

*

*

* each entry:

*

*

♦

♦

♦

*

♦

♦

*

♦

*

'SET\0 'EXIT*,0

'CLOCK CARTRIDGE *,0

text info structures

L - pointer to text

L - pointer to template

L - pointer to validation string

W - font to be used, 3«normal, 5*=small

W ~ 6

W - justification (left, center, right)

W - color code W - 0

W - border thickness ( + outward, - Inward ) W - length of text (including null)

W - length of template (including null)

♦

28 bytes

*

*

♦

text info blocks*

110:

dc. 1

s_time.sl,s2 ;

t ime

dc .w

3.6.0.$1180

dc .w

0.-1,8.19

til:

dc. 1

8_date.84.s5 ;

date

dc. w

3.6.0,$1180

dc.w

0.-1.7.16

112:

dc. 1

s15,nul1,nul 1 ;

title

dc.w

3,6.2,$1180

dc.w

0.-3,16,1

♦

a K i a a 4 a

♦

♦ each

entry:

W - ID of next sibl

Ing (

Table caption♦

Table caption♦

Table caption♦

Table caption♦

Table caption*

Table caption♦

Table caption*

Table caption*

Table caption♦

Table caption*

Table caption*

Table caption♦

Table caption*

Table caption♦ - object

Table caption*

— ~ y i ii none )

W - ID of last offspring (-1 if none)

W - type of object W - object fIags

W - state flags (selected, open, etc)

L - <expansion>

W - x position of upper left corner (relative to parent) W - y position of upper left corner W - width in pixels W - height in pixels

24 bytes types:

BOX

EQU

20

•

TXT

EQU

21

•

BOXTEXT

EQU

22

IMAGE

EQU

23

!

PROGDEF

EQU

24

.

I BOX

EQU

25

BUTTON

EQU

26

.

BOXCHAR

EQU

27

.

STRING

EQU

28

.

ETEXT

EQU

29

.

EBOXTEXT

EQU

30

•

ICON

EQU

31

!

TITLE

*

EQU

32

i

* - object option fl

*

ags

NONE

EQU

$0000

•

SLECTBLE

EQU

$0001

;

DEFAULT

EQU

$0002

f

EXIT

EQU

$0004

P

EDITABLE

EQU

$0008

$

RADIOB

EQU

$0010

•

LASTOB

EQU

$0020

l

box

text

text within a box bit image

programmer defined invisible box text within a button single char within a button str Ing

editable text

editable text within a box Icon Image

string used In menu titles

no option SLECTBLE

default for <CR>

causes exit when selected

editable text

radio button

last object In tree

continued

BYTH LISTINGS SUPPLEMENT • APRIL-JUNE. 1987 169

** - object states:

*

NORMAL EQU $0000

SELECTED EQU $0001

DISABLED EQU $0008

OUTLINED EQU $0010

SHADOWED EQU $0020

* MB

*

tree:

dc.w

ROE TREE:

-1,01.01.BOX

dc.w

NONE.NORMAL

dc. 1

$00011100

dc.w

0.0.262.174

.o

o

•

1

dc.w

00,02,14.BOX

dc.w

SLECTBLE+EXIT,NORMAL

dc. 1

$00FD1103

dc.w

7,7,248,160

o

*

2

dc.w

03,-1,-1.ETEXT

dc.w

EDITABLE,NORMAL

dc. 1

til

dc.w

79,55,120,16

* obj

3

dc.w

04,-1,-1,ETEXT

dc.w

EDITABLE,NORMAL

dc. 1

t 10

dc.w

79,78,144,16

* obj

4

dc.w

12.05,11,BOX

dc.w

NONE.NORMAL

dc. 1

$00FF1100

dc.w

16,16,43,126

* obj

5

dc.w

06,-1,-1,BUTTON ;

dc.w

(RADIOB+SLECTBLE),NORMAL

dc. 1

86

dc.w

1,1,41,16

* obj

6

dc.w

07,-1,-1,BUTTON j

dc.w

(RADIOB+SLECTBLE).NORMAL

dc. 1

s7

dc.w

1,19,41,16

JO

o

*

7

dc.w

08,-1,-1,BUTTON ;

dc.w

(RADIOB+SLECTBLE),NORMAL

dc. 1

s8

dc.w

1,37,41,16

♦ obj

8

dc.w

09,-1,-1,BUTTON ;

dc.w

(RADIOB+S LECTBLE),NORMAL

dc. 1

s9

dc.w

1,55,41,16

♦ obj

9

dc.w 10,-1,-1,BUTTON

dc.w

(RADIOB+SLECTBLE).NORMAL

dc. 1

8 10

dc.w

1,73,41,16

♦ obj

10

dc.w

11,-1,-1,BUTTON ;

dc.w

(RADIOB+SLECTBLE).NORMAL

dc. 1

• 11

dc.w

1,91,41,16

♦ obj

11

dc.w

04,-1,-1,BUTTON ;

dc.w

(RADIOB+SLECTBLE),NORMAL

dc. 1

812

dc.w

1,109,41,16

♦ obj

12

dc.w

13.-1,-1,BUTTON ;

dc.w

5,SHADOWED

dc. 1

813

dc.w

72,112,64,16

nothing special

has been selected by the mouse button

can't be selected

shows up as out IIned

shows up as casting a shadow

Table captionoutermost box

Table captionInner framing box

Table captioneditable date string

Table captioneditable time string

box surrounding radio buttons

Table captionradio button for SUN

Table captionMON

Table captionTUE

Table captionWED

Table captionFRI

Table captionSAT

THU

Table caption'SET* button

170 BYTE LISTINGS SUPPLEMENT • APRIL-JUNE, 1987

* obj 13

Table caption♦ obj 14

dc .w

14,-1,-1,BUTTON

. *

dc.w

5. SHADOWED

dc. 1

s14

dc.w

160,112,64,16

dc.w

01.-1.-1.BOXTEXT

: t

dc.w

LASTOB+SLECTBLE+EXIT.NORMAL

dc. 1

112

dc.w

80,16,136,16

Table captionEXIT* button

* - dynamic storage area begins at end of program

* The dynamic storage Is an uninitialized temporary data area that

* begins at the end of the program. It is used for the stack and all

* variables that do not need to be initialized prior to program

* execution. Use of a dynamic storage area reduces the disk space

* requirements of the program.

*

storage: nop

end

TIMESET.ASM Contributed by: Tim G. Hunkier

"68000 Machines: Atari 520ST Projects," Tim G. Hunkier. June, page 161.

Note 1

Note 2

Note 3

Note 4

Table caption*

Note 5

♦

*

symbol

definitions

R0M3

equ

$f00000

.

R0M4

equ

$fb0000

•

READ

equ

0

;

WRT

equ

64

.

CR

equ

$0d

•

LF

equ

$0a

•

BELL

equ

$07

•

T rnuuiifwi LninT rUlIMI ——

*

x:

1 ea

x-16(pc),sp

»

Table captionIine feed

Note 6

Note 7

moveq #%0001,d0

moveq #0,d1

bsr

w_clock

; load control bits ; addr 0 - control register

; enable clock, disable interrupts

* read the time from the cartridge

*

movea.l sp,a5 ; point a5 to temp buffer

bsr r_clock ; retrieve the time

move.w d0,-(sp) ; save error flag

* - set the system time

*

bsr.s set_tos ; set the time If no error

* - format and display the time

continued

BYTE LISTINGS SUPPLEMENT • APRIL-JUNB. 1987 171

♦

bsr I ea

tod_fmt 1111e(pc),a0

format time for display point to title string

(sp)+ okfine

errmsg(pc),a0 string

tst .w bge.s lea

okfine: bsr.s *

* - delay a bit before exiting

*

move.I #400000, d0 ;

delay: subq.I #1,d0 ;

bne.s delay

*

* - time to exit

*

clr.w -(sp)

trap #1

page

error reading cartridge ? no, skip

yes, change message display the string

load delay count

loop till count reaches zero

pass function code ■ 0

call the system (never return)

string : display a string

in: A0.L - string address out: none changed: many

This subroutine displays the null terminated string whose address is passed in A0 at the current cursor location on the screen.

trlng: move.I a0,-fsp) move.w #9,-(sp) trap #1 addq.l #6,sp rts

; pass string address on stack ; function 9 = text output ; system caI I ; fix stack

*

♦

*

*

*

*

*

*

*

♦

♦

♦

♦

fetch2: moveq and.b moveq and.b mu lu add.w r ts

:cstcancKBB

fetch2 : convert next two digits to a number

in: A0.L ■ address of digits out: 00.L ■ value of conversion A0.L ■ updated by 2 cc * 8 : set by 00 changed: D1

This subroutine converts the two ASCII digits pointed to by the address in A0 into a binary value.

#%1111,d0 (a0)+,d0 #%1111,d1 (a0)+,dl #10.d0 dl ,d0

load mask get 10’s digit load mask get 1 *8 digit x 10

resuIt * d0 x 10 + dl

* ■■■■■■■■■■■■

* nan set_tos : Set the time and date for TOS

* In: A5.L - address of buffer returned by r_clock

* D0.W ■ negative value If default time desired

* out: D7.L - date/time encoded like TOS likes It

*

♦ changed: A0,A1,A2,D1,02

*

* This subroutine uses the data retrieved from the clock cartridge and

* stored in a formatted buffer and converts this information into a

* format suitable for setting the time of both TOS and GEM. System

* calls are then performed for changing the time and date.

*

set_tos:

move.I #$0C215000,d7 ; preload 01/01/86 10:00:00

tst.w d0 ; do we want default or real time?

bml.s stdef ; branch for default

172 BYTE LISTINGS SUPPLEMENT • APRIL-JUNE, 1987

- format the date: [yyyyyyy mmmm ddddd]

point to first year digit get year (00= 1980) place year into d7

get month, 1..12 form: ????? yyyyyyy 0000 add in the month

get day of month, 1..31 form: yyyyyyy mmmm 00000 add in the day

encode the time: [hhhhh mmmmmm sssss]

put year/month/day In upper word

1 ea

2(a5),a0

•

bsr .s

fetch2

move. 1

d0,d7

»

bsr .s

fetch2

.

1 s 1 .w

#4, d7

!

or .w

d0,d7

i

bsr .s

fetch2

Isl .w

#5.d7

5

or .w

d0,d7

1

swap

d7

•

bsr .s

fetch2

•

move.w

d0,d7

•

»

bsr .s

fetch2

1 8 1 .w

#6.d7

•

or .w

d0.d7

i

bsr .8

f«tch2

1 8 1 .W

#5.d7

S

1 sr .w

#1,d0

•

addx.w

d0,d7

$

Table captionget hour, 0..23 form in low word:

??????????? hhhhh

get minute, 0..59 form: ????? hhhhh 000000 add in the minutes

get seconds, 0..59

form: hhhhh mmmmmm 00000

divide seconds by 2

add In seconds (with rounding)

- set the TOS time [date : time ]

stdef: move.w move.w trap addq.I

d7.-(sp) #45,-(sp)

#4,sp

* - set the GEM date and time:

move.I d7,-(sp) move.w #22,-(sp) trap #14 addq.I #6,sp

♦

* - set the TOS date

*

pass the new time pass function code « set time cal I system fix stack

[ date : time ]* pass the date and time pass function code - set date and time cal I system fix stack

swap d7

move.w d7,-(sp) move.w #43,-(sp) trap #1

addq. I #4,sp rts

; retrieve date to low word ; pass the date

; pass function code ■ set date ; call system ; fix stack

*

*

*

*

♦

♦

♦

♦

♦

♦

♦

*

♦

♦

♦

*

♦

♦

w_clock : write to clock ■■■■■

In: D0.B * data to be written

D1.W * register address x 2 to be written to

out: A3.L * pointer to clock address latch A4.L - pointer to clock chip select 01.W ■ increased by 2 D0.W ■ data present prior to write cc’s : set by 00

changed: A0.D2

This subroutine is used to write data to the clock chip. The data to be written is passed in the lower 4 bits of 00 and 2 times the clock register to be accessed in passed in 01.

w_clock:

lea R0M3,a3 ; LATCH address

lea R0M4,a4 ; CS low strobe

continued

BYTE LISTINGS SUPPLEMENT • APRIL-JUNE, 1987 173

*

*

♦

weep:

♦

*

*

♦

*

form the clock register oddress

lea 0(a3,d1.w),a0 ; form proper address

mask off 4 bit data and align It Into address bits 12..15

moveq #15.d2 ; load mask

and.w d0,d2 ; mask of 4 bit data Item

ror.w #4,d2 ; rotate to upper bits

latch address, data, and enable writes to the chip

move.b WRT(a0,d2.I),d0 ; read old data, latch new data

turn chip select on to start the write operation

tst.w (a4) ; set chip select low

addq.w #2,d1 ; update register address

turn off write enable, turn off chip select, but hold data

tst.b READ(a0,d2.I) ; set chip select high

andi.w #$000F,d0 ; mask off 4 bit data and set cond codes

rts

♦

*

♦

♦

*

*

*

♦

*

♦

4c 4c 4c 4c 4c 4c 4c 4c 4c 4c 4c 4c 4c 4c 4c 4c 4c 4i 4c 4«

4c 4c 4c 4c 4c 4c 4c

r_clock:

r_clock : read from clock ““«===

In:

out:

A3.L - pointer to clock latch address

A4.L • pointer to chip select strobe address

A5.L « address of 16 byte buffer to be filled

D0.L - 0 If alI OK, else cc*s : set by D0

-1

(A5)->

+ 1 ■f2 +3 +4 +5

+ 14 + 15

changed: A0,D1,D2

flag bits day of week year x 10 year x 1 month x 10 month x 1 day x 10 day x 1 hour x 10 hour x minute minute second second .1 seconds junk byte

10

1

10

1

leap count, AM/PM, 12/24 hour 1»Sunday

00 - 1980, 01 - 1981, etc.

This subroutine reads all time and date registers from the clock chip and fills a 16 byte buffer whose address was passed in A5. As the information Is read It is added up. Invalid sums typically indicate a dead battery or a clock cartridge which is not present and are indicated by returning a -1 In register D0 and the condition codes.

A data changed bit Is check and if the time changed while the read operation was In progress the operation Is repeated.

movea.l a3,a0 ; set pntr to register 0

l«o 16(a5),a5 ; point to end of buffer to

moveq #0,d1 ; set accumulator to zero

fill

-preload the register address In the la»tch

tst.w (a0)+ ; set register selection to 0

-loop and read clock registers 0..154*

moveq #15,d2 ; loop count * 16

174 BYTE LISTINGS SUPPLEMENT • APRIL-JUNE, 1987

Table captionfetch:

tst.w

( 04 )

•

moveq

#15.d0

»

and.w

(o0)+,d0

»

move.b

d0,-(o5)

•

add.w

d0,d1

•

dbf

d2,fetch

•

set chip select on

load 4 bit data mask

get data, set next addr, select off

store data in buffer

add up all data values

and repeat for 16 items

* retrieve data changed flag (zero indicates no change occurred)

*

*

♦

tst.w (a*) l CS low with register select

moveq #8,d0 ; load mask

and.w ( Q 0),d0 ; get flag, nxt addr ■ 2, select ■

\

if no clock present we generally accumulate 16x15 » 240

■ 0 off

cmpi.w

ble.s

moveq

#125,dl nwf I g #-1.d0

does accumulate indicate bad data?

no, branch

yes, set error flag

* test data changed flag and reread the time if necessary

nwflg: tst.w d0 ; was data changed (or an error)?

bgt.s r_cIock ; yes, then repeat the time reading

r * s ; no, exit with cond codes set

♦

*

*

♦

♦

*

*

♦

*

♦

♦

♦

*

xI ate:

xlate : Translate two bytes into ASCII digits

in: A0.L ■ address of two bytes in the range 0..9 A1.L « destination address for ASCII digits out: A0.L » incremented by 2 A1.L » incremented by 3 changed: none

This subroutine converts two bytes addressed by A1 into ASCII digits in the range '0..9' and Increments the address pointer by 3.

bsr .8 bsr .8 addq.I r ts

dt

dt

#1,a1

; convert digit one ; convert digit two ; skip ahead one place

dt:

move.b addi.b rts

a* ! copy byt *

(($30, (al)+ ; convert copied byte to ASCII

*

♦

*

♦

*

♦

♦

*

>K

*

♦

♦

B2D : Binary to Decimal String

in: D0.W - value to convert, range ■ 0..99

Al.L - destination buffer* out: A1.L

changed: D0

Incremented by 2

This subroutine converts the value passed in D0.W which should be In the range of 0..99 Into a two digit ASCII string and stores these digits at the address passed in Al.

; extend word Into longword ; divide to separte ten's and one's ; convert ten's digit to ASCII ; store ten's digit ; swap remainder to low word ; convert one's digit to ASCII ; store one's digit

d: ext.l

d0

di vu

#10.d0

addi.b

#$30.d0

move.b

d0,(o1)+

swap add!.b move.b rts

d0

#$30.d0 d0,(a1)+

: format time

In: A5.

L « pointer to

out: none

changed: A0,A1,D0,D1,?

continued

BYTE LISTINGS SUPPLEMENT • APRIL-JUNE, 1987 175

Table caption* This subroutine takes the data block returned by the subroutine

Table caption* *r_clock* and formats It Into a string of the form:

Table caption*

Table caption* "WED 07-SEP-86 12:42 AM"

*

tod_fmt

•

1 ea

time+3(pc),o1

•

address day of week field

1 ea

1(a5),a0

»

pnt to day of week byte

moveq

#0.d 0

t

ensure we start with zero

move.b

(o0)+,d0

•

•

get day of week. 1..7

1 s 1 .w

#2,d0

•

form 4x which Is byte offset

move.1

t_doy-4(pc,d0.

w),

>(al)+ ; Install string lik« "MON ■

addq.1

#8,o1

t

address year field

bsr

f«tch2

»

fetch the year. 0..99

addl.w

#80.d0

>

convert 0 Into 80

bsr .s

b2d

!

format as decimal string

1 ea

tIme+11(pc),a1 ;

address month field

bsr

fetch2

i

fetch the month. 1..12

Is 1 .w

#2.d0

»

form 4x which Is byte offset

move.1

month-4(pc,d0.

w).

(al) ; Install string like "JAN-"

subq.1

#3.a1

S

address day of month

bsr .s

xlate

•

copy and translate day of the month

addq.1

#8.a1

•

address hours field

bsr

fetch2

»

fetch hours, 0..23

moveq

#$41.d2

#

preload "A" for AM

tst.w

d0

»

Is time 00:xx ?

bne.s

ampm

•

no. skIp

moveq

#12.d0

•

yes. change 00:xx into 12:xx

bra.8

AM

ampm:

cmpl.w

#12.d0

s

are we after noon?

bit .s

AM

!

no. skip

beq.s

NOON

!

If before 1:00pm just update characl

subl.w

#12.d0

!

convert 13:00 Into 1:00

NOON:

moveq

#$50.d2

!

change character to "P"

AM:

bsr .s

b2d

S

format hours as decimal string

addq.1

#1.a1

•

advance over colon

bsr .s

xlate

•

minutes

bsr .s

xlate

S

seconds

move.b

d2.(o1)

•

Instal1 AM or PM

♦

rts

* -This Is a

*

table for converting 1..7 Into a day of week string

t_day:

dc. 1

•Sun *, ’Mon \*

Tue

i \*Wed •

dc. 1

•Thu ’.’Fri •,*

Sat

•

Table caption♦

*

This I8 a

table for converting 1..12 into a month string

month:

dc. 1

'Jan-*,'Feb-*,'Mar-*,'Apr-*

dc. 1

•May-*,*Jun-*,*Jul-*.*Aug-*

dc. 1

*Sep-*,*Oct-*.*Nov-*,'Dec-*

id —

>d

the title

and time and date display

title:

dc.b

CR.LF.LF

dc.b

•-TIMESET vl.0-’

time:

dc. b

CR.LF

dc.b

* WED xx-xxx-xx xx:xx:xx xM*

*

dc.b

CR.LF.0

♦

*

error message

er rmsg

: dc. b

CR.LF.BELL

dc.b

•-TIMESET-*

dc.b

CR.LF

176 BYTE LISTINGS SUPPLEMENT • APRIL-JUNE, 1987

Chapter Notes

* * * * * * ** *** * * * * * * * ,|c * *

♦ ♦

* TIMESET.ASM * Set TIME from clock cartridge

* * <-> PUBLIC DOMAIN 09-SEP-86 <-> ******************

*** created: 07-JUN-86 by Tim Hunkier / Solar Powered Software

; set up a very small stack (240 bytes)

* - initialize the clock cartridge after power up

June

dc.b * * Check Clock Battery!’

dc.b CR,LF,0

end

COMPRES.PAS Contributed by: Dick Pountaln

"Focus on Algorithms: Run-Length Encoding,” by Dick Pountain. June 1987, page 317.

{COMPRESS.PAS is a procedure written in Turbo Pascal for the IBM PC and its compatibles for the purpose of compressing screen data.

It is not a stand-alone program.}

procedure Compress;

const escapechar = $F800;

scrnseg = $B800; scrnsize ® 4000;

var OutputFile: Text;

OutputFiIeName: string[80];

run length.currentword,nextword,scrnofs,items: integer;

{read word from screen memory}

begin

OutputFileName :■ paramSTR(l);

Assign(OutputFile, OutputFileName);

Rewrite(OutputFile); wr i te(OutputFile,*(');

Items :* 0; scrnofs := 0;

currentword :« MemW[scrnseg:scrnofs]; scrnofs :« scrnofs + 2; repeat

runlength :« 0; repeat

nextword :« MemW[scrnseg:scrnofs]; scrnofs :• scrnofs + 2; runlength :*= runlength + 1;

until (nextword <> currentword) or (scrnofs > scrnsize); if runlength > 1 then begin

runlength :■= escapechar or runlength; wr1te(OutputFiIe,run Iength,•,*.currentword,*,’); if (items mod 12) >« 10 {format into lines}

then wrIteIn(OutputFI Ie); items :■ items + 2 end

else begin

write(OutputFI Ie,currentword,*,•);

If (items mod 12) >« 11 then wrIteIn(OutputFile); items :*= Items + 1 end;

currentword :■ nextword until scrnofs > scrnsize;

wr ite(OutputFile,’*** *,items,’ items ***);’); end l0Se ^° UtPUtFIwr,teln ^’ Com P ress « d data written to ’.OutputFiIeName)

jit’s count/value} (set ’escape’ bits}

{It’s a singleton}

EXPAND.PAS Contributed by: Dick Pountain

"Focus on Algorithms: Run-Length Encoding," by Dick Pountain. June 1987, page 317.

{EXPAND.PAS is a procedure written for the IBM PC and its compatibles

continued

BYTE LISTINGS SUPPLEMENT • APRIL JUNE, 1987 177

f

June

in Turbo Pascal for the purpose of expanding data compressed with COMPRESS.PAS. It is not a stand-alone program.}

{Fill <count> words of memory starting at <seg:ofs> with the 16-bit value <word>}

procedure FiI IW(seg.ofs.count.word:integer); beg i n

iniine

($8B/$86/seg/ $8E/$C0/ $8B/$BE/ofs/ $8B/$86/word/ $8B/$8E/count/ $FC/

$F3/$AB)

end;

MOV AX.sea} MOV ES.AXJ MOV Dl.ofs} MOV AX.word} MOV CX,count} CLD}

REPZ STOSW}

procedure Expand(srcofs.picsize:integer);

const escapechar * $F800; {binary 1111100000000000}

transparent « $07FA;

scrnseg » $B800; {start segment of video RAM}

var srcptr,destptr,data,run Iength,I: integer;

begin

srcptr :« 0; destptr :• 0;

while srcptr < picsize * 2 do begin

data :» MemW[Cseg:srcofs+srcptr]; srcptr :- srcptr + 2; if (data and escapechar) - escapechar then begin

runlength :« data xor escapechar; data :- MemW[Cseg:srcofs+srcptr]; srcptr :« srcptr + 2; if data * transparent

then destptr :« destptr + (2 * runlength) else begin

FiIIW(scrnseg,destptr.run Iength.data); destptr :- destptr + (2 * runlength) end end

else begin

MemW[scrnseg:destptr] :« data; destptr

end end end;

{fetch next word}

test top 5 bits}

It’s a count word| unpack count part} fetch next word}

1 color is transparent| so just bump pointer}

{fill screen memory}

{it’s a singleton} :■ destptr + 2

POLYFIT.BAS Contributed by: William G. Hood

Programming Insight: "Polynomial Curve Fitter." William G. Hood. June 1987. page 155.

1000 LN-1000: LD-11: REM LN-Max data points; LD-highest degree+1 1010 DEF FNMI(X,Y)*(X<Y)*(-X) + (Y<«X)*(-Y)

1020 N=0: M=0: S2*0: R2«0: MF«0

1030 S1-0: S2»0: S3«0: S4=0: P1-0: P2-0: P3-0: 1-0: J»0: J1«0 : K-0: VR-0:MM=0: WT-0: P=0 1040 DIM X(LN),Y(LN).W(LN),C(LD)

1050 DIM D1(LD).D2(LD).D3(LD).D4(LD).D5(LD).D6(LD)

1060 GOTO 1450

1070 IF MF>0 AND M>MM THEN J1-MM+1: MM-M: GOTO 1130 1080 J1-1: MM-M: S1-0: S2-0: S3-0: S4-0 1090 FOR 1-1 TO N: WT-W(I)

1100 S1«S1+WT*X(I): S2-S2+WT: S3-S3+WT*Y(I): S4=S4+WT%Y(I)%Y(I)

1110 NEXT I V ' V J

1120 D4(1)«S1/S2: D5(1)-0: D6(1)-S3/S2: D1(1)-0: D2(1)«1: VR-S4-S3*D6(1)

1130 FOR J-J1 TO MM: S1-0: S2-0: S3-0: S4-0 1140 FOR 1-1 TO N: P1-0: P2-1

178 BYTE LISTINGS SUPPLEMENT • APRIL-JUNE. 1987

1150

1160

1170

1180

1190

1200

1210

1220

1230

1240

1250

1260

1270

1280

1290

1300

1310

1320

1330

1340

1350

1360

1370

1380

1390

1400

1410

1420

1430

1440

1450

1470

1480

1490

1500

1510

1520

1530

1540

1550

1560

1570

1580

1590

1600

1610

1620

1630

1640

1650

1660

1670

1680

1690

1700

1710

1720

1730

1740

1750

1760

1770

1780

1790

1800

1810

1820

1830

1840

1850

I860

1870

1880

1890

1900

P1=P: NEXT K

D6(K)=D6(K)+D3(K)*D6(J+1): NEXT K

N*# of data points

X()»X-coordinates of the data points

FOR K=1 TO J: P=P2: P2«(X(I)-D4(K))*P2-D5(K)*P1 WT=W(I): P=WT*P2*P2 S1*S1+P*X(I) : S2=S2+P: S3=S3+WT*P1*P1: S4=S4+WT*Y(I)*P2: NEXT I IF ( j<4 THEN S 1210 5(J+1) " S2/S3: D6(J+1 )“ S4 /S2: 03(1)-D4( J)*D2(1)-D5(J)*D1(1)

FOR K-2 TO J-2: D3(K)-D2(K-1)-D4(J)*D2(K)-D5(J)*D1(K): NEXT K IF J>2 THEN D3(J-1)»D2(J-2)-D4(J)*D2(J-l)-D5lJ)

IF J>1 THEN D3(J)-D2(J-1 )-D4(J)

FOR K-1 TO J: D1(K)-02(k): D2(K)-D3(K):

NEXT J

FOR J-1 TO M+1: C(J)«D6(M+2-J): NEXT J P2-0: FOR 1-1 TO N: P-C(1)

FOR J-1 TO M: P=P*X(I)+C(J+1): NEXT J P-P-Y(I): P2-P2+W(I)*P*P: NEXT I S2-0: IF N>M+1 THEN S2-P2/(N-M-1)

R2-1: IF VR<>0 THEN R2-1-P2/VR: IF R2<0 THEN R2-0 RETURN

REM GOSUB 30 calls the subrout Ins REM Input:

REM REM

REM YH-Y-coordinates of the data points REM W()=Welghting factors of the data points REM M-Degree of polynomial

REM MF—0 if new data, MF—1 If old data but higher degree REM Output:

REM C«Array of M+1 coefficients REM S2-Resldual variance REM R2-coeffIcient of determination

CLS1460 PRINT "Polyflt. Copyright (C) 1986 by William G. Hood"

PRINT

PRINT "This program finds the coefficients of the nth degree polynomial" PRINT: PRINT “y - c(1)*x~n + c(2)*x*(n-1) + ... + c(n)*x + c(n+1)

PRINT: PRINT that fits a set of data points In a least-squares sense " PRINT "Each data point must consist of an X value, a Y value, and an PRINT "optional weight, separated by commas and terminated by a return PRINT “Data are read from a disk file until the eof is reached, or a PRINT "specified number of data points ore read In from the keyboard."

PRINT

LINE INPUT "Name the data file (null line-keyboard): "; FI$

PRINT "Is the data weighted (Y/N, null IIne-No)? ":

W$="": INPUT W$

IF W$<>"Y" AND W$<>"y" THEN W$-"N M IF FI$oNU$ THEN 2000 PRINT "Keyboard data entry"

PRINT "How many data points ( 2 <- n <-";LN;")";: INPUT N IF N<2 OR N>LN THEN 1620 FOR K-1 TO N

IF W$<>"N" THEN INPUT "x,y,w";X(K).Y(K).W(K): W(K)-ABS(W(K))

IF W$="N" THEN INPUT "x.y"; X(K).Y(K): W(K)-1 V "

NEXT K

PM-FNMI(LD-1,N-1)

PRINT "Degree of polynomial ( 1<- m <- PM;")":

IF M<1 OR M>PM THEN 1690 GOSUB 1070

PRINT: PRINT "Coefficients (constant term last):

INPUT M: M-INT(M)

K-0

INPUT A$

A$-“": INPUT A$

’ ’ ’ • • » wwwf v I V I VM VU y VVMO VUII

FOR J-1 TO M+1: PRINT TAB(K) C(J);: K-K+20: IF K>20 THEN K-0: PRINT NEXT J

PRINT: PRINT "Residual variance: ";S2 R2-INT(10000001*R2+.5)/10000001 PRINT: PRINT"CoeffIcient of determination: ";R2 PRINT "Try another degree (Y/N. null IIne-No)";: A$«"

IF A$="Y" OR A$»"y" THEN 1680

PRINT "Print a table of the data (Y/N. null IIne-No)"

IF A$o"Y" AND A$o"y" THEN 1870 '

PRINT: PRINT"Degree of p(x): ";M

PRINT: PRINT " X"; TAB(11) "Y"; TAB(25) "p(x)": PRINT FOR 1-1 TO N: P-C(1)

FOR K-1 TO M: P=P*X(I)+C(K+1): NEXT K PRINT X(I);TAB(10);Y(I);TAB(24);P: NEXT I IF F$<>NU$ THEN END

PRINT: PRINT “Save the data (Y/N, null IIne-No)? ";: A$»"": INPUT A$ IF A$<>"Y" AND A$<>"y" THEN END ' Ul *

PRINT: LINE INPUT "Name of output file ";F0$

continued

BYTE LISTINGS SUPPLEMENT • APRIL-JUNE, 1987 179

1910 IF FO$=NU$ THEN END 1920 PRINT "Writing to ";F0$

1930 OPEN FO$ FOR OUTPUT AS 1 1940 FOR 1=1 TO N

1950 IF W$<>"N" THEN PRINT#1. X(I);\“; Y(I);","; W(I)

1960 IF W$="N" THEN PRINTjjM , X(I);"."; Y(I)

1970 NEXT I 1980 CLOSE 1 1990 END

2000 PRINT "Reading from ";FI$2010 OPEN FI$ FOR INPUT AS 1 2020 N=0

2030 PRINT M X" TAB(15) "Y"; TAB(28) "W"; : PRINT 2040 IF EOF(1) OR N«LN THEN 2100 2050 N=N+1

2060 IF W$o"N" THEN INPUT#1. X(N), Y(N), W(N): W(N)-ABS(W(N)) 2070 IF W$*"N" THEN INPUT#1, X(N), Y(N): W(N)«1 2080 PRINT X(N) TAB(14) Y(N) TAB(28) W(N)

2090 GOTO 2040 2100 CLOSE 1

2110 PRINT: PRINT"Ffle contained N; M data points.**

2120 IF N<2 THEN PRINT "Too few data points.": END 2130 GOTO 1680

BENCH.OBJ Contributed by: Mat Davis

TEXT "Smalitalk/V Release 1.2," by Mat Davis, June, page 256.

"Class implementing the Byte benchmarks.

Written by Mat Davis."

Object subclass: ^Benchmark i nstanceVarlabIeNames: ** cIassVariabIeNames: * * poolDictionaries: ** !

{Benchmark class methods I !

{Benchmark methods I calculate: nTimes

"Perform the Byte calculation benchmark. Using 'print it' with the expression 'Benchmark new calculate: 5000' will print the error after 5000 Iterations."

|abc|

a := 271828 / 100000. b := 314159 / 100000. c := 1.

1 to: nTimes do: [ :I | c :■ c a. c :■ c b. c :- c / a. c :« c / b ].

"c - II

diskRead: kBytes

Perform the Byte disk read benchmark. Evaluating the expression 'Benchmark new diskRead: 64* will read a 64K from the file A:TEST.DAT."

| nr input | nr :■ kBytes 8.

Input :« DiskA file: 'TEST.DAT'.

1 to: nr do: [ :i | input next: 128 ]. input close.

A 'Done'I

180

BYTE LISTINGS SUPPLEMENT • APRII.-JUNE, 1987

.

June

diskWrite: kBytes

"Perform the Byte disk write benchmark. Evaluating the expression ^Benchmark new diskWrite: 64* will create a 64K file named A:TEST.DAT."

| a b nr output |

a :■ * 12345678123456781234567812345678*.

b :« a, a, a, a. nr :■ kBytes 8. output DIskA file: 'TEST.DAT*.

1 to: nr do: [ :I |

output nextPutAII: b ]. output close.

"•Done*I

sieve: size

"Perform the Byte prime eieve benchmark. Evaluating the expression Benchmark.new sieve: 8191* will return the number of primes from • xo o i y I .

| flags count k | flags :* Array new: size, count :■ 0.

1 to: size do: [ :l | flags at: I put: 1 *1.

2 to: size do: [ :I j

(flags at: I) 1 IfTrue: [ k :« I + I.

[ k > size ] whlleFalee: [ flags at: k put: 0. k k + I ]. count :« count + 1 1 1.

"count! !

BYTE LISTINGS SUPPLEMENT • APR1L-JUNE, 1987 181

BVTE

1986

EDITORIAL

INDEX

12-BIT • AMSOFT

12-bit 16-channel highspeed analog-to-digital converter, construction of (S. Ciarcia), Jan 105

2861 computer from Kaypro, review (H. Krause), Mar 217

520ST computer from Atari. See Atari computers, 520ST

1040ST computer from Atari compared to Macintosh and Amiga computers (B. Webster), May 343 preview (P. Robinson,

J. R. Edwards), Mar 84 1409 EPROM programmer from B&C Microsystems, review (R. Jacobs),

May 279

6060 computer from Xerox, review (W. Rash Jr.),

Sept 275

8031 processor from Intel, construction of emulator board for in-circuit emulation of(G. Dinwiddie), July 181

65C816 processor in Apple IIGS computer, Oct 84

68000 processor from Motorola. See Motorola, 68000 processor

68008 processor from Motorola, compared to other 68000-series processors (T. L. Johnson), Sept 205

68010 processor from Motorola. See Motorola, 68010 processor

68012 processor from Motorola, compared to other 68000-series processors (T. L. Johnson), Sept 205

68020 processor from Motorola

compared to other 68000-series processors (T. L. Johnson),

Sept 205

in Definicon 68020 coprocessor (T. Marshall,

C. Jones, S. Kluger),

July 120, Aug 108 68881 floating-point chip from Motorola, in Definicon 68020 coprocessor,

July 120

80286 processor from Intel.

See Intel, 80286 processor

80287 processor from Intel, in micro-based supercomputer (N. H.

Christ, A. E. Terrano),

Apr 145

80386 processor from Intel. See Intel, 80386 processor

A

A-200 Canon computer, review (P. V. Callamaras), Jan 293

Abstract mathematical

art (K. E. Perry), Dec 181

Abundance Forth-based database language, in public domain (R.

Green), Oct 193

Accelerator boards for

IBM PC(S. S. Fried),

IBM 141

Access Associates Alegra Memory Expansion Box for Amiga (B. Webster),

Dec 305

ACE 2200 computer from Franklin, review (A. S. Woodhull), Sept 263

Acorn Computers RISC processor (D. Pountain),

Jan 387

Acta outline processor for Macintosh (B. Webster),

Dec 316

Activation network

erector set (J. Pollack),

Feb 196

Actor object-oriented language (C. B. Duff),

Aug 211

Ada, best of BIX on,

Nov 405

Addison-Wesley

MicroT^X typesetting package, review (H. R. Varian), Apr 267

Advanced Fullscreen Debug debugging program, review (J. C. Carden),

Apr 249

Advanced Trace86

assembler/debugger (B. Webster), Oct 293

Advantage! multifunction board for IBM PC AT, review (T. J. Byers), Jan 327 Aegis Animator and Images animation and painting programs, review (W. Block), Nov 285

Aging, robotic aids increasing independence in (K. G. Engelhardt, R. Edwards), Mar 191

Airus Al. Typist word processor (E. Shapiro),

July 383

Aitken extrapolation for

approximating integrals (D. M. Smith), Dec 113 Alegra Memory expansion Box for Amiga (B. Webster), Dec 305

Algorithms

Euclid’s (R. T. Kurosaka), Jan 397, Mar 343 for extracting nth root from binary number (L. S. Wo), Nov 115 Huffman, for data compression (J. Amsterdam), May 99 ID3, for extracting knowledge from data (B. Thompson, W. Thompson), Nov 149 Pan and Reif, for inversion of large matrices (T. E. Phipps Jr ),

Apr 181

Runge-Kutta, for solving differential equations,

Apr 216

in BASIC (D. M. Leo),

Apr 196

in FORTRAN, (B.

Thomas), Apr 191 on storage allocators, Oct 125,128,130

Allocating memory in

Modula-2, programming project (J. Amsterdam),

Oct 123

Alloy Computer Products

FT-60 tape backup unit, review (M. C. Rubel),

Oct 243

Alpha Microsystems

Videotrax tape backup unit, review (M. C. Rubel),

Oct 243

American National Standards Institute (ANSI) C language standards of (S. A. Hersee, D. Knopoff), Mar 135

meeting schedule of,

Mar 136

Amiga computer from Commodore Access Associates Alegra Memory Expansion Box for (B. Webster), Dec 305 Aegis Animator and Images animation and painting programs for, review (W. Block),

Nov 285

AmigaDOS operating system of (D. Pountain), Feb 321

animation of graphics with Aegis Animator package (W. Block), Nov 285

glossary on, Sept 241 software for (E. A.

Ditton, R. A. Ditton), Sept 241

best of BIX on, Feb 363, Mar 367, Apr 349, May 398, June 367, July 393, Aug 344, Sept 380, Oct 324, Nov 385,

Dec 349

compared to Macintosh and Atari computers (B. Webster), Mar 305,

May 343

Deluxe Paint program for, Apr 322

Electronic Arts software for (B. Webster), Apr 322, Dec 308

Instant Music program for (B. Webster), Dec 308 Lattice C compiler for, review (C. Heath),

Nov 271

Lattice Screen Editor program editor for (B. Webster), July 352 Mandelbrot program for, in Lattice C. (P. B. Schroeder), Dec 207 Manx Aztec C68K C compiler for, review (C. Heath), Nov 271 Metascope debugger for (B. Webster), Nov 334 MicroBotics MAS-20 hard disk drive for (B. Webster), Dec 306 review on Model 1000 (T.

Thompson), Oct 231 ROM Kernel software of, introduction to (R. J. Mical), Feb 116 sound system of (D. D.

Thiel), Oct 139 system calls of, compared to Macintosh (A. B. Webber),

Sept 249 three-dimensional Breakout game for (B. Webster), Dec 310 TxEd program editor for (B. Webster), Nov 336

AmigaDOS operating system, development of (D. Pountain), Feb 321

Amsoft Amstrad PCW 8256 computer and word processor (D. Pountain),

Mar 333

184 B YTE • 1986 INDEX

AMSTRAD • ATOMCC

Amstrad PCW 8256 computer and word processor (D. Pountain), Mar 333

Anagram solving in Pascal (B. Keefer), July 113

Analog circuit analysis

introduction to (W.

Blume), July 165 with SPICE program for Commodore 64 (D. McNeill), July 170 Analog-to-digital converter, construction of (S. Ciarcia), Jan 105 Analytical software Reflex database program, review (R. DeMaria), Aug 277 SPSS/PC+ package, review (J. M. Jacques), Nov 279

Anamartic Wisper wafer (D. Pountain), Nov 351

Animal Game in Smalltalk, Aug 153

Animation of Amiga graphics

with Aegis Animator package, review (W. Block), Nov 285 glossary on, Sept 246 software for (E. A. Ditton,

R. A. Ditton), Sept 241 Animator animation software for Amiga, review (W. Block), Nov 285

Ann Arbor Softworks

FullPaint program for Macintosh (E. Shapiro),

Sept 368

Ansa Software

Application Generator from, Sept 308 Paradox 1.1 relational database program from, review (R. DeMaria),

Sept 303

Runtime module from,

Sept 308

ANSI (American National Standards Institute)

C language standards of (S. A. Hersee, D. Knopoff), Mar 135

meeting schedule of,

Mar 136

ANSI.SYS driver,

Enhanced Console Driver replacement for (A.

Zackin), Oct 183

Apex Resources

DevpacST 68000 assembly language development package (B. Webster),

Nov 330

APL language, review on Pocket APL version (E. H. Johnson), Mar 237

Apple computers Apple II

best of BIX on, Nov 394, Dec 370 for blind users,

Mar 199, 251 Franklin ACE 2200 computer compared to (A. S. Woodhull),

Sept 263

MIDI interfaces for, hardware review (R. Powell, R. Grehan),

June 265

Printit printer interface card for, review (H. Brugsch, J. J.

Lazzaro), Mar 261 Sider hard disk drive for, review (D. E. Hall), Jan 319

text analysis programs identifying unknown authors for (J.

Tankard), Feb 231 three-dimensional graphics program for, in BASIC, Jan 153 windowing system for, programming of (B. Webster), Mar 128,

Apr 97 Apple IIGS best of BIX on,

Dec 376

preview (G. Williams,

R. Grehan), Oct 84 catalog sort routine for ProDOS of (A. C. Silvestri), June 117

LaserWriter Plus laser printer from, June 88 MacApp object-oriented application framework for Macintosh from (K. J. Schmucker), Aug 189 programming experience with,

Aug 200

MacDraw painting program from, review (R. Birmele), May 269 Macintosh. See Macintosh computer object-oriented languages for Macintosh from, Aug 177 Approximations in computer computations with Aitken extrapolation

for approximating integrals (D. M. Smith), Dec 113 Chebyshev, Apr 174 in Runge-Kutta method for solving differential equations, Apr 216 in BASIC (D. M. Leo),

Apr 191

in FORTRAN (B.

Thomas), Apr 191 speed and precision of (S. L. Moshier), Apr 161

Apricot XEN computer (D. Pountain), Apr 305

Arabic script typesetting (P. A. MacKay), Feb 201 Architecture of houses, bit-mapped classifier system on, in BASIC, Nov 166 Arity/Prolog version 3.2, review (W. G.

Wong), Mar 245 version 4.0, Mar 247

Arms, robotic

in automation of chemistry laboratory (G. W. Kramer, P. L.

Fuchs), Jan 263 coordination of multiple manipulators (J. S.

Hawker, R. N. Nagel,

R. Roberts, N. G. Odrey), Jan 203

Artificial intelligence

in computer vision (J. L. Cuadrado, C. Y.

Cuadrado), Jan 237 knowledge representation in. See Knowledge representation Ashton-Tate dBASE III Plus software from (E. Shapiro),

June 330

Framework II software from, Apr 331 Assembly language

best of BIX on, IBM 300 compared to C language (T. Hogan), IBM 267 Getspec routine for passing filenames to compiled BASIC in (B. Hubanks), Nov 119 guidelines for Motorola MC68000 processor (M. Morton), Sept 163 HiSoft DevpacST 68000 assembly language development package.

Nov 330

interrupt routines for IBM PC in (W. J. Claff),

IBM 249

using assembly routines in MS-FORTRAN programs (M.

Dahmke), IBM 217 AST Research Advantage! multifunction board from, review (T. J. Byers), Jan 327 Enhanced Expanded Memory Specification from, IBM 170

ASYST laboratory interfacing software package, July 303 Atari computers 520ST (B. Webster),

Feb 331

compared to Macintosh and Amiga computers (B. Webster), Mar 305,

May 343 DEGAS painting software for (B. Webster), Apr 320 description of (J. R. Edwards, P. Robinson, B. McLaughlin),

Jan 84

MichTron software for (B. Webster), Apr 318 review (E. Jensen),

June 233 1040ST

compared to Macintosh and Amiga computers (B. Webster), May 343

preview (P. Robinson,

J. R. Edwards), Mar 84 best of BIX on, Feb 372,

Mar 376, Apr 366, May 402, June 372, July 397, Aug 347, Sept 390, Oct 328, Nov 386,

Dec 356

games for (B. Webster),

Dec 312

Graphics Environment Manager of, Sept 223 Line A Handler of,

Sept 223

Megamax C development system for (B. Webster), Nov 326 Motorola 68000 processor and TOS operating system of (M. Rothman), Sept 223 Personal Pascal software for (B. Webster), July 347 Shivji interview on (P.

Robinson), Mar 90 XBIOS of, Sept 223

ATOMCC toolbox for solving differential equations in FORTRAN (Y. F.

Chang), Apr 215

1986INDEX - BYTE 185

AT&T INFORMATION SYSTEMS • BENCHMARKS

AT&T Information Systems

Model 4000 modem from, Dec 255 Model 4024 modem from, Dec 255 PC 6300 computer from, Hardcard hard disk for, May 273

UNIX PC from, review (A. J. W. Mayer), May 254

Audlo-and-video

multiplexer, construction of (S. Ciarcia), Feb 85

Automata, cellular,

Dec 181 origins of,

Dec 182

Automation of chemistry laboratory (G. W. Kramer,

P. L. Fuchs), Jan 263

AUTO.OPS

implementation of OPS5 programming language,

Nov 222

AVMUX audio-and-video multiplexer, construction of (S. Ciarcia), Feb 85

Aztec C

Badfile utility in (L.

Baker), Feb 157 Manx Aztec C68K C compiler for Amiga, review (C. Heath), Nov 271

B

Backup systems, tape comparison of (A.

Antonuccio), May 227 hardware reviews (M. C. Rubel), Oct 243

Badfile utility in C

language for CP/M systems (L. Baker), Feb 157

Balance of Power game (E. Shapiro), Mar 299,

Dec 322

Bank-switched memoryexpansion systems AST Enhanced Expanded Memory Specification, IBM 170 Lotus/Intel/Microsoft Expanded Memory Specification (R.

Duncan), IBM 169

BASIC

abstract mathematical art in (K. E. Perry), Dec 181 best of BIX on, IBM 304 bit-mapped classifier

system on house architecture in,

Nov 168

calculating impact of nuclear weapons with programs in (J. R.

Fanchi), Dec 143 Circuit Cellar BASIC com puter/controller-30 analog-to-digital converter board (S. Ciarcia), Jan 105 Circuit Cellar BASIC computer/controller-52, construction of analogto-digital converter compatible with (S. Ciarcia), Jan 105 COLOR3D.BAS program displaying molecules in color in, for IBM PC (J. J. Farrell), Feb 149 Diophantine equation solver program in, Mar 346

Euclid’s algorithm in,

Jan 399

freeform curve program in, for Texas Instruments Professional Computer (S. Enns), Dec 225 Getspec assembly language routine for passing filenames to (B. Hubanks), Nov 119 Hilbert curve program in (M. Ackerman), June 137 keyed file access in (S. C.

Perry), Sept 137 Macintosh Explorer disassembler program in (O. Andrade), Mar 145 Mapper similarity mapping program for Macintosh in (R.

Spencer), Aug 85 number-sequence games in (R. T. Kurosaka), Aug 333

Pan and Reif algorithm for inversion of large matrices in, Apr 184 physical property estimation programs in (J. N. Stone), July 253 probability analysis programs in, on sucker bets (R. T. Kurosaka).

Nov 373

ProDOS catalog sort routine in Applesoft BASIC, June 117 Runge-Kutta method for solving differential equations in (D. M.

Leo), Apr 196 SmartWatch real-time clock program in, Mar 120 stress analysis program

for underground mining in, July 222

subroutine overlays in GW-BASIC (M. Carmichael), May 151 text analysis programs identifying unknown authors in (J. Tankard),

Feb 231

three-dimensional graphics program in (H. Mittelbach), Jan 153 for molecules in color (J. J. Farrell), Feb 149 on quadric surfaces (G. Haroney), Dec 215 translated into C with CGEN program (D. Pountain), Oct 311 Truss2 bridge-truss analysis program in (C. Pedicini), July 145 ZBasic interactive BASIC compiler, review (T. J. Byers), May 265

Batteries Included

DEGAS painting software, Apr 320

B&C Microsystems Model 1409 EPROM programmer, review (R. Jacobs),

May 279

Benchmarks

on Amiga computer model 1000, May 254,

Oct 234 on Apricot XEN computer, Apr 309 on Arity/Prolog version 3.2, Mar 248 on Atari 520ST computer,

May 354, June 236 on Atari 1040ST computer, Mar 87, May 354

on AT&T UNIX PC computer, May 257 on Canon A-200 computer system, Jan 296 on C. Itoh TriPrinter dotmatrix printer, Sept 284 characteristics and interpretation of (B. Webster), Jan 371 on Commodore 128 personal computer,

July 271

on Compaq Deskpro 286 computer, June 246 on Compaq Deskpro 386 computer, Nov 86 on Compaq Portable II Model 3 computer,

Oct 240

on Conquest Turbo PC computer, July 290

on Datran Modem Accelerator version 1.1 for text transmission,

Aug 292

on Definicon 68020 coprocessor, July 140 on DeSmet C Development Package for Macintosh, Aug 253 on Eco-C88 C compiler,

Jan 310

on Epson Equity I computer, Nov 241 on Epson Equity III computer, Dec 241 on filePro 16 database management software, Nov 298

on Franklin ACE 2200 computer, Sept 264 on Fujitsu DL2400 24-pin dot-matrix printer,

Nov 257

on GE 3-8100 printer,

May 294

on General Computer HyperDrive 2000 computer, Nov 324 on Hardcard hard disk,

May 276

on Hercules Graphics Card Plus, Dec 251 on Hochstrasser Modula2 System for Z80 CP/M systems, Mar 226 on IBM PC accelerators,

IBM 157

on IBM PC AT at various CPU speeds (E. White), IBM 212

on IBM Wheelprinter E,

July 316 on ITC Modula-2 Software Development System, Oct 256 on ITT XTRA XP computer, July 283 on KAMAS outline processor, Apr 244 on Kaypro 286i computer, Mar 220 on Kaypro PC computer,

Nov 241

on Lattice C compilers for Amiga, Nov 271 for IBM PC, Feb 277 on Leading Edge Model D PC computer, Sept 270 on Levco Prodigy 4 computer, Nov 324 on LISP implementations BYSO LISP and Waltz LISP, July 294 on MacCharlie accessory for Macintosh, Feb 266 on Macintosh 512K version, Nov 324 compared to Atari and

186 BYTE* 1986 INDEX

BERNOULLI BOX • BOOK REVIEWS

Amiga computers, May 354

and mass storage devices, June 354 Plus version, May 354, Nov 248, Nov 324 on Manx Aztec C68K C compiler for Amiga, Nov 271

on Microsoft Word version 3.0 word processor, Oct 262 on Mix C Compiler,

June 258

on modems, Dec 255 on Motorola VME/10 system, Feb 256 on Multitech MPFPC/700 D1 computer, Nov 241

on NCR PC6 computer, Aug 242

on NewWord 3 word processor, Aug 274 on Nisso NP-2410 24-pin dot-matrix printer,

Nov 257

on Panasonic Exec. Partner transportable computer, Apr 234 on Paradox 1.1 relational database program,

Sept 306

on Pascal packages for IBM PC. Dec 274 on PCT^X and MicroT^X typesetting packages, Apr 270

on Pocket APL language Mar 238

on Scottsdale Systems Color Fox computer system, Jan 304 on Sider hard disk drive, Jan 322

on Sperry PC/IT computer, Aug 249 on tape backup units,

Oct 247

on TeleVideo Tele-286 Model 2 computer,

June 254 on TOPSI 2.0 programming language for IBM PC, Aug 261 on Toshiba P321 24-pin dot-matrix printer,

Nov 257

on Turbo Pascal version 3.0, Feb 282 on Turbo Prolog programming language, Sept 295

on Western AT computer, Dec 241

on WordPerfect 4.1 word processor, Sept 312

on Xerox 6060 computer, Sept 277

on ZBasic compiler,

May 267 on Zenith Z-241 computer, Dec 241 on Zenith Z-248 computer, Dec 241 Bernoulli Box for Macintosh (B. Webster), Feb 344

Bezier curves, with BASIC program for Texas Instruments Professional Computer (S. Enns),

Dec 225

Binary numbers,

algorithm for extracting nth root from (L. S. Wo),

Nov 115

BIOS, Extended (XBIOS) of Atari ST computers,

Sept 223

Bit-mapped classifier

(P. W. Frey), Nov 161 on house architecture, in BASIC, Nov 166 on political predictions (P. A. Schrodt), Nov 177 Bit Pad Two digitizer, review (E. D. Hearn),

Nov 261

BIZCOMP IntelliModem EXT, Dec 255 Blind users

Braille-Edit talking word processor for, Mar 199 review (H. Brugsch),

Mar 251

workable computing systems for (A. Arditi, A. E. Gillman), Mar 199

Blue Chip financial investment simulation software (E. Shapiro),

Dec 326

Book reviews

Abelson, H., Sussman,

G. J., and Sussman, J. Structure and Interpretation of Computer Programs, Nov 70 Alber, A. F.

Videotex/Teletext: Principles and Practices, Feb 57 Ammeraal, L.

Programming Principles in Computer Graphics,

Dec 68

Andriole, S. J., ed.

Software Validation, Verification, Testing and Documentation (A Source Book), Nov 76

Bentley, J. Programming Pearls, Oct 68 Berry, P. Operating the IBM PC Networks, IBM 26 Busch, D. D. Program Your IBM PC to Program Itself!, IBM 32 Byers, T. J. Inside the IBM PC AT, IBM 26 Campbell, J. Crafting C Tools for the IBM PCs, IBM 34

Chamberlin, H. Musical Applications of Microprocessors,

June 63

Chernicoff, S. Macintosh Revealed, Volume One: Unlocking the Toolbox, Sept 74

Chernicoff, S. Macintosh Revealed, Volume Two: Programming with the Toolbox, Apr 67, Sept 74 Commander, J.

Macintosh Assembly Language

Programming, Sept 74 Critchlow, A. J.

Introduction to Robotics, Jan 57

DeVoney, C. Using PCDOS, IBM 30 Dodge, C., and Jerse,

T. A. Computer Music.Synthesis,

Composition and Performance, June 67 Donnelly, D. P. The Computer Culture, Mar 58 Dreyfus, H. L., and Drefus, S. E. Mind Over Machine, Aug 70 Duncan, R. Advanced MS-DOS, IBM 23 Eggebrecht, L. C.

Interfacing to the IBM Personal Computer,

IBM 26

Fortgang, K. S., ed.

M68000 8-/16-/32-Bit Microprocessors Programmer's Reference Manual, 5th ed.,

Sept 70

Foster, D. L. The Practical Guide to the IBM Personal Computer AT,

IBM 28

Gilburne, M. R.,

Johnston, R. L., and Grogan, A. R., eds.

The Computer Law Annual 1985 , Mar 74 Gust, P. J. Introduction to Machine and Assembly Language

Programming, July 70 Kamin, J. MS-DOS Power User's Guide,

IBM 30

Kelleher, K., and Cross,

T. B. Teleconferencing: Linking People Together, Feb 60 Kelly-Bootle, S., and Fowler, B. 68000, 68010, 68020 Primer, Sept 70 King, R. A. The MS-DOS Handbook, IBM 30 Kogak, H. Differential and Difference Equations Through Computer Experiments, July 63 Lambert, S., and Ropiequet, S., eds. CD ROM: The New Papyrus, Oct 65 Manning, P. Electronic and Computer Music, June 76

McFadden, F. R., and Hoffer, J. A. Data Base Management, Jan 68 Merry, M., ed. Expert Systems 85: Proceedings of the Fifth Technical Conference of the British Computer Society Specialist Group on Expert Systems,

Nov 65

Miller, A. R. Assembly Language Techniques for the IBM PC, IBM 34 Mims, F. M. III. Siliconnections: Coming of Age in the Electronic Era, Feb 74 Mize, R. R., ed. The Microcomputer in Cell and Neurobiology Research, Jan 60 Morse, S. P., and Alpert,

D. J. The 80286 Architecture, IBM 28 Mortimore, E. F. Amiga Programmer's Handbook, Sept 65

Norton, P. The Peter Norton Programmer's Guide to the IBM PC,

Mar 57

Penna, M. A., and Patterson, R. R. Projective Geometry and Its Applications to Computer Graphics, Dec 65 Ramirez, R. W. The FFT: Fundamentals and Concepts, Apr 57 Roads, C., and Strawun,

J., eds. Foundations of Computer Music,

June 70

BORLAND INTERNATIONAL • BYTE LISTINGS

Rochkind, M. J.

Advanced UNIX Programming, Oct 74 Rosenzweig, E., and Harrison, H. Programming the 68000: Macintosh Assembly Language,

Sept 76

Scanlon, L. J. 80286 Assembly Language on MS-DOS Computers,

IBM 36

Schnapp, R. L.

Macintosh Graphics in Modula-2, May 68 Schustack, S. Variations in C, May 63

Schwaderer, W. D. The C Wizard’s Programming Reference, July 66 Shafer, D. Pascal Primer for the Macintosh, Feb 66 Siechert, C., and Wood,

C. The Power of Running PC/DOS, IBM 32

Sisk, J. E., and VanArsdale, S. Exploring the Pick Operating System, Apr 70 Stevens, A. C Development Tools for the IBM PC, IBM 36 Stroustrup, B. The C+ + Programming Language, Aug 63

Szczepanowski, N., and Gunther, B. Atari ST GEM Programmer’s Reference, Sept 78 Takatsuka, J., Bernard,

D. , and Huxham, F. Using the Macintosh Toolbox with C, Sept 76

Thomas, R., Rogers,

L. R., and Yates, J. L. Advanced

Programmer's Guide to UNIX System V,

Aug 68

Triebel, W. A., and Singh,

A. The 68000 Microprocessor: Architecture, Software, and Interfacing Techniques, Sept 74 Troy, D. A. Complete C Language Programming for the IBM PC, IBM 38 Waite, M., Lafore, R., and Lansing, I. Microsoft Macinations, Mar 62 Ward, T. A. Programming C on the Macintosh,

Sept 76

Welsh, J., and Hay, A. A Model Implementation of Standard Pascal,

Dec 70

William, C., and Kane, J. 68000 Microprocessor Handbook: Includes 68008, 68010, & 68020, 2nd ed., Sept 68 Williams, C. S. Designing Digital Filters, Apr 60 Williams, S.

Programming the Macintosh in Assembly Language, Sept 76 Wirth, N. Algorithms and Data Structures, May 74 Wolverton, V. Running MS-DOS, IBM 32

Borland International

Reflex analytical database program from, review (R. DeMaria),

Aug 277

Turbo Editor Toolbox from (E. Shapiro), Mar 297 Turbo Lightning version 1.00A spelling checker from, review (R.

Ramsey), Nov 289 Turbo Pascal from for Macintosh (B.

Webster), Nov 338 version 3.0, review (M. Bridger), Feb 281 Turbo Prolog programming language from (B. Webster), Sept 335

review (N. C.

Shammas), Sept 293 Boxcalc spreadsheet program (E. Shapiro), May 336

Boxes and Arrows

spreadsheet and graphics program (E. Shapiro),

May 335

Braille-Edit talking word processor, Mar 199 review (H. Brugsch), Mar 251

Breakout game, threedimensional version for Amiga (B. Webster), Dec 310

BREAKPT routine for PCDOS DEBUG program, programming of (E.

Batutis), Sept 127

Bridge construction,

computer-aided engineering in. See Engineering, computer-aided

Britain, BYTE reports from.

See U.K., BYTE reports from

Brown & Co. PC-Pedal input device, review (C. H. Pappas), May 285

B-spline curves, with BASIC program for Texas Instruments Professional Computer (S. Enns),

Dec 225

Bulletin board system in

Japanese language (W. M. Raike), Nov 348

Businessoft Mindreader word processor (E. Shapiro), Aug 319

Business systems

Abundance FORTHbased database language for, in public domain (R. Green), Oct 193 Intuitive solution business application generator for (D. Pountain), May 363

BYSO LISP version 1.17, review (W. G. Wong), July 293 BYTE listings on abstract mathematical art, Dec 186 on anagram solving in Pascal, July 113 on assembly routines in MS-FORTRAN programs, IBM 222

on ATOMCC toolbox for solving differential equations, in FORTRAN, Apr 215 on AUTO. OPS implementation of OPS5 programming language, Nov 222 on Badfile utility in C language for CP/M systems, Feb 162 on bit-mapped classifier system

on house architecture, in BASIC, Nov 168 on political predictions, in Turbo Pascal,

Nov 188

on BREAKPT routine for PC-DOS DEBUG program, Sept 127 on calculating impact of nuclear detonations, in BASIC, Dec 152 on Circuit Cellar intelligent serial EPROM programmer, Oct 119 on COLOR3D.BAS program for displaying molecules in color,

Feb 152

on CP/M public domain software, Oct 222

on cyclic redundancy check calculations in C, Sept 120

on debugging program for 8031 in-circuit emulator, July 190 on Decision Support System in Prolog, Nov 201 on DRAGON program in FORTH, Apr 138 on DVORAK.BAS program for studying finger motion in typing, Feb 244

on EDITNET program in LISP, Feb 196 on EditSort capsule editor and Quicksort capsule, Jan 148 on Enhanced Console Driver for user-friendly interface to DOS,

Oct 183

on Euclid's algorithm,

Jan 399

on Expanded Memory Specification EMSDISK driver, IBM 174 on file-indexing program in Turbo Pascal, June 102 on frame-manipulation routines in Prolog,

Jan 238

on freeform curves, with BASIC program for Texas Instruments Professional Computer, Dec 230 on graphing quadric surfaces, with BASIC program for IBM PC,

Dec 224

on Henon mapping in Turbo Pascal, Dec 163 on Hilbert curve program in BASIC, June 138 on Huffman coding for data compression, in Modula-2, May 108 on Icon high-level programming language, Oct 167

on Induce program for extracting knowledge from data, in Turbo Pascal,

Nov 158

on integral approximation with Aitken extrapolation, Dec 113

on interrupt routines for IBM PC in assembly language, IBM 252 on keyed file access in BASIC, Sept 143 on Macintosh Explorer disassembler program in BASIC, Mar 148 on MacView program for transferring Macintosh graphics to IBM PC, in

188 BYTE* 1986 INDEX

C LANGUAGE • CIRCUIT CELLAR

Pascal, June 131 on Mandelbrot program for Amiga, in Lattice C, Dec 208

on Mapper similarity mapping program in BASIC, Aug 92 on Marvin program for teaching computers to learn, in Prolog, Nov 225

on material selection program for construction, in Turbo Pascal, July 235

on memory manipulations for IBM PC, IBM 236 on Microsafe finiteelement-analysis programs, in FORTRAN, July 209 on MIDI programs for IBM PC in C, June 204 in Turbo Pascal,

June 224

on musical fractals, in BASIC, June 185 on operating system functions from Turbo Pascal, Dec 103 on Pan and Reif algorithm for inversion of large matrices, in BASIC, Apr 184 on PD PROLOG, Oct 165 on Performance Index benchmark, IBM 158 on performance programming for IBM PC-compatible products, IBM 194 on physical property estimation programs in BASIC, July 253 on poetry processing program in Pascal,

Feb 225

on polar method for generating normal deviates, in Pascal,

Aug 131

on ProDOS catalog sort routine in BASIC,

June 122

on protected-mode program for IBM PC AT,

IBM 123

on RAM-loadable character sets for IBM PC IBM 198

on Runge-Kutta method for solving differential equations, in FORTRAN,

Apr 196

on shareware, Oct 297 on SIMPL compiler,

Jan 144, Feb 105

on SmarTime code in BASIC, Mar 124 on SPICE program for Commodore 64, July 178 on spreadsheet program in Modula-2, for Macintosh, July 97 on storage allocators, in Modula-2, Oct 123 on stress analysis program for underground mining, in BASIC,

July 222

on subroutine overlays in GW-BASIC, May 153 on text analysis programs for identification of unknown authors,

Feb 238

on three-dimensional graphics programs, in BASIC, Jan 153, Feb 152

on Truss2 bridge-truss analysis program in BASIC, July 145 on Turbo Pascal programs version 3.0,

Feb 286 on Turbo Prolog benchmarks, Sept 295 on Visual Syntax editor in LISP, Feb 144 on Watson deductive reasoning program in Prolog, Nov 214 on write-once database,

May 199

on Z80MU program for emulation of Zilog Z80 and CP/M 2.2, Oct 203

c

C language

ANSI standards on (S. A Hersee, D. Knopoff), Mar 135

Badfile utility in (L.

Baker), Feb 157 BASIC translated into, with CGEN program (D. Pountain), Oct 311 compared to assembly language (T. Hogan), IBM 267

compatibility with UNIX and MC68000 architecture, Sept 192 cyclic redundancy check calculations in, Sept 120 DeSmet C development package (W. M. Raike), June 339 review (J. Robie),

Aug 253

Easy C preprocessor (P.

Orlin, J. Heath),

May 137

Eco-C88 C compiler, review (D. D. Clark),

Jan 307

IBM PC-compatible programs in (J. Rosenblum, D.

Jacobs), IBM 181 Lattice C compiler for Amiga, review (C.

Heath), Nov 271 for IBM PC, version 2.15, review (D. S. Woolston), Feb 273 Let’s C and csd C development package and symbolic debugger, review (W. G. Wong), Aug 267 Lightspeed C development environment for Macintosh (B.

Webster), Aug 323,

Sept 340

Mac C compiler for Macintosh, Apr 318 Mandelbrot program for Amiga in (P. B.

Schroeder), Dec 207 Manx Aztec C68K C compiler for Amiga, review (C. Heath), Nov 271 Megamax C development system for Atari ST (B. Webster),

Nov 326

MIDI programs for IBM PC in, June 204 Mix C compiler for IBM PC, review (R. Grehan), June 257

C+ + object-oriented programming language,

Aug 196

Camera systems in

machine vision (P. Dunbar) Jan 161

Canon A-200 computer system, review (P. V. Callamaras), Jan 293 Capsule editors, for customizing modules in Modula-2 (N. C.

Shammas), Jan 145 Catalog sort routine, in Applesoft BASIC (A. C. Silvestri), June 117 CD-ROM

compared to magnetic disks (B. Zoellick),

May 177

databases available on (N. Desmarais), May 235 development of, May 163

logical format standards on, May 184 new products related to, May 218

software development for (B. Zoellick), May 177 technology of, May 164

Cellular automata,

Dec 181

origins of, Dec 182

Central Point Software

PC Tools version 1.10, review (R. Rabinovitz),

Oct 265

Cermetek Security Modem, Dec 255 CGEN program for translation of BASIC into C (D. Pountain), Oct 311 Character sets for IBM PC, RAM-loadable (R. Wilton), IBM 197 Chebyshev

approximations, Apr 1 74 Chemistry laboratory, automation of (G. W. Kramer, P. L. Fuchs),

Jan 263

CHEMMOD molecular modeling system (D. Pountain), Dec 334

Ciarcla’s Circuit Cellar

(S. Ciarcia) on addition of SCSI to SB 180 computer, May 85, June 107

on analog-to-digital converter, Jan 105 on AVMUX audio-andvideo multiplexer, Feb 85 on data encryptor, Sept 97 on GT180 color graphics board

basic technology of,

Nov 105

hardware of, Dec 87 on intelligent serial EPROM programmer,

Oct 103

on overzealous computer security, Apr 85 on parallel interfacing applications of, Aug 97 introductions to, July 85 on real-time clocks,

Mar 113

CIE Terminals C. Itoh Triprinter Model 20, review (R. D. Swearengin),

Sept 283

C. Itoh TriPrlnter dotmatrix printer, review (R. D. Swearengin), Sept 283 Circuit Cellar projects.

See Ciarcia's Circuit Cellar

Circuit simulation

programs

for Commodore 64 (D.

McNeill), July 170 introduction to (W.

Blume), July 165 SPICE (Simulation Program for Integrated Circuit Engineering),

July 165, July 170

Clocks, real-time (S.

Ciarcia), Mar 113

CLUEDO, Watson deductive reasoning program in Prolog based on(J.-C. Emond, A. Paulissen), Nov 207

Coal mining, stress analysis of tunnels in (D. L. Petersen, S. L. Crouch),

July 219

Codex Corp Model 2233 modem, Dec 255

College education at

home, with Electronic University Network (D. Osgood), Mar 171

Color Fox computer system from Scottsdale Systems, review (J. D. Unger), Jan 301

COLOR3D.BAS program for displaying molecules in color, for IBM PC (J. J. Farrell), Feb 149

COMDEX show of 1986 in Japan (W. M. Raike),

July 371

ComicWorks painting program for Macintosh (E. Shapiro), Dec 321

COMM180 1200-bps modem and SCSI expansion board for SB 180 computer (S. Ciarcia), May 85, June 107

Commodore computers Amiga. See Amiga computer from Commodore Commodore 64 MIDI interfaces for, review (R. Powell, R. Grehan), June 265 SPICE circuit analysis program for (D.

McNeill), July 170 Commodore 128 personal computer, review (W. Wiese Jr.), July 269

Communications

comparison of modems in (S. Satchell), Dec 255

with Datran Modem Accelerator version 1.1 for text transmission, review (B. Nance),

Aug 289

with Enable integrated software package,

Jan 331 with Flash-Corn electronic mail and telecommunications software system, review (B. N. Meeks), Dec 281 with Hayes Smartmodem 2400 (W. M. Raike),

June 339

with Miracle Technology WS3000 modem (D. Pountain), June 319 with Mirror telecommunications program, Apr 329 with Pibterm shareware program, Oct 300 with ProComm shareware program,

Oct 300

Prolog strategy for (L.

Su), Oct 160

with Qmodem shareware program, Oct 300

Compact-disk read-only memory. See CD-ROM

Compaq computers Compaq Deskpro 286 Models 1 and 2, review (S. Miastkowski), June 243

Compaq Deskpro 386, preview (T. Thompson,

D. Allen), Nov 84 Compaq Portable II Model 3, review (S. Miastkowski), Oct 239 Hardcard hard disk for,

May 273

Compilers

in DeSmet C development package (W. M. Raike), June 339 review (J. Robie),

Aug 253

Eco-C88 C compiler, review (D. D. Clark),

Jan 307

in ITC Modula-2 Software Development System, review (M. Bridger),

Oct 255

Lattice C compilers for Amiga, review (C.

Heath), Nov 271 for IBM PC version 2.15, review (D. S. Woolston), Feb 273 in Let’s C and csd development package and symbolic

debugger, review (W. G. Wong), Aug 267 Lightspeed C development environment for Macintosh (B.

Webster), Aug 323,

Sept 340

Mac C compiler for Macintosh, Apr 318 MacLanguage Series Pascal compiler (B. Webster), Feb 340,

Apr 315

Manx Aztec C68K C compiler for Amiga, review (C. Heath), Nov 271 Mix C compiler for IBM PC, review (R. Grehan), June 257

Modula-2 System for Z80 CP/M systems, review (B. R. Anderson),

Mar 225

PIE (Prolog Inference Engine) editor and compiler (S. Y. i

Blackwell), Oct 164 SIMPL

extensions of (J.

Amsterdam), Feb 103 procedures and functions of (J. Amsterdam),

Jan 131

TDI Modula-2/ST compiler (B. Webster),

Feb 332

Turbo Prolog (N. C.

Shammas), Sept 293 ZBasic interactive BASIC compiler, review (T. J. Byers), May 265

Computex show of 1986 in Taiwan (W. M. Raike),

Oct 307

ConcertWare+ music software for Macintosh, review (M. S. Bernardo),

June 273

Concurrency, in

multiprocessing operating systems, May 114

Conquest Turbo PC computer, review (J. D. Unger), July 289

Console Utility command syntax, Oct 185

Consulair Mac C compiler version 4.01, Apr 318

Construction, computeraided engineering in. See Engineering, computeraided

Convertible IBM PC,

description of (G. M. Vose), IBM 83

Coprocessors

coprocessor accelerator boards for IBM PC,

IBM 144 Definicon 68020 coprocessor (T. Marshall, C. Jones, S. Kluger),

July 120, Aug 108

Coral Software Object Logo object-oriented language for Macintosh,

Aug 184

Cotton Software Boxcalc program (E. Shapiro),

May 336

CP/M operating systems

Badfile utility for (L.

Baker), Feb 157 best of BIX on, Oct 338 public domain software for(B. N. Meeks), Oct 219 Z80 based. See Z80based CP/M systems

CRC (cyclic redundancy check) calculation, programming project (G. Morse), Sept 115

Cruise Control cursor control program (E. Shapiro), Nov 361

Cryptography

background information on, Sept 98 Circuit Cellar data encryptor (S. Ciarcia),

Sept 97

glossary on, Sept 111

Crystal change enhancing IBM PC AT performance,

IBM 209

CTS-Fabri-Tek modems,

Dec 255

Cursor control with Cruise Control program (E.

Shapiro), Nov 361

Curves

free-form, with BASIC program for Texas Instruments Professional Computer (S. Enns), Dec 225 Hilbert curve program in BASIC, June 138

CWare DeSmet C development package (W. M Raike), June 339 review (J. Robie), Aug 253

Cyclic redundancy check

(CRC) calculation, programming project (G. Morse), Sept 115

190 BYTE* 1986 INDEX

DAC-EASYWORD • DISPLAYS

Dac-Easy Word word processor (E. Shapiro),

July 381

Daisy-wheel printer, IBM

Wheelprinter E, review (R. D. Swearengin), July 315

Dallas Semiconductor

SmartWatch real-time clock, Mar 118

Dark Castle game for Macintosh (E. Shapiro),

Dec 327

DASCH external RAM disk for Macintosh (B. Webster), June 353

Data

compression with Huffman coding (J. Amsterdam), May 99 design principles in organization of files (L. Shapiro), Apr 129 encryption background information on, Sept 98 with Circuit Cellar data encryptor (S. Ciarcia), Sept 97

glossary on, Sept 111 entry, digitizers for, comparison of (E. D.

Hearn), Nov 261 flow in functional programming (C. Hankin,

D. Till, H. Glaser),

May 123

handling conflicts in, with decision support system in Prolog (C. Y. Cuadrado,

J. L. Cuadrado), Nov 193 ID3 algorithm for extracting knowledge from (B. Thompson, W. Thompson), Nov 149 protection of, with tape backup systems, May 227 Oct 243

recovery and restoration of, with Norton Utilities, PC Tools and Super Utility programs, comparison of (R. Rabinovitz), Oct 265 structures in objectoriented programming,

Aug 142 Database

Abundance Forth-based database language, in public domain (R.

Green), Oct 193 in coin-operated terminals in Japan (W. M. Raike), Nov 347

data design principles in organization of (L. Shapiro), Apr 129 Enable integrated software package for management of,

Jan 331

filePro 16 and filePro 16 Plus database management software, review (R. Harkness),

Nov 297

Instant Recall Database manager (E. Shapiro),

Oct 297

on optical disks (N.

Desmarais), May 235 Paradox 1.1 relational database program, review (R. DeMaria), Sept 303 Reflex analytical database program, review (R. DeMaria), Aug 277 Data Show of 1985 in Japan, highlights of (W. M. Raike), Feb 317

Datatek Datatext word processor (E. Shapiro),

July 383

Data Translation

DT2801 board from, software interfacing packages for (P. Wirth,

L. E. Ford), July 303 PCLAB software from,

July 303

Datran Modem Accelerator version 1.1, review (B.

Nance), Aug 289

Dayna Communications

MacCharlie Macintosh accessory, review (L. Crockett), Feb 262

dBASE III Plus software (E. Shapiro), June 330

Debugging

with 8031 in-circuit emulator (G. Dinwiddie),

July 181

with Advanced Trace86 assembler/debugger (B. Webster), Oct 293 with Let’s C and csd C development package and symbolic debugger, review (W G. Wong), Aug 267 of Macintosh applications (J. West), Dec 127 with Metascope program for Amiga (B. Webster),

Nov 334

of optical disks, May 198 codes used in (S. W Golomb), May 203 with PC-DOS DEBUG program and BREAKPT

routine (E. Batutis),

Sept 127

with Professional Debug Facility and Advanced Fullscreen Debug programs, comparison of (J. C. Carden), Apr 249 Decimals, repeating, converted to fractions (R. T. Kurosaka), Jan 397

Decision support system in Prolog (C. Y. Cuadrado,

J. L. Cuadrado), Nov 193 Deductive reasoning with Watson program in Prolog (J.-C. Emond, A.

Paulissen), Nov 207

Definicon 68020

coprocessor hardware and operating system of(T. Marshall, C. Jones, S. Kluger),

July 120

kernel functions of,

July 142

software for (T. Marshall,

C. Jones, S. Kluger),

Aug 108

DEGAS painting software for Atari 520ST (B. Webster), Apr 320

Deluxe Paint program for Amiga, Apr 322

Deskpro computers from Compaq

model 286, review (S.

Miastkowski), June 243 model 386, preview (T. Thompson, D. Allen),

Nov 84

DeSmet C development package (W. M. Raike),

June 339

for Macintosh, review (J. Robie), Aug 253 DevpacST 68000 assembly language development package (B. Webster), Nov 330 Differential equations ATOMCC toolbox method for solving, in FORTRAN (Y. F.

Chang), Apr 215 Runge-Kutta method for solving, Apr 216 in BASIC (D. M. Leo),

Apr 196 in FORTRAN (B.

Thomas), Apr 191

Digi-Pad 5 digitizer for data entry, review (E. D. Hearn),

Nov 261

Digital music synthesis (R. A. Moog), June 155 with Kurzweil 250 Digital Synthesizer, review (C. Morgan), June 279 with Macintosh (C.

Yavelow), June 171 Digital Research GEM (Graphics Environment Manager)

in Atari ST computers (M.

Rothman), Sept 223 and GEM Draw painting program, review (R. Birmele), May 269

Digital typography with TeX typesetting system,

Feb 206

Knuth interview on (G. M. Vose, G. Williams),

Feb 169

Digitizers for data entry, comparison of (E. D. Hearn), Nov 261

Diophantine equations

(R. T. Kurosaka), Mar 343 DirectoryDemo program,

Dec 103

Disabilities

in hearing impairment. Kurzweil Voice Writer in (R. Kurzweil), Mar 177 in motion impairment, robotic aids in (K. G. Engelhardt, R.

Edwards), Mar 191 in speech impairment, semantic compaction system in (B. R. Baker),

Mar 160

in visual impairment assembling workable computing system in (A. Arditi, A. E. Gillman),

Mar 199

Braille-Edit talking word processor in,

Mar 199, 251

Disassembler program

for Macintosh, Macintosh Explorer, programming of (O. Andrade), Mar 145

Disks

compact-disk read-only memory. See CD-ROM hard. See Hard disks magnetic, compared to compact-disk read-only memories (B. Zoellick),

May 177

optical. See Optical disks Displays gas-plasma, of Panasonic Exec. Partner transportable computer, Apr 231

1986 INDEX •BYTE 191

DOT-MATRIX PRINTERS • EXPERTELLIGENCE

size and shape of characters in, with RAMloadable character sets for IBM PC (R. Wilton), IBM 197

Dot-matrix printers

C. Itoh Triprinter, review (R. D. Swearengin), Sept 283

Fujitsu DL2400 24-pin, review (R, D. Swearengin), Nov 255

GE 3-8100, review (R. D.

Swearengin), May 293 Lettrix resident print processor used with, review (A. R. Miller),

May 299

Nissho NP-2410 24-pin, review (R. D. Swearengin), Nov 255

Toshiba P321 24-pin, review (R. D. Swearengin), Nov 255

DRAGON program for Macintosh, in Forth (B. R. Land), Apr 137

DS-AP MIDI interface for

Apple II computers, review (R. Powell, R. Grehan),

June 265

DSC-64 MIDI interface for

Commodore 64, review (R. Powell, R. Grehan),

June 265

DSI-020 coprocessor board from Definicon Systems

hardware and operating system of (T. Marshall, C. Jones, S. Kluger),

July 120

software for (T. Marshall,

C. Jones, S. Kluger),

Aug 108

Dvorak keyboard layout, efficiency of (D. W. Olson,

L. E. Jasinski), Feb 241

DynaMac Japanese version of Macintosh,

Jan 382

Dynamic load balancing

in parallel computing systems (D. Pountain),

July 368, Sept 359

Dynamic Master Systems

TOPSI 2.0 programming language for IBM PC, review (L. Moskowitz),

Aug 261

E

Easy C preprocessor (P.

Orlin, J. Heath), May 137 Easy word processor from MicroPro (E. Shapiro),

Mar 300

Echo speech synthesizers from Street Electronics, Mar 199,

Mar 251, Mar 261

Ecosoft Eco-C88 C compiler

review (D. D. Clark),

Jan 307

update on, Jan 314

EDITNET program (J. Pollack), Feb 196

EditSort capsule editor,

Jan 148

Education at home, with Electronic University Network (D. Osgood),

Mar 171

Elderly, robotic aids increasing independence of (K. G. Engelhardt, R. Edwards), Mar 191

Electronic Arts software for Amiga (B. Webster),

Apr 322

Instant Music program (B. Webster), Dec 308

Electronic mail, with Flash-Corn electronic mail and telecommunications software system, review (B. N. Meeks), Dec 281

Electronic University Network (D. Osgood),

Mar 171

EM/3 + software from Megasoft, May 329

Emulation

with emulator accelerators for IBM PC, IBM 150

of EPROM with Emulo-8 (S. R. Ball), Apr 105 of Intel 8031 processor, construction of emulator board for(G.

Dinwiddie), July 181 of Zilog Z80 and CP/M 2.2 with Z80MU program (R. A. Baumann),

Oct 203

Emulo-8 EPROM emulator, construction of (S. R. Ball), Apr 105

Enable integrated software package

version 1.0, review (S.

King), Jan 331

version 1.1 (R. Malloy),

Jan 334

Encryption of data

background information on, Sept 98 with Circuit Cellar data encryptor (S. Ciarcia), Sept 97

glossary on, Sept 111

Engineering, computeraided

with 8031 in-circuit emulator (G. Dinwiddie), July 181

with circuit simulation programs

for Commodore 64 (D.

McNeill), July 170 introduction to (W.

Blume), July 165 SPICE (Simulation Program for Integrated Circuit Engineering), July 165,170 finite-element analysis method in, July 145,148 on IBM PC (R. W. Johnson, F. G.

Loygorri), July 199 in Truss2 bridge-truss analysis program,

July 145

as issue theme (G. M.

Vose), July 163 with material selection program in Turbo Pascal (T. Sawyer, M. Pecht),

July 235

with physical property estimation programs (J. N. Stone), July 253 with stress analysis program for underground mining (D. L. Petersen,

S. L. Crouch), July 219 with Truss2 bridge-truss analysis program in BASIC (C. Pedicini), July 145 with U-MAN 1000 computer (D. Pountain), Dec 329

England BYTE reports. See U K. BYTE reports

Enhanced Console Driver, for user-friendly interface to DOS (A.

Zackin), Oct 183

EPROM programmers

Circuit Cellar intelligent serial EPROM programmer, construction of (S.

Ciarcia), Oct 103 Emulo-8 EPROM emulator, construction of (S. R. Ball), Apr 105

Model 1409 from B&C Microsystems, review (R. Jacobs), May 279

Epson computers

Equity I, review (J. D.

Unger), Nov 239 Equity III, review (W.

Rash Jr.), Dec 239 Equity I computer, review (J. D. Unger), Nov 239 Equity III computer, review (W. Rash Jr.),

Dec 239

Eratosthenes Sieve benchmark. See Benchmarks Error detection and correction. See Debugging

Euclid’s algorithm (R. T. Kurosaka), Jan 397, Mar 343

Exec. Partner

transportable computer from Panasonic, review (R. Malloy), Apr 231

Exhibits and shows

COMDEX show of 1986 in Japan (W. M. Raike), July 371

Computex show of 1986 in Taiwan (W. M. Raike), Oct 307

Data Show of 1985 in Japan, Feb 317 Microcomputer Show of 1986 in Tokyo (W. M. Raike), Sept 351 Software Show of 1985 in Japan, Feb 317 West Coast Computer Faire of 1986 (B. Webster), Aug 323

Expanded Memory Specification

AST Research, IBM 170 Lotus/Intel/Microsoft (R. Duncan), IBM 169

ExperCommonLISP object-oriented language for Macintosh, Aug 180

ExperOPS5 expert-system programming language for Macintosh, review (W. Jacobs), July 297

ExperTelligence

ExperCommonLISP object-oriented language for Macintosh from,

Aug 180

ExperOPS5 expertsystem programming language for Macintosh from, review (W. Jacobs), July 297

192 BYTE • 1986 INDEX

EXPERT SYSTEMS • GRAPHICS

G

Expert systems

knowledge representation in. See Knowledge representation OPS5 programming language of. See OPS5 programming language

Explorer disassembler program for Macintosh, programming of (O. Andrade), Mar 145

F

Federalist papers, text analysis programs identifying author of (J. Tankard), Feb 231

Ffle(s)

with bad sectors or tracks, Badfile utility for identification and location of (L. Baker),

Feb 157 compression of with Datran Modem Accelerator version 1.1, review (B. Nance),

Aug 289

with Huffman coding (J. Amsterdam), May 99 data design principles in organization of (L. Shapiro), Apr 129 Getspec assembly language routine for passing filenames to compiled BASIC (B. Hubanks), Nov 119 indexes of records in in keyed access method in BASIC, Sept 138

programming project on, in Pascal (B. Webster), June 93 keyed access to data in, in BASIC (S. C. Perry),

Sept 137

ProDOS catalog sort routine for locating entries in (A. C. Silvestri),

June 177

Q&A software package for management of, preview, Jan 120 recovery and restoration of, with Norton Utilities, PC Tools and Super Utility programs, comparison of (R. Rabinovitz), Oct 265

transmission of, with Datran Modem Accelerator version 1.1, review (B. Nance), Aug 289

FilePro 16 and filePro 16 Plus database management software, review (R. Harkness), Nov 297 Finite-element analysis technique, July 145, 148 on IBM PC (R. W Johnson, F Q I oygorri) July 199

in Truss2 bridge truss analysis program,

July 145

Flnot Group KeepTrack Plus softwaro (I Shapiro), June 334

First Class Peripherals

Sider hard disk drive, review (D. E. Hall), Jan 319 Flag testing using 2" property, programming insight (R. C. Arp Jr.),

Oct 145

Flash-Corn electronic mail and telecommunications software system, roviow (B. N. Meeks), Dor 281

Floating-point operations, approximations In (S I Moshier), Apr 1(31

FM-168 computer from Fujitsu, upgrade of (W M Raike), Aug 329

FM-16* portable computer from Fujitsu(W M Italke),

Jan 384, Mar 330

Fonts

for Macintosh (IV Webstor), Fob 340 METAFONT typesetting system, Feb 169, 211 for non-Latin scripts Feb 204

Footmou8e Input device, review (C. H Pappas),

May 285

Forbln Project Qmodem shareware program (l Shapiro), Oct 300

Forth

Abundance database language based on, In public domain (It Green), Oct 193 DRAGON program lor Macintosh in(B It I and)

Apr 137 object-oriented extensions of (D.

Pountain), Aug 227

in queue simulation program, Aug 230

fortran

assembly routines in MSFORTRAN programs (M. Dahmke), IBM 217 ATOMCC toolbox for solving differential equations in (Y. F. Chang), Apr 215 integral approximation with Aitken extrapolation in, Dec 113

Microsafe finite-element analysis programs in,

July 209

Runge-Kutta method for solving differential equations in (B.

Thomas), Apr 191 Fractals, musical (C.

Dodge, C. R. Bahn),

June 185

Fractions, conversion of repeating decimals to (R. T. Kurosaka), Jan 397

Framework II software (E.

Shapiro), Apr 331 Franklin ACE 2200

computer, review (A. S. Woodhull), Sept 263

Free-form curves, with BASIC program for Texas Instruments Professional Computer (S. Enns),

Dec 225

FREQUENCY ANALYZER

programs for identifying unknown authors,

Feb 232

FT-60 tape backup unit, review (M. C. Rubel),

Oct 243

Fujitsu

DL2400 24-pin dotmatrix printer, review (R. D. Swearengin),

Nov 255

FM-16B computer upgrade (W. M. Raike),

Aug 329 FM-16x portable computer (W. M. Raike),

Jan 384, Mar 330 FullPaint program for Macintosh (E. Shapiro),

Sept 368

Functional programming,

data-flow in (C. Hankin, D.

Till, H. Glaser), May 123

Games

Animal Game in Smalltalk, Aug 153 for Atari ST (B. Webster), Dec 312

Balance of Power game (E. Shapiro), Mar 299, Dec 322

Dark Castle game for Macintosh (E. Shapiro) Dec 327

number-sequence games in BASIC (R. T. Kurosaka), Aug 333 three-dimensional Breakout game for Amiga (B. Webster), Dec 310 Gas-plasma display, of Panasonic Exec. Partner transportable computer Apr 231

GEM from Digital Research in Atari ST computers (M.

Rothman), Sept 223 and GEM Draw painting program, review (R. Birmele), May 269 General Computer HyperDrive 2000 computer (B. Webster), Nov 323 General Electric GE 38100 printer, review (R. D. Swearengin), May 293 Getspec assembly language routine for passing filenames to compiled BASIC (B. Hubanks),

Nov 119

Glossaries

on Amiga animation,

Sept 246

on data encryption,

Sept 111

on image processing technology, Mar 110 on SCSI bus

implementation of SB 180 computer, June 112 on video, Jan 168

GP-7 and GP-8 digitizers for data entry, review (E. D. Hearn), Nov 261

Graphics

abstract mathematical art, in BASIC (K. E. Perry), Dec 181

with Amiga computer and Aegis Animator and Images animation and painting programs (W. Block),

Nov 285

1986 INDEX - BYTE 193

GRAPHICS CARD PLUS • HAYES

animation software for (E. A. Ditton, R. A. Ditton), Sept 241 and Deluxe Paint program, Apr 322 and Mandelbrot program in Lattice C (P. B. Schroeder),

Dec 207

and ROM Kernel,

Feb 116

with Atari 520ST and DEGAS painting software, Apr 320

book reviews related to,

Dec 65

with Circuit Cellar GT180 color graphics board and SB180 computer basic technology of (S.

Ciarcia), Nov 105 hardware of (S.

Ciarcia), Dec 87 with GEM Draw and MacDraw painting programs, comparison of (R. Birmele), May 269 with Henon mapping program in Pascal (G. Hughes), Dec 161 with Hercules Graphics Card Plus, review (R. Malloy), Dec 249 with IBM PC best of BIX on, Dec 385

and Boxes and Arrows program, May 335 and MacView program (M. Anacker), June 131 and Mandelbrot program in Turbo Pascal (D. Pountain), Sept 359

as issue theme (C.

Weston), Dec 159 with Macintosh and DRAGON program in Forth(B. R. Land), Apr 137 transferred to IBM PC with MacView program (M. Anacker),

June 131

with Mandelbrot program for Amiga in Lattice C (P. B. Schroeder),

Dec 207

for IBM PC in Turbo Pascal (D. Pountain), Sept 359

quadric surfaces in, with BASIC program (G. Haroney), Dec 215 with Texas Instruments Professional Computer, and BASIC program

on free-form curves (S. Enns), Sept 225 with Texas Instruments TMS34010 Graphics System Processor (C. R. Killebrew Jr.),

Dec 193

three-dimensional,

BASIC program for (H. Mittelbach), Jan 153 for molecules in color (J. J. Farrell), Feb 149 on quadric surfaces (G. Haroney), Dec 215

Graphics Card Plus from Hercules, review (R. Malloy), Dec 249

Graphics System Processor, Texas Instruments TMS34010 (C. R. Killebrew Jr.),

Dec 193

Great Wbve Software

ConcertWare-f music program for Macintosh, review (M. S. Bernardo), June 273

GT180 color graphics board for SB180 computer basic technology of (S.

Ciarcia), Nov 105 hardware of (S. Ciarcia),

Dec 87

GTCO Corp digitizer for data entry, review (E. D. Hearn), Nov 261

Guru integrated software package, review (E. R. Tello), Aug 281

GW-BASIC, subroutine overlays in (M. Carmichael), May 151

H

Hammerlab Lettrix resident print processor, review (A. R. Miller),

May 299

Hamming code for optical disk error correction (S. W. Golomb), May 203

Hardcard hard disk, review (E. White), May 273

Hard disks

Hardcard, review (E.

White), May 273 MacBottom for Macintosh, June 348 MicroBotics MAS-20 hard disk drive for Amiga (B. Webster), Dec 306 Sider for Apple II

computers, review (D. E. Hall), Jan 319 tape backup systems for comparison of (A.

Antonuccio), May 227 hardware reviews (M. C. Rubel), Oct 243 Hardware of 8031 in-circuit emulator (G. Dinwiddie), July 181

in Circuit Cellar projects.

See Ciarcia’s Circuit Cellar of Definicon 68020 coprocessor (T. Marshall, C. Jones, S. Kluger),

July 120

of Emulo-8 EPROM emulator (S. R. Ball),

Apr 105

IBM PC accelerator boards (S. S. Fried),

IBM 141

increasing speed of IBM PC AT (B. K. Roemmele), IBM 209

of Lotus/Intel/Microsoft Expanded Memory Specification (R.

Duncan), IBM 169 Macintosh Plus memoryexpansion kits, comparison of (C. Crawford, T. Thompson), Nov 250

memory management units for 68000 architectures (G. Zehr),

Nov 127 of micro-based supercomputer (N. H. Christ, A. E. Terrano),

Apr 145

in MIDI interface for IBM PC, construction project (J. Kubicky), June 199 reviews (R. Powell, R. Grehan), June 265 reviews. See Hardware reviews in robotics in automation of chemistry laboratory (G. W. Kramer, P. L. Fuchs), Jan 263 in tactile sensing (K. E.

Pennywitt), Jan 172 in vision system (P. Dunbar), Jan 161 Texas Instruments TMS34010 Graphics System Processor (C. R. Killebrew Jr.),

Dec 193

Hardware reviews

on Advantage! multifunction board for IBM PC AT (T. J. Byers), Jan 327 on B&C Microsystems Model 1409 EPROM Programmer (R. Jacobs), May 279 on C. Itoh TriPrinter Model 20 (R. D. Swearengin), Sept 283 on Commodore 128 personal computer (W. Wiese Jr.), July 269 on Datran Modem Accelerator version 1.1 for text transmission (B. Nance), Aug 289 on digitizers for data entry (E. D. Hearn), Nov 261

on Fujitsu DL2400 dotmatrix printer (R. D. Swearengin), Nov 255 on GE 3-8100 printer (R. D. Swearengin), May 293

on Hardcard hard disk (E. White), May 273 on Hercules Graphics Card Plus (R. Malloy), Dec 249

on IBM Wheelprinter E (R. D. Swearengin), July 315

on Kurzweil 250 Digital Synthesizer (C. Morgan), June 279

on MIDI Interfaces (R. Powell, R. Grehan), June 265

on modems (S. Satchell), Dec 255

on Nissho NP-2410 dotmatrix printer (R. D. Swearengin), Nov 255 on non-keyboard input devices (C. H. Pappas), May 285

on Printit printer interface card (H. Brugsch, J. J. Lazzaro), Mar 261 on Sider hard disk drive (D. E. Hall), Jan 319 on tape backup units (M. C. Rubel), Oct 243 on Toshiba P321 dotmatrix printer (R. D. Swearengin), Nov 255 on Turner Hall Card for IBM PC memory expansion (J. Angel). Sept 287

Hayes Microcomputer Products

Smartmodem 1200,

Dec 255

194 BYTE • 1986 INDEX

HEARING-IMPAIRED PERSONS • IBM PC

Smartmodem 2400, June 339, Dec 255 Hearing-Impaired persons, Kurzweil Voice Writer for (R. Kurzweil), Mar 177

Henon mapping, Dec 170

with Pascal (G. Hughes), Dec 161

Hercules Graphics Card Plus, review (R. Malloy), Dec 249

Hermes real-time multiprocessing system, Modula-2 in development of (R. C. Corbeil, A. H. Anderson), May 111

HERMIES robot, Jan 233 Hewlett-Packard in

Japan, Vectra-D DualMode Workstation from (W. M. Raike), Sept 351 High-Performance Systems Stella program (E. Shapiro), May 335 review (S. B. Robinson), Dec 277

Hilbert curve program, in

BASIC (M. Ackerman), June 137

HIPAD digitizer for data entry, review (E. D.

Hearn), Nov 261

HiSoft DevpacST 68000 assembly language development package (B. Webster), Nov 330 Hochstrasser Computing AG, Modula-2 System for Z80 CP/M from, review (B. R. Anderson),

Mar 225

Holland bit-mapped classifier (P. W. Frey)

Nov 161

on house architecture, in BASIC, Nov 166 on political predictions, in Pascal (P. A. Schrodt), Nov 177

Home security system,

overzealous (S. Ciarcia),

Apr 85

Homebound computing

in aging, with robotic aids (K. G. Engelhardt, R. Edwards), Mar 191 in blindness, factors considered in (A.

Arditi, A. E. Gillman),

Mar 199

with Electronic University Network (D. Osgood),

Mar 171

in hearing impairment, with Kurzweil Voice Writer (R. Kurzweil),

Mar 177

as issue theme (J M Tazelaar), Mar 153 in speech impairment, semantic compaction system in (B. R.

Baker), Mar 160 and telecommuting (J. M. Tazelaar),

Mar 155

Houston Instrument Corp. digitizer for data entry, review (E D. Hearn), Nov 261

Huffman coding for data compression (J. Amsterdam), May 99

HyperDrive 2000

computer from General Computer Company (I \ Webster), Nov 323

l

IBM

best of BIX on, Fob 378, Mar 384, Apr 371, May 405, June 383 personal computer from See IBM PC Professional Debug Facility from, review (J. C. Carden), Apr 249 Wheelprinter I from, review (R. I)

Swearengin),

July 315 IBM PC

abstract mathematic alart with BASIC program for(K. E. Perry), l)n< 181 Abundance Forth based databann language for, In public domain (R Green),

Oct 193

accelerator boards for (S. S f nod), IBM 14 I Actor object-oriented programming language for (C. B. Duff),

Aug 211

address ordering in (A. R. Miller), IBM 233 Advantage! multifunction board for PC AT, review (T. J. Byers),

Jan 327

Arity/Prolog version 3 2 for, review (W. G.

Wong), Mar 245 assembly language

interrupt routines for (W. J. Claff). IBM 249 Balance of Power game for (E. Shapiro),

Dec 322

best of BIX on, July 403, Aug 351, Sept 398, Oct 333, Nov 390,

Dec 362, IBM 288 book reviews related to IBM 24

Boxes and Arrows program for, May 335 BYSO LISP version 1.17 for, review (W. G. Wong), July 293 CGEN program for translating BASIC intoC for (D. Pountain),

Oct 311

circuit simulation programs for, July 170 COLOR3D.BAS program for displaying molecules in color with (J. J. Farrell), Feb 149 and compatible products. See IBM PCcompatible products Convertible model, description of (G. M. Vose), IBM 83 Datran Modem Accelerator version 1.1 for, review (B. Nance), Aug 289

Definicon Systems 68020 coprocessor board for (T. Marshall, C. Jones,

S. Kluger), July 120,

Aug 108

Enable integrated software package for, review (S. King),

Jan 331

Enhanced Console Driver for user-friendly interface to DOS of (A. Zackin), Oct 183 filePro 16 database management software for, review (R. Harkness), Nov 297

Flash-Corn electronic mail and telecommunications software for, review (B. N. Meeks), Dec 281 Gl M Draw painting program for, review (R. Birmele), May 269 graphics with, best of BIX on, Dec 385 graphing quadric surfaces on, with BASIC program (G. Haroney),

Dec 215

Guru integrated software

package for, review (E. R. Tello), Aug 281 Hardcard hard disk for, review, (E. White),

May 273

Henon mapping with Turbo Pascal program for (G. Hughes), Dec 161 Hercules Graphics Card Plus for, review (R. Malloy), Dec 249 increasing speed of PC AT (B. K. Roemmele),

IBM 209

benchmarks on (E. White), IBM 212 Induce program for extracting knowledge from data for, in Turbo Pascal, Nov 158 input devices for, nonkeyboard, review (C. H. Pappas), May 285 Intuitive Solution business application generator for (D.

Pountain), May 363 ITC Modula-2 version for, review (M. Bridger),

Oct 255

Japanese-language word processing on (W. M. Raike), Aug 330 Kaypro 286i compared to PC AT (H. Krause),

Mar 217

keyed file access method for, in BASIC (S. C.

Perry), Sept 137 Lattice 8086/8088 C compiler version 2.15 for, review (D. S.

Woolston), Feb 273 Lettrix resident print processor for, review (A. R. Miller), May 299 Lotus Manuscript word processor for, preview (G. A. Stewart), Nov 91 MacView program for transferring Macintosh graphics to (M.

Anacker), June 131 Mandelbrot program in Turbo Pascal for (D. Pountain), Sept 359 memory of adjusting size of (R.

Miller), IBM 243 AST Enhanced Expanded Memory Specification for expansion of,

IBM 170

Lot us/I ntel/M icrosof t Expanded Memory Specification for expansion of (R.

Duncan), IBM 169

1986 INDEX •BYTE 195

IBM PC-COMPATIBLE PRODUCTS • INDEXES

manipulation of (A. R.

Miller), IBM 233, 243 memory management unit of RT PC (R. S. Simpson), IBM 143 Turner Hall Card for expansion of, review (J. Angel), Sept 287 Microsoft Word version 3.0 word processor for, review (M. C. Rubel),

Oct 261

microTSP time-series analysis program version 4.1 for, Apr 257 and MIDI interface hardware construction and software for (J. Kubicky), June 199 hardware reviews (R. Powell, R. Grehan),

June 265

Turbo Pascal software for (D. Swearingen), June 211

Mix C compiler for, review (R. Grehan),

June 257

muLISP-86 programming language for, review (R. J. Schalkoff), Oct 249 NewWord 3 word processor for, review (J. Heilborn, N. Reel),

Aug 273

Norton Utilities, PC Tools and Super Utility software for, comparison of (R. Rabinovitz), Oct 265 Paradox 1.1 relational database program for, review (R. DeMaria),

Sept 303

Pascal packages for, comparison of (N. C. Shammas), Dec 265 PC-DOS DEBUG program and BREAKPT routine for (E. Batutis),

Sept 127

PCT e X and MicroT^X typesetting packages for, review (H. R. Varian), Apr 267

Pocket APL for, review (E. H. Johnson),

Mar 237

Professional Debug Facility and Advanced Fullscreen Debug programs for, review (J. C. Carden), Apr 249 protected mode program for PC AT (R. P. Nelson), IBM 123

Racter program for, review (H. Kenner),

May 289

RAM-loadable character sets for (R. Wilton),

IBM 197 Reflex analytical database program for, review (R. DeMaria), Aug 277

with RT processor (R. O.

Simpson), IBM 43 Software Carousel virtual memory manager for, review (M. Haas),

Sept 299

SPSS/PC + analytical software package for, review (J. M. Jacques), Nov 279

Strike spelling checker for, review (R. Ramsey), Nov 289

structural analysis procedures on with finite-element technique (R. W. Johnson, F. G. Loygorri), July 199 with Truss2 bridgetruss analysis program (C. Pedicini), July 145

tape backup units for, review (M. C. Rubel), Oct 243 three-dimensional graphics program for, in BASIC, Jan 153 for molecules in color,

Feb 149

on quadric surfaces,

Dec 215

TOPSI 2.0 programming language for, review (L. Moskowitz), Aug 261 Turbo Lightning spelling checker for, review (R. Ramsey), Nov 289 Turbo Prolog programming language for (B. Webster),

Sept 335 review (N. C. Shammas), Sept 293 Waltz LISP version 5.01 for, review (W. G. Wong), July 293 Watson deductive reasoning program in Prolog for, Nov 214 WordPerfect 4.1 word processor for, review (R. Birmele), Sept 311 Z80MU program for emulation of Zilog Z80 and CP/M 2.2 for (R. A. Baumann),

Oct 203

IBM PC-compatible products

Apricot XEN computer,

Apr 311

best of BIX on, June 383, July 403, Aug 361,

Sept 398, Oct 333, Nov 390, Dec 362, IBM 288 Canon A-200 computer system, review (P. V. Callamaras), Jan 293 Compaq Deskpro 286 computer, review (S. Miastkowski),

June 243

Compaq Deskpro 386 computer, preview (T. Thompson, D. Allen),

Nov 84

Compaq Portable II computer, review on Model 3 (S.

Miastkowski), Oct 239 Conquest Turbo PC computer, review (J. D. Unger), July 289 developing software for (J. Rosenblum, D. Jacobs), IBM 181 Epson Equity I computer, review (J. D. Unger),

Nov 239 Epson Equity III computer, review (W.

Rash Jr.), Dec 239 ITT XTRA XP computer, review (J. D. Unger),

July 281

Kaypro PC, review (J. D.

Unger), Nov 239 Leading Edge Model D PC computer, review (S. Miastkowski), Sept 269 MacCharlie accessory for Macintosh providing access to (L. Crockett), Feb 262

Multitech MPF-PC/700 D1 computer, review (J. D. Unger), Nov 239 NCR PC6 computer, review (A. Little),

Aug 241

Panasonic Exec. Partner transportable computer, review (R. Malloy), Apr 231 Scottsdale Systems Color Fox computer system, review (J. D. Unger),

Jan 301

Sperry PC/IT, review (F. D. Davis), Aug 247 at Taiwan Computex show of 1986 (W. M. Raike), Oct 307

TeleVideo Tele-286 Model 2 computer, review (W. Rash Jr.), June 251

Western AT computer, review (W. Rash Jr.), Dec 239

Xerox 6060 computer, review (W. Rash Jr.), Sept 275

Zenith Z-241 computer, review (W. Rash Jr.), Dec 239

Zenith Z-248 computer, review (W. Rash Jr.), Dec 239

Icon high-level programming language (R. E. Griswold, M. T. Griswold), Oct 167

Iconic user interface

in object-oriented programming (B. Cox, B. Hunt), Aug 161 performance of (J. Uebbing, C. Young), Aug 176

in semantic compaction system (B. R. Baker), Mar 160

ID3 algorithm for

extracting knowledge from data (B. Thompson, W. Thompson), Nov 149

ifCOM7 laptop portable computer from Oki (W. M. Raike), July 371

ILS laboratory interfacing software package,

July 303

Image-processing

technology glossary on, Mar 110 in locating Titanic (M. Spalding, B. Dawson), Mar 97

Images

in iconic user interface, Aug 161, 176 in semantic compaction system (B. R. Baker), Mar 160

Images painting program

for Amiga, review (W. Block), Nov 285

INCOMM Data Systems Rainbow 1200SA modem, Dec 255

Indexes

on magazine and newspaper articles, on optical disks, May 236 on records in files in keyed access method, in BASIC, Sept 138

196 BYTE* 1986 INDEX

INFORMATION ACCESS COMPANY • KEYBOARDS

programming project on, in Pascal (B. Webster), June 93

Information Access Company Info Tract magazine and newspaper index (J. Dorner), May 236 Infostructures PopDrop program (E. Shapiro), Nov 362

Info Tract magazine and newspaper index (J. Dorner), May 236

Inmos Transputer (D.

Pountain), July 363 Meiko Computing Surface based on (D. Pountain), July 364

Inner Loop Software

Boxes and Arrows program (E. Shapiro), May 335

Input comparison using 2" property, programming insight on (R. C. Arp Jr.), Oct 145

Input devices, nonkeyboard, review (C. H. Pappas), May 285 Instant Music program for Amiga (B. Webster),

Dec 308

Integral approximation

with Aitken extrapolation (D. M. Smith), Dec 113

Integrated software

packages

Enable

version 1.0 (S. King), Jan 331

version 1.1 (R. Malloy), Jan 334

Guru, review (E. R. Tello), Aug 281

Works, for Macintosh (E. Shapiro), Nov 365

Intel

8031 processor, construction of emulator board for in-circuit emulation of (G. Dinwiddie), July 181 80286 processor,

IBM 112 in Apricot XEN computer, Apr 305 in IBM PC AT,

IBM 112, 123 in Kay pro 286i computer, Mar 217 in micro-based supercomputer (N. H. Christ, A. E.

Terrano), Apr 145 program using native code of (R. P. Nelson), IBM 123 protected mode of, IBM 112,123 80287 processor, in micro-based supercomputer (N. H. Christ, A. E. Terrano), Apr 145 80386 processor,

Nov 88

architecture of (P. Wells), IBM 89 Compaq Deskpro 386 computer based on, Nov 84

paging with, IBM 89, 111

segmentation with,

IBM 89, 111 systems implications of (B. Nicholls), IBM 98 virtual memory with, IBM 89, 111 Lotus/Intel/Microsoft Expanded Memory Specification (R. Duncan), IBM 169 Intelligent Assistant of Q&A software package, Jan 120

Intelligent Digitizers,

review (E. D. Hearn),

Nov 261

Intelligent serial EPROM

programmer, construction of (S. Ciarcia), Oct 103 Interface Technologies Corporation Modula-2 Software Development System, review (M. Bridger), Oct 255 Interfacing laboratory interfacing software packages, review (P. Wirth, L. E. Ford), July 303 machine language routine to Pascal (J. Feldman), Sept 145 MIDI (musical instrument digital interface) specifications in. See MIDI specifications parallel

applications of (S. Ciarcia), Aug 97 introduction to (S. Ciarcia), July 85 with Printit serial/parallel printer interface card (H. Brugsch, J. J.

Lazzaro), Mar 261 with user. See User interface

Interlace database program (E. Shapiro),

May 336

Interrupt routines for

IBM PC

in assembly language (W. J. Claff), IBM 249 in BREAKPT routine for PC-DOS DEBUG program (E. Batutis), Sept 127

Intuitive Solution

business application generator (D. Pountain),

May 363

Invention Software

Pascal Extender program for Macintosh (B. Webster) July 350

Inversion of large matrices, with Pan and Reif algorithm (T. E. Phipps Jr.), Apr 181

Iomega Corporation Mac

Bernoulli Box, Feb 344 ISM Surgeon surgery simulation program (E. Shapiro), Dec 322 It Figures spreadsheet program (E. Shapiro),

July 381

ITC Modula-2, review (M. Bridger), Oct 255

ITT XTRA XP computer, review (J. D. Unger),

July 281

J

Japan, BYTE reports from (W. M. Raike) on coin-operated database service,

Nov 347

on COMDEX show of 1986 in Japan,

July 371

on Data Show of 1985, Feb 317 on DeSmet C development package, June 339

on DynaMac Japanese version of Macintosh, Jan 382

on EM/3+ software from Megasoft, May 329 on FM-16ir computer upgrade, Aug 329 on FM-16x portable computer, Jan 384 Mar 330

on Hayes Smartmodem 2400, June 339 on Japanese-language bulletin board system, Nov 348

on Japanese-language word processing on IBM PC, Aug 330 on Keystyle 80 keyboard and laptop computer, Oct 309

on Mind Japanese programming language, Mar 327 on NEC PC-9801 VM2E personal computer, Nov 347

on NEC PC-9801 VM4 personal computer, July 372

on NEC upgrades of PC 9801 series, Jan 381 on Oki ifCOM7 laptop portable computer, July 371

on Software Show of 1985, Feb 317 on Taiwan Computex Show of 1986, Oct 307 on Tokyo Microcomputer Show of 1986, Sept 351 on Vectra-D Dual-Mode Workstation, Sept 351 on Yamaha Piano Player, Sept 351

Japanese language

bulletin board system in (W. M. Raike), Nov 348 word processing on IBM PC in (W. M. Raike),

Aug 330

K

KAMASOFTKAMAS

outline processor, review (A. S. Woodhull), Apr 241 Kaypro computers Kaypro 10, MixC Compiler for, review (R. Grehan), June 257 Kaypro 286i, review (H.

Krause), Mar 217 Kaypro PC, review (J. D. Unger), Nov 239

KeepTrack Plus software (E. Shapiro), June 334

Keyboards

efficiency of Dvorak and QWERTY layouts (D. W. Olson, L. E. Jasinski), Feb 241

Keystyle 80 keyboard and laptop computer (W. M. Raike), Oct 309

1986 INDEX • B YTE 197

KEYED FILE ACCESS • LOTUS DEVELOPMENT CORPORATION

Keyed file access in

BASIC (S. C. Perry),

Sept 137

Keystyle 80 keyboard and laptop computer (W. M. Raike), Oct 309

Knowledge

representation

in bit-mapped classifier system (P. W. Frey),

Nov 161

on house architecture, in BASIC, Nov 166 on political predictions, in Pascal (P. A.

Schrodt), Nov 177 handling data conflicts in, with decision support system in Prolog (C. Y. Cuadrado, J. L. Cuadrado), Nov 193 ID3 algorithm for extracting knowledge from data (B. Thompson, W. Thompson), Nov 149 as issue theme (C.

Baskin), Nov 147 in Marvin program for teaching computers to learn, in Prolog (A. T. Kolokouris), Nov 225 in OPS5 (Official Production System version 5) programming language (L. Moskowitz), Nov 217

in Watson program for deductive reasoning, in Prolog (J.-C. Emond,

A. Paulissen), Nov 207

Knuth, Donald, interview with (G. M. Vose, G.

Williams), Feb 169

Krlya Systems Neon object-oriented language for Macintosh, Aug 179

Kurzweil

250 Digital Synthesizer, review (C. Morgan),

June 279

Voice Writer (R. Kurzweil),

Mar 177

Kyocera International

KM1200S modem, Dec 255

L

Laboratories

LabView Laboratory Virtual Instrument Engineering

Workbench programming

environment for, preview (G. M. Vose, G. Williams), Sept 84 robotic automation of, for organic chemistry research (G. W.

Kramer, P. L. Fuchs),

Jan 263

software interfacing packages for, review (P. Wirth, L. E. Ford),

July 303

Laboratory Technologies

Labtech Notebook software, July 303

LABPAC laboratory interfacing software package, July 303

Labtech Notebook

laboratory interfacing software package,

July 303

LabView Laboratory Virtual Instrument Engineering Workbench, preview (G. M. Vose, G. Williams), Sept 84

Languages

Abundance FORTHbased database language, in public domain (R. Green), Oct 193

Actor object-oriented programming language (C. B. Duff), Aug 211 Ada, best of BIX on,

Nov 405

assembly. See Assembly language BASIC. See BASIC C. See C language FORTH. See FORTH FORTRAN. See FORTRAN

functional, data-flow in (C. Hankin, D. Till, H. Glaser), May 123 Icon high-level programming language (R. E. Griswold, M. T. Griswold), Oct 167 interfacing machine language routine to Pascal (J. Feldman), Sept 145 of KAMAS outline processor, Apr 241 LISP. See LISP language Mind Japanese programming language (W. M. Raike), Mar 327 Modula-2. See Modula-2 natural

parallel interpretation of(J. Pollack, D. L. Waltz), Feb 189

of Q&A software package, Jan 120 in object-oriented programming on Macintosh (K. J.

Schmucker), Aug 177 with Smalltalk (T.

Kaehler, D. Patterson), Aug 145

Occam (D. Pountain),

July 363, Sept 359 dynamic load balancing in (D. Pountain), July 368, Sept 359

OPS5 (Official Production System version 5) programming language (L. Moskowitz), Nov 217 AUTO.OPS implementation of,

Nov 222 ExperOPS5 implementation of, for Macintosh (W.

Jacobs), July 297 TOPSI 2.0

implementation of, for IBM PC (L.

Moskowitz), Aug 261 PAL (Paradox Application Language), Sept 303 Pascal. See Pascal Pocket APL, review (E. H. Johnson), Mar 237 Prolog. See Prolog SIMPL (J. Amsterdam),

Jan 131, Feb 103 SNOBOL4, processing strings in (J. F. Gimpel), Feb 175

Lap-size portable computers. See Portable computers

Laser disks, databases available on (N. Desmarais). May 235

Laser printers, LaserWriter Plus, June 88

LaserWriter Plus laser printer, June 88

Lattice Inc.

Amiga C compiler from, review (C. Heath),

Nov 271

Mandelbrot program using (P. B. Schroeder), Dec 207

IBM PC C compiler from, review (D. S. Woolston), Feb 273

Screen Editor program editor for Amiga from (B. Webster), July 352

Leading Edge Model D PC computer, review (S. Miastkowski), Sept 269

Let’s C and csd C

development package and symbolic debugger, review (W. G. Wong),

Aug 267

Lettrix resident print processor, review (A. R. Miller), May 299

Levco Prodigy 4 computer (B. Webster), Nov 323

Levien BYSO LISP version 1.17, review (W. Wong),

July 293

Lifetree Software

Volkswriter 3 program (E. Shapiro), June 332

Light Pen input device, review (C. H. Pappas),

May 285

Lightspeed C

development environment for Macintosh (B.

Webster), Aug 323, Sept 340

LISP language BYSO LISP version 1.17 implementation of, review (W. Wong), July 293 EDITNET program in,

Feb 196

muLISP-86 LISP development system, review (R. J. Schalkoff), Oct 249

Visual Syntax editor for programming in (R. Levien), Feb 135 Waltz LISP version 5.01 implementation of, review (W. Wong), July 293

Living Videotext

More outline processor for Macintosh from,

Sept 367, Dec 316 Ready! memory-resident outline processor from,

Mar 297

Logitech LogiMouse C7 (E. Shapiro), Dec 324

Lotus Development Corporation

Lotus/Intel/Microsoft Expanded Memory Specification (R.

Duncan), IBM 169 Manuscript word processor from, preview (G. A. Stewart), Nov 91

198 BYTE • 1986 INDEX

MACAPP • MASS STORAGE

M

MacAPP object-oriented application framework for Macintosh (K. J. Schmucker), Aug 189 programming experience with, Aug 200

MacBottom Macintosh hard disk (B. Webster), June 348

Mac C C compiler version 4.01 for Macintosh (B. Webster), Apr 318

MacCharlie Macintosh accessory from Dayna Communications, review (L. Crockett), Feb 262 MacDraw painting program, review (R. Birmele), May 269

MacFORTH, DRAGON program in (B. R. Land), Apr 137

Machine language

routine, interfaced to Pascal (J. Feldman), Sept 145 Machine learning with Marvin program in Prolog (A. T. Kolokouris),

Nov 225

Macintosh computer 512K-byte version of (B.

Webster), Nov 323 Acta outline processor for (B. Webster), Dec 316 Bernoulli Box for (B. Webster), Feb 344 best of BIX on, Feb 388,

Mar 392, Apr 376, May 414, June 387, July 407, Aug 354, Sept 404, Oct 335, Nov 394,

Dec 370

ComicWorks painting program for (E. Shapiro), Dec 321

compared to Atari and Amiga computers (B. Webster), Mar 305,

May 343

ConcertWare+ and SongPainter programs for, review (M. S.

Bernardo), June 273 Dark Castle game for (E. Shapiro), Dec 327 DASCH external RAM disk for (B. Webster),

June 353

debugging programs on (J. West), Dec 127 DeSmet C Development Package for, review

(J. Robie), Aug 253 digital music synthesis on (C. Yavelow), June 171 with Kurzweil 250 Digital Synthesizer (C. Morgan), June 279

DRAGON program for, in Forth (B. R. Land), Apr 137

DynaMac Japanese version of, Jan 382 ExperOPS5 expert system programming language for, review (W. Jacobs), July 297 Explorer disassembler program for, programming of (O. Andrade), Mar 135

fonts for (B. Webster), Feb 340

Interlace database program for (E. Shapiro), May 336

LabView Laboratory Virtual Instrument Engineering Workbench for, preview (G. M. Vose, G Williams), Sept 84 Lightspeed C development environment for (B. Webster), Aug 323, Sept 340 MacApp object-oriented application framework for (K. J. Schmucker),

Aug 189 programming experience with,

Aug 200

MacBottom hard disk lor (B. Webster), June 348 Mac CC compile m version 4.01 for (B Webster), Apr 318 MacCharlie accessory for, review (l Crockett),

Feb 262

MacDraw painting program for, review (ft Birmele), May 269 MacPaint program for graphics on, transferred to IBM PC wilt) MacVitw program (M Anacker),

June 131 Mapper similarity mapping program for, In BASIC (R. Spencer),

Aug 85

mass storage devices for, benchmark tests on,

June 354

MIDI interfaces for, hardware reviews (R Powell, R. Grehan),

June 265

More outline processor for, Sept 367, Dec 316 object-oriented languages for (K. J. Schmucker), Aug 177 Pascal compilers for (B. Webster), Feb 340, Apr 315

Pascal Extender software for (B. Webster), July 350 Plus version of (B. Webster), Nov 323 compared to Atari and Amiga computers (B. Webster), May 343

description of (P.

Robinson), June 85 memory expansion kits for, comparison of (C. Crawford, T. Thompson), Nov 250 system review (C. Crawford), Nov 247 spreadsheet program in Modula-2 for, programming project on (J. Amsterdam),

July 97

Stella program for,

May 335 review (S. B.

Robinson), Dec 277 Surgeon surgery simulation program for (E. Shapiro), Dec 322 system calls of, compared to Amiga (A. B. Webber), Sept 249 Talking Moose public domain desk accessory for (B. Webster), Dec 310

three-dimensional graphics program for, in BASIC, Jan 153 Turbo Pascal for (B.

Webster), Nov 338 Works integrated software package for (E. Shapiro), Nov 365

MacLanguage Series

Pascal compiler from TML Systems (B. Webster),

Feb 340, Apr 315

Macmillan Software

ASYST program, July 303 MacPaint program for Macintosh graphics, transferred to IBM PC with MacView program (M. Anacker), June 131 MacView program, for transferring Macintosh

graphics to IBM PC (M. Anacker), June 131

Magazine index on optical disks, May 326

Magnetic disks

compared to CD-ROM (B. Zoellick), May 177 and tape backup systems (A. Antonuccio), May 227

Mail, electronic, with Flash-Corn electronic mail and telecommunications software system, review (B. N. Meeks), Dec 281 Mandelbrot program for Amiga in Lattice C (P. B. Schroeder),

Dec 207

for IBM PC in Turbo Pascal (D. Pountain),

Dec 359

Manuscript word processor from Lotus, preview (G. A. Stewart),

Nov 91

Manx Aztec C68K C

compiler for Amiga, review (C. Heath), Nov 271

Mapper similarity mapping program for Macintosh, in BASIC (R. Spencer),

Aug 85

Mapping

Henon, Dec 170 with Pascal (G.

Hughes), Dec 161 similarity, with Mapper program for Macintosh (R. Spencer), Aug 85 Mark Williams Company Let’s C and csd C development package and symbolic debugger, review (W. G. Wong), Aug 267

Marvin program in Prolog, teaching computers to learn (A. T. Kolokouris), Nov 225

MAS-20 hard disk drive for Amiga (B. Webster), Dec 306 Mass storage and CD-ROM software development (B. Zoellick), May 177

evolution of (L. Laub),

May 161

as issue theme (K.

Sheldon), May 159 on optical disks. See Optical disks and tape backup systems (A. Antonuccio), May 227

1986INDEX • BYTE 199

MATERIAL SELECTION • MICROSOFT

hardware reviews (M. C. Rubel), Oct 243 Material selection in

construction with MSP program in Turbo Pascal (T. Sawyer, M. Pecht). July 235 with physical property estimation programs in BASIC (J. N. Stone),

July 253

Mathematics

abstract mathematical computer graphics with BASIC program (K. E. Perry), Dec 181 approximating integrals with Aitken extrapolation (D. M. Smith), Dec 113 ATOMCC toolbox method for solving differential equations, in FORTRAN (Y. F. Chang), Apr 215 computer approximations in, Apr 191,196,216,

Dec 113

Chebyshev, Apr 174 speed and precision of (S. L. Moshier), Apr 161 conversion of repeating decimals to fractions (R. T. Kurosaka), Jan 397 in cyclic redundancy check calculations (G. Morse), Sept 115 Diophantine equations in (R. T. Kurosaka), Mar 343 Euclid’s algorithm in (R. T. Kurosaka), Jan 397, Mar 343

extracting /7th root from binary numbers (L. S. Wo), Nov 115

Henon mapping with Pascal (G. Hughes),

Dec 161

laws of, in programming (C. A. R. Hoare), Aug 115 with Mandelbrot program for Amiga in Lattice C (P. B. Schroeder),

Dec 207

for IBM PC in Turbo Pascal (D. Pountain), Sept 359 with micro-based supercomputer (N. H. Christ, A. E. Terrano),

Apr 145

and musical fractals (C. Dodge, C. R. Bahn),

June 185

and number crunching as issue theme (T. Clune), Apr 143

number-sequence games in BASIC (R. T. Kurosaka), Aug 333 Pan and Reif algorithm for inversion of large matrices (T. E. Phipps Jr.), Apr 181 Pellian equation in (R. T.

Kurosaka), May 379 plotting equations in three dimensions, with BASIC program (G. Haroney), Dec 215 polar method for generating normal deviates (A. Latour),

Aug 131

probability analysis programs on sucker bets (R. T. Kurosaka), Nov 373

Runge-Kutta method for solving differential equations, Apr 216 in BASIC (D. M. Leo),

Apr 196 in FORTRAN (B.

Thomas), Apr 191 time-series analysis in,

Apr 262 with microTSP program version 4.1 (P. Davenport), Apr 257 whole-number solutions to equations in (R. T. Kurosaka), Mar 343

Matrices, large, Pan and Reif algorithm for inversion of (T. E. Phipps Jr.), Apr 181

Megamax C development system for Atari ST (B. Webster), Nov 326

Megasoft EM/3+ software, May 329

Meiko Computing Surface (D. Pountain), July 364

Memory

Access Associates Alegra Memory Expansion Box for Amiga (B. Webster), Dec 305

Amiga ROM Kernel, introduction to(R. J.

Mical), Feb 116 compact disk-read only memory. See CD-ROM DASCH external RAM disk for Macintosh (B. Webster), June 353 of EPROM programmers.

See EPROM programmers of IBM PC

adjusting size of (A. R.

Miller), IBM 243 AST Enhanced Expanded Memory Specification for

expansion of, IBM 170 Lotus/Intel/Microsoft Expanded Memory Specification for expansion of (R. Duncan), IBM 169 manipulation of (A. R.

Miller), IBM 233, 243 memory management unit of RT PC (R. S. Simpson), IBM 143 Turner Hall Card for expansion of. review (J. Angel), Sept 287 of Macintosh Plus, memory expansion kits for (C. Crawford, T. Thompson), Nov 250 mass storage as issue theme (K. Sheldon),

May 159. See also Mass storage Motorola 68000 architecture memory management units (G. Zehr), Nov 127 packed-pixel organization of, Dec 200 programming of storage allocators in Modula-2 (J. Amsterdam), Oct 123 RAM-loadable character sets for IBM PC (R. Wilton), IBM 197

virtual (J. Shiell), IBM 111 with Intel 80386 CPU,

IBM 89, 111 Software Carousel virtual memory manager (M. Haas),

Sept 299

Memory management units

in IBM RT PC (R. S.

Simpson), IBM 43 for Motorola 68000 family of processors (G. Zehr), Nov 127

Message passing

procedures in Modula-2,

May 115

Metacomco Tripos

operating system (D. Pountain), Feb 321

Metadigm Metascope debugger (B. Webster),

Nov 334

METAFONT typesetting system, Feb 169, 211

Metascope debugger for Amiga (B. Webster), Nov 334

Meta Ware Professional Pascal version 2.5, review (N. C. Shammas), Dec 265

Methods version of Smalltalk language, programming experience with, Aug 206

MEX114.COM public domain communications program, Oct 220

MichTron Atari 520ST software (B. Webster),

Apr 318

MicroBotics MAS-20 hard disk drive for Amiga (B. Webster), Dec 306

Micro Data Base Systems

Guru integrated software package, review (E. R.

Tello), Aug 281

Microelectronic technology in Soviet Union (P. Walton), Nov 137

Microgrid digitizers,

review (E. D. Hearn),

Nov 261

MicroPro International

Easy word processor from, Mar 300 WordStar 2000 Release 2 software from (E. Shapiro), June 329

Microsafe series of finiteelement analysis programs, July 208

Microshop Computer Products Conquest Turbo PC computer, review (J. D. Unger), July 289

MicroSmiths TxEd program editor for Amiga (B. Webster), Nov 336

Microsoft

BASIC

Macintosh Explorer disassembler program in, Mar 145 Mapper similarity mapping program for Macintosh in (R. Spencer), Aug 85 subroutine overlays in (M. Carmichael),

. May 151

translated into C, with CGEN program (D. Pountain), Oct 311 Lotus/Intel/Microsoft Expanded Memory Specification (R.

Duncan), IBM 169 MS-DOS. See MS-DOS MS-FORTRAN, assembly routines in (M. Dahmke), IBM 217

MS-Pascal version 3.31, review (N. C. Shammas), Dec 265

200 BYTE • 1986INDEX

MICROTEX • MPF-PC/700 D1

Windows on Apricot XEN computer, Apr 309 Word 3.0 word processor (E. Shapiro), Aug 322 review (M. C. Rubel),

Oct 261

Works integrated software package for Macintosh (E. Shapiro), Nov 365

MicroTgX typesetting package, review (H. R. Varian), Apr 267

MicroTSP time-series regression package, version 4.1, review (P.

Davenport), Apr 257

MIDI (musical instrument digital interface) specifications, June 145,

172, 199

hardware reviews related to (R. Powell, R. Grehan), June 265 for IBM PC

hardware construction and software for (J. Kubicky), June 199 hardware reviews (R. Powell, R. Grehan),

June 265

Turbo Pascal software tools for (D.

Swearingen),

June 211

of Kurzweil 250 Digital Synthesizer, June 279 MIDIMAC MIDI interface for Macintosh, hardware review (R. Powell, R.

Grehan), June 265 Mind Japanese programming language (W. M. Raike), Mar 327 Mindreader word processor (E. Shapiro),

Aug 319

Mindscape

Balance of Power game (E. Shapiro), Mar 299,

Dec 322

ComicWorks painting program (E. Shapiro),

Dec 321

Racter program, review (H. Kenner), May 289 Mining, underground, stress analysis of tunnels in (D. L. Petersen, S. L.

Crouch), July 219 Miracle Technology WS3000 modem (D.

Pountain), June 319

Mirror telecommunications program (E. Shapiro),

Apr 329

Mix C compiler for IBM PC, review (R. Grehan),

June 257

MM digitizers for data entry, review (E. D. Hearn), Nov 261

Models. See Simulation Modems comparison of (S.

Satchell), Dec 255 Datran Modem Accelerator version of 1.1 for text transmission, review (B. Nance),

Aug 289

Hayes Smartmodem 2400 (W. M. Raike),

June 339

Miracle Technology WS3000 modem (D. Pountain), June 319 Modula-2 creating reusable modules in (N. C. Shammas), Jan 145 Hochstrasser system for Z80 CP/M system (B. R. Anderson), Mar 225 Huffman coding programs for data compression in,

May 108 from Interface Technologies Corporation, review (M. Bridger),

Oct 255

spreadsheet program for Macintosh in, programming project on (J. Amsterdam),

July 97

storage allocators in (J.

Amsterdam), Oct 123 as systems programming language (R. C. Corbeil,

A. H. Anderson),

May 111

TSI Modula-2/ST compiler (B. Webster),

Feb 332

Modules, reusable, creation of (N. C. Shammas), Jan 145

Modulo 2 division, in

calculation of cyclic redundancy checks (G. Morse), Sept 115

Molecules displayed in color

withCHEMMOD molecular modeling system (D. Pountain),

Dec 334

with COLOR3D.BAS program for IBM PC (J. J. Farrell), Feb 149

Monitors, red-green-blue, COLOR3D.BAS program for displaying molecules in color on (J. J. Farrell),

Feb 149

More outline processor

for Macintosh, Sept 367,

Dec 316

Morgan Computing

Advanced Trace86/ assembler/debugger (B. Webster), Oct 293

Motherboard accelerators for IBM PC, IBM 156

Motion-Impaired persons, robotic aids increasing

independence of (K. G. Engelhardt, R. Edwards),

Mar 191

Motion In robotics

and autonomous robot navigation (C. Jorgensen, W. Hamel, C. Weisbin),

Jan 223

and coordination of multiple manipulators (J. S. Hawker, R. N.

Nagel, R. Roberts, N. G. Odrey), Jan 203

Motorola

68000 processor in Amiga computer,

Oct 231. See also Amiga computer from Commodore and animation software for Amiga (E. A. Ditton,

R. A. Ditton), Sept 241

architecture and Unix compatibility of (A. L. Rood, R. C. Cline,

J. A. Brewster),

Sept 179

assembly language programming guidelines for (M.

Morton), Sept 163 in Atari computers, Jan 84. See also Atari computers compared to other 68000-series processors (T. L.

Johnson), Sept 205 comparison of Macintosh, Atari, and Amiga computers based on (B. Wbbster),

Mar 305, May 343

HiSoft DevpacST 68000 assembly language

development package, Nov 330

as issue theme (G. M.

Vose), Sept 161 in Macintosh, Mar 305, May 343. See also Macintosh computer memory management units for (G. Zehr),

Nov 127

and sound system of Amiga (D. D. Thiel),

Oct 139

and system calls of Amiga and Macintosh (A. B. Webber),

Sept 249

and TOS operating system of Atari ST computers (M. Rothman), Sept 223 VME/10 system based on, review (R. E. Robinson III),

Feb 253

68008 processor, compared to other 68000series processors (T. L. Johnson), Sept 205 68010 processor in AT&T UNIX PC,

May 254

compared to other 68000-series processors (T. L. Johnson), Sept 205 of VME/10 system,

Feb 253

68012 processor compared to other 68000series processors (T. L. Johnson), Sept 205 68020 processor compared to other 68000-series processors (T. L. Johnson), Sept 205 in Definicon 68020 coprocessor (T.

Marshall, C. Jones,

S. Kluger), July 120,

Aug 108

68881 floating-point chip in Definicon 68020 coprocessor, July 120 VME/10 system, review (R. E. Robinson III),

Feb 253

MoU80

of AT&T UNIX PC,

May 254

Logitech LogiMouse C7 (E. Shapiro), Dec 324 MPF-PC/700 D1 computer, review (J. D.

Unger), Nov 239

MPU-401 MIDI INTERFACE • OPCODE SYSTEMS

MPU-401 MIDI interface

for IBM PC hardware review (R.

Powell, R. Grehan),

June 265

Turbo Pascal programs for (D. Swearingen), June 211

MS Associates CGEN program for translating BASIC into C (D.

Pountain), Oct 311

MS-DOS

Arity/Prolog version 3.2 for, review (W. G. Wong), Mar 245

best of BIX on, IBM 312 comparison of PCT^X and MicroT^X typesetting packages for (H. R. Varian), Apr 267 Eco-C88 C compiler for, review (D. D. Clark),

Jan 307

EM/3-f programs running under, May 329 of IBM PC-compatible products, developing software for (J. Rosenblum, D. Jacobs), IBM 181 Mirror

telecommunications program for, Apr 329 PD PROLOG public domain implementation of Prolog for (R. Morein),

Oct 155

muLISP-86 LISP development system, review (R. J. Schalkoff), Oct 249

Multiprocessing operating systems, May 114 Modula-2 in development of Hermes system (R. C. Corbeil, A. H.

Anderson), May 111

Multitasking

with Amiga ROM Kernel,

Feb 116

with Intel 80386 CPU (P. Wells), IBM 89

Multitech Electronics

MPF-PC/700 D1 computer, review (J. D. Unger),

Nov 239

Multi-Tech Systems

modems, Dec 255

Music, computer on Amiga (D. D. Thiel),

Oct 139

with Instant Music program (B. Webster),

Dec 308

book reviews related to, June 63

digital synthesizers in, overview on (R. A. Moog), June 155

fractals in (C. Dodge,

C. R. Bahn), June 185 on IBM PC and MIDI interface

hardware construction project and software for (J. Kubicky), June 199

hardware reviews (R. Powell, R. Grehan), June 265

Turbo Pascal software tools for (D. Swearingen),

June 211 as issue theme (R.

Grehan), June 143 with Kurzweil 250 Digital Synthesizer, review (C. Morgan), June 279 on Macintosh with ConcertWare+ and SongPainter programs (M. S. Bernardo), June 273 with digital music synthesis (C. Yavelow), June 171

with MIDI interfaces, hardware reviews (R. Powell, R. Grehan),

June 265

MIDI specifications in.

See MIDI specifications software for, overview on (R. Powell), June 145 with Yamaha Piano Player (W. M. Raike),

Sept 351

N

National Instruments

LabView Laboratory Virtual Instrument Engineering Workbench, preview (G. M. Vose, G. Williams), Sept 84

Natural language

parallel interpretation of (J. Pollack, D. L. Waltz), Feb 189 of Q&A software package. Jan 120 Navigation of robots, autonomous (C. Jorgensen, W. Hamel, C. Weisbin),

Jan 223

NCR

5380 SCSI bus-interface chip, added to SB 180 computer (S. Ciarcia), May 85, June 107 PC6 computer, review (A. Little), Aug 241

NEC

PC-9801 VM2E personal computer (W. M. Raike), Nov 347

PC-9801 VM4 personal computer (W. M. Raike), July 372

upgrades of PC-9801 series (W. M. Raike),

Jan 381

Neon object-oriented language for Macintosh,

Aug 179

NewStar Software

NewWord 3 word processor, review (J. Heilborn, N.

Reel), Aug 273

New Sweep public domain file maintenance program, Oct 219

NewWord 3 word processor, review (J. Heilborn, N. Reel), NtAwq&f&r index on

optical disks, May 236

Nippon. See NEC

NisshoNP-2410 24-pin dot-matrix printer, review (R. D. Swearengin),

Nov 255

Norton Utilities version 3.1, review (R. Rabinovitz), Oct 265

Novation Smart-CAT Plus modem, Dec 255

Nuclear weapons, BASIC programs calculating impact of(J. R. Fanchi), Dec 143

NULU151.COM public domain library utility,

Oct 220

Numbers. See

Mathematics

Numonics digitizers for

data entry, review (E. D. Hearn), Nov 261

o

Object Assembler objectoriented language for Macintosh, Aug 182

Object Logo object

oriented language for Macintosh, Aug 184

Object-oriented

programming

Actor language in (C. B.

Duff), Aug 211 best of BIX on, Aug 357 data structures in,

Aug 142

elements of (G. A.

Pascoe), Aug 139 in Forth (D. Pountain),

Aug 227

queue simulation program, Aug 230 iconic user interfaces in (B. Cox, B. Hunt), Aug 161 performance of (J. Uebbing, C. Young), Aug 176

improving efficiency of (C. B. Duff), Aug 211 interviews with programmers on (L. Tesler), Aug 195 as issue theme (E. White,

R. Malloy), Aug 137 with MacApp application framework (K. J. Schmucker), Aug 189 on Macintosh (K. J.

Schmucker), Aug 177 pseudovariables in,

Aug 144

software-ICs in, reusable (B. Cox, B. Hunt), Aug 161 syntax and design of Smalltalk language for (T. Kaehler, D. Patterson),

Aug 145

Object Pascal objectoriented language for Macintosh, Aug 177

Objective-C objectoriented language for Macintosh, Aug 182 programming experience with, Aug 202

Occam language (D.

Pountain), July 363,

Sept 359

dynamic load balancing , in (D. Pountain), July 368, Sept 359

Okl ifCOM7 laptop portable computer (W. R. Raike), July 371

Omni Computer Systems

Flash-Corn electronic mail and telecommunications software system, review (B. N. Meeks), Dec 281

OmniTel 1200 modem,

Dec 255

Opcode Systems

MIDIMAC MIDI interface for

202 BYTE* 1986 INDEX

OPERATING SYSTEMS • PC-9801 VM4

Powell, R. Grehan),

June 265

Operating systems

AmigaDOS, development of (D. Pountain), Feb 321 Apple ProDOS, catalog sort routine for (A. C. Silvestri). June 117 CP/M. See CP/M operating systems of Definicon 68020 coprocessor (T. Marshall, C. Jones, S. Kluger),

July 120

EM/3 + operating system unification adapter,

May 329

MS-DOS. See MS-DOS multiprocessing,

May 114 Modula-2 in

development of Hermes system (R. C.

Corbeil, A. H. Anderson), May 111 PC-DOS

DEBUG program and BREAKPT routine for (E. Batutis),

Sept 127

PD PROLOG public domain implementation of Prolog for (R.

Morein), Oct 155 Professional Debug Facility and Advanced Fullscreen Debug programs for, review (J. C. Carden),

Apr 249

TOS operating system of Atari ST computers (M. Rothman), Sept 223 Tripos system from Metacomco (D. Pountain), Feb 321 UNIX

compatibility with Motorola MC68000 architecture (A. L.

Rood, R. C. Cline, J. A. Brewster), Sept 179 security features of (A. Filipski, J. Hanko),

Apr 113

System V version 2, in AT&T UNIX PC,

May 254

user-friendly interface to, with Enhanced Console Driver (A. Zackin), Oct 183 using DOS functions from Turbo Pascal (D. F. Yriart), Dec 103

OPS5 (Official Production System version 5) programming language (I Moskowitz), Nov 217 AUTO.OPS implementation of,

Nov 222 ExperOPS5 Implementation of, for Macintosh (W.

Jacobs), July 297

Optical disks, May 218

development of, May 162 error correction in,

May 198

codes used ln(S. W. Golomb), May 203 Info Tract magazine and newspaper Index on(J. Droner), May 236 now products related to (R Malloy), May 215 mad only, databases available on (N.

I )onmsralfi), May 235 write once, May 215 programming with (J II Duludo), May 193 Optimized Systems Softwere Per* ional Pascal for Alan SI computers(B. Webster), July 347

Orpheus program for poetry pro< nv.ing, Feb 221 Outline processors Act, for Macintosh (B Webstar), Dec 316 KAMAS, review (A. S.

Woodhulf), Apr 241 More, for Macintosh,

Sept 367, De< no PC 0utline(l Shapiro),

May 336 Readyl, Mai 207

P

Packed-pixel memory

organization, I )e< .*()<)

Paging with Intel IK) 188 CPU, IBM 89, ill

Painting program**

Aegis lmag»n pfngram for Amiga, review (W. Block), Nnv 2118 ComicWorks program for Macintosh (I Shapiro), Dec 321

comparison of (it M Draw and Ma< I )raw programs(II Itirmnle) May 269

FullPaint program lur Macintosh, trnrmlorim! s. IBM PC with Mac View

program, June 131

PAL (Paradox Application Language) programming language, Sept 303

Pan and Reif algorithm

for inversion of large matrices (T. E. Phipps Jr.), Apr 181

Panasonic Exec. Partner

transportable computer, review (R. Malloy),

Apr 231

Paradox Application Language, Sept 303

Paradox 1.1 relational database program, review (R. DeMaria), Sept 303 Parallel processing applications of (S. Ciarcia), Aug 97 dynamic load balancing in (D. Pountain), July 368, Sept 359 introduction to (S. Ciarcia), July 85 Parameter passing, with assembly routines in MSFORTRAN programs (M. Dahmke), IBM 217 Pascal

anagram solving in (E. Keefer), July 113 best of BIX on, Sept 409,

IBM 288 compared to ITC Modula-2 (M. Bridger),

Oct 255

file-indexing program in,

June 96

Henon mapping with (G.

Hughes), Dec 161 Holland classifier in, on political predictions,

Nov 188

for IBM PC, comparison of versions of (N. C. Shammas), Dec 265 Induce program for extracting knowledge from data in, for IBM PC,

Nov 158

interfacing machine language routine to (J. Feldman), Sept 145 MacLanguage Series Pascal compiler for Macintosh (B.

Webster), Feb 340,

Apr 315

MacView program for transferring Macintosh graphics to IBM PC in,

June 131

Mandelbrot program for IBM PC in (D. Pountain),

Sept 359 material selection program for construction in (T. Sawyer, M.

Pecht), July 235 MetaWare Professional Pascal version 2.5, review (N. C. Shammas),

Dec 265

Microsoft MS-Pascal version 3.31, review (N. C. Shammas), Dec 265 MIDI software for IBM PC In (D. Swearingen),

June 211

Object Pascal objectoriented extension of, for Macintosh, Aug 177 Pascal Extender software for Macintosh (B.

Webster), July 350 Pecan Software Systems UCSD Pascal version 4.2.1, review (N. C. Shammas), Dec 265 Personal Pascal software for Atari ST computers,

July 347

poetry processing program in, Feb 224 polar method for generating normal deviates in (A. Latour),

Aug 131

Prospero Software Pro Pascal version 2.14, review (N. C.

Shammas), Dec 265 real-time in (J. Feldman),

Sept 145

TOPSI 2.0 programming language in, review (L. Moskowitz), Aug 261 Turbo. See Turbo Pascal windowing systems for Apple II in, Apr 101 Pattern-matching capabilities

of expert systems (P. W.

Frey), Nov 161 on house architecture,

Nov 166

on political events (P. A. Schrodt), Nov 177 of SNOBOL4 (J. F.

Gimpel), Feb 175 PC6 computer from NCR, review (A. Little), Aug 241

PC-9801 computer from NEC, upgrades of (W. M. Raike), Jan 181

PC-9801 VM2E personal computer from NEC, (W. M. Raike), Nov 347

PC-9801 VM4 personal computer from NEC, (W. M. Raike), July 372

1986INDEX • BYTE 203

PC-DOS • PROGRAM LISTINGS

PC-DOS

DEBUG program and BREAKPT routine for (E. Batutis), Sept 127 PD PROLOG public domain implementation of Prolog for (R. Morein),

Oct 155

Professional Debug Facility and Advanced Fullscreen Debug programs for, review (J. C. Carden), Apr 249

PCLAB laboratory interfacing software package, July 303

PC-Outline usersupported outliner (E. Shapiro), May 336

PC-Pedal input device, review (C. H. Pappas),

May 285

PC-Shell (E. Shapiro),

Oct 302

PCTeX typesetting package, review (H. R. Varian), Apr 267

PC Tools version 2.20, review (R. Rabinovitz),

Oct 265

PC-Write word processor (E. Shapiro), Aug 320

PD PROLOG public domain implementation of Prolog (R. Morein),

Oct 155

Pecan Software Systems

SCSD Pascal version 4.2.1, review (N. C. Shammas),

Dec 265

Pellian equation (R. T.

Kurosaka), May 379

Performance Index

benchmark, IBM 158 Performance programming for IBM

PC-compatible products (J. Rosenblum, D. Jacobs), IBM 181

Persoft Referee program (E. Shapiro), Nov 361

Personal Pascal software for Atari ST machines (B. Webster), July 347

Personal TgX PCTeX

typesetting package, review (H. R. Varian), Apr 267

Personics SmartNotes

program (E. Shapiro),

Nov 362

Piano Player from Yamaha (W. M. Raike), Sept 351 Pibterm shareware communications program (E. Shapiro), Oct 300

PIE (Prolog Inference Engine) editor and compiler (S. Y. Blackwell), Oct 164

PIL Software Systems

ProComm shareware communications program (E. Shapiro),

Oct 300

Pipelined architecture of

Intel 80386 CPU (P. Wells), IBM 89

Plus Development

hardcard hard disk, review (E. White), May 273

Pocket APL language, review (E. H. Johnson),

Mar 237

Poetry

machine reading of metric verse (P. Holzer), Feb 224

text processing of (M. Newman), Feb 221

Polar method for

generating normal deviates (A. Latour), Aug 131

Political predictions with Holland bit-mapped classifier in Pascal (P. A. Schrodt), Nov 177

PopDrop program (E.

Shapiro), Nov 362

Portable computers

Compaq Portable II model 3, review (S. Miastkowski), Oct 239 Fujitsu FM-16 tt(W. M.

Raike), Jan 384, Mar 330 IBM PC Convertible, description of(G. M.

Vose), IBM 83 Keystyle 80 keyboard and laptop computer (W. M. Raike), July 371 Panasonic Exec. Partner transportable computer, reviews (R. Malloy),

Apr 231

PowerSoft Products

Super Utility version 1.10, review (R. Rabinovitz),

Oct 265

Percept Instant Recall

database manager (E. Shapiro), Oct 297 Predictions on impact of nuclear detonations, with BASIC programs (J. R.

Fanchi), Dec 143 political, with Holland bitmapped classifier in Pascal (P. A. Schrodt), Nov 177

Printers

C. Itoh TriPrinter dotmatrix printer, review (R. D. Swearengin),

Sept 283

Fujitsu DL-2400 20-pin dot-matrix, review (R. D. Swearengin), Nov 255 GE 3-8100 thermal dotmatrix, review (R. D. Swearengin), May 293 IBM Wheelprinter E, review (R. D. Swearengin), July 315

LaserWriter Plus, June 88 Lettrix resident print processor used with, review (A. R. Miller),

May 299

NishoNP-24110 24-pin dot-matrix, review (R. D. Swearengin), Nov 255 Printit printer interface card used with, Mar 261 Toshiba P321 24-pin dotmatrix, review (R. D. Swearengin), Nov 255

Printit printer interface card, review (H. Brugsch,

J. J. Lazzaro), Mar 261

Probability analysis

programs, on sucker bets (R. T. Kurosaka),

Nov 373

Pro Code International

Waltz LISP version 5.01, review (W. Wong),

July 293

ProComm shareware communications program (E. Shapiro), Oct 300

Prodigy 4 computer from Levco (B. Webster), Nov 323 ProDOS from Apple, catalog sort routine for (A. C. Silvestri), June 117

Product previews and descriptions

on Apple IIGS computer (G. Williams, R. Grehan), Oct 84

on Atari 520ST(J. R.

Edwards, P. Robinson,

B. McLaughlin), Jan 84

on Atari 1040ST computer (P. Robinson, J. R. Edwards), Mar 84 on Compaq Deskpro 386 computer (T. Thompson, D. Allen), Nov 84 on IBM PC Convertible (G. M. Vose), IBM 83 on LabView Laboratory Virtual Instrument Engineering

Workbench (G. M. Vose, G. Williams). Sept 84 on Lotus Manuscript word processor (G. A. Stewart), Nov 91 on Q&A software (J. Edwards), Jan 120

Productivity Products

Objective-C object-oriented language

for Macintosh, Aug 183 programming experience with, Aug 202

Professional Debug Facility, review (J. C. Carden), Apr 249

Professional Pascal

version 2.5, review (N. C. Shammas), Dec 265 Program listings available from BYTE. See BYTE Listings on Badfile utility in C language, Feb 158 on BREAKPT routine for PC-DOS DEBUG program, Sept 127 on Circuit Cellar data encryptor, Sept 109 on cyclic redundancy check calculations in C, Sept 119

on decision support system in Prolog, Nov 197 on diphantine equation solver in BASIC, Mar 346 on DOS functions from Turbo Pascal, Dec 104 on DRAGON program in Forth, Apr 138 on EditSort capsule editor and Quicksort capsule, Jan 148 on Euclid’s algorithm,

Jan 399

on file-indexing scheme, June 94

on finite-element analysis program for IBM PC,

July 211

on frame-manipulation routines in Prolog,

Jan 241

on free-form curves in BASIC, Dec 228

204 BYTE* 1986 INDEX

PROGRAMMING • PROLOG

on Getspec assembly language routine for passing filenames to compiled BASIC, Nov 120 on graphing quadric surfaces with BASIC program for IBM PC,

Dec 219

on Henon mapping in Turbo Pascal, Dec 163 on Hilbert curve program in BASIC, June 137 on interfacing machine language routine to Pascal, Sept 148 on interrupt routines for IBM PC in assembly language, IBM 252 on keyed file access in BASIC, Sept 140 on Mandelbrot program for Amiga in Lattice C, Dec 209

on memory

manipulations for IBM PC, IBM 236

on MIDI software for IBM PC in Turbo Pascal,

June 212

on musical fractals,

June 188 on nuclear blast calculations, Dec 145 on number sequence programs in BASIC,

Aug 334

on one-dimensional cellular automata program in BASIC, Dec 184 on Pan and Reif algorithm for inversion of large matrices, in BASIC, Apr 186 on Pellian equation solver, May 385 on Performance Index benchmark, IBM 160 on performance programming for IBM PCcompatible products,

IBM 182

on ProDOS catalog sort routine, June 122 on SIMPL programs,

Jan 134, Feb 111 on SmartWatch real-time clock in BASIC. Mar 120 on stress analysis of tunnels in underground mining, in BASIC,

July 223

on Watson deductive reasoning program in Prolog, Nov 209 on windowing system,

Apr 98

Proamrnmlno

for nruiumm nr riving in Pmuinl (H Kmrfer),

for approximating Inltyraln with Altken •xtrni rotation (D M Sml(h), I )n< 113 of Bidflli ulilily Irt C languagri for CP/M 8yit#mi(l ftaker),

Feb 187

of BRl AKIM routine for PC DOS Dl MUG program (I Bnfulln), ? apt 127 in C language . md ailfrnbly language, comparison of (I Hogan), IBM 21)7 for calculation of < ycllc redundancy checks (G. Mourn) f Inpt 115 for CD H< )Ma(B Zoellick). Mny 177 of COLOR: tD BAS program f< rr (Implaying molecuinN in color, for IRM PC (J I I urrnll)

Fob 141)

for data < ompm-.wion with Huffman c< rding (J. Amsterdam), Mny 99 for dragon curve on Macintosh (B R, Land), Apr 137 with Easy (

preprocoHHor (P, Orlm, J. Heath), Mny Id/ with Emulo M I PROM emulator (S R Ball),

Apr 10!)

for extruding nth root from binary numbers (L. S, Wo), Nov t IS of file-indexing < :hnrnn (B, Webster), June 93 for flag testing and Input comparison using ? w property(II r Arp Jr ), Oct 148 functional data flow In (C. Hankin, I) Till. H Glaser), May 123 of Getspec o'viombly language routine for passing filename*, to compiled BASIC (B. Hubanks), Nov 119 of Hilbert curve program In BASK : (M Ackerman), June 137 for IBM PC compatible products (J 11< miir ihlijm ,

D. Jacobs), IRM 101 with Icon high level programming language (R. E. Griswold, M I Griswold), Oct 1f>7

of interrupt routines for IBM PC (W. J.CIaff).

IBM 249

with Let’s C and csdC development package and symbolic debugger, review (W. G. Wong), Aug 267 in LISP language with muLISP-86 development system, review (R. J.

Schalkoff), Oct 249 with Visual Syntax editor (R. Levien),

Feb 135

of Macintosh Explorer disassembler program (O. Andrade), Mar 145 mathematical laws in (C. A. R. Hoare), Aug 115 in Modula-2 (R. C.

Corbeil, A. H. Anderson), May 111

with ITC Modula-2 Software Development System, review (M. Bridger), Oct 253 with reusable modules (N. C. Shammas),

Jan 145 of spreadsheet program for Macintosh (J. Amsterdam),

July 97

of storage allocators (J. Amsterdam), Oct 123 for Motorola MC 68000 processor, guidelines for (M. Morton), Sept 163 of MS-FORTRAN programs (M. Dahmke), IBM 217

object-oriented. See Object-oriented programming of operating system functions from Turbo Pascal programs (D. F. Yriart), Dec 103 with OPS5 (Official Production System version 5) programming language (L. Moskowitz), Nov 217 and AUTO.OPS implementation of,

Nov 222 and EsperOPS5 implementation for Macintosh (W.

Jacobs), July 297 and TOPSI 2.0 implementation for IBM

PC (L. Moskowitz),

Aug 261

in PD PROLOG public domain implementation of Prolog (R. Morein),

Oct 155

of polar method for generating normal deviates (A. Latour),

Aug 131 rule-based (L.

Moskowitz), Nov 217 with SIMPL

programming language and compiler extensions of (J. Amsterdam), Feb 103 procedures and functions of (J. Amsterdam),

Jan 131

of subroutine overlays in GWBASIC (M.

Carmichael), May 151 of three-dimensional graphics program in BASIC, Jan 153 for displaying molecules in color (J. J. Farrell), Feb 149 of windows basic principles in (B.

Webster), Mar 129 implementation of (B. Webster), Apr 97 with write-once optical disks (J. R. Dulude),

May 193

Prolog

from Arity version 3.2, review (W. G.Wong), Mar 245 version 4.0, Mar 247 computer-vision system using, Jan 257 decision support system in (C. Y. Cuadrado, J. L. Cuadrado), Nov 193 Marvin program for teaching computers to learn in (A. T.

Kolokouris), Nov 225 PD PROLOG public domain implementation of (R. Morein), Oct 155 PIE (Prolog Inference Engine) editor and compiler (S. Y.

Blackwell), Oct 164 telecommunications in (L. Su), Oct 160 Turbo Prolog implementation of (B. Webster), Sept 335 review (N. C.

Shammas), Sept 293

1986 INDEX • BYTE 205

PRO PASCAL • SEMANTIC COMPACTION

Watson deductive reasoning program in (J.-C. Emond, A. Paulissen), Nov 207

Pro Pascal version 2.14, review (N. C. Shammas), Dec 265

Prospero Software Pro

Pascal version 2.14, review (N. C. Shammas),

Dec 265

Protected-mode program

for IBM PC AT (R. P. Nelson), IBM 123

Pseudovariables in objectoriented programming, Aug 144

Public domain software

Abundance Forth-based database language (R. Green), Oct 193 for CP/M (B. N. Meeks),

Oct 219

Enhanced Console Driver for user-friendly interface to DOS (A. Zackin), Oct 183 Icon high-level programming language (R. E. Griswold, M. T. Griswold), Oct 167 as issue theme (J.

Edwards), Oct 153 PD PROLOG (R. Morein), Oct 155

Talking Moose desk accessory program for Macintosh (B.

Webster), Dec 310 TeX digital typography system, Feb 169 Z80MU program for emulation of Zilog Z80 and CP/M 2.2 (R. A.

Baumann), Oct 203 Publishing, TeX digital typography system in,

Feb 169, 206

Puttkammer Software

and Microcomputertechnich Advanced Fullscreen Debug, review (J. C.

Carden), Apr 249

Q

Q&A software, preview (J. Edwards), Jan 120

QIC-60 tape backup unit, review (M. C. Rubel), Oct 243

Qmodem shareware communications program (E. Shapiro), Oct 300

Quadric surface (G.

Haroney), Dec 215 Quantitative Micro Software microTSP version 4.1 program, review (P. Davenport), Apr 257

Queue simulation objectoriented program, Aug 230

Quicksoft PC-Write word processor (E. Shapiro),

Aug 320

Quicksort capsule,

Jan 148

QWERTY keyboard layout, efficiency of (D. W. Olson,

L. E. Jasinski), Feb 241

R

Racal-Vadic modems,

Dec 255

Racter program, review (H. Kenner), May 289

Raised Dot Computing

Braille-Edit talking word processor, Mar 199 review (H. Brugsch),

Mar 251

RAM

DASCH external RAM disk for Macintosh (B. Webster), June 353 RAM-loadable character sets for IBM PC (R. Wilton), IBM 197

Ready! memory-resident outline processor from Living Videotext (E. Shapiro),

Mar 297

Real-time systems

clocks in (S. Ciarcia),

Mar 113

Hermes real-time multiprocessing operating system (R. C. Corbeil,

A. H. Anderson), May 111 in Pascal (J. Feldman),

Sept 145

Reed-Solomon for optical disk error correction (S. W. Golomb), May 203

Referee program (E.

Shapiro), Nov 361

Reflex analytical database program, review (R.

DeMaria), Aug 277

Relational database

programs

filePro 16 and filePro 16

Harkness), Nov 297 Paradox 1.1, review (R. DeMaria), Sept 303

Reviews

of books. See Book reviews

of hardware. See Hardware reviews of software. See Software reviews

of systems. See Systems reviews

Revolution Software

Cruise Control program (E. Shapiro), Nov 361

RISC processor (D.

Pountain), Jan 387 in IBM RT PC (R. S. Simpson), IBM 43

Robotics

artificial intelligence in (J. L. Cuadrado, C. Y. Cuadrado), Jan 237 autonomous navigation in (C. Jorgensen, W. Hamel, C. Weisbin),

Jan 223

Camera systems in (P.

Dunbar), Jan 161 in chemistry laboratory automation (G. W.

Kramer, P. L. Fuchs),

Jan 263

coordination of multiple manipulators in (J. S. Hawker, R. N. Nagel,

R. Roberts, N. G. Odrey), Jan 203 increasing

independence in aging (K. G. Engelhardt, R. Edwards), Mar 191 as issue theme (T.

Clune), Jan 159 tactile sensors in (K. E. Pennywitt), Jan 172

Roland Corporation MPU401 MIDI interface for IBM PC. June 211 review (R. Powell, R.

Grehan), June 265 ROM

compact disk. See CD-ROM

EPROM programmers.

See EPROM programmers Kernel software of Amiga, introduction to (R. J.

Mical), Feb 116

Round-off errors in

computer approximations (S. L. Moshier), Apr 161

RT Personal Computer

from IBM (R. O. Simpson), IBM 43

Rubicon Publishing

SongPainter music software for Macintosh, review (M. S. Bernardo), June 273

Rule-base programming

(L. Moskowitz), Nov 217

Runge-Kutta method for

solving differential equations, Apr 216

in BASIC (D. M. Leo), Apr 196

in FORTRAN (B.

Thomas), Apr 191

s

S-100 bus systems, best of BIX on, Oct 338

SALT laboratory interfacing software package, July 303

SB 180 computer from Circuit Cellar addition of SCSI to (S. Ciarcia), May 85,

June 107

GT180 color graphics board for

basic technology of (S.

Ciarcia), Nov 105 hardware of (S.

Ciarcia), Dec 87

Science Accessories

digitizers for data entry, review (E. D. Hearn),

Nov 261

Scientific solutions

LABPAC software, July 303

Scottsdale Systems Color Fox computer, review (J. D. Unger), Jan 301

SCSI bus, implementation of SB 180 computer (S. Ciarcia), May 85,

June 107

SDD.COM public domain file directory program,

Oct 219

Security

of data, with Circuit Cellar data encryptor (S.

Ciarcia), Sept 97 of home, overzealous system of (S. Ciarcia),

Apr 85

of UNIX operating system (A. Filipske, Jan Hanko), Apr 113

Segmentation with Intel 80386CPU, IBM 89, 111

Semantic compaction

system, in speech impairment (B. R. Baker),

Mar 160

206 BYTE • 1986INDEX

SENSORS • SOFTWARE

practical applications of, Mar 166

Sensors in robotics in automation of chemistry laboratory, Jan 274 in navigation (C. Jorgensen, W. Hanwil, t Weisbin), Jan 223 tactile (K. E. Pennywllt), Jan 172

visual (P. Dunbar),

Jan 161

Serial EPROM programmer, intelligent, construction of (S,

Ciarcia), Oct 103

Shareware (E. Shapiro),

Oct 297

Shivji, Shiraz, interview with (P. Robinson), M,n no

Shows and exhibits Soo Exhibits and shows

Sider hard disk drive, review (D. E. Hall), Jan 319

Sieve of Eratosthenon benchmarks. See

Benchmarks

Signal Technology ILS

laboratory interfacing software, July 303

Silicon Beach Software

Dark Castle game for Macintosh (E. Shapiro),

Dec 327

Similarity mapping

program for Macintosh in BASIC (R. Spencer),

Aug 85

SIMPL programming language and compiler extensions of (J.

Amsterdam), Feb 103 procedures and functions of (J. Amsterdam), Jan 131

SimpleSoft Products It

Figures spreadsheet program (E. Shapiro),

July 381

Simulation

with CHEMMOD molecular modeling system (D. Pountain),

Dec 334

of circuits, program for for Commodore 64 (D.

McNeill), July 170 introduction to (W.

Blume), July 165

SPICE (Simulation Program for Integrated Circuit Engineering), July 165, 170 of customers queuing in bank, object-oriented program on, Aug 230 of financial investments with Blue Chip software (E. Shapiro), Dec 326 with STELLA, May 335,

Dec 277

(*i surgery with Surgeon program for Macintosh (E. Shapiro), Dec 322

Singular Software

Interlace Database program (I Shapiro), May 336

s«.K Technology Strike vi usion spelling checker, review (R. Ramsey),

Nov 289

SK AM routines for keyed

fiio access in BASIC (S. C. Porry), Sept 137

Small Computer Company filePro 16 and filnPro 16 Plus database munngement software, review (R. Harkness),

Nov 297

Smalltalk language

Animal Game in,

Aug 153

improving efficiency of (CM Duff), Aug 211 for Mm< mtosh, Aug 177 Method* version of, programming experience with, Aug 206 tiyntax and design philosophy of (T. Kaehler, I) I ’m! lor son), Aug 145 lower of Hanoi program In, Aug 146 SmarTIma real time system, Mai 123 Smartmodoma Irom I laynu, Juno 339, Dec 255 SmnrtNotaa | rrogram (E. Shapiro), Nov 362

Smart QIC-HI# tape backup unit, review (M. C. Rubel), Oct 243 SmartWntch mal Ilnur clock from I )allas Semiconductor, Mar 118

SNOBOL4 language, processing strings in (J. F. Gimpel), Feb 176

SoftKIone Distributing

Software Carousel virtual memory manager, review (M. Haas), Sopt 299

Software

for abstract mathematical art, with BASIC program for IBM PC (K. E.

Perry), Dec 181 Acta outline processor for Macintosh (B. Webster), Dec316

AkTypist word processor (E. Shapiro), July 383 for Amiga (B. Webster),

Apr 322

Amiga ROM Kernel, introduction to (R. J. Mical), Feb 116 for animation of Amiga graphics, Sept 241,

Nov 285

for Atari 520ST(B.

Webster), Apr 318 Balance of Power game (E. Shapiro), Mar 299,

Dec 322

Blue Chip financial investment simulation programs (E. Shapiro), Dec 326

Boxcalc spreadsheet program (E. Shapiro),

May 336

Boxes and Arrows spreadsheet and graphics program (E. Shapiro),

May 335

BYTE listings of. See BYTE listings for CD-ROM, development of (B. Zoellick), May 177 CGEN program for translating BASIC into C (D. Pountain), Oct 311 CHEMMOD molecular modeling system (D. Pountain), Dec 334 circuit simulation programs

for Commodore 64 (D.

McNeill), July 170 introduction to (W.

Blume), July 165 SPICE (Simulation Program for Integrated Circuit Engineering),

July 165, 170 ComicWorks painting program for Macintosh (E. Shapiro), Dec 321 for CP/M in public domain (B. N. Meeks),

Oct 219

Cruise Control cursor control program (E. Shapiro), Nov 361 Dac-Easy Word word processor (E. Shapiro). July 381

Datatext word processor (E. Shapiro), July 383 dBASE III Plus (E.

Shapiro), June 330 debugging of. See Debugging for Definicon 68020 coprocessor (T. Marshall, C. Jones, S. Kluger),

Aug 108

Easy word processor,

Mar 300

Enhanced Console Driver for user-friendly interface to DOS (A. Zackin), Oct 183 finite-element analysis program for IBM PC (R. W. Johnson, F. G. Loygorri), July 199 Framework II (E.

Shapiro), Apr 331 FullPaint program for Macintosh (E. Shapiro), Sept 368 Henon mapping program in Turbo Pascal (G. Hughes), Dec 161 IBM PC-compatfole, MacCharlie accessory for Macintosh providing access to (L. Crockett), Feb 262

on impact of nuclear detonations in BASIC (J. R. Fanchi), Dec 143 Induce program for extracting knowledge from data, in Turbo Pascal for IBM PC, Nov 158 Instant Music program for Amiga (B. Webster), Dec 308

Instant Recall database manager (E. Shapiro),

Oct 297

Interlace database program (E. Shapiro),

May 338 Intuitive Solution business application generator (D.

Pountain), May 363 It Figures spreadsheet program (E. Shapiro),

July 381

KeepTrack PlusfE.

Shapiro), June 334 for keyed file access in BASIC (S. C. Perry),

Sept 137

Lattice Screen Editor program editor for Amiga, July 352

of Lotus/Intel/Microsoft Expanded Memory Specification (R.

Duncan), IBM 169 for Macintosh (B.

1986INDEX • B YTE 207

SOFTWARE GROUP • SOFTWARE REVIEWS

Webster), Apr 315 MacView program for transferring Macintosh graphics to IBM PC (M. Anacker), June 131 Mandelbrot program for Amiga in Lattice C (P. B. Schroeder),

Dec 207

for IBM PC in Turbo Pascal (D. Pountain), Sept 359 Manuscript word processor, preview (G. A. Stewart), Nov 91 Mapper similarity mapping program for Macintosh, in BASIC (R. Spencer), Aug 85 Marvin program in Prolog for teaching computers to learn (A. T. Kolokouris), Nov 225

for material selection in construction with MSP program in Turbo Pascal (T. Sawyer, M. Pecht),

July 235

with physical property estimation programs in BASIC (J. N. Stone). July 253

Metascope debugger for Amiga (B. Webster),

Nov 334

Mindreader word processor (E. Shapiro), Aug 319 Mirror

telecommunications program (E. Shapiro),

Apr 329

More outline processor for Macintosh, Sept 367, Dec 316 Music

in C language, for IBM PC in MIDI interface (J. Kubicky), June 199 Concert Ware+ and SongPainter programs, review (M. S.

Bernardo), June 273 for Macintosh,

June 171,273 overview of (R. Powell), June 145

in Turbo Pascal, for IBM PC and MIDI interface (D. Swearingen), June 211 Orpheus poetry processing program,

Feb 221

Pascal Extender for Macintosh, July 350 PC-Outline usersupported outliner (E. Shapiro), May 336 PC-Shell (E. Shapiro),

Oct 302

PC-Write word processor (E. Shapiro), Aug 320 PD PROLOG implementation of Prolog (R. Morein), Oct 155 Personal Pascal for Atari ST machines, July 347 Pibterm shareware communications program (E. Shapiro), Oct 300 PopDrop program (E.

Shapiro), Nov 362 ProComm shareware communications program (E. Shapiro). Oct 300 ProDOS catalog sort routine (A. C. Silvestri), June 117

program listings of. See Programming protected-mode program for IBM PC AT (R. P. Nelson), IBM 123 in public domain. See Public domain software Q&A package, preview (J. Edwards), Jan 120 Qmodem shareware communications program (E. Shapiro), Oct 300 for RAM-loadable character sets for IBM PC (R. Wilton), IBM 198 Ready! memory-resident outline processor,

Mar 297

Referee program (E.

Shapiro), Nov 361 reviews. See Software reviews

SmartNotes program (E.

Shapiro), Nov 362 Stella program, May 335,

Dec 277

for stress analysis of tunnels in underground mining (D. L. Petersen,

S. L. Crouch), July 219 Surgeon surgery simulation program for Macintosh (E.

Shapiro), Dec 322 Talking Moose desk accessory program for Macintosh (B.

Webster), Dec 310 for text analysis and identification of unknown authors (J. Tankard),

Feb 231

Truss2 bridge-truss analysis program in BASIC

(C. Pedicini), July 145 TSRCOM utilities (E.

Shapiro), Oct 299 Turbo Editor Toolbox,

Mar 297

TxEd program editor for Amiga (B. Webster),

Nov 336

Visual syntax editor for visual programming in LISP (R. Levien),

Feb 135

Volkswriter 3 (E. Shapiro), June 332 Watson deductive reasoning program in Prolog (J.-C. Emond,

A. Paulissen), Nov 207 Word 3.0 word processor, Aug 322,

Oct 261

WordStar 2000 Release 2 (E. Shapiro), June 329 Workbench program for object-oriented programming,

Aug 162 Works integrated package for Macintosh (E. Shapiro), Nov 365 Z80MU program for emulation of Zilog Z80 and CP/M 2.2 (R. A.

Baumann), Oct 203

Software Group Enable integrated software package version 1.0, review (S.

King), Jan 331 version 1.1 (R. Malloy),

Jan 334

Software Carousel virtual memory manager, review (M. Haas), Sept 299

Software ICs, reusable, in object-oriented programming (B. Cox,

B. Hunt), Aug 161

Software reviews

on Advanced Fullscreen Debug (J. C. Carden),

Apr 249

on Aegis Animator and Images animation and painting programs (W. Block), Nov 285 on Arity/Prolog for MSDOS systems (W. G.

Wong), Mar 245 on Braille-edit (H.

Brugsch), Mar 251 on BYSO LISP version 1.17 (W. Wong), July 293 on DeSmet C Development Package for Macintosh (J. Robie),

Aug 253

on Eco-C88 C compiler (D. D. Clark), Jan 307 on Enable integrated package (S. King),

Jan 331 on ExperOPS5 programming language for Macintosh (W. Jacobs), July 297 on filePro 16 and filePro 16 Plus database management programs (R. Harkness), Nov 297

on flash-Com electronic mail and

telecommunications system (B. N. Meeks), Dec 281

on GEM Draw painting program (R. Birmele), May 269

on Guru integrated package (E. R. Tello), Aug 281

on KAMAS outline processor (A. S. Woodhull), Apr 241 on laboratory interfacing packages (P. Wirth, L. E. Ford), July 303 on Lattice C compilers for Amiga (C. Heath), Nov 271

for IBM PC version 2.15 (D. S. Woolston), Feb 273

on Let’s C and csd development package and symbolic debugger (W. G. Wong), Aug 267

on Lettrix resident print processor (A. R. Miller), May 299

on MacDraw painting program (R. Birmele), May 269

on Manx Aztex C68K C compiler for Amiga (C. Heath), Nov 271 on Microsoft Word version 3.0 word processor (M. C.

Rubel), Oct 261 on MicroT^X typesetting package (H R. Varian), Apr 267

on microTSP version 4.1 time-series regression package (P.

Davenport). Apr 257 on Mix C compiler for IBM PC (R. Grehan),

June 257

on Modula-2 Software Development system (M. Bridger), Oct 255 on Modula-2 System for

208 BYTE* 1986 INDEX

SOFTWARE SHOW • SYSTEM REVIEWS

280 CP/M (B. R. Anderson), Mar 225 on muLISP-86 LISP development system (R. J. Schalkoff), Oct 249 on NewWord 3 word processor (J. Heilborn,

N. Reel), Aug 273 on Norton Utilities version 3.1 (R. Rabinovitz),

Oct 265

on Paradox 1.1 relational database (R. DeMaria), Sept 303

on Pascal packages for IBM PC (N. C. Shammas), Dec 265

on PC Tools version 1.10 (R. Rabinovitz), Oct 265 on PCT^X typesetting package (J. R. Varian),

Apr 267

on Pocket APL language (E. H. Johnson), Mar 237 on Professional Debug Facility (J. C. Carden),

Apr 249

on Racter program (H.

Kenner), May 289 on Reflex analytical database (R. DeMaria),

Aug 277

on Software Carousel virtual memory manager (M. Haas), Sept 299 on SPSS/PC+ analytical package (J. M. Jacques), Nov 270

on STELLA modeling and simulation program for Macintosh (S. B. Robinson), Dec 277 on Strike spelling checker (R. Ramsey),

Nov 289

on Super Utility version 1.10(R. Rabinovitz),

Oct 265 on TOPSI 2.0 programming language for IBM PC (L.

Moskowitz), Aug 261 on Turbo Lightning spelling checker (R. Ramsey), Sept 293 on Turbo Pascal version 3.0 (M. Bridger), Feb 281 on Waltz LISP Version 5.01 (W. Wong), July 293 on WordPerfect 4.1 word processor (R. Birmele).

Sept 311

on ZBasic interactive BASIC compiler (T. J.

Byers), May 265

Software Show of 1985 in Japan, highlights of (W. M. Raike), Feb 317

Soft Warehouse muLISP86 programming language, review (R. J. Schalkoff),

Oct 249

SoftWorks Development

PC-Outline user-supported outliner (E. Shapiro),

May 336

Sonar sensors in robotic navigation, Jan 230

SongPainter music software for Macintosh, review (M. S. Bernardo), June 273

Sound system of Amiga (D. D. Thiel), Oct 139 Soviet Union,

microelectronic technology in (P. Walton), Nov 137

Speech

Braille-Edit talking word processor, Mar 199, 251 Kurzweil Voice Writer voice-activated word processor (R.

Kurzweil), Mar 177 semantic compaction system for speechimpaired (C. R. Baker), Mar 160

speech synthesizers for blind users, Mar 199, 251,261

Talking Moose public domain desk accessory for Macintosh (B.

Webster), Dec 310 voice synthesis on Amiga (D. D. Thiel), Oct 140 Spelling checkers Strike version 1, review (R. Ramsey), Nov 289 Turbo Lightning version 1.00A, review (R.

Ramsey), Nov 289

Sperry PC/IT computer, review (F D. Davis),

Aug 247

SPICE (Simulation Program for Integrateci Circuit Engineering), July 165 for Commodore 64 (D McNeill), July 170

Spreadsheets

with Boxcalc program,

May 336

with Boxes and Arrow?, program, May 336 with Enable integrated software package,

Jan 331

with It Figures program,

July 381

in Modula-2, programming project on (J. Amsterdam),

July 97

SPSS/PC+ analytical software package, review (J. M. Jacques), Nov 279

Standards

of ANSI on C language (S. A. Hersee, D. Knopoff), Mar 135

on musical instrument digital interface. See MIDI specifications STELLA program (E.

Shapiro), May 335 review (S. B. Robinson),

Dec 277

Storage allocation in

Modula-2, programming project on (J.

Amsterdam), Oct 123

Street Electronics Echo speech synthesizers,

Mar 199, 251,261

Stress analysis of tunnels in underground mining (D. L. Petersen, S. L.

Crouch), July 219 Strike version 1 spelling checker, review (R. Ramsey), Nov 289

String processing in

SNOBOL4 (J. F. Gimpel),

Feb 175

Structural analysis in

engineering with finite-element analysis method,

July 145, 148, 199 on IBM PC (R. W.

Johnson, F. G. Loygorri), July 199

with Truss2 bridge-truss analysis program (C. Pedicini), July 145

STSC Pocket APL language, review (E. H. Johnson), Mar 237

Subroutine overlays in

GWBASIC (M. Carmichael), May 151

Summagraphics digitizers for data entry, review (W. D. Hearn), Nov 261

Super Utility version 1.10, review (R. Rabinovitz),

Oct 265

Surgeon surgery simulation program for Macintosh (E. Shapiro),

Dec 322

Symantec Corporation

Q&A software package, preview (J. Edwards),

Jan 120

Symmetry Corporation

Act outline processor for Macintosh (B. Webster), Dec316

Synchronization of

processes Modula-2,

May 111

Syntech MIDI interfaces for Apple II and Commodore 64, review (R. Powell, R. Grehan), Jan 265 Synthesizers digital music Kurzweil 250 Digital Synthesizer, review (C. Morgan), June 279 for Macintosh (C.

Yavelow), June 171 overview of (R. A.

Moog), June 155 speech, for blind users,

Mar 199, 251,261

Sysgen Smart QIC-File tape backup unit, review (M. C. Rubel), Oct 243 System reviews on Atari 520ST computer (E. Jensen), June 233 on AT&T UNIX PC (A. J. W. Mayer), May 254 on Canon A-200 computer system (P. V. Callamaras), Jan 293 on Commodore Amiga 1000 (T. Thompson),

Oct 231

on Compaq Deskpro 286 computer Models 1 and 2 (S. Miastkowski),

June 243

on Compaq Portable II computer Model 3 (S. Miastkowski), Oct 239 on Conquest Turbo PC computer (J. D. Unger), July 289

on Epson Equity I computer (J. D. Unger), Nov 239

on Epson Equity III computer (W. Rash Jr.), Dec 239

on Franklin ACE 2200 computer (A. S.

Woodhull), Sept 263 on ITTXTRA XP computer (J. D. Unger), July 281

on Kaypro 286i computer (H. Krause), Mar 217 on Kaypro PC computer (J. D. Unger), Nov 239

1986 INDEX • B YTE 209

SYSTEMS PROGRAMMING • TURBO PASCAL

on Leading Edge Model D PC computer (S. Miastkowski), Sept 269 on MacCharlie (L.

Crockett), Feb 262 on Macintosh Plus computer (C. Crawford). Nov 247

on Motorola VME/10 (R. R. Robinson III),

Feb 253

on Multitech MPFPC/700 D1 computer (J. D. Unger), Nov 239 on NCR PC6 computer (A. Little), Aug 241 on Panasonic Exec.

Partner computer (R. Malloy), Apr 231 on Scottsdale Systems Color Fox computer (J. D. Unger), Jan 301 on Sperry PC/IT computer (F. D. Davis), Aug 247

on TeleVideo Tele-286 Model 2 computer (W. Rash Jr.), June 251 on Western AT computer (W. Rash Jr.), Dec 239 on Xerox 6060 computer (W. Rash Jr.), Sept 275 on Zenith Z-241 computer (W. Rash Jr.), Dec 239 on Zenith Z-248 computer (W. Rash Jr.), Dec 239

Systems programming

with Modula-2 (R. C. Corbeil, A. H. Anderson),

May 111

T

Tactile sensing in robotics (K. E. Pennywitt), Jan 172

Taiwan Computex show of 1986 (W. M.Raike),

Oct 307

Talking Moose public domain desk accessory for Macintosh (B. Webster), Dec 310

Talking word processor for visually impaired, BrailleEdit, Mar 199. 251

Tallgrass Technologies

TC-4060 tape backup unit, review (M. C. Rubel),

Oct 243

Tape backup systems

comparison of (A.

Antonuccio), May 227 hardware reviews (M. C. Rubel), Oct 243

TDI Software Modula-2/ST compiler (B. Webster),

Feb 332

TDS-AP MIDI interface for Apple II computers, review (R. Powell, R. Grehan), June 265

Technical writing (C.

Weston), Nov 94 Lotus Manuscript word processor for, preview (G. A. Stewart), Nov 91 with U-MAN 1000 computer (D. Pountain), Dec 329 Tecmar

Lab Master board, software interfacing packages for (P. Wirth,

L. E. Ford), July 303 QIC-60 tape backup unit, review (M. C. Rubel).

Oct 243

Tele-286 Model 2 computer from TeleVideo Systems, review (W. Rash Jr.), June 251

Telecommunications.

See Communications

Telecommuting (J. M.

Tazelaar), Mar 155

TeleLearning, Electronic University Network of (D. Osgood), Mar 171

Telesensor Systems

Versabraille, Mar 199

TeleVideo Systems Tele286 Model 2 computer, review (W. Rash Jr.),

June 251

TeX typesetting systems,

Feb 206

comparison of PCT^X and MicroT^X implementations of (H. R. Varian), Apr 267 Knuth interview on (G. M. Vose, G. Williams),

Feb 169

Texas Instruments

Professional Computer, BASIC program for freeform curves on (S.

Enns), Dec 225 TMS34010 Graphics System Processor (C. R. Killebrew Jr.), Dec 193

TEXT GOBBLER

programs for identifying unknown authors,

Feb 232

Text Processing

in Arabic and other problem scripts (P. A. MacKay), Feb 201 as computer science problem, Knuth interview on (G. M. Vose, G. Williams), Feb 169 as issue theme (J. R.

Edwards), Feb 167 keyboard efficiency in (D. W. Olson, L. E. Jasinski), Feb 241 in natural language (J. Pollack, D. L. Waltz),

Feb 189

of poetry (M. Newman),

Feb 221

programs for identifying unknown authors (J. Tankard), Feb 231 in SNOBOL4 language (J. F. Gimpel), Feb 175 T^X typesetting system in, Feb 169, 206 comparison of PCT^X and MicroT^X implementations of (H. R. Varian), Apr 267 Knuth interview on (G. M. Vose, G. Williams), Feb 169

TG-4060 tape backup unit, review (M. C. Rubel),

Oct 243

Think Technologies

Lightspeed C development environment for Macintosh (B. Webster),

Aug 323, Sept 340

Three-dimensional graphics, BASIC program for (H. Mittelbach),

Jan 153

for molecules in color (J. J. Farrell), Feb 149 on Quadric surfaces (G. Haroney), Dec 215

Time-series analysis, Apr

262

with microTSP program version 4.1, review (P. Davenport), Apr 257

Titanic, image-processing technology used in locating (M. Spalding, B.

Dawson), Mar 97

TML MacLanguage Series Pascal compiler (B. Webster), Feb 340,

Apr 315

TMS34010 Graphics System Processor from Texas Instruments (C. R. Killebrew Jr.), Dec 193

TOPSI 2.0 programming language for IBM PC, review (L. Moskowitz), Aug 261

TOS operating system of

Atari ST computer, and Motorola MC68000 processor (M. Rothman), Sept 223

Toshiba P321 24-pin dotmatrix printer, review (R. D. Swearengin), Nov 255

Touch sensing, robotic (K. E. Pennywitt), Jan 172

Tower of Hanoi problem, Smalltalk program on,

Aug 146

Transputer from Inmos (D. Pountain), July 363 Meiko Computing Surface based on (D. Pountain), July 364

Tri-Data OZ Guardian Model 533 modem, Dec 255 Tripos operating system from Metacomco (D. Pountain), Feb 321

TriPrinter, C. Itoh Model 20, review (R. D.

Swearengin), Sept 283

TRS-80, physical property estimation programs in BASIC for (J. N. Stone),

July 253

Truss2 bridge-truss analysis program in BASIC (C. Pedicini), July 145

TRW vector processor in

micro-based supercomputer (N. H. Christ, A. E.

Terrano), Apr 145

TRSCOM utilities (E.

Shapiro), Oct 299

Turbo Editor Toolbox

from Borland (E. Shapiro),

Mar 297

Turbo Lightning version 1.00A spelling checker, review (R. Ramsey),

Nov 289

Turbo Pascal

anagram solving in (B.

Keefer), July 113 compared to ITC Modula-2 (M. Bridger),

Oct 255

210 BYTE* 1986 INDEX

TURBOPOWER SOFTWARE • WESTERN AT COMPUTER

file-indexing program in, June 96

Henon mapping in (G.

Hughes), Dec 161 Induce program for extracting knowledge from data in,

for IBM PC. Nov 150 for Macintosh (B.

Webster), Nov 330 MacView program for transferring Macintosh graphics to IBM PC in, June 131

Mandelbrot program for IBM PC in (D Pounluin), Sept 359 material selection program for construction in (T. Sawyer, M Pecht), July 235 MIDI software for IBM I ’(: in (D. Swearingen),

June 211

TOPSI 2.0 programming language in, review (I Moskowitz), Aug 2(51 TurboPower

Programmer’s Utilities in, Feb 334

using operating system functions from programs written in (D. F. Yriart),

Dec 103

version 3.0, review (M Bridger), Feb 201

TurboPower Software

Programmer’s Utilities (B.

Webster), Feb 334 TRSCOM utilities (E.

Shapiro), Oct 299 Turbo Prolog programming language (B. Webster), Sept 335 review (N. C. Shammas),

Sept 293

Turner Hall Card for IBM

PC memory expansion, review (J. Angel),

Sept 207

TxEd program editor for Amiga (B. Webster), Nov 336 Typesetting in Arabic and other problem scripts (P. A. MacKay), Feb 201 METAFONT system in,

Feb 169,211 T^X digital system in, Feb 169, 206

comparison of PCT^X and MicroT^X packages (H. R.

Varian), Apr 267

Knuth interview on (G. M. Vose, G. Williams), Feb 169

u

Note 1

Note 2

Note 3

Note 4

Note 5

Note 6

Note 7

Note 8

Note 9

Note 10

Note 11

Note 12

Note 13

Note 14

Note 15

Note 16

Note 17

Note 18

Note 19

Note 20

Note 21

Note 22

Note 23

Note 24

architecture (A. L.

Rood, R. C. Cline, J. A. Brewster), Sept 179 security features of (A. Filipski, J. Hanko),

Apr 113

System V version 2 in AT&T UNIX PC, May 254

UNIX PC from AT&T, review (A. J. W. Mayer),

May 254

User interface

with Amiga ROM Kernel and Intuition, Feb 124 in hearing impairment,

Mar 177

iconic, in object-oriented programming (B. Cox,

B. Hunt), Aug 161 performance of (J. Uebbing, C. Young), Aug 176

to operating system with Enhanced Console Driver (A. Zackin), Oct 183 in visual impairment,

Mar 199, 251

USRobotlcs Courier 2400 modem, Dec 255

V

Vectra-D Dual-Mode Workstation (W. M. Raike), Sept 351

Ven-Tel 2400 Plus Modem, Dec 255

Versabraille from Telesensory Systems,

Mar 199

Versatron Footmouse input device, review (C. H. Pappas), May 285

Video

construction of audioand-video multiplexer (S. Ciarcia), Feb 85 glossary on, Jan 168

Vldeotrax tape backup unit, review (M. C. Rubel), Oct 243

Virtual machines

(J. Shiel), IBM 111 LabView Laboratory Virtual Instrument Engineering Workbench, preview (G. M. Vose, G.

Williams), Sept 84 VM2, SIMPL compiler for (J. Amsterdam), Jan 131, Feb 103

Virtual memory (J. Shiell),

IBM 111

with Intel 80386 CPU,

IBM 111

Software Carousel virtual memory manager, review (M. Haas), Sept 299

Vision in robotics

artificial intelligence in (J. L. Cuadrado, C. Y. Cuadrado), Jan 237 camera systems in (P. Dunbar), Jan 161

Visual programming in

LISP, with Visual Syntax editor (R. Levien),

Feb 135

Visual Syntax editor, for

visual programming in LISP (R. Levien), Feb 135

Visually impaired persons

Braille-Edit talking word processor for, Mar 199 review (H. Brugsch),

Mar 251

workable computing system for (A. Arditi, A. E. Gillman), Mar 199

VM2 virtual machine,

SIMPL compiler for (J. Amsterdam), Jan 131,

Feb 103

VME/10 system from Motorola, review (R. E. Robinson III), Feb 253

Voice. See Speech

Volkswriter 3 software (E. Shapiro), June 332 Votrax Personal Speech System, Mar 199, 261

w

Wafer-scale integration of

semiconductor devices (D. Pountain), Nov 351 Waltz LISP version 5.01, review (W. Wong), July 293

Warp Speed Light Pen

input device, review (C. H. Pappas), May 285

Watson deductive reasoning program in Prolog (J.-C. Emond, A.

Paulissen), Nov 207

West Coast Computer Faire of 1986 (B. Webster), Aug 323

Western AT computer,

review (W. Rash Jr.),

Dec 239

1986 INDEX •BYTE 211

Chapter Notes

UCSD Pascal version 4.2.1. from Pecan Software systems, review (N. C. Shummas), Dec 265 U.K., BYTE reports from (D. Pountain) on Acorn RISC machine, Jan 307

on AmigaDOS, Feb 321 on Amstrad PCW 8256 computer and word processor, Mar 333 on Apricot XEN

* • >mputer, Apr 305 on i Gl N program for Irmmlatlng BASIC into C, Oct 311 on CHE MMOD »"< >ln< ular model system, Duo 334

on lnm< >f. Transputer,

July 363

on Intuitive Solution hunuum application yttnnmtor, May 363 on Mum lolbrot program for IBM PC in Turbo I ii'h nl Sept359 on Millo Computing Mur fin n, July 364 on Minn In technology WfllNM)() modem,

Juno 110

on (tooum language,

July lo i Sept 369 end dynamic load hitler m mg, July 360, fUipl 3A9 on U MAN MXK) computer I >o(; 329 on wnfm m «Ut Integration Of Sirnlnr h M It« |( ir (ji 'vices, Nov JO I

U MAN MMO inputer (D.

Pounliln), Dm i

UndoruMiimil tmmnla in

mining * *»lr. n anelyuinof

(D I I 'nine (III ' i, |

Crouch). July .10

Underwrite •Mplmntlon

with Imago pi. ( ing

technology (M i *nli ling,

B. Dawnon) Mm u/

Univeraitl Oniti hy.ii.

Faslalk 1200mM.ini,.

Dec 255

UNIX

compallhlllfy Willi Motorola M( tiMiion

WESTERN AUTOMATION LABORATORIES • ZYMATE LABORATORY ROBOT

Western Automation Laboratories DASCH external RAM disk for Macintosh, June 353

Western Design Center

W65C816 processor, in Apple IIGS computer,

Oct 84

Wheelprinter E from IBM, review (R. D. Swearengin), July 315

Windows

of AT&T UNIX PC.

May 254

with Enable integrated software package,

Jan 331

Microsoft, of Apricot XEN computer, Apr 309 programming project on basic principles in (B.

Webster), Mar 129 implementation of (B. Webster), Apr 97

Wisper wafer from Anamartic (D. Pountain), Nov 351

Word 3.0 word processor (E. Shapiro), Aug 322 review (M. C. Rubel),

Oct 261

WordPerfect 4.1 word processor, review (R. Birmele). Sept 311

Word processing

with Al: Typist software (E.

Shapiro), July 383 with Anstrad PCW 8256 computer (D. Pountain), Mar 333

with Braille-Edit, Mar 199 review (H. Brugsch),

Mar 251

with Dac-Easy Word program (E. Shapiro), July 381

with Datatext software (E.

Shapiro), July 383 with Easy program,

Mar 300

with Enable integrated software package,

Jan 331

in Japanese language on IBM PC(W. M.Raike), Aug 330

with Kurzweil Voice Writer (R. Kurzweil), Mar 177 with Lotus Manuscript program, preview (G. A. Stewart), Nov 91

with Mindreader program (E. Shapiro), Aug 319 with NewWord 3 program, review (J. Heilborn, N. Reel),

Aug 273

with PC-Write program (E. Shapiro), Aug 320 and processing text as issue theme (J. R. Edwards), Feb 167.

See also Text processing with Q&A software package. Jan 120 with Word 3.0 program (E. Shapiro), Aug 322 review (M. C. Rubel),

Oct 261

with WordPerfect 4.1 program, review (R. Birmele), Sept 311

WordStar 2000 Release 2 software (E. Shapiro),

June 329

Workbench program for object-oriented programming, Aug 162

Works integrated package for Macintosh (E. Shapiro), Nov 365

Write-once optical disks,

May 215

programming with (J. R. Dulude), May 193

WS3000 modem from Miracle Technology (D. Pountain), June 319

x

XBIOS of Atari ST computers, Sept 223

XEN computer from Apricot (D. Pountain),

Apr 305

Xerox 6060 computer, review (W. Rash Jr.),

Sept 275

XLISP, EDITNET program in, Feb 196

XOR function, in calculation of cyclic redundancy checks (G. Morse), Sept 115

Y

Yamaha

CX5-M music computer, musical fractal program for, June 185, 196 Piano Player (W. M. Raike), Sept 351

Yokogawa Hewlett-Packard Vectra-D Dual-Mode Workstation (W. M.

Raike), Sept 351

z

Z80-based CP/M systems

Amstrad PCW 8256 computer and word processor, Mar 333 Commodore 128 personal computer, review (W. Wiese Jr.),

July 269 KAMAS outline processor for, Apr 241 Modula-2 System for, review (B. R. Anderson), Mar 225

Z80MU program for emulation of Zilog Z80 and CP/M 2.2 (R. A.

Baumann), Oct 203

Z80MU program for emulation of Zilog Z80 and CP/M 2.2 (R. A.

Baumann), Oct 203

Z-241 computer from Zenith, review (W. Rash Jr.), Dec 239

Z-248 computer from Zenith, review (W. Rash Jr.), Dec 239

ZBasic interactive BASIC compiler, review (T. J.

Byers), May 265

Zenith

Z-248 computer, review (W. Rash Jr.), Dec 239 Z-241 computer, review (W. Rash Jr.), Dec 239

Zilog Z80 processor and CP/M 2.2, Z80MU program for emulation of (R. A. Baumann), Oct 203

Zymark Zymate Laboratory Robot, Jan 263

Zymate Laboratory Robot

from Zymark,

Jan 263

212 BYTE • 1986 INDEX

_

BBS’S POSTING BYTENET LISTINGS

Australia:

Gray ham Smith 12 Brentwood Road Flinders Park, South Australia 5025 The Electronic Oracle 300 Baud, CCITT Standard Telephone: 08-43-3331 Voice 08-260-6686 BBS

Edward A. Romer 31 Warwick Street Killara,

Sydney NSW, Australia 2071 OMEN

300 & 1200 Baud Telephone: 02-498-2399 Voice (Wbrk)

02-499-2642 Voice (Home)

02-498-2495 BBS

Alan Salmon PCUG Sysop GPO Box 2229 Canberra,

A.C.T. 2601, Australia Canberra PC Users Group Inc.

300 & 1200 Baud Telephone: 61-62-58-9967 BBS

Angus S. Bliss POB 293

Hamilton NSW 2303, Australia

Newcastle Microcomputer Club

300 Baud, CCITT Standard, 8 Bits, 1 Stop, No Parity

Telephone: 049-67-2433 Voice (Angus Bliss)

049-54-9505 Voice (Tony Nicholson) 61-49-685385 BBS

John Hastwell-Batten POB 242

Dural, NSW 2158, Australia Tesseract RCPM +

300 Baud, CCITT Standard, 8 Bits, No Parity Telephone: 02-651-2363 Voice 02-651-1404 BBS

Phil Harding POB 35

Chamwood A.C.T., Australia 2615 PC-Exchange Bulletin Board 300 & 1200 Baud, CCITT Standard Telephone: 61-062-581406 Voice 61-62-586352 BBS

Eric Salter POB 60

Canterbury 3126, Australia

MICOM: The Microcomputer Club of Melbourne

300 Baud

Telephone: 61-3-861-9117 Eric Salter

61-3-762-1386 Peter Jetson (SYSOP) 61-3-762-5088 BBS

Craig Bowen

29 Warrigal Road

Surrey Hills 3127, Vic., Australia

Public Resource 01

300 Baud, CCITT Standard, 8 Bits, 1 Stop, No Parity Telephone: 03-890-2174

John Blackett-Smith Unit 8

69 Wattle Road Hawthorn 3122, Australia The National Fido Telephone: 613-818-2336

Austria:

Wolfgang Hryzak Bahnstrasse 48 A-2230 Gansemdorf, Austria University of Vienna BBS FIDO 300 Baud, 8 Bits, 1 Stop Bit Telephone: 02282-24094 BBS

Brazil:

Sistema Sampa ATTN: Rizieri Maglio R. Portugal, 202 Jdm Europe - CEP 01446 Sao Paulo - SP - Brazil Sistema Sampa

300 & 1200 Baud, CCITT Standard Telephone: 011-8536273 BBS

Canada:

Leigh Calnek 3036 25th Avenue

Regina, Saskatchewan, Canada S4S 1K9 Telephone: 306-586-9253 BBS

Tom Kashuba

PCOMM Systems

1411 Fort Street, Suite 2001

Montreal, Quebec, Canada H3H 2N7

Telephone: 514-989-9450 BBS

Gary McCallum

Western Canadian Distribution Center 342048th Street

Edmonton, Alberta, Canada T6L 3R5 300 & 1200 & 2400 Baud Telephone: 403-462-9189 Voice 403-461-9124 BBS

Judson Newell

Canada Remote Systems

Suite 311,4198 Dundas Street West

Toronto, Ontario, Canada M8X 1Y6

Telephone: 416-231-2383 Voice

416-231-9202 BYTEnet System

Vernon Paige EPSNUNK 3 McNicoll Avenue

Willowdale, Ontario, Canada M2H 2A6 300 & 1200 Baud Telephone: 416-494-1380 Voice 416-635-9600 BBS

Terry Smythe Sysop, Z-Node 40 Muddy Water User Group 55 Rowand Avenue

Winnipeg, Manitoba. Canada R3J 2N6 Telephone: 204-832-3982 Voice 204-945-6713 Voice 204-832-4593 BBS

Denmark:

Beverly Kleiman International Representative Personal Computer Society of Denmark Kronprinsensgade 14,

DK-1114 Copenhagen, Denmark 300 Baud. CCITT Standard Telephone: 01-122518 BBS

England:

Frank Thomley 67 Woodbridge Road,

Guildford,

Surrey GU21 UP, United Kingdom CompuLink

Telephone: 0-483-65895 Voice

0-483-573337 (300/1200 Baud) BBS 0-483-573338 (1200/2400 Baud) BBS

Finland:

JuhaWiio Databox Oy Museokatu 11 00100 Helsinki, Finland DATABOX FIDO 300 & 1200 Baud Telephone: 358-0-497904

Vivian Ronald Dwight Suvikuja 3 B 14 02120 Espoo, Finland Micro Maniacs III Fido Node 1 7 300 & 1200 & 2400 Baud Telephone: 358-0-424524 Voice 358-0-4557307 Voice 358-0-467673 BBS

France:

Bill Graham,

President

OUF! (Ordinateurs Utilisateurs France)

ATTN: OUFLOG, B.P. 62 10 rue Saint Nicolas 75012 Paris, France 300 Baud, CCITT Standard Telephone: 331-43-44-06-48 Voice (Bill) 331-43-44-82-65 Voice 331-43-41-61-47 OUFLOG for BYTE Listings 331-43-40-33-79 OUFTEL 300 & 1200 Baud 331-43-07-95-39 OUFTEL

214 BYTE LISTINGS SUPPLEMENT • APRIL-JUNE. 1987

Dr. Bernard Pidoux

Groupe Des Utilisateurs Francophones D ’Informatique

37, Boulevard Saint-Jacques

75014 Paris, France

300 Baud, CCITT Standard

Telephone: 1-47-63-72-50 Voice

1-45-65-10-09 GUFINET 1-45-65-10-11 GUFITEL

Hong Kong:

W. A. Hanafi SEAnet

Suite 812, Star House,

Tsim Sha Tsui, Kowloon, Hong Kong ATTN: Christine Wang Telephone: 5-455088 Voice

5-8937856 SEAnet 1 5-724495 SEAnet 2

Indonesia:

James D. Filgo

US Embassy Box R

APO SF 96356-5000

Jakarta Computer Society

300 Baud, Bell & CCITT Standard

Telephone: 062-21-799-3286 BBS

Ireland:

Gerry Clarke 30 Auburn Road

Dunlaoire County, Dublin, Ireland Dublin Bay Bulletin Board 300 & 1200 Baud Telephone: 353-01-854179

Italy:

Bruno Bonino MICRO design s. r. 1.

Via Rostan. 1 16155 Genova, Italy C.B.B.S.

CCITT & Bell Standard Telephone: 10-687098 Voice 10-688783 BBS

Giorgio Leo Rutigliano Via degli Oleandri, 7 POB 175

85100-Potenza. Italy

FIDO-PZ

300 Baud

Telephone: 0971-34593 Voice (W>rk)

0971-54431 Voice (Home)

0971-35447 BBS

Claudio Vandelli Amministratore Unico SOFT SERVICE s.r.l.

Via G. B. Morgagni 32 20129 Milano, Italy SOFT SERVICE BBS

300 Baud, CCITT Standard, 8 Bits, No Parity. Full Duplex

Telephone: 02-209231 Voice 02-228467 BBS

Paolo Marraffa Computronix Via De Amicis 76 90145 Palermo, Italy Network Computer Club

300 Baud, CCITT Standard, 8 Bits, 1 Stop Bit, Full Duplex

Telephone: 39-91-266021 BBS 39-91-300229 BBS

Japan:

Peter Perkins Vice President

Honda Trading Company Ltd.

Mail 101

9-91-Chome, Sota Kanda Chiyoda-ku, Tokyo, Japan JANIS

300 & 1200 Baud. CCITT Standard Telephone: 03-251-0855 BBS

Malaysia:

Ong Boo Huat 3, Jalan Pisang

Jalan Kelang Lama. 58000 Kuala Lumpur

STARUNK

300 Baud

Telephone: 03-7578811 X 116 Vbice 03-7576644 BBS

Nigeria:

Chester W.Vlaun MTCE/31 POB 263

Port Harcourt, Nigeria. West Africa 300 Baud

Telephone: 234-84-301210 to 301229-3022

Norway:

Robert Hertz Hertz Data Inc.

Huitssfeldts Gate 16 N-0253 Oslo, Norway Hacker’s Unlimited Telephone: 47-2-431655 Vbice 47-2-390521 BBS

Helge Vindenes 5670 FUSA, Norway Costa del

Telephone: 47-5-151610 Vbice 47-5-234129 BBS

Saudi Arabia:

Larry Layland System Operator DPCS Aramco Box 10063

Dhahran, Saudi Arabia 31311

Dhahran Personal Computing Society Bulletin Bcc

Telephone: 03-873-7851 BBS

Singapore:

Ken Ong

10 Orange Grove Road #04-01

Singapore 1025, Singapore K.B.B.S.

300 & 1200 Baud

Telephone: (IDD) 65-734-5825 Vacs (IDD) 65-73-^?* £35

Sweden:

Jacob Palme

Stockholm University Computer Centre-QZ Box 27322

102 54 Stockholm, Sweden BYTECOM

Telephone: 46-8-65-45-00 Voice (Work)

08-23-86-60 (300 Baud)

08-23-89-30 (300 Baud)

08-15-59-20 (300 Baud)

08-14-35-00(1200 Baud)

08-22-81-30 (1200 Baud)

08-24-61-20 (1200 Baud)

08-14-53-70 (1200 Baud)

Carl Nordin

Nyakersgatan 8B

531 41 Lidkoping, Sweden

A.T.L

300 & 1200 Baud, CCITT Standard Telephone: 46-510-25280 Voice 46-510-20409 BBS

Switzerland:

Peier M. C. Werner 9. rue de la Colombiere 1260 Nyon, Switzerland OCTET

300 & 1200 & 2400 Baud. CCITT Standard Telephone: 41-22-62-16-54 Vbice 41-22-62-18-17 BBS

Albert F. Studer Technical Director Kupfer Electronic AG Soodstrasse 53

Postfach, 8134 Adliswil, Switzerland TRAX

300 Baud, CCITT Standard Telephone: 01-710-81-11 Voice 01-710-44-36 BBS

The Netherlands:

Henk Wevers Cloeckendaal 38 6715 GH Ede, The Netherlands Henk Wevers ‘ Fido Telephone: 31-8380-37156 BBS

West Germany:

Rupert Mohr

RMI Nachnchteniech.“jt GmbH RosstraBe 7 Postfrch 1526

D-5100 .Aachen. WsrGennam RMI Set

Tefepbooe 49-241-21145 Vo»ce

*5-2* 0-90528 BYTEnet - DATEX-P >26245-2* 10-90528 User Data - DATEX-P

Radod Scncxer UnnH—r. 20

D-8000 Mssacr. 22. West Germany 7-SI'S FIDO

-389-29-38-81 BBS

3VTE LISTINGS SUPPLEMENT • APRIL-JUNE. 1987 215

1987-88 EDITORIAL CALENDAR

AUGUST

Prolog: A look at logic programming with articles on tips and techniques and explorations of the tasks Prolog is best suited for.

SEPTEMBER

Printer Technologies: An examination of the state of the art in printer technologies, including laser, liquid-crystal shutter, and ink-jet technologies.

OCTOBER

Heuristic Algorithms: Artificial intelligence techniques for giving computers the ability to learn from experience.

NOVEMBER

High-Performance Workstations: A tour of the technology underlying the workstations used by scientists and engineers in computer-aided engineering/design.

DECEMBER

Natural Language Processing: The technology of getting computers to understand the natural language of man.

JANUARY

Managing Megabytes: Looking at the ways computers store and retrieve data in situations where disk space is measured in gigabytes and memory is measured in megabytes. Also a look at the new applications that mega-memory and storage will permit.

FEBRUARY

LISP: A BYTE reexamination of the original language of artificial intelligence research.

MARCH

Floating-Point Processors: A look at the processors that speed the computation of mathematical operations in personal computers, including coprocessors and array processors.

APRIL

Memory Management: The hardware and software issues in managing a personal computer’s memory space.

MAY

CPU Architectures: An exploration of the latest 32-bit microprocessors, including digital signal processors and programmable graphics processors.

DISKS AND DOWNLOADS

ORDERING DISKS OF BYTE LISTINGS

Listings that accompany BYTE articles are available in a variety of disk formats and on Cauzin Softstrip. Each disk package (which sometimes consists of more than one disk) contains an entire month’s listings. If you want to order a disk package from a previous month, please call (603) 924-9281 to find out how many disks it includes. To order listings (for noncommercial use only), fill out this form and send a check or money order in the correct amount to:

BYTE Listings

One Phoenix Mill Lane

Peterborough, NH 03458

All prices include postage. Program listings can also be downloaded via BYTEnet Listings at (617) 861-6764.

BYTE issue:_

CP/M STANDARD 8-INCH FORMAT

All cost $9.95, $11.95 outside U.S.A.

Annual subscription is $79.95, $99.95 outside U.S.A.

COMMON 5‘/4-INCH FORMATS

All cost $8.95, $10.95 outside U.S.A.

Annual subscription is $69.95, $89.95 outside U.S.A.

□ Apple II □ MS-DOS 8 Sector

□ IBM PC □ Texas Instruments Professional

□ Kaypro 2 CP/M □ TRS-80 Model 4

COMMON 3V2-INCH FORMATS

All cost $9.95, $11.95 outside U.S.A.

Annual subscription is $79.95, $99.95 outside U.S.A.

□ Apple Macintosh □ Hewlett-Packard 150

□ Atari 520ST □ IBM PS/2

□ Amiga

SEND TO:

Name _

Street _

City_State or Province_

Postal Code _Country _

Check or money order enclosed for $_

216 BYTE LISTINGS SUPPLEMENT • APRIL-JUNE. 1987

Announcing BYTE’s New Subscriber Benefits

Y

Aoi

Program

.our BYTE subscription brings you a complete diet of the latest in microcomputer technology every 30 days. The kind of broad-based objective coverage you read in every issue. In addition , your subscription carries a wealth of other benefits. Check the check list:

DISCOUNTS

2 13 issues instead of 12 if you send payment with subscription order.

jjJ One-year subscription at S21 (50% off cover price).

Two-year subscription at S38.

Three-year subscription at S55.

Bf One-year GROUP subscription for ten or more at $17.50 each. (Call or write for details.)

SERVICES

BIX: BYTE’s Information Exchange puts you on-line 24 hours a day with your peers via computer conferencing and electronic mail. All you need to sign up is a microcomputer, a modem, and telecomm software.

Reader Service: For information on products advertised in BYTE, circle the numbers on the Reader Service card enclosed in each issue that correspond to the numbers for the advertisers you select. Drop it in the mail and we’ll get your inquiries to the advertisers.

Ei TIPS: BYTE’s Telephone Inquiry System is available to

subscribers who need fast response. After obtaining your Subscriber I.D. Card, dial TIPS and enter your inquiries. You’ll save as much as ten days over the response to Reader Service cards.

Disks and Downloads:

Listings of programs that accompany BYTE articles are now available free on the BYTEnet bulletin board, and on disk or in quarterly primed s up plement s .

B Microform: BYTE s available in microform from Unnersay Microfilm IncmaDonai in die ULS. aad Europe.

D 5>TFs BOMB: BYTE's Ongoing Mocazr Bor s your direct la* to Dt ecrrr's desk. Each month. wdc az rxt die amdrs via die Reader Service card. Your jeedbark hetps us

keep up to date on your information needs.

2 Customer Service: If you have a problem with, or a question about, your subscription, you may phone us during regular business hours (Eastern time) at our toll-free number: 800258-5485. You can also use Customer Service to obtain back issues and editorial indexes.

BONUSES

Bj Annual Separate Issues: In addition to BYTE’s 12 monthly issues, subscribers also receive our annual IBM PC issue free of charge, as well as any other annual issues BYTE may produce.

^ BYTE Deck: Subscribers receive five BYTE postcard deck mailings each year—a direct response system for you to obtain information on advertised products through return mail.

To be on the leading edge of microcomputer technology and receive all die aforementioned benefits, make a career decision today. Call toll-free weekday s. 8:30am to 4:30pm Eastern time: 800-258-5485.

And. . . welcome to BYTE country!

EVIi

~-E SMALL SYSTEMS JOURNAL

m

Borland’s new lirbo C:

The most powerful optimizing compiler ever

O ur new Turbo C* generates fast, tight, productionquality code at compilation speeds of more than 13,000* lines a minute!

It’s the full-featured optimizing compiler everyone has been waiting for.

Switching to TUrbo C, or starting with TUrbo C, you win both ways

If you’re already programming in C, switching to Turbo C will make you feel like you’re riding a rocket instead of pedaling a bike.

If you’ve never programmed in C, starting with Turbo C gives you an instant edge. It’s easy to learn, easy to use, and the most efficient C compiler at any price.

ii Turbo C does look like What We’ve All Been Whiting For: a full-featured compiler that produces excellent code in an unbelievable hurry... moves into a class all its own among fullfeatured C compilers ... Turbo C is indeed for the serious developer... One heck of a buy—at any

price. Michael Abrash,

Programmer's Journal * *

Join more than 100,000 Turbo C enthusiasts. Get your copy of Turbo C today!

All Borland products art iraoamarts or ra^swad tradamarics ot Borland warnai-on*. inc. or Boriand/A/n/yta. Inc Owtr brand and product namw arc trademarts or rto-SJarad trademarks o< m*r rt*>«ct>« no»dtrs Coorr QN 1M7 Borland mtamat>onai Bi-ti36

For the dealer nearest you or to order by phone call

(800) 255-8008

in CA (800) 742-1133 in Canada (800) 237-1136

4585 SC0TTS VALLEY DRIVE SCOnS VALLEY. CA 95066 (408)438-8400 TELEX: 172373

Only $99.95!

BORLAND

I N T E R H A T I 0 N A L

Technical Specifications

S' Compiler. One-pass optimizing compiler generating linkable object modules. Included is Borland's highperformance Turbo Linker. m The object module is compatible with the PCDOS linker. Supports tiny, small, compact medium, large, and huge memory model libraries. Can mix models with near and far pointers. Includes floating point emulator (utilizes 8087/ 80287 if installed).

S' Interactive Editor The system includes a powerful, interactive full-screen text editor. If the compiler detects an error, the editor automatically positions the cursor appropriately in the source code

S' Development Environment A powerful "Make" is included so that managing Turbo C program development is highly efficient Also includes pulldown menus and windows

S' Links with relocatable object modules created using Borland's Turbo Prolog* into a single program.

S' Inline assembly code.

S Loop optimizations

S Register variables

S ANSI C compatible.

S Start-up routine source code included.

S Both command line and integrated environment versions included.

S License to the source code for Runtime Library available.

Sieve benchmark

TUrbo C

Microsoft*

C

Compile time

2.4

13-51

Compile and link time

4.1

18.13

Execution

time

395

5.93

Object code size

239

249

Execution

size

5148

7136

Price

$99.95

1450.00

Table caption’Benchmark run on an IBM PS/2 Model 60 usng Trto C verson 1.0 me trto Lrter verson 10. Microsoft C version 4 0 and me MS overlay l*iker verson 3.51.

Minimum systam rtQuirtmanti: BM PC. XT. XT. PS 2 and trut compatbits PC-D0S (MS-DOS) 2 0 or later 3B4K