装配16BIT NewLine

时间:2014-09-06 14:16:15

标签: assembly newline

嗨,我正在大会上制作一个简单的Hello World程序。 [BITS 16] [ORG 0x7C00]

  MOV SI, HelloString
  CALL PrintString

  MOV SI, NewLine
  CALL PrintString
  ;New line here
  MOV SI, HelloString2
  CALL PrintString
  JMP $

  ;Write String Method {
  PrintCharacter:
  MOV AH, 0x0E
  MOV BH, 0x00
  MOV BL, 0x07
  INT 0x10
  RET
  PrintString:
  next_character:
  MOV AL, [SI]
  INC SI
  OR AL, AL
  JZ exit_function
  CALL PrintCharacter
  JMP next_character
  exit_function:
  RET
  ;} Write String Method    


  HelloString db 'Hello World', 0
  HelloString2 db 'Hi, my name is Ottovolante321', 0

  times 510 - ($-$$) db 0
  dw 0xAA55

如何在两个字符串之间包含NewLine? 谢谢你的关注。

1 个答案:

答案 0 :(得分:0)

HelloString db 'Hello World'
            db 13,10,0
HelloString2 db 'Hi, my name is Ottovolante321'
            db 13,10,0

只需在字符串结束指示符之前插入回车符,换行符。