注册 登录
编程论坛 汇编论坛

masm报错A2004而且问题很严重。

btx_0607 发布于 2012-03-12 09:14, 972 次点击
assume cs:code,ds:data,ss:stack

data segment
db '1.display       '
db '2.brows         '
db '3.replace       '
db '4.modify        '
data ends

stack segment
dw 0,0,0,0,0,0,0,0
stack ends


code segment

start:  mov ax,data
    mov ds,ax
    mov ax,stack
    mov ss,ax
    mov sp,16
    mov bx,0
    mov si,0
    mov cx,4
s:     push cx
    mov cx,4
s1:     mov al,2[bx+si]
    and al,11011111b
    inc si
    loop s1
    add bx,16
    pop cx
    loop s
code ends
end start
在mov ax,stack 和mov ax,data 这两行报错,不知道怎么解决。
12 回复
#2
btx_06072012-03-12 09:39
自己做沙发。
#3
zaixuexi2012-03-12 09:40
我怎么就没问题
#4
btx_06072012-03-12 09:47
难道是我masm配置的问题?
#5
zklhp2012-03-12 09:49
在mov ax,stack 和mov ax,data 这两行报错,不知道怎么解决。

mov ax,seg stack

mov ax,seg data

这样要是再有错应该是错误的版本或者错误的参数

按理你的写法是正确的。。
#6
zklhp2012-03-12 09:50
我顺手百度了一下发现csdn有同样的问题 应该是同一个人问的 不知道他们那边回答怎么样 呵呵
#7
btx_06072012-03-12 10:11
我刚刚问的,呵呵,又发现一个错error A4910: cannot open file: E:\masm32\bin\ml.err
刚安装的masm32为什么会找不到ml.err文件呢?
#8
zklhp2012-03-12 10:15
我的也这样。。。 不知道原因

正因为这样所以出不了错误提示

不过 你是用masm32编译上面的程序么 那参数得变 不知道你咋写的参数


[ 本帖最后由 zklhp 于 2012-3-12 10:28 编辑 ]
#9
btx_06072012-03-12 10:18
原版复制的。。。第一次用的是Radasm,换成Masm32参数没变,不知道咋变啊,没接触过masm32这个东西啊,求指教。
#10
btx_06072012-03-12 10:19
加上seg 还是那个错误。
#11
zklhp2012-03-12 10:25
看来你没明白我的意思 你上面的是16位程序 masm32带的编译器是32位编译器

用masm32里的编译器也就是ml编译16位程序要

ml.exe /Zm /c a.asm
link.exe a.obj

而且link可能还要用16位的才行

如果你非要用这个 建议用IDE 比如masmplus 完美解决这个问题

如果你想用命令行 呵呵 那你得能明白上面我帖的命令的用法才行。。。


[ 本帖最后由 zklhp 于 2012-3-12 10:30 编辑 ]
#12
btx_06072012-03-12 10:40
知道错了,官方回答
you are trying to assemble and link a 16-bit program with a 32-bit assembler/linker
actually - the assembler should be ok - it is the linker that cannot handle 16-bit code
at the end of the sub-forum list is one for 16-bit programming
search that subforum
there are 16-bit linker downloads, as well as batch files to perform assembly and linking
there are also a number of 16-bit program examples
you do not have to declare all those segments - there are shortcuts   

then, the data segment is best refered to as @DATA
#13
btx_06072012-03-12 10:41
呵呵,谢谢,知道了
1