void DT_XDATA *OSTaskStkInit (void (DT_CODE *task)(void DT_XDATA *pd), void DT_XDATA *ppdata, void DT_XDATA *ptos, INT16U opt) REENTRANT
{
OS_STK DT_XDATA *stk;
ppdata = ppdata;
opt = opt;
stk = (OS_STK DT_XDATA *)ptos; /* bottom of stack */
*stk++ = (0xFF + 1); /* C_IBP */
/* simulated stack size == 0 */
*stk++ = 2 + 13; /* tow bytes of return address and 13 byte registers */
*stk++ = (INT16U)task & 0xFF; /* low byte of return address */
*stk++ = (INT16U)task >> 8; /* high byte of return address */
*stk++ = 0x0A; /* ACC */
*stk++ = 0x0B; /* B */
*stk++ = 0xD1; /* DPH */
*stk++ = 0xD0; /* DPL */
*stk++ = 0x00; /* PSW */
*stk++ = 0x00; /* R0 */
*stk++ = 0x01; /* R1 */
*stk++ = 0x02; /* R2 */
*stk++ = 0x03; /* R3 */
*stk++ = 0x04; /* R4 */
*stk++ = 0x05; /* R5 */
*stk++ = 0x06; /* R6 */
*stk++ = 0x07; /* R7 */
return ((void DT_XDATA *)ptos); /* note return ptos, not stk */
}
这里面
*stk++ = 0xD1; /* DPH */
*stk++ = 0xD0; /* DPL */
*stk++ = 0x00; /* PSW */
为什么要把0xD1,0xD0 写入栈里面?
包括下面的 R0,R1 ,都是把数字0,1,写入是不是可以随便写个数字进去
有知道的朋友吗?