Текущий архив: 2007.04.01;
Скачать: CL | DM;
Вниз
Десятичное число в строку Найти похожие ветки
← →
ArtemESC © (2007-03-07 00:15) [0]Глаз уже приелся... Немогу найти ошибку... Может кто посмотрит свежим оком??
;this macros get length of string
;ds: [si] - address of string
GetStrLen macro len
local L1, L2
push si
and len, 0h
L1:
cmp byte ptr ds: [si], 0h
je L2
inc si
inc len
L2:
pop si
endm
;this macros inverse string
;ds: [si] - address of string
InverseStr macro
local L
push ax
push di
push si
GetStrLen ax
mov di, ax
dec di
mov ax, si
add di, ax
L:
mov ax, word ptr ds: [si]
xchg ax, word ptr ds: [di]
mov word ptr es: [si], ax
dec di
inc si
cmp si, di
jb L
pop si
pop di
pop ax
endm
;tis macros convert decimal number to string
;es: [di] - address of string
DecIntToStr macro num
local L
push dx
push ax
push bx
push di
push ds
push si
L:
xor dx, dx
mov ax, num
mov bx, 10
div bx
add dx, "0"
mov byte ptr es: [di], dl
inc di
cmp ax, 0
jne L
mov byte ptr es: [di], 0
mov ax, es
mov ds, ax
mov ax, di
mov si, ax
InverseStr
pop si
pop ds
pop di
pop bx
pop ax
pop dx
endm
← →
Сергей М. © (2007-03-07 08:33) [1]
>...
> mov ax, di <<<- здесь di указывает на конец, а не на начало строки
> mov si, ax
> InverseStr
>...
← →
ArtemESC © (2007-03-07 12:08) [2]Thanks...
Страницы: 1 вся ветка
Текущий архив: 2007.04.01;
Скачать: CL | DM;
Память: 0.47 MB
Время: 0.034 c