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

NOAREG & AREG,

Hello,
I'm having trouble understanding the NOAREG, AREG & USING options. I'm also confused with R0-R7 & AR0-AR7.
I've read the support files and manual but i'm still confused.
May I know
a) How is it that using NOAREGs will allow me to disregard register bank currently used when writing function? ( will the registers be automatically saved to stack? )
b) What is the difference with R0 and AR0? How does the USING option affect R0 & AR0? (for example if i put the option "USING 2", have then use R4, does this mean that it is the actually R20 ie in bank 2, whiel AR4 is not affected by the using function)
c) How does USING help me to save stack space?
Best Regards,
AL

Parents
  • Here is an example of the "prologue" to a C51 interrupt function with & without the using(n) option:

    ; void UartIsr( void ) INTERRUPT(4)   ; void UartIsr( void ) INTERRUPT(4) USING(2)
    
            RSEG  ?PR?UartIsr?VM_OLMFSM       RSEG  ?PR?UartIsr?VM_OLMFSM
            USING   0                         USING   2
    UartIsr:                              UartIsr:
            PUSH    ACC                       PUSH    ACC
            PUSH    B                         PUSH    B
            PUSH    DPH                       PUSH    DPH
            PUSH    DPL                       PUSH    DPL
            PUSH    PSW                       PUSH    PSW
                                              USING   2
            MOV     PSW,#00H                  MOV     PSW,#010H
            PUSH    AR0                       
            PUSH    AR1                   
            PUSH    AR2                   
            PUSH    AR3
            PUSH    AR4
            PUSH    AR5
            PUSH    AR6
            PUSH    AR7
            USING   0
    ; {                                   ; {
    there'd be a corresponding saving of POPs at the end of the function

Reply
  • Here is an example of the "prologue" to a C51 interrupt function with & without the using(n) option:

    ; void UartIsr( void ) INTERRUPT(4)   ; void UartIsr( void ) INTERRUPT(4) USING(2)
    
            RSEG  ?PR?UartIsr?VM_OLMFSM       RSEG  ?PR?UartIsr?VM_OLMFSM
            USING   0                         USING   2
    UartIsr:                              UartIsr:
            PUSH    ACC                       PUSH    ACC
            PUSH    B                         PUSH    B
            PUSH    DPH                       PUSH    DPH
            PUSH    DPL                       PUSH    DPL
            PUSH    PSW                       PUSH    PSW
                                              USING   2
            MOV     PSW,#00H                  MOV     PSW,#010H
            PUSH    AR0                       
            PUSH    AR1                   
            PUSH    AR2                   
            PUSH    AR3
            PUSH    AR4
            PUSH    AR5
            PUSH    AR6
            PUSH    AR7
            USING   0
    ; {                                   ; {
    there'd be a corresponding saving of POPs at the end of the function

Children