标题: codewarrior里怎么在C中插入汇编? [打印本页] 作者: whut_RY 时间: 2011-10-21 09:21 标题: codewarrior里怎么在C中插入汇编? RT.起因在PIT模块中 中断里清除标志位不能使用
PITTF_PTFx = 1;
上面这条语句等同于汇编中的
BSET PITTF_PTFx, #0x01
PDF中关于清除标志位有如下解释
A flag is cleared by writing a one to the flag bit. Always use store or move instructions to write a one in
certain bit positions. Do not use the BSET instructions. Do not use any C-constructs that compile to BSET
instructions. “BSET flag_register, #mask” must not be used for flag clearing because BSET is a readmodify-
write instruction which writes back the “bit-wise or” of the flag_register and the mask into the
flag_register. BSET would clear all flag bits that were set, independent from the mask.
For example, toclear flag bit 0 use: MOVB #$01,PITTF.
要清除标志位,必须使用 MOVB #mask, flag_register 这条汇编语句或者C-constructs that compile to MOVB instructions.
我在论坛上搜到关于类似的贴: http://www.znczz.com/thread-56088-1-1.html
那么怎么样用C结构的语句来实现汇编中MOVB结构?
在KEIL 中利用编译控制命令#pragma asm(用来标识所插入的汇编语句的起始位置)
和 #pragma endasm (用来标识所插入的汇编语句的结束位置)中插入汇编
类似的,还有一个问题,codewarrior里,C语言中如何插入汇编?
小弟初来乍到,望各位解答!作者: whut_RY 时间: 2011-10-21 15:39
没人知道?作者: mick0866 时间: 2011-10-21 19:28
看看作者: chenrunshe_007 时间: 2011-10-21 22:52 本帖最后由 chenrunshe_007 于 2011-10-21 22:55 编辑