MR> I CANT use LONGs instead of DWORDs in this case, has someone a
MR> source which does the same thing as the HEX$-command does and works
MR> with DWORDS? I'm in a big need of such a source... :(
John Pearson posted the following on the Compuserve PB forum. I saved
it in case I ever needed it, but I've never used it and can't explain
what it does.
DIM Dhex as string*8
a???=&hffffffff
DoubleHex a???,Dhex
print Dhex
end
sub DoubleHex(a???,Dhex as string*8)
! push di
! push ds
! push si
! les di,a??? ;es:di points to a???
! lds si,Dhex ;ds:si points to DHex start
! mov ax,si
! add ax,7
! mov si,ax ;ds:si points to DHex end
! mov ax,es:[di] ;get the least sig word
! mov cx,4 ;shift constant
! mov bx,&h204 ;words/nibbles to process *MOD bh AS REQD.*
shloop1:
! push ax
! and ax,&H0F ;get next nibble
! add al,&h90
! daa
! adc al,&h40
! daa ;AL now contains ASCII value for the
nibble
! mov ds:[si],AL ;store it
! dec si
! pop ax
! shr ax,CL ;adjust data
! dec bl
! jnz shloop1 ;repeat for all nibbles in the word
! or bl,4 ;reset nibble counter
! inc di
! inc di
! mov ax,es:[di] ;get next most sig word
! dec bh ;see if all words done yet
! jnz shloop1 ;loop if not
! pop si
! pop ds
! pop di
end sub
* RM 1.31 1209 * Anton Monroe 70304.3663@compuserve.com
--- FidoPCB v1.4 [ff013/c]
---------------
* Origin: Sound Advice - 24 Nodes (816)436-4516 (1:280/333)
|