HP 41: new barcode creation tool



#19

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


#20

WOW!
Nice tool. Thank you Michael.

Massimo

#21

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

#22

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

#23

Hi there,

Yet another big thanks! on my behalf Michael.

Cheers.

Diego

#24

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

#25

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.


#26

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


#27

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


#28

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
#29

Problems fixed! Many, many thanks.

Very quick debugger... :-)


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

#30

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
#31

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


Thank you.

#32

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.


#33

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

#34

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


#35

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


#36

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.

#37

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.

#38

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


#39

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öricke

HP-41 Focal Decompiler v1.0 (c) 2012 Michael Göricke

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>


#40

Hi Ángel,

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

#41

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

#42

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


#43

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


#44

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

#45

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

Thanks a lot Michael!


#46

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 Ángel'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


#47

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


#48

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

Michael


#49

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

Nothing wrong with it.

#50

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


Thanks, as usual... ;-)


#51

Just download the new version :-)


#52

Faster than light, uh? :)

#53

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!


#54

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

#55

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


#56

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.

#57

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

#58

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


#59

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.


#60

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öricke

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>


#61

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

#62

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

#63

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

#64

This is quickly becoming an excellent tool!


Thanks again for the fast service ;-)

#65

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


#66

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


#67

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

Michael

#68

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.


#69

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


Possibly Related Threads...
Thread Author Replies Views Last Post
  HP-41(CL): The easiest way to transfer FOCAL programs from a Linux PC to the HP-41 Geir Isene 13 1,282 12-05-2013, 02:40 AM
Last Post: Hans Brueggemann
  HP Prime - definitely no education tool bluesun08 5 440 11-17-2013, 11:35 AM
Last Post: Alberto Candel
  "HexZombie - a tool for real programmers" Thomas Chrapkiewicz 8 703 11-16-2013, 12:46 AM
Last Post: Kiyoshi Akima
  Updated PPC DVD Version 2.10: HP-41 Searchable Program Files and Scannable Barcode Jake Schwartz 3 454 09-27-2013, 09:51 PM
Last Post: Olivier (Wa)
  HP41 Barcode ideas MichaelG 6 571 07-15-2013, 08:59 AM
Last Post: Olivier De Smet
  wp34s library tool Andrew Nikitin 3 366 07-11-2013, 03:45 AM
Last Post: Marcus von Cube, Germany
  What About An iOS/Android HP-41 Barcode Reader App? Jake Schwartz 0 255 07-10-2013, 10:39 AM
Last Post: Jake Schwartz
  HP 71b ZENWAND Barcode Reader - Manual Michael Fehlhammer 2 296 11-02-2012, 03:34 AM
Last Post: Klaus
  HP-41C clear cased barcode reader Keith Midson 7 595 05-21-2012, 08:10 AM
Last Post: aurelio
  Errors reading with a HP 82153A Barcode Optical Wand aurelio 22 1,403 04-04-2012, 05:19 PM
Last Post: Les Wright

Forum Jump: