News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests

Main Menu

QR code generator

Started by jj2007, November 23, 2022, 09:50:35 AM

Previous topic - Next topic

jj2007

Just for fun, attached a QR code generator - 72 lines of purest Assembly :biggrin:

You can supply a URL via the commandline, or you paste it in the edit box and hit Enter. Right-click into the image to save it to disk. I've tested it with Scanner QR for Android, and it works like a charm.


jack


jj2007

Version 2, slightly improved so that longer text can be displayed: Window size and resolution will adapt to the amount of information needed.

TimoVJL

May the source be with you

jj2007

Quote from: TimoVJL on November 24, 2022, 02:48:14 AM
Just have to test it :azn:

What is that tiny lousy website, Timo?  :biggrin:

Attached version 3 of the QR code generator; remember to right-click into the image. In case you can't see the *.asc source because you don't have WordPad or RichMasm on your machine, here is the source in plain text *.asm:



Btw with Jack's DLL there is a 2996 character limit (the source above has 2906 chars). There are several sizes reported on the web:

QuoteModel 1:
The original QR Code, a code capable of coding 1,167 numerals with its maximum version being 14 (73 x 73 modules)

Model 2
This code can encode up to 7,089 numerals with its maximum version being 40 (177 x 177 modules).

https://blinq.me/blog/what-size-should-a-qr-code-be
QuoteA QR code can store up to 4,296 alphanumeric characters of arbitrary text. The text can be anything from contact information, a URL, or even a telephone number.

jj2007

I've run some tests comparing:

a) Jack's version: libqrencode32Jack.dll, 62974 bytes of 22.11.22, 03:15:50
b) Timo's version: qrcodegen_na_msvcrt.lib, 4648 bytes of 25.11.22, 00:48:34

Both support strings up to 2933 bytes, Timo's version up to 2940 or so. However, the codes generated by Jack's dll are slightly more easy to recognise by my smartphone reader.

jj2007

Get the latest version in the ShowCase here :thumbsup:

Version 2 allows to produce multiple QR codes via a text file named QrBatch.txt, which you can drag over the exe. Its format is very simple:

HelloW.png Hello World
Line2.png This is line #2 of QrBatch.txt
Download.png http://masm32.com/board/index.php?topic=94.0
Unicode.png Unicode characters like 💪🏿😡🦾🎶☕are OK
Origin.png You got this program from http://masm32.com/board/index.php?topic=10511.0


First the file name, then a tab, followed by the text to encode, which can be Ansi, Utf8 or Utf16.