source: xtideuniversalbios/trunk/XTIDE_Universal_BIOS/Src/Boot/BootPrint.asm @ 87

Last change on this file since 87 was 87, checked in by krille_n_@…, 13 years ago

Change to XTIDE Universal BIOS
*Size optimization in BootPrint.asm

File size: 2.7 KB
Line 
1; Project name  :   IDE BIOS
2; Description   :   Functions for printing boot related strings.
3
4; Section containing code
5SECTION .text
6
7;--------------------------------------------------------------------
8; Prints trying to boot string.
9;
10; BootPrint_TryToBootFromDL
11;   Parameters:
12;       DL:     Drive to boot from (translated, 00h or 80h)
13;       DS:     RAMVARS segment
14;   Returns:
15;       Nothing
16;   Corrupts registers:
17;       AX, CX, SI, DI
18;--------------------------------------------------------------------
19ALIGN JUMP_ALIGN
20BootPrint_TryToBootFromDL:
21    push    dx
22    ePUSH_T ax, BootPrint_PopDxAndReturn    ; Return address
23
24    xor     dh, dh              ; Translated drive number to DX
25    push    dx                  ; Push translated drive number
26    call    DriveXlate_ToOrBack
27    push    dx                  ; Push untranslated drive number
28
29    mov     ax, g_szFloppyDrv   ; Assume "Floppy Drive"
30    test    dl, 80h             ; Hard Disk?
31    jz      SHORT .PushHardOrFloppy
32    add     ax, BYTE g_szHardDrv - g_szFloppyDrv
33.PushHardOrFloppy:
34    push    ax
35
36    mov     si, g_szTryToBoot
37    mov     dh, 6               ; 6 bytes pushed to stack
38    jmp     PrintString_JumpToFormat
39
40ALIGN JUMP_ALIGN
41BootPrint_PopDxAndReturn:
42    pop     dx
43    ret
44
45
46;--------------------------------------------------------------------
47; Prints message that valid boot sector has been found.
48;
49; BootPrint_BootSectorLoaded
50;   Parameters:
51;       Nothing
52;   Returns:
53;       Nothing
54;   Corrupts registers:
55;       AX, CX, SI
56;--------------------------------------------------------------------
57ALIGN JUMP_ALIGN
58BootPrint_BootSectorLoaded:
59    push    dx
60    ePUSH_T ax, BootPrint_PopDxAndReturn    ; Return address
61
62    ePUSH_T ax, g_szFound
63    jmp     SHORT BootPrint_MsgCodeShared
64
65
66;--------------------------------------------------------------------
67; Prints message that first sector is not boot sector.
68;
69; BootPrint_FirstSectorNotBootable
70;   Parameters:
71;       Nothing
72;   Returns:
73;       Nothing
74;   Corrupts registers:
75;       AX, CX, DX, SI
76;--------------------------------------------------------------------
77ALIGN JUMP_ALIGN
78BootPrint_FirstSectorNotBootable:
79    ePUSH_T ax, g_szNotFound
80BootPrint_MsgCodeShared:
81    ePUSH_T ax, g_szBootSector
82    mov     si, g_szSectRead
83    mov     dh, 4               ; 4 bytes pushed to stack
84    jmp     PrintString_JumpToFormat
85
86
87;--------------------------------------------------------------------
88; Prints error code for failed first sector read attempt.
89;
90; BootPrint_FailedToLoadFirstSector
91;   Parameters:
92;       AH:     INT 13h error code
93;   Returns:
94;       Nothing
95;   Corrupts registers:
96;       AX, CX, DX, SI
97;--------------------------------------------------------------------
98ALIGN JUMP_ALIGN
99BootPrint_FailedToLoadFirstSector:
100    eMOVZX  cx, ah              ; Error code to CX
101    push    cx                  ; Push INT 13h error code
102    mov     si, g_szReadError
103    mov     dh, 2               ; 2 bytes pushed to stack
104    jmp     PrintString_JumpToFormat
Note: See TracBrowser for help on using the repository browser.