Annotation of /tags/mkinitrd-6_1_8/isolinux/writehex.inc
Parent Directory | Revision Log
Revision 916 -
(hide annotations)
(download)
Wed Oct 28 00:17:50 2009 UTC (14 years, 11 months ago) by niro
File size: 1212 byte(s)
Wed Oct 28 00:17:50 2009 UTC (14 years, 11 months ago) by niro
File size: 1212 byte(s)
tagged 'mkinitrd-6_1_8'
1 | niro | 532 | ;; $Id: writehex.inc,v 1.1 2007-09-01 22:44:06 niro Exp $ |
2 | ;; ----------------------------------------------------------------------- | ||
3 | ;; | ||
4 | ;; Copyright 1994-2002 H. Peter Anvin - All Rights Reserved | ||
5 | ;; | ||
6 | ;; This program is free software; you can redistribute it and/or modify | ||
7 | ;; it under the terms of the GNU General Public License as published by | ||
8 | ;; the Free Software Foundation, Inc., 53 Temple Place Ste 330, | ||
9 | ;; Boston MA 02111-1307, USA; either version 2 of the License, or | ||
10 | ;; (at your option) any later version; incorporated herein by reference. | ||
11 | ;; | ||
12 | ;; ----------------------------------------------------------------------- | ||
13 | |||
14 | ;; | ||
15 | ;; writehex.inc | ||
16 | ;; | ||
17 | ;; Write hexadecimal numbers to the console | ||
18 | ;; | ||
19 | |||
20 | section .text | ||
21 | ; | ||
22 | ; writehex[248]: Write a hex number in (AL, AX, EAX) to the console | ||
23 | ; | ||
24 | writehex2: | ||
25 | pushfd | ||
26 | pushad | ||
27 | rol eax,24 | ||
28 | mov cx,2 | ||
29 | jmp short writehex_common | ||
30 | writehex4: | ||
31 | pushfd | ||
32 | pushad | ||
33 | rol eax,16 | ||
34 | mov cx,4 | ||
35 | jmp short writehex_common | ||
36 | writehex8: | ||
37 | pushfd | ||
38 | pushad | ||
39 | mov cx,8 | ||
40 | writehex_common: | ||
41 | .loop: rol eax,4 | ||
42 | push eax | ||
43 | and al,0Fh | ||
44 | cmp al,10 | ||
45 | jae .high | ||
46 | .low: add al,'0' | ||
47 | jmp short .ischar | ||
48 | .high: add al,'A'-10 | ||
49 | .ischar: call writechr | ||
50 | pop eax | ||
51 | loop .loop | ||
52 | popad | ||
53 | popfd | ||
54 | ret | ||
55 |