回 帖 发 新 帖 刷新版面

主题:[讨论]编译出错

为什么老是提示编译错误??附源程序:
data   segment
       a db 32h
       b db 15h
       c db 2 dup(?)
data   ends
code   segment 
        assume cs: code ds: data
start   mov ax,data
        mov ds,ax
        mov al,a
        add al,b
        daa 
        mov c,al
        lahf
        and ah,01
        mov c+1,ah
        mov ah,4ch
        int 21h
code    ends
        end start
提示(14 )illegal instruction:start mov ax,data or wrong parametres
望高手指点一下。

回复列表 (共7个回复)

沙发

start:   mov ax,data

板凳

我实在是不知道你这个程序是做什么的不是过你没有定义堆栈段要知道这个是不能少的还有没有保护DOS断点你先把流程图画出来,再详细的做连个注也没有我不知道你是做什么的我是PIGTWO QQ307980907有问题可以商量


data   segment
       a db 32h
       b db 15h
       c db 2 dup(?)   ;定义数据段
data   ends
stk segment stack
 buf db dup(?)
stk ends               ;定义堆栈段
code   segment 
        assume cs: code, ds: data,ss:stk
start: push ds
       mov ax,0
       push aX         ;保护DOS断点
        mov ax,data
        mov ds,ax
        mov al,a
        add al,b
        daa         ;不懂你的算法了!!!
        mov c,al
        lahf
        and ah,01
        mov c+1,ah
        mov ah,4ch
        int 21h
    start dnep
 code ends
end

[em14][em14][em13][em14]

3 楼


data   segment
       a db 32h
       b db 15h
       c db 2 dup(?)   ;定义数据段
data   ends
stk segment stack
 buf db dup(?)
stk ends               ;定义堆栈段
code   segment 
        assume cs: code, ds: data,ss:stk
start: push ds
       mov ax,0
       push aX         ;保护DOS断点
        mov ax,data
        mov ds,ax
        mov al,a
        add al,b
        daa         ;不懂你的算法了!!!
        mov c,al
        lahf
        and ah,01
        mov c+1,ah
        mov ah,4ch
        int 21h
    start endp     ;过程结束
 code endS         ;代码段结束
enD                ;程序结束
你最好把原题的意图写来,我们共同看看好不好啊?QQ307980907[em18]

4 楼

题目:
把存储单元A和B的两个单字节压缩BCD码相加,结果保存到单元C中。
....

5 楼

     不好意思,发的急了,忘记写清楚了,实在抱歉。
对不起拉!!!!

6 楼

mov c,al
         lahf
        and ah,01
        mov c+1,ah
        mov ah,4ch
        int 21h
有必要这样写吗?
这样能输出结果的?

7 楼

mov    C,al


    ;Display the higher 4bit
    mov    al,C
    and    al,0F0H            ;clear the low 4 bit of al
    mov    cl,4
    shr    al,cl            ;al shift to right 4
    mov    dl,al

    cmp    dl,0Ah
    js    dis_num2
    add    dl,37h
    jmp    display2
dis_num2:
    add    dl,30h

display2:
    mov    ah,02
    int    21h

    ;Display the lower 4bit
    mov    al,C
    and    al,0FH            ;clear the high 4 bit of ah
    mov    dl,al

    cmp    dl,0Ah
    js    dis_num1
    add    dl,37h
    jmp    display1
dis_num1:
    add    dl,30h

display1:
    mov    ah,02
    int    21h

    mov    ah,07            ;wait a input from keyboard
    int    21h

         .....
试试!

我来回复

您尚未登录,请登录后再回复。点此登录或注册