source: trunk/BOOTCODE/REGULAR/AUXIO.ASM@ 34

Last change on this file since 34 was 31, checked in by Ben Rietbroek, 13 years ago

Bumped code-version to v1.0.8 [2011-11-11]

Fixes

o Fixed the drive-letter feature that was broken in v1.07
o Corrected release date in signature which was not updated with v1.07

Changes

o Bumped code-version in signature to v1.0.8

The extra dot is cosmetic only, the version in the signature
is BCD-coded and did not change format.

o Reworked MBR code to contain two I13X signatures

These signatures are actually MOV EAX,'X31I' in the original eCS
LVM MBR-code. However, they are at different offsets in the v1.x
and v2.x versions of the LVM MBR-code. (v1.x->0d5h -- v2.x->0d0h)
Other code might depend on their existence so we put both in
the AiR-BOOT MBR. (See eCS bugtracker issue #3002)

Note

This commit and all following commits upto and including the RC3
commit [2012-09-09] are delayed commits from a local repository.
Also, the RC (Release Candidate) naming of the corresponding commits
is a bit misleading. One would label a revision with RC when near to
a final release. Since many things have changed between RC1,RC2 & RC3,
these RC's should be interpreted as mile-stones.

WARNING!!

All commits upto and including the commit of [2012-05-13] contain
a severe bug!! Building from these sources and then disabling
the 'force LBA' feature while also using the drive-letter feature or
editing the label can destroy the MBR on all attached disks!!
DO NOT DISABLE 'FORCE LBA USAGE' WHEN BUILT FROM THE ABOVE COMMITS!!

File size: 8.7 KB
Line 
1; AiR-BOOT (c) Copyright 1998-2008 M. Kiewitz
2;
3; This file is part of AiR-BOOT
4;
5; AiR-BOOT is free software: you can redistribute it and/or modify it under
6; the terms of the GNU General Public License as published by the Free
7; Software Foundation, either version 3 of the License, or (at your option)
8; any later version.
9;
10; AiR-BOOT is distributed in the hope that it will be useful, but WITHOUT ANY
11; WARRANTY: without even the implied warranty of MERCHANTABILITY or FITNESS
12; FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
13; details.
14;
15; You should have received a copy of the GNU General Public License along with
16; AiR-BOOT. If not, see <http://www.gnu.org/licenses/>.
17;
18;---------------------------------------------------------------------------
19; AiR-BOOT / AUXILARY I/O
20;---------------------------------------------------------------------------
21
22
23; -----------------------
24; Rousseau: # AUXIO.ASM #
25; -----------------------
26; Output some stuff to the serial port.
27; The aux parameters in the MBR must be initialized for this.
28; Lower byte is com-port, 0=disabled, 1=com1, etc.
29; High byte is initialization; see below. (0e3h)
30
31IFDEF ModuleNames
32DB 'AUXIO',0
33ENDIF
34
35; Initialize the com-port, but only when logging is enabled.
36; It get's it's parameters from offset 1B0h in the MBR.
37; Out: AX - line status
38AuxIO_Init Proc Near Uses dx si
39 ; bits 7-5 = datarate (000=110,001=150,010=300,011=600,100=1200,101=2400,110=4800,111=9600 bps)
40 ; bits 4-3 = parity (00 or 10 = none, 01 = odd, 11 = even)
41 ; bit 2 = stop-bits (set = 2 stop-bits, clear = 1 stop-bit)
42 ; bits 1-0 = data-bits (00 = 5, 01 = 6, 10 = 7, 11 = 8)
43 ; mov [BIOS_AuxParms],ax ; save initialization and port
44 mov dx,[BIOS_AuxParms] ; DL=port, 0=disabled, 1=com1; DH=config-parms
45 test dl,dl ; see if logging is enabled, if not, skip initialization
46 jz AuxIO_Init_NoLogging
47
48 dec dl ; adjust port-number
49 and dl,03h ; 3 is max value
50
51 ; Initialization message
52 mov si,offset AuxInitMsg
53 call MBR_Teletype
54
55 ; Port number
56 call VideoIO_SyncPos
57 mov al,dl
58 inc al
59 call VideoIO_PrintByteDynamicNumber
60 xor si,si
61 call MBR_TeletypeNL
62
63 ; Do the initialization
64 mov al,dh ; initialization parameters to al
65 mov dh,0 ; DX now contains port-number
66 mov ah,0
67 int 14h ; intialize com-port
68 AuxIO_Init_NoLogging:
69 ret
70AuxIO_Init EndP
71
72
73; In: AL - Single Char to send to Com Port
74; DL - Port number; 0 for com1, etc.
75; Destroyed: None
76AuxIO_PrintSingleChar Proc Near Uses ax es di
77 nop
78AuxIO_PrintSingleChar EndP
79
80
81; Print char to com-port (teletype style)
82AuxIO_Teletype Proc Near Uses ax dx
83 mov dx,[BIOS_AuxParms] ; get port and parameters
84 xor dh,dh ; we don't need the parameters
85 test dl,dl ; test if logging is enabled
86 jz AuxIO_Teletype_NoLogging ; nope, return immediately
87 dec dl ; adjust port-number
88 and dl,03h ; 3 is max value
89 mov ah,01h
90 int 14h ; send char to com-port
91 AuxIO_Teletype_NoLogging:
92 ret
93AuxIO_TeleType EndP
94
95
96; Print newline char (unix) to com-port (teletype style)
97AuxIO_TeletypeNL Proc Near Uses ax
98 mov al,10
99 call AuxIO_Teletype
100 ret
101AuxIO_TeleTypeNL EndP
102
103
104; Print hex-byte to com-port (teletype style)
105; This outputs two characters
106; In: AL - byte to send
107; Out: AL - byte sent
108; Destroyed: None
109AuxIO_TeletypeHexByte Proc Near Uses ax
110 call CONV_BinToAsc ; Returns high hex-nibble in AH, low hex-nibble in AL
111 xchg al,ah ; High hex-nibble first
112 call AuxIO_Teletype ; Output to com-port
113 xchg al,ah ; Low hex-nibble next
114 call AuxIO_Teletype ; Output to com-port
115 ret
116AuxIO_TeleTypeHexByte EndP
117
118; Print hex-word to com-port (teletype style)
119; This outputs four characters
120; In: AX - word to send
121; Out: AX - word sent
122; Destroyed: None
123AuxIO_TeletypeHexWord Proc Near
124 xchg al,ah ; High byte first
125 call AuxIO_TeletypeHexByte ; Output to com-port
126 xchg al,ah ; low byte next
127 call AuxIO_TeletypeHexByte ; Output to com-port
128 ret
129AuxIO_TeleTypeHexWord EndP
130
131
132; Print hex-dword to com-port (teletype style)
133; This outputs eight characters
134; In: DX:AX - dword to send
135; Out: DX:AX - dword sent
136; Destroyed: None
137AuxIO_TeletypeHexDWord Proc Near
138 xchg ax,dx
139 call AuxIO_TeletypeHexWord ; High word first
140 xchg ax,dx
141 call AuxIO_TeletypeHexWord ; Low word next
142 ret
143AuxIO_TeleTypeHexDWord EndP
144
145
146; Print hex-qword to com-port (teletype style)
147; This outputs sixteen characters
148; In: BX:CX:DX:AX - qword to send
149; Out: BX:CX:DX:AX - qword sent
150; Destroyed: None
151AuxIO_TeletypeHexQWord Proc Near
152 xchg dx,bx
153 xchg ax,cx
154 call AuxIO_TeletypeHexDWord ; High dword first
155 xchg dx,bx
156 xchg ax,cx
157 call AuxIO_TeletypeHexDWord ; Low dword next
158 ret
159AuxIO_TeleTypeHexQWord EndP
160
161
162
163
164
165
166; Print 0-terminated string to com-port
167AuxIO_Print Proc Near Uses ax bx cx dx
168 AuxIO_PrintNext:
169 lodsb
170 test al,al
171 jz AuxIO_PrintEOS
172 call AuxIO_Teletype
173 jmp AuxIO_PrintNext
174 AuxIO_PrintEOS:
175 ret
176AuxIO_Print EndP
177
178
179; Dump a 16-byte block of memory to the com-port in debug-format (hex-bytes and ascii-bytes)
180; In: DS:SI - pointer to memory to dump
181;
182AuxIO_DumpParagraph Proc Near Uses ax cx dx si
183
184 ; Dump the index dword
185 xor dx,dx
186 mov ax,si
187 call AuxIO_TeletypeHexDWord
188
189 ; Separate it from the dump
190 mov al,' '
191 call AuxIO_Teletype
192 mov al,' '
193 call AuxIO_Teletype
194 mov al,'|'
195 call AuxIO_Teletype
196 mov al,' '
197 call AuxIO_Teletype
198
199 ; Save si for later
200 push si
201
202 ; Four groups of 4 bytes
203 mov cx,4
204
205
206 AuxIO_DumpParagraph_Next_1:
207
208 ; byte at offset 0
209 lodsb
210 call AuxIO_TeletypeHexByte
211
212 ; space separator
213 mov al,' '
214 call AuxIO_Teletype
215
216 ; byte at offset 1
217 lodsb
218 call AuxIO_TeletypeHexByte
219
220 ; space separator
221 mov al,' '
222 call AuxIO_Teletype
223
224 ; byte at offset 2
225 lodsb
226 call AuxIO_TeletypeHexByte
227
228 ; space separator
229 mov al,' '
230 call AuxIO_Teletype
231
232 ; byte at offset 3
233 lodsb
234 call AuxIO_TeletypeHexByte
235
236 ; space separator
237 mov al,' '
238 call AuxIO_Teletype
239
240 ; separator
241 mov al,'|'
242 call AuxIO_Teletype
243
244 ; space separator
245 mov al,' '
246 call AuxIO_Teletype
247
248 loop AuxIO_DumpParagraph_Next_1
249
250 ; space separator
251 mov al,' '
252 call AuxIO_Teletype
253
254 ; recall pointer
255 pop si
256
257 ; 16 ascii bytes to print
258 mov cx,16
259
260 AuxIO_DumpParagraph_Next_2:
261 mov ah,'.' ; char to use ufnot printable
262 lodsb ; load byte
263 call CONV_ConvertToPrintable ; use dot's if not printable
264 call AuxIO_Teletype ; print it
265 loop AuxIO_DumpParagraph_Next_2
266 ret
267AuxIO_DumpParagraph EndP
268
269
270
271AuxIO_DumpSector Proc Near Uses cx si
272 mov cx,32 ; Number of paragraphs in a sector
273 AuxIO_DumpSector_Next:
274 call AuxIO_DumpParagraph ; Dump te paragraph
275 add si,16 ; Advance pointer
276 call AuxIO_TeletypeNL
277 loop AuxIO_DumpSector_Next
278 ret
279AuxIO_DumpSector EndP
280
281
282AuxIOHello: db 'AiR-BOOT com-port debugging',10,0
283
284
285
Note: See TracBrowser for help on using the repository browser.