flat assembler
Message board for the users of flat assembler.
Index
> Main > Reed-Solomon simple encoder in Assembly language? Goto page 1, 2 Next |
Author |
|
Hrstka 01 Nov 2021, 11:46
Can you post a link to the Pascal source code?
|
|||
01 Nov 2021, 11:46 |
|
FlierMate 02 Nov 2021, 03:39
Hrstka wrote: Can you post a link to the Pascal source code? Hi, I have attached the Pascal source file on here since the link contains additional binaries for Win32 and Linux. The Reed-Solomon encoder functions are as below: Code: rs_init_gf(285); rs_init_code(7,0); rs_encode(19,@data[0],@ecc[0]); rs_free; The 285 value is fixed. 19 means the total codewords in Version 1 (21x21) QR Code.
|
|||||||||||
02 Nov 2021, 03:39 |
|
Hrstka 02 Nov 2021, 09:42
Looks interesting. I would reserve a fixed amount of memory instead of calling GetMem and add some lookup tables in order to simplify the code. I may try to convert it to assembler if I have enough time. Are you using 32bit or 64bit instruction set?
|
|||
02 Nov 2021, 09:42 |
|
FlierMate 02 Nov 2021, 11:15
Hrstka wrote: Looks interesting. I would reserve a fixed amount of memory instead of calling GetMem and add some lookup tables in order to simplify the code. I may try to convert it to assembler if I have enough time. Are you using 32bit or 64bit instruction set? That's very good of you, it will be pleasant if you able to rewrite the Pascal code in Assembly. I am using 32-bit instruction for Win32, but prefer 64-bit instruction for Linux. I am using Linux x64 since last few months. |
|||
02 Nov 2021, 11:15 |
|
FlierMate 02 Nov 2021, 11:23
Hi, the following are some additional info to help understand the program.
1. Please refer to attached image, as that is what my QRCLI program was referring to, * Version 1 (21x21, 23x23 if includes quiet zone) * Byte encoding * 14-chars max (although 21x21 allows up to 17 chars for byte encoding) * Low error correction level (7%, that is 7 bytes of ECC) 2. The last three characters (15th, 16th , 17th) were not encoded as the bit pattern is different from the previous 14 characters. You may want to improve it or leave it as is (14-chars max) 3. The QRCLI program encodes a fixed length of 14 (regardless of the length of actual string) by substituting the rest with null bytes. Thank you!
|
||||||||||
02 Nov 2021, 11:23 |
|
Hrstka 05 Nov 2021, 08:30
Here is my assembly version. The code is 32bit to make it more universal. Targeted for Windows, but should be easy to adapt it for Linux as well. Instead of drawing the QR code to the screen I decided to create a bmp file. You just have to magnify the image to see it. The string is hard-coded, if you want to pass arguments on command line, you have to implement it.
|
|||||||||||
05 Nov 2021, 08:30 |
|
Hrstka 31 Dec 2021, 13:41
Why has the FlierMate's Linux version disappeared?
|
|||
31 Dec 2021, 13:41 |
|
FlierMate 31 Dec 2021, 14:24
Hrstka wrote: Why has the FlierMate's Linux version disappeared? I'm sorry, it wasn't administrator's fault. I deleted quite a lot of stuffs today, because I was in bad mood this afternoon..... If forum CP has a recycle bin, hopefully admin can restore this particular post. |
|||
31 Dec 2021, 14:24 |
|
Tomasz Grysztar 31 Dec 2021, 17:30
FlierMate wrote: If forum CP has a recycle bin, hopefully admin can restore this particular post. Is this the file?
|
|||||||||||
31 Dec 2021, 17:30 |
|
FlierMate 31 Dec 2021, 18:01
Tomasz Grysztar wrote:
Yes, I have tested it again and it is the same file that I had uploaded. Thank you very much, Tomasz, for the extra effort. Hrstka, thank you for your Assembly version in Win32-i386. Added on 2 Jan 2022 I have created a repo for you and me, Hrstka: Last edited by FlierMate on 09 Jan 2022, 11:33; edited 1 time in total |
|||
31 Dec 2021, 18:01 |
|
Hrstka 03 Jan 2022, 15:11
Tomasz, thanks for restoring back the file.
FlierMate, I hope you will be in a better mood this year . After reading your comments on GitHub, I realized that it would be a lot better to move the string to the beginning of the source file like this Code: text_to_encode equ 'Hello World!' SIZE_QRDATA = 32 SIZE_QRECC = 16 and then Code: string db text_to_encode,0 |
|||
03 Jan 2022, 15:11 |
|
FlierMate 03 Jan 2022, 17:28
Hrstka wrote:
Thank you for the well wishes, and your enhancement. I think I will do it later , because I have just finished porting your QRCLI.asm to MenuetOS 64 GUI app!! Update on 4 Jan 2022 Hi there, Hrstka, I have updated the repo accordingly. Thank you tor the nice idea! |
|||
03 Jan 2022, 17:28 |
|
FlierMate 04 Jan 2022, 08:25
Hi Hrstika, sorry to bother you again.
Firstly, want to let you know the MenuetOS-64 version of qrcli.asm is at: https://board.flatassembler.net/topic.php?t=22141 I found that our qrcli.asm (and qrcli.pas) are generating the correct 21x21 QR code, but somehow when I port it to MenuetOS 64 GUI app, the pixels might be drawn in wrong direction. Do you know what's wrong? Please see image below (both with decoded string "What is this?") Thanks to error correction, the tampered QR code can still be read and decoded successfully.
|
||||||||||
04 Jan 2022, 08:25 |
|
Hrstka 04 Jan 2022, 11:16
I think there is a bug in the redo routine. You can try the code below, but since I don't use MenuetOS, the code isn't tested and might contain bugs as well. If int 0x60 doesn't preserve r8, r9 and r10, you must add push/pop instructions in order to keep these registers.
Code: MAG = 5 ; 500% magnification xor r9, r9 ; r9 = y xor r10, r10 ; r10 = x mov r8, qr_image redo: mov rcx, r9 imul rcx, 24 add rcx, r10 cmp byte [r8+rcx], 1 jnz is_white mov rdx, 0x000000 jmp show_pixel is_white: mov rdx, 0xFFFFFF show_pixel: push r9 push r10 imul r9, MAG imul r10, MAG xor rbx, rbx xor rcx, rcx c2: push rbx push rcx push rdx add rbx, r10 ; rbx = x add rcx, r9 ; rcx = y add rbx, 20 add rcx, 80 mov rax, 1 int 0x60 ; must keep r8, r9 and r10 pop rdx pop rcx pop rbx inc rbx cmp rbx, MAG jb c2 inc rcx xor rbx, rbx cmp rcx, MAG jb c2 c1: pop r10 pop r9 inc r10 cmp r10, 24 jb redo xor r10, r10 inc r9 cmp r9, 23 jb redo |
|||
04 Jan 2022, 11:16 |
|
FlierMate 04 Jan 2022, 19:57
Hrstka wrote: I think there is a bug in the redo routine. You can try the code below, but since I don't use MenuetOS, the code isn't tested and might contain bugs as well. Thank you once again, it works perfectly without modification. Now the QR code is facing upward (as you can notice the "three lines" are now at the top of the symbol. Wonderful! Update: So, this project is coming to an end. Let me list advantages and disadvantages of this small QR code generator: Advantages: 1. Unlike competitors, this program does not have Reed-Solomon divisor polynomials, or finite field exp/log tables. Instead, if I understand correctly, it is generated during runtime. Some competitors spends hundreds of lines of code on tables of constants. 2. No other x86 Assembly of QR code generator in the market, according to my knowledge. So this is the first program of its kind that is written in x86 Assembly language. 3. Available in many desktop platforms, ranging from Windows , Linux to MenuetOS. Disadvantages: 1. Limited to Version 1 only (21x21), Version 2 to Version 40 are not supported 2. No support for other EC level (i.e. Medium, Quartile, High) 3. No support for other mask pattern. No support for Kanji characters.
|
||||||||||
04 Jan 2022, 19:57 |
|
FlierMate 28 Jan 2022, 03:04
Good day everyone!
I have modified the qrcli for Linux 32-bit to display the 21x21 QR code directly in terminal window (instead of saving it as tiny BMP file). It makes use of ANSI escape code for coloring.
|
||||||||||||||||||||
28 Jan 2022, 03:04 |
|
edfed 28 Jan 2022, 17:48
qrcode are obsolete, prefer datamatrix if really you want to barcode everything.
a proof qrcodes are obsolete, French governement use them for the sanitary pass. and when dinosaurs use something, you can be sure it's obsolete. |
|||
28 Jan 2022, 17:48 |
|
FlierMate 28 Jan 2022, 18:55
edfed wrote: qrcode are obsolete, prefer datamatrix if really you want to barcode everything. Thank you for introducing data matrix, I am totally new to this. Its newer version also use Reed-Solomon error correction, at least the base code probably will be unchanged. But I find it harder to encode data matrix in diagonal pattern, it says "if the tile falls off the edge, put remainder on the opposite side". |
|||
28 Jan 2022, 18:55 |
|
al_Fazline 04 Feb 2022, 15:08
DataMatrix is indeed kinda easier to understand, then QR, I think.
The only problem is that I don't quite understand how to generate the error correction codes myself. It has some hardcore math in it. I'm wondering if it's using same constants as QR or not (as far as I understand particular Reed-Solomon implementation depends on several constants. I didn't find which constants DM is supposed to use however. |
|||
04 Feb 2022, 15:08 |
|
Goto page 1, 2 Next < Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.