From 2fd45689067148d7d24280a3ee945dfb32494147 Mon Sep 17 00:00:00 2001 From: "Marat Zakiyanov (Mario79)" Date: Tue, 16 Oct 2007 21:19:12 +0000 Subject: [PATCH] Function 47 - output of number without empty zero in high bits git-svn-id: svn://kolibrios.org@652 a494cfbc-eb01-0410-851d-a64ba20cac60 --- kernel/trunk/docs/sysfuncr.txt | 3 ++- kernel/trunk/docs/sysfuncs.txt | 3 ++- kernel/trunk/kernel.asm | 40 +++++++++++++++++++++++++++++----- 3 files changed, 39 insertions(+), 7 deletions(-) diff --git a/kernel/trunk/docs/sysfuncr.txt b/kernel/trunk/docs/sysfuncr.txt index c4e6e30986..df0d188cd7 100644 --- a/kernel/trunk/docs/sysfuncr.txt +++ b/kernel/trunk/docs/sysfuncr.txt @@ -2203,7 +2203,8 @@ dd 638 * bh = 1 - отображать в шестнадцатеричной системе * bh = 2 - отображать в двоичной системе * биты 16-21 = сколько цифр отображать - * биты 22-31 зарезервированы и должны быть установлены в 0 + * биты 22-30 зарезервированы и должны быть установлены в 0 + * бит 31 - установлен в 1, если требуется вывод числа без пустых нулей в старших разрядах * ecx = число (при bl=0) или указатель (при bl=1) * edx = [координата по оси x]*65536 + [координата по оси y] * esi = 0xX0RRGGBB: diff --git a/kernel/trunk/docs/sysfuncs.txt b/kernel/trunk/docs/sysfuncs.txt index 1237c52493..02d7896078 100644 --- a/kernel/trunk/docs/sysfuncs.txt +++ b/kernel/trunk/docs/sysfuncs.txt @@ -2174,7 +2174,8 @@ Parameters: * bh = 1 - display in hexadecimal system * bh = 2 - display in binary system * bits 16-21 = how many digits to display - * bits 22-31 reserved and must be set to 0 + * bits 22-30 reserved and must be set to 0 + * bit 31 - set in 1, if the output of number without empty zero in high bits is required * ecx = number (if bl=0) or pointer (if bl=1) * edx = [coordinate on axis x]*65536 + [coordinate on axis y] * esi = 0xX0RRGGBB: diff --git a/kernel/trunk/kernel.asm b/kernel/trunk/kernel.asm index 1501937aad..261be71016 100644 --- a/kernel/trunk/kernel.asm +++ b/kernel/trunk/kernel.asm @@ -1325,13 +1325,17 @@ display_number: ; edx = color xor edi, edi display_number_force: - + push eax + and eax,0x7fffffff cmp eax,0xffff ; length > 0 ? + pop eax jge cont_displ ret cont_displ: - + push eax + and eax,0x7fffffff cmp eax,61*0x10000 ; length <= 60 ? + pop eax jb cont_displ2 ret cont_displ2: @@ -1347,8 +1351,10 @@ display_number_force: cmp ah,0 ; DECIMAL jne no_display_desnum shr eax,16 - and eax,0x3f + and eax,0x803f +; and eax,0x3f push eax + and eax,0x3f mov edi,esp add edi,4+64-1 mov ecx,eax @@ -1362,6 +1368,7 @@ display_number_force: dec edi loop d_desnum pop eax + call normalize_number call draw_num_text add esp,64 popad @@ -1371,8 +1378,10 @@ display_number_force: cmp ah,0x01 ; HEXADECIMAL jne no_display_hexnum shr eax,16 - and eax,0x3f + and eax,0x803f +; and eax,0x3f push eax + and eax,0x3f mov edi,esp add edi,4+64-1 mov ecx,eax @@ -1387,6 +1396,7 @@ display_number_force: dec edi loop d_hexnum pop eax + call normalize_number call draw_num_text add esp,64 popad @@ -1396,8 +1406,10 @@ display_number_force: cmp ah,0x02 ; BINARY jne no_display_binnum shr eax,16 - and eax,0x3f + and eax,0x803f +; and eax,0x3f push eax + and eax,0x3f mov edi,esp add edi,4+64-1 mov ecx,eax @@ -1411,6 +1423,7 @@ display_number_force: dec edi loop d_binnum pop eax + call normalize_number call draw_num_text add esp,64 popad @@ -1421,6 +1434,23 @@ display_number_force: popad ret +normalize_number: + test ah,0x80 + jz .continue + mov ecx,48 + and eax,0x3f +@@: + inc edi + cmp [edi],cl + jne .continue + dec eax + cmp eax,1 + jne @r +.continue: + and eax,0x3f + ret + + draw_num_text: