From c53631ec2577e869f46d5c5bcc4fb9c7f292e804 Mon Sep 17 00:00:00 2001 From: thrust26 Date: Fri, 16 Apr 2021 08:33:57 +0200 Subject: [PATCH] slightly improved instructions --- QRCodeGen.inc | 17 ++++++++++------- QRCodeGenDemo.asm | 11 ++++++----- instructions.txt | 11 +++++------ 3 files changed, 21 insertions(+), 18 deletions(-) diff --git a/QRCodeGen.inc b/QRCodeGen.inc index 361c818..b690347 100644 --- a/QRCodeGen.inc +++ b/QRCodeGen.inc @@ -502,8 +502,11 @@ DrawPattern SUBROUTINE ldy .right1 dey dey -; bpl .loopRight ; unconditional! - jmp .loopRight ; unconditional! + IF QR_OVERLAP + jmp .loopRight + ELSE + bpl .loopRight ; unconditional! + ENDIF ; } // for right .exitDraw ENDM @@ -977,7 +980,11 @@ FormatHi ; positions of the 15 type information bits FormatX1 .byte 0, 1, 2, 3, 4, 5, 7, 8 - .byte 8, 8, 8, 8, 8, 8, 8 +; ds 7, 8 ; shared +FormatX2 + ds 7, 8 + .byte QR_SIZE-8, QR_SIZE-7, QR_SIZE-6, QR_SIZE-5 + .byte QR_SIZE-4, QR_SIZE-3, QR_SIZE-2, QR_SIZE-1 FormatY2 .byte 0, 1, 2, 3, 4, 5, 6 ; ds 8, QR_SIZE-9 ; shared @@ -985,10 +992,6 @@ FormatY1 ds 8, QR_SIZE-9 .byte QR_SIZE-8, QR_SIZE-6, QR_SIZE-5, QR_SIZE-4 .byte QR_SIZE-3, QR_SIZE-2, QR_SIZE-1 -FormatX2 - ds 7, 8 - .byte QR_SIZE-8, QR_SIZE-7, QR_SIZE-6, QR_SIZE-5 - .byte QR_SIZE-4, QR_SIZE-3, QR_SIZE-2, QR_SIZE-1 ENDIF ; /QR_SINGLE_MASK = 0 || QR_DIRECT_DRAW = 0 BitMask diff --git a/QRCodeGenDemo.asm b/QRCodeGenDemo.asm index 1b7ba70..893b326 100644 --- a/QRCodeGenDemo.asm +++ b/QRCodeGenDemo.asm @@ -12,7 +12,7 @@ ; + optimize single pattern for space ; x support multiple QR code versions ; o support multiple QR code levels -; x try to optimize function pattern (SetPixel) +; + try to optimize function pattern (SetPixel) ; x add logo (does NOT work for such small sizes) ;--------------------------------------------------------------- @@ -58,6 +58,7 @@ QR_SPRITE_GFX = 1 ; display playfield or sprite graphics ERR ENDIF + ;=============================================================================== ; C O N S T A N T S ;=============================================================================== @@ -515,14 +516,14 @@ InitDemo SUBROUTINE sta NUSIZ0 sta VDELP1 - ldx #$3f + ldx #$6f stx HMP0 inx stx HMP1 - lda #$a0 + lda #$d0 sta HMM1 - SLEEP 5 + SLEEP 4 sta RESM1 sta RESP0 @@ -811,7 +812,7 @@ _QR_TOTAL SET _QR_TOTAL + . - FunctionModulesData QR_CODE_DATA - .byte " QR Code Generator Demo V0.4 - (C)2021 Thomas Jentzsch " + .byte " QR Code Generator Demo V0.5 - (C)2021 Thomas Jentzsch " ; messages MUST NOT be longer than 26 bytes for version 2, level M! MessageTbl diff --git a/instructions.txt b/instructions.txt index ed9dca7..9bf279f 100644 --- a/instructions.txt +++ b/instructions.txt @@ -22,16 +22,15 @@ Instructions: 4. Implement two subroutines: - GetPixel: checks the pixel at position x (Y), y (X), returns Z = 1 if not set - InvertPixel: inverts the pixel at position x (Y), y (X) + Note: Both routines MUST NOT change X and Y registers! -5. Add the macros GEN_QR_CODE and QR_CODE_DATA to your code area +5. Add message text using the START_MSG, n x ADD_MSG_BYTE, STOP_MSG -6. Add message text using the START_MSG, n x ADD_MSG_BYTE, STOP_MSG +6. Set qrPattern to 0..7 (chosing a mask pattern) -7. Set qrPattern to 0..7 (chosing a mask pattern) +7. Use the GEN_QR_CODE and QR_CODE_DATA macros -8. Call the GEN_QR_CODE macro - -9. Draw the generated QR code bitmap +8. Draw the generated QR code bitmap That's all! :)