Method 2: Bar Code from the 82162 Small HP-IL Thermal Printer

Back to main page | Email me at: Gene!


The program presented below is basically the program presented by Winfried Maschke of West Germany in the V9N4P44 PPC Journal (May/June/July 1982). Thanks to Winfried wherever he is today!

I have modified his program to reduce the amount of synthetic instructions it uses in the following ways:
1) I changed all E, E2, and E3 instructions (which are short-form exponents that act like a normal 1 E3, but save a byte) into either normal exponents or 3, 10^X type instructions. Costs a byte or two, but easier to key.
2) I changed several synthetic text lines into the equivalent CHR#, XTOA sets of instructions. This IS again more byte-intensive, but removes the need to create the text lines that were in the orignal program synthetically. This change also necessitated adding the RDN instructions after the XTOA instruction to keep the stack contents unchanged (except for stack level T, which is lost compared to the original program, but that doesn't appear to make a difference). There might be a few places where I unnecessarily have a RDN instruction when the program might at that point really not care what is on the stack, but I've erred on the side of caution.

This program has a few synthetic programming steps in it. Only one of these, X <> c, is of any danger. The HP-41 uses status register c to hold some operating information, one piece of which is a "cold start" constant that is checked to see if the unit has had any memory problems. If this constant is not present, a MEMORY LOST will result. That could easily occur if you have a zero (0) in the X register and single step that X <> c line. Don't do that! Follow the instructions below carefully. If you are uncomfortable with this possibility, you may do one of three things: 1) Back up your machine to cards, cassette, disk, and then proceed, or 2) Buy a plotter module and print bar code that way, or 3) Don't print bar code. ;-)

Requirements:
1) This program requires the HP-IL Module, the HP-IL 82162 thermal printer and an HP-41CX or HP-41CV with extended functions/memory. Also, either a wand to scan in or the ability to key in four synthetic program lines is needed.
2) Note: The program also requires Black thermal paper. You won't get proper results if you try to use BLUE thermal paper in the HP-41 printer.
3) You need to be able to construct the following program lines into the listing of the program: X <> c, RCL M, STO M in lines 78, 127, 128, 132, and 164.

This can either be done by one of the numerous methods of putting synthetic program instructions into memory (Have you read the article on my main page that talks about synthetic programming yet? Or have you bought a book from Educalc? (such as Wlodek's "Extend your HP-41"?).

These can also be scanned in using a bar code wand, which you probably would already have if you're interested in printing bar code anyway, right? I have provided short little programs on two lines of bar code each that contain the necessary synthetic instructions.

Line for STO M : STO M Barcode

Line for RCL M : RCL M Barcode

Line for X <> c : X <> c Barcode

Note: The X <> c bar code is the dangerous one.


Instructions:
1) Make sure that extended memory is empty or that the program you want bar code of is the first program in extended memory. (Do an EMDIR to make sure of this).
2) Put the name (global label) of the program you want bar code of into the alpha register.
3) Put the number of bytes you want printed in each row of bar code into the X register (display). Note: My suggestion is to make this 6 bytes if you want to take the rows printed and fit them onto an 8.5 x 11" piece of paper after they are printed.
4) Execute the program.
5) You will hear a BEEP When the program is almost finished.
Note: To make private bar code (why you would want to do that these days, I don't know, but...), replace the CF 10 in line 2 and replace it with a SF 10.
Program Listing: You need your printer plugged in to be able to key this program into the HP-41.

I do apologize for the way in which I present entering the synthetic steps in lines 78, 127, 128, 132, and 164. That's the best way I could think of to help you key them in without actually doing synthetic programming. If you follow the instructions as listed, you should do fine. The other option is, of course, to buy a plotter module. ;-)

Line      Instruction
01         LBL "BCD"
02         CF 10
03         LBL 04
04         CF 12
05         ACA
06         PRX
07         ADV
08         CLRG
09         ABS
10         INT
11         X = 0?
12         SIGN
13         13
14         X > Y?
15         X <> Y
16         STO 06
17         12
18         +
19         PSIZE
20         1
21         -
22         1 E3
23         /
24         STO 03
25         SF 25
26         SAVEP
27         FIX 0
28         CF 29
29         RCLPTA
30         2
31         -
32         STO 05
33         LASTX
34         +
35         ACX
36         FLSIZE
37         X <> Y
38         " BYTES"
39         ACA
40         ADV
41         RCL 06
42         /
43         INT
44         LASTX
45         FRC
46         X NE 0?
47         SIGN
48         +
49         "="
50         ACA
51         ACX
52         " ROWS"
53         ACA
54         ADV
55         ADV
56         SF 12
57         RDN
58         CLA
59         32
60         XTOA
61         RDN
62         190
63         XTOA
64         RDN
65         0
66         XTOA
67         XTOA
68         XTOA
69         RDN
70         256
71         /
72         XTOA
73         LASTX
74         *
75         LASTX
76         MOD
77         XTOA

Note: Stop here, press GTO . ., and scan in
the barcode for the small program for RCL M.
Clear the END created just after the XTOA step
above, and then delete the steps of the new small
program except for the next line, RCL M.

78         RCL M


79         XEQ 06
80         STO 06
81         SF 08
82         1
83         STO 01
84         XEQ 08
85         CLA
86         192
87         XTOA
88         RDN
89         0
90         XTOA
91         RDN
92         47
93         XTOA
94         RDN
95         3
96         STO 04
97         STO 05
98         XEQ 11
99         FS?C 09
100        XEQ 05
101        RCL 06
102        BEEP
103        PWRDN
104        LBL 06
105        CLA
106        11
107        XTOA
108        RDN
109        224
110        XTOA
111        RDN
112        1
113        XTOA
114        RDN
115        105
116        XTOA
117        RDN
118        11
119        XTOA
120        RDN
121        224
122        XTOA
123        RDN
124        176
125        XTOA
126        RDN

Note: Stop here, press GTO . ., and scan in
the barcode for the small program for RCL M.
Clear the END created just after the RDN step
above, and then delete the steps of the new small
program except for the next line, RCL M.


127        RCL M


Note: Stop here, press GTO . ., and scan in
the barcode for the small program for X <> c.
Clear the END created just after the RCL M step
above, and then delete the steps of the new small
program except for the next line, X <> c.

128        X <> c


129        X <> Y
130        X <> 00
131        X <> Y


Note: Stop here, press GTO . ., and scan in
the barcode for the small program for X <> c.
Clear the END created just after the X <> Y step
above, and then delete the steps of the new small
program except for the next line, X <> c.

132        X <> c


133        X <> Y
134        CLST
135        +
136        RTN
137        GTO 04
138        LBL 15
139        ISG 03
140        GTO 02
141        XEQ 05
142        LBL 08
143        RCL 03
144        FRC
145        12
146        +
147        STO 03
148        16
149        RCL 01
150        1
151        -
152        *
153        STO 11
154        LBL 02
155        DSE 05
156        GTO 02
157        RTN
158        LBL 02
159        DSE 04
160        GTO 11
161        7
162        STO 04
163        GETX


Note: Stop here, press GTO . ., and scan in
the barcode for the small program for STO M.
Clear the END created just after the GETX step
above, and then delete the steps of the new small
program except for the next line, STO M.

164        STO M


165        LBL 11
166        SF 09
167        ALENG
168        RCL 04
169        X NE Y?
170        0
171        X = Y?
172        ATOX
173        ENTER
174        STO IND 03
175        ST+ 09
176        DSE 01
177        GTO 15
178        143
179        -
180        X < = 0?
181        97
182        64
183        -
184        X < = 0?
185        34
186        32
187        -
188        X < = 0?
189        3
190        STO 01
191        STO 07
192        GTO 15
193        LBL 05
194        CF 09
195        RCL 08
196        16
197        MOD
198        LASTX
199        FS? 10
200        ST+ X
201        +
202        ST+ 09
203        STO 10
204        ISG 08
205        DEG
206        RCL 07
207        RCL 01
208        DSE X
209        -
210        RCL 11
211        +
212        STO 11
213        RCL 09
214        +
215        255
216        MOD
217        X = 0?
218        LASTX
219        STO 09
220        ASTO 02
221        RCL 03
222        INT
223        8999
224        +
225        1 E3
226        /
227        STO 00
228        LBL 12
229        RCL 08
230        ACX
231        ADV
232        ADV
233        ADV
234        PWRDN
235        PWRUP
236        AUTOIO
237        SF 17
238        CLX
239        ACCOL
240        118
241        RCL 03
242        INT
243        +
244        CLA
245        27
246        XTOA
247        RDN
248        49
249        XTOA
250        RDN
251        XTOA
252        OUTA
253        RCL 00
254        LBL 13
255        RCL IND X
256        CLA
257        XTOA
258        SF 25
259        X = 0?
260        ACCOL
261        X NE 0?
262        OUTA
263        RDN
264        INSTAT
265        FS? 03
266        GTO 14
267        RDN
268        ISG X
269        GTO 13
270        ADV
271        ADV
272        ADV
273        ADV
274        ADV
275        ADV
276        CLA
277        ARCL 02
278        RTN
279        LBL 14
280        PWRDN
281        "PAPER"
282        BEEP
283        BEEP
284        PROMPT
285        RCL 00
286        GTO 12
287        END

That's it. Hope it's useful!