Centralize shift_is_held(), make it work to force the command line
[syslinux/sherbszt.git] / core / writedec.inc
blob19e479684d2f422732f5cf267429210e7b4187f9
1 ;; -----------------------------------------------------------------------
2 ;;
3 ;;   Copyright 1994-2008 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 ;; writedec.inc
16 ;; Write decimal numbers to the console
19                 section .text16
21 ; writedec[bwl]: Write an unsigned decimal number in (AL, AX, EAX)
22 ;                to the console
24 writedecb:
25                 pushad
26                 movzx eax,al
27                 jmp short writedec_common
28 writedecw:
29                 pushad
30                 movzx eax,ax
31                 jmp short writedec_common
32 writedecl:
33                 pushad
34 writedec_common:
35                 pushfd
36                 mov ebx,10              ; Conversion base
37                 xor cx,cx               ; Number of digits
39 .cloop:
40                 mov edx,0
41                 div ebx
42                 inc cx
43                 push dx
44                 and eax,eax
45                 jnz .cloop
47 .dloop:
48                 pop ax
49                 add al,'0'
50                 call writechr
51                 loop .dloop
53                 popfd
54                 popad
55                 ret
57 ; writechr:
58 ;               ret