nasm astrcspn函数 x86
xxx.asm
%define p1 ebp+8
%define p2 ebp+12
%define p3 ebp+16
section .text
global dllmain
export astrcspn
dllmain:
mov eax,1
ret 12
;---------------------------------------------------;
; 返回属于一组字符的字符在字符串中第一次出现的索引
;---------------------------------------------------;
astrcspn:
push ebp
mov ebp,esp
sub esp,8
mov edx,[p1] ; char ptr 1
mov ecx,[p2] ; char ptr 2
xor eax,eax
; 保存str2指针,和ebx寄存器
mov [ebp-4],ecx
mov [ebp-8],ebx
;-------------------------------------;
; 遍历 str1
;-------------------------------------;
.forStr1:
mov bh,[edx]
test bh,bh
jz .return
;-------------------------------------;
; 遍历str2,如果相等退出函数
;-------------------------------------;
.forStr2:
mov bl,[ecx]
test bl,bl
jz .forbreak
cmp bh,bl
je .return
inc ecx
jmp .forStr2
.forbreak:
mov ecx,[ebp-4]
inc edx
inc eax
jmp .forStr1
;-------------------------------------;
; 恢复ebx寄存器,恢复堆栈
;-------------------------------------;
.return:
mov ebx,[ebp-8]
add esp,8
mov esp,ebp
pop ebp
ret 8
c++:
#include <iostream>
#include <Windows.h>
typedef size_t (CALLBACK* astrcspn_t)(const char* str1, const char* str2);
astrcspn_t astrcspn;
int main()
{
HMODULE myDLL = LoadLibraryA("xxx.dll");
astrcspn = (astrcspn_t)GetProcAddress(myDLL, "astrcspn");
const char* str1 = "fcba73";
const char* str2 = "1234567890";
printf("%d\n", strcspn(str1, str2)); // 4
printf("%d\n", astrcspn(str1, str2)); // 4
return 0;
}
nasm astrcspn函数 x86的更多相关文章
- nasm astrspn函数 x86
xxx.asm %define p1 ebp+8 %define p2 ebp+12 %define p3 ebp+16 section .text global dllmain export ast ...
- nasm astrchr函数 x86
xxx.asm: %define p1 ebp+8 %define p2 ebp+12 %define p3 ebp+16 section .text global dllmain export as ...
- nasm astrlen函数 x86
xxx.asm %define p1 ebp+8 %define p2 ebp+12 %define p3 ebp+16 section .text global dllmain export ast ...
- nasm aat函数 x86
xxx.asm: %define p1 ebp+8 %define p2 ebp+12 %define p3 ebp+16 section .text global dllmain dllmain: ...
- nasm astrstr函数 x86
xxx.asm: %define p1 ebp+8 %define p2 ebp+12 %define p3 ebp+16 section .text global dllmain export as ...
- nasm astrset_s函数 x86
xxx.asm %define p1 ebp+8 %define p2 ebp+12 %define p3 ebp+16 section .text global dllmain export ast ...
- nasm astrrev函数 x86
xxx.asm %define p1 ebp+8 %define p2 ebp+12 %define p3 ebp+16 section .text global dllmain export ast ...
- nasm astrrchr函数 x86
xxx.asm %define p1 ebp+8 %define p2 ebp+12 %define p3 ebp+16 section .text global dllmain export ast ...
- nasm astrncmp函数 x86
xxx.asm: %define p1 ebp+8 %define p2 ebp+12 %define p3 ebp+16 section .text global dllmain export as ...
随机推荐
- 类型检查 Type Checking 一些编程语言并不安全 类型化语言的优点 定型环境 (符号表) 断言的种类
Compiler http://staff.ustc.edu.cn/~bjhua/courses/compiler/2014/ http://staff.ustc.edu.cn/~bjhua/cour ...
- centos7+python+selenium+chrome
1.安装chrome yum install google-chrome 2.安装chromedriver所有版本的下载地址:https://sites.google.com/a/chromium.o ...
- SpringMVC听课笔记(九:数据转换 & 数据格式化 & 数据校验)
1.数据绑定流程 --1). Spring MVC主框架将ServletRequest对象及目标方法入参实例传递给WebDataBinderFactory实例,以创建DataBinder实例对象. - ...
- OutOfMemoryError系列
OutOfMemoryError系列 1.[OutOfMemoryError系列(1): Java heap space](https://blog.csdn.net/renfufei/article ...
- owncloud搭建
使用OwnCloud建立属于自己私有的云存储网盘 OwnCloud概述: OwnCloud 一款文件主机服务软件,就是我们平时使用的云存储,不过这是在自己主机的服务器上建立属于自己的私有云,OwnCl ...
- 关于POI相关通用方法源码
设置宽度,1个汉字的宽度 导入excel用,返回行数 sheetName是sheet,显示名 导出excel 导出excel 获得excel数据 写输出,最后用 重新单元格指定位置 移到下一行,列开头 ...
- C语言--指针数组大小
#include <stdio.h> #include <string.h> int main(void) { char *str[3]={ "Hello,thisi ...
- DedeCMS程序使用拼音首字母做栏目名称的方法
Dedecms织梦程序默认使用拼音为保存目录的时候使用的是中文全拼,当遇到栏目名称比较长的时候目录名称看起来有点冗长,这时候大多数站长喜欢使用拼音首字母作为栏目的保存目录,那么就需要修改 dede/c ...
- Java中finalize()方法的作用
finalize方法是Object提供的的实例方法,使用规则如下: 当对象不再被任何对象引用时,GC会调用该对象的finalize()方法 finalize()是Object的方法,子类可以覆盖这个方 ...
- P2801 教主的魔法 (分块)
题目传送 长度为\(n(n\le 1000000)\)的数组,\(q(q\le 3000)\) 次操作.修改操作即将某个区间的值增加某个不大于1000的值,查询操作即查询某个区间比C大于等于的数有多少 ...