Professional Documents
Culture Documents
~
COMPUTER
SYSTEMS WE ACCEPT MlC. VISA. AM EXP
INC . PLACE ORDERS TOLL FREE
1-800-4 21 -5150
15620 South Inglewood Ave . (CONTINENTAL U.S. ONLY)
Lawndale, California 90260 (EXCEPT CALIFORNIA)
(213) 970-0952 CP / M is a Irademark 01 Oigl1al Res ea rch
-
proceuing is required. A keyboard bvff er permits fosl Iyping Conlrol • End of Page Con trol· Non Prin ti ng Text
CommenT ing • lin~ & Paragraph Indentatien •
-
withou t charac te r lou.
the HP-41 C has up to three labels associated with it: the label CP/M
Seria l Dioblo, NEC, Qume S 300.00
TRSDOS
S 350.00
Center i n g · Underlining · Boldroce
etched into the top face of the key, the label visible directly All ot he r printers ••••• S 275.00 S 325.00
VISA
above the key , and a letter of the alphabet (enabled by toggling The Elec t ric Pencil I is st ill ovoiloble for TR5.aO Model I
users . Although not as .sophisticated os Elec tr ic Pencil II, it
is stilt m extr emely easy to lISe md power ful word processing
the ALPHA button) etched into the bottom face of the key. system. The software hos been desi9"ed to be used wi th both
Level I (16K system) Q'ld Level II models of the TRS-SO. Two
Additional functions are called by hitting the XEQ button and
spelling out the function name. (Photo courtesy of Hewlett-
versiO"\S, one for use wilh cosselle, Qr'Id Qr'Ie for use wi th disk,
a re available Q'l cosselle . The TRS-aO disk version is cosily
transf e rred to disk md 15 fully Interactive with the READ , m MICHAel SHRAYER SOFTWARE. INC.
1198 Los Robles Dr .
Packard.)
WRITE, DIR , OI"Id KILL rout ines of TRSDOS.
TRC
TRD
Cassp,tw .•. , ••• S 100.00
Disk . . • • • • . . • S 150.00
5S Palm Springs. CA, 92262
(714) 323·1400
Circle 167 on Inquiry card . December 1980 © BYTE Publical ions tn c 245
To facilitate the entry of multiple-key sequences, the dresses or instruction lengths; instead, programs are
display provides prompting messages, and invalid keys entered on automatically numbered lines, as is done on
are disabled . In addition to the normal clear-display key, many microcomputer text editors. Lines may be freely in-
there is a backspace key to facilitate corrections. If you serted or deleted anywhere, with automatic renumbering
forget the name of a function (programmed or standard), of subsequent lines . Alphabetic labels of up to seven
depressing the CAT (catalog) key will list all functions characters can be used for tagging the destination of
currently known to the calculator. branches or for program, subroutine, and function
names. Also, any number of programs may be resident in
Memory memory, each uniquely indentified by an alphabetic
The HP-41C has continuous memory, which means name. Programs can be selectively edited, deleted, or
that the contents of memory are preserved even when the entered without affecting other programs.
calculator is turned off. You can even replace the bat- Best of all , the key codes displayed by other calculators
teries without destroying the contents of memory . The are gone, and are replaced by mnemonic instruction dis-
HP-41C's size-N throw-away batteries typically last 1 or plays. For example, if you examine an instruction for
2 months, instead of the 9 to 12 months claimed in the storing a number into register 15 on the Texas In-
documentation. A BAT annunciator warns you when struments TI-59, it is displayed on three separate lines as
you have only about 2 weeks' worth of life left in the bat- "42", "01", "05", where "42" is the TI-59's key code for
teries. The HP-41C can also be run using an AC adapter. the STO key. On the HP-41C, however, the same opera-
Not only are user programs saved in continuous tion is displayed on a single line as "STO 15". This im-
memory, but so is virtually everything relating to the provement is analogous to stepping up to assembly-
calculator: data, flags, user-key assignments, registers, language programming from machine-language, an ad-
and display formats. You can even set a flag so that, vantage that really speeds up program development and
when you turn on the calculator, it immediately con- checkout.
tinues executing a program from where it left off when Two powerful loop-control instructions have been
shut down! added to the function repertoire of the HP-41C: incre-
The standard calculator contains sixty-three registers ment and skip if greater (ISG), and decrement and skip if
of memory. Each register is 7 bytes long and can be used equal (DSE). These instructions allow a single register to
to store one number, up to six characters, or several pro- serve as a loop counter, increment value, and final value
gram steps. The total memory space can be partitioned simultaneously, by coding the number in the register in
into any combination of program and data storage, or it the form:
can be left at the default partition of seventeen data
registers and forty-six program registers. The instruction iiiii.fffcc
set contains eighty-six I-byte instructions, thirty-one
2-byte instructions, three 3-byte instructions, and one where iiiii is the current counter value, ftf is the final
4-byte instruction . Instructions with alphanumeric value , and cc is the increment. For example, the BASIC
operands such as LABEL, GOTO, etc, use 1 extra byte loop:
per character. In a typical mix of instructions, the HP-
41C can store about 200 lines of program code in the FOR I 1 TO 50 STEP 2
default forty-six registers of program space. An HP-41C
containing four optional expansion-memory modules
contains over 2.1 K bytes of continuous memory, capable
of storing an average of over 1300 program steps. NEXT I
CIP MF Series 2 Same as above plus 20K RAM; real ·tlme clock, 90K
mini floppy & more . $1279 S1126
630 1/ 0 Expander Board (add to C1P or C1P MF) 16 color output; dual
8 axis joystick interface; home security interface; 16 line parallel li D;
programmable sound generator & more . $229 $202
CALL NOW • TOLL FREE
FARAGHER ASSOCIATES. INC.
1-800-558-0870 7635 W8LUEMOUND MILWAUKEE, WI 53213
HOURS: C.ST M-F 8-6 SAT, 9-1
MASTER CARD • VISA
246 December 1980 © BYTE Publicati ons In c Circle 168 on inquiry card .
TONE VALUE- 0 3 4 8
Figure 1: Musical notes on the HP-41C. The TONE function on the HP-41C produces one of ten musical notes that roughly corres-
pond to the notes presented in this figure.
STO 01 Store the loop-control number in which normal execution resumes. The data entry flags
register 01 can be tested to see if any keys were depressed during a
LBL 'TOPLOOP" Top of loop label pause; if so, the corresponding key indentifications,
which are stored in the display register, are available to
the program. This feature facilitates the programming of
games with real-time user responses .
ISG 01 Increment register 01 by 2, skip
next line if greater than 50 Let the Music Play
GTO 'TOPLOOP" Otherwise, repeat this loop The calculator can produce ten different audible tones
under keyboard or program control. I found the volume
The integer part (iiiii) of register 01 is incremented by 2 in level of the tones a little too low for my taste; it is barely
each pass until 51 is reached; the GTO is then skipped audible in a noisy office. After successfully programming
and the loop is exited at the bottom. "Mary Had a Little Lamb," I decided to tabulate which
A full complement of indirect operations (including in- musical notes are actually provided; the results are
direct subroutine calls) and register arithmetic are sup- presented in figure 1. Those with perfect pitch may find
ported. Subroutines may be nested up to 6 levels deep. the error in the frequencies of the notes a little annoying,
Ten different compare operations are available, including but the tones are close enough to produce recognizable
a test for character string equality. Fifty-five flags are music.
provided, some of which are predefined for controlling
calculator functions such as display format, mode of Documentation
operation, etc. One of life's little pleasures is reading Hewlett-Packard
There are eleven user-defined flags, five of which have documentation, which is among the best in the industry .
built-in status annunciators on the display . I found the It took me three evenings to finish the entire 268-page
flags with annunciators useful for monitoring program HP-41 C Owner's Handbook, working each example pro-
execution during debugging. Since running programs gram as I read . For me, the manual struck just the right
have complete control over the display format, it is easy balance between simplicity and comprehensiveness. My
to display several labeled numeric values on the display only complaint is that the text does not always make
at the same time. User-defined prompts for data entry are clear which functions are available on the keyboard and
also easily programmed. In fact, an executing program which must be spelled out. For instance, I spent several
can even turn the calculator off . minutes fruitlessly searching for the multiple-line-delete
(DEL) function shown in the example on page 138 as a
Error Detection key, only to conclude that it must be accessed by depress-
When a running program encounters an error condi- ing:
tion, the calculator displays an English error message.
Dividing .by 0, for instance, produces the diagnostic XEQ ALPHA DEL ALPHA
"OUT OF RANGE". If you depress the PROG key, the
display will show the exact line number and instruction A second manual, HP-41C Standard Applications
that caused the error. If desired, a flag can be set to ignore Handbook, gives ten sample programs ranging from
errors, or errors can be detected under program control hexadecimal conversions to a blackjack game. These pro-
for user-specified recovery. grams detail a wealth of programming techniques in-
Besides flags for various error conditions, there are cluding random-number generation, character-string con-
flags that detect whether the data entered is numeric or catenation and substring extraction, display formatting ,
alphabetic in nature . Since these flags are set only if data table lookup, etc. In addition, a year's free membership
is entered, they can be used in conjunction with the to Keynotes , the HP calculator newsletter, is included
PAUSE function to poll the keyboard during program ex- with your purchase.
ecution to see if a key has been depressed . The PAUSE in- Membership in a user's library group is available on a
struction activates the keyboard for about 1 second, after subscription basis for $20 per year. This subscription en-
Expansion
One of the most exciting aspects of the HP-41C is the
array of available peripheral devices, including:
250 December 1980 © BYTE Publications Inc Circle 171 on inquiry card.
standard magnetic card reader and larger standard calculators. I programmed both calculators in the same
memory (960 bytes, as opposed to 441 bytes on a stan- manner, deliberately trying to avoid "trick" program-
dard HP-41C). (Price information for the Hewlett- ming but taking advantage of each machine's strengths
Packard machine is given at the end of this article .) Of where possible (such as short-form addressing on the
course, it doesn't have an alphanumeric display or con- TI-S9 and stack manipulation on the HP-41C).
tinuous memory; still, it is an attractive alternative to the The programs for the HP-41C and the TI-S9 are in
HP-41C. listings 1 and 2, respectively. Although I expected the
I decided to run a small benchmark test to compare HP-41C to run slower since it uses ultra-low-power
speed and memory usage on both machines. Conducting technology , both calculators took about the same
proper benchmark tests is an involved and time- amount of time to execute the benchmark. The HP-41C
consuming process. Instead, I settled for one represen- program uses less memory space, but of course it has
tative test that should be adequate for at least rough com- only about half as much memory available in its standard
parison. I programmed both the HP-41C and the TI-S9 to configuration.
compute the present value of a bond with "periodic
coupons, " as given by the formula:
N
P=IE(l+ yr +M(l+ yr
J N
Listing 1: HP-41C benchmark program to calculate the present
J=l v alue of a bond with "pe riodic co upons." This problem ,
desc ribed in th e text, w as used as a ben chm ark program against
where : the Texas Instrumen ts TJ-59 because it uses both arithmetic
calculations and program loo ping. Th e TI-59 ben chmark pro-
gram is given in listing 2, and the results of th e comparison are
P present value
given in table 1.
I coupon value HP-41C program steps often consist of multiple keystrokes;
N number of periods each step is shown in this listing as it appears in th e calculator's
M maturity value disp lay after entry , w ith one exceptio n: characters en tered in
Y yield rate, in percent alphabetic m ode on th e calculator are shown here en closed in
quotes. O n th e calculator's display the quotes do not appea r,
I picked this example because it requires a mix of bu t the characters are preceded by a superscript "T il.
arithmetic, looping, and register operations; I intuitively
felt that this mixture is representative of the operations REGISTERS
performed in many of the problems suitable for pocket
R, M, maturity value
R, N, number of periods
and J, loop index
RJ I , coupon value
1 + Y, where Y is yield
GREAT R.
rate as decimal fraction
01 LBL "BOND"
XMAS 02
03
FIX 2
STO 01
Set dollars and cents format
SAVE M in 01
04 STOP Input N
05 STO 02 Save N in reg 02
06 STOP Input I
07 STO 03 Save I in reg 03
08 STOP Input Y
09 100
10 / Convert to decimal fraction
ATTACH E STYL E CAS ES FOR CARRY ING AND PROT ECT ING A COM· II 1
PLETE COM PUTER SET-UP . CONSTRUCTED OF THE HIGHEST OUALITY
LUGGAGE MAT ERIAL WITH SADDLE STITCHING W ILL ACCOMMODATE
12 +
EQUIPMENT IN A FULLY OPERAT IONAL CONFIGURATION ALONG WITH
13 STO 04 Save 0 + YJ in reg 04
MANUALS . WORK ING PA PE RS AND D ISKS . NEVER A NEED TO REM OV E 14 RCL 02
EQUIPMENT FROM CASE . SIM PLY REMOVE LID . CONNECT POWER AND 15 CHS
OPERATE . LID CAN BE REPLACED AND LOCKED FOR SECUR ITY AND
PROTECT ION W IT H OUT D ISCO N NECTING CABLES FULLY TESTED
16 Y/X o + yr N
17 RCL 01
18 M* O + N
yr
• AP101S Apple and Single Disk Drive .................... .... .... .... ...... Sl09 19 0 Initialize sum to 0
• AP 102D Apple and Double Disk Drive ... ............ ... .. .... .. .. .......... 119 20 LB L 01 Top of summation loop
• AP103M Apple , 9 inch Monitor and Double Drive ....... ............ 129 21 RCL 04 (l + YJ
• RS201 TRS-80 , Expansion Unit and Double Drive .. ..... .... ....... 109 22 RC L 02 J
• RS202 TRS-80 Monitor and Accessories .... .. ..... ....... ...... ............. 84 23 CHS - J
•
•
P401 Paper Tiger Printer ....... .... .. ... ...... ... ..... ..... ............................ 99
P402 Line Printer Ii-Centronics 730 ..... ...... ................. ............. .... 89
24 Y/X o+ yr J
2S2 December 1980 © BYTE Publications Inc Circle 173 on inquiry card .
Listing 2: Texas Instruments TJ-59 benchmark program to 056 43 RCL
calculate the present value of a bond with "periodic coupons. " 057 06 6 Plus first term .. .
Th e results of the comparison with the HP-41C are given in 058 95 Result is P
table 1. 059 91 RIS
060 00
REGISTERS
RI M, maturity value
R, N, number of periods, A subjective conclusion I drew after programming
and L loop index both calculators is that the HP-41C is much easier to pro-
RJ I, coupo n value gram and debug because of its line-oriented, mnemonic
R, 1 + Y, where Y is yield display. The results of this comparison are given in table
rate as decimal fraction
R. scratch register for 1.
summation
Sample Program: Codebreaker
DISPLAY KEY Because I am a games enthusiast, I decided to write a
LINE CODE ENTRY COMMENTS game program as an example of an HP-41C program. I
programmed a variation of the popular "codebreaker"
000 76 LBL type games, where the calculator generates a random
00 1 11 A
002 58 FIX Set dollars and cents format code and the player attempts to guess the code . The
003 02 2 flowchart for this program is given in figure 2.
004 42 · STO To begin, the player first decides on the number of
005 01 1 Save M in reg 01 digits for the code, from three to five digits. Assume that
006 91 RIS Input N
007 42 STO a three-digit game is chosen. The calculator will then
008 02 2 Save N in reg 02 secretly pick a three-digit number with no two digits the
009 91 RIS Input I same. The user then enters a three-digit guess.
010 42 STO After evaluating the guess, the calculator displays the
011 03 3 Save I in reg 03
number of digits that are exactly right and the number of
0 12 91 RIS Input Y
013 55 I digits that exist in the true code but are not in the proper
014 01 1 Convert to decimal fraction position. For example, if the secret code is 108 and 802 is
015 00 o the guess, the display will show:
016 00 o
017 85 + 802 RT:1 MP:1
018 01 1
019 95
020 42 STO indicating one entirely right (RT) digit (the 0) and one
021 04 4 Save (1 + Y) in reg 04 misplaced (MP) digit (the 8).
022 45 yx o + y)"N ... The user continues guessing until the correct answer is
023 43 RCL
Text continued on page 258
024 02 2
025 94 +1-
026 65 x
027 43 RCL
028 01 1 TI-59 H P-41 C
029 95
030 42 STO Number of data registers used 5 4
031 05 5 Save MOO + y)" N Program size (as displayed) 59 lines 31 lines
032 25 C LR Program size (internal representation) 59 steps 41 bytes
033 42 STO Total memory used/total memory 99/960 69/441 (69/2233)
034 06 6 Percentage of total memory used 10.3 15.6 (3.0)
Execution time , seconds 43 37
035 76 LBL
036 44 SUM Top of summation loop Benchmark equation programmed :
037 43 RCL
038 04 4
yX
p = /
N
E (1 + yr J
+ M(1 + yr N
039 45 J=1
040 43 RCL
041 02 2 Data used:
042 94 +1- -J M = 20 ,000 , N = 50 , / = 1400, Y = 8%
043 95 o + yr J
IN PUT
DESIRED
NUMBER
DIGITS, P ~ SAME
.?
NO
YE S INCREMENT
# RIGHT
COUNT, RT
J
ALL
INITIALIZE NO P DIGITS
LOOP TRIED
?
YES
LOOP
SAVE NEW
RANDOM
DIGIT, R
GET NEXT
GUESS DIGIT,
D
PICK NEW
RANDOM
DIGIT, R
J
1
IS GET NEXT
YES R SAME
AS ANY SAVED ACTUAL
DIGIT DIGIT, A
?
<)
NO
ARE INCREMENT
NO ALL P YES
DIGITS # MISPLACED
SA~ED DIGITS, MP
YES NO
I
INITIALIZE
ALL
NO P DIGITS
TRIED
~
YES
INCREMENT ALL
NO P DIG ITS
GUESS
COU N TE R TRIED
?
YES
DISPLAY
INITIALIZE GUES S,
LOOP RT, MP
Figure 2: Flowchart for the HP-41C Codebreaker game . Listing 3 gives the HP-41C keystrokes for the equivalent program.
I nt roduc in-=:;!
the
SYSiBffiS,
•
Hie. 82143R
• Quantity Discounts
Available
THE HP-41C's
• 9O-day Warranty
• Ask about our unique WHISPER QUIET PRINTER,
"Guaranteed Custom
Programming"
ZENITH DATA SYSTEMS
UST OUR PRICE
Z89 MICROCOMPUTER SYSTEM ... .. . . $2,895 $2,495
48KB Memory KEY FERTURES
Z19 Video Terminal (24 x 80)
2 Serial EIA ports
Single 5" Diskette Drive
Z19 Smart Video Terminal .. . . SPECIAL . $ 950 $ 795
24 lines x 80 col
Reverse Video
Numeric keypad 127 STANDARD CHARACTERS
HDOS Operating System (with BASIC) . .. . $ 150 $ 145
Microsoft Basic ........................ . $ 150 $ 145
Word Processing for Z89 System ...... . .. . $ 395 $ 375
SINGLE WIDTH
Dual 5" Diskette Drive for Z89 Syst em ... . $1,195 $1,095 DOUBLE WIDTH
To Order: Send Check or Money Order to: PK Systems, Inc., ll3 North UPPER CASE
Center, Bloomington, IL 6170l. Allow two weeks for personal c hecks to
clear. For COD Orders, add 5% for handling and service charge . Rush lower case
orders, add $50.00
Shipping: Freight collect, FOB Bloomington. We ship UPS, air freight, or
motor freight.
PK Systems is an Authorized
Service Center.
,:$..
_ -.: 51 r'Yt1 !:, ,, "]1
Dealer and Zenith
SPECIAL CHARACTER
CAPABILITIES
Photo 3: Sample thermal printer output. The 82143A peripheral
printer is capable of printing both uppercase and lowercase
letters, as well as numbers, symbols, and user-defined special
characters, all in two print densities . The printer can also be
used for program tracing or equation plotting. (Print sample
courtesy of Hewlett-Packard.)
258 December 1980 © BYTE Publications Inc Circle 186 on inquiry card.
Listing 3: HP-41C Codebreaker game program. This program choQses a random 3- to 5-digit number with nonrepeating digits and
gives the player clues about the code, based on the player's guesses. This listing uses the same conventions as listing 1.
TO ORDER: Please phone using VISA and Master Card. Or send cash ier's check, I am able to find discounts of about 15 % off the list
money order or personal check (allow 14 business days to clear). VISA and Me
credit card service add 2%. Shipping, handling and insurance add 3%. California price in my area . Larger discounts can be expected with
residents add 6% sales tax .
ORDER HOURS: Monday thru Saturday 9·5 PST.
the passage of time . The HP-41C is manufactured by
Hewlett-Packard Co, Corvallis Division, 1000 NE Circle
computc:!r aga.lnc. Blvd, Corvallis OR 97330.
Authorized Apple Dealer & Service Center
Is the HP-41C a pocket computer? Well, maybe not
4688 CONVOY ST. , SUITE 105, SAN DIEGO , CA 92111 (714) 565-4042 quite-but what will the next generation of calculators be
like?
262 December 1980 © BYTE Pub lications Inc Circle 177 on inquiry card.