<?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=41366&amp;view=findpost&amp;p=269627</guid>
        <pubDate>Wed, 24 Dec 2003 13:37:28 +0000</pubDate>
        <title>Резидент</title>
        <link>https://forum.sources.ru/index.php?showtopic=41366&amp;view=findpost&amp;p=269627</link>
        <description><![CDATA[Some1: 1. Не правда. Я вот проверял резидент на её собственном тексте. И там встретил такой символ %))))))))))<br>2. известный глюк. Только с этим символом. Его номер совпадает с кодом управляющих символов. И поэтому нужно проверять, и если сканкод (следующий байт в буффере клавиатуры) равен 0, а сама клавиша - &quot;р&quot; (кажется 229) то это буква &quot;р&quot;.  Иначе это управляющая клавиша. И, соответственно, если ты подменяешь клавиши, то для всех обычных букв тебе достаточно поменять один байт. А чтобы поместить в буффер букву &quot;р&quot; тебе нужно ещё сбросить в ноль следующий байт (как у меня в проге).<br>]]></description>
        <author>Some1</author>
        <category>Pascal</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=41366&amp;view=findpost&amp;p=269614</guid>
        <pubDate>Wed, 24 Dec 2003 13:08:46 +0000</pubDate>
        <title>Резидент</title>
        <link>https://forum.sources.ru/index.php?showtopic=41366&amp;view=findpost&amp;p=269614</link>
        <description><![CDATA[Krishkinn:  Насчет первого глюка. Символ ~ никогда не встречается в исходниках Pascal.<br>Насчет второго глюка. Эта ошибка возникает только с символом &quot;р&quot; или есть еще какие-нибудь символы?<br><br>Заранее спасибо.<br> ]]></description>
        <author>Krishkinn</author>
        <category>Pascal</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=41366&amp;view=findpost&amp;p=269506</guid>
        <pubDate>Wed, 24 Dec 2003 10:55:24 +0000</pubDate>
        <title>Резидент</title>
        <link>https://forum.sources.ru/index.php?showtopic=41366&amp;view=findpost&amp;p=269506</link>
        <description><![CDATA[Some1: Нашёл два (как минимум) глюка:<br>Во первых если в тексте программы, которую печатаем будет &quot;~&quot;, то всё обрубится.<br>Во вторых я убрал, а ты добавил глюк с русской буквой &quot;р&quot;. Она не печатается. Для того, чтобы правильно её положить в буффер обмена, нужно в соседнюю ячейку буффера положить вместе с ней ноль (как было у меня): &quot;<b>if s2[p]=&#39;р&#39; then mem[&#036;0040:memw[&#036;0040:&#036;001A]+1]:=0;</b>&quot;.<br><br>И ты решил, что при нажатии любой клавиши (даже управляющей типа стрелок курсора) будет выводиться текст из файла. Чтож, это твоё решение %) Может так даже лучше. Я просто старался сделать так, чтобы текст выводился только при нажати на буквы, цифры, всякие знаки, но на стрелки и F клавиши не выводился бы %)]]></description>
        <author>Some1</author>
        <category>Pascal</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=41366&amp;view=findpost&amp;p=269478</guid>
        <pubDate>Wed, 24 Dec 2003 10:19:25 +0000</pubDate>
        <title>Резидент</title>
        <link>https://forum.sources.ru/index.php?showtopic=41366&amp;view=findpost&amp;p=269478</link>
        <description><![CDATA[Krishkinn:  Я тут чуть изменил Ваш исходник. Теперь прога берет все из файла и печатает это. Также она включается/выключается при нажатии на &#39;~&#39;<br><!--c1--></div><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b></b> </td></tr><tr><td id='CODE'><!--ec1--><br>Program Resident;<br>{Говорим компилятору, что все юниты имеют общий сегмент данных}<br>{&#036;G+}<br>{Не будем использовать кучу}<br>{&#036;M 4072,0,0}<br>uses dos;<br>const<br>&nbsp; Stacksize = 2*512; {512 - Количество слов в стеке}<br>&nbsp; name=&#39;txt.txt&#39;;<br>&nbsp; quit=&#39;~&#39;;<br>var<br>&nbsp; oldint09&#58;pointer;<br>&nbsp; temp&#58;word;<br>&nbsp; i,kolvo&#58;longint;<br>&nbsp; power&#58;boolean;<br>&nbsp; ch&#58;char;<br>{&#036;F+}<br>{Процедура обработки прерывания}<br>procedure MyInt; Interrupt;<br>begin<br>&nbsp; asm<br>&nbsp; &nbsp; jmp @skip<br>&nbsp; &nbsp; db 14,&#39;Мой резидент 2&#39;<br>&nbsp; &nbsp; @skip&#58;<br>&nbsp; end;<br>&nbsp; temp&#58;=memw&#91;&#036;0040&#58;&#036;001c&#93;;<br>&nbsp; asm<br>&nbsp; &nbsp; db &#036;9c<br>&nbsp; &nbsp; call oldint09<br>&nbsp; end;<br>&nbsp; if mem&#91;&#036;0040&#58;memw&#91;&#036;0040&#58;&#036;001A&#93;&#93;=ord&#40;&#39;~&#39;&#41; then power&#58;=not power;<br><br>&nbsp; if power then<br>&nbsp; &nbsp; if temp&#60;&#62;memw&#91;&#036;0040&#58;&#036;001c&#93; then<br>&nbsp; &nbsp; &nbsp; if&#40;&#40;mem&#91;&#036;0040&#58;memw&#91;&#036;0040&#58;&#036;001A&#93;&#93;&#60;&#62;0&#41;&#41; then<br>&nbsp; &nbsp; &nbsp; begin<br>&nbsp; &nbsp; &nbsp; &nbsp; inc&#40;kolvo&#41;;<br>&nbsp; &nbsp; &nbsp; &nbsp; reset&#40;input&#41;;<br>&nbsp; &nbsp; &nbsp; &nbsp; i&#58;=0;<br>&nbsp; &nbsp; &nbsp; &nbsp; while &#40;ch&#60;&#62;#26&#41;and&#40;i&#60;kolvo&#41; do<br>&nbsp; &nbsp; &nbsp; &nbsp; begin<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; read&#40;ch&#41;;<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; inc&#40;i&#41;;<br>&nbsp; &nbsp; &nbsp; &nbsp; end;<br>&nbsp; &nbsp; &nbsp; &nbsp; close&#40;input&#41;;<br>&nbsp; &nbsp; &nbsp; &nbsp; if ch=#26 then<br>&nbsp; &nbsp; &nbsp; &nbsp; begin<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; power&#58;=false;<br>&nbsp; &nbsp; &nbsp; &nbsp; end else mem&#91;&#036;0040&#58;memw&#91;&#036;0040&#58;&#036;001A&#93;&#93;&#58;=ord&#40;ch&#41;;<br>&nbsp; &nbsp; &nbsp; end;<br><br>end;<br>{&#036;F-}<br><br>var<br>&nbsp; ptr1&#58;pchar; {Указатель на предпологаемый резидент}<br>&nbsp; s&#58;string&#91;14&#93;; {Проверочная строка}<br>begin<br>&nbsp; assign&#40;input,name&#41;;<br>&nbsp; kolvo&#58;=0;<br>&nbsp; power&#58;=false;<br>&nbsp; getintvec&#40;&#036;09,pointer&#40;ptr1&#41;&#41;; {Узнаем адрес вектора}<br>&nbsp; {Скопируем из содержимого предпологаемого резидента проверочную строку}<br>&nbsp; {Смещение - 18 это смещение проверочной строки от начала резидента}<br>&nbsp; move&#40;ptr1&#91;18&#93;,s,15&#41;; {15 - количество букв + 1 байт на размер строки}<br>&nbsp; if s=&#39;Мой резидент 2&#39; then<br>&nbsp; begin<br>&nbsp; &nbsp; writeln&#40;&#39;Программа уже запущена.&#39;&#41;;<br>&nbsp; &nbsp; exit;<br>&nbsp; end;<br>&nbsp; GetIntVec&#40;&#036;09,OldInt09&#41;;<br>&nbsp; SetIntVec&#40;&#036;09,Addr&#40;MyInt&#41;&#41;;<br>&nbsp; Keep&#40;0&#41;;<br>end.<br><!--c2--></td></tr></table><div class='postcolor'><!--ec2--> ]]></description>
        <author>Krishkinn</author>
        <category>Pascal</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=41366&amp;view=findpost&amp;p=269270</guid>
        <pubDate>Wed, 24 Dec 2003 04:00:59 +0000</pubDate>
        <title>Резидент</title>
        <link>https://forum.sources.ru/index.php?showtopic=41366&amp;view=findpost&amp;p=269270</link>
        <description><![CDATA[Some1: Вот, но правда тут всё молодо, зелено %)) Нужно ещё дорабатывать. Лучше закоментируй пока строку keep, и поставь перед ней writeln (для тестирования).<br>
Я туда ещё много чего прифинтычу. Например буффер для текстовых данных. Ты скажи мне, какого максимум размера у тебя в билетах ответ ? Сколько мне памяти под прогу отводить ? или лучше читать из файла ? Тогда придётся самому писать чтение из файла. На асме (паскалевое не подойдёт). Хотя.. ммм.. хотя придумаем... главное время. А его у меня маловато свободного.<br>
<br>
Программа подменяет нажатия основных (не управляющих)клавиш на строку s2. Когда строка кончается Имитирует ENTER (#13). Поэтому тестировать лучше всего readln&#39;ом<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">Program Resident;</div><div class="code_line">{Говорим компилятору, что все юниты имеют общий сегмент данных}</div><div class="code_line">{$G+}</div><div class="code_line">{Не будем использовать кучу}</div><div class="code_line">{$M 4072,0,0}</div><div class="code_line">uses dos;</div><div class="code_line">const</div><div class="code_line">&nbsp;&nbsp;Stacksize = 2*512; {512 - Количество слов в стеке}</div><div class="code_line">&nbsp;&nbsp;s2:string=&#39;Привет всем кто меня знает !!!&#39;+#13;</div><div class="code_line">&nbsp;&nbsp;p:word=1;</div><div class="code_line">var</div><div class="code_line">&nbsp;&nbsp;oldint09:pointer;</div><div class="code_line">&nbsp;&nbsp;temp:word;</div><div class="code_line">&nbsp;</div><div class="code_line">{$F+}</div><div class="code_line">{Процедура обработки прерывания}</div><div class="code_line">procedure MyInt; Interrupt;</div><div class="code_line">begin</div><div class="code_line">&nbsp;&nbsp;asm</div><div class="code_line">&nbsp;&nbsp; &nbsp;jmp @skip</div><div class="code_line">&nbsp;&nbsp; &nbsp;db 14,&#39;Мой резидент 2&#39;</div><div class="code_line">&nbsp;&nbsp; &nbsp;@skip:</div><div class="code_line">&nbsp;&nbsp;end;</div><div class="code_line">&nbsp;&nbsp;temp:=memw[{text}40:{text}1c];</div><div class="code_line">&nbsp;&nbsp;asm</div><div class="code_line">&nbsp;&nbsp; &nbsp;db c</div><div class="code_line">&nbsp;&nbsp; &nbsp;call oldint09</div><div class="code_line">&nbsp;&nbsp;end;</div><div class="code_line">&nbsp;&nbsp;if temp&#60;&#62;memw[{text}40:{text}1c] then</div><div class="code_line">&nbsp;&nbsp;if((mem[{text}40:memw[{text}40:{text}1A]]&#60;&#62;0)and</div><div class="code_line">&nbsp;&nbsp; &nbsp; (mem[{text}40:memw[{text}40:{text}1A]]&#60;&#62;224))</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; or(memw[{text}40:memw[{text}40:{text}1A]]=224) then</div><div class="code_line">&nbsp;&nbsp;begin</div><div class="code_line">&nbsp;&nbsp; &nbsp;mem[{text}40:memw[{text}40:{text}1A]]:=byte(s2[p]);</div><div class="code_line">&nbsp;&nbsp; &nbsp;if s2[p]=&#39;р&#39; then mem[{text}40:memw[{text}40:{text}1A]+1]:=0;</div><div class="code_line">&nbsp;&nbsp; &nbsp;if p&#60;length(s2) then inc(p);</div><div class="code_line">&nbsp;&nbsp;end;</div><div class="code_line">end;</div><div class="code_line">{$F-}</div><div class="code_line">&nbsp;</div><div class="code_line">var</div><div class="code_line">&nbsp;&nbsp;ptr1:pchar; {Указатель на предпологаемый резидент}</div><div class="code_line">&nbsp;&nbsp;s:string[14]; {Проверочная строка}</div><div class="code_line">begin</div><div class="code_line">&nbsp;&nbsp;getintvec(,pointer(ptr1)); {Узнаем адрес вектора}</div><div class="code_line">&nbsp;&nbsp;{Скопируем из содержимого предпологаемого резидента проверочную строку}</div><div class="code_line">&nbsp;&nbsp;{Смещение - 18 это смещение проверочной строки от начала резидента}</div><div class="code_line">&nbsp;&nbsp;move(ptr1[18],s,15); {15 - количество букв + 1 байт на размер строки}</div><div class="code_line">&nbsp;&nbsp;if s=&#39;Мой резидент 2&#39; then</div><div class="code_line">&nbsp;&nbsp;begin</div><div class="code_line">&nbsp;&nbsp; &nbsp;writeln(&#39;Программа уже запущена.&#39;);</div><div class="code_line">&nbsp;&nbsp; &nbsp;exit;</div><div class="code_line">&nbsp;&nbsp;end;</div><div class="code_line">&nbsp;&nbsp;GetIntVec(,OldInt09);</div><div class="code_line">&nbsp;&nbsp;SetIntVec(,Addr(MyInt));</div><div class="code_line">&nbsp;&nbsp;Keep(0);</div><div class="code_line">end.</div></ol></div></div></div></div><script>preloadCodeButtons('1');</script>]]></description>
        <author>Some1</author>
        <category>Pascal</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=41366&amp;view=findpost&amp;p=269066</guid>
        <pubDate>Tue, 23 Dec 2003 18:17:31 +0000</pubDate>
        <title>Резидент</title>
        <link>https://forum.sources.ru/index.php?showtopic=41366&amp;view=findpost&amp;p=269066</link>
        <description><![CDATA[Krishkinn:  Это прога для экзаменов. Запускаешь её, указываешь номер билета, а она берет уже готовый исходник. Далее заходишь в Pascal нажимаешь на любые клавиши, а резидент пишит не то что нажато а готовый исходник.<br><br>&#33;&#33;&#33;Мне только надо узнать, как имитировать нажатие клавиш(отсылать в KEY-буфер нужную клавишу). ]]></description>
        <author>Krishkinn</author>
        <category>Pascal</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=41366&amp;view=findpost&amp;p=268955</guid>
        <pubDate>Tue, 23 Dec 2003 16:14:57 +0000</pubDate>
        <title>Резидент</title>
        <link>https://forum.sources.ru/index.php?showtopic=41366&amp;view=findpost&amp;p=268955</link>
        <description><![CDATA[Some1: Давай напишем. Только что должно печататься? Какой, и когда это должно активироваться ?]]></description>
        <author>Some1</author>
        <category>Pascal</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=41366&amp;view=findpost&amp;p=268897</guid>
        <pubDate>Tue, 23 Dec 2003 15:08:02 +0000</pubDate>
        <title>Резидент</title>
        <link>https://forum.sources.ru/index.php?showtopic=41366&amp;view=findpost&amp;p=268897</link>
        <description><![CDATA[Krishkinn:  Кто знает как написать резидента, который мог бы что-нибудь печатать в других прогах. Вообщем &#39;имитировал&#39; нажатие клавиш. Все это естественно под MS-DOS <!--emo&:huh:--><img src='http://forum.sources.ru/html/emoticons/huh.gif' border='0' style='vertical-align:middle' alt='huh.gif' /><!--endemo--> ]]></description>
        <author>Krishkinn</author>
        <category>Pascal</category>
      </item>
	
      </channel>
      </rss>
	