链接是出现 example1.asm : fatal error L1101: invalid Object file offset: 1 Record type: 3b
源代码;Exampleassemblylanguageprogram--adds158tonumberinmemory;Author:R.Detmer;Date1/201...
源代码
;Example assembly language program--adds 158 to number in memory
;Author: R.Detmer
;Date 1/2013
.386
.MODEL FLAT
Exitprocess PROTO NEAR32 stdcall,dwExitCode:DWORD
.STACK 4096; reserve 4096-byte stack
.DATA; reserve storage fo data
number DWORD -105
sum DWORD ?
.CODE
_start:
moveax,number;first number to EAX
addeax,158;add 158
mov sum,eax ;sum to memory
INVOKE Exitprocess,0;exit with return code 0
PUBLIC _start ;make entry point pubic
END;end of source code
大侠求解
;program to evaluate the expression-(x+y-2z+1)
;for doubleword values stored in memory,leaving the result in EAX
;author:baohuanan
;date: revised 4/2005
.386
.MODEL FLAT
ExitProcess PROTO NEAR32 stdcall,dwExitCode:DWORD
.STACK 4096 ;reserve 4096-byte stack
.DATA ;reserve storage for data
x DWORD 35
y DWORD 47
z DWORD 26
.CODE
_start:
mov eax,x ;result :=x
add eax,y ;result :=x+y
mov ebx,z ;temp :=z
add ebx,ebx ;temp :=2*z
sub eax,ebx ;result :=x+y-2*z
inc eax ;result :=x+y-2*z+1
neg eax ;result :=-(x+y-2*z+1)
INVOKE Exitprocess,0 ;exit with return code 0
PUBLIC _start ;make entry point public
END ;end of source code
上面那段代码被我误删了,这个的问题也一样。用masm611汇编 展开
;Example assembly language program--adds 158 to number in memory
;Author: R.Detmer
;Date 1/2013
.386
.MODEL FLAT
Exitprocess PROTO NEAR32 stdcall,dwExitCode:DWORD
.STACK 4096; reserve 4096-byte stack
.DATA; reserve storage fo data
number DWORD -105
sum DWORD ?
.CODE
_start:
moveax,number;first number to EAX
addeax,158;add 158
mov sum,eax ;sum to memory
INVOKE Exitprocess,0;exit with return code 0
PUBLIC _start ;make entry point pubic
END;end of source code
大侠求解
;program to evaluate the expression-(x+y-2z+1)
;for doubleword values stored in memory,leaving the result in EAX
;author:baohuanan
;date: revised 4/2005
.386
.MODEL FLAT
ExitProcess PROTO NEAR32 stdcall,dwExitCode:DWORD
.STACK 4096 ;reserve 4096-byte stack
.DATA ;reserve storage for data
x DWORD 35
y DWORD 47
z DWORD 26
.CODE
_start:
mov eax,x ;result :=x
add eax,y ;result :=x+y
mov ebx,z ;temp :=z
add ebx,ebx ;temp :=2*z
sub eax,ebx ;result :=x+y-2*z
inc eax ;result :=x+y-2*z+1
neg eax ;result :=-(x+y-2*z+1)
INVOKE Exitprocess,0 ;exit with return code 0
PUBLIC _start ;make entry point public
END ;end of source code
上面那段代码被我误删了,这个的问题也一样。用masm611汇编 展开
1个回答
展开全部
反正你帖的这段代码问题很大 比如 moveax addeax 这能编译过么
而且你这里好像是个API Exitprocess 但应该是ExitProcess 难道你这个不是大小写敏感
光代码 也不说你的编译方法 编译参数 没法回答 祝你好运
而且你这里好像是个API Exitprocess 但应该是ExitProcess 难道你这个不是大小写敏感
光代码 也不说你的编译方法 编译参数 没法回答 祝你好运
追答
一般都用 Microsoft (R) Macro Assembler Version 6.14.8444 这个版本的MASM
编译参数我建议这样
ml.exe /c /coff /Fo"a.obj" a.asm
link.exe /SUBSYSTEM:CONSOLE /OUT:"a.exe" "a.obj"
这是MASMPlus(一个汇编的IDE)里面命令行程序的编译参数 初学汇编推荐这个IDE
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询