assume cs:code,ss:stack
code segment
d:db 'Mission Complete Successfully!','$'
e:db 'Mission Failed!','$'
start:mov ax,cs
mov es,ax
mov bx,offset t
mov ah,3
mov al,1
mov ch,0
mov cl,1
mov dh,0
mov dl,0
int 13h
cmp al,0
jne g
f:mov ax,cs
mov ds,ax
mov dx,offset d
mov ah,9
int 21h
jmp h
g:mov ax,cs
mov ds,ax
mov dx,offset e
mov ah,9
int 21h
h:mov ax,4c00h
int 21h
t equ this byte
org 7c00h
i:mov ax,0
mov ss,ax
mov sp,1024
mov ax,cs
mov ds,ax
mov si,offset p
mov es,ax
mov di,0600h
mov cx,offset c-offset n
cld
rep movsb
p equ this byte
org 0600h
n:mov ah,7
mov al,0
int 10h
mov ax,cs
mov ds,ax
mov si,offset a
mov di,80*2*6
mov ax,0b800h
mov es,ax
mov cx,offset b-offset a
cld
j:movsb
mov byte ptr es:[di],2
inc di
loop j
mov di,80*2*7
mov si,offset b
mov cx,offset y-offset b
cld
k:movsb
mov byte ptr es:[di],2
inc di
loop k
mov di,80*2*8
mov si,offset y
mov cx,offset c-offset y
cld
x:movsb
mov byte ptr es:[di],2
inc di
loop x
l:mov ah,0h
int 16h
cmp al,'r'
je r
cmp al,'R'
je r
cmp al,'S'
je s
cmp al,'s'
je s
cmp al,'o'
je off
cmp al,'O'
je off
jne l
r:db 0EAh
dw 0
dw 0FFFFh
s:mov ax,0
mov es,ax
mov bx,7c00h
mov ah,2h
mov al,1h
mov ch,0h
mov dh,0h
mov dl,80h
mov cl,1h
int 13h
db 0EAh
dw 7c00h
dw 0
off:mov ax,5301h
mov bx,0
int 15h
mov ax,530Dh
mov bx,1
mov cx,1
int 15h
mov ax,530fh
mov bx,1
mov cx,1
int 15h
mov ax,5307h
mov bx,1
mov cx,3
int 15h
a db 'R(r),reset'
b db 'S(s),start system'
y db 'O(o),power off'
o equ offset p-offset i
q equ offset c-offset n
c db 510-(o+q) dup (?)
m dw 0AA55h
code ends
stack segment stack
db 32 dup (?)
stack ends
end start