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 ...
随机推荐
- CF570B
题意转化: 一条长为n的路,路上有一点m,问你在什么地方再设一点a可以使路上任意一点到点a的概率大于到点m的概率 所谓概率更大,也就是说从离点m更远的一端到点a的长度小于到点m的长度 (因为此长度内所 ...
- SpringMVC听课笔记(SpringMVC 表单标签 & 处理静态资源)
1.springmvc表单标签,可以快速开发,表单回显,但是感触不深 2.静态资源的获取,主要是要配置这个
- Java——接口、匿名类
接口语法 public interface Demolnteface{ public void demo(): //其他方法 //所有方法都是抽象的 } 接口里放: 1.静态常量 (一般全部大写) 2 ...
- SparkStreaming直连方式读取kafka数据,使用MySQL保存偏移量
SparkStreaming直连方式读取kafka数据,使用MySQL保存偏移量 1. ScalikeJDBC 2.配置文件 3.导入依赖的jar包 4.源码测试 通过MySQL保存kafka的偏移量 ...
- Kubernetes --(k8s)yml 文件
认识yml文件 yaml文件语法 大小写敏感 使用缩进表示层级关系 缩进时不允许使用Tab键,只允许使用空格. 缩进的空格数目不重要,只要相同层级的元素左侧对齐即可 # 表示注释,从这个字符一直到行尾 ...
- 4. Linux工作目录切换和文本文件编辑命令
1.pwd:显示用户当前所处的工作目录 举例:[root@Centos ~]# pwd /root 2.cd:切换工作路径 "cd -"命令返回到上一次所处的目录 " ...
- XV6学习(10)锁
在包括XV6的绝大部分操作系统都是多个任务交错执行的.交错的一个原因是多核硬件:多核计算机的多个CPU核心独立执行计算,如XV6的RISC-V处理器.多个CPU核心共享物理内存,XV6利用这种共享来维 ...
- 一文弄懂-BIO,NIO,AIO
目录 一文弄懂-BIO,NIO,AIO 1. BIO: 同步阻塞IO模型 2. NIO: 同步非阻塞IO模型(多路复用) 3.Epoll函数详解 4.Redis线程模型 5. AIO: 异步非阻塞IO ...
- Codeforces Round #594 (Div. 2) D1 - The World Is Just a Programming Task
思路:枚举换的位置i,j 然后我们要先判断改序列能否完全匹配 如果可以 那我们就需要把差值最大的位置换过来 然后直接判断就行
- AtCoder Beginner Contest 169
比赛链接:https://atcoder.jp/contests/abc169/tasks A - Multiplication 1 #include <bits/stdc++.h> us ...