China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --

Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
DOS stands for freedom, openness and progress. Let us work hard, learn from the openness and GNU spirit of FreeDOS and Linux, and together build and grow a free GNU GPL world!

中国DOS联盟论坛
The time now is 2026-08-01 04:26
中国DOS联盟论坛 » DOS开发编程 & 发展交流 (开发室) » How to write a program under DOS to detect whether a CD-ROM drive is installed? View 7,322 Replies 45
Floor 46 Posted 2003-09-23 00:00 ·  中国 广东 深圳 电信
初级用户
Credits 107
Posts 3
Joined 2003-09-23 00:00
22-year member
UID 10206
Gender Male
Status Offline
Hello moderator!
I really admire your programming skills!
Can you change this assembly program of yours into TC style writing?
Let me thank you in advance!
----------------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------------

add environment variable subroutine”

function InsertEnvVar:Boolean; assembler;
asm mov es,
mov es,es:
mov ax,es:
dec ax
mov es,ax
mov dx,es:
shl dx,4
inc ax
mov es,ax
cld
xor di,di
xor ax,ax
mov cx,dx
@@l1: repne scasb
mov bx,di
dec cx
scasb
jnz @@l1
cmp word ptr es:,1
jnz @@no_ext
scasw
sub cx,2
repne scasb
jnz @@err
@@no_ext:
cmp cx,10
jl @@err
push ds
push es
pop ds
mov si,di
add di,10
mov cx,si
sub cx,bx
std
dec si
dec di
rep movsb
cld
pop ds
mov si,offset env
mov di,bx
mov cx,10
rep movsb
mov al,1
jmp @@e
@@err:
mov al,0
@@e:
end;
----------------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------------
Forum Jump: