VirtualBox

source: vbox/trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-PrintX32.asm@ 95491

Last change on this file since 95491 was 93115, checked in by vboxsync, 3 years ago

scm --update-copyright-year

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 2.4 KB
Line 
1; $Id: bs3-cmn-PrintX32.asm 93115 2022-01-01 11:31:46Z vboxsync $
2;; @file
3; BS3Kit - Bs3PrintU32, Common.
4;
5
6;
7; Copyright (C) 2007-2022 Oracle Corporation
8;
9; This file is part of VirtualBox Open Source Edition (OSE), as
10; available from http://www.virtualbox.org. This file is free software;
11; you can redistribute it and/or modify it under the terms of the GNU
12; General Public License (GPL) as published by the Free Software
13; Foundation, in version 2 as it comes in the "COPYING" file of the
14; VirtualBox OSE distribution. VirtualBox OSE is distributed in the
15; hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
16;
17; The contents of this file may alternatively be used under the terms
18; of the Common Development and Distribution License Version 1.0
19; (CDDL) only, as it comes in the "COPYING.CDDL" file of the
20; VirtualBox OSE distribution, in which case the provisions of the
21; CDDL are applicable instead of those of the GPL.
22;
23; You may elect to license modified versions of this file under the
24; terms and conditions of either the GPL or the CDDL or both.
25;
26
27%include "bs3kit-template-header.mac"
28
29
30BS3_EXTERN_CMN Bs3PrintStr
31
32;;
33; Prints a 32-bit unsigned integer value as hex.
34;
35; @param [xBP + xCB*2] 32-bit value to format and print.
36;
37BS3_PROC_BEGIN_CMN Bs3PrintX32, BS3_PBC_HYBRID
38 BS3_CALL_CONV_PROLOG 1
39 push xBP
40 mov xBP, xSP
41 push sAX
42 push sDX
43 push sCX
44 push sBX
45BONLY16 push ds
46
47 mov eax, [xBP + xCB + cbCurRetAddr]
48
49 ; Allocate a stack buffer and terminate it. ds:bx points ot the end.
50 sub xSP, 30h
51BONLY16 mov bx, ss
52BONLY16 mov ds, bx
53 mov xBX, xSP
54 add xBX, 2fh
55 mov byte [xBX], 0
56
57 mov ecx, 16 ; what to divide by
58.next:
59 xor edx, edx
60 div ecx ; edx:eax / ecx -> eax and rest in edx.
61 cmp dl, 10
62 jb .decimal
63 add dl, 'a' - '0' - 10
64.decimal:
65 add dl, '0'
66 dec xBX
67 mov [BS3_ONLY_16BIT(ss:)xBX], dl
68 cmp eax, 0
69 jnz .next
70
71 ; Print the string.
72BONLY64 add rsp, 18h
73BONLY16 push ss
74 push xBX
75 BS3_CALL Bs3PrintStr, 1
76
77 add xSP, 30h + BS3_IF_16_32_64BIT(2, 0, 18h) + xCB
78BONLY16 pop ds
79 pop sBX
80 pop sCX
81 pop sDX
82 pop sAX
83 leave
84 BS3_CALL_CONV_EPILOG 1
85 BS3_HYBRID_RET
86BS3_PROC_END_CMN Bs3PrintX32
87
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette