Skip to content

Commit

Permalink
format bits and mask working
Browse files Browse the repository at this point in the history
  • Loading branch information
barrettotte committed Sep 6, 2021
1 parent 83daa1f commit d9d9d8c
Show file tree
Hide file tree
Showing 7 changed files with 318 additions and 46 deletions.
8 changes: 4 additions & 4 deletions ascii.s
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
// subroutines for various ASCII utilities

.include "const.s"
.include "const.inc"

// exports
.global ascii_uint2dec // Convert uint to ASCII decimal string
.global ascii_ubyte2bin // Convert ubyte to ASCII binary string
.global ascii_uint2dec // convert uint to ASCII decimal string
.global ascii_ubyte2bin // convert ubyte to ASCII binary string

.data

Expand All @@ -15,7 +15,7 @@ one_tenth: .word 0x1999999A // ~((2^32)/10)+1; for quick div by 1

ascii_ubyte2bin: // ***** Convert ubyte to ASCII binary string *****
// r0 - pointer to ASCII conversion
// r1 - length of ASCII conversion (output only)
// r1 - unused
// r2 - ubyte input
// r3 - unused
push {r4-r11, lr} // save caller's vars + return address
Expand Down
File renamed without changes.
18 changes: 18 additions & 0 deletions docs/3Q-test.md
Original file line number Diff line number Diff line change
Expand Up @@ -289,3 +289,21 @@ Verify ubyte to ASCII binary string worked - `x/9ub &bin_string`, `x/9ub &aub2b_
From this point on its a lot of visual checking.

`x/567ub &data_bin`

`x/9ub &fmt_hi`

```
"00110101"
0x?????: 48 48 49 49 48 49 48 49
0x?????: 0
```

`x/9ub &fmt_lo`

```
"01011111"
0x?????: 48 49 48 49 49 49 49 49
0x?????: 0
```
13 changes: 11 additions & 2 deletions main.s
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
// - Build QR code matrix using payload block and QR code specifications
// - Output QR code matrix to image file

.include "const.s"
.include "const.inc"

.global _start

Expand Down Expand Up @@ -92,7 +92,7 @@ dw_block: .space MAX_DWB // data word block
ecw_blocks: .space MAX_ECWB*MAX_G1B // all error correction blocks
ecw_block: .space MAX_ECWB // error correction words block
payload: .space MAX_PAYLOAD // payload of data and error correction blocks
qr_mat: .space MAX_QR_SIZE, ASCII_ZERO // QR code matrix; ASCII bytes
qr_mat: .space MAX_QR_SIZE, ASCII_TWO // QR code matrix; ASCII bytes
data_bin: .space MAX_PAYLOAD*8 // payload converted to binary ASCII string

.text
Expand Down Expand Up @@ -385,6 +385,7 @@ qr_rem_loop:
ldr r7, =pyld_bits // pointer to payload size in bits
strh r4, [r7] // store calculated payload size

qr_fill:
ldr r0, =qr_mat // pointer to QR matrix
mov r2, r11 // pass qr_width
ldr r3, =version // pointer to version
Expand All @@ -396,11 +397,19 @@ qr_rem_loop:
mov r3, r4 // load payload size in bits
bl qr_zigzag // add payload to QR matrix

mov r1, #0 // hardcoded mask index
ldr r3, =eclvl_idx // pointer to error level index
ldrb r3, [r3] // pass error level
bl qr_fmtbits // add format bits to QR matrix

bl qr_mask0 // apply mask 0 to QR matrix

ldr r0, =qr_mat // pointer to QR matrix
ldr r1, =out_file // pointer to PBM file name
mov r2, r11 // pass qr_width
bl qr_normalize // normalize QR matrix to ['0','1']

qr_output:
mov r2, r11 // pass qr_width
mov r3, r2 // use width for PBM width + length (square)
bl pbm_write // create new PBM file from QR matrix
Expand Down
2 changes: 1 addition & 1 deletion pbm.s
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// subroutines for creating a Portable Bitmap File (PBM)

.include "const.s"
.include "const.inc"

// exports
.global pbm_write // write array to a new PBM file
Expand Down
56 changes: 28 additions & 28 deletions qrcode.pbm
Original file line number Diff line number Diff line change
@@ -1,31 +1,31 @@
P1
29 29
1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1
1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 1
1 0 1 1 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 1 1 0 1
1 0 1 1 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 1 1 0 1
1 0 1 1 1 0 1 0 0 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