From dde07790ba591a8acd2d150b41898a23af1cee4d Mon Sep 17 00:00:00 2001 From: thrust26 Date: Thu, 15 Apr 2021 20:16:31 +0200 Subject: [PATCH] amoved single mask option to common code --- QRCodeGen.inc | 9 ++++++++- QRCodeGenDemo.asm | 22 ++++++++-------------- instructions.txt | 17 +++++++++-------- 3 files changed, 25 insertions(+), 23 deletions(-) diff --git a/QRCodeGen.inc b/QRCodeGen.inc index 799bab6..361c818 100644 --- a/QRCodeGen.inc +++ b/QRCodeGen.inc @@ -7,6 +7,9 @@ QR_VERSION = 2 ; 1..3, QR code size (21, 25, 29) ENDIF IFNCONST QR_LEVEL QR_LEVEL = 0 ; 0..4, error correction levels L, M, Q, H + ENDIF + IFNCONST QR_SINGLE_MASK +QR_SINGLE_MASK = 0 ; 0|1, use only 1 of the 8 mask pattern ENDIF IFNCONST QR_PADDING QR_PADDING = 1 ; 0|1, add padding bytes add the end of test message text @@ -671,7 +674,11 @@ DrawPattern SUBROUTINE .loopFormat sty .idx cpy #8 + IF QR_SINGLE_MASK + ldx #0 + ELSE ldx qrPattern + ENDIF lda FormatLo,x and BitMask,y bcc .lowFormat @@ -838,7 +845,7 @@ PatternWidth .byte 1 ; left, vertical timing line .byte 9, 9, 8 ; eye pattern .byte 4, 1 ; alignment pattern (right/middle part) - .byte QR_SIZE - 9 - 8 ; top, horizontal timing line +; .byte QR_SIZE - 9 - 8 ; top, horizontal timing line PatternHeight .byte QR_SIZE - 9 - 8 ; left, vertical timing line .byte 9, 8, 9 ; eye pattern diff --git a/QRCodeGenDemo.asm b/QRCodeGenDemo.asm index ac391d0..1b7ba70 100644 --- a/QRCodeGenDemo.asm +++ b/QRCodeGenDemo.asm @@ -1,4 +1,4 @@ -; QR Code generator demo V0.4 +; QR Code generator demo V0.5 ; (C) 2021 Thomas Jentzsch ; TODOs @@ -40,16 +40,16 @@ ATARI_2600 = 1 ; enable for Atari 2600 specific code ; QR Code Generator Switches QR_VERSION = 2 ; 1, 2 or 3 (TODO 1 and 3) QR_LEVEL = 1 ; 0 (L), 1 (M), 2 (Q) and 3 (H)) +QR_SINGLE_MASK = 0 ; (-255 bytes) use only the 1st of the 8 mask pattern QR_PADDING = 1 ; (+ 22 bytes) add padding bytes (optional) -QR_GENERATE = 0 ; (+~12 bytes) generates Reed-Solomon ECC generator polynomial on-the-fly - ; else uses built-in table +QR_GENERATE = 0 ; (+~12 bytes) generate Reed-Solomon ECC generator polynomial on-the-fly + ; else use built-in table ; Atari 2600 specific QR settings (keep set to 0 for other platforms!) IFCONST ATARI_2600 QR_OVERLAP = 1 ; overlaps input and output data to save RAM (defined for version 2 only!) -QR_SINGLE_MASK = 0 ; (-255 bytes) if 1 uses only 1 of the 8 mask pattern QR_DIRECT_DRAW = 0 ; (+ 45 bytes) draw byte columns instead of individual pixel -QR_SPRITE_GFX = 0 ; display playfield or sprite graphics +QR_SPRITE_GFX = 1 ; display playfield or sprite graphics ENDIF IF QR_VERSION != 2 @@ -58,13 +58,6 @@ QR_SPRITE_GFX = 0 ; display playfield or sprite graphics ERR ENDIF - IF QR_SINGLE_MASK = 1 && QR_DIRECT_DRAW = 0 - ECHO "" - ECHO "*** ERROR: Unsupported assembler switches combination! ***" - ERR - ENDIF - - ;=============================================================================== ; C O N S T A N T S ;=============================================================================== @@ -631,11 +624,12 @@ _QR_TOTAL SET _QR_TOTAL + . - MessageCode IF QR_SPRITE_GFX = 0 ; rearrange bitmap data for PF display -; | P0L | P1 | P0R | -; X|XXXXXXXX|XXXXXXXX|XXXXXXXX| ; |PF0 | PF1 | PF2 |PF0 | PF1 | PF2 | ; | |7......0|0......7|4..7|7......0| | ; |....|...XXXXX|XXXXXXXX|XXXX|XXXXXXXX|........| +; | P0L | P1 | P0R | +; 0|abcdefgh|ijklmnop|qrstuvwx| -> +; -> 0|ponmabcd|lkjihgfe|qrstuvwx| .tmpLeft = qrTmpVars ldx #QR_SIZE-1 diff --git a/instructions.txt b/instructions.txt index 8bf1a09..ed9dca7 100644 --- a/instructions.txt +++ b/instructions.txt @@ -5,16 +5,17 @@ Instructions: 1. Include QRCodeGen.inc into the code area of your own code 2. Define the following constants: - - QR_VERSION = 1..3 ; QR code size (21, 25, 29) - - QR_LEVEL = 0..3 ; error correction levels L, M, Q, H - - QR_PADDING = 0|1 ; add padding bytes add the end of test message text - - QR_GENERATE = 0|1 ; generate Reed-Solomon ECC generator polynomial on-the-fly - ; else use built-in table + - QR_VERSION = 1..3 ; QR code size (21, 25, 29) + - QR_LEVEL = 0..3 ; error correction levels L, M, Q, H + - QR_SINGLE_MASK = 0|1 ; use only the 1st of the 8 mask pattern + - QR_PADDING = 0|1 ; add padding bytes add the end of test message text + - QR_GENERATE = 0|1 ; generate Reed-Solomon ECC generator polynomial on-the-fly + ; else use built-in table 3. Define memory for code generation and displayed bitmap: - - qrTmpVars ds 9 - - qrData ds QR_TOTAL - - qrPattern ds 1 + - qrTmpVars ds 9 + - qrData ds QR_TOTAL + - qrPattern ds 1 - qrGenerator ds QR_DEGREE (only required if QR_GENERATE = 1) - bitmap depends on platform