2016-01-29 26 views
0

我的講師要求我們編寫一個彙編語言代碼來顯示一首詩或一段文字。我該怎麼做呢?據我所知,我只能顯示一個像「hello world」這樣的單句。用匯編語言輸出多行代碼

的示例代碼是這樣的:

.model small 
     .stack 100h 

CR   equ  13d 
LF   equ  10d 

      .data 
message  db  'Hello World', CR, LF, '$'     ; note the terminating $ 

      .code 
start:  
      mov ax, @data 
      mov ds, ax 

      mov dx, offset message 
      mov  ah, 9   ; subprogram for string output 
      int  21h    ; call ms-dos to display string 

      mov ax, 4c00h 
      int  21h 

      end start 

回答

1

的「$」是結束,而CR是回車和LF是換行的字符串。 在「消息」中寫下整首詩,並將其放在末尾。

+0

謝謝你的回覆,但我需要一行一行地寫這首詩如何去那 –

+1

@Owitigracie:很明顯,你可以多次調用這個系統調用。 –

+0

@PeterCordes我已經做了這個反覆它只有在前兩行工作,但之後有一個錯誤,它不執行 –