Assembler Unclassified Convert a value to its hexadecimal string representation (Amiga)

Source Code Snippet (edit)

***************************************************************************************
* --- ValueToStringHex(buffer, value, optlen, prefix) (a0,d0,d1,d2)
***************************************************************************************
_LVOValueToStringHex
    movem.l    d2-d7/a0,-(sp)
    tst.l      d1
    bne.s      ConvHex_Default
    moveq      #8,d1
ConvHex_Default
    moveq      #$f,d5
    moveq      #48,d6
    moveq      #58,d7
    cmpi.l     #8,d1
    bhi.s      ConvHex_Exit
    move.l     d1,d3
    rol.w      #2,d3
    ror.l      d3,d0
    subq.l     #1,d1
    tst.l      d2
    beq.s      ConvHex_Next
    move.b     #"$",(a0)+
ConvHex_Next
    rol.l      #4,d0
    move.l     d0,d3
    and.b      d5,d3
    add.b      d6,d3
    cmp.b      d7,d3
    bcs.s      ConvHex_Out
    addq.b     #7,d3
ConvHex_Out
    move.b     d3,(a0)+
    dbf        d1,ConvHex_Next
ConvHex_Exit
    movem.l    (sp)+,d2-d7/a0
    rts
    
comments powered by Disqus

Last Source Code Snippets in same category

Assembler Clearing the screen (16-bits x86)

Assembler Unclassified2012-01-29 - mov xor

Assembler Change proxy server

Assembler Unclassified2012-01-29 - eax je jmp mov registry

Assembler Quicker and Shorter Method to free/deallocate memory off the stack

Assembler Unclassified2012-01-15 - ebx ecx pop push

Assembler Pushing all registers on the stack using one instruction

Assembler Unclassified2012-01-15 - eax ebx ecx edx pop push

Assembler Enable 8085 interrupts

Assembler Unclassified2012-01-15 -

Assembler Converting Numbers from Decimal to Binary

Assembler Unclassified2012-01-15 - eax mov pop push xor