mirror of
https://github.com/thrust26/6502-QR-code-generator.git
synced 2024-12-27 04:29:36 +00:00
added level Q and H support
This commit is contained in:
parent
2d664f8ef4
commit
eefc158261
@ -169,4 +169,9 @@ FirstIdxTbl ; for 25 pixel
|
||||
ds 7, 0
|
||||
.byte $01
|
||||
ds 7, 0
|
||||
.byte $bf
|
||||
IF QR_LEVEL = 0 || QR_LEVEL = 1
|
||||
.byte $bf ; 1st format bit is 1
|
||||
ELSE
|
||||
.byte $3f ; 1st format bit is 0
|
||||
ENDIF
|
||||
|
||||
|
@ -178,7 +178,7 @@ FirstIdxTbl ; for 25 pixel
|
||||
ds 7, 0
|
||||
.byte $01
|
||||
ds 7, 0
|
||||
IF QR_VERSION = 1 || QR_VERSION = 2
|
||||
IF QR_LEVEL = 0 || QR_LEVEL = 1
|
||||
.byte $bf ; 1st format bit is 1
|
||||
ELSE
|
||||
.byte $3f ; 1st format bit is 0
|
||||
|
@ -614,7 +614,47 @@ FormatHi
|
||||
.byte %00101110
|
||||
.byte %01000000
|
||||
ENDIF
|
||||
; TODO: levels Q and H
|
||||
IF QR_LEVEL = 2 ; Q
|
||||
FormatLo
|
||||
.byte %01101010
|
||||
.byte %01100000
|
||||
.byte %01111110
|
||||
.byte %01110100
|
||||
.byte %01001001
|
||||
.byte %01000011
|
||||
.byte %01011101
|
||||
.byte %01010111
|
||||
FormatHi
|
||||
.byte %10111110
|
||||
.byte %11010000
|
||||
.byte %01100010
|
||||
.byte %00001100
|
||||
.byte %01101000
|
||||
.byte %00000110
|
||||
.byte %10110100
|
||||
.byte %11011010
|
||||
ENDIF
|
||||
IF QR_LEVEL = 3 ; H
|
||||
FormatLo
|
||||
.byte %00101101
|
||||
.byte %00100111
|
||||
.byte %00111001
|
||||
.byte %00110011
|
||||
.byte %00001110
|
||||
.byte %00000100
|
||||
.byte %00011010
|
||||
.byte %00010000
|
||||
FormatHi
|
||||
.byte %00010010
|
||||
.byte %01111100
|
||||
.byte %11001110
|
||||
.byte %10100000
|
||||
.byte %11000100
|
||||
.byte %10101010
|
||||
.byte %00011000
|
||||
.byte %01110110
|
||||
ENDIF
|
||||
ENDIF ; /QR_SINGLE_MASK = 0
|
||||
|
||||
; position of the 15 type information bits
|
||||
FormatX1
|
||||
|
@ -38,9 +38,9 @@ NTSC = 1
|
||||
|
||||
; QR Code Generator Switches
|
||||
QR_VERSION = 2 ; 1, 2 or 3 (TODO 1 and 3)
|
||||
QR_LEVEL = 1 ; 0 (L) or 1 (M) (TODO: 2 (Q) and 3 (H))
|
||||
QR_LEVEL = 1 ; 0 (L), 1 (M), 2 (Q) and 3 (H))
|
||||
QR_OVERLAP = 1 ; overlaps input and output data to save RAM (0 not tested!)
|
||||
QR_SINGLE_MASK = 1 ; (-255) if 1 uses only 1 of the 8 mask pattern
|
||||
QR_SINGLE_MASK = 0 ; (-255) if 1 uses only 1 of the 8 mask pattern
|
||||
QR_PADDING = 1 ; (+22) add padding bytes
|
||||
|
||||
IF QR_VERSION = 1 || QR_VERSION = 3
|
||||
@ -85,7 +85,7 @@ msgData = data + QR_DEGREE ; (QR_MAX_DATA = 28 bytes)
|
||||
;- - - - - - - - - - - - - - - - - - - -
|
||||
; The QR code overlaps the data! It overwrites the data while being drawn.
|
||||
IF QR_OVERLAP
|
||||
qrCodeLst = data + 6 ; all but 6 bytes overlap (version 2 only!)
|
||||
qrCodeLst = data + 6 ; all but 6 bytes overlap (version 2 only!)
|
||||
ds NUM_FIRST + QR_SIZE*3 - QR_TOTAL + 6 ; 38 bytes
|
||||
ELSE
|
||||
qrCodeLst ds NUM_FIRST + QR_SIZE*3 ; 76 bytes
|
||||
@ -250,23 +250,23 @@ DrawScreen SUBROUTINE
|
||||
.tmpFirst = tmpVars
|
||||
|
||||
; the QR code kernel
|
||||
.loopKernel ; @55
|
||||
.loopKernel ; @53
|
||||
lda FirstIdxTbl,x ; 4*
|
||||
cmp #1
|
||||
cmp #1 ; 2
|
||||
bcs .newFirst ; 2/3
|
||||
lsr .tmpFirst ; 5
|
||||
bpl .endFirst ; 3 = 14 unconditional
|
||||
bpl .endFirst ; 3 = 16 unconditional
|
||||
|
||||
.newFirst ; @62
|
||||
; $bf/$3f | $01 | $fe
|
||||
bne .enterLoop ; 2/3
|
||||
lda firstMsl ; 3
|
||||
.enterLoop
|
||||
sta .tmpFirst ; 3 = 7
|
||||
.endFirst ; @69
|
||||
sta .tmpFirst ; 3 = 8
|
||||
.endFirst ; @70/69
|
||||
ldy #2 ; 2
|
||||
.loopBlock
|
||||
sta WSYNC ; 3 @74
|
||||
sta WSYNC ; 3 @75/74
|
||||
;---------------------------------------
|
||||
;M1-P0-P1-P0
|
||||
lda .tmpFirst ; 3
|
||||
@ -276,13 +276,17 @@ DrawScreen SUBROUTINE
|
||||
sta GRP1 ; 3
|
||||
lda grp0LLst,x ; 4
|
||||
sta GRP0 ; 3
|
||||
SLEEP 17 ;17
|
||||
SLEEP 17-7 ;10
|
||||
lda grp0RLst,x ; 4
|
||||
dey ; 2
|
||||
sta GRP0 ; 3 = 40 @48
|
||||
bne .loopBlock ; 3/2
|
||||
dey ; 2 = 30
|
||||
cpy #$01 ; 2
|
||||
bne .isff ; 2/3
|
||||
BIT_B ; 1
|
||||
.isff
|
||||
dex ; 2
|
||||
bpl .loopKernel ; 3/2=7/6
|
||||
sta GRP0 ; 3 = 10 @48
|
||||
bcs .loopBlock ; 2/3
|
||||
bpl .loopKernel ; 3/2=5/4
|
||||
sta WSYNC
|
||||
;---------------------------------------------------------------
|
||||
sty ENAM1
|
||||
|
Loading…
Reference in New Issue
Block a user