Главная страница
Top.Mail.Ru    Яндекс.Метрика
Текущий архив: 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
2-1173110211
pasha star
2007-03-05 18:56
2007.04.01
RichEdit add lines down


2-1173811838
Костя
2007-03-13 21:50
2007.04.01
Как узнать температуру процессора?


15-1173425549
Kerk
2007-03-09 10:32
2007.04.01
Путин: У меня хотят отнять право смотреть футбол бесплатно (c)


15-1173435017
Ламот
2007-03-09 13:10
2007.04.01
Нопонятки с мышкой...


1-1170732544
Ant205
2007-02-06 06:29
2007.04.01
Delphi и WinAmp