If you look at the datasheet for the 877 you will see that it has 4 BANKs of registers. Use the RP1 and RP0 to select the other BANKs and use the 'free' registers.
Also looking at your program listing, I would suggest that you look at the CBLOCK assembler directive, it will simplify the coding.
You can use cblock but according to the datasheet, 0x20 to 0x7f is only 96 registers in bank 0. You need 12 more, so just place the rest in bank 1.
*EDIT: FYI, general purpose register start from 0xa0
Which assembler are you using, if you are using MPLAB IDE 7.6 from microchip.com, its free,
then the CBLOCK and other directives are in the HELP section.
Is this clear enough?
EDIT:
Extract from MPLAB Help.
Code:
Simple Example
cblock 0x20 ; name_1 will be assigned 20
name_1, name_2 ; name_2, 21 and so on
name_3, name_4 ; name_4 is assigned 23.
endc
cblock 0x30
TwoByteVar: 0, TwoByteHigh, TwoByteLow ;TwoByteVar =0x30
;TwoByteHigh=0x30
;TwoByteLow =0x31
endc
As you are using the registers in all 4 BANK's, note that reg adddress's 0x70 thru 0x7F are common to ALL 4 BANK's, so don't use these registers in more than one BANK, to store different data blocks.
Look at the bottom of Page #13, of the datasheet for a full explanation.
Yes, but you need to consider what CBLOCK actually does, it's just a simple text substitution - so the assembler will simply replace every occurance of DIGIT1 by '20h', DIG1T2 by '21h' - it doesn't generate any code, or allocate anything, just does the text substitution.
If I need a BIG buffer in ram then I normally use banks 3 and 4 in conjunction with indirect addressing. Set the IRP bit in STATUS and put 10h in FSR, you can now access a ram buffer that is 96 bytes long. If you add a simple check for reaching 70h you can then access a buffer that is 192 bytes long. And, no bank switching required.