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;; writehex.inc 15;; 16;; Write hexadecimal numbers to the console 17;; 18 19; 20; writehex[248]: Write a hex number in (AL, AX, EAX) to the console 21; 22writehex2: 23 pushfd 24 pushad 25 rol eax,24 26 mov cx,2 27 jmp short writehex_common 28writehex4: 29 pushfd 30 pushad 31 rol eax,16 32 mov cx,4 33 jmp short writehex_common 34writehex8: 35 pushfd 36 pushad 37 mov cx,8 38writehex_common: 39.loop: rol eax,4 40 push eax 41 and al,0Fh 42 cmp al,10 43 jae .high 44.low: add al,'0' 45 jmp short .ischar 46.high: add al,'A'-10 47.ischar: call writechr 48 pop eax 49 loop .loop 50 popad 51 popfd 52 ret 53