! bootoff.S, to generate bootoff.com, for dosemu 0.49, 4/9/93
! Original code by:  Theodore Ts'o
! Modified by:       Scott Buchholz

.text
.data
.bss

.align 0

.globl _main              ! for ld86
_main:
	.org	0

	mov	ah, #0xC0		! Get ROM BIOS information
	int	0x15
	mov	cx, #7
	mov	di, bx			! ES:DI = BIOS name
	add	di, #10
	mov	si, #VerCheck		! DS:SI = Version check
	add	si, #0x100
	.byte   0xf3, 0xa6		! repz	cmpsb
	jcxz	Version_OK

	mov	ax, #0x35E6		! Get the Int 0xE6 vector
	int	0x21

	mov	ax, es			! Sanity check -- if 0xE6 -> 0000:0000
	or	ax, bx			!   don't call it!
	jz	Not_Dosemu

	mov	al, #0x30
	mov	bx, #1
	int	0xe6			! disable bootdisk
Not_Dosemu:
	int	0x20			! exit

Version_OK:				! Version 0.61+
	mov	bx, #1
	call	#0xFC00:#0x0001		! Dos helper
	int	0x20			! exit

VerCheck:
	.ascii	"DOSEMU "
