home *** CD-ROM | disk | FTP | other *** search
/ PC World 2002 February / PCWorld_2002-02_cd.bin / Software / Vyzkuste / ranish / SOURCES.ZIP / IPL2.ASM < prev    next >
Assembly Source File  |  1998-11-05  |  2KB  |  141 lines

  1. .MODEL LARGE
  2. .DATA        ;
  3. .CODE        ;   Do not edit this file!!!
  4. LOCALS        ;
  5. PUBLIC    _EMP_IPL
  6. PUBLIC    _STD_IPL
  7.  
  8. _EMP_IPL    PROC
  9.         ;
  10.         ;  Dummy boot record to display message like
  11.         ;
  12.         ;  "Partition is not bootable ..."
  13.         ;
  14.         ;  MBR loads this boot record at 0000:7C00h
  15.         ;
  16.         mov    ax, cs
  17.         mov    ds, ax
  18.         mov    ss, ax
  19.         mov    sp, 7C00h
  20.         jmp    short    @@p3
  21. @@p0:
  22.         pop    si
  23.         mov    ah, 0Eh
  24.         mov    bh, 00h
  25. @@p1:
  26.         cld
  27.         lodsb
  28.         or    al, al
  29.         jz    @@p2
  30.         int    10h
  31.         jmp    @@p1
  32. @@p2:
  33.         xor    ax, ax
  34.         int    16h
  35.         mov    ax, 0E0Dh
  36.         int    10h
  37.         mov    al, 0Ah
  38.         int    10h
  39.         int    19h
  40.         ;
  41. @@p3:
  42.         call    @@p0
  43.         DB     0
  44. _EMP_IPL    ENDP
  45.  
  46.  
  47. _STD_IPL    PROC    NEAR
  48.  
  49.         ;
  50.         ;   IPL that comes with MS-DOS's fdisk.exe
  51.         ;
  52.  
  53.         CLI
  54.         XOR    AX,AX
  55.         MOV    SS,AX
  56.         MOV    SP,7C00h
  57.         MOV    SI,SP
  58.         PUSH    AX
  59.         POP    ES
  60.         PUSH    AX
  61.         POP    DS
  62.         STI
  63.         CLD
  64.         MOV    DI,0600h
  65.         MOV    CX,0100h
  66.         REPNZ
  67.         MOVSW
  68.     ;    JMP    0000:061D
  69.         DB    0EAh
  70.         DW    061Dh, 0000h
  71. @@_061D:
  72.         MOV    SI,07BEh
  73.         MOV    BL,04h
  74. @@_0622:
  75.         CMP    BYTE PTR [SI],80h
  76.         JZ    @@_0635
  77.         CMP    BYTE PTR [SI],00h
  78.         JNZ    @@_0648
  79.         ADD    SI,10h
  80.         DEC    BL
  81.         JNZ    @@_0622
  82.         INT    18h
  83. @@_0635:
  84.         MOV    DX,[SI]
  85.         MOV    CX,[SI+02]
  86.         MOV    BP,SI
  87. @@_063C:
  88.         ADD    SI,10h
  89.         DEC    BL
  90.         JZ    @@_065D
  91.         CMP    BYTE PTR [SI],00
  92.         JZ    @@_063C
  93. @@_0648:
  94.         MOV    SI,068Bh
  95. @@_064B:
  96.         LODSB
  97.         CMP    AL,00
  98.         JZ    @@_065B
  99.         PUSH    SI
  100.         MOV    BX,0007
  101.         MOV    AH,0Eh
  102.         INT    10h
  103.         POP    SI
  104.         JMP    @@_064B
  105. @@_065B:
  106.         JMP    @@_065B
  107. @@_065D:
  108.         MOV    DI,0005h
  109. @@_0660:
  110.         MOV    BX,7C00h
  111.         MOV    AX,0201h
  112.         PUSH    DI
  113.         INT    13h
  114.         POP    DI
  115.         JNB    @@_0678
  116.         XOR    AX,AX
  117.         INT    13h
  118.         DEC    DI
  119.         JNZ    @@_0660
  120.         MOV    SI,06A3h
  121.         JMP    @@_064B
  122. @@_0678:
  123.         MOV    SI,06C2h
  124.         MOV    DI,7DFEh
  125.         CMP    WORD PTR [DI],0AA55h
  126.         JNZ    @@_064B
  127.         MOV    SI,BP
  128.     ;    JMP    0000:7C00
  129.         DB    0EAh
  130.         DW    7C00h, 0000h
  131.  
  132. @@_068B:    DB    "Invalid partition table",0
  133. @@_06A3:    DB    "Error loading operating system",0
  134. @@_06C2:    DB    "Missing operating system",0
  135.  
  136.         DB    293 DUP(0)
  137.  
  138. _STD_IPL    ENDP
  139.  
  140.         END
  141.