Author Topic: QR code generator  (Read 143 times)

jj2007

  • Moderator
  • Member
  • *****
  • Posts: 13274
  • Assembly is fun ;-)
    • MasmBasic
QR code generator
« on: November 23, 2022, 09:50:35 AM »
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.

Masm32 Tips, Tricks and Traps

Some members can't live without insulting others. It tells us a lot about them.

jack

  • Member
  • **
  • Posts: 197
Re: QR code generator
« Reply #1 on: November 23, 2022, 10:08:10 AM »
impressive jj :smiley:

jj2007

  • Moderator
  • Member
  • *****
  • Posts: 13274
  • Assembly is fun ;-)
    • MasmBasic
Re: QR code generator
« Reply #2 on: November 24, 2022, 01:51:13 AM »
Version 2, slightly improved so that longer text can be displayed: Window size and resolution will adapt to the amount of information needed.
Masm32 Tips, Tricks and Traps

Some members can't live without insulting others. It tells us a lot about them.

TimoVJL

  • Member
  • *****
  • Posts: 1223
Re: QR code generator
« Reply #3 on: November 24, 2022, 02:48:14 AM »
Just have to test it :azn:
May the source be with you

jj2007

  • Moderator
  • Member
  • *****
  • Posts: 13274
  • Assembly is fun ;-)
    • MasmBasic
Re: QR code generator
« Reply #4 on: November 24, 2022, 01:03:06 PM »
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:

Quote
Model 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
Quote
A 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.
Masm32 Tips, Tricks and Traps

Some members can't live without insulting others. It tells us a lot about them.

jj2007

  • Moderator
  • Member
  • *****
  • Posts: 13274
  • Assembly is fun ;-)
    • MasmBasic
Re: QR code generator
« Reply #5 on: November 26, 2022, 09:49:41 AM »
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.
Masm32 Tips, Tricks and Traps

Some members can't live without insulting others. It tells us a lot about them.