![]() |
#2
有容就大2012-05-25 14:46
![]() ;////////////////////////////////// 这个是一个 输入一串字符再将其显示出来的代码 为什么我运行后无法输入字符串?stack segment para stack 'stack' db 1024 dup(?) stack ends ;//////////////////////////////////// data segment para stack 'stack' input db 'Please input a number:$' crlf db 0dh, 0ah, '$' output db 'The result is :$' ;---------------------------- buffer_size db 50 ; max string length = 50 actual_size db ? ; actual string length chars db 50 dup (20h) ; store from here data ends ;///////////////////////////////////////////// code segment assume ds:data, cs:code, ss:stack start: mov ax, data mov ds, ax ; display the 'input' string context lea dx, input mov ah, 09h int 21h ; get the buffer_size and input a string lea dx, buffer_size mov ah, 0ah int 21h ; get the actual_size and loop output mov cl, actual_size add cl, 0 jnz display jmp exit_proc ;--------------------- ;--------------------- display: ; enter & change line lea dx, crlf mov ah, 09h int 21h ; display 'output' string lea dx, output mov ah, 09h int 21h ; get the string length and set end with '$' xor cx, cx mov cl, actual_size mov dx, offset chars mov bx, dx add bx, cx mov BYTE ptr [bx], '$' ; display the single character mov ah, 09h int 21h ;------------------------ ;------------------------ exit_proc: mov ah, 4ch int 21h code ends end start ; get the buffer_size and input a string --lea dx, buffer_size mov ah, 0ah int 21 这个中断调用没起作用啊 为什么? 只有本站会员才能查看附件,请 登录 诚心求教! [ 本帖最后由 有容就大 于 2012-5-25 15:21 编辑 ] |
我的意图是输入一个数后 ENTER 程序马上再显示这个数出来
貌似0-9可以用 SUM AL 30H来搞 2位 3位 多位的数怎么弄 是不是要存在一个字符数组里然后 通过单个字符转换
为数字 并循环输出?
有没有其他的方法?