P386 ;select the processor MODEL TPascal ;select the model DATASEG ;<> CODESEG DWord2Str PROC FAR num:DWORD, chars:DWORD RETURNS @Result:DWORD PUBLIC DWord2Str ASSUME ds:NOTHING ; push ds les di,@Result inc di lds si,chars cld lodsb ;{ AL := Length(chars) } cmp al,2 jb @EndLoop xor ebx,ebx mov bl,al mov cx,si ;{ CX := OFFSET chars[1] } mov eax,num ;{ AX := num } @Loop: xor edx,edx ;{ convert AX to doubleword in DX:AX} div ebx ; { DX:= AX mod BX; AX := AX div BX } add dx,cx mov si,dx ;{ DS:SI -> next char of converting string} movsb ; { Store next char of converting string} or eax,eax jnz @Loop; @EndLoop: mov si,di les di,@Result mov cx,si sub cx,di dec cl mov al,cl stosb ;{ Store length of returned string} mov bx,-1 xchg si,di shr cx,1 jcxz @End @loop1: ;{ Make Reverse String} dec di mov al,es:[di] SEGES movsb mov es:[si][bx],al dec di loop @loop1 @End: pop ds ; ASSUME ds:@DATA RET DWord2Str ENDP END