关于如何在C语言中嵌入汇编命令
转载自:http://www.keil.com/support/docs/2308.htm
C51: GETTING INLINE ASSEMBLY TO WORK
Information in this article applies to:
- C51 All Versions
QUESTION
How do I implement inline assembly in C51 using the ASM and ENDASM directives. I have read some of the knowledgebase articles relating to this problem, but I still cannot get it to work.
ANSWER
The following example program, MAIN.C, demonstrates some simple inline assembly.
void main(void){
test();
#pragma asm
JMP $ ; endless loop
#pragma endasm
}
The following rules apply to C51 inline assembly:
- To use #pragma ASM/ENDASM, you must set the Generate Assembler SRC File andAssemble SRC File source file compile options in µVision by right-clicking your source file name in the Project Workspace and selectingOptions for File.
- When using the Generate Assembler SRC File and Assemble SRC File options in µVision, if there are no other C modules in your project, you must manually include the C51 Run-Time Library (C51S.LIB, C51M.LIB, or C51L.LIB).
MORE INFORMATION
- Refer to ASM in the Cx51 User's Guide.
- Refer to Interfacing C to Assembler in the Cx51 User's Guide.
SEE ALSO
- C51: PROBLEMS WITH #PRAGMA ASM
- GENERAL: SRC DIRECTIVE
- BL51: WARNING L1 (UNRESOLVED EXTERNAL) USING INLINE ASSEMBLY
- C51: INLINE ASSEMBLY GENERATES TARGET OUT OF RANGE
- C51: IN-LINE ASM GIVES COMPILER WARNINGS
FORUM THREADS
The following Discussion Forum threads may provide information related to this topic.
Last Reviewed: Thursday, July 17, 2008
关于如何在C语言中嵌入汇编命令的更多相关文章
- [汇编] C语言中嵌入汇编
>_<" 下面是在C语言中嵌入汇编的例子,下面是三点要注意的~ 1.内联式汇编 2._asm关键字 3.并不是所有中断都能被支持 #include<iostream> ...
- 如何在C语言中调用Swift函数
在Apple官方的<Using Swift with Cocoa and Objectgive-C>一书中详细地介绍了如何在Objective-C中使用Swift的类以及如何在Swift中 ...
- 【转载】如何在C语言中调用shell命令
转载自:http://blog.csdn.net/chdhust/article/details/7951576 如何在C语言中调用shell命令 在linux操作系统中,很多shell命令使用起来非 ...
- 在c语言中嵌入汇编语句,对于我来说相当难。
今天早上在csdn论坛上看到一个帖子http://topic.csdn.net/u/20120917/14/82f42e17-977a-4824-95bd-7b79db15d283.html:“C语言 ...
- 技术分享:如何在PowerShell脚本中嵌入EXE文件
技术分享:如何在PowerShell脚本中嵌入EXE文件 我在尝试解决一个问题,即在客户端攻击中只使用纯 PowerShell 脚本作为攻击负荷.使用 PowerShell 运行恶意代码具有很多优点, ...
- 在C语言中嵌入汇编语言
TMS320C28x编译器允许在C程序中嵌入汇编指令,通过下面声明实现: asm(“assembler text”); 其中assembler text指汇编代码.asm指令一般用来处理C/C++语句 ...
- 如何在R语言中使用Logistic回归模型
在日常学习或工作中经常会使用线性回归模型对某一事物进行预测,例如预测房价.身高.GDP.学生成绩等,发现这些被预测的变量都属于连续型变量.然而有些情况下,被预测变量可能是二元变量,即成功或失败.流失或 ...
- 如何在batch脚本中嵌入python代码
老板叫我帮他测一个命令在windows下消耗的时间,因为没有装windows那个啥工具包,没有timeit那个命令,于是想自己写一个,原理很简单: REM timeit.bat echo %TIME% ...
- 解析如何在C语言中调用shell命令的实现方法【转】
本文转自:http://www.jb51.net/article/37404.htm 1.system(执行shell 命令)相关函数 fork,execve,waitpid,popen表头文件 #i ...
随机推荐
- 赵雅智_ListView_BaseAdapter
Android界面中有时候须要显示略微复杂的界面时,就须要我们自己定义一个adapter,而此adapter就要继承BaseAdapter,又一次当中的方法. Android中Adapter类事实上就 ...
- Android Bitmap开发之旅--基本操作
1 Bitmap加载方式 在介绍Bitmap--OOM 异常时,首先介绍一下Bitmap有哪几种加载方式.通常Bitmap的加载方式有Resource资源加载.本地(SDcard)加载.网络加载等加载 ...
- Zlib文件压缩和解压
开源代码:http://www.zlib.net/zlib使用手册:http://www.zlib.net/manual.htmlzlib wince版:http://www.tenik.co.jp/ ...
- 汉诺塔III 递推题
题目描述: 约19世纪末,在欧州的商店中出售一种智力玩具,在一块铜板上有三根杆,最左边的杆上自上而下.由小到大顺序串着由64个圆盘构成的塔.目的是将最左边杆上的盘全部移到右边的杆上,条件是一次只能移动 ...
- HDU5289
题意:求解存在最大差值小于给定K值的所有区间段. 输入: T(测试数据) n(数组个数)K(给定区间值的范围) ai...(数组值) 输出: ss(所有满足符合条件的区间段) 思路:二分+ST算法,首 ...
- js正则表达式验证大全
/判断输入内容是否为空 function IsNull(){ var str = document.getElementById('str').value.trim(); ...
- 移动页面缩放方法之(一)控制meta法
<!DOCTYPE HTML> <html lang="zh-cn"> <head> <meta http-equiv="Con ...
- (转)ThinkPHP find方法 查询一条数据记录
find() ThinkPHP find() 方法是和 select() 用法类似的一个方法,不同之处 find() 查询出来的始终只有一条数据,即系统自动加上了 LIMIT 1 限制. 当确认查询的 ...
- Android-adb相关
最近做android开发遇到无法通过usb链接设备的情况,通过wifi连接设备调试也颇为方便 1.android 要root , 下载终端app 比如 BetterTerminal 2.通过以下命令 ...
- 使用ol,添加图书销售排行榜
如果想在网页中展示有前后顺序的信息列表,怎么办呢?如,当当网上的书籍热卖排行榜,如下图所示. 这类信息展示就可以使用<ol>标签来制作有序列表来展示. 语法: <ol> < ...