1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83
|
! rmrd.S - DOS program to remove ramdisk
!
! Copyright (C) 1996-1998 Gero Kuhlmann <gero@gkminix.han.de>
!
! This program is free software; you can redistribute it and/or modify
! it under the terms of the GNU General Public License as published by
! the Free Software Foundation; either version 2 of the License, or
! any later version.
!
! This program is distributed in the hope that it will be useful,
! but WITHOUT ANY WARRANTY; without even the implied warranty of
! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
! GNU General Public License for more details.
!
! You should have received a copy of the GNU General Public License
! along with this program; if not, write to the Free Software
! Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
.text
.org 0x0100
entry start
start: push cs
pop ds
xor ax,ax
mov es,ax
mov si,#rdsig
mov di,#0xF1 * 4 ! check ramdisk driver signature
mov cx,#4
repz
cmpsb
jnz start4
mov ax,#0x9C00
int 0xF8 ! check if a ramdisk driver is
cmp ax,#0x009C ! installed
je start1
start4: mov al,#1
mov dx,#noramd
jmp start9
start1: mov ax,#0x9C03
int 0xF8 ! get ramdisk ID
or cl,cl ! has to be drive A: (e.g. floppy)
jz start2
mov al,#2
mov dx,#noflop
jmp start9
start2: mov ax,#0x9C04
int 0xF8 ! remove ramdisk
or al,al
jz start3
mov al,#3
mov dx,#rderr
jmp start9
start3: xor al,al
mov dx,#rdok
start9: push ax
mov ah,#0x09
int 0x21 ! print error message
mov dx,#crlf
mov ah,#0x09
int 0x21 ! print CR/LF
pop ax
mov ah,#0x4C
int 0x21 ! terminate program
! Data area
rdsig: .ascii "NetB"
noramd: .ascii "No ramdisk found$"
noflop: .ascii "Ramdisk is not drive A:$"
rderr: .ascii "Can't remove ramdisk$"
rdok: .ascii "Ramdisk removed$"
crlf: .byte 0x0D,0x0A
.ascii "$"
|