This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Stack

Hello,
I'm working on the XC164X µc and I've a question concerning the storage of registers in stack when interrupt occur.

The function is written in c language

void ItFunc (void) interrupt 14
{ funcCode ();
}

The pre-processor code is as follow:

ItFunc PROC INTERRUPT = 14 GLOBAL ItFunc
; FUNCTION ItFunc (BEGIN RMASK = @0x3FFF)

SCXT DPP3,#3

PUSH DPP0

SCXT MDC,#16

PUSH MDH

PUSH MDL

MOV [-R0],R1

MOV [-R0],R2

MOV [-R0],R3

MOV [-R0],R4

MOV [-R0],R5

MOV [-R0],R6

MOV [-R0],R7

MOV [-R0],R8

MOV [-R0],R9

MOV [-R0],R10

MOV [-R0],R11

MOV [-R0],R12

; line 234: funcCode ();

CALL funcCode

?C0005:

MOV R12,[R0+]

MOV R11,[R0+]

MOV R10,[R0+]

MOV R9,[R0+]

MOV R8,[R0+]

MOV R7,[R0+]

MOV R6,[R0+]

MOV R5,[R0+]

MOV R4,[R0+]

MOV R3,[R0+]

MOV R2,[R0+]

MOV R1,[R0+]

POP MDL

POP MDH

POP MDC

POP DPP0

POP DPP3

RETI

; FUNCTION ItFunc (END RMASK = @0x3FFF)

ItFunc ENDP

?PR?BS_TST ENDS

As shown in this pre-processor code, we use the register R0 to save the registers R1—R12.
I'd like to store the registers using the instruction PUSH R1.
How can I do this? Which directive could I use that the compiler store the registers in stack using the instruction "PUSH R1" and not using "MOV [-R0], R1"

Thanks

0