【发布时间】:2015-11-13 19:42:46
【问题描述】:
这个程序应该将一个包含五个元素的数组与数组中每个元素的最小值和最大值进行比较。我不确定为什么当我将数组与最大数组和最小数组进行比较时会出现此错误
1>......\Users\ross\Desktop\chapter6HW.asm(97): 错误 A2032: 无效......\Users\ross\Desktop\chapter6HW.asm(99)r 指定大小
这是我的代码。我已经用** ** 标记了错误的位置。
INCLUDE Irvine32.inc
.data
str1 BYTE "Invalid",0
str2 BYTE "Valid", 0
str3 BYTE "The PIN under Validation is:",0
minArr BYTE 5,2,4,1,3
maxArr BYTE 9,5,8,4,6
arr1 BYTE 6,4,5,3,5
arr2 BYTE 1,4,5,3,5
arr3 BYTE 8,4,5,2,5
arr4 BYTE 5,4,9,2,6
.code
main PROC
call Clrscr
mov esi,OFFSET arr1
call Display
call Validate_PIN
cmp eax,0
je L1
mov edx,OFFSET str1
call WriteString
call Crlf
L1:
mov edx,OFFSET str2
call WriteString
call Crlf
call Crlf
mov esi,OFFSET arr2
call Display
call Validate_PIN
cmp eax,0
je L2
mov edx,OFFSET str1
call WriteString
call Crlf
L2:
mov edx,OFFSET str2
call WriteString
call Crlf
call Crlf
mov esi,OFFSET arr3
call Display
call Validate_PIN
cmp eax,0
je l3
mov edx,OFFSET str1
call WriteString
call Crlf
L3:
mov edx,OFFSET str2
call WriteString
call Crlf
call Crlf
mov esi,OFFSET arr4
call Display
call Validate_PIN
cmp eax,0
je L4
mov edx,OFFSET str1
call WriteString
call Crlf
L4:
mov edx,OFFSET str2
call WriteString
call Crlf
call Crlf
exit
main ENDP
Validate_PIN PROC
mov edi,0
mov ecx,5
L1:
**cmp [esi],minArr[edi]**
jb L2
**cmp [esi],maxArr[edi]**
ja L2
inc esi
inc edi
cmp edi,5
je L3
loop L1
L2:
mov eax,edi
inc eax
jmp L4
L3:
mov eax,0
L4:
ret
Validate_PIN ENDP
Display PROC
mov edx,OFFSET str3
call WriteString
mov ecx,5
L1:
mov eax,[esi]
call WriteDec
inc esi
loop L1
call Crlf
ret
Display ENDP
End main
【问题讨论】:
标签: arrays assembly x86 masm irvine32