注册 登录
编程论坛 汇编论坛

救解 新手学汇编 关于array

超级菜鸟手 发布于 2012-10-24 21:05, 750 次点击
INCLUDE Irvine32.inc
 .data
 HELLO dword 0,0,0,0,0,0
 str1 BYTE "Enter Integer: ",0
 totalODD dword ?
 str2 BYTE "TotalODD is   : ",0
 totalEVEN dword ?
 str3 BYTE "TotalEVEN is  : ",0

 .code
 main PROC

 mov edi,OFFSET HELLO
 mov ecx,LENGTHOF HELLO

 mov edx,OFFSET str1
 call writestring
 call readint
 mov HELLO[0],eax

 mov edx,OFFSET str1
 call writestring
 call readint
 mov HELLO[1],eax

 mov edx,OFFSET str1
 call writestring
 call readint
 mov HELLO[2],eax

 mov edx,OFFSET str1
 call writestring
 call readint
 mov HELLO[3],eax

 mov edx,OFFSET str1
 call writestring
 call readint
 mov HELLO[4],eax

 mov edx,OFFSET str1
 call writestring
 call readint
 mov HELLO[5],eax

 mov eax,0
 L1:
 add eax,[edi]
 add edi ,TYPE HELLO
 loop L1

 call writeint
 call crlf
 exit
 main endp
 end main

我想要吧HELLO的value 全部加起来
但是 却得到其他的答案
有哪位大大 能帮我解吗
6 回复
#2
有容就大2012-10-24 21:38
哇 用头文件的32位汇编 呵呵 不太会 坐等大牛来
#3
超级菜鸟手2012-10-24 21:43
呵呵 在学中 ~
#4
超级菜鸟手2012-10-24 21:49
我想 把第一 第三 第五 的value 用loop加起来

请各位 大大赐教 。。。
#5
超级菜鸟手2012-10-25 09:20
已解决了

INCLUDE Irvine32.inc
 .data
 HELLO dword 0,0,0,0,0,0
 str1 BYTE "Enter Integer : ",0
 totalODD dword ?
 str2 BYTE "TotalODD is   : ",0
 totalEVEN dword ?
 str3 BYTE "TotalEVEN is  : ",0

 .code
 main PROC

 mov esi,OFFSET HELLO
 mov ecx,LENGTHOF HELLO

 L1:
     mov edx,OFFSET str1
     call writestring
     call readint
     mov [esi],eax
     add esi,4
     call crlf
     LOOP L1

 sub esi, 24
 mov ecx, 3
 mov eax, 0
 CountODD :
         add eax,[esi]
         add esi,8
         loop CountODD
         mov TotalODD,eax

 sub esi, 20
 mov ecx, 3
 mov eax, 0
 CountEVEN :
         add eax,[esi]
         add esi,8
         loop CountEVEN
         mov TotalEVEN,eax

 mov edx ,OFFSET str2
 call WriteString
 mov eax, TotalODD
 call WriteDec
 call crlf

 mov edx ,OFFSET str3
 call WriteString
 mov eax, TotalEVEN
 call WriteDec
 call crlf
 call crlf

 exit
 main endp
 end main

#6
青春无限2012-10-25 10:35
厉害
#7
zklhp2012-10-25 10:47
如果有好的输入输出方法 直接学32位汇编也不是不可以
1