Before this fix, the cpu flags were shifted
[syslinux.git] / writehex.inc
blob3856501869370436c5a214625b0bd44ce937751a
1 ;; -----------------------------------------------------------------------
2 ;;
3 ;;   Copyright 1994-2002 H. Peter Anvin - All Rights Reserved
4 ;;
5 ;;   This program is free software; you can redistribute it and/or modify
6 ;;   it under the terms of the GNU General Public License as published by
7 ;;   the Free Software Foundation, Inc., 53 Temple Place Ste 330,
8 ;;   Boston MA 02111-1307, USA; either version 2 of the License, or
9 ;;   (at your option) any later version; incorporated herein by reference.
11 ;; -----------------------------------------------------------------------
14 ;; writehex.inc
16 ;; Write hexadecimal numbers to the console
19                 section .text
21 ; writehex[248]: Write a hex number in (AL, AX, EAX) to the console
23 writehex2:
24                 pushfd
25                 pushad
26                 rol eax,24
27                 mov cx,2
28                 jmp short writehex_common
29 writehex4:
30                 pushfd
31                 pushad
32                 rol eax,16
33                 mov cx,4
34                 jmp short writehex_common
35 writehex8:
36                 pushfd
37                 pushad
38                 mov cx,8
39 writehex_common:
40 .loop:          rol eax,4
41                 push eax
42                 and al,0Fh
43                 cmp al,10
44                 jae .high
45 .low:           add al,'0'
46                 jmp short .ischar
47 .high:          add al,'A'-10
48 .ischar:        call writechr
49                 pop eax
50                 loop .loop
51                 popad
52                 popfd
53                 ret