After a quick look at that code, it looks like it already handles 8x8. You probably could cut out some unused bits of cs_menu_matrix.inc but there’s no real point as it does what you want already. If it ain’t broke, don’t fix it.
Wire it up like in the MB-SID step C connection diagram, and then change which shift registers you are using, most likely you only have two connected so in main.asm:
;; define the shift registers to which the LED matrix is connected
;; (note: HERE the shift register begins with 0: 1st SR is 0, 2nd is 1, 3rd is 2, ...)
#define MOD_MATRIX_ANODES 6 ; shift register with anodes (HERE: 7th shift register in the chain)
#define MOD_MATRIX_CATHODES 7 ; shift register with cathodes (HERE: 8th shift register in the chain)
[/code]
replace 6 with 0 and 7 with 1.
Further down, change 56 to 64:
[code]
;; increment counter, wrap at 56
incf LED\_SELECT\_CTR, F
movlw 56
IFGEQ LED\_SELECT\_CTR, ACCESS, clrf LED\_SELECT\_CTR
Note this is just some sample code that appears to turn on one LED at a time, cycling through them all, i.e. you don’t need this counter to do what you want later. The code in cs_menu_matrix.inc manages turning on LEDs in a single row and incrementing the row counter. Once you’ve got this demo working, replace this code with just:
USER_SR_Service_Prepare
;; branch to LED Matrix code
goto CS_MENU_MATRIX_Handler
[/code]
You should also clear the matrix in the USER_Init routine:
[code]
;; clear LED matrix
clrf CS\_MENU\_MATRIX\_BEGIN+0
clrf CS\_MENU\_MATRIX\_BEGIN+1
clrf CS\_MENU\_MATRIX\_BEGIN+2
clrf CS\_MENU\_MATRIX\_BEGIN+3
clrf CS\_MENU\_MATRIX\_BEGIN+4
clrf CS\_MENU\_MATRIX\_BEGIN+5
clrf CS\_MENU\_MATRIX\_BEGIN+6
clrf CS\_MENU\_MATRIX\_BEGIN+7
Then elsewhere (perhaps in USER_MPROC_NotifyReceivedEvent) you should toggle bits in the registers CS_MENU_MATRIX_BEGIN+0 to CS_MENU_MATRIX_BEGIN+7 (each byte is a row of the matrix). You’ll have to learn enough assember to do that bit yourself. In short, you’re probably wanting to turn a number like 0-63 into the byte to change (CS_MENU_MATRIX_BEGIN+0 to CS_MENU_MATRIX_BEGIN+7) and a bit within that byte. The code in the demo does this already:
lfsr FSR2, CS_MENU_MATRIX_BEGIN
movf LED_SELECT_CTR, W
andlw 0x07
addwf FSR2L, F
rrf LED_SELECT_CTR, W
rrf WREG, W
rrf WREG, W
andlw 0x07
call MIOS_HLP_GetBitORMask
movwf INDF2
[/code]
The register LED\_SELECT\_CTR is used to calculate which byte to change. You'll need to adjust this to suit your purposes, and learn about using a mask to toggle one bit in a byte. Basically you will need to understand how this little bit of code works, using indirect registers to change one register in a register range, i.e. called an array in other programming languages.