Skip to content

Commit

Permalink
repo cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
barrettotte committed Sep 6, 2021
1 parent 1567971 commit 7ff17db
Show file tree
Hide file tree
Showing 16 changed files with 29 additions and 32 deletions.
38 changes: 18 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,37 +1,35 @@
# qr-asm

Generate a QR code image from scratch with only ARM assembly.
Generate a QR code from scratch with only ARM assembly.

This was made just to learn how QR codes work and to learn ARM assembly with a really challenging project.

## Disclaimer
<figure>
<img src="./docs/asm_qrcode.png" alt="QR code to my GitHub profile."/>
<figcaption>
A byte mode QR code of
<a href="https://github.com/barrettotte">https://github.com/barrettotte</a> using Q error correction level.
</figcaption>
</figure>

The biggest thing is that **this hasn't been fully tested**. I got my one scenario working and that's good enough
for me. I'd test some others, but I'm not looking for trouble.
## Usage

`Usage: qrcode msg err_lvl`

If its not obvious I'm bad at assembly...I'm sure there are a disgusting amount of optimizations I could have done.
But, I tried to keep things simple so a dummy like me could understand this a year from now.
Specifically, I didn't really leverage 32-bit word sizes or ARM's fancy optional shifting on each instruction.
valid error levels: `L=1, M=0, Q=3, H=2`

Additionally, the binary generated is massive...I haven't messed with linkers yet.
So I'm just going to leave it the way it is for now...
My primary test - `./bin/qrcode "https://github.com/barrettotte" 3`

## QR Code Limitations
Quick build and test - `make && make test`

## Limitations

I constrained the QR code generation a lot. I just wanted to encode a url, not build a whole library.

- Byte mode encoding only
- QR version 4 and below (up to 80 characters with v4-L)
- Mask evaluation not implemented, hardcoded to mask 0 (I think masks only effect scan efficiency)

## Usage

`Usage: qrcode msg err_lvl`

My primary test - `./bin/qrcode "https://github.com/barrettotte" 3`

error levels: `L=1, M=0, Q=3, H=2`

- Instead of implementing an entire image file spec, I used [PBM](https://en.wikipedia.org/wiki/Netpbm) files to create my QR code image.

### Debugging with GDB

Expand All @@ -52,4 +50,4 @@ For sanity checking this ugly thing, see my notes in [docs/3Q-test.md](docs/3Q-t
- [Reed Solomon Codes for Coders](https://en.wikiversity.org/wiki/Reed%E2%80%93Solomon_codes_for_coders)
- [GDB Command Reference](https://visualgdb.com/gdbreference/commands/x)
- [PBM File Description](https://oceancolor.gsfc.nasa.gov/staff/norman/seawifs_image_cookbook/faux_shuttle/pbm.html)
- [Netpbm Wiki](https://en.wikipedia.org/wiki/Netpbm)
- [Netpbm Wiki](https://en.wikipedia.org/wiki/Netpbm)
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes.
23 changes: 11 additions & 12 deletions reed-solomon.s
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,17 @@
// exports
.global reed_solomon // Reed-Solomon error correction

// internal:
//
// new_msg_poly - build polynomial from message
// new_gen_poly - build generator polynomial
// gf256_mul - multiplication in Galois Field 2^8
// gf256_inv - inversion in Galois Field 2^8
// gf256_div - division in Galoi field 2^8
// poly_clr - reset a polynomial's data
// poly_norm - polynomial normalization
// poly_add - polynomial addition
// poly_mul - polynomial multiplication
// poly_rem - find remainder of polynomial long division
// internal subroutines
// new_msg_poly - build polynomial from message
// new_gen_poly - build generator polynomial
// gf256_mul - multiplication in Galois Field 2^8
// gf256_inv - inversion in Galois Field 2^8
// gf256_div - division in Galoi field 2^8
// poly_clr - reset a polynomial's data
// poly_norm - polynomial normalization
// poly_add - polynomial addition
// poly_mul - polynomial multiplication
// poly_rem - find remainder of polynomial long division

// constants
.equ POLY_SIZE, 128 // max terms in a polynomial
Expand Down

0 comments on commit 7ff17db

Please sign in to comment.