     PRESERVE8 



















































    EXPORT    GSMInterlockedIncrement
    EXPORT    GSMInterlockedDecrement
    EXPORT    GSMInterlockedDecrementNoTurnaround
    EXPORT    GSMInterlockedAdd
    EXPORT    GSMInterlockedExchange
    EXPORT    GSMInterlockedBitAnd
    EXPORT    GSMInterlockedBitOr
    EXPORT    GSMInterlockedBitAndOr
    EXPORT    GSMInterlockedBitOrAnd
    EXPORT    PCUWriteFromsharedRAM_START
    EXPORT    PCUWriteFromsharedRAM_END

    AREA SysInterlocked, CODE, READONLY

    CODE32

GSMInterlockedIncrement
    MRS     r1, CPSR
    ORR     r2, r1, #0x80:OR:0x40
    MSR     CPSR_c, r2

    LDR     r2, [r0]
    ADD     r3, r2, #1
    STR     r3, [r0]

    MOV     r0, r2

    MSR     CPSR_c, r1

    BX      LR

GSMInterlockedDecrement
    MRS     r1, CPSR
    ORR     r2, r1, #0x80:OR:0x40
    MSR     CPSR_c, r2

    LDR     r2, [r0]
    SUB     r3, r2, #1
    STR     r3, [r0]

    MOV     r0, r2

    MSR     CPSR_c, r1

    BX      LR

GSMInterlockedDecrementNoTurnaround
    MRS     r1, CPSR
    ORR     r2, r1, #0x80:OR:0x40
    MSR     CPSR_c, r2

    LDR     r2, [r0]
    SUBS    r3, r2, #1
    STRCS   r3, [r0]

    MOV     r0, r2

    MSR     CPSR_c, r1

    BX      LR

GSMInterlockedAdd
    MRS     r2, CPSR
    ORR     r3, r2, #0x80:OR:0x40
    MSR     CPSR_c, r3

    LDR     r3, [r0]
    ADD     r1, r3, r1
    STR     r1, [r0]

    MOV     r0, r3

    MSR     CPSR_c, r2

    BX      LR

GSMInterlockedExchange
    MRS     r2, CPSR
    ORR     r3, r2, #0x80:OR:0x40
    MSR     CPSR_c, r3

    LDR     r3, [r0]
    STR     r1, [r0]

    MOV     r0, r3

    MSR     CPSR_c, r2

    BX      LR

GSMInterlockedBitAnd
    MRS     r2, CPSR
    ORR     r3, r2, #0x80:OR:0x40
    MSR     CPSR_c, r3

    LDR     r3, [r0]
    AND     r1, r3, r1
    STR     r1, [r0]

    MOV     r0, r3

    MSR     CPSR_c, r2

    BX      LR

GSMInterlockedBitOr
    MRS     r2, CPSR
    ORR     r3, r2, #0x80:OR:0x40
    MSR     CPSR_c, r3

    LDR     r3, [r0]
    ORR     r1, r3, r1
    STR     r1, [r0]

    MOV     r0, r3

    MSR     CPSR_c, r2

    BX      LR

GSMInterlockedBitAndOr
    STMFD    r13!, {r4}
    MRS     r4, CPSR
    ORR     r3, r4, #0x80:OR:0x40
    MSR     CPSR_c, r3

    LDR     r3, [r0]
    AND     r1, r3, r1
    ORR     r1, r1, r2
    STR     r1, [r0]

    MOV     r0, r3

    MSR     CPSR_c, r4

    LDMFD    r13!, {r4}
    BX      LR

GSMInterlockedBitOrAnd
    STMFD    r13!, {r4}
    MRS     r4, CPSR
    ORR     r3, r4, #0x80:OR:0x40
    MSR     CPSR_c, r3

    LDR     r3, [r0]
    ORR     r1, r3, r1
    AND     r1, r1, r2
    STR     r1, [r0]

    MOV     r0, r3

    MSR     CPSR_c, r4

    LDMFD    r13!, {r4}
    BX      LR















PCUWriteFromsharedRAM
PCUWriteFromsharedRAM_START
                 MOV         r2,#0
                 ADD         r2,pc,#8
                 STMIA      r2,{r0-r7}
                 STR      r1,[r0]
                 BX LR
PCUWriteFromsharedRAM_END    

    : END OF FILE 
    END

