New HP-71B Program - YATZ71



#2

http://retrocalculator.com/software/yatz71-1.0.tgz

From the README:

YATZ71 is the result of my attempt to reacquaint myself with the joys
of programming in BASIC on a memory constrained computer from the
1980s. I never touched an HP-71B back then, let alone programmed one,
but there were, nonetheless, strong points of reference between the
machines I did use and this cool little handheld BASIC computer. Even
though the BASIC on the 71 is much better than Applesoft, to give an
example of a language I used an awful lot, the similarities were
stronger than the improvements HP's BASIC offered. In a nutshell,
BASIC sucks. The line numbers clutter the code visually, and nine
times out of ten serve no other purpose than that. Compounding this,
the interpreter in both machines renders all keywords and variable
names in upper case only, regardless of how you type them in. Then
there's the generous provision of two whole characters for variable
names themselves. And the second character has to be a number! Yecch!
I knew all of this at one time, and blissfully forgot about it as I
went on to more capable languages, with their own set of endearing
quirks and foibles.

So why do I feel so good about having written this stupid little
Yahtzee clone in BASIC? I guess it's the pride of having overcome the
visual clutter, the enforced spaghetti, the unhelpful variable names,
the slow speed and tiny memory to produce something that actually
works. This is a game that I actually play every day. (But I'm easily
amused.)

But there's also the fun of the time I spent playing with the cool toy
that is the HP-71B while writing this program. It really is a
remarkable little machine, considering what its contemporaries were up
to. I had to learn how to use HPILLINK, for example, in order to be
able to edit the source in an environment where I could search for
variable names and so forth.


#3

Quote:
on a memory-constrained computer from the 1980s

The 71 came with only about 17K of RAM, of which 16K was available to the user. Third-party modules allowed adding a whole lot more. My own 71 has an extra 160KB of RAM in two ports, and, if you wanted to pay enough enough back then, there was a company that would hard-wire 256KB inside so it wouldn't take up any of your ports.
Quote:
the similarities were stronger than the improvements HP's BASIC offered. In a nutshell, BASIC sucks.

A factor that made HP-71 BASIC potentially so great was the LEX (Language EXtension) file contributions from the user groups which added so many great functions to the BASIC. LEX files are written in assembly and add statements, functions, operators, and program structures that actually become part of the BASIC. They usually come with BASIC programs to get them entered into memory without needing an assembler or text editor. You might be able to get much of that from the CD ROMs offered by this website, hpmuseum.org. I keyed mine in from the CHHU Chronicle, the magazine of the Club of Hewlett-Packard Handheld computer Users in the 1980's.
Quote:
The line numbers clutter the code visually

I sometimes used my text editor to write a program with no line numbers (using labels to branch to), spacing things the way I want, and then another little program that adds the line numbers and uses TRANSFORM to turn it into a BASIC file. The Forth/Assembler ROM comes with a text editor, but I was able to write a much better one using the user group LEX files. WorkBook 71, by Richard Harvey in Glendale, AZ is a set of programs for spreadsheet, file management, and report generation. He included a full-screen text editor for use with one of the video adapters. Maybe some here knows if WB71 is on the CD ROMs.

Using this text-editor-TRANSFORM process to write a program, you will not get the error-checking every time you enter a line, but you can make your code clearer with meaningful white space (indentation, etc.) so that once you're familiar with the language, the likelihood of entering erroneous lines is diminished. The process lets you start with long variable names if you wish, in both upper- and lower-case, and then use your search-and-replace function at the end to change them to names BASIC likes.

Although the 71 BASIC variable naming method was definitely suboptimal, their system did allow you to run everything together on a line, with no spaces in most cases, and the 71 could figure it all out. I don't think that would be possible with long variable names.

Quote:
the enforced spaghetti

The Paname module provided other programming structures like a multi-line CASE statement. I never did get that one myself. I don't know if there might be LEX files available that you could key in yourself that might get the same functions.
Quote:
the slow speed

The 71 is sure slow by today's standards, but was very fast at math for its time. With the math module, you could do complex FFTs twice as fast as a PC running GWBASIC, and a whole lot bigger. It took about 40 minutes for me to do 8K-point FFTs on data downloaded from a digital oscilloscope over the IEEE-488 interface. A 1K-point took about 4 minutes, using 12-digit floating-point (which was overkill).
Quote:
I had to learn how to use HPILLINK, for example, in order to be able to edit the source in an environment where I could search for variable names and so forth

If you have the program in text form, you can do the search with a text editor. If the program is in BASIC form, there's a variable cross-reference program that lists all the variables used and where they are referenced in the program. You'll find it in the HP-71 Users' Library Solutions, Utilities book, HP number 00071-90066, which again might be available in the CD ROMs available from this website.

#4

The Paname module provided other programming structures like a multi-line CASE statement.

PANAME module for HP-71B? I think you are talking about JPC ROM ...

#5

Thanks for the detailed and interesting response, Garth!

Quote:

The 71 came with only about 17K of RAM, of which 16K was available to the user. Third-party modules allowed adding a whole lot more. My own 71 has an extra 160KB of RAM in two ports, and, if you wanted to pay enough enough back then, there was a company that would hard-wire 256KB inside so it wouldn't take up any of your ports.


I have a 64K CMT module and three HP 4K modules in my work system. That gives me more than a stock Apple ][ had. The theoretical maximum of 512K, or even the 256K you mention, were huge by contemporary standards. But I stand by the description of the machine as "memory constrained," compared to the 1GB in two of my servers, my laptop and my main workstation, that is. 8)

Quote:

A factor that made HP-71 BASIC potentially so great was the LEX (Language EXtension) file contributions from the user groups which added so many great functions to the BASIC. LEX files are written in assembly and add statements, functions, operators, and program structures that actually become part of the BASIC. They usually come with BASIC programs to get them entered into memory without needing an assembler or text editor. You might be able to get much of that from the CD ROMs offered by this website, hpmuseum.org. I keyed mine in from the CHHU Chronicle, the magazine of the Club of Hewlett-Packard Handheld computer Users in the 1980's.


I can access the swap disks, so I can load all the great LEX files from that source. I agree that's one of the coolest features of the HP-71B, and of the HP-75 before it.

Quote:

WorkBook 71, by Richard Harvey in Glendale, AZ is a set of programs for spreadsheet, file management, and report generation. He included a full-screen text editor for use with one of the video adapters. Maybe some here knows if WB71 is on the CD ROMs.


I don't think it is. One of my interests in working with these machines is to conserve old software and documentation. If anyone has a copy of this software lying around, I'd love to hear from you.

Quote:

Although the 71 BASIC variable naming method was definitely suboptimal, their system did allow you to run everything together on a line, with no spaces in most cases, and the 71 could figure it all out. I don't think that would be possible with long variable names.


That's making a virtue from necessity. The underlying problem was the lack of memory.

Quote:

The Paname module provided other programming structures like a multi-line CASE statement. I never did get that one myself. I don't know if there might be LEX files available that you could key in yourself that might get the same functions.


As HrastProgrammer notes below, I think you mean the JPC ROM. I've played with this great ROM using emu71, including the nice structured programming elements. It certainly goes a long way toward making me more comfortable with the BASIC. With those mods, the HP-71 basic starts to approach the flexibility and power of Rocky Mountain BASIC, which was the best contemporary BASIC I know of.

There's a problem with relying on a custom ROM though. If you want to distribute software, then you have to assume your users will have the ROM you are using. For example, In my current efforts with the HP-71B, I'm trying to disassemble certain LEX files so I can add to them. One disassembler I've come across is DISASMKW, by Mike Markov. Here are the first two lines of that program:

0010 ! DISASMKW - (c) by Michael Markov, 1988/06/13 version 123
0020 ! Needs TSORTLX9, DISASMLX, EDLEX, JPCROM, HPILROM AND STRINGLX

Yikes! Well, I can still use this software, but only under emu71, since I don't have a real JPC ROM at my disposal.

Quote:

The 71 is sure slow by today's standards, but was very fast at math for its time. With the math module, you could do complex FFTs twice as fast as a PC running GWBASIC, and a whole lot bigger. It took about 40 minutes for me to do 8K-point FFTs on data downloaded from a digital oscilloscope over the IEEE-488 interface. A 1K-point took about 4 minutes, using 12-digit floating-point (which was overkill).


Interesting measure of the performance of this little guy!

In terms of YATZ71, the slowness shows up in the graphics. I first tried to use BINIOR to write a cursor under the dice images. I got this to work, but it was unusably slow. (I could probably get reasonable speed with a custom implementation in assembly.) What I finally ended up doing was toggling the dice images in response to numeric inputs. This is still slow, but borders on being usable.

Quote:

If you have the program in text form, you can do the search with a text editor. If the program is in BASIC form, there's a variable cross-reference program that lists all the variables used and where they are referenced in the program. You'll find it in the HP-71 Users' Library Solutions, Utilities book, HP number 00071-90066, which again might be available in the CD ROMs available from this website.


No, it's not there. There is a lack of extant material for the 71B on the Internet today. I want to try to remedy that, as far as I can, by providing a repository of such information at retrocalculator,com (or hp71.org, which I've also registered.) If you have any materials that you would like to donate to this effort, I'd be delighted to hear from you. 8)


#6

Quote:
I have a 64K CMT module

That's one I have. My other one is 96K in the card reader port, which was all I could afford at the time even though CMT offered up to 160K in the card reader port. My total is 177K. That quantity would never be necessary except that I like to keep 100 or so files in there all the time and still have room for large data arrays.

Quote:
and three HP 4K modules in my work system.

Hmmm.... that fills up your ports, not leaving room for anything else.

Quote:
The theoretical maximum of 512K

You can't have 512K of RAM though, because some of the address space is taken by ROM, at least for the OS if not for other modules as well (HPIL, Math, etc.).

Quote:
But I stand by the description of the machine as "memory constrained," compared to the 1GB in two of my servers, my laptop and my main workstation, that is. 8)

But do consider how efficiently any given computer uses memory. Back before I had Windows on my PC, I had a 32MB HD, but never filled more than about 20MB of if in spite of the many complex multi-layer printed circuit board layouts on it, all the embedded software projects on it, the manuals, endless letters and E-mail (plain text only, which takes one byte per character), the OS and my CAD, assemblers, compilers, and device programmer software and probably a lot of things I'm forgetting now. I had 1MB of RAM and never ran out.

Quote:
I had written:
WorkBook 71, by Richard Harvey in Glendale, AZ is a set of programs for spreadsheet, file management, and report generation. He included a full-screen text editor for use with one of the video adapters. Maybe some here knows if WB71 is on the CD ROMs.

You responded:
I don't think it is. One of my interests in working with these machines is to conserve old software and documentation. If anyone has a copy of this software lying around, I'd love to hear from you.


I have it. If you get permission to make it public, I can loan it to you to put on CD ROM or the web. The software is on tape for the HP82161A drive.


Quote:
I had written:
The Paname module provided other programming structures like a multi-line CASE statement. I never did get that one myself. I don't know if there might be LEX files
available that you could key in yourself that might get the same functions.

You responded:
As HrastProgrammer notes below, I think you mean the JPC ROM.


Ah yes, you're probably right. I think it came from the Paris user's group, which is why I said "Paname."

Quote:
With those mods, the HP-71 basic starts to approach the flexibility and power of Rocky Mountain BASIC, which was the best contemporary BASIC I know of.

After learning the 71 system well, I used HP's Rocky Mountain BASIC 5.1 at work and absolutely hated it. I expected it to be better than 71 BASIC, but there were all kinds of things it couldn't do that the 71 did with ease, and with a lot less memory. There seemed to be a lot of discontent with HP BASIC in the field, and TransEra took advantage and introduced HTBasic. I never had the oportunity to try that. When we dumped the HP BASIC we went to a completely different hardware platform in our automated production testing.

Quote:
0010 ! DISASMKW - (c) by Michael Markov, 1988/06/13 version 123
0020 ! Needs TSORTLX9, DISASMLX, EDLEX, JPCROM, HPILROM AND STRINGLX

Yikes! Well, I can still use this software, but only under emu71, since I don't have a real JPC ROM at my disposal.


Yes, it would be nice to get all that stuff in various forms (even paper) so it could be used by anyone with enough RAM, since the modules are basically unavailable now.

Quote:
I had written:
If you have the program in text form, you can do the search with a text editor. If the program is in BASIC form, there's a variable cross-reference program that
lists all the variables used and where they are referenced in the program. You'll find it in the HP-71 Users' Library Solutions, Utilities book, HP number 00071-90066, which again might be available in the CD ROMs available from this website.

You responded:
No, it's not there. There is a lack of extant material for the 71B on the Internet today. I want to try to remedy that, as far as I can, by providing a repository of such information at retrocalculator,com (or hp71.org, which I've also registered.) If you have any materials that you would like to donate to this effort, I'd be delighted to hear from you. 8)


I can give you copies of lots of good material, but it'll be awhile before I can spend the necessary time at the copier. It'll be a big job.


#7

Quote:

That's one I have. My other one is 96K in the card reader port,


Mine is 64K in the card reader port. I also have a 96K homebrew someone made that fits in the CR port. It works, but it sucks down batteries, so I leave it out.

Quote:
Quote:and three HP 4K modules in my work system.

Hmmm.... that fills up your ports, not leaving room for anything else.


Since my 64K is in the CR port, my port 1 is available for my HP-41 emulator. If I need something else, I'll just pull one or more of the 4K modules.

Quote:
You can't have 512K of RAM though, because some of the address space is taken by ROM, at least for the OS if not for other modules as well (HPIL, Math, etc.).

Ah, yes. Of course. Well, that's 64K for the OS. HPIL takes 16K, FORTH and HP-41 emulator both take 32K, (It's one or the other; they won't coexist,) JPC is 32K. So if I were to have a setup including JPC and the HP-41 modules, that would leave 344K aboove the built in 24K available. That would be pretty cool. 8)

My emu71 setup has 160K in port 0 plus a 32K IRAM in port 5

Quote:
But do consider how efficiently any given computer uses memory.

That's quite true. The 71B can actually get work done in 24K. The explosion in RAM and hard disk sizes have lead to a lot of waste. But not all use of the big memory pool is wasteful, even if it appears to be. I'm an old command line jocky, but GUIs actually do increase productivity for the majority of users. I'm sitting in front of two 20" LCD monitors right now, showing a single desktop on my Linux system. (Actually, the left hand display has an rdp session to my work laptop running Windows 8( ) I actually use all of that real estate. I'd feel severely cramped going back to a single monitor.

Quote:

WorkBook 71, by Richard Harvey in Glendale, AZ ..

I have it. If you get permission to make it public, I can loan it to you to put on CD ROM or the web.


Oh, cool! There happens to be a shareware author named Richard Harvey in Glendale AZ. I've sent him mail asking if WorkBook 71 is his creation, and if so, if I can make it available. Thanks for suggesting this!

Quote:
After learning the 71 system well, I used HP's Rocky Mountain BASIC 5.1 at work and absolutely hated it.

Interesting. My comment about 71 BASIC rising to the level of RMB hs to do with the latter's standard REPEAT .. UNTIL, WHILE .. END WHILE and SELECT .. CASE .. END SELECT constructs. When I first used RMB, in 1985, those things just weren't available in most BASICs. They weren't even there with the 71, out of the box. The other thing I liked about RMB was the fast I/O. We were doing hydrographic survey with surface navigation and bathymetry. So we would plot the vessel's surface position and sometimes features on the bottom of the sea. We would also display the ranges to the radio nav stations in real time. The radio navigation used HP-IB and the others a mixture of that and RS-232. Tying this together was a little 9816 running an interpreted BASIC. Coming from an Apple ][, I was mighty impressed! There were other "real" language features like named "COM" which were like FORTRAN COMMON blocks. You could build structured, modular software, and let the subs selectively see the global namespace with COM. Anyhow, I was a fan. I've just obtained a 9816 and have it on my list to write some software in RMB. I'll have a better feel of the two languages after I do that.

Quote:
I can give you copies of lots of good material, but it'll be awhile before I can spend the necessary time at the copier. It'll be a big job.

Anything you can offer, I'd be grateful for. Thanks, Garth!


Possibly Related Threads...
Thread Author Replies Views Last Post
  HP Prime: run a program in another program Davi Ribeiro de Oliveira 6 1,451 11-11-2013, 08:28 PM
Last Post: Davi Ribeiro de Oliveira
  HP-IL 71B to 71B via HPIL Geoff Quickfall 11 1,835 12-01-2010, 06:55 PM
Last Post: Michael Meyer
  HP-41 MCODE: Making an MCODE program call another MCODE program Geir Isene 10 1,745 01-13-2008, 05:58 AM
Last Post: Raymond Del Tondo
  Surveying program for the HP-71B Gerson W. Barbosa 2 671 08-28-2007, 08:46 PM
Last Post: Gerson W. Barbosa
  Question: 71B <-HPIL -> 71B john smith 16 2,093 05-12-2003, 06:37 AM
Last Post: John Smith

Forum Jump: