cvs commit: de-docproj/books/developers-handbook/x86 chapter.sgml

From: Aron Schlesinger <as(at)doc.bsdgroup.de>
Date: Mon, 13 Aug 2007 13:47:23 GMT

as 2007-08-13 13:47:23 UTC

  FreeBSD ports repository

  Modified files:
    books/developers-handbook/x86 chapter.sgml
  Log:
  Kapitel 12.7 von Nornagest uebersetzt.
  
  Revision Changes Path
  1.6 +162 -184 de-docproj/books/developers-handbook/x86/chapter.sgml
  
  Index: chapter.sgml
  ===================================================================
  RCS file: /home/cvs/de-docproj/books/developers-handbook/x86/chapter.sgml,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -I$FreeBSDde.*$ -r1.5 -r1.6
  --- chapter.sgml 8 Aug 2007 17:33:32 -0000 1.5
  +++ chapter.sgml 13 Aug 2007 13:47:22 -0000 1.6
  @@ -402,7 +402,7 @@
     <sect1 id="x86-portable-code">
       <title>Portablen Code erzeugen</title>
   
  - <para>Portabilit&auml;t ist im Allgemeinen keine Stärke der
  + <para>Portabilit&auml;t ist im Allgemeinen keine St&auml;rke der
         Assembler-Programmierung. Dennoch ist es, besonders mit
         <application>nasm</application>, m&ouml;glich
         Assembler-Programme f&uuml;r verschiedene Plattformen zu
  @@ -699,7 +699,7 @@
         Zeichenkette "Hello, World!", gefolgt von einem Zeilenumbruch
         (<constant>0Ah</constant>). Zeile 5 erstellt eine Konstante, die
         die L&auml;nge der Zeichenkette aus Zeile 4 in Bytes
  - enthält.</para>
  + enth&auml;lt.</para>
   
       <para>Die Zeilen 7 bis 16 enth&auml;lten den Code. Beachten Sie
         bitte, dass FreeBSD das Dateiformat <emphasis>elf</emphasis>
  @@ -784,25 +784,21 @@
       </sect2>
     </sect1>
   
  -<sect1 id="x86-unix-filters">
  -<title>Writing &unix; Filters</title>
  + <sect1 id="x86-unix-filters">
  + <title>&unix;-Filter schreiben</title>
   
  -<para>
  -A common type of &unix; application is a filter&mdash;a program
  -that reads data from the <filename>stdin</filename>, processes it
  -somehow, then writes the result to <filename>stdout</filename>.
  -</para>
  + <para>Ein h&auml;ufiger Typ von &unix;-Anwendungen ist ein Filter
  + &mdash; ein Programm, das Eingaben von
  + <filename>stdin</filename> liest, sie verarbeitet und das
  + Ergebnis nach <filename>stdout</filename> schreibt.</para>
  +
  + <para>In diesem Kapitel m&ouml;chten wir einen einfachen Filter
  + entwickeln und lernen, wie wir von <filename>stdin</filename>
  + lesen und nach <filename>stdout</filename> schreiben. Dieser
  + Filter soll jedes Byte seiner Eingabe in eine hexadezimale Zahl
  + gefolgt von einem Leerzeichen umwandeln.</para>
   
  -<para>
  -In this chapter, we shall develop a simple filter, and
  -learn how to read from <filename>stdin</filename> and write to
  -<filename>stdout</filename>. This filter will convert each byte
  -of its input into a hexadecimal number followed by a
  -blank space.
  -</para>
  -
  -<programlisting>
  -%include 'system.inc'
  + <programlisting>%include 'system.inc'
   
   section .data
   hex db '0123456789ABCDEF'
  @@ -840,102 +836,93 @@
   
   .done:
           push dword 0
  - sys.exit
  -</programlisting>
  -<para>
  -In the data section we create an array called <varname>hex</varname>.
  -It contains the 16 hexadecimal digits in ascending order.
  -The array is followed by a buffer which we will use for
  -both input and output. The first two bytes of the buffer
  -are initially set to <constant>0</constant>. This is where we will write
  -the two hexadecimal digits (the first byte also is
  -where we will read the input). The third byte is a
  -space.
  -</para>
  -
  -<para>
  -The code section consists of four parts: Reading the byte,
  -converting it to a hexadecimal number, writing the result,
  -and eventually exiting the program.
  -</para>
  -
  -<para>
  -To read the byte, we ask the system to read one byte
  -from <filename>stdin</filename>, and store it in the first byte
  -of the <varname>buffer</varname>. The system returns the number
  -of bytes read in <varname role="register">EAX</varname>. This will be <constant>1</constant>
  -while data is coming, or <constant>0</constant>, when no more input
  -data is available. Therefore, we check the value of
  -<varname role="register">EAX</varname>. If it is <constant>0</constant>,
  -we jump to <varname>.done</varname>, otherwise we continue.
  -</para>
  -
  -<note>
  -<para>
  -For simplicity sake, we are ignoring the possibility
  -of an error condition at this time.
  -</para>
  -</note>
  + sys.exit</programlisting>
   
  -<para>
  -The hexadecimal conversion reads the byte from the
  -<varname>buffer</varname> into <varname role="register">EAX</varname>, or actually just
  -<varname role="register">AL</varname>, while clearing the remaining bits of
  -<varname role="register">EAX</varname> to zeros. We also copy the byte to
  -<varname role="register">EDX</varname> because we need to convert the upper
  -four bits (nibble) separately from the lower
  -four bits. We store the result in the first two
  -bytes of the buffer.
  -</para>
  + <para>Im Datenabschnitt erzeugen wir ein Array mit Namen
  + <varname>hex</varname>. Es enth&auml;lt die 16 hexadezimalen
  + Ziffern in aufsteigender Reihenfolge. Diesem Array folgt ein
  + Puffer, den wir sowohl f&uuml;r die Ein- als auch f&uuml;r die
  + Ausgabe verwenden. Die ersten beiden Bytes dieses Puffers werden
  + am Anfang auf <constant>0</constant> gesetzt. Dorthin schreiben
  + wir die beiden hexadezimalen Ziffern (das erste Byte ist auch
  + die Stelle an die wir die Eingabe lesen). Das dritte Byte ist
  + ein Leerzeichen.</para>
  +
  + <para>Der Code-Abschnitt besteht aus vier Teilen: Das Byte lesen,
  + es in eine hexadezimale Zahl umwandeln, das Ergebnis schreiben
  + und letztendlich das Programm verlassen.</para>
  +
  + <para>Um das Byte zu lesen, bitten wir das System ein Byte von
  + <filename>stdin</filename> zu lesen und speichern es im ersten
  + Byte von <varname>buffer</varname>. Das System gibt die Anzahl
  + an Bytes, die gelesen wurden, in <varname
  + role="register">EAX</varname> zur&uuml;ck. Diese wird
  + <constant>1</constant> sein, wenn eine Eingabe empfangen wird
  + und <constant>0</constant>, wenn keine Eingabedaten mehr
  + verf&uuml;gbar sind. Deshalb &uuml;berpr&uuml;fen wir den Wert
  + von <varname role="register">EAX</varname>. Wenn dieser
  + <constant>0</constant> ist, springen wir zu
  + <varname>.done</varname>, ansonsten fahren wir fort.</para>
   
  -<para>
  -Next, we ask the system to write the three bytes
  -of the buffer, i.e., the two hexadecimal digits and
  -the blank space, to <filename>stdout</filename>. We then
  -jump back to the beginning of the program and
  -process the next byte.
  -</para>
  + <note>
  + <para>Zu Gunsten der Einfachheit ignorieren wir hier die
  + M&ouml;glichkeit eines Fehlers.</para>
  + </note>
   
  -<para>
  -Once there is no more input left, we ask the system
  -to exit our program, returning a zero, which is
  -the traditional value meaning the program was
  -successful.
  -</para>
  + <para>Die Umwandlungsroutine in eine Hexadezimalzahl liest das
  + Byte aus <varname>buffer</varname> in <varname
  + role="register">EAX</varname>, oder genaugenommen nur in
  + <varname role="register">AL</varname>, wobei die &uuml;brigen
  + Bits von <varname role="register">EAX</varname> auf null gesetzt
  + werden. Au&szlig;erdem kopieren wir das Byte nach <varname
  + role="register">EDX</varname>, da wir die oberen vier Bits
  + (Nibble) getrennt von den unteren vier Bits umwandeln
  + m&uuml;ssen. Das Ergebnis speichern wir in den ersten beiden
  + Bytes des Puffers.</para>
  +
  + <para>Als N&auml;chstes bitten wir das System die drei Bytes in
  + den Puffer zu schreiben, also die zwei hexadezimalen Ziffern und
  + das Leerzeichen nach <filename>stdout</filename>. Danach
  + springen wir wieder an den Anfang des Programms und verarbeiten
  + das n&auml;chste Byte.</para>
  +
  + <para>Wenn die gesamte Eingabe verarbeitet ist, bitten wie das
  + System unser Programm zu beenden und null zur&uuml;ckzuliefern,
  + welches traditionell die Bedeutung hat, dass unser Programm
  + erfolgreich war.</para>
  +
  + <para>Fahren Sie fort und speichern Sie den Code in eine Datei
  + namens <filename>hex.asm</filename>. Geben Sie danach folgendes
  + ein (<userinput>^D</userinput> bedeutet, dass Sie die
  + Steuerungstaste dr&uuml;cken und dann <userinput>D</userinput>
  + eingeben, w&auml;hrend Sie Steuerung gedr&uuml;ckt
  + halten):</para>
   
  -<para>
  -Go ahead, and save the code in a file named <filename>hex.asm</filename>,
  -then type the following (the <userinput>^D</userinput> means press the
  -control key and type <userinput>D</userinput> while holding the
  -control key down):
  -</para>
  -
  -<screen>&prompt.user; <userinput>nasm -f elf hex.asm</userinput>
  + <screen>&prompt.user; <userinput>nasm -f elf hex.asm</userinput>
   &prompt.user; <userinput>ld -s -o hex hex.o</userinput>

----------------------------------------------
Diff block truncated. (Max lines = 200)
----------------------------------------------

To Unsubscribe: send mail to majordomo(at)de.FreeBSD.org
with "unsubscribe de-cvs-doc" in the body of the message
Received on Mon 13 Aug 2007 - 15:49:05 CEST

search this site