📄 lastdrv.asm
字号:
; LASTDRV.ASM -- uses only documented DOS
; masm lastdrv;
; link lastdrv;
_STACK segment para stack 'STACK'
_STACK ends
_DATA segment word public 'DATA'
msg db 'LASTDRIVE='
dletter db (?)
db 0dh, 0ah, '$'
_DATA ends
_TEXT segment word public 'CODE'
assume cs:_TEXT, ds:_DATA, ss:_STACK
main proc near
mov ax, _DATA
mov ds, ax ; set DS to data segment
mov ah, 19h ; Get Current Disk function
int 21h ; call MS-DOS
mov dl, al ; AL now holds current drive
mov ah, 0Eh ; Select Disk function
int 21h ; call MS-DOS
mov bl, al ; LASTDRIVE in AL; save in BL
add al, ('A' - 1) ; convert to drive letter
mov dletter, al ; insert into string
mov dx, offset msg ; string in DS:DX
mov ah, 9 ; Display String function
int 21h ; call MS-DOS
mov ah, 4Ch ; Return to DOS
mov al, bl ; LASTDRIVE is exit code
int 21h ; call MS-DOS
main endp
_TEXT ends
end main
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -