<?xml version='1.0' encoding="utf-8"?>
      <rss version='2.0'>
      <channel>
      <title>Форум на Исходниках.RU</title>
      <link>https://forum.sources.ru</link>
      <description>Форум на Исходниках.RU</description>
      <generator>Форум на Исходниках.RU</generator>
  	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=413924&amp;view=findpost&amp;p=3785989</guid>
        <pubDate>Fri, 21 Dec 2018 14:12:05 +0000</pubDate>
        <title>Поиск минимального вещественного числа в массиве</title>
        <link>https://forum.sources.ru/index.php?showtopic=413924&amp;view=findpost&amp;p=3785989</link>
        <description><![CDATA[JoeUser: <div class='tag-quote'><a class='tag-quote-link' href='https://forum.sources.ru/index.php?showtopic=413924&view=findpost&p=3785961'><span class='tag-quote-prefix'>Цитата</span></a> <span class='tag-quote__quote-info'>snapsik &#064; <time class="tag-quote__quoted-time" datetime="2018-12-20T19:01:34+03:00">20.12.18, 16:01</time></span><div class='quote '> Уже голову сломал) Может есть тут знатоки?</div></div><br>
Знатоки есть, и я даже их всех знаю поименно ... батраков только среди них нет :lol: <br>
<br>
Включай моск, я помогу.  Ассемблер ничуть не лучше других ЯП - столько же over 9000+ многобукф, особенное если руки золотые, но растут из жопы. <br>
<br>
1) Программка, которая вычисляет f=x(i), где i = 0..10 есть - замечательно&#33; Вырежи ее копипастой отдельно и сохрани. Аки Linux Kernel)))<br>
2) Тебе нужно в массиве выбрать минимальный элемент, но про печать массива ни кто не говорил - вывод, массив не нужен<br>
3) Заряжаешь вычисление 0-вого элемента f=x(0), и заносишь его в переменную<br>
4) Делаешь цикл по вычислению остальных от 1 до 9, сравнивая его с п.3 (если меньше - обозначаешь его минимальным)<br>
5) По окончании расчетов ты будешь знать минимальный элемент, он в переменной из п.3 <br>
<br>
Давно я АСМ не юзал, поэтому извини за менторский тон, но чуйка подсказывает, что есть неплохая вероятность даже call-ы не использовать, а тупо заинлайнить расчеты функции в код.<br>
<br>
Момент набма ТЮ: научись пользоваться онлайн-компиляторами&#33; Тогда тебе форумчане не просто напишут слова, а возможно и работающий пример подгонят.<br>
<br>
Как говорится, с бестами и регардами,<br>
JoeUser  :whistle:]]></description>
        <author>JoeUser</author>
        <category>Assembler</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=413924&amp;view=findpost&amp;p=3785980</guid>
        <pubDate>Fri, 21 Dec 2018 08:32:47 +0000</pubDate>
        <title>Поиск минимального вещественного числа в массиве</title>
        <link>https://forum.sources.ru/index.php?showtopic=413924&amp;view=findpost&amp;p=3785980</link>
        <description><![CDATA[Jin X: <strong class='tag-b'>snapsik</strong>, эту программу не сам писал?<br>
<strong class='tag-b'>OutFloat</strong> понятно, что не сам, а остальное тоже?]]></description>
        <author>Jin X</author>
        <category>Assembler</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=413924&amp;view=findpost&amp;p=3785961</guid>
        <pubDate>Thu, 20 Dec 2018 16:01:34 +0000</pubDate>
        <title>Поиск минимального вещественного числа в массиве</title>
        <link>https://forum.sources.ru/index.php?showtopic=413924&amp;view=findpost&amp;p=3785961</link>
        <description><![CDATA[snapsik: Добрый день&#33; Есть у меня программка, которая вычисляет значение уравнения y при каждом x от 0 до 10. Как занести каждое значение y в массив mas  и найти минимальный элемент min? Уже голову сломал) Может есть тут знатоки?<br>
<br>
<div class='tag-code'><span class='pre_code'></span><div class='code  code_collapsed ' title='Подсветка синтаксиса доступна зарегистрированным участникам Форума.' style=''><div><div><ol type="1"><div class="code_line">.286</div><div class="code_line">.model tiny</div><div class="code_line">.data</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;.code</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;org &nbsp; &nbsp; 100h</div><div class="code_line">main &nbsp; &nbsp;proc</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;jmp &nbsp; &nbsp; start</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;;Данные</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;CrLf &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;db &nbsp; &nbsp; &nbsp;0Dh, 0Ah, &#39;$&#39;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;X &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; dw &nbsp; &nbsp; &nbsp;0</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;Y &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; dw &nbsp; &nbsp; &nbsp;?</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;i &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; dw &nbsp; &nbsp; &nbsp;0</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;press &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; db 13,10,&#39;$&#39;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;minElem &nbsp; &nbsp; &nbsp; &nbsp; db 13,10,&#39;Минимальный &nbsp;элемент массива: $&#39;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;mas dw 11 dup (?)</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;min dw ?</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;;int i = 10; </div><div class="code_line">start:</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;;программа</div><div class="code_line">&nbsp;&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;fninit</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;mov i,0</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;mov cx,11</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;lea bx, mas</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;</div><div class="code_line">label1:</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;mov ax,[i] </div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;fild &nbsp; &nbsp;[i] &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ;загрузить целое число со знаком в стек</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;;fild &nbsp; &nbsp;[X] &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;;загрузить целое число со знаком в стек</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;fld1 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;;поместить в стек 1.0 (вещественное число)</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;fld &nbsp; &nbsp; st(1)</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;fsubp &nbsp; st(1), &nbsp;st(0) &nbsp; &nbsp; &nbsp; ; st(0)=1-x, st(1)=x - верно??</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;;exp(1-x)</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;fldl2e &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;;st(0)=1/ln(2)=log2(e)</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;fmulp &nbsp; st(1), &nbsp;st(0) &nbsp; ;st(0)=x/ln(2)=x*log2(e)</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;fld &nbsp; &nbsp; st(0)</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;frndint</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;fsub &nbsp; &nbsp;st(1), st(0)</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;fxch &nbsp; &nbsp;st(1)</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;f2xm1 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ;st(0)=2^(mantissa)-1</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;fld1 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;;st(0)=2^(mantissa)-1+1=2^(mantissa)</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;faddp &nbsp; st(1), st(0)</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;fscale</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;fstp &nbsp; &nbsp;st(1)</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;;2*x-epx(1-x)</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;fxch &nbsp; &nbsp;st(1)</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;fld &nbsp; &nbsp; st(0)</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;fadd &nbsp; &nbsp;st(0), &nbsp;st(0)</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;fxch &nbsp; &nbsp;st(2)</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;fsubp &nbsp; st(2), &nbsp;st(0)</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;;3*x^3+2*x+epx(1-x)</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;fld &nbsp; &nbsp; st(0)</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;fmul &nbsp; &nbsp;st(0), &nbsp;st(0)</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;fmulp &nbsp; st(1), &nbsp;st(0)</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;fld &nbsp; &nbsp; st(0)</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;fadd &nbsp; &nbsp;st(0), &nbsp;st(0)</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;faddp &nbsp; st(1), &nbsp;st(0)</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;faddp &nbsp; st(1), &nbsp;st(0)</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;;тут надо в массив поместить вещ. число из стека </div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;fst dword ptr[bx] ;???? тут что-то не так!</div><div class="code_line">&nbsp;&nbsp; &nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;call outfloat</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;mov dx,offset press &nbsp; &nbsp; ;перевод курсора</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;mov ah,09h</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;int 21h</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp;</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;inc i</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;inc bx &nbsp; ;переход к следующему элементу (размер элемента=1 байту)</div><div class="code_line">&nbsp;&nbsp; &nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;loop label1</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;;??? ТУТ НАДО МАССИВ ОБРАБОТАТЬ И НАЙТИ МИНИМАЛЬНЫЙ</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;mov ax,4C00h &nbsp; &nbsp; &nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;int 21h &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ;/ Завершение программы</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;;завершение программы</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;int &nbsp; &nbsp; 20h</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;RET &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ;Возврат из процедуры</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;</div><div class="code_line">main &nbsp; &nbsp;endp &nbsp; &nbsp; &nbsp; &nbsp;</div><div class="code_line">;-----------------------------------------------------------------------------------------------------------------------------------</div><div class="code_line">;ВЫВОД ВЕЩЕСТВЕННОГО ЧИСЛА</div><div class="code_line">;-----------------------------------------------------------------------------------------------------------------------------------</div><div class="code_line">; .exit</div><div class="code_line">&nbsp;</div><div class="code_line">; Вывод вещественного числа</div><div class="code_line">; аргумент - количество цифр дробной части</div><div class="code_line">length_frac &nbsp; &nbsp; equ &nbsp; &nbsp; [bp+4]</div><div class="code_line">; локальные переменные</div><div class="code_line">ten &nbsp; &nbsp; equ word ptr [bp-2]</div><div class="code_line">temp &nbsp; &nbsp;equ word ptr [bp-4]</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;OutFloat proc &nbsp; near</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;push cx</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;push ax</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;enter &nbsp; 4, 0 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;; пролог - выделим в кадре стека 4 байта под локальные переменные</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;mov &nbsp; &nbsp; ten, 10</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;ftst &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;; определяем знак числа</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;fstsw &nbsp; ax</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;sahf</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;jnc &nbsp; &nbsp; @positiv</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;mov &nbsp; &nbsp; al, &#39;-&#39; &nbsp; &nbsp; &nbsp; &nbsp; ; если число отрицательное - выводим минус</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;int &nbsp; &nbsp; 29h</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;fchs &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;; и получаем модуль числа</div><div class="code_line">@positiv:</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;fld1 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;; загружаем единицу</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;fld &nbsp; &nbsp; st(1) &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ; копируем число на вершину стека</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;fprem &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ; выделим дробную часть</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;fsub &nbsp; &nbsp;st(2), st &nbsp; &nbsp; &nbsp; ; отнимем ее от числа - получим целую часть</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;fxch &nbsp; &nbsp;st(2) &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ; меняем местами целую и дробную части</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;xor &nbsp; &nbsp; cx, cx &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;; обнуляем счетчик</div><div class="code_line">; далее идет стандартный алгоритм вывода целого числа на экран</div><div class="code_line">@1:</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;fidiv &nbsp; ten &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ; делим целую часть на десять</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;fxch &nbsp; &nbsp;st(1) &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ; обменяем местами st и st(1) для команды fprem</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;fld &nbsp; &nbsp; st(1) &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ; копируем результат на вершину стека </div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;fprem &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ; выделим дробную часть (цифру справа от целой части)</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;fsub &nbsp; &nbsp;st(2), st &nbsp; &nbsp; &nbsp; ; получим целую часть</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;fimul &nbsp; ten &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ; *10</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;fistp &nbsp; temp &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;; получаем очередную цифру &nbsp; &nbsp; &nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;push &nbsp; &nbsp;temp &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;; заталкиваем ее глубже в стек</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;inc &nbsp; &nbsp; cx &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;; и увеличим счетчик</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;fxch &nbsp; &nbsp;st(1) &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ; подготовим стек к следующему шагу цикла (полученное частное на вершину, в st(1) - 1)</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;ftst &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;; проверим не получили ли в частном 0?</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;fstsw &nbsp; ax</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;sahf</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;jnz &nbsp; &nbsp; @1 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;; нет - продолжим цикл</div><div class="code_line">@2: &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ; извлекаем очередную цифру, переводим её в символ и выводим.</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;pop &nbsp; &nbsp; ax</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;add &nbsp; &nbsp; al, &#39;0&#39;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;int &nbsp; &nbsp; 29h</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;loop &nbsp; &nbsp;@2</div><div class="code_line">; далее то же самое, только для дробной части. Алгоритм похож на вывод целого числа, только вместо деления умножение и проход по числу слева</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;fstp &nbsp; &nbsp;st &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;; сначала проверим, есть ли дробная часть</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;fxch &nbsp; &nbsp;st(1)</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;ftst</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;fstsw &nbsp; ax</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;sahf</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;jz &nbsp; &nbsp; &nbsp;@quit &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ; дробная часть отсутствует</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;mov &nbsp; &nbsp; al, &#39;.&#39;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;int &nbsp; &nbsp; 29h &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ; если присутствует - выведем точку</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;;mov &nbsp; &nbsp; cx, length_frac ; помещаем в счетчик длину дробной части</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;mov &nbsp; &nbsp; cx, 2 ; помещаем в счетчик длину дробной части</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;</div><div class="code_line">@3:</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;fimul &nbsp; ten &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ; умножим на 10</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;fxch &nbsp; &nbsp;st(1) &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ; подготовка для fprem - меняем st и st(1) местами и</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;fld &nbsp; &nbsp; st(1) &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ; копируем число на вершину</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;fprem &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ; отделим дробную часть от целой</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;fsub &nbsp; &nbsp;st(2), st &nbsp; &nbsp; &nbsp; ; и оставляем дробную</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;fxch &nbsp; &nbsp;st(2)</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;fistp &nbsp; temp &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;; выталкиваем полученное число из стека в temp</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;mov &nbsp; &nbsp; ax, temp &nbsp; &nbsp; &nbsp; &nbsp;; по дробной части идем слева, значит число выводим сразу, без предварительного сохранения в стек</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;or &nbsp; &nbsp; &nbsp;al, 30h &nbsp; &nbsp; &nbsp; &nbsp; ; перевод в ascii</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;int &nbsp; &nbsp; 29h &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ; на экран</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;fxch &nbsp; &nbsp;st(1) &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ; подготовим стек к следующему шагу цикла (полученное частное на вершину, в st(1) - 1)</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;ftst</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;fstsw &nbsp; ax</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;sahf &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;; проверим на 0 остаток дробной части</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;loopne &nbsp;@3</div><div class="code_line">@quit:</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;fstp &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;; готово. Чистим стек сопроцессора</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;fstp &nbsp; &nbsp;st</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;leave &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ; эпилог</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;pop ax</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;pop cx</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;ret 2 &nbsp; &nbsp;</div><div class="code_line">OutFloat endp</div><div class="code_line">&nbsp;</div><div class="code_line">end &nbsp; &nbsp; main</div></ol></div></div></div></div><script>preloadCodeButtons('1');</script>]]></description>
        <author>snapsik</author>
        <category>Assembler</category>
      </item>
	
      </channel>
      </rss>
	