为什么我们在消息 DB 10,13, 'foo $' 中使用 10,13? [英] Why do we use 10,13 in message DB 10,13, 'foo $'?

查看:131
本文介绍了为什么我们在消息 DB 10,13, 'foo $' 中使用 10,13?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是8086微处理器用汇编语言编写的代码.此代码确定数字是正数还是负数.我理解代码,但看不懂代码的第 4 行和第 5 行.

Here is the Code written on assembly language for 8086 microprocessor.This code find if the number is positive or negative. I understand the code but can not understand the 4th and 5th line of that code.

       ;FIND A NUMBER THAT WAS POSITIVE OR NEGETIVE 
       DATA SEGMENT 
       X DW 28H
       MSG1 DB 10,13, 'NUMBER IS POSITIVE $'
       MSG2 DB 10,13, 'NUMBER IS NEGETIVE $' 
       DATA ENDS 

       CODE SEGMENT
       ASSUME CS:CODE, DS:DATA
       START: 
       MOV AX, DATA
       MOV DS, AX
       MOV AX, X 
       ROL AL, 01H
       JC NEGA
       LEA DX, MSG1
       JMP LAST

       NEGA:
        LEA DX, MSG2

        LAST:
            MOV AH, 09H
            INT 21H
            MOV AH,4CH
            INT 21H 


       CODE ENDS
   END START

为什么他们在第 4 行和第 5 行的 MSG1 DB 之后使用 10,13?

Why they use 10,13 after MSG1 DB in the 4th and 5th line ?

推荐答案

As Internal Server Error 的注释表明 10 是换行的 ASCII 控制代码,而 13 是回车代码.换行控制代码将光标移动到下一行,而回车代码将光标移动到行首.两个控制代码一起将光标移动到下一行的开头.

As Internal Server Error's comment indicates 10 is the ASCII control code for line feed while 13 is the code for carriage return. The line feed control code moves the cursor to the next line, while the carriage return code moves the cursor to the start of line. Together the two control codes move the cursor to the start of the next line.

这两个控制代码一起也形成了标准的 MS-DOS 行结束序列,除了其他顺序.换句话说,序列 13, 10 是标准的 MS-DOS 行尾.虽然在您的示例程序中以不正确的顺序使用它们可能不会产生任何实际差异,但您应该在您自己的程序中使用正确的顺序.这将确保其他可能读取您程序输出的程序不会混淆.

Together these two control codes also form the standard MS-DOS line ending sequence, except in the other order. In other words, the sequence 13, 10 is the standard MS-DOS line ending. While having them in the incorrect order in your sample program is probably not going to make any practical difference you should use the correct order in your own programs. This will ensure that other programs that might read your program's output aren't confused.

这篇关于为什么我们在消息 DB 10,13, 'foo $' 中使用 10,13?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆