Gosub

When you run that program your message...which might be something different from what we suggested, of course...will simply hang there on the blank screen until you touch a key. That's just the beginning. After you've run this two liner and come back to BASIC and before you LIST or EDIT anything, enter (in COMMAND mode) ?Z$. Hey, that's the key you hit...if it was a character and not a control key. If it was a digit from 0 thru 9, try asking ?ZZ. That's a true number, not a string character. See the possibilities? Get fast action on IF Z=type statements. The Z-80 microprocessor will test ten. or fifteen of these in a fraction of a second and you can get a different branch with every one...without having to ENTER a response.

We've discussed just one subroutine to give you the general idea. Type yourself a few and try them with mini-programs or even in the command mode. The results will amaze you. When you test the screen boxes, #31, and #32, be sure to end your mini-program with a GOSUB 9 so you won t ruin the shape you have produced. Several other subroutines return useful information, like ZO which is the address where the centered line was written by #11. Some of the printer subroutines may not work because printers are notoriously non-standardized. Your assignment, if you care to accept it, is to "translate" those that don't work into your printer's "native'' language.

Note that some of the Z-variables are mnemonic and get used over and over: ZT$, ZL, ZT. etc. Make your own subroutines. We've left plenty of room below 200. Define the variables differently in each of them and then call some Z-Language. This multiplies the versatility of your "package" manyfold.

For a good look at Z-Language in action study the program listing for the Exatron Label Writer which is also in this issue. In particular, look at line 910 of that program to see two GOSUB 9 returning a line number toched by the user for instan-taneouslabeling of the text input box without the use of the ENTER key.

You may want to copy some, but not all, of the subroutines we have

80-U.S. Journal, January, 1982 79

listed. The first nine are basic (no pun!) and the second nine include several which are »needed in order not to mess up the boxes created by #31 and #32...which you really ought to have. The flicker routines, numbers 43 and 44 are useful in teaching programs to signal "RIGHT" or "WRONG" after the student has answered a question. The number conversions, #50 and

#51 are great if you are writing various kinds of monitors with PEEK statements. Type a few at a time and record them. Keep your numbers the same as ours or confusion can easily develop.

The elegant way to do this is to have them on a five-foot Stringy Floppy wafer. When you get the urge to program, ZAP! You're in Z-Language in just a few seconds.

By the time this appears in print, you should be able to get these from the Exatron Stringy Floppy Owners Association for the cost of one wafer. This will save you the trouble of copying them. ESFOA will be on the lookout for other subroutines to fit in all those missing numbers and we'll all be elegant program stylists with no effort at all. Disgusting isn't it? ■

Z-Language Summary GOSUB 29 does not apply to the Model 11 or Color Computer.

# Lines

Function

1 — Centers text ZT$ on current line

2 — Centers text ZB$ on bottom line

3 142 Prints line of 64 of character ZC$ on current line

4 3, 141, 142 Prints line of 64 of graphics block ZG

on current line

5 — Places cursor at start of line ZL

6 — Erases screen below line ZP and re turns cursor to start of line ZP+

7 — "Freezes" screen for ZS seconds

8 9 Prints message "HIT ANY KEY TO

PROCEED" on current line and "freezes" screen until user responds

9 — "Freezes" screen with no message un til user hits a key. Defines Z$=ikey hit). Also, if key is a single digit (0-9), defines ZZ as this number.

11 — Centers text ZT$ on line ZL and de fines ZO as the PRINT @ address for the start position of ZT$

12 2, 5 Same as #2 above but returns cursor immediately to start of line ZL.

character string on line ZL.

14 4, 5 Same as #4 above but writes the 64

graphics string on line ZL

15 — Places cursor at tab position ZT on line ZL

16 —- Erases the screen from the top thru line ZE and returns cursor to top of the screen

18 9 Same as #8 above except that the mes sage appears on the bottom line

17 — "Freezes" screen for ZS seconds and counts time with the message, "(n) SECONDS" at tab position, ZT on line ZL

19 — Prints text ZT$ at tab position, ZT on line ZL and defines ZO as the PRINT @ address for the start of text ZT$ NOTE: The following printer subroutines use the TRS-80 mode control codes native to the Okidata Micro-line 80.

21 26 Centers text ZT$ on a 64-character line using normal (10 per inch) characters

22 26 Centers text ZT$ on a 32-character line using large (5 per inch) characters and returns printer to normal (10 per inch) characters

23 26, 142 Centers a string of ZN characters ZC$

on the line

24 23, 26, Centers a string of ZN graphics 141, 142 blocks ZG on the line

25 — Feeds paper for ZN lines

26 — Sets printers for 64-character line (8

space margins). NOTE: The following specialty subroutines, although called by the line number shown, actually depend on subroutines which are listed beginning with line 101. 29 101-105 Causes printer to reproduce the entire image on the screen.

31 111-1.14 Draws a single line box around the ex treme outer edge of the screen.

32 106-110 Draws a double line box around the and 114 extreme edge of the screen

41 115-119 Prints text ZT$ at tab position, ZT on line ZL surrounded by a single line box

42 — Erases the contents of the box drawn by #41 but leaves the box

43 120-122 Causes text ZT$ to flicker on and off at the center of the screen. Number of "on" flickers is set by value assigned to ZF and the time of each appearance is set by the value assigned to ZD. Default values are: ZF= and ZD =20.

44 120-122 Same as #43 except that the text flick ers at tab position ZT on line ZL

51 124-134 Accepts a decimal value D and re turns its hexadecimal equivalent as H$

52 136-140 Accepts a hexadecimal number H$

and returns its decimal equivalent as D

Z-Language listing for Model I and III

0 CLEAR 500:CLS:G0T0 200

1 PRINTTABC(64-LEN(ZT$))/2)ZT$:RETURN

3 GOSUB 142:PRINTTAB((64-ZN)/2)STRINGSC ZN,ZC$);:RETURN

4 GOSUB 141:GOTO 3

5 PRINTED 64*ZL,;:RETURN

Better results. Microsoft's Level III BASIC and Editor/ Assembler-Plus are programming tools that help you write complex programs in less time, with less effort and utilizing less memory. Better programs. No matter what your programming skill. And for the first time these tools are available on disk.

Editor/Assembler-Plus. A powerful editing, assembly and debugging tool with many sophisticated features that make writing TRS-80 assembly language programs easier, faster and more efficient. ® Full disk capabilities.

• Assembly directly into memory. No need to save object code then reload for execution.

• Macro capability that allows you to define macros for commonly used sequences of instructions.

® Conditional assembly that allows you to generate more than one version of a program.

• Eight breakpoints at a time for program debugging.

• The INCLUDE statement that allows you to call additional disk files for assembly.

• Other features include extensive operators, automatic origin, symbol table printout, quash command, hex, decimal and octal constants, single step-through instructions in memory, five type-out modes, four type-in radices, plus extensive edit commands.

A more powerful BASIC. With Level III BASIC, you get power to perform tasks in BASIC that used to require assembly language. Plus, new ease-of-use features for your TRS-80.

® Advanced graphics. Develop charts, graphs, even animation in Level III BASIC. Draw a line, an outline box or

Now on disk.

a solid box by specifying just two points. Then save and recall it with BASIC commands. ® MENU. One command that allows you to construct an entire menu.

® CHAIN and COMMON commands allow you to call another program and pass variables to it.

• Powerful editing commands such as COPY/TRANSFER, FIND and CHANGE.

® DUMP command that makes debugging easier. ® Time-limit response. New INPUT # LEN and LINE INPUT # LEN commands allow you to set, a time limit on response.

• RS-232 output from BASIC. With a single command. ® More. Level III gives you automatic line numbering, 26

user-definable single stroke instructions, and more. Disk or cassette. Disk versions of Level III and Editor/ Assembler-Plus are brand new. Cassette versions are also available with many of the same capabilities. Talk to your Microsoft™ dealer. Ask for a demonstration of two of the most powerful tools you can get for your TRS-80: Level III BASIC and Editor/Assembler-Plus. On disk or cassette. From Microsoft.

TRS-80 is a trademark of Radio Shack, a division of Tandy Corporation.

Microsoft is a trademark of Microsoft, Inc.

Microsoft Consumer Products is a division of Microsoft, Inc.

/MICROSOFT

V CONSUMER^ PRODUCTS P

400 108th Ave. N.E., Bellevue, WA 98004. (206) 454-1315

6 PRINTS 64*(ZP+1),; : FOR Z=1 TO 14-ZP-.P RINTSTRINGS(64," ");:NEXT:PRINTS 64*( ZP+1),;:RETURN

8 PRINTTAB(21)"TO PROCEED HIT ANY KEY"

9 Z$=INKEY$:IFZ$=""THEN 9 ELSE ZZ=VAL(Z $):RETURN

0 0

Post a comment