2014-09-06 80 views
0

嗨,我正在组装一个简单的Hello World程序。 [比特16] [ORG 0x7C00]Assembly 16BIT NewLine

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 

我怎么能有两个字符串之间的换行? 感谢您的关注。

+0

你可以在第一行添加'\ n'字符吗? – 2014-09-06 14:21:19

+0

不工作。我试了一下 – ottovolante321 2014-09-06 14:30:57

回答

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

只需在字符串尾部指示符之前插入回车换行符即可。

+0

不起作用:( – ottovolante321 2014-09-06 15:12:04

+0

在做出上面的修改之后,从你的代码中删除'MOV SI,NewLine; CALL PrintString'行,因为它们不再是必需的,如果仍然无法正确描述它如何不起作用。 – 2014-09-06 16:27:34