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

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