invalid instruction operands

LDQ777 2014-12-30 05:27:56
_STACK SEGMENT STACK 'STACK'
DB 1000 DUP(0)
TOS DW 0
_STACK ENDS
.386
_DATA SEGMENT
NUM DD ?
Buf DB 11,?,10 DUP (?)
_DATA ENDS
_TEXT SEGMENT 'CODE'
ASSUME CS:_TEXT,DS:_DATA,SS:_STACK
START: MOV AX,_DATA
MOV DS,AX
CLI
MOV AX,_STACK
MOV SS,AX
MOV SP,Offset TOS
STI
MOV DX,Offset Buf ; 出错啦
MOV AH,0AH
INT 21H
SUB ECX,ECX
SUB EAX,EAX
MOV EBX,10
Rep1b: MUL EBX
MOVZX EDX,Byte Ptr Buf [ECX] [2]
SUB DL,'0'
ADD EAX,EDX
INC CX
Rep1?: CMP CL,Buf [1]
JNGE Rep1b
EndRep1: MOV NUM,EAX
MOV DL,10
MOV AH,2
INT 21H
MOV CX,8
Rep2b: ROL NUM,4
MOV EDX,NUM
AND DL,0FH
CMP DL,9
JG Else1
Then1: ADD DL,'0'
JMP Endif1
Else1: ADD DL,'A'-10
Endif1: MOV AH,2
INT 21H
Rep2?: LOOP Rep2b
EndRep2: MOV AX,4C00H
INT 21H
_TEXT ENDS
END START
刚刚学汇编,感觉很糊涂,书上的是DX,然后提示类型必须相同,我改成DL之后就提示invalid instruction operands这个了。然后我在网上看有的说加上WORD PTR (BYTE PTR),可是我不管加哪个都还是不对,到底为什么错了呀
...全文
769 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
LDQ777 2014-12-30
  • 打赏
  • 举报
回复
引用 3 楼 a1193561652 的回复:
我是用的masm5.0,真的没问题呀(我以智商担保,我没有复制错),你也用masm试试吧。 另外你说的有问题的地方我也没看出有什么问题,感觉是对的呀。
其实我也觉得没问题,对照了之前写的几个程序都差不多,不过就是现实出错,可能是我系统有问题吧,谢谢啦
纵横车 2014-12-30
  • 打赏
  • 举报
回复

我是用的masm5.0,真的没问题呀(我以智商担保,我没有复制错),你也用masm试试吧。
另外你说的有问题的地方我也没看出有什么问题,感觉是对的呀。
LDQ777 2014-12-30
  • 打赏
  • 举报
回复
引用 1 楼 a1193561652 的回复:
刚刚直接复制了一遍去编译,没提示有错误呀。
我复制了一遍然后编译就提示了1212.asm(19):error A2022:instruction operands must be the same size 我就是按照老师说的在cmd里面转到masm文件后ml /c /omf 1212.asm这样子的
纵横车 2014-12-30
  • 打赏
  • 举报
回复
刚刚直接复制了一遍去编译,没提示有错误呀。
MSL 即 Microsoft Library 是 DOS 版的 "WinHelp",也就是现代版 Help Viewer 的始祖。 安装目录下有个 ini 文件,用来指定图书的路径,它即是目录。 文件来源自 http://wdl2.winworldpc.com/Abandonware%20SDKs/Microsoft Programmer's Library 1.3.7z Microsoft Programmer's Library 1.3.iso 这就是 DOS 版的 MSDN!使用 DOSBOX 就可以运行此库。此库含一大古董级MS官方编程参考材料,主要针对 Windows 3.0 平台,真可谓之应用尽有: MS Windows 3.0 SDK Guide to Programming MS Windows 3.0 SDK Install. & Update Guide MS Windows 3.0 SDK Programmer's Reference Vol. 1 MS Windows 3.0 SDK Programmer's Reference Vol. 2 MS Windows 3.0 SDK Tools MS Windows 3.0 SDK Articles All MS Windows 3.0 SDK Manuals MS Windows 3.0 DDK Install. & Update Guide MS Windows 3.0 DDK Adaptation Guide MS Windows 3.0 DDK Virtual Device Adapt. Guide MS Windows 3.0 DDK Printer & Font Kit All MS Windows 3.0 DDK Manuals MS Online User's Guide Programming MS Windows MS Windows Sample Code MS KnowledgeBase - MS Windows 以及 Options => Library 菜单下提供的 9 个重要的参考资料,其中就有 C 和 MASM 这些重要的参考资料。这些是已安装的目录部分,鉴于 MASM 的重要性,特将其添加到压缩包内,免CD运行: Windows References OS/S References Network References MS-DOS References MS Systems Journal Hardware References C References MASM References BASIC References Pascal References FORTUAN References 其中 C References 和 MASM References 包含: Installing and Using MS MASM 6.0 MS MASM 6.0 Reference MS MASM 6.0 Programmer's Guide MS MASM 6.0 White Paper QuickAssembler 2.01 Programmer's Guide MS Mixed-Language Programming Guide CodeView & Utilities User's Guide MS Editor User's Guide MS OnLine User's Guide MASM Sample Code MS KnowledgeBase - MASM MS C 6.0 Advanced Programming Techniques MS C 6.0 Installing and Using the P.D.S. MS C 6.0 Reference MS C 6.0 Run-Time Library Reference MS C 6.0 Developer's Toolkit Reference QuickC 2.5 Tool Kit QuickC 2.5 C for Yourself QuickC 2.5 Up and Running QuickC 2.5 Update MS Professional
You are visitor as of October 17, 1996.The Art of Assembly Language ProgrammingForward Why Would Anyone Learn This Stuff?1 What's Wrong With Assembly Language2 What's Right With Assembly Language?3 Organization of This Text and Pedagogical Concerns4 Obtaining Program Source Listings and Other Materials in This TextSection One: Machine OrganizationArt of Assembly Language: Chapter OneChapter One - Data Representation1.0 - Chapter Overview1.1 - Numbering Systems1.1.1 - A Review of the Decimal System1.1.2 - The Binary Numbering System1.1.3 - Binary Formats1.2 - Data Organization1.2.1 - Bits1.2.2 - Nibbles1.2.3 - Bytes1.2.4 - Words1.2.5 - Double Words1.3 - The Hexadecimal Numbering System1.4 - Arithmetic Operations on Binary and Hexadecimal Numbers1.5 - Logical Operations on Bits1.6 - Logical Operations on Binary Numbers and Bit Strings1.7 - Signed and Unsigned Numbers1.8 - Sign and Zero Extension1.9 - Shifts and Rotates1.10 - Bit Fields and Packed Data1.11 - The ASCII Character Set1.12 Summary1.13 Laboratory Exercises1.13.1 Installing the Software1.13.2 Data Conversion Exercises1.13.3 Logical Operations Exercises1.13.4 Sign and Zero Extension Exercises1.13.5 Packed Data Exercises1.14 Questions1.15 Programming ProjectsChapter Two - Boolean Algebra2.0 - Chapter Overview2.1 - Boolean Algebra2.2 - Boolean Functions and Truth Tables2.3 - Algebraic Manipulation of Boolean Expressions2.4 - Canonical Forms2.5 - Simplification of Boolean Functions2.6 - What Does This Have To Do With Computers, Anyway?2.6.1 - Correspondence Between Electronic Circuits and Boolean Functions2.6.2 - Combinatorial Circuits2.6.3 - Sequential and Clocked Logic2.7 - Okay, What Does It Have To Do With Programming, Then?2.8 - Generic Boolean Functions2.9 Laboratory Exercises<

21,458

社区成员

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

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