字符串倒置
摘要:include irvine32.inc.dataa byte "abhgfu s women"b byte sizeof a dup(0).codemain proc;打印出字符串;mov edx,offset acall writestringcall crlfmov esi,offset amov edi,offset bmov ecx,(sizeof a)add esi,(sizeof a)-1mov eax,0L1: mov al, byte ptr [esi] mov [edi], eax inc edi dec esi LOOP L1mov edx ,offs
阅读全文
posted @
2013-02-25 19:18
叶城宇
阅读(173)
推荐(0)
数组求和
摘要:include irvine32.inc.dataarray dword 10000h,20000h,30000h,20000h,10000hthesum dword ?.codearraysum proc push esipush ecxmov eax,0L1: add eax,[esi] add esi,type dword LOOP L1 pop ecx pop esi retarraysum endp main proc mov esi,offset array mov ecx,lengthof array call arraysum mov thesum,eax call wri..
阅读全文
posted @
2013-02-25 19:17
叶城宇
阅读(136)
推荐(0)
数组的输出
摘要:include irvine32.inc.datai dword 1,2,34,5,6,7,8,9,0,11.codemain procmov ecx,0;mov esi,offset imov ecx,lengthof i;;mov eax,ecx;;call writeint;call crlfmov ebx,dword;call dumpmem;exitmain endpend main
阅读全文
posted @
2013-02-25 19:16
叶城宇
阅读(167)
推荐(0)
日期
摘要:include irvine32.incstandard=2000;.dataday word 15;month word 5;year word 2012;ymd word ?.codemain procmov eax,0;mov ebx,0;mov ax,year;sub ax,standard;shl ax,9;mov bx,month;shl bx,5;add ax ,bx;add ax,day;mov ymd,ax;call writebin;exitmain endpend main
阅读全文
posted @
2013-02-25 19:15
叶城宇
阅读(109)
推荐(0)
时间
摘要:include irvine32.inc.datatime word 0101011000111001bhh word ?mmm word ?sss word ?.codemain procmov eax,0;mov ax,time;shr ax,11;mov hh,ax;call writedec;mov al,':'call writechar;mov ax,time;shr ax,5;and ax,111111b;mov mmm,ax;call writedec;mov al,':'call writechar;mov ax,time;and ax,111
阅读全文
posted @
2013-02-25 19:14
叶城宇
阅读(100)
推荐(0)
临时变量
摘要:include irvine32.inc.datastr1 byte "赋值后的结果:",0;.codemain proccall swap;;mov ebx,offset str1;;call writestring;exitmain endpswap procpush ebp;mov ebp,esp;sub esp,32;mov ecx,29;mov eax,ebp;L1: mov byte ptr [eax-32],'@'; inc eax; loop L1; mov byte ptr[eax-32],0 mov edx,offset str1; ca
阅读全文
posted @
2013-02-25 19:13
叶城宇
阅读(204)
推荐(0)
两个数交换
摘要:include irvine32.incchang proto ,v1:ptr dword,v2: ptr dword.datai dword ?j dword ?str1 byte "交换前的是:",0;str2 byte "交换后的结果:",0;.codemain proccall readintmov i,eax;call readintmov j,eax;mov edx,offset str1call writestring;mov eax,i;call writeint;mov al,','call writecharmov e
阅读全文
posted @
2013-02-25 19:12
叶城宇
阅读(131)
推荐(0)
参数传值(数组赋值)
摘要:include irvine32.incsub2 proto a:ptr dword,l1:dword.datai dword 10 dup(?);str1 byte "开始初始化的值:",0;.codemain procmov edx,offset str1;call writestringinvoke sub2 ,offset i,lengthof i;call crlf;mov esi,offset i;mov ecx,lengthof i;mov ebx,dword;call dumpmem;exitmain endpsub2 proc, a:PTR dword,
阅读全文
posted @
2013-02-25 19:11
叶城宇
阅读(258)
推荐(0)
while循环
摘要:include irvine32.inc.datai dword 8j dword 29x dword 0.codemain proc mov eax,0L: cmp i,10 jl L1 cmp j,15 jng next ;call writeint ;call crlfL1: inc i dec j inc x LOOP Lnext:mov eax,xcall writeintexitmain endpend main
阅读全文
posted @
2013-02-25 19:09
叶城宇
阅读(152)
推荐(0)
简单语法
摘要:;功能:查找32位之间的赋值语句是否有语法错误,如果没有就输出,如果有就输出错误;;为了减少情况判断;特意规定mov后面的第一个参数必须为寄存器。;赋值语句中32位赋值和16位、8位等情况的赋值语法完全相同,;所以这里只判断32位赋值的情况,并且假设这里的内存操作数一定是写对的;用str1来存储要判断的语句,用str2来存储内存操作数的类型。include irvine32.inc.datai dword 1;c1 byte "改语法不正确:",0;c2 byte "相等",0;c3 byte "该语法正确",0;c4 byte &q
阅读全文
posted @
2013-02-25 19:08
叶城宇
阅读(163)
推荐(0)
移位指令实现乘法
摘要:include irvine32.inc;.datai dword 0;sum qword 0;str1 byte "请输入16进制的(32位整数)乘数和被乘数",0str2 byte "乘积为:",0;j dword 0;.codemain procL1: mov edx,offset str1; call writestring; mov j,0; mov eax,0;eax为(低32位)乘积值; mov ebx,0;edx为(低32位)乘积值的中间值 mov edx,0; mov esi,0;dsi为(高32位)乘积值的中间值 mov edi,0;
阅读全文
posted @
2013-02-25 19:07
叶城宇
阅读(532)
推荐(0)
斐波那序列求值
摘要:include irvine32.inc.datastr1 byte "请输入所要的斐波那序列的位置:",0;str2 byte "斐波那序列的结果为:",0;str3 byte "斐波那序列的最大值为N=",0;i dword 2;var1 dword 3 dup(1,0,0);var2 dword 3 dup(1,0,0);.codemain proc mov ecx,0; mov eax,0;L1: mov var1,1; mov dword ptr var1+4,0; mov dword ptr var1+8,0; mov v
阅读全文
posted @
2013-02-25 19:06
叶城宇
阅读(225)
推荐(0)
大整数与2的N次方相乘
摘要:include irvine32.inc.datavar1 dword 4 dup(0,0,0,0);str1 byte "请用16进制输入一个大整数(最高位为96位)",0;str2 byte "结果为:",0;str3 byte "请输入2的次方数(十进制--不能超过31):",0;i dword 0;j dword 0;str4 byte "输入的绝对值为:",0.codemain procL4: mov dword ptr var1+12,0; mov j,0;正负数的标志;0为正数,1为负数; mov e
阅读全文
posted @
2013-02-25 19:03
叶城宇
阅读(291)
推荐(0)