汇编新手。。error A2070:invalid instruction operands

INCLUDEIrvine32.inc.datatableBDWORD10h,20h,30h,40h,50hRowSizeB=($-tableB)DWORD60h,70h... INCLUDE Irvine32.inc

.data
tableB DWORD 10h, 20h, 30h, 40h, 50h
RowSizeB = ($ - tableB)
DWORD 60h, 70h, 80h, 90h, 0A0h
DWORD 0B0h, 0C0h, 0D0h, 0E0h, 0F0h

tableW DWORD 10h, 20h, 30h, 40h, 50h
RowSizeW = ($ - tableW)
DWORD 60h, 70h, 80h, 90h, 0A0h
DWORD 0B0h, 0C0h, 0D0h, 0E0h, 0F0h

tableD DWORD 10h, 20h, 30h, 40h, 50h
RowSizeD = ($ - tableD)
DWORD 60h, 70h, 80h, 90h, 0A0h
DWORD 0B0h, 0C0h, 0D0h, 0E0h, 0F0h

index DWORD ?

msg1 BYTE "Enter row number: ",0
msg2 BYTE "The sum is: ",0

.code
main PROC

mov edx,OFFSET msg1 ; "Enter row number:"
call WriteString
call Readint ; EAX = row number
mov index,eax

; byte array:
push OFFSET tableB ; array offset
push RowSizeB ; row size
push TYPE BYTE ; array type
push index ; row index
call calc_row_sum ; EAX = sum

mov edx,OFFSET msg2 ; "The sum is:"
call WriteString
call WriteHex ; write sum in EAX
call Crlf

; word array:
push OFFSET tableW ; array offset
push RowSizeW ; row size
push TYPE WORD ; array type
push index ; row index
call calc_row_sum ; EAX = sum

mov edx,OFFSET msg2 ; "The sum is:"
call WriteString
call WriteHex ; write sum in EAX
call Crlf

; doubleword array:
push OFFSET tableD ; array offset
push RowSizeD ; row size
push TYPE DWORD ; array type
push index ; row index
call calc_row_sum ; EAX = sum

mov edx,OFFSET msg2 ; "The sum is:"
call WriteString
call WriteHex ; write sum in EAX
call Crlf

exit
main ENDP

;------------------------------------------------------------
calc_row_sum PROC
;
; Calculates the sum of a row in a two-dimensional table
; of any type.
; Receives: array offset, row size in bytes, array type, row index.
; Returns: EAX = sum.
;------------------------------------------------------------

_arrayOffset EQU DWORD PTR [ebp+20]
_rowSize EQU DWORD PTR [ebp+16]
_arrayType EQU DWORD PTR [ebp+12]
_rowindex EQU DWORD PTR [ebp+8]

push ebp
mov ebp,esp

mov eax,_rowIndex
mul DWORD PTR _rowSize
mov ebx,_arrayOffset
add ebx,eax ; row offset

; Convert row size to a loop counter.
mov ecx,_rowSize
.IF _arrayType == 2
shr ecx, 1
.ELSEIF _arrayType == 4
shr ecx, 2
.ENDIF

mov eax,0 ; accumulator
mov esi,0 ; column index

; Loop through the columns.
L1:
.IF _arrayType == 1

movzx edx,BYTE PTR[ebx + esi] ; get a byte

.ELSEIF _arrayType == 2

movzx edx,WORD PTR[ebx + esi*2] ; get a word

.ELSEIF _arrayType == 4

mov edx,DWORD PTR[ebx + esi*4] ; get a doubleword

.ENDIF

add eax,edx ; add to accumulator
inc esi ; next value in row
loop L1

pop ebp
ret 16
calc_row_sum ENDP

END main

为什么push RowSizeB,push RowSizeW,push RowSizeD都是invalid instruction operands呢?~
展开
 我来答
gjcn1234
2011-05-28 · TA获得超过133个赞
知道答主
回答量:75
采纳率:0%
帮助的人:0
展开全部
RowSizeB = ($ - tableB)
...
push RowSizeB
这种语句在 RadASM 上是可以通过编译的

;-------------------------------------------
另外:
建议在 calc_row_sum 子程序中,让编译器自动平衡堆栈(与您的问题无关,只是建议)
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
士枋苓gx
2011-05-31
知道答主
回答量:6
采纳率:0%
帮助的人:0
展开全部
这个。。是不是汇编器的问题啊
本回答被提问者采纳
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
收起 1条折叠回答
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式