我的代碼是:
Mov ah,02
Mov cl,0A
Mov dh,30
Mov dl,dh
Int 21
Mov dl,20
Int 21
Add dh,01
Loop 0106
Mov ah,02
Mov cl,09
Mov bl,31
Mov dl,0A
Int 21
Mov dl,0D
Int 21
Mov dl,bl
Int 21
Add bl,01
Loop 0106

uj5u.com熱心網友回復:
與標題中關于使用 TASM 的內容相反,螢屏截圖和代碼對應于 DOS DEBUG.EXE。請參閱有關撰寫 TASM 程式的資訊。
讓我們從注釋代碼開始(在發布之前你應該做的事情!):
Mov ah,02 ; DOS.PrintCharacter
Mov cl,0A ; Count for the 1st loop
Mov dh,30 ; '0'
0106 is address of top of the 1st loop.
Mov dl,dh
Int 21 ; This prints a digit
Mov dl,20 ; ' '
Int 21 ; This interjects a space character
Add dh,01 ; Next character
Loop 0106 ; Go to top of the 1st loop
Mov ah,02 ; DOS.PrintCharacter
Mov cl,09 ; Count for the 2nd loop
Mov bl,31 ; '1'
01?? is address of top of the 2nd loop.
Mov dl,0A ; Linefeed
Int 21
Mov dl,0D ; Carriage return
Int 21
Mov dl,bl ; Current character
Int 21
Add bl,01 ; Next character
Loop 0106 ; Go to top of the 1st (????????) loop
第一個回圈
- 當您的程式啟動時,您不應依賴預先存在的注冊內容。不要假設
CX暫存器為0。您需要使用mov cx, 0A(十進制的10)初始化回圈計數器。該loop指令取決于CX,而不僅僅是CL。 - 螢屏截圖在第一行的數字之間沒有任何空格。您應該洗掉插入空格字符的行
Mov dl,20Int 21。
第二個回圈
- 這里可以用
mov cl, 09(十進制的 9)初始化回圈計數器,因為前面的loop指令將CX暫存器留在 0。 - 因為這是一個單獨的回圈,所以
loop指令必須轉到另一個目的地。
該程式
Mov ah,02 ; DOS.PrintCharacter
Mov cx,0A ; Count for the 1st loop
Mov dl,30 ; '0'
0107 is address of top of the 1st loop.
Int 21 ; This prints a digit
Add dl,01 ; Next character
Loop 0107 ; Go to top of the 1st loop
Mov cl,09 ; Count for the 2nd loop
Mov bl,31 ; '1'
0112 is address of top of the 2nd loop.
Mov dl,0D ; Carriage return
Int 21
Mov dl,0A ; Linefeed
Int 21
Mov dl,bl ; Current character
Int 21
Add bl,01 ; Next character
Loop 0112 ; Go to top of the 2nd loop
int 20 ; DOS.Terminate
轉載請註明出處,本文鏈接:https://www.uj5u.com/caozuo/463853.html
