The Museum of HP Calculators

HP Forum Archive 21

[ Return to Index | Top of Index ]

HP 41: new barcode creation tool
Message #1 Posted by MichaelG on 8 July 2013, 12:46 p.m.

As you might remember I released a first version of my FOCAL Compiler/decompiler more than one year ago. The package now got a major enhancement: the compiler now can create Barcodes.

I decided to create one JPG file per page. The dimensions of the JPG are big enough to fit at 300 dpi on a DIN A4 or letter paper (minus some border).

You'll find the download package here:

download.michael-goericke.de/hp41/FocalComp.zip

The compiler is written in C# and requires an installation of the .Net Framework 4.5.

Michael

      
Re: HP 41: new barcode creation tool
Message #2 Posted by Massimo Gnerucci (Italy) on 8 July 2013, 2:19 p.m.,
in response to message #1 by MichaelG

WOW!
Nice tool. Thank you Michael.

Massimo

      
Re: HP 41: new barcode creation tool
Message #3 Posted by Namir on 8 July 2013, 7:56 p.m.,
in response to message #1 by MichaelG

Thank you sooooooooooooooooo much. I have been trying to use Leo Duran's program to compiled HP-41C text files into .raw, with no success using Windows 7. You utility works well. I tried a very simple program and got its .raw file with no problem!!

Namir

      
Re: HP 41: new barcode creation tool
Message #4 Posted by Namir on 8 July 2013, 8:03 p.m.,
in response to message #1 by MichaelG

Michael,

I browsed through you manual and I must say that I like very much the directives, the ability to include comments, and the support for a rich set of commands including extended functions and XROMs. Very nice work!!!

Namir

      
Re: HP 41: new barcode creation tool
Message #5 Posted by Diego Diaz on 8 July 2013, 9:08 p.m.,
in response to message #1 by MichaelG

Hi there,

Yet another big thanks! on my behalf Michael.

Cheers.

Diego

      
Re: HP 41: new barcode creation tool
Message #6 Posted by 聲gel Martin on 9 July 2013, 2:11 a.m.,
in response to message #1 by MichaelG

Hi Michael, many thanks for the tools! Is there any chance to get an XP-compatible version as well?

      
FocalComp Bugs??
Message #7 Posted by Namir on 9 July 2013, 3:22 a.m.,
in response to message #1 by MichaelG

Hi Michael,

I compiled the following program:

LBL "ZETA" CHS STO 01 1 STO 00 ENTER LBL 01 CLX SIGN RCL 00 + STO 00 RCL 01 Y^X - CHS LASTX RND X#0? GTO 01 SIGN 2 RCL 01 Y^X ST+ X - / ABS END

The compiler replaced the CHS with a subtraction operation. Also, the GTO 01 translated into a GTO 00. Can you please check if it is not a bug?

In compiling another program, the compiler rejected all occurrences of the X<>Y command.

Thanks!

Namir

Edited: 9 July 2013, 3:37 a.m.

            
Re: FocalComp Bugs??
Message #8 Posted by Massimo Gnerucci (Italy) on 9 July 2013, 9:26 a.m.,
in response to message #7 by Namir

Quote:
The compiler replaced the CHS with a subtraction operation. Also, the GTO 01 translated into a GTO 00. Can you please check if it is not a bug?

In compiling another program, the compiler rejected all occurrences of the X<>Y command.


I confirm this behaviour, further you cannot use tabs in source listing (e.g. before a comment).

Greetings,
Massimo

                  
Re: FocalComp Bugs??
Message #9 Posted by MichaelG on 9 July 2013, 3:13 p.m.,
in response to message #8 by Massimo Gnerucci (Italy)

Your are great. Thx for your findings. I can confirm all of them. The problems are fixed now, the new package is available at:

download.michael-goericke.de/hp41/FocalComp.zip

This version also supports tabs :-) and I added the Wand XRom codes.

Please let me know if you encounter further problems. Do you have any idea you like to see in the Compiler?

Michael

                        
Re: FocalComp Bugs??
Message #10 Posted by Namir on 9 July 2013, 3:51 p.m.,
in response to message #9 by MichaelG

I found more bugs. Here is a program that calculates Erf(x) (taken from this site). I added comments to errors and missing steps:

LBL "ERF"
ABS
SIGN
LASTX
ENTER
STO M
STO O
6
LN
X<=Y?
GTO 02
RDN         ; Did not appear when viewed using an HP-41C emulator
X^2
STO N
LBL 01
CLX
RCL N
RCL O
*
CHS
R^
ISG T
CLX
/
STO O
R^
ST+ X
DSE X
/
X<>Y
ST+ Y
X#Y?
GTO 01
ST+ X       ; appears as CLST in the emulator
PI
SQRT
/
ENTER
CHS
1
+
X<>Y
GTO 04
LBL 02    ; did not appear in the emulator
CLX
24
STO N
R^
+
X<>Y
ST+ X
/   
LBL 03
+
RCL N
X<>Y
ST+ X
/
DSE N
GTO 03
+             ; did not appear in the emulator
1/X
X<>Y
X^2
CHS
E^X
*
PI
SQRT
/
ENTER
CHS
1
+
LBL 04
RCL M
SIGN
RDN
CLA
END 
                        
Re: FocalComp Bugs??
Message #11 Posted by Massimo Gnerucci (Italy) on 9 July 2013, 3:53 p.m.,
in response to message #9 by MichaelG

Problems fixed! Many, many thanks.

Very quick debugger... :-)

So we now have x<> p, x<> e... Great!

                        
Re: FocalComp Bugs??
Message #12 Posted by Namir on 9 July 2013, 4:00 p.m.,
in response to message #9 by MichaelG

I think I found a bug where ST+ X is replaced by CLST. Here is the listing for another program ERF2:

LBL "ERF2"
1
RCL Y
ENTER
X^2
STO M
LBL 01
X<> T
RCL M
ST+ X
*
R^
SIGN
R^
+
STO T
ST+ L
X<> L
/
STO T
X<>Y
ST+ Y
X#Y?
GTO 01
ST+ X     ; appears as CLST
0
X<> M
E^X
PI
SQRT
*
/
END 
                        
Re: FocalComp Bugs??
Message #13 Posted by Massimo Gnerucci (Italy) on 9 July 2013, 4:09 p.m.,
in response to message #9 by MichaelG

Doesn't like X=0?, you use X=0 instead. How should you enter exponents? 1 E99, E99, EEX 99 not accepted.

Thank you.

      
Unexpected FocalComp Bonus Feature????
Message #14 Posted by Namir on 9 July 2013, 10:29 a.m.,
in response to message #1 by MichaelG

I don't know if the FocalComp documentation mentions it, but the FocalComp compiler DOES support code that accesses the M, N, O, and P synthetic registers. This is a much welcome feature since some of the HP-41C code written by Jean-Marc Baillard uses these synthetic registers.

Namir

Edited: 9 July 2013, 11:01 a.m.

            
Re: Unexpected FocalComp Bonus Feature????
Message #15 Posted by MichaelG on 9 July 2013, 2:36 p.m.,
in response to message #14 by Namir

Yes, the Compiler supports ALL Registers: x, y , z, t, l, m, n, o, p, q, r, d, e (the documentation seems to be somewhat hidden).

Michael

      
Re: HP 41: new barcode creation tool
Message #16 Posted by Raymond Del Tondo on 9 July 2013, 3:02 p.m.,
in response to message #1 by MichaelG

Quote:
The compiler is written in C# and requires an installation of the .Net Framework 4.5.

Michael


Hello Michael,

great stuff, congrats:-)

Is there a chance you could compile a version against .NET 2.0 , or maybe against .NET 3.0 as highest version?

Regards

Raymond

            
Re: HP 41: new barcode creation tool
Message #17 Posted by MichaelG on 9 July 2013, 3:32 p.m.,
in response to message #16 by Raymond Del Tondo

I see the demand. Right now I don't use Special Features from .Net 4.5. .Net 4.0 is the last version supported on XP. I built 2 Versions, one for 4.0 and one for 3.0:

download.michael-goericke.de/hp41/FocalCompNet4.zip

download.michael-goericke.de/hp41/FocalCompNet3.zip

For the time being I can stay at .Net 4.0. The .Net 3.0 Version is for test purposes only.

Michael

Edited: 10 July 2013, 6:45 a.m. after one or more responses were posted

                  
Re: HP 41: new barcode creation tool
Message #18 Posted by Raymond Del Tondo on 9 July 2013, 7:47 p.m.,
in response to message #17 by MichaelG

Hello Michael,

many thanks for the 3.0 and 4.0 versions:-)

I tested the 3.0 on a machine running XP, and it works fine so far, including barcode generation!
Printing without modifying printer settings leads to very small barcodes. I wasn't aware that the Wand can scan those small but high resolution barcodes, but it works....

Raymond

[Edit: Typo]

Edited: 9 July 2013, 7:47 p.m.

                  
Re: HP 41: new barcode creation tool
Message #19 Posted by Juergen Keller on 10 July 2013, 5:15 p.m.,
in response to message #17 by MichaelG

Thanks for the .NET 3.0 version, too. That should allow for running the tool on my MacBook via CrossOver. I'll give it a try over the weekend.

      
Re: HP 41: new barcode creation tool
Message #20 Posted by MichaelG on 10 July 2013, 11:45 a.m.,
in response to message #1 by MichaelG

You Keep me busy :-) Thx again for your finding. x=0? works now.

The floating point values issue is a matter of documention (which I added now). Floating point values may not contain blanks. The exponent starts with an "e". A valid value is -12345.67e-89.

Please find the new version here:

download.michael-goericke.de/hp41/FocalComp.zip

This package contains both versions for .Net 4.0 and 3.0.

Michael

            
Re: HP 41: new barcode creation tool
Message #21 Posted by 聲gel Martin on 10 July 2013, 1:20 p.m.,
in response to message #20 by MichaelG

Hi Michael, the compiler works fine but I'm getting exception errors with Focaldecomp - is that one also supposed to work on .NET 4.0? Ir maybe it's the specific .raw file I'm throwing at it...

D:\HP-41\FOCAL>focaldecomp pfe.raw HP-41 Focal Decompiler v1.0 (c) 2013 Michael G顤icke

HP-41 Focal Decompiler v1.0 (c) 2012 Michael G顤icke

Decompiling: pfe.raw

Unhandled Exception: System.Collections.Generic.KeyNotFoundException: The given key was not present in the dictionary. at System.Collections.Generic.Dictionary`2.get_Item(TKey key) at FocalDecompiler.FocalDecomp.Decompile(String InputFilename, String OutputF ilename) at FocalDecompiler.Program.Main(String[] args)

D:\HP-41\FOCAL>

                  
Re: HP 41: new barcode creation tool
Message #22 Posted by MichaelG on 10 July 2013, 2:38 p.m.,
in response to message #21 by 聲gel Martin

Hi 聲gel,

looking at the exception dump its most likely your specific raw file. How can I get access to it? Can you send me the file? Here you'll find my email address: http://www.michael-goericke.de/info

Michael

                  
Re: HP 41: new barcode creation tool
Message #23 Posted by MichaelG on 10 July 2013, 3:26 p.m.,
in response to message #21 by 聲gel Martin

Could it be that your program uses single character lables in the range 112-122? The expected range is "A" to "J" and "a" to "e". The mentioned gap in between is not checked right now and the decompiler would Crash (already added "T" to "Q" and "R").

Michael

                  
Re: HP 41: new barcode creation tool
Message #24 Posted by MichaelG on 10 July 2013, 4:01 p.m.,
in response to message #21 by 聲gel Martin

I created a very special version for you. That version catches the exception and dumps the last statement that caused the exception. The Output Looks like this: Exception caught on statement: 145 110

and helps me to identify the problem.

Please download the version here and run it with your raw file: download.michael-goericke.de/hp41/FocalDecompDump.zip

thx Michael

                        
Re: HP 41: new barcode creation tool
Message #25 Posted by 聲gel Martin on 11 July 2013, 1:51 a.m.,
in response to message #24 by MichaelG

Hi Michael, I sent two raw files to your email that cause issues. I ran the debugging version you provide and it reports the offending statements; hope it helps diagnose things.

Many thanks for troubleshooting this wrinkle, hope you find the solution - your tools are tremendous for documentation, storage and archival.

Cheers, 'AM

                              
Re: HP 41: new barcode creation tool
Message #26 Posted by 聲gel Martin on 11 July 2013, 2:05 a.m.,
in response to message #25 by 聲gel Martin

Hi again, I looked at the partial outputs the debugging version produces to see where it aborted. In one case (for TYLR10.RAW) it was a "GTO E" instruction, and in the other case (PFE.RAW) it was 'RCL 04'.

I also noticed that one 'RCL O' in the first case was wrongly reported as 'XEQ O'

Thanks, 'AM

            
Re: HP 41: new barcode creation tool
Message #27 Posted by Massimo Gnerucci (Italy) on 10 July 2013, 3:12 p.m.,
in response to message #20 by MichaelG

Apart from different spacing between operators and register number, this time I found no further issues.

Thanks a lot Michael!

                  
Re: HP 41: new barcode creation tool
Message #28 Posted by MichaelG on 12 July 2013, 9:06 a.m.,
in response to message #27 by Massimo Gnerucci (Italy)

Quote:
Apart from different spacing between operators and register number, this time I found no further issues.

Thanks a lot Michael!

Wunderful. What different spacing do you mean?

But I found a severe issue (Compiler and decompiler) with the GTO statement :-( While 聲gel's findings were easy to fix (thx for sending the data) I need some more tests to verify the fix for the GTO. My plan is to release the next version today or tomorrow.

Michael

                        
Re: HP 41: new barcode creation tool
Message #29 Posted by Massimo Gnerucci (Italy) on 12 July 2013, 2:49 p.m.,
in response to message #28 by MichaelG

Quote:
What different spacing do you mean?

Nothing, really: after STO, SF, CF, LBL XEQ, FIX etc. you put two spaces before the numeric argument.

I'll try to look after those GTOs

Massimo

                              
Re: HP 41: new barcode creation tool
Message #30 Posted by MichaelG on 12 July 2013, 2:53 p.m.,
in response to message #29 by Massimo Gnerucci (Italy)

Ah, I see. I did that on purpose. That aligns all arguments to the same column.

Michael

                                    
Re: HP 41: new barcode creation tool
Message #31 Posted by Massimo Gnerucci (Italy) on 12 July 2013, 2:55 p.m.,
in response to message #30 by MichaelG

Right, in effect after SF and CF there are three spaces.

Nothing wrong with it.

                                    
Re: HP 41: new barcode creation tool
Message #32 Posted by Massimo Gnerucci (Italy) on 12 July 2013, 3:36 p.m.,
in response to message #30 by MichaelG

Oh, I forgot: could you please let it accept "ENTER^"? Now it only likes "ENTER".

Thanks, as usual... ;-)

                                          
Re: HP 41: new barcode creation tool
Message #33 Posted by MichaelG on 12 July 2013, 4:23 p.m.,
in response to message #32 by Massimo Gnerucci (Italy)

Just download the new version :-)

                                                
Re: HP 41: new barcode creation tool
Message #34 Posted by Massimo Gnerucci (Italy) on 12 July 2013, 4:44 p.m.,
in response to message #33 by MichaelG

Faster than light, uh? :)

                                                
Re: HP 41: new barcode creation tool
Message #35 Posted by Massimo Gnerucci (Italy) on 12 July 2013, 4:52 p.m.,
in response to message #33 by MichaelG

The compiler now accepts ENTER^ while the decompiler turns it into ENTER.

I think it should always be ENTER^, but I wonder what our friends have to say about it.

Thank you Michael!

                                                      
Re: HP 41: new barcode creation tool
Message #36 Posted by Raymond Del Tondo on 12 July 2013, 8:31 p.m.,
in response to message #35 by Massimo Gnerucci (Italy)

The accent circonflexe (^) requires at least one (superfluous in this case) additional keystroke to enter on a PC keyboard. Therefore I'd suggest to allow both options, with and without "^"

Ray

                                                      
Re: HP 41: new barcode creation tool
Message #37 Posted by Paul Dale on 12 July 2013, 10:16 p.m.,
in response to message #35 by Massimo Gnerucci (Italy)

The compiler should accept both. The decompiler should always output one. I'd go for ENTER^ but I don't think there is much in it.

Pauli

                                                            
Re: HP 41: new barcode creation tool
Message #38 Posted by Massimo Gnerucci (Italy) on 13 July 2013, 3:54 a.m.,
in response to message #37 by Paul Dale

Quote:
The compiler should accept both. The decompiler should always output one. I'd go for ENTER^ but I don't think there is much in it.

I concur, but most (all?) of the listings I have show ENTER^, hence my request.

      
Re: HP 41: new barcode creation tool
Message #39 Posted by MichaelG on 12 July 2013, 2:52 p.m.,
in response to message #1 by MichaelG

All known issues are fixed now. Thx to you all to make this product stable and reliable. The download link is still the same:

download.michael-goericke.de/hp41/FocalComp.zip

Michael

      
Re: HP 41: new barcode creation tool
Message #40 Posted by MichaelG on 13 July 2013, 1:36 a.m.,
in response to message #1 by MichaelG

The next version is available. Changes:

- fixed a problem with paging when printing barcodes

- added page #, date/time and filename to the Header of each page

- the barcode is a bit wider and uses the full width of the page

- the decompiler creates "ENTER^" instead of "ENTER" while the compiler accepts both versions

Michael

            
Re: HP 41: new barcode creation tool
Message #41 Posted by 聲gel Martin on 13 July 2013, 2:00 a.m.,
in response to message #40 by MichaelG

Michael the decompiler works like a charm now, thanks for fixing the problems. I still have one glitch: the compiler doesn't recognize the synthetic statements using exponents without the leading one, i.e. "E3", or "E-7". Can you also add support for those, they're widely used. (including the single "E" as a replacement for "1")

Also I get exception errors trying to produce the barcode for TYLR10.TXT (one of the files I sent you). It could be related to this as well, or maybe I should use the .NET3 for barcode generation on a XP machine?

Sorry I'm still reporting wrinkles, it's looking better and better each time.

Best, 'AM

Edited: 13 July 2013, 2:07 a.m.

                  
Re: HP 41: new barcode creation tool
Message #42 Posted by 聲gel Martin on 13 July 2013, 2:20 a.m.,
in response to message #41 by 聲gel Martin

Actually I tried the .NET3 version and it has the same problem, maybe something related to fonts not being available? The irony is that this was working fine in previous versions...

see the error dump below.-

D:\HP-41\FOCAL>focalcomp -barcode pfe.txt HP-41 Focal Compiler v1.0 (c) 2013 Michael G顤icke

Barcoding: pfe.txt

Unhandled Exception: System.TypeInitializationException: The type initializer fo r 'System.Windows.Media.FontFamily' threw an exception. ---> System.TypeInitiali zationException: The type initializer for 'MS.Internal.FontCache.Util' threw an exception. ---> System.UriFormatException: Invalid URI: The format of the URI co uld not be determined. at System.Uri.CreateThis(String uri, Boolean dontEscape, UriKind uriKind) at System.Uri..ctor(String uriString, UriKind uriKind) at MS.Internal.FontCache.Util..cctor() --- End of inner exception stack trace --- at System.Windows.Media.FontFamily.PreCreateDefaultFamilyCollection() at System.Windows.Media.FontFamily..cctor() --- End of inner exception stack trace --- at System.Windows.Media.Typeface..ctor(FontFamily fontFamily, FontStyle style , FontWeight weight, FontStretch stretch) at FocalCompiler.FocalBarcode.InitImage() at FocalCompiler.FocalBarcode.AddBarcodeToImage(Byte[] barcode, Int32 barcode Len, Int32 currentRow, Int32 fromLine, Int32 toLine) at FocalCompiler.FocalBarcode.OutputBarcode(Byte[] barcodeBuf, Int32 barcodeL ength, Int32 leading, Int32 trailing, Int32 currentRow, Int32 fromLine, Int32 to Line) at FocalCompiler.FocalBarcode.AddToBarcode(Int32 OutcodeLength, Byte[] OutCod e) at FocalCompiler.FocalBarcode.Compile(String InputFilename, Boolean hex) at FocalCompiler.Program.Main(String[] args)

D:\HP-41\FOCAL>

                        
Re: HP 41: new barcode creation tool
Message #43 Posted by MichaelG on 13 July 2013, 3:51 a.m.,
in response to message #42 by 聲gel Martin

Ups! No idea what going on here right now. You problably know the top number one excuse of a developer: it works for me :-(

I didn't change anything in font handling. The dump points to the code that creates the new page Header (which in fact is a copy of the other print text line).

Lets see what I can figure out. Probably I'll send you a test version that outputs some more info.

Michael

                        
Re: HP 41: new barcode creation tool
Message #44 Posted by MichaelG on 15 July 2013, 6:18 a.m.,
in response to message #42 by 聲gel Martin

I know Angel did a lot of tests regarding his Crash. Today I had the chance to test the latest version on XP. Angel, you won't like this news but it works fine. The crash is related to your machine only :-(

Michael

                  
Re: HP 41: new barcode creation tool
Message #45 Posted by MichaelG on 13 July 2013, 3:37 a.m.,
in response to message #41 by 聲gel Martin

Its ok!

I already added the new (reduced) float syntax. I needed to change the lexical analyzer which means it introduces a high risc. But first tests show error-free results.

Michael

            
Re: HP 41: new barcode creation tool
Message #46 Posted by Massimo Gnerucci (Italy) on 13 July 2013, 3:59 a.m.,
in response to message #40 by MichaelG

This is quickly becoming an excellent tool!

Thanks again for the fast service ;-)

      
Re: HP 41: new barcode creation tool
Message #47 Posted by MichaelG on 13 July 2013, 3:51 p.m.,
in response to message #1 by MichaelG

I just uploaded a new version. Changelog:

- added Support for special float syntax, "E3" is now allowed

- dropped support of the .Net 3 Version, only .Net 4 version is available

Angle's crash isn't solved yet. Still no idea what's going on. Very strange crash under XP. Please let me know how it runs on your XP.

Michael

            
Re: HP 41: new barcode creation tool
Message #48 Posted by Raymond Del Tondo on 13 July 2013, 8:09 p.m.,
in response to message #47 by MichaelG

How about a version which doesn't need .NET at all? The FOCAL en- and decoder could be realised using plain C/C++ CLI programs, and even the BC image output should not be very different using Win32 instead of .NET .

Ray

                  
Re: HP 41: new barcode creation tool
Message #49 Posted by MichaelG on 15 July 2013, 6:21 a.m.,
in response to message #48 by Raymond Del Tondo

I leave that challenge open for someone else (e.g. the Win32 API does not support handling of images).

Michael

      
Re: HP 41: new barcode creation tool
Message #50 Posted by MichaelG on 16 July 2013, 2:45 p.m.,
in response to message #1 by MichaelG

Based on Angel's idea I released a new version. Changelog:

- added tons of new XROM codes

- the (de)compiler now reads the file XRomCodes.txt, you can add your xrom codes you want the (de)compiler to understand, I added a demo file, please refer to the manual for details

Michael

Edited: 16 July 2013, 2:46 p.m.

            
Re: HP 41: new barcode creation tool
Message #51 Posted by 聲gel Martin on 17 July 2013, 2:09 a.m.,
in response to message #50 by MichaelG

Thanks for adding those, works great!

Minor typos in the manual for some function names from the 41Z - the xrom code is there as a leftover; does not affect the functionality (functions are correctly shown in the TXT output file).

Best, 'AM


[ Return to Index | Top of Index ]

Go back to the main exhibit hall