|
编写程序:实现int 21h 的字符串输入输出实现功能:先显示“input:",然后从键盘输入1~20个字符串(最大为 20 个字符)。在下一行显示“output:”和输出字符串。重复上述输入和显示,直到按 ctrl-c才退出 |
|
|
|
data segment
string db 23 input db "input:" data ends code segment assume cs:code ds:data start: move ax,data move ds,ax circle: move ah,0ah ;0a还是09显示我忘了,你自己查查 mov dx,offset input mov [dx],20 int 21h mov dx, offset input mov al,09 int 21h mov al,[dx+1] mov ah,0 inc dx,ax+2 mov [dx],0ah mov [dx+1],'$' mov dx,offset string+2 mov al,0ah int 21h jmp circle code ends end start |
|
|
有好多错哦~~~“哇~~~~~”
|
|
|
sseg segment stack
dw 256 dup (?) sseg ends dseg segment buf db 21,?,21 dup (?) msg1 db 13,10,'input:',24h msg2 db 13,10,'output:',24h dseg ends cseg segment assume cs:cseg,ds:dseg,ss:sseg start: mov ax,dseg mov ds,ax cont: mov dx,offset msg1 mov ah,9 int 21h mov dx,offset buf mov ah,0ah int 21h mov si,dx mov al,[si+1] mov ah,0 add si,ax add si,2 mov byte ptr [si],24h mov dx,offset msg2 mov ah,9 int 21h mov dx,offset buf + 2 mov ah,9 int 21h jmp cont cseg ends end start |
|