展辉 刘

Some questions about S12Z Assembler

Discussion created by 展辉 刘 on Aug 8, 2017
Latest reply on Aug 9, 2017 by Daniel Martynek

I I have used S12 MCU,and there are some Assembly code。Now i am using S12ZV(S12Z),and I want to transplant the  assembly code(S12) to S12Z project to achieve the same function,but the Assembly instructions are different between S12 and S12Z,can you help me to write the code?

 

/****************************************************************************
Name : VStdLL_GlobalInterruptDisable
Called by : -
Preconditions : -
Parameters : tVStdIrqStateType* pOldState: pointer to the local irq state
Return values : none
Description : saves the current CCR value to *pOldState and disables the
global interrupt
****************************************************************************/
/* CODE CATEGORY 1 START*/
VSTD_DEF_FUNC_API(VSTD_NONE, void, CODE) VStdLL_GlobalInterruptDisable(VSTD_DEF_P2VAR_PARA(VSTD_NONE, tVStdIrqStateType, AUTOMATIC, VAR_NEAR) pOldState) VSTD_API_2
{
asm{

pshy ; save index register
tfr d,y ; transfer pointer to index register
tpa ; load ccr to accumulator
sei ; disable global interrupt
staa 0,y ; store the value of ccr into loction pointed by pOldState
puly ; restore index register
}

}
/* CODE CATEGORY 1 END*/

/****************************************************************************
Name : VStdLL_GlobalInterruptRestore
Called by : -
Preconditions : -
Parameters : tVStdIrqStateType nOldState: value of the local irq state
Return values : none
Description : restores the CCR value stored in nOldState
****************************************************************************/
/* CODE CATEGORY 1 START*/
VSTD_DEF_FUNC_API(VSTD_NONE, void, CODE) VStdLL_GlobalInterruptRestore(tVStdIrqStateType nOldState) VSTD_API_2
{
asm{
tba ; b to a
tap ; load accumulator to ccr
}
}

Outcomes