⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dosio.asm

📁 masm,debug,link还有上课时的源程序
💻 ASM
字号:
;用于说明DOS输入/输出调用的例子程序
;作者:陈虎,2003.9.7

data segment para
        maxlen db 31            ;Max len for int 21h 
        actlen db ?
        d1 db 32 dup(?)                 ;input string 
        out_buf db $-d1 dup (?)         ;output string
        RETURN db 0ah, 0dh, '$' ;string for return
data ends

stack segment para stack 'stack'
        db 64 dup(?)
stack ends

code segment  public
       assume cs:code, ds:data,ss:stack,es:data
start:
        ;Begin
        mov ax,data
        mov ds,ax
        ;Add your code here

        mov dx, offset maxlen
        mov ah,0ah
        int 21h		;input string
        mov bl, actlen
        xor bh,bh
        mov [d1+bx],'$'	;add the end mark '$' to input string
        
        mov dx,offset d1
        call display		;Display input string
        
        lea si, d1
        lea di, out_buf
        call a2A		;Trans a to A

        mov dx, offset out_buf
        call display		;Display output string

;Exit to DOS
        mov ah,4ch
        int 21h

a2A proc 
;si:source string, di:dest. string
        push ax
a2A_begin:
        mov al,[si]
        cmp al, '$'
        jz a2A_end
        cmp al,'a'
        jb isA
        cmp al,'z'
        ja isA
        sub al,'a'-'A'
isa:
        mov [di], al
        inc si
        inc di
        jmp a2A_begin
a2A_end:
        mov [di],al
        pop ax
        ret
a2A endp

display proc ;dx:output buffer
        push ax
        push dx
        mov dx, offset RETURN
        mov ah,9
        int 21h		;Return to begin the new line
        pop dx
        mov ah,9
        int 21h		;Output the string
        pop ax
        ret
display endp

code ends
        end start

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -