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

一个基础问题

Donie87412 发布于 2007-12-04 22:36, 990 次点击
我写了一段输出字符串的代码,但是在要输出的字符串之前总是有很多乱码,请大家帮帮我
代码如下:
;COUNT
;*********************************************
.MODEL small
.stack 100h
;*********************************************
DATA SEGMENT
student_number       DB         0
below60              DB         ?
to6070               DB         ?
to7080               DB         ?
to8090               DB         ?
above90              DB         ?
average              Dw         ?

account      DW         60 dup(?)
;point        DB         '.'
message1     DB         'input the number of the students$'
anotherline  DB          10
message2     DB          'number  result'
DATA ends
;*********************************************
CODE SEGMENT
ASSUME CS:CODE,DS:DATA
;---------------------------------------------
begin                 proc             far
                      call             read

begin                 endp
;---------------------------------------------
;accept name
read                  proc             near
                     
                      MOV              AX,DATA
                      MOV              DS,AX
                      lea              dx,message1
                      mov              ah,09
                      int              21h
                     
                      mov              dl,anotherline
                      mov              ah,02
                      int              21h
                     
                      ;input the number of the student
                      mov              ah,0ah
                      lea              dx,student_number
                      int              21h
                      ;give the format
                      lea              dx,message2
                      mov              ah,09
                      int              21h

                      mov              dl,anotherline
                      mov              ah,02
                      int              21h
                      ;input number    result
                     

                     
                      ret
read                  endp                  
;*********************************************
CODE ends
                      end              begin
3 回复
#2
zhoulikelvjj2007-12-05 00:32
你有没有试过,把message1     DB         'input the number of the students$'
这句放到数据段第一句定义,程序就会出错。。。。很另人废解
#3
Donie874122007-12-05 12:30
试过啊,都不知道为什么,望高人指点
1