Salve a tutti! stò cercando di convertire una word di 32 bit in codice ascii o meglio in un numero che possa essere stampato a video. Per fare ciò avevo trovato questa procedura...
PrintDecimal32:
mov ebp,10 ; Destination base is decimal
xor cx,cx ; CX = 0, it will be our digit counter
.DivideAgain:
xor edx,edx ; Clear high portion of dividend to prevent divide errors
div ebp ; EDX:EAX/EBP -> EAX r EDX
push dx ; Push the remainder (always 0-9) onto the stack
inc cx ; Increment the number of digits we know we have on the stack
test eax,eax ; Is the quotient from DIV zero?
jnz .DivideAgain ; If not, then there are more digits to be extracted from the number, so loop
.PrintMore:
pop ax ; Pop the next digit to be printed (0-9)
add al,"0" ; Convert it to an ASCII character ("0"-"9")
int 29h ; Print it
dec cx ; Decrement our counter of the number of digits we know are remaining on the stack
jnz .PrintMore ; Zero? If not then we have more digits to print.
ret ; Return to the caller
ma nn so per quale motivo sembra che nn vada e qualunque nuemro io inserisca mi stampa sempre a video il numero 2340 che nn è assolutamente il numero che deve stampare...prima di chiamare questa procedura il mio numero è contenuto in DX:AX...qualcuno sa dirmi cosa sbaglio?!