QR Code version 1

Any discussions related to the creation of new hardware or software for the ZX80 or ZX81
leiradel
Posts: 15
Joined: Sat Mar 02, 2013 4:55 pm

QR Code version 1

Post by leiradel »

Hi All,

I've written a QR Code version 1 generator in Z80 assembly, along with a plotter for the ZX81: https://github.com/leiradel/qrc1

QR Code version 1 can encode 14 bytes of information. There's a PR which I'm changing a bit with a version 11 generator, capable of encoding messages with up to 251 bytes. Unfortunately it's too big for the humble ZX81, but a ZX Spectrum plotter will be included.

If you use QR Codes in your programs I'd love to hear about it.

Cheers,

Andre

Image
User avatar
PokeMon
Posts: 2264
Joined: Sat Sep 17, 2011 6:48 pm

Re: QR Code version 1

Post by PokeMon »

Nice - what resolution would be needed for a bigger QR code ? 8-)
User avatar
XavSnap
Posts: 1940
Joined: Sat May 10, 2008 4:23 pm
Location: 'Zx81 France' Fb group.

Re: QR Code version 1

Post by XavSnap »

Hi,
big for the humble ZX81
For the Zx81 display, but you can throw the HR QRcode, directly to the ZxPrinter… from an array.

Image
http://abandonlistings.free.fr/microsys ... HR_n33.zip

Or my printer driver to store 4 graphics screen (low res), and print them to the printer (one full inverted space=2x2 pixel square)…
Image
http://zx81.ordi5.free.fr/xavsnap/downl ... ER_HRG.zip
Xavier ...on the Facebook groupe : "Zx81 France"(fr)
leiradel
Posts: 15
Joined: Sat Mar 02, 2013 4:55 pm

Re: QR Code version 1

Post by leiradel »

PokeMon wrote: Wed Nov 04, 2020 11:34 pm Nice - what resolution would be needed for a bigger QR code ? 8-)
Version 11 needs 61x61 pixels to render, the largest one needs 149x149. This page has detailed information about all QR Code sizes, capacities etc.
leiradel
Posts: 15
Joined: Sat Mar 02, 2013 4:55 pm

Re: QR Code version 1

Post by leiradel »

XavSnap wrote: Thu Nov 05, 2020 8:27 ambut you can throw the HR QRcode, directly to the ZxPrinter
That'd be great, PRs welcome! ;)
User avatar
XavSnap
Posts: 1940
Joined: Sat May 10, 2008 4:23 pm
Location: 'Zx81 France' Fb group.

Re: QR Code version 1

Post by XavSnap »

:lol:

"Starsky & Hutch" …
lol.jpg
lol.jpg (41.9 KiB) Viewed 5547 times
QRCODE.P
(2.7 KiB) Downloaded 208 times
Xavier ...on the Facebook groupe : "Zx81 France"(fr)
leiradel
Posts: 15
Joined: Sat Mar 02, 2013 4:55 pm

Re: QR Code version 1

Post by leiradel »

XavSnap wrote: Thu Nov 05, 2020 11:04 amQRCODE.P
Not sure what you're trying to do, the machine code cannot be relocated as it uses some absolute addresses, but you've added a line before the QR Code routines that live in line 10:

Code: Select all

   0 REM #5 ?)# U#RND RETURN #C- RETURN #C) RETURN #C� RETURN #ASN aINKEY$ RETURN #ASN PAUSE INKEY$/#;;;63INKEY$E�RND7INKEY$2 #k#U9I
NKEY$ RETURN 
8215 INKEY$)S ;63INKEY$E7INKEY$7INKEY$/ LLIST A2I  NEW # RETURN  C#VAL ?)# ;( CLEAR AT LN ?INKEY$LN ?INKEY$ACS kC#LN ?INKEY$LN ?INKE
Y$ACS ?C#LN #INKEY$)# ;LN ?INKEY$LN ?INKEY$ACS kC#LN $INKEY$LN ?INKEY$ACS ?C#LN -INKEY$E7INKEY$7INKEY$#?TAB uRNDE3INKEY$U5INKEY$?)4 
;U6INKEY$? GOSUB ?763INKEY$E7INKEY$ TAB uRNDTAN U9INKEY$ACS kC#U5INKEY$ACS *ACS *ACS #ACS ?M5INKEY$TAN U6INKEY$ACS *ACS *ACS #ACS ?M
6INKEY$TAN U5INKEY$ACS INT M5INKEY$TAN U5INKEY$ACS SIN M5INKEY$TAN U6INKEY$ACS INT M6INKEY$TAN U6INKEY$ACS SIN M6INKEY$TAN ;?  #? LN
 SCROLL #5 ?-K: 24?PEEK CLS <= CLS #K CLS #"( RETURN ##STR$ ?*ACS 73l?<= CLS NEW #C IF ?PEEK CLS ( LOAD SGN 714 NEW <= CLS NEW #C IF
 +C#? RETURN #4ASN :#/LEN Y#PEEK CLS LN ##TAN Q )#?# # GOSUB kTAN 
   1 REM 
  10 DIM Z$(1,14)
  15 LET MAKEQR=16901
  20 FAST 
  30 CLS 
  40 PRINT AT 0,0;"ENTER MESSAGE (MAX 14 CHARS)"
  50 INPUT M$
  52 LET Z$(1)=M$
  60 LET M$=Z$(1)
  80 PRINT AT 1,0;M$
 100 LET O=17607
 110 POKE O,14
 120 FOR I=1 TO 14
 130 POKE O+I,CODE M$(I)
 140 NEXT I
 145 STOP 
 150 FOR I=6 TO 16
 160 PRINT AT I,10;"           "
 170 NEXT I
 175 POKE 16514,5
 177 RAND USR 16515
 180 RAND USR MAKEQR
 181 POKE 16514,0
 182 RAND USR 16515
 183 POKE 16514,1
 184 RAND USR 16515
 185 POKE 16514,2
 186 RAND USR 16515
 187 POKE 16514,3
 188 RAND USR 16515
 189 POKE 16514,4
 190 RAND USR 16515
9000 SAVE "QRCODe"
9999 RUN
The README in the GitHub repository has information that will help you use the encoder and printer, but do let me know if you have doubts.
User avatar
PokeMon
Posts: 2264
Joined: Sat Sep 17, 2011 6:48 pm

Re: QR Code version 1

Post by PokeMon »

leiradel wrote: Thu Nov 05, 2020 10:06 am Version 11 needs 61x61 pixels to render, the largest one needs 149x149. This page has detailed information about all QR Code sizes, capacities etc.
Then you could make a bigger version for ZX81 as well as is supports a resolution of 256x192 pixels.
With HRG driver like used by Z88dk. In general the ZX printer is able to print high resolution graphics as well, maybe a special driver is needed.

http://k1.spdns.de/Vintage/Sinclair/80/ ... ctions.pdf

https://www.z88dk.org/forum/
Bildschirmfoto 2020-11-05 um 22.43.38.png
leiradel
Posts: 15
Joined: Sat Mar 02, 2013 4:55 pm

Re: QR Code version 1

Post by leiradel »

PokeMon wrote: Thu Nov 05, 2020 10:46 pm Then you could make a bigger version for ZX81 as well as is supports a resolution of 256x192 pixels.
With HRG driver like used by Z88dk. In general the ZX printer is able to print high resolution graphics as well, maybe a special driver is needed.
My goal for now is to show them on the screen. As for a highres version for the ZX81, there are some different ways to implement the video driver. While I could provide a sample plotter for one specific driver, I want to focus on the QR Code version 11 PR.
leiradel
Posts: 15
Joined: Sat Mar 02, 2013 4:55 pm

Re: QR Code version 1

Post by leiradel »

ZX Spectrum sample code added!

The code is capable of plotting the barcode using 1x1, 2x2, and 4x4 square pixels per module, selectable in compile time. The encoder and plotter code is shared between the ZX81 and ZX Spectrum versions, only the pixel routines are specific to each of the platforms.

Image
Post Reply