dev.asm

来自「汇编源代码大全4」· 汇编 代码 · 共 74 行

ASM
74
字号
; DEV.ASM
.model small
.stack

.data
blkdev  db      'Block: '       ; block driver message
blkcnt  db      '0 unit(s)$'

.code
dev     proc

        mov     ah,52h          ; get List of Lists
        int     21h
        mov     ax,es           ; segment to AX
        add     bx,22h          ; driver offset, 3.1 and up
        mov     di,seg blkdev
        mov     dx,offset blkdev

dev1:   mov     ds,ax
        lea     si, [bx+10]     ; step to name/units field
        test    byte ptr [bx+5], 80h    ; check driver type
        jz      dev3            ; is BLOCK driver

        mov     cx,8            ; is CHAR driver
dev2:   lodsb                   ; so output its name
IFDEF INT29
        int     29h             ; gratuitous use of undoc DOS
ELSE
        push    dx
        mov     dl, al
        mov     ah, 2           ; Character Output
        int     21h
        pop     dx
ENDIF
        loop    dev2
        jmp     short   dev4    ; then go look for next one

dev3:   lodsb                   ; get number of units
        add     al,'0'
        push    ds
        mov     ds,di
        mov     blkcnt,al       ; set into message
        mov     ah,9
        int     21h
        pop     ds

IFDEF INT29
dev4:   mov     al,13           ; send CR and LF to CRT
        int     29h             ; gratuitous use of undoc DOS
        mov     al,10
        int     29h
ELSE
dev4:   push    dx
        mov     ah,2            ; Character Output
        mov     dl,13           ; send CR and LF to CRT
        int     21h
        mov     dl,10
        int     21h
        pop     dx
ENDIF
        mov     si,bx           ; back up to front of driver
        lodsw                   ; get offset of next one
        xchg    ax,bx
        lodsw                   ; and then its segment
        cmp     bx,0FFFFh       ; was this end of chain?
        jne     dev1            ; no, loop back

        mov     ax,4C00H        ; yes, return to DOS
        int     21h

dev     endp

        end     dev

⌨️ 快捷键说明

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