Register | Login
Forum Index > Samples > dw2hex - dword to hexadecimal
Author Message
Pages: 1
Admin
Site Admin

avatar

(send private message)

Posts: 923
Topics: 54

Location:
OverHertz Studio
[1126] dw2hex - dword to hexadecimal - posted: 2012-05-17 16:05:32
Another sample function for dword to hexadecimal conversion, it is very simple and probably could be optimized if you are not bothered to preserve ecx - edi

Code:
//
// dw2hex - Code::zIron. 2012.
// buf len minimum length 12 bytes
//
function dw2hex(DWord val; char* buf) {
  uses ecx edi esi;
  
  edi = buf;
  ecx = val;
  esi = '0123456789ABCDEF';
      
  $repeat 8:
    eax = ecx;
    eax >> 28;

    al = [esi+eax];
    stosb

    ecx << 4;
  $end;
  
  char*[edi] = "h";
  
  return buf;
}


Download Ziron
Get free hosting for Ziron related fan-sites and Ziron projects, contact me in private message.
Pages: 1
create new reply


Quick reply:

Message:



Currently Active Users:
There are currently 2 user(s) online. 0 member(s) and 2 guest(s)
Most users ever online was 533, May 5, 2016, 7:19 am.


Statistics:
Threads: 223 | Posts: 1835 | Members: 50 | Active Members: 50
Welcome to our newest member, NobodyAtWork
const Copyright = '2011-2017 © OverHertz Ltd. All rights reserved.';
Web development by OverHertz Ltd