Last change
on this file was
e16e8f2,
checked in by Edwin Eefting <edwin@datux.nl>, 3 years ago
|
bootstuff
|
-
Property mode set to
100644
|
File size:
1.2 KB
|
Rev | Line | |
---|
[e16e8f2] | 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. |
---|
| 10 | ;; |
---|
| 11 | ;; ----------------------------------------------------------------------- |
---|
| 12 | |
---|
| 13 | ;; |
---|
| 14 | ;; writedec.inc |
---|
| 15 | ;; |
---|
| 16 | ;; Write decimal numbers to the console |
---|
| 17 | ;; |
---|
| 18 | |
---|
| 19 | section .text16 |
---|
| 20 | ; |
---|
| 21 | ; writedec[bwl]: Write an unsigned decimal number in (AL, AX, EAX) |
---|
| 22 | ; to the console |
---|
| 23 | ; |
---|
| 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 |
---|
| 38 | |
---|
| 39 | .cloop: |
---|
| 40 | mov edx,0 |
---|
| 41 | div ebx |
---|
| 42 | inc cx |
---|
| 43 | push dx |
---|
| 44 | and eax,eax |
---|
| 45 | jnz .cloop |
---|
| 46 | |
---|
| 47 | .dloop: |
---|
| 48 | pop ax |
---|
| 49 | add al,'0' |
---|
| 50 | call writechr |
---|
| 51 | loop .dloop |
---|
| 52 | |
---|
| 53 | popfd |
---|
| 54 | popad |
---|
| 55 | ret |
---|
| 56 | |
---|
| 57 | ; writechr: |
---|
| 58 | ; ret |
---|
Note: See
TracBrowser
for help on using the repository browser.