Главная страница
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.035 c
1-1171001707
Choco
2007-02-09 09:15
2007.04.01
Изменить размер видео в MediaPlayer


2-1173183398
..::KraN::..
2007-03-06 15:16
2007.04.01
*.EXE файл.


2-1173033268
AMW
2007-03-04 21:34
2007.04.01
Как возвратить строку из dll без ShareMem?


4-1163412977
--= Eagle =--
2006-11-13 13:16
2007.04.01
Как получить информацию S.M.A.R.T. диска?


15-1173175507
Ксардас
2007-03-06 13:05
2007.04.01
Не подскажите сайт...