invalid use of register?

liztac 2009-04-22 07:53:04
TITLE
;store A*B random char(41h-5ah) in ArrayAB
;then display them
INCLUDE c:\irvine\irvine32.inc

.data
A=20
B=11
ArrayAB byte A dup(B dup(0))

;iterate A times,in every A iterate that iterate B times
;to create a array,first B-1 generate random char then leave
;the orignal 0 to make a array
.code
main proc
call randomize
;record B iterate
mov edx,B
mov ecx,A*B
mov esi,0
L:
;when edx=0 a B array is filled with random char
;then jump to the 0
dec edx
cmp edx,0
jz Next
mov eax,1aH
call randomrange
add eax,41H
mov al,byte ptr eax
mov ArrayAB[esi],al
jmp Outentrance
Next:
mov edx,11
Outentrance:
inc esi
Loop L

mov edx,offset ArrayAB
call writestring

exit
main endp
end main




1>------ 已启动生成: 项目: masmtest, 配置: Debug Win32 ------
1>Assembling...
1> Assembling: f:\MyDocument\Document2.asm
1>f:\MyDocument\Document2.asm(30) : error A2032: invalid use of register
1>Project : error PRJ0019: 工具从"Assembling..."
1>生成日志保存在“file://e:\正在学习\VisualStudio2005\masmtest\Debug\BuildLog.htm”
1>masmtest - 2 个错误,0 个警告
========== 生成: 0 已成功, 1 已失败, 0 最新, 0 已跳过 ==========
...全文
524 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
lmxd70 2009-04-22
  • 打赏
  • 举报
回复
mov al,byte ptr eax 这句有问题。如果你想访问eax中数据指向的地址,改成 mov al,byte ptr [eax]试试,如果想把eax中的数放入al,那得根据数值的长度做一下处理

21,459

社区成员

发帖
与我相关
我的任务
社区描述
汇编语言(Assembly Language)是任何一种用于电子计算机、微处理器、微控制器或其他可编程器件的低级语言,亦称为符号语言。
社区管理员
  • 汇编语言
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧