Code Example For Stop2 Mode ?

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

Code Example For Stop2 Mode ?

1,660 次查看
m2s
Contributor I
Hy, I'm wondering if someone have an example on how they save all register value into ram and get them back into the register when returning from Stop2 mode.
 
Is theyre a faster way than simply copy the information regsiter by regsiter ?
 
best regards.
标签 (1)
0 项奖励
回复
2 回复数

822 次查看
Ake
Contributor III
The fastest way for saving the registers would be something like this
 
pshh ;save h 2
pshx ;save x 2
psha ;save a 2
tpa ;get a copy of the status register 1
psha; and save it 2
tsx; get stack pointer to hx 2
sthx savedSP ;save the stack pointer 4
So it would take 2+2+2+1+2+2+4 = 15 clock cycles or 0.75 uS on a 20 Mhz 9S08.
 
In the savedSP word the SP should be saved so when the CPU is powered up, it first checks the savedSP word. If it is < 0xffff, the saved data can be restored. If = 0xffff, no data has been saved.
 
 
Regards,
Ake
 
 
 
0 项奖励
回复

822 次查看
m2s
Contributor I
Thank's
 
To that I need to add the instructions to save all I/O regsiter to.
0 项奖励
回复