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 ...
随机推荐
- RPM 和YUM总结
RPM RPM命名: 安装 rpm -ihv 其他常用的选项: 1. 重新安装 --replacepkgs (或者 --force ) 2. 不考虑依赖 --nodeps (不推荐) 升级: 查询: ...
- 洛谷P3413 P6754
双倍经验题 由于我先做的 P6754,所以一切思路基于 P6754 的题目 " P6754 这题就是 P3413 的究极弱化版 " --By Aliemo. P6754 Descr ...
- yum安装docker-ce-18.03.0
yum install -y yum-utils device-mapper-persistent-data lvm2 yum-config-manager --add-repo http://mir ...
- 浅谈Winform控件开发(一):使用GDI+美化基础窗口
写在前面: 本系列随笔将作为我对于winform控件开发的心得总结,方便对一些读者在GDI+.winform等技术方面进行一个入门级的讲解,抛砖引玉. 别问为什么不用WPF,为什么不用QT.问就是懒, ...
- 理解了这三点,才敢说自己会写Python代码
某同学应聘Python岗位被录用.上班第一天,Leader吩咐他写一个获取次日日期信息的函数.该同学信心满满地写下了这样一段代码, 然后就没有然后了. import time def get_next ...
- 2019牛客暑期多校训练营(第八场)A.All-one Matrices(dp)
题意:又是最大01矩阵的模型了 这次要找的是极大0/1矩阵的个数 思路:我们像处理最大01矩阵那样处理一下边界 由于我们上左右已经无法再继续扩展 我们只需要用前缀和记录一下是否可以向下扩展(即判断当前 ...
- Educational Codeforces Round 97 (Rated for Div. 2)【ABCD】
比赛链接:https://codeforces.com/contest/1437 A. Marketing Scheme 题解 令 \(l = \frac{a}{2}\),那么如果 \(r < ...
- P4254 [JSOI2008]Blue Mary开公司 (李超树)
题意:插入一些一次函数线段 每次询问在x = x0处这些线段的最大值 题解:李超树模版题 维护优势线段 注意这题的输入是x=1时的b #include <iostream> #includ ...
- 男孩周末班-k8s-架构图
k8s-三层网络结构图 k8s-核心组件原理图 k8s-服务架构图 k8s-部署架构 小结 RBAC 用户账户: 角色: role(普通角色),只能运行在特定名称空间下 clusterrole,对集群 ...
- Operating System:信号量
pv原语操作(1)操作系统PV意思:PV操作与信号量的处理相关,P表示通过的意度思,V表示释放的意思.(2)p操作和v操作是不可中断问的程序段,称为原语.如果将信号量看作共享变量,则pv操作为其临界区 ...