From fdab2c3455cbb38fecf8e506fecd71eabd1a7589 Mon Sep 17 00:00:00 2001 From: Mitchell Horne Date: Tue, 19 May 2026 11:17:02 -0300 Subject: [PATCH] x86-assembly: generate/update .po files Following the move of this chapter to a separate article. I ran `tools/update_translate_template.sh` and discarded the irrelevant changes. Discussed with: ziaee, carlavilla Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D56430 --- .../x86 => articles/x86-assembly}/_index.po | 2405 ++++++++--------- .../en/books/developers-handbook/partiv.po | 6 +- 2 files changed, 1184 insertions(+), 1227 deletions(-) rename documentation/content/en/{books/developers-handbook/x86 => articles/x86-assembly}/_index.po (65%) diff --git a/documentation/content/en/books/developers-handbook/x86/_index.po b/documentation/content/en/articles/x86-assembly/_index.po similarity index 65% rename from documentation/content/en/books/developers-handbook/x86/_index.po rename to documentation/content/en/articles/x86-assembly/_index.po index 6adffa071b..bd310c6c2f 100644 --- a/documentation/content/en/books/developers-handbook/x86/_index.po +++ b/documentation/content/en/articles/x86-assembly/_index.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: FreeBSD Documentation VERSION\n" -"POT-Creation-Date: 2025-11-08 16:17+0000\n" +"POT-Creation-Date: 2026-05-19 11:05-0300\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -16,159 +16,167 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" +#. type: YAML Front Matter: description +#: documentation/content/en/articles/x86-assembly/_index.adoc:1 +#, no-wrap +msgid "A tutorial on writing programs for FreeBSD in x86 assembly language" +msgstr "" + #. type: Title = -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:15 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1 +#: documentation/content/en/articles/x86-assembly/_index.adoc:11 #, no-wrap msgid "x86 Assembly Language Programming" msgstr "" -#. type: YAML Front Matter: title -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1 -#, no-wrap -msgid "Chapter 11. x86 Assembly Language Programming" +#. type: Plain text +#: documentation/content/en/articles/x86-assembly/_index.adoc:46 +msgid "" +"_This article was written by {stanislav} (2001), and adjusted by {mhorne} " +"(2026)._" msgstr "" -#. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:53 -msgid "_This chapter was written by {stanislav}._" +#. type: delimited block = 4 +#: documentation/content/en/articles/x86-assembly/_index.adoc:50 +msgid "The content in this article is historical." msgstr "" #. type: Title == -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:55 +#: documentation/content/en/articles/x86-assembly/_index.adoc:53 #, no-wrap msgid "Synopsis" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:59 +#: documentation/content/en/articles/x86-assembly/_index.adoc:57 msgid "" "Assembly language programming under UNIX(R) is highly undocumented. It is " -"generally assumed that no one would ever want to use it because various " -"UNIX(R) systems run on different microprocessors, so everything should be " -"written in C for portability." +"generally assumed that no one would ever want to use it because various UNIX " +"systems run on different microprocessors, so everything should be written in " +"C for portability." msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:63 +#: documentation/content/en/articles/x86-assembly/_index.adoc:61 msgid "" "In reality, C portability is quite a myth. Even C programs need to be " -"modified when ported from one UNIX(R) to another, regardless of what " -"processor each runs on. Typically, such a program is full of conditional " -"statements depending on the system it is compiled for." +"modified when ported from one UNIX to another, regardless of what processor " +"each runs on. Typically, such a program is full of conditional statements " +"depending on the system it is compiled for." msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:65 +#: documentation/content/en/articles/x86-assembly/_index.adoc:63 msgid "" -"Even if we believe that all of UNIX(R) software should be written in C, or " -"some other high-level language, we still need assembly language programmers: " -"Who else would write the section of C library that accesses the kernel?" +"Even if we believe that all of UNIX software should be written in C, or some " +"other high-level language, we still need assembly language programmers: Who " +"else would write the section of C library that accesses the kernel?" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:67 +#: documentation/content/en/articles/x86-assembly/_index.adoc:65 msgid "" -"In this chapter I will attempt to show you how you can use assembly language " -"writing UNIX(R) programs, specifically under FreeBSD." +"In this article I will attempt to show you how you can use assembly language " +"writing UNIX programs, specifically under FreeBSD." msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:72 +#: documentation/content/en/articles/x86-assembly/_index.adoc:70 msgid "" -"This chapter does not explain the basics of assembly language. There are " +"This article does not explain the basics of assembly language. There are " "enough resources about that (for a complete online course in assembly " "language, see Randall Hyde's http://webster.cs.ucr.edu/[Art of Assembly " "Language]; or if you prefer a printed book, take a look at Jeff Duntemann's " "Assembly Language Step-by-Step (ISBN: 0471375233). However, once the " -"chapter is finished, any assembly language programmer will be able to write " +"article is finished, any assembly language programmer will be able to write " "programs for FreeBSD quickly and efficiently." msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:74 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:4311 +#: documentation/content/en/articles/x86-assembly/_index.adoc:72 +#: documentation/content/en/articles/x86-assembly/_index.adoc:4287 msgid "Copyright (R) 2000-2001 G. Adam Stanislav. All rights reserved." msgstr "" #. type: Title == -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:76 +#: documentation/content/en/articles/x86-assembly/_index.adoc:74 #, no-wrap msgid "The Tools" msgstr "" #. type: Title === -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:79 +#: documentation/content/en/articles/x86-assembly/_index.adoc:77 #, no-wrap msgid "The Assembler" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:82 +#: documentation/content/en/articles/x86-assembly/_index.adoc:81 msgid "" "The most important tool for assembly language programming is the assembler, " -"the software that converts assembly language code into machine language." +"the software that converts assembly language code into machine language. " +"Two very different types of assemblers are available for FreeBSD." msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:85 +#: documentation/content/en/articles/x86-assembly/_index.adoc:84 msgid "" -"Three very different assemblers are available for FreeBSD. Both man:llvm-" -"as[1] (included in package:devel/llvm[]) and man:as[1] (included in " -"package:devel/binutils[]) use the traditional UNIX(R) assembly language " -"syntax." +"The first is the GNU man:as[1] (package:devel/binutils[]), which uses the " +"traditional UNIX assembly language syntax. Alternatively, one can use " +"man:clang[1], which is a compatible replacement for the GNU assembler and " +"comes with the system." msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:88 +#: documentation/content/en/articles/x86-assembly/_index.adoc:87 msgid "" -"On the other hand, man:nasm[1] (installed through package:devel/nasm[]) uses " -"the Intel syntax. Its main advantage is that it can assemble code for many " +"The other is man:nasm[1] (package:devel/nasm[]). This assembler uses the " +"Intel syntax, and its main advantage is that it can assemble code for many " "operating systems." msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:91 +#: documentation/content/en/articles/x86-assembly/_index.adoc:90 msgid "" -"This chapter uses nasm syntax because most assembly language programmers " +"This article uses nasm syntax because most assembly language programmers " "coming to FreeBSD from other operating systems will find it easier to " "understand. And, because, quite frankly, that is what I am used to." msgstr "" #. type: Title === -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:93 +#: documentation/content/en/articles/x86-assembly/_index.adoc:92 #, no-wrap msgid "The Linker" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:96 +#: documentation/content/en/articles/x86-assembly/_index.adoc:95 msgid "" "The output of the assembler, like that of any compiler, needs to be linked " "to form an executable file." msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:99 +#: documentation/content/en/articles/x86-assembly/_index.adoc:98 msgid "" "The standard man:ld[1] linker comes with FreeBSD. It works with the code " "assembled with either assembler." msgstr "" #. type: Title == -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:101 +#: documentation/content/en/articles/x86-assembly/_index.adoc:100 #, no-wrap msgid "System Calls" msgstr "" #. type: Title === -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:104 +#: documentation/content/en/articles/x86-assembly/_index.adoc:103 #, no-wrap msgid "Default Calling Convention" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:108 +#: documentation/content/en/articles/x86-assembly/_index.adoc:107 msgid "" "By default, the FreeBSD kernel uses the C calling convention. Further, " "although the kernel is accessed using `int 80h`, it is assumed the program " @@ -177,22 +185,22 @@ msgid "" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:111 +#: documentation/content/en/articles/x86-assembly/_index.adoc:110 msgid "" "This convention is very convenient, and quite superior to the Microsoft(R) " -"convention used by MS-DOS(R). Why? Because the UNIX(R) convention allows " -"any program written in any language to access the kernel." +"convention used by MS-DOS(R). Why? Because the UNIX convention allows any " +"program written in any language to access the kernel." msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:114 +#: documentation/content/en/articles/x86-assembly/_index.adoc:113 msgid "" "An assembly language program can do that as well. For example, we could " "open a file:" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:120 +#: documentation/content/en/articles/x86-assembly/_index.adoc:119 #, no-wrap msgid "" "kernel:\n" @@ -201,7 +209,7 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:129 +#: documentation/content/en/articles/x86-assembly/_index.adoc:128 #, no-wrap msgid "" "open:\n" @@ -215,15 +223,15 @@ msgid "" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:133 +#: documentation/content/en/articles/x86-assembly/_index.adoc:132 msgid "" "This is a very clean and portable way of coding. If you need to port the " -"code to a UNIX(R) system which uses a different interrupt, or a different " -"way of passing parameters, all you need to change is the kernel procedure." +"code to a UNIX system which uses a different interrupt, or a different way " +"of passing parameters, all you need to change is the kernel procedure." msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:137 +#: documentation/content/en/articles/x86-assembly/_index.adoc:136 msgid "" "But assembly language programmers like to shave off cycles. The above " "example requires a `call/ret` combination. We can eliminate it by " @@ -231,7 +239,7 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:148 +#: documentation/content/en/articles/x86-assembly/_index.adoc:147 #, no-wrap msgid "" "open:\n" @@ -245,38 +253,37 @@ msgid "" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:151 +#: documentation/content/en/articles/x86-assembly/_index.adoc:150 msgid "" "The `5` that we have placed in `EAX` identifies the kernel function, in this " "case `open`." msgstr "" #. type: Title === -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:153 +#: documentation/content/en/articles/x86-assembly/_index.adoc:152 #, no-wrap msgid "Alternate Calling Convention" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:158 +#: documentation/content/en/articles/x86-assembly/_index.adoc:157 msgid "" "FreeBSD is an extremely flexible system. It offers other ways of calling " -"the kernel. For it to work, however, the system must have Linux emulation " -"installed." +"the kernel. For it to work, however, the system must have Linux(R) " +"emulation installed." msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:163 +#: documentation/content/en/articles/x86-assembly/_index.adoc:162 msgid "" -"Linux is a UNIX(R) like system. However, its kernel uses the same system-" -"call convention of passing parameters in registers MS-DOS(R) does. As with " -"the UNIX(R) convention, the function number is placed in `EAX`. The " -"parameters, however, are not passed on the stack but in `EBX, ECX, EDX, ESI, " -"EDI, EBP`:" +"Linux is a UNIX-like system. However, its kernel uses the same system-call " +"convention of passing parameters in registers MS-DOS does. As with the UNIX " +"convention, the function number is placed in `EAX`. The parameters, " +"however, are not passed on the stack but in `EBX, ECX, EDX, ESI, EDI, EBP`:" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:172 +#: documentation/content/en/articles/x86-assembly/_index.adoc:171 #, no-wrap msgid "" "open:\n" @@ -288,7 +295,7 @@ msgid "" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:178 +#: documentation/content/en/articles/x86-assembly/_index.adoc:177 msgid "" "This convention has a great disadvantage over the UNIX(R) way, at least as " "far as assembly language programming is concerned: Every time you make a " @@ -298,7 +305,7 @@ msgid "" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:181 +#: documentation/content/en/articles/x86-assembly/_index.adoc:180 msgid "" "If you do choose the Linux convention, you must let the system know about " "it. After your program is assembled and linked, you need to brand the " @@ -306,28 +313,28 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:185 +#: documentation/content/en/articles/x86-assembly/_index.adoc:184 #, no-wrap msgid "% brandelf -t Linux filename\n" msgstr "" #. type: Title === -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:188 +#: documentation/content/en/articles/x86-assembly/_index.adoc:187 #, no-wrap msgid "Which Convention Should You Use?" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:193 +#: documentation/content/en/articles/x86-assembly/_index.adoc:192 msgid "" -"If you are coding specifically for FreeBSD, you should always use the " -"UNIX(R) convention: It is faster, you can store global variables in " -"registers, you do not have to brand the executable, and you do not impose " -"the installation of the Linux emulation package on the target system." +"If you are coding specifically for FreeBSD, you should always use the UNIX " +"convention: It is faster, you can store global variables in registers, you " +"do not have to brand the executable, and you do not impose the installation " +"of the Linux emulation package on the target system." msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:196 +#: documentation/content/en/articles/x86-assembly/_index.adoc:195 msgid "" "If you want to create portable code that can also run on Linux, you will " "probably still want to give the FreeBSD users as efficient a code as " @@ -336,26 +343,26 @@ msgid "" msgstr "" #. type: Title === -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:198 +#: documentation/content/en/articles/x86-assembly/_index.adoc:197 #, no-wrap msgid "Call Numbers" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:202 +#: documentation/content/en/articles/x86-assembly/_index.adoc:201 msgid "" "To tell the kernel which system service you are calling, place its number in " "`EAX`. Of course, you need to know what the number is." msgstr "" #. type: Title ==== -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:204 +#: documentation/content/en/articles/x86-assembly/_index.adoc:203 #, no-wrap msgid "The [.filename]#syscalls# File" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:208 +#: documentation/content/en/articles/x86-assembly/_index.adoc:207 msgid "" "The numbers are listed in [.filename]#syscalls#. `locate syscalls` finds " "this file in several different formats, all produced automatically from " @@ -363,28 +370,28 @@ msgid "" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:211 +#: documentation/content/en/articles/x86-assembly/_index.adoc:210 msgid "" -"You can find the master file for the default UNIX(R) calling convention in " +"You can find the master file for the default UNIX calling convention in " "[.filename]#/usr/src/sys/kern/syscalls.master#. If you need to use the " "other convention implemented in the Linux emulation mode, read [.filename]#/" "usr/src/sys/i386/linux/syscalls.master#." msgstr "" #. type: delimited block = 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:215 +#: documentation/content/en/articles/x86-assembly/_index.adoc:214 msgid "" "Not only do FreeBSD and Linux use different calling conventions, they " "sometimes use different numbers for the same functions." msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:218 +#: documentation/content/en/articles/x86-assembly/_index.adoc:217 msgid "[.filename]#syscalls.master# describes how the call is to be made:" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:229 +#: documentation/content/en/articles/x86-assembly/_index.adoc:228 #, no-wrap msgid "" "0\tSTD\tNOHIDE\t{ int nosys(void); } syscall nosys_args int\n" @@ -398,32 +405,32 @@ msgid "" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:232 +#: documentation/content/en/articles/x86-assembly/_index.adoc:231 msgid "It is the leftmost column that tells us the number to place in `EAX`." msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:235 +#: documentation/content/en/articles/x86-assembly/_index.adoc:234 msgid "" "The rightmost column tells us what parameters to `push`. They are " "``push``ed _from right to left_." msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:237 +#: documentation/content/en/articles/x86-assembly/_index.adoc:236 msgid "" "For example, to `open` a file, we need to `push` the `mode` first, then " "`flags`, then the address at which the `path` is stored." msgstr "" #. type: Title == -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:239 +#: documentation/content/en/articles/x86-assembly/_index.adoc:238 #, no-wrap msgid "Return Values" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:243 +#: documentation/content/en/articles/x86-assembly/_index.adoc:242 msgid "" "A system call would not be useful most of the time if it did not return some " "kind of a value: The file descriptor of an open file, the number of bytes " @@ -431,7 +438,7 @@ msgid "" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:246 +#: documentation/content/en/articles/x86-assembly/_index.adoc:245 msgid "" "Additionally, the system needs to inform us if an error occurs: A file does " "not exist, system resources are exhausted, we passed an invalid parameter, " @@ -439,26 +446,26 @@ msgid "" msgstr "" #. type: Title === -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:248 +#: documentation/content/en/articles/x86-assembly/_index.adoc:247 #, no-wrap msgid "Man Pages" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:252 +#: documentation/content/en/articles/x86-assembly/_index.adoc:251 msgid "" "The traditional place to look for information about various system calls " -"under UNIX(R) systems are the manual pages. FreeBSD describes its system " -"calls in section 2, sometimes in section 3." +"under UNIX systems are the manual pages. FreeBSD describes its system calls " +"in section 2, sometimes in section 3." msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:254 +#: documentation/content/en/articles/x86-assembly/_index.adoc:253 msgid "For example, man:open[2] says:" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:258 +#: documentation/content/en/articles/x86-assembly/_index.adoc:257 msgid "" "If successful, `open()` returns a non-negative integer, termed a file " "descriptor. It returns `-1` on failure, and sets `errno` to indicate the " @@ -466,27 +473,27 @@ msgid "" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:260 +#: documentation/content/en/articles/x86-assembly/_index.adoc:259 msgid "" -"The assembly language programmer new to UNIX(R) and FreeBSD will immediately " +"The assembly language programmer new to UNIX and FreeBSD will immediately " "ask the puzzling question: Where is `errno` and how do I get to it?" msgstr "" #. type: delimited block = 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:265 +#: documentation/content/en/articles/x86-assembly/_index.adoc:264 msgid "" "The information presented in the manual pages applies to C programs. The " "assembly language programmer needs additional information." msgstr "" #. type: Title === -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:268 +#: documentation/content/en/articles/x86-assembly/_index.adoc:267 #, no-wrap msgid "Where Are the Return Values?" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:273 +#: documentation/content/en/articles/x86-assembly/_index.adoc:272 msgid "" "Unfortunately, it depends... For most system calls it is in `EAX`, but not " "for all. A good rule of thumb, when working with a system call for the " @@ -495,7 +502,7 @@ msgid "" msgstr "" #. type: delimited block = 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:279 +#: documentation/content/en/articles/x86-assembly/_index.adoc:278 msgid "" "I am aware of one system call that returns the value in `EDX`: `SYS_fork`. " "All others I have worked with use `EAX`. But I have not worked with them " @@ -503,33 +510,33 @@ msgid "" msgstr "" #. type: delimited block = 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:284 +#: documentation/content/en/articles/x86-assembly/_index.adoc:283 msgid "" "If you cannot find the answer here or anywhere else, study libc source code " "and see how it interfaces with the kernel." msgstr "" #. type: Title === -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:287 +#: documentation/content/en/articles/x86-assembly/_index.adoc:286 #, no-wrap msgid "Where Is `errno`?" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:290 +#: documentation/content/en/articles/x86-assembly/_index.adoc:289 msgid "Actually, nowhere..." msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:293 +#: documentation/content/en/articles/x86-assembly/_index.adoc:292 msgid "" -"`errno` is part of the C language, not the UNIX(R) kernel. When accessing " +"`errno` is part of the C language, not the UNIX kernel. When accessing " "kernel services directly, the error code is returned in `EAX`, the same " "register the proper return value generally ends up in." msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:297 +#: documentation/content/en/articles/x86-assembly/_index.adoc:296 msgid "" "This makes perfect sense. If there is no error, there is no error code. If " "there is an error, there is no return value. One register can contain " @@ -537,20 +544,20 @@ msgid "" msgstr "" #. type: Title === -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:299 +#: documentation/content/en/articles/x86-assembly/_index.adoc:298 #, no-wrap msgid "Determining an Error Occurred" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:302 +#: documentation/content/en/articles/x86-assembly/_index.adoc:301 msgid "" "When using the standard FreeBSD calling convention, the `carry flag` is " "cleared upon success, set upon failure." msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:305 +#: documentation/content/en/articles/x86-assembly/_index.adoc:304 msgid "" "When using the Linux emulation mode, the signed value in `EAX` is non-" "negative upon success, and contains the return value. In case of an error, " @@ -558,13 +565,13 @@ msgid "" msgstr "" #. type: Title == -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:307 +#: documentation/content/en/articles/x86-assembly/_index.adoc:306 #, no-wrap msgid "Creating Portable Code" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:312 +#: documentation/content/en/articles/x86-assembly/_index.adoc:311 msgid "" "Portability is generally not one of the strengths of assembly language. " "Yet, writing assembly language programs for different platforms is possible, " @@ -573,29 +580,29 @@ msgid "" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:314 +#: documentation/content/en/articles/x86-assembly/_index.adoc:313 msgid "" "It is all the more possible when you want your code to run on two platforms " "which, while different, are based on similar architectures." msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:318 +#: documentation/content/en/articles/x86-assembly/_index.adoc:317 msgid "" -"For example, FreeBSD is UNIX(R), Linux is UNIX(R) like. I only mentioned " -"three differences between them (from an assembly language programmer's " +"For example, FreeBSD is UNIX, Linux is UNIX-like. I only mentioned three " +"differences between them (from an assembly language programmer's " "perspective): The calling convention, the function numbers, and the way of " "returning values." msgstr "" #. type: Title === -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:320 +#: documentation/content/en/articles/x86-assembly/_index.adoc:319 #, no-wrap msgid "Dealing with Function Numbers" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:325 +#: documentation/content/en/articles/x86-assembly/_index.adoc:324 msgid "" "In many cases the function numbers are the same. However, even when they " "are not, the problem is easy to deal with: Instead of using numbers in your " @@ -604,7 +611,7 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:333 +#: documentation/content/en/articles/x86-assembly/_index.adoc:332 #, no-wrap msgid "" "%ifdef\tLINUX\n" @@ -615,26 +622,26 @@ msgid "" msgstr "" #. type: Title === -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:336 +#: documentation/content/en/articles/x86-assembly/_index.adoc:335 #, no-wrap msgid "Dealing with Conventions" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:339 +#: documentation/content/en/articles/x86-assembly/_index.adoc:338 msgid "" "Both, the calling convention, and the return value (the `errno` problem) can " "be resolved with macros:" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:343 +#: documentation/content/en/articles/x86-assembly/_index.adoc:342 #, no-wrap msgid "%ifdef\tLINUX\n" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:347 +#: documentation/content/en/articles/x86-assembly/_index.adoc:346 #, no-wrap msgid "" "%macro\tsystem\t0\n" @@ -643,7 +650,7 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:356 +#: documentation/content/en/articles/x86-assembly/_index.adoc:355 #, no-wrap msgid "" "align 4\n" @@ -657,7 +664,7 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:363 +#: documentation/content/en/articles/x86-assembly/_index.adoc:362 #, no-wrap msgid "" "\tmov\tebx, [esp+32]\n" @@ -669,7 +676,7 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:370 +#: documentation/content/en/articles/x86-assembly/_index.adoc:369 #, no-wrap msgid "" "\tpop\tebp\n" @@ -681,7 +688,7 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:375 +#: documentation/content/en/articles/x86-assembly/_index.adoc:374 #, no-wrap msgid "" "\tor\teax, eax\n" @@ -691,7 +698,7 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:380 +#: documentation/content/en/articles/x86-assembly/_index.adoc:379 #, no-wrap msgid "" ".errno:\n" @@ -701,13 +708,13 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:382 +#: documentation/content/en/articles/x86-assembly/_index.adoc:381 #, no-wrap msgid "%else\n" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:386 +#: documentation/content/en/articles/x86-assembly/_index.adoc:385 #, no-wrap msgid "" "%macro\tsystem\t0\n" @@ -716,19 +723,19 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:388 +#: documentation/content/en/articles/x86-assembly/_index.adoc:387 #, no-wrap msgid "%endif\n" msgstr "" #. type: Title === -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:391 +#: documentation/content/en/articles/x86-assembly/_index.adoc:390 #, no-wrap msgid "Dealing with Other Portability Issues" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:395 +#: documentation/content/en/articles/x86-assembly/_index.adoc:394 msgid "" "The above solutions can handle most cases of writing code portable between " "FreeBSD and Linux. Nevertheless, with some kernel services the differences " @@ -736,7 +743,7 @@ msgid "" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:398 +#: documentation/content/en/articles/x86-assembly/_index.adoc:397 msgid "" "In that case, you need to write two different handlers for those particular " "system calls, and use conditional assembly. Luckily, most of your code does " @@ -745,13 +752,13 @@ msgid "" msgstr "" #. type: Title === -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:400 +#: documentation/content/en/articles/x86-assembly/_index.adoc:399 #, no-wrap msgid "Using a Library" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:404 +#: documentation/content/en/articles/x86-assembly/_index.adoc:403 msgid "" "You can avoid portability issues in your main code altogether by writing a " "library of system calls. Create a separate library for FreeBSD, a different " @@ -759,7 +766,7 @@ msgid "" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:409 +#: documentation/content/en/articles/x86-assembly/_index.adoc:408 msgid "" "In your library, write a separate function (or procedure, if you prefer the " "traditional assembly language terminology) for each system call. Use the C " @@ -769,7 +776,7 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:417 +#: documentation/content/en/articles/x86-assembly/_index.adoc:416 #, no-wrap msgid "" "sys.open:\n" @@ -780,14 +787,14 @@ msgid "" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:421 +#: documentation/content/en/articles/x86-assembly/_index.adoc:420 msgid "" "Your Linux library will require more different functions. But even here you " "can group system calls using the same number of parameters:" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:432 +#: documentation/content/en/articles/x86-assembly/_index.adoc:431 #, no-wrap msgid "" "sys.exit:\n" @@ -801,13 +808,13 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:434 +#: documentation/content/en/articles/x86-assembly/_index.adoc:433 #, no-wrap msgid "...\n" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:440 +#: documentation/content/en/articles/x86-assembly/_index.adoc:439 #, no-wrap msgid "" "sys.return:\n" @@ -818,7 +825,7 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:445 +#: documentation/content/en/articles/x86-assembly/_index.adoc:444 #, no-wrap msgid "" "sys.err:\n" @@ -828,7 +835,7 @@ msgid "" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:452 +#: documentation/content/en/articles/x86-assembly/_index.adoc:451 msgid "" "The library approach may seem inconvenient at first because it requires you " "to produce a separate file your code depends on. But it has many " @@ -841,7 +848,7 @@ msgid "" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:454 +#: documentation/content/en/articles/x86-assembly/_index.adoc:453 msgid "" "If you do not like the idea of having a library, you can at least place all " "your system calls in a separate assembly language file and link it with your " @@ -850,20 +857,20 @@ msgid "" msgstr "" #. type: Title === -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:456 +#: documentation/content/en/articles/x86-assembly/_index.adoc:455 #, no-wrap msgid "Using an Include File" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:459 +#: documentation/content/en/articles/x86-assembly/_index.adoc:458 msgid "" "If you are releasing your software as (or with) source code, you can use " "macros and place them in a separate file, which you include in your code." msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:462 +#: documentation/content/en/articles/x86-assembly/_index.adoc:461 msgid "" "Porters of your software will simply write a new include file. No library " "or external object file is necessary, yet your code is portable without any " @@ -871,22 +878,22 @@ msgid "" msgstr "" #. type: delimited block = 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:467 +#: documentation/content/en/articles/x86-assembly/_index.adoc:466 msgid "" -"This is the approach we will use throughout this chapter. We will name our " +"This is the approach we will use throughout this article. We will name our " "include file [.filename]#system.inc#, and add to it whenever we deal with a " "new system call." msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:470 +#: documentation/content/en/articles/x86-assembly/_index.adoc:469 msgid "" "We can start our [.filename]#system.inc# by declaring the standard file " "descriptors:" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:476 +#: documentation/content/en/articles/x86-assembly/_index.adoc:475 #, no-wrap msgid "" "%define\tstdin\t0\n" @@ -895,12 +902,12 @@ msgid "" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:479 +#: documentation/content/en/articles/x86-assembly/_index.adoc:478 msgid "Next, we create a symbolic name for each system call:" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:488 +#: documentation/content/en/articles/x86-assembly/_index.adoc:487 #, no-wrap msgid "" "%define\tSYS_nosys\t0\n" @@ -912,14 +919,14 @@ msgid "" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:491 +#: documentation/content/en/articles/x86-assembly/_index.adoc:490 msgid "" "We add a short, non-global procedure with a long name, so we do not " "accidentally reuse the name in our code:" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:499 +#: documentation/content/en/articles/x86-assembly/_index.adoc:498 #, no-wrap msgid "" "section\t.text\n" @@ -930,12 +937,12 @@ msgid "" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:502 +#: documentation/content/en/articles/x86-assembly/_index.adoc:501 msgid "We create a macro which takes one argument, the syscall number:" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:509 +#: documentation/content/en/articles/x86-assembly/_index.adoc:508 #, no-wrap msgid "" "%macro\tsystem\t1\n" @@ -945,13 +952,13 @@ msgid "" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:513 +#: documentation/content/en/articles/x86-assembly/_index.adoc:512 msgid "" "Finally, we create macros for each syscall. These macros take no arguments." msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:519 +#: documentation/content/en/articles/x86-assembly/_index.adoc:518 #, no-wrap msgid "" "%macro\tsys.exit\t0\n" @@ -960,7 +967,7 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:523 +#: documentation/content/en/articles/x86-assembly/_index.adoc:522 #, no-wrap msgid "" "%macro\tsys.fork\t0\n" @@ -969,7 +976,7 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:527 +#: documentation/content/en/articles/x86-assembly/_index.adoc:526 #, no-wrap msgid "" "%macro\tsys.read\t0\n" @@ -978,7 +985,7 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:531 +#: documentation/content/en/articles/x86-assembly/_index.adoc:530 #, no-wrap msgid "" "%macro\tsys.write\t0\n" @@ -987,37 +994,37 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:533 +#: documentation/content/en/articles/x86-assembly/_index.adoc:532 #, no-wrap msgid "; [etc...]\n" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:537 +#: documentation/content/en/articles/x86-assembly/_index.adoc:536 msgid "" "Go ahead, enter it into your editor and save it as [.filename]#system.inc#. " "We will add more to it as we discuss more syscalls." msgstr "" #. type: Title == -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:539 +#: documentation/content/en/articles/x86-assembly/_index.adoc:538 #, no-wrap msgid "Our First Program" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:542 +#: documentation/content/en/articles/x86-assembly/_index.adoc:541 msgid "We are now ready for our first program, the mandatory Hello, World!" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:546 +#: documentation/content/en/articles/x86-assembly/_index.adoc:545 #, no-wrap msgid "\t%include\t'system.inc'\n" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:550 +#: documentation/content/en/articles/x86-assembly/_index.adoc:549 #, no-wrap msgid "" "\tsection\t.data\n" @@ -1026,7 +1033,7 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:558 +#: documentation/content/en/articles/x86-assembly/_index.adoc:557 #, no-wrap msgid "" "\tsection\t.text\n" @@ -1039,7 +1046,7 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:561 +#: documentation/content/en/articles/x86-assembly/_index.adoc:560 #, no-wrap msgid "" "\tpush\tdword 0\n" @@ -1047,14 +1054,14 @@ msgid "" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:564 +#: documentation/content/en/articles/x86-assembly/_index.adoc:563 msgid "" "Here is what it does: Line 1 includes the defines, the macros, and the code " "from [.filename]#system.inc#." msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:568 +#: documentation/content/en/articles/x86-assembly/_index.adoc:567 msgid "" "Lines 3-5 are the data: Line 3 starts the data section/segment. Line 4 " "contains the string \"Hello, World!\" followed by a new line (`0Ah`). Line " @@ -1063,7 +1070,7 @@ msgid "" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:572 +#: documentation/content/en/articles/x86-assembly/_index.adoc:571 msgid "" "Lines 7-16 contain the code. Note that FreeBSD uses the _elf_ file format " "for its executables, which requires every program to start at the point " @@ -1072,96 +1079,50 @@ msgid "" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:574 +#: documentation/content/en/articles/x86-assembly/_index.adoc:573 msgid "" "Lines 10-13 ask the system to write `hbytes` bytes of the `hello` string to " "`stdout`." msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:577 +#: documentation/content/en/articles/x86-assembly/_index.adoc:576 msgid "" "Lines 15-16 ask the system to end the program with the return value of `0`. " "The `SYS_exit` syscall never returns, so the code ends there." msgstr "" #. type: delimited block = 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:585 +#: documentation/content/en/articles/x86-assembly/_index.adoc:584 msgid "" -"If you have come to UNIX(R) from MS-DOS(R) assembly language background, you " -"may be used to writing directly to the video hardware. You will never have " -"to worry about this in FreeBSD, or any other flavor of UNIX(R). As far as " -"you are concerned, you are writing to a file known as [.filename]#stdout#. " -"This can be the video screen, or a telnet terminal, or an actual file, or " -"even the input of another program. Which one it is, is for the system to " -"figure out." +"If you have come to UNIX from MS-DOS assembly language background, you may " +"be used to writing directly to the video hardware. You will never have to " +"worry about this in FreeBSD, or any other flavor of UNIX. As far as you are " +"concerned, you are writing to a file known as [.filename]#stdout#. This can " +"be the video screen, or a telnet terminal, or an actual file, or even the " +"input of another program. Which one it is, is for the system to figure out." msgstr "" #. type: Title === -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:588 +#: documentation/content/en/articles/x86-assembly/_index.adoc:587 #, no-wrap msgid "Assembling the Code" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:592 +#: documentation/content/en/articles/x86-assembly/_index.adoc:591 msgid "" "Type the code in an editor, and save it in a file named " -"[.filename]#hello.asm#. You need nasm to assemble it." -msgstr "" - -#. type: Title ==== -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:594 -#, no-wrap -msgid "Installing nasm" +"[.filename]#hello.asm#. You need package:devel/nasm[] to assemble it." msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:597 -msgid "If you do not have nasm, type:" -msgstr "" - -#. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:606 -#, no-wrap -msgid "" -"% su\n" -"Password:your root password\n" -"# cd /usr/ports/devel/nasm\n" -"# make install\n" -"# exit\n" -"%\n" -msgstr "" - -#. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:609 -msgid "" -"You may type `make install clean` instead of just `make install` if you do " -"not want to keep nasm source code." -msgstr "" - -#. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:611 -msgid "" -"Either way, FreeBSD will automatically download nasm from the Internet, " -"compile it, and install it on your system." -msgstr "" - -#. type: delimited block = 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:616 -msgid "" -"If your system is not FreeBSD, you need to get nasm from its https://" -"sourceforge.net/projects/nasm[home page]. You can still use it to assemble " -"FreeBSD code." -msgstr "" - -#. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:619 +#: documentation/content/en/articles/x86-assembly/_index.adoc:593 msgid "Now you can assemble, link, and run the code:" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:627 +#: documentation/content/en/articles/x86-assembly/_index.adoc:601 #, no-wrap msgid "" "% nasm -f elf hello.asm\n" @@ -1172,21 +1133,21 @@ msgid "" msgstr "" #. type: Title == -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:630 +#: documentation/content/en/articles/x86-assembly/_index.adoc:604 #, no-wrap -msgid "Writing UNIX(R) Filters" +msgid "Writing UNIX Filters" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:633 +#: documentation/content/en/articles/x86-assembly/_index.adoc:607 msgid "" -"A common type of UNIX(R) application is a filter-a program that reads data " -"from the [.filename]#stdin#, processes it somehow, then writes the result to " +"A common type of UNIX application is a filter-a program that reads data from " +"the [.filename]#stdin#, processes it somehow, then writes the result to " "[.filename]#stdout#." msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:636 +#: documentation/content/en/articles/x86-assembly/_index.adoc:610 msgid "" "In this chapter, we shall develop a simple filter, and learn how to read " "from [.filename]#stdin# and write to [.filename]#stdout#. This filter will " @@ -1195,20 +1156,20 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:640 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:734 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:824 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:952 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1219 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2337 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:3335 +#: documentation/content/en/articles/x86-assembly/_index.adoc:614 +#: documentation/content/en/articles/x86-assembly/_index.adoc:708 +#: documentation/content/en/articles/x86-assembly/_index.adoc:798 +#: documentation/content/en/articles/x86-assembly/_index.adoc:926 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1193 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2313 +#: documentation/content/en/articles/x86-assembly/_index.adoc:3311 #, no-wrap msgid "%include\t'system.inc'\n" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:644 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:738 +#: documentation/content/en/articles/x86-assembly/_index.adoc:618 +#: documentation/content/en/articles/x86-assembly/_index.adoc:712 #, no-wrap msgid "" "section\t.data\n" @@ -1217,7 +1178,7 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:656 +#: documentation/content/en/articles/x86-assembly/_index.adoc:630 #, no-wrap msgid "" "section\t.text\n" @@ -1234,7 +1195,7 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:666 +#: documentation/content/en/articles/x86-assembly/_index.adoc:640 #, no-wrap msgid "" "\t; convert it to hex\n" @@ -1249,7 +1210,7 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:674 +#: documentation/content/en/articles/x86-assembly/_index.adoc:648 #, no-wrap msgid "" "\t; print it\n" @@ -1262,8 +1223,8 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:678 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:781 +#: documentation/content/en/articles/x86-assembly/_index.adoc:652 +#: documentation/content/en/articles/x86-assembly/_index.adoc:755 #, no-wrap msgid "" ".done:\n" @@ -1272,7 +1233,7 @@ msgid "" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:686 +#: documentation/content/en/articles/x86-assembly/_index.adoc:660 msgid "" "In the data section we create an array called `hex`. It contains the 16 " "hexadecimal digits in ascending order. The array is followed by a buffer " @@ -1283,14 +1244,14 @@ msgid "" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:688 +#: documentation/content/en/articles/x86-assembly/_index.adoc:662 msgid "" "The code section consists of four parts: Reading the byte, converting it to " "a hexadecimal number, writing the result, and eventually exiting the program." msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:694 +#: documentation/content/en/articles/x86-assembly/_index.adoc:668 msgid "" "To read the byte, we ask the system to read one byte from " "[.filename]#stdin#, and store it in the first byte of the `buffer`. The " @@ -1301,14 +1262,14 @@ msgid "" msgstr "" #. type: delimited block = 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:698 +#: documentation/content/en/articles/x86-assembly/_index.adoc:672 msgid "" "For simplicity sake, we are ignoring the possibility of an error condition " "at this time." msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:703 +#: documentation/content/en/articles/x86-assembly/_index.adoc:677 msgid "" "The hexadecimal conversion reads the byte from the `buffer` into `EAX`, or " "actually just `AL`, while clearing the remaining bits of `EAX` to zeros. We " @@ -1318,7 +1279,7 @@ msgid "" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:706 +#: documentation/content/en/articles/x86-assembly/_index.adoc:680 msgid "" "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#. We then " @@ -1326,7 +1287,7 @@ msgid "" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:708 +#: documentation/content/en/articles/x86-assembly/_index.adoc:682 msgid "" "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 " @@ -1334,7 +1295,7 @@ msgid "" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:710 +#: documentation/content/en/articles/x86-assembly/_index.adoc:684 msgid "" "Go ahead, and save the code in a file named [.filename]#hex.asm#, then type " "the following (the `^D` means press the control key and type `D` while " @@ -1342,7 +1303,7 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:719 +#: documentation/content/en/articles/x86-assembly/_index.adoc:693 #, no-wrap msgid "" "% nasm -f elf hex.asm\n" @@ -1354,16 +1315,15 @@ msgid "" msgstr "" #. type: delimited block = 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:725 +#: documentation/content/en/articles/x86-assembly/_index.adoc:699 msgid "" -"If you are migrating to UNIX(R) from MS-DOS(R), you may be wondering why " -"each line ends with `0A` instead of `0D 0A`. This is because UNIX(R) does " -"not use the cr/lf convention, but a \"new line\" convention, which is `0A` " -"in hexadecimal." +"If you are migrating to UNIX from MS-DOS, you may be wondering why each line " +"ends with `0A` instead of `0D 0A`. This is because UNIX does not use the cr/" +"lf convention, but a \"new line\" convention, which is `0A` in hexadecimal." msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:730 +#: documentation/content/en/articles/x86-assembly/_index.adoc:704 msgid "" "Can we improve this? Well, for one, it is a bit confusing because once we " "have converted a line of text, our input no longer starts at the beginning " @@ -1372,7 +1332,7 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:743 +#: documentation/content/en/articles/x86-assembly/_index.adoc:717 #, no-wrap msgid "" "section\t.text\n" @@ -1382,7 +1342,7 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:753 +#: documentation/content/en/articles/x86-assembly/_index.adoc:727 #, no-wrap msgid "" ".loop:\n" @@ -1397,7 +1357,7 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:760 +#: documentation/content/en/articles/x86-assembly/_index.adoc:734 #, no-wrap msgid "" "\t; convert it to hex\n" @@ -1409,7 +1369,7 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:769 +#: documentation/content/en/articles/x86-assembly/_index.adoc:743 #, no-wrap msgid "" ".hex:\n" @@ -1423,7 +1383,7 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:777 +#: documentation/content/en/articles/x86-assembly/_index.adoc:751 #, no-wrap msgid "" "\t; print it\n" @@ -1436,15 +1396,15 @@ msgid "" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:785 +#: documentation/content/en/articles/x86-assembly/_index.adoc:759 msgid "" "We have stored the space in the `CL` register. We can do this safely " -"because, unlike Microsoft(R) Windows(R), UNIX(R) system calls do not modify " -"the value of any register they do not use to return a value in." +"because, unlike Microsoft Windows, UNIX system calls do not modify the value " +"of any register they do not use to return a value in." msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:789 +#: documentation/content/en/articles/x86-assembly/_index.adoc:763 msgid "" "That means we only need to set `CL` once. We have, therefore, added a new " "label `.loop` and jump to it for the next byte instead of jumping at " @@ -1453,14 +1413,14 @@ msgid "" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:791 +#: documentation/content/en/articles/x86-assembly/_index.adoc:765 msgid "" "Once you have changed [.filename]#hex.asm# to reflect these changes, type:" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:802 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1061 +#: documentation/content/en/articles/x86-assembly/_index.adoc:776 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1035 #, no-wrap msgid "" "% nasm -f elf hex.asm\n" @@ -1474,7 +1434,7 @@ msgid "" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:806 +#: documentation/content/en/articles/x86-assembly/_index.adoc:780 msgid "" "That looks better. But this code is quite inefficient! We are making a " "system call for every single byte twice (once to read it, another time to " @@ -1482,13 +1442,13 @@ msgid "" msgstr "" #. type: Title == -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:808 +#: documentation/content/en/articles/x86-assembly/_index.adoc:782 #, no-wrap msgid "Buffered Input and Output" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:813 +#: documentation/content/en/articles/x86-assembly/_index.adoc:787 msgid "" "We can improve the efficiency of our code by buffering our input and " "output. We create an input buffer and read a whole sequence of bytes at one " @@ -1496,7 +1456,7 @@ msgid "" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:816 +#: documentation/content/en/articles/x86-assembly/_index.adoc:790 msgid "" "We also create an output buffer. We store our output in it until it is " "full. At that time we ask the kernel to write the contents of the buffer to " @@ -1504,7 +1464,7 @@ msgid "" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:820 +#: documentation/content/en/articles/x86-assembly/_index.adoc:794 msgid "" "The program ends when there is no more input. But we still need to ask the " "kernel to write the contents of our output buffer to [.filename]#stdout# one " @@ -1514,18 +1474,18 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:826 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:954 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1221 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2339 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:3337 +#: documentation/content/en/articles/x86-assembly/_index.adoc:800 +#: documentation/content/en/articles/x86-assembly/_index.adoc:928 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1195 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2315 +#: documentation/content/en/articles/x86-assembly/_index.adoc:3313 #, no-wrap msgid "%define\tBUFSIZE\t2048\n" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:829 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:957 +#: documentation/content/en/articles/x86-assembly/_index.adoc:803 +#: documentation/content/en/articles/x86-assembly/_index.adoc:931 #, no-wrap msgid "" "section\t.data\n" @@ -1533,10 +1493,10 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:833 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:961 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1230 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2353 +#: documentation/content/en/articles/x86-assembly/_index.adoc:807 +#: documentation/content/en/articles/x86-assembly/_index.adoc:935 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1204 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2329 #, no-wrap msgid "" "section .bss\n" @@ -1545,8 +1505,8 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:841 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:969 +#: documentation/content/en/articles/x86-assembly/_index.adoc:815 +#: documentation/content/en/articles/x86-assembly/_index.adoc:943 #, no-wrap msgid "" "section\t.text\n" @@ -1559,9 +1519,9 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:845 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:973 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2501 +#: documentation/content/en/articles/x86-assembly/_index.adoc:819 +#: documentation/content/en/articles/x86-assembly/_index.adoc:947 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2477 #, no-wrap msgid "" ".loop:\n" @@ -1570,9 +1530,9 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:851 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:979 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1283 +#: documentation/content/en/articles/x86-assembly/_index.adoc:825 +#: documentation/content/en/articles/x86-assembly/_index.adoc:953 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1257 #, no-wrap msgid "" "\t; convert it to hex\n" @@ -1583,9 +1543,9 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:856 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:984 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1288 +#: documentation/content/en/articles/x86-assembly/_index.adoc:830 +#: documentation/content/en/articles/x86-assembly/_index.adoc:958 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1262 #, no-wrap msgid "" "\tmov\tal, dl\n" @@ -1595,9 +1555,9 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:861 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:989 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1293 +#: documentation/content/en/articles/x86-assembly/_index.adoc:835 +#: documentation/content/en/articles/x86-assembly/_index.adoc:963 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1267 #, no-wrap msgid "" "\tmov\tal, ' '\n" @@ -1607,8 +1567,8 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:865 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2512 +#: documentation/content/en/articles/x86-assembly/_index.adoc:839 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2488 #, no-wrap msgid "" ".put:\n" @@ -1617,11 +1577,11 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:870 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1001 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1305 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2534 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:3848 +#: documentation/content/en/articles/x86-assembly/_index.adoc:844 +#: documentation/content/en/articles/x86-assembly/_index.adoc:975 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1279 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2510 +#: documentation/content/en/articles/x86-assembly/_index.adoc:3824 #, no-wrap msgid "" "align 4\n" @@ -1631,20 +1591,20 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:872 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1003 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1307 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2536 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:3850 +#: documentation/content/en/articles/x86-assembly/_index.adoc:846 +#: documentation/content/en/articles/x86-assembly/_index.adoc:977 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1281 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2512 +#: documentation/content/en/articles/x86-assembly/_index.adoc:3826 #, no-wrap msgid "\tcall\tread\n" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:877 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1008 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1312 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2541 +#: documentation/content/en/articles/x86-assembly/_index.adoc:851 +#: documentation/content/en/articles/x86-assembly/_index.adoc:982 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1286 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2517 #, no-wrap msgid "" ".fetch:\n" @@ -1654,8 +1614,8 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:890 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1021 +#: documentation/content/en/articles/x86-assembly/_index.adoc:864 +#: documentation/content/en/articles/x86-assembly/_index.adoc:995 #, no-wrap msgid "" "read:\n" @@ -1673,8 +1633,8 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:896 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1027 +#: documentation/content/en/articles/x86-assembly/_index.adoc:870 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1001 #, no-wrap msgid "" "align 4\n" @@ -1685,11 +1645,11 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:904 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1035 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1348 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2581 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:3887 +#: documentation/content/en/articles/x86-assembly/_index.adoc:878 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1009 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1322 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2557 +#: documentation/content/en/articles/x86-assembly/_index.adoc:3863 #, no-wrap msgid "" "align 4\n" @@ -1702,8 +1662,8 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:916 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1047 +#: documentation/content/en/articles/x86-assembly/_index.adoc:890 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1021 #, no-wrap msgid "" "align 4\n" @@ -1720,7 +1680,7 @@ msgid "" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:922 +#: documentation/content/en/articles/x86-assembly/_index.adoc:896 msgid "" "We now have a third section in the source code, named `.bss`. This section " "is not included in our executable file, and, therefore, cannot be " @@ -1729,18 +1689,18 @@ msgid "" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:926 +#: documentation/content/en/articles/x86-assembly/_index.adoc:900 msgid "" "We take advantage of the fact that the system does not modify the registers: " "We use registers for what, otherwise, would have to be global variables " -"stored in the `.data` section. This is also why the UNIX(R) convention of " +"stored in the `.data` section. This is also why the UNIX convention of " "passing parameters to system calls on the stack is superior to the Microsoft " "convention of passing them in the registers: We can keep the registers for " "our own use." msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:930 +#: documentation/content/en/articles/x86-assembly/_index.adoc:904 msgid "" "We use `EDI` and `ESI` as pointers to the next byte to be read from or " "written to. We use `EBX` and `ECX` to keep count of the number of bytes in " @@ -1749,12 +1709,12 @@ msgid "" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:932 +#: documentation/content/en/articles/x86-assembly/_index.adoc:906 msgid "Let us see how it works now:" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:943 +#: documentation/content/en/articles/x86-assembly/_index.adoc:917 #, no-wrap msgid "" "% nasm -f elf hex.asm\n" @@ -1768,7 +1728,7 @@ msgid "" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:948 +#: documentation/content/en/articles/x86-assembly/_index.adoc:922 msgid "" "Not what you expected? The program did not print the output until we pressed " "`^D`. That is easy to fix by inserting three lines of code to write the " @@ -1777,7 +1737,7 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:996 +#: documentation/content/en/articles/x86-assembly/_index.adoc:970 #, no-wrap msgid "" ".put:\n" @@ -1789,17 +1749,17 @@ msgid "" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1050 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1024 msgid "Now, let us see how it works:" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1064 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1038 msgid "Not bad for a 644-byte executable, is it!" msgstr "" #. type: delimited block = 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1069 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1043 msgid "" "This approach to buffered input/output still contains a hidden danger. I " "will discuss-and fix-it later, when I talk about the crossref:x86[x86-" @@ -1807,13 +1767,13 @@ msgid "" msgstr "" #. type: Title === -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1072 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1046 #, no-wrap msgid "How to Unread a Character" msgstr "" #. type: delimited block = 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1078 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1052 msgid "" "This may be a somewhat advanced topic, mostly of interest to programmers " "familiar with the theory of compilers. If you wish, you may " @@ -1822,7 +1782,7 @@ msgid "" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1084 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1058 msgid "" "While our sample program does not require it, more sophisticated filters " "often need to look ahead. In other words, they may need to see what the " @@ -1832,7 +1792,7 @@ msgid "" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1088 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1062 msgid "" "For example, you may be parsing the input stream for a textual string (e.g., " "when implementing a language compiler): If a character is followed by " @@ -1842,14 +1802,14 @@ msgid "" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1090 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1064 msgid "" "This presents an interesting problem: How to return the next character back " "to the input stream, so it can be read again later?" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1094 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1068 msgid "" "One possible solution is to store it in a character variable, then set a " "flag. We can modify `getchar` to check the flag, and if it is set, fetch " @@ -1858,7 +1818,7 @@ msgid "" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1099 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1073 msgid "" "The C language has an `ungetc()` function, just for that purpose. Is there " "a quick way to implement it in our code? I would like you to scroll back up " @@ -1868,28 +1828,28 @@ msgid "" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1101 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1075 msgid "" "The key to returning a character back to the stream is in how we are getting " "the characters to start with:" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1104 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1078 msgid "" "First we check if the buffer is empty by testing the value of `EBX`. If it " "is zero, we call the `read` procedure." msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1107 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1081 msgid "" "If we do have a character available, we use `lodsb`, then decrease the value " "of `EBX`. The `lodsb` instruction is effectively identical to:" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1112 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1086 #, no-wrap msgid "" "mov\tal, [esi]\n" @@ -1897,7 +1857,7 @@ msgid "" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1117 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1091 msgid "" "The byte we have fetched remains in the buffer until the next time `read` is " "called. We do not know when that happens, but we do know it will not happen " @@ -1907,7 +1867,7 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1124 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1098 #, no-wrap msgid "" "ungetc:\n" @@ -1917,7 +1877,7 @@ msgid "" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1128 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1102 msgid "" "But, be careful! We are perfectly safe doing this if our look-ahead is at " "most one character at a time. If we are examining more than one upcoming " @@ -1926,7 +1886,7 @@ msgid "" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1131 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1105 msgid "" "Because as long as `getchar` does not have to call `read`, all of the pre-" "read bytes are still in the buffer, and our `ungetc` works without a " @@ -1935,28 +1895,28 @@ msgid "" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1133 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1107 msgid "" "We can always rely on `ungetc` working properly on the last character we " "have read with `getchar`, but not on anything we have read before that." msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1135 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1109 msgid "" "If your program reads more than one byte ahead, you have at least two " "choices:" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1138 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1112 msgid "" "If possible, modify the program so it only reads one byte ahead. This is " "the simplest solution." msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1142 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1116 msgid "" "If that option is not available, first of all determine the maximum number " "of characters your program needs to return to the input stream at one time. " @@ -1967,7 +1927,7 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1149 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1123 #, no-wrap msgid "" "section\t.bss\n" @@ -1977,14 +1937,14 @@ msgid "" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1152 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1126 msgid "" "You also need to modify your `ungetc` to pass the value of the byte to unget " "in `AL`:" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1160 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1134 #, no-wrap msgid "" "ungetc:\n" @@ -1995,7 +1955,7 @@ msgid "" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1163 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1137 msgid "" "With this modification, you can call `ungetc` up to 17 times in a row safely " "(the first call will still be within the buffer, the remaining 16 may be " @@ -2003,13 +1963,13 @@ msgid "" msgstr "" #. type: Title == -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1165 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1139 #, no-wrap msgid "Command Line Arguments" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1169 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1143 msgid "" "Our hex program will be more useful if it can read the names of an input and " "output file from its command line, i.e., if it can process the command line " @@ -2017,23 +1977,23 @@ msgid "" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1173 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1147 msgid "" -"Before a UNIX(R) system starts a program, it ``push``es some data on the " -"stack, then jumps at the `_start` label of the program. Yes, I said jumps, " -"not calls. That means the data can be accessed by reading `[esp+offset]`, " -"or by simply ``pop``ping it." +"Before a UNIX system starts a program, it ``push``es some data on the stack, " +"then jumps at the `_start` label of the program. Yes, I said jumps, not " +"calls. That means the data can be accessed by reading `[esp+offset]`, or by " +"simply ``pop``ping it." msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1176 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1150 msgid "" "The value at the top of the stack contains the number of command line " "arguments. It is traditionally called `argc`, for \"argument count.\"" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1181 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1155 msgid "" "Command line arguments follow next, all `argc` of them. These are typically " "referred to as `argv`, for \"argument value(s).\" That is, we get `argv[0]`, " @@ -2043,23 +2003,23 @@ msgid "" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1183 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1157 msgid "" "The `argv` list is followed by a NULL pointer, which is simply a `0`. There " "is more, but this is enough for our purposes right now." msgstr "" #. type: delimited block = 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1188 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1162 msgid "" -"If you have come from the MS-DOS(R) programming environment, the main " +"If you have come from the MS-DOS programming environment, the main " "difference is that each argument is in a separate string. The second " "difference is that there is no practical limit on how many arguments there " "can be." msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1192 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1166 msgid "" "Armed with this knowledge, we are almost ready for the next version of " "[.filename]#hex.asm#. First, however, we need to add a few lines to " @@ -2067,13 +2027,13 @@ msgid "" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1194 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1168 msgid "" "First, we need to add two new entries to our list of system call numbers:" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1199 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1173 #, no-wrap msgid "" "%define\tSYS_open\t5\n" @@ -2081,12 +2041,12 @@ msgid "" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1202 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1176 msgid "Then we add two new macros at the end of the file:" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1208 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1182 #, no-wrap msgid "" "%macro\tsys.open\t0\n" @@ -2095,7 +2055,7 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1212 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1186 #, no-wrap msgid "" "%macro\tsys.close\t0\n" @@ -2104,12 +2064,12 @@ msgid "" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1215 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1189 msgid "Here, then, is our modified source code:" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1226 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1200 #, no-wrap msgid "" "section\t.data\n" @@ -2119,7 +2079,7 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1236 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1210 #, no-wrap msgid "" "section\t.text\n" @@ -2130,7 +2090,7 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1241 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1215 #, no-wrap msgid "" "align 4\n" @@ -2140,8 +2100,8 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1244 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1256 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1218 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1230 #, no-wrap msgid "" "\tpop\tecx\n" @@ -2149,7 +2109,7 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1250 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1224 #, no-wrap msgid "" "\t; ECX contains the path to input file\n" @@ -2160,7 +2120,7 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1253 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1227 #, no-wrap msgid "" "\tadd\tesp, byte 8\n" @@ -2168,7 +2128,7 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1264 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1238 #, no-wrap msgid "" "\t; ECX contains the path to output file\n" @@ -2181,7 +2141,7 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1267 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1241 #, no-wrap msgid "" "\tadd\tesp, byte 12\n" @@ -2189,7 +2149,7 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1273 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1247 #, no-wrap msgid "" ".init:\n" @@ -2200,7 +2160,7 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1277 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1251 #, no-wrap msgid "" ".loop:\n" @@ -2209,7 +2169,7 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1300 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1274 #, no-wrap msgid "" ".put:\n" @@ -2221,7 +2181,7 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1325 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1299 #, no-wrap msgid "" "read:\n" @@ -2239,8 +2199,8 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1329 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2562 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1303 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2538 #, no-wrap msgid "" "align 4\n" @@ -2249,9 +2209,9 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1333 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2566 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:3820 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1307 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2542 +#: documentation/content/en/articles/x86-assembly/_index.adoc:3796 #, no-wrap msgid "" "\t; close files\n" @@ -2260,9 +2220,9 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1336 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2569 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:3823 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1310 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2545 +#: documentation/content/en/articles/x86-assembly/_index.adoc:3799 #, no-wrap msgid "" "\tpush\tdword [fd.out]\n" @@ -2270,9 +2230,9 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1340 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2573 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:3829 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1314 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2549 +#: documentation/content/en/articles/x86-assembly/_index.adoc:3805 #, no-wrap msgid "" "\t; return success\n" @@ -2281,7 +2241,7 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1360 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1334 #, no-wrap msgid "" "align 4\n" @@ -2298,21 +2258,21 @@ msgid "" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1364 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1338 msgid "" "In our `.data` section we now have two new variables, `fd.in` and `fd.out`. " "We store the input and output file descriptors here." msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1366 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1340 msgid "" "In the `.text` section we have replaced the references to `stdin` and " "`stdout` with `[fd.in]` and `[fd.out]`." msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1369 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1343 msgid "" "The `.text` section now starts with a simple error handler, which does " "nothing but exit the program with a return value of `1`. The error handler " @@ -2321,7 +2281,7 @@ msgid "" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1372 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1346 msgid "" "Naturally, the program execution still begins at `_start`. First, we remove " "`argc` and `argv[0]` from the stack: They are of no interest to us (in this " @@ -2329,7 +2289,7 @@ msgid "" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1378 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1352 msgid "" "We pop `argv[1]` to `ECX`. This register is particularly suited for " "pointers, as we can handle NULL pointers with `jecxz`. If `argv[1]` is not " @@ -2340,7 +2300,7 @@ msgid "" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1383 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1357 msgid "" "If all went well, we now check for the second argument. If it is there, we " "open the output file. Otherwise, we send the output to `stdout`. If we " @@ -2349,7 +2309,7 @@ msgid "" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1385 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1359 msgid "" "The rest of the code is the same as before, except we close the input and " "output files before exiting, and, as mentioned, we use `[fd.in]` and " @@ -2357,36 +2317,36 @@ msgid "" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1387 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1361 msgid "Our executable is now a whopping 768 bytes long." msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1390 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1364 msgid "" "Can we still improve it? Of course! Every program can be improved. Here are " "a few ideas of what we could do:" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1392 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1366 msgid "Have our error handler print a message to `stderr`." msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1393 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1367 msgid "Add error handlers to the `read` and `write` functions." msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1394 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1368 msgid "" "Close `stdin` when we open an input file, `stdout` when we open an output " "file." msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1395 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1369 msgid "" "Add command line switches, such as `-i` and `-o`, so we can list the input " "and output files in any order, or perhaps read from `stdin` and write to a " @@ -2394,39 +2354,39 @@ msgid "" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1396 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1370 msgid "Print a usage message if command line arguments are incorrect." msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1398 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1372 msgid "" "I shall leave these enhancements as an exercise to the reader: You already " "know everything you need to know to implement them." msgstr "" #. type: Title == -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1400 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1374 #, no-wrap -msgid "UNIX(R) Environment" +msgid "UNIX Environment" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1404 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1378 msgid "" -"An important UNIX(R) concept is the environment, which is defined by " +"An important UNIX concept is the environment, which is defined by " "_environment variables_. Some are set by the system, others by you, yet " "others by the shell, or any program that loads another program." msgstr "" #. type: Title === -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1406 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1380 #, no-wrap msgid "How to Find Environment Variables" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1411 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1385 msgid "" "I said earlier that when a program starts executing, the stack contains " "`argc` followed by the NULL-terminated `argv` array, followed by something " @@ -2436,7 +2396,7 @@ msgid "" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1414 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1388 msgid "" "The structure of `env` is the same as that of `argv`, a list of memory " "addresses followed by a NULL (`0`). In this case, there is no `\"envc\"`-we " @@ -2444,66 +2404,67 @@ msgid "" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1417 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1391 msgid "" "The variables usually come in the `name=value` format, but sometimes the " "`=value` part may be missing. We need to account for that possibility." msgstr "" #. type: Title === -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1419 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1393 #, no-wrap msgid "webvars" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1423 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1397 msgid "" "I could just show you some code that prints the environment the same way the " -"UNIX(R) env command does. But I thought it would be more interesting to " -"write a simple assembly language CGI utility." +"UNIX env command does. But I thought it would be more interesting to write " +"a simple assembly language CGI utility." msgstr "" #. type: Title ==== -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1425 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1399 #, no-wrap msgid "CGI: a Quick Overview" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1428 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1404 msgid "" -"I have a http://www.whizkidtech.redprince.net/cgi-bin/tutorial[detailed CGI " -"tutorial] on my web site, but here is a very quick overview of CGI:" +"I have a link:https://web.archive.org/web/20230612082452/http://" +"www.whizkidtech.redprince.net/cgi-bin/tutorial[detailed CGI tutorial] on my " +"web site, but here is a very quick overview of CGI:" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1430 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1406 msgid "" "The web server communicates with the CGI program by setting _environment " "variables_." msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1431 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1407 msgid "" "The CGI program sends its output to [.filename]#stdout#. The web server " "reads it from there." msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1432 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1408 msgid "It must start with an HTTP header followed by two blank lines." msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1433 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1409 msgid "" "It then prints the HTML code, or whatever other type of data it is producing." msgstr "" #. type: delimited block = 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1438 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1414 msgid "" "While certain _environment variables_ use standard names, others vary, " "depending on the web server. That makes webvars quite a useful diagnostic " @@ -2511,13 +2472,13 @@ msgid "" msgstr "" #. type: Title ==== -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1441 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1417 #, no-wrap msgid "The Code" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1445 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1421 msgid "" "Our webvars program, then, must send out the HTTP header followed by some " "HTML mark-up. It then must read the _environment variables_ one by one and " @@ -2525,13 +2486,13 @@ msgid "" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1448 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1424 msgid "" "The code follows. I placed comments and explanations right inside the code:" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1485 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1461 #, no-wrap msgid "" ";;;;;;; webvars.asm ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;\n" @@ -2571,7 +2532,7 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1522 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1498 #, no-wrap msgid "" "section\t.data\n" @@ -2613,7 +2574,7 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1532 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1508 #, no-wrap msgid "" "section\t.text\n" @@ -2628,7 +2589,7 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1536 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1512 #, no-wrap msgid "" "\t; Now find how far on the stack the environment pointers\n" @@ -2637,7 +2598,7 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1551 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1527 #, no-wrap msgid "" "\t; We need to remove the following from the stack:\n" @@ -2657,7 +2618,7 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1557 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1533 #, no-wrap msgid "" "\t; Loop through the environment, printing it out\n" @@ -2668,7 +2629,7 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1563 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1539 #, no-wrap msgid "" "\t; Print the left part of HTML\n" @@ -2679,7 +2640,7 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1574 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1550 #, no-wrap msgid "" "\t; It may be tempting to search for the '=' in the env string next.\n" @@ -2695,7 +2656,7 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1581 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1557 #, no-wrap msgid "" "\t; Now is the time to find '='\n" @@ -2707,7 +2668,7 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1586 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1562 #, no-wrap msgid "" "\tpush\tecx\n" @@ -2717,7 +2678,7 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1592 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1568 #, no-wrap msgid "" "\t; Print the middle part of HTML table code\n" @@ -2728,7 +2689,7 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1596 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1572 #, no-wrap msgid "" "\t; Find the length of the value\n" @@ -2737,7 +2698,7 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1600 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1576 #, no-wrap msgid "" "\t; Print \"undefined\" if 0\n" @@ -2746,7 +2707,7 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1603 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1579 #, no-wrap msgid "" "\tmov\tebx, undeflen\n" @@ -2754,7 +2715,7 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1609 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1585 #, no-wrap msgid "" ".value:\n" @@ -2765,7 +2726,7 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1615 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1591 #, no-wrap msgid "" "\t; Print the right part of the table row\n" @@ -2776,7 +2737,7 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1618 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1594 #, no-wrap msgid "" "\t; Get rid of the 60 bytes we have pushed\n" @@ -2784,7 +2745,7 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1621 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1597 #, no-wrap msgid "" "\t; Get the next variable\n" @@ -2792,7 +2753,7 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1628 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1604 #, no-wrap msgid "" ".wrap:\n" @@ -2804,7 +2765,7 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1632 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1608 #, no-wrap msgid "" "\t; Return success\n" @@ -2813,19 +2774,19 @@ msgid "" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1636 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1612 msgid "" "This code produces a 1,396-byte executable. Most of it is data, i.e., the " "HTML mark-up we need to send out." msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1638 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1614 msgid "Assemble and link it as usual:" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1643 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1619 #, no-wrap msgid "" "% nasm -f elf webvars.asm\n" @@ -2833,7 +2794,7 @@ msgid "" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1647 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1623 msgid "" "To use it, you need to upload [.filename]#webvars# to your web server. " "Depending on how your web server is set up, you may have to store it in a " @@ -2842,33 +2803,30 @@ msgid "" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1651 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1627 msgid "" "Then you need to use your browser to view its output. To see its output on " -"my web server, please go to http://www.int80h.org/webvars/[http://" -"www.int80h.org/webvars/]. If curious about the additional environment " -"variables present in a password protected web directory, go to http://" -"www.int80h.org/private/[http://www.int80h.org/private/], using the name " -"`asm` and password `programmer`." +"my web server, please go to link:https://web.archive.org/web/20100818031015/" +"http://www.int80h.org/webvars/[http://www.int80h.org/webvars]." msgstr "" #. type: Title == -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1653 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1629 #, no-wrap msgid "Working with Files" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1658 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1634 msgid "" "We have already done some basic file work: We know how to open and close " -"them, how to read and write them using buffers. But UNIX(R) offers much " -"more functionality when it comes to files. We will examine some of it in " -"this section, and end up with a nice file conversion utility." +"them, how to read and write them using buffers. But UNIX offers much more " +"functionality when it comes to files. We will examine some of it in this " +"section, and end up with a nice file conversion utility." msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1661 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1637 msgid "" "Indeed, let us start at the end, that is, with the file conversion utility. " "It always makes programming easier when we know from the start what the end " @@ -2876,27 +2834,27 @@ msgid "" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1667 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1643 msgid "" -"One of the first programs I wrote for UNIX(R) was link:ftp://ftp.int80h.org/" -"unix/tuc/[tuc], a text-to-UNIX(R) file converter. It converts a text file " -"from other operating systems to a UNIX(R) text file. In other words, it " -"changes from different kind of line endings to the newline convention of " -"UNIX(R). It saves the output in a different file. Optionally, it converts " -"a UNIX(R) text file to a DOS text file." +"One of the first programs I wrote for UNIX was package:converters/" +"tuc[tuc(1)], a text-to-UNIX file converter. It converts a text file from " +"other operating systems to a UNIX text file. In other words, it changes " +"from different kind of line endings to the newline convention of UNIX. It " +"saves the output in a different file. Optionally, it converts a UNIX text " +"file to a DOS text file." msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1671 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1647 msgid "" "I have used tuc extensively, but always only to convert from some other OS " -"to UNIX(R), never the other way. I have always wished it would just " -"overwrite the file instead of me having to send the output to a different " -"file. Most of the time, I end up using it like this:" +"to UNIX, never the other way. I have always wished it would just overwrite " +"the file instead of me having to send the output to a different file. Most " +"of the time, I end up using it like this:" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1676 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1652 #, no-wrap msgid "" "% tuc myfile tempfile\n" @@ -2904,89 +2862,89 @@ msgid "" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1679 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1655 msgid "" "It would be nice to have a ftuc, i.e., _fast tuc_, and use it like this:" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1683 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1659 #, no-wrap msgid "% ftuc myfile\n" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1686 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1662 msgid "" -"In this chapter, then, we will write ftuc in assembly language (the original " +"In this article, then, we will write ftuc in assembly language (the original " "tuc is in C), and study various file-oriented kernel services in the process." msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1688 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1664 msgid "" "At first sight, such a file conversion is very simple: All you have to do is " "strip the carriage returns, right?" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1690 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1666 msgid "" "If you answered yes, think again: That approach will work most of the time " "(at least with MS DOS text files), but will fail occasionally." msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1695 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1671 msgid "" -"The problem is that not all non UNIX(R) text files end their line with the " +"The problem is that not all non-UNIX text files end their line with the " "carriage return / line feed sequence. Some use carriage returns without " "line feeds. Others combine several blank lines into a single carriage " "return followed by several line feeds. And so on." msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1697 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1673 msgid "" "A text file converter, then, must be able to handle any possible line " "endings:" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1699 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1675 msgid "carriage return / line feed" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1700 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1676 msgid "carriage return" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1701 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1677 msgid "line feed / carriage return" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1702 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1678 msgid "line feed" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1704 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1680 msgid "" "It should also handle files that use some kind of a combination of the above " "(e.g., carriage return followed by several line feeds)." msgstr "" #. type: Title === -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1706 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1682 #, no-wrap msgid "Finite State Machine" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1713 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1689 msgid "" "The problem is easily solved by the use of a technique called _finite state " "machine_, originally developed by the designers of digital electronic " @@ -3002,7 +2960,7 @@ msgid "" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1716 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1692 msgid "" "Because of that, all software is essentially a sequence of state " "instructions for the microprocessor. Nevertheless, the concept of _finite " @@ -3010,7 +2968,7 @@ msgid "" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1719 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1695 msgid "" "Our text file converter can be designer as a _finite state machine_ with " "three possible states. We could call them states 0-2, but it will make our " @@ -3018,50 +2976,50 @@ msgid "" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1721 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1697 msgid "ordinary" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1722 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1698 msgid "cr" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1723 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1699 msgid "lf" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1725 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1701 msgid "" "Our program will start in the ordinary state. During this state, the program " "action depends on its input as follows:" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1728 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1704 msgid "" "If the input is anything other than a carriage return or line feed, the " "input is simply passed on to the output. The state remains unchanged." msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1730 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1706 msgid "" "If the input is a carriage return, the state is changed to cr. The input is " "then discarded, i.e., no output is made." msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1732 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1708 msgid "" "If the input is a line feed, the state is changed to lf. The input is then " "discarded." msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1735 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1711 msgid "" "Whenever we are in the cr state, it is because the last input was a carriage " "return, which was unprocessed. What our software does in this state again " @@ -3069,14 +3027,14 @@ msgid "" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1737 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1713 msgid "" "If the input is anything other than a carriage return or line feed, output a " "line feed, then output the input, then change the state to ordinary." msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1738 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1714 msgid "" "If the input is a carriage return, we have received two (or more) carriage " "returns in a row. We discard the input, we output a line feed, and leave the " @@ -3084,7 +3042,7 @@ msgid "" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1739 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1715 msgid "" "If the input is a line feed, we output the line feed and change the state to " "ordinary. Note that this is not the same as the first case above - if we " @@ -3092,18 +3050,18 @@ msgid "" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1743 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1719 msgid "" "Finally, we are in the lf state after we have received a line feed that was " "not preceded by a carriage return. This will happen when our file already " -"is in UNIX(R) format, or whenever several lines in a row are expressed by a " +"is in UNIX format, or whenever several lines in a row are expressed by a " "single carriage return followed by several line feeds, or when line ends " "with a line feed / carriage return sequence. Here is how we need to handle " "our input in this state:" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1745 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1721 msgid "" "If the input is anything other than a carriage return or line feed, we " "output a line feed, then output the input, then change the state to " @@ -3112,27 +3070,27 @@ msgid "" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1746 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1722 msgid "" "If the input is a carriage return, we discard the input, we output a line " "feed, then change the state to ordinary." msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1747 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1723 msgid "" "If the input is a line feed, we output the line feed, and leave the state " "unchanged." msgstr "" #. type: Title ==== -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1749 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1725 #, no-wrap msgid "The Final State" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1754 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1730 msgid "" "The above _finite state machine_ works for the entire file, but leaves the " "possibility that the final line end will be ignored. That will happen " @@ -3142,7 +3100,7 @@ msgid "" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1757 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1733 msgid "" "This problem is easily fixed by checking the state after the entire file was " "processed. If the state is not ordinary, we simply need to output one last " @@ -3150,7 +3108,7 @@ msgid "" msgstr "" #. type: delimited block = 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1763 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1739 msgid "" "Now that we have expressed our algorithm as a _finite state machine_, we " "could easily design a dedicated digital electronic circuit (a \"chip\") to " @@ -3159,13 +3117,13 @@ msgid "" msgstr "" #. type: Title ==== -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1766 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1742 #, no-wrap msgid "The Output Counter" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1771 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1747 msgid "" "Because our file conversion program may be combining two characters into " "one, we need to use an output counter. We initialize it to `0`, and " @@ -3174,13 +3132,13 @@ msgid "" msgstr "" #. type: Title === -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1773 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1749 #, no-wrap msgid "Implementing FSM in Software" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1777 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1753 msgid "" "The hardest part of working with a _finite state machine_ is analyzing the " "problem and expressing it as a _finite state machine_. That accomplished, " @@ -3188,7 +3146,7 @@ msgid "" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1780 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1756 msgid "" "In a high-level language, such as C, there are several main approaches. One " "is to use a `switch` statement which chooses what function should be run. " @@ -3196,7 +3154,7 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1795 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1771 #, no-wrap msgid "" "switch (state) {\n" @@ -3214,33 +3172,33 @@ msgid "" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1798 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1774 msgid "" "Another approach is by using an array of function pointers, something like " "this:" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1802 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1778 #, no-wrap msgid "(output[state])(inputchar);\n" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1805 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1781 msgid "" "Yet another is to have `state` be a function pointer, set to point at the " "appropriate function:" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1809 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1785 #, no-wrap msgid "(*state)(inputchar);\n" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1813 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1789 msgid "" "This is the approach we will use in our program because it is very easy to " "do in assembly language, and very fast, too. We will simply keep the " @@ -3248,13 +3206,13 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1817 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1793 #, no-wrap msgid "call\tebx\n" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1821 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1797 msgid "" "This is possibly faster than hardcoding the address in the code because the " "microprocessor does not have to fetch the address from the memory-it is " @@ -3263,13 +3221,13 @@ msgid "" msgstr "" #. type: Title === -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1823 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1799 #, no-wrap msgid "Memory Mapped Files" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1827 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1803 msgid "" "Because our program works on a single file, we cannot use the approach that " "worked for us before, i.e., to read from an input file and to write to an " @@ -3277,9 +3235,9 @@ msgid "" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1835 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1811 msgid "" -"UNIX(R) allows us to map a file, or a section of a file, into memory. To do " +"UNIX allows us to map a file, or a section of a file, into memory. To do " "that, we first need to open the file with the appropriate read/write flags. " "Then we use the `mmap` system call to map it into the memory. One nice " "thing about `mmap` is that it automatically works with virtual memory: We " @@ -3292,7 +3250,7 @@ msgid "" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1838 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1814 msgid "" "The 32-bit Intel microprocessors can access up to four gigabytes of memory - " "physical or virtual. The FreeBSD system allows us to use up to a half of it " @@ -3300,7 +3258,7 @@ msgid "" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1842 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1818 msgid "" "For simplicity sake, in this tutorial we will only convert files that can be " "mapped into the memory in their entirety. There are probably not too many " @@ -3310,23 +3268,23 @@ msgid "" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1848 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1824 msgid "" "If you examine your copy of [.filename]#syscalls.master#, you will find two " -"separate syscalls named `mmap`. This is because of evolution of UNIX(R): " -"There was the traditional BSD `mmap`, syscall 71. That one was superseded " -"by the POSIX(R) `mmap`, syscall 197. The FreeBSD system supports both " -"because older programs were written by using the original BSD version. But " -"new software uses the POSIX(R) version, which is what we will use." +"separate syscalls named `mmap`. This is because of evolution of UNIX: There " +"was the traditional BSD `mmap`, syscall 71. That one was superseded by the " +"POSIX(R) `mmap`, syscall 197. The FreeBSD system supports both because " +"older programs were written by using the original BSD version. But new " +"software uses the POSIX version, which is what we will use." msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1850 -msgid "The [.filename]#syscalls.master# lists the POSIX(R) version like this:" +#: documentation/content/en/articles/x86-assembly/_index.adoc:1826 +msgid "The [.filename]#syscalls.master# lists the POSIX version like this:" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1855 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1831 #, no-wrap msgid "" "197\tSTD\tBSD\t{ caddr_t mmap(caddr_t addr, size_t len, int prot, \\\n" @@ -3334,14 +3292,14 @@ msgid "" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1859 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1835 msgid "" "This differs slightly from what man:mmap[2] says. That is because " "man:mmap[2] describes the C version." msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1863 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1839 msgid "" "The difference is in the `long pad` argument, which is not present in the C " "version. However, the FreeBSD syscalls add a 32-bit pad after ``push``ing a " @@ -3349,28 +3307,27 @@ msgid "" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1865 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1841 msgid "" "When we are finished working with a memory-mapped file, we unmap it with the " "`munmap` syscall:" msgstr "" #. type: delimited block = 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1869 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1845 msgid "" -"For an in-depth treatment of `mmap`, see W. Richard Stevens' http://" -"www.int80h.org/cgi-bin/isbn?isbn=0130810819[Unix Network Programming, Volume " -"2, Chapter 12]." +"For an in-depth treatment of `mmap`, see W. Richard Stevens' _Unix Network " +"Programming_, Volume 2, Chapter 12." msgstr "" #. type: Title === -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1872 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1848 #, no-wrap msgid "Determining File Size" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1875 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1851 msgid "" "Because we need to tell `mmap` how many bytes of the file to map into the " "memory, and because we want to map the entire file, we need to determine the " @@ -3378,28 +3335,28 @@ msgid "" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1878 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1854 msgid "" "We can use the `fstat` syscall to get all the information about an open file " "that the system can give us. That includes the file size." msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1881 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1857 msgid "" "Again, [.filename]#syscalls.master# lists two versions of `fstat`, a " -"traditional one (syscall 62), and a POSIX(R) one (syscall 189). Naturally, " -"we will use the POSIX(R) version:" +"traditional one (syscall 62), and a POSIX one (syscall 189). Naturally, we " +"will use the POSIX version:" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1885 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1861 #, no-wrap msgid "189\tSTD\tPOSIX\t{ int fstat(int fd, struct stat *sb); }\n" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1889 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1865 msgid "" "This is a very straightforward call: We pass to it the address of a `stat` " "structure and the descriptor of an open file. It will fill out the contents " @@ -3407,7 +3364,7 @@ msgid "" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1892 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1868 msgid "" "I do, however, have to say that I tried to declare the `stat` structure in " "the `.bss` section, and `fstat` did not like it: It set the carry flag " @@ -3416,13 +3373,13 @@ msgid "" msgstr "" #. type: Title === -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1894 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1870 #, no-wrap msgid "Changing the File Size" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1898 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1874 msgid "" "Because our program may combine carriage return / line feed sequences into " "straight line feeds, our output may be smaller than our input. However, " @@ -3431,7 +3388,7 @@ msgid "" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1901 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1877 msgid "" "The `ftruncate` system call allows us to do just that. Despite its somewhat " "misleading name, the `ftruncate` system call can be used to both truncate " @@ -3439,7 +3396,7 @@ msgid "" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1904 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1880 msgid "" "And yes, we will find two versions of `ftruncate` in " "[.filename]#syscalls.master#, an older one (130), and a newer one (201). We " @@ -3447,24 +3404,24 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1908 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1884 #, no-wrap msgid "201\tSTD\tBSD\t{ int ftruncate(int fd, int pad, off_t length); }\n" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1911 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1887 msgid "Please note that this one contains a `int pad` again." msgstr "" #. type: Title === -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1913 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1889 #, no-wrap msgid "ftuc" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1918 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1894 msgid "" "We now know everything we need to write ftuc. We start by adding some new " "lines in [.filename]#system.inc#. First, we define some constants and " @@ -3472,7 +3429,7 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1925 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1901 #, no-wrap msgid "" ";;;;;;; open flags\n" @@ -3482,7 +3439,7 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1934 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1910 #, no-wrap msgid "" ";;;;;;; mmap flags\n" @@ -3496,7 +3453,7 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1958 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1934 #, no-wrap msgid "" ";;;;;;; stat structure\n" @@ -3525,12 +3482,12 @@ msgid "" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1961 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1937 msgid "We define the new syscalls:" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1968 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1944 #, no-wrap msgid "" "%define\tSYS_mmap\t197\n" @@ -3540,12 +3497,12 @@ msgid "" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1971 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1947 msgid "We add the macros for their use:" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1977 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1953 #, no-wrap msgid "" "%macro\tsys.mmap\t0\n" @@ -3554,7 +3511,7 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1981 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1957 #, no-wrap msgid "" "%macro\tsys.munmap\t0\n" @@ -3563,7 +3520,7 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1985 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1961 #, no-wrap msgid "" "%macro\tsys.ftruncate\t0\n" @@ -3572,7 +3529,7 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1989 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1965 #, no-wrap msgid "" "%macro\tsys.fstat\t0\n" @@ -3581,12 +3538,12 @@ msgid "" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:1992 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1968 msgid "And here is our code:" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2005 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1981 #, no-wrap msgid "" ";;;;;;; Fast Text-to-Unix Conversion (ftuc.asm) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;\n" @@ -3602,7 +3559,7 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2019 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1995 #, no-wrap msgid "" "section\t.data\n" @@ -3621,13 +3578,13 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2021 +#: documentation/content/en/articles/x86-assembly/_index.adoc:1997 #, no-wrap msgid "section\t.text\n" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2027 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2003 #, no-wrap msgid "" "align 4\n" @@ -3638,7 +3595,7 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2033 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2009 #, no-wrap msgid "" "align 4\n" @@ -3649,7 +3606,7 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2039 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2015 #, no-wrap msgid "" "align 4\n" @@ -3660,7 +3617,7 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2045 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2021 #, no-wrap msgid "" "align 4\n" @@ -3671,7 +3628,7 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2050 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2026 #, no-wrap msgid "" "align 4\n" @@ -3681,7 +3638,7 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2054 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2030 #, no-wrap msgid "" "error:\n" @@ -3690,7 +3647,7 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2057 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2033 #, no-wrap msgid "" "\tpush\tdword 1\n" @@ -3698,7 +3655,7 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2065 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2041 #, no-wrap msgid "" "align 4\n" @@ -3711,7 +3668,7 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2069 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2045 #, no-wrap msgid "" "\tpop\teax\n" @@ -3720,7 +3677,7 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2075 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2051 #, no-wrap msgid "" "\t; Open the file\n" @@ -3731,13 +3688,13 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2077 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2053 #, no-wrap msgid "\tmov\tebp, eax\t; Save fd\n" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2080 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2056 #, no-wrap msgid "" "\tsub\tesp, byte stat_size\n" @@ -3745,7 +3702,7 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2086 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2062 #, no-wrap msgid "" "\t; Find file size\n" @@ -3756,13 +3713,13 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2088 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2064 #, no-wrap msgid "\tmov\tedx, [ebx + st_size + 4]\n" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2096 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2072 #, no-wrap msgid "" "\t; File is too long if EDX != 0 ...\n" @@ -3775,7 +3732,7 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2099 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2075 #, no-wrap msgid "" "\t; Do nothing if the file is 0 bytes in size\n" @@ -3783,7 +3740,7 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2111 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2087 #, no-wrap msgid "" "\t; Map the entire file in memory\n" @@ -3800,7 +3757,7 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2116 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2092 #, no-wrap msgid "" "\tmov\tedi, eax\n" @@ -3810,7 +3767,7 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2121 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2097 #, no-wrap msgid "" "\t; Use EBX for state machine\n" @@ -3820,7 +3777,7 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2126 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2102 #, no-wrap msgid "" ".loop:\n" @@ -3830,7 +3787,7 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2129 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2105 #, no-wrap msgid "" "\tcmp\tebx, ordinary\n" @@ -3838,7 +3795,7 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2134 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2110 #, no-wrap msgid "" "\t; Output final lf\n" @@ -3848,7 +3805,7 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2142 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2118 #, no-wrap msgid "" ".filesize:\n" @@ -3861,7 +3818,7 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2145 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2121 #, no-wrap msgid "" "\t; close it (ebp still pushed)\n" @@ -3869,7 +3826,7 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2148 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2124 #, no-wrap msgid "" "\tadd\tesp, byte 16\n" @@ -3877,7 +3834,7 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2152 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2128 #, no-wrap msgid "" ".quit:\n" @@ -3886,7 +3843,7 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2157 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2133 #, no-wrap msgid "" "align 4\n" @@ -3896,8 +3853,8 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2160 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2182 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2136 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2158 #, no-wrap msgid "" "\tcmp\tal, ah\n" @@ -3905,7 +3862,7 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2164 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2140 #, no-wrap msgid "" "\tstosb\n" @@ -3914,7 +3871,7 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2169 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2145 #, no-wrap msgid "" "align 4\n" @@ -3924,7 +3881,7 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2174 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2150 #, no-wrap msgid "" "align 4\n" @@ -3934,7 +3891,7 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2179 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2155 #, no-wrap msgid "" "align 4\n" @@ -3944,8 +3901,8 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2186 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2214 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2162 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2190 #, no-wrap msgid "" "\txchg\tal, ah\n" @@ -3954,7 +3911,7 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2189 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2165 #, no-wrap msgid "" "\txchg\tal, ah\n" @@ -3962,7 +3919,7 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2195 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2171 #, no-wrap msgid "" ".lf:\n" @@ -3973,7 +3930,7 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2202 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2178 #, no-wrap msgid "" "align 4\n" @@ -3985,7 +3942,7 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2207 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2183 #, no-wrap msgid "" "align 4\n" @@ -3995,7 +3952,7 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2210 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2186 #, no-wrap msgid "" "\tcmp\tal, 0Dh\n" @@ -4003,7 +3960,7 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2220 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2196 #, no-wrap msgid "" "\txchg\tal, ah\n" @@ -4014,7 +3971,7 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2226 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2202 #, no-wrap msgid "" "align 4\n" @@ -4025,7 +3982,7 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2231 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2207 #, no-wrap msgid "" ".lf:\n" @@ -4035,69 +3992,69 @@ msgid "" msgstr "" #. type: delimited block = 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2238 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2214 msgid "" -"Do not use this program on files stored on a disk formatted by MS-DOS(R) or " -"Windows(R). There seems to be a subtle bug in the FreeBSD code when using " +"Do not use this program on files stored on a disk formatted by MS-DOS or " +"Windows. There seems to be a subtle bug in the FreeBSD code when using " "`mmap` on these drives mounted under FreeBSD: If the file is over a certain " "size, `mmap` will just fill the memory with zeros, and then copy them to the " "file overwriting its contents." msgstr "" #. type: Title == -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2241 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2217 #, no-wrap msgid "One-Pointed Mind" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2244 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2220 msgid "" "As a student of Zen, I like the idea of a one-pointed mind: Do one thing at " "a time, and do it well." msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2247 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2223 msgid "" -"This, indeed, is very much how UNIX(R) works as well. While a typical " -"Windows(R) application is attempting to do everything imaginable (and is, " -"therefore, riddled with bugs), a typical UNIX(R) program does only one " -"thing, and it does it well." +"This, indeed, is very much how UNIX works as well. While a typical Windows " +"application is attempting to do everything imaginable (and is, therefore, " +"riddled with bugs), a typical UNIX program does only one thing, and it does " +"it well." msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2249 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2225 msgid "" -"The typical UNIX(R) user then essentially assembles his own applications by " +"The typical UNIX user then essentially assembles his own applications by " "writing a shell script which combines the various existing programs by " "piping the output of one program to the input of another." msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2251 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2227 msgid "" -"When writing your own UNIX(R) software, it is generally a good idea to see " -"what parts of the problem you need to solve can be handled by existing " -"programs, and only write your own programs for that part of the problem that " -"you do not have an existing solution for." +"When writing your own UNIX software, it is generally a good idea to see what " +"parts of the problem you need to solve can be handled by existing programs, " +"and only write your own programs for that part of the problem that you do " +"not have an existing solution for." msgstr "" #. type: Title === -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2253 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2229 #, no-wrap msgid "CSV" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2256 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2232 msgid "" "I will illustrate this principle with a specific real-life example I was " "faced with recently:" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2260 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2236 msgid "" "I needed to extract the 11th field of each record from a database I " "downloaded from a web site. The database was a CSV file, i.e., a list of " @@ -4106,7 +4063,7 @@ msgid "" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2263 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2239 msgid "" "The first line of the file contains the list of various fields separated by " "commas. The rest of the file contains the data listed line by line, with " @@ -4114,7 +4071,7 @@ msgid "" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2265 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2241 msgid "" "I tried awk, using the comma as a separator. But because several lines " "contained a quoted comma, awk was extracting the wrong field from those " @@ -4122,30 +4079,30 @@ msgid "" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2268 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2244 msgid "" "Therefore, I needed to write my own software to extract the 11th field from " -"the CSV file. However, going with the UNIX(R) spirit, I only needed to " -"write a simple filter that would do the following:" +"the CSV file. However, going with the UNIX spirit, I only needed to write a " +"simple filter that would do the following:" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2270 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2246 msgid "Remove the first line from the file;" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2271 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2247 msgid "Change all unquoted commas to a different character;" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2272 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2248 msgid "Remove all quotation marks." msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2274 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2250 msgid "" "Strictly speaking, I could use sed to remove the first line from the file, " "but doing so in my own program was very easy, so I decided to do it and " @@ -4153,7 +4110,7 @@ msgid "" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2278 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2254 msgid "" "At any rate, writing a program like this took me about 20 minutes. Writing " "a program that extracts the 11th field from the CSV file would take a lot " @@ -4162,45 +4119,45 @@ msgid "" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2280 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2256 msgid "" "This time I decided to let it do a little more work than a typical tutorial " "program would:" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2282 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2258 msgid "It parses its command line for options;" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2283 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2259 msgid "It displays proper usage if it finds wrong arguments;" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2284 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2260 msgid "It produces meaningful error messages." msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2286 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2262 msgid "Here is its usage message:" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2290 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2266 #, no-wrap msgid "Usage: csv [-t] [-c] [-p] [-o ] [-i ]\n" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2293 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2269 msgid "All parameters are optional, and can appear in any order." msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2297 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2273 msgid "" "The `-t` parameter declares what to replace the commas with. The `tab` is " "the default here. For example, `-t;` will replace all unquoted commas with " @@ -4208,7 +4165,7 @@ msgid "" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2301 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2277 msgid "" "I did not need the `-c` option, but it may come in handy in the future. It " "lets me declare that I want a character other than a comma replaced with " @@ -4217,7 +4174,7 @@ msgid "" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2304 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2280 msgid "" "The `-p` option preserves the first line, i.e., it does not delete it. By " "default, we delete the first line because in a CSV file it contains the " @@ -4225,33 +4182,33 @@ msgid "" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2307 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2283 msgid "" "The `-i` and `-o` options let me specify the input and the output files. " "Defaults are [.filename]#stdin# and [.filename]#stdout#, so this is a " -"regular UNIX(R) filter." +"regular UNIX filter." msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2310 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2286 msgid "" "I made sure that both `-i filename` and `-ifilename` are accepted. I also " "made sure that only one input and one output files may be specified." msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2312 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2288 msgid "To get the 11th field of each record, I can now do:" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2316 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2292 #, no-wrap msgid "% csv '-t;' data.csv | awk '-F;' '{print $11}'\n" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2319 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2295 msgid "" "The code stores the options (except for the file descriptors) in `EDX`: The " "comma in `DH`, the new separator in `DL`, and the flag for the `-p` option " @@ -4260,12 +4217,12 @@ msgid "" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2321 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2297 msgid "Here is the code:" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2335 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2311 #, no-wrap msgid "" ";;;;;;; csv.asm ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;\n" @@ -4282,7 +4239,7 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2349 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2325 #, no-wrap msgid "" "section\t.data\n" @@ -4297,7 +4254,7 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2363 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2339 #, no-wrap msgid "" "section\t.text\n" @@ -4312,8 +4269,8 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2372 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:3421 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2348 +#: documentation/content/en/articles/x86-assembly/_index.adoc:3397 #, no-wrap msgid "" "align 4\n" @@ -4327,8 +4284,8 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2381 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:3430 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2357 +#: documentation/content/en/articles/x86-assembly/_index.adoc:3406 #, no-wrap msgid "" "align 4\n" @@ -4342,7 +4299,7 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2387 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2363 #, no-wrap msgid "" "align 4\n" @@ -4353,7 +4310,7 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2392 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2368 #, no-wrap msgid "" ".arg:\n" @@ -4363,8 +4320,8 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2396 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:3445 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2372 +#: documentation/content/en/articles/x86-assembly/_index.adoc:3421 #, no-wrap msgid "" "\t; ECX contains the pointer to an argument\n" @@ -4373,7 +4330,7 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2399 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2375 #, no-wrap msgid "" "\tinc\tecx\n" @@ -4381,8 +4338,8 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2403 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:3453 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2379 +#: documentation/content/en/articles/x86-assembly/_index.adoc:3429 #, no-wrap msgid "" ".o:\n" @@ -4391,8 +4348,8 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2407 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:3457 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2383 +#: documentation/content/en/articles/x86-assembly/_index.adoc:3433 #, no-wrap msgid "" "\t; Make sure we are not asked for the output file twice\n" @@ -4401,8 +4358,8 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2412 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:3462 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2388 +#: documentation/content/en/articles/x86-assembly/_index.adoc:3438 #, no-wrap msgid "" "\t; Find the path to output file - it is either at [ECX+1],\n" @@ -4412,7 +4369,7 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2418 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2394 #, no-wrap msgid "" "\tinc\tecx\n" @@ -4423,8 +4380,8 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2426 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:3475 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2402 +#: documentation/content/en/articles/x86-assembly/_index.adoc:3451 #, no-wrap msgid "" ".openoutput:\n" @@ -4437,8 +4394,8 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2430 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:3479 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2406 +#: documentation/content/en/articles/x86-assembly/_index.adoc:3455 #, no-wrap msgid "" "\tadd\tesp, byte 12\n" @@ -4447,8 +4404,8 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2434 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:3483 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2410 +#: documentation/content/en/articles/x86-assembly/_index.adoc:3459 #, no-wrap msgid "" ".i:\n" @@ -4457,8 +4414,8 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2438 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:3487 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2414 +#: documentation/content/en/articles/x86-assembly/_index.adoc:3463 #, no-wrap msgid "" "\t; Make sure we are not asked twice\n" @@ -4467,7 +4424,7 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2446 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2422 #, no-wrap msgid "" "\t; Find the path to the input file\n" @@ -4480,8 +4437,8 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2452 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:3500 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2428 +#: documentation/content/en/articles/x86-assembly/_index.adoc:3476 #, no-wrap msgid "" ".openinput:\n" @@ -4492,8 +4449,8 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2456 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:3504 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2432 +#: documentation/content/en/articles/x86-assembly/_index.adoc:3480 #, no-wrap msgid "" "\tadd\tesp, byte 8\n" @@ -4502,7 +4459,7 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2464 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2440 #, no-wrap msgid "" ".p:\n" @@ -4515,7 +4472,7 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2472 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2448 #, no-wrap msgid "" ".t:\n" @@ -4528,7 +4485,7 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2480 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2456 #, no-wrap msgid "" ".c:\n" @@ -4541,7 +4498,7 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2487 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2463 #, no-wrap msgid "" "align 4\n" @@ -4553,7 +4510,7 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2491 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2467 #, no-wrap msgid "" "\t; See if we are to preserve the first line\n" @@ -4562,7 +4519,7 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2497 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2473 #, no-wrap msgid "" ".firstline:\n" @@ -4573,7 +4530,7 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2505 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2481 #, no-wrap msgid "" "\t; is it a comma (or whatever the user asked for)?\n" @@ -4582,7 +4539,7 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2508 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2484 #, no-wrap msgid "" "\t; Replace the comma with a tab (or whatever the user wants)\n" @@ -4590,7 +4547,7 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2516 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2492 #, no-wrap msgid "" ".quote:\n" @@ -4599,7 +4556,7 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2523 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2499 #, no-wrap msgid "" "\t; Print everything until you get another quote or EOL. If it\n" @@ -4611,7 +4568,7 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2526 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2502 #, no-wrap msgid "" "\tcmp\tal, 0Ah\n" @@ -4619,7 +4576,7 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2529 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2505 #, no-wrap msgid "" "\tcall\tputchar\n" @@ -4627,8 +4584,8 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2545 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:3860 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2521 +#: documentation/content/en/articles/x86-assembly/_index.adoc:3836 #, no-wrap msgid "" "read:\n" @@ -4637,7 +4594,7 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2558 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2534 #, no-wrap msgid "" ".read:\n" @@ -4655,8 +4612,8 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2595 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:3901 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2571 +#: documentation/content/en/articles/x86-assembly/_index.adoc:3877 #, no-wrap msgid "" "align 4\n" @@ -4675,7 +4632,7 @@ msgid "" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2600 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2576 msgid "" "Much of it is taken from [.filename]#hex.asm# above. But there is one " "important difference: I no longer call `write` whenever I am outputting a " @@ -4683,16 +4640,16 @@ msgid "" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2604 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2580 msgid "" "I have found a better solution for the interactive problem since I first " -"started writing this chapter. I wanted to make sure each line is printed " +"started writing this article. I wanted to make sure each line is printed " "out separately only when needed. After all, there is no need to flush out " "every line when used non-interactively." msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2608 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2584 msgid "" "The new solution I use now is to call `write` every time I find the input " "buffer empty. That way, when running in the interactive mode, the program " @@ -4701,13 +4658,13 @@ msgid "" msgstr "" #. type: Title ==== -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2610 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2586 #, no-wrap msgid "The Dark Side of Buffering" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2614 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2590 msgid "" "This change prevents a mysterious lockup in a very specific case. I refer " "to it as the _dark side of buffering_, mostly because it presents a danger " @@ -4715,7 +4672,7 @@ msgid "" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2618 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2594 msgid "" "It is unlikely to happen with a program like the csv above, so let us " "consider yet another filter: In this case we expect our input to be raw data " @@ -4724,7 +4681,7 @@ msgid "" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2621 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2597 msgid "" "Such a filter would be very simple to write. Most of it would look just " "like all the other filters we have written so far, so I am only going to " @@ -4732,7 +4689,7 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2629 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2605 #, no-wrap msgid "" ".loop:\n" @@ -4743,72 +4700,72 @@ msgid "" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2632 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2608 msgid "" "Because this filter works with raw data, it is unlikely to be used " "interactively." msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2635 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2611 msgid "" "But it could be called by image manipulation software. And, unless it calls " "`write` before each call to `read`, chances are it will lock up." msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2637 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2613 msgid "Here is what might happen:" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2640 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2616 msgid "The image editor will load our filter using the C function `popen()`." msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2641 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2617 msgid "It will read the first row of pixels from a bitmap or pixmap." msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2642 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2618 msgid "" "It will write the first row of pixels to the _pipe_ leading to the `fd.in` " "of our filter." msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2643 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2619 msgid "" "Our filter will read each pixel from its input, turn it to a negative, and " "write it to its output buffer." msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2644 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2620 msgid "Our filter will call `getchar` to fetch the next pixel." msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2645 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2621 msgid "`getchar` will find an empty input buffer, so it will call `read`." msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2646 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2622 msgid "`read` will call the `SYS_read` system call." msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2647 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2623 msgid "" "The _kernel_ will suspend our filter until the image editor sends more data " "to the pipe." msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2648 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2624 msgid "" "The image editor will read from the other pipe, connected to the `fd.out` of " "our filter so it can set the first row of the output image _before_ it sends " @@ -4816,14 +4773,14 @@ msgid "" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2649 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2625 msgid "" "The _kernel_ suspends the image editor until it receives some output from " "our filter, so it can pass it on to the image editor." msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2653 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2629 msgid "" "At this point our filter waits for the image editor to send it more data to " "process, while the image editor is waiting for our filter to send it the " @@ -4832,7 +4789,7 @@ msgid "" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2656 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2632 msgid "" "The filter and the image editor will continue waiting for each other forever " "(or, at least, until they are killed). Our software has just entered a " @@ -4840,20 +4797,20 @@ msgid "" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2658 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2634 msgid "" "This problem does not exist if our filter flushes its output buffer _before_ " "asking the _kernel_ for more input data." msgstr "" #. type: Title == -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2660 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2636 #, no-wrap msgid "Using the FPU" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2663 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2639 msgid "" "Strangely enough, most of assembly language literature does not even mention " "the existence of the FPU, or _floating point unit_, let alone discuss " @@ -4861,7 +4818,7 @@ msgid "" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2665 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2641 msgid "" "Yet, never does assembly language shine more than when we create highly " "optimized FPU code by doing things that can be done _only_ in assembly " @@ -4869,13 +4826,13 @@ msgid "" msgstr "" #. type: Title === -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2667 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2643 #, no-wrap msgid "Organization of the FPU" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2671 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2647 msgid "" "The FPU consists of 8 80-bit floating-point registers. These are organized " "in a stack fashion-you can `push` a value on TOS (_top of stack_) and you " @@ -4883,14 +4840,14 @@ msgid "" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2673 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2649 msgid "" "That said, the assembly language op codes are not `push` and `pop` because " "those are already taken." msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2676 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2652 msgid "" "You can `push` a value on TOS by using `fld`, `fild`, and `fbld`. Several " "other op codes let you `push` many common _constants_-such as _pi_-on the " @@ -4898,7 +4855,7 @@ msgid "" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2679 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2655 msgid "" "Similarly, you can `pop` a value by using `fst`, `fstp`, `fist`, `fistp`, " "and `fbstp`. Actually, only the op codes that end with a _p_ will literally " @@ -4907,7 +4864,7 @@ msgid "" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2681 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2657 msgid "" "We can transfer the data between the TOS and the computer memory either as a " "32-bit, 64-bit, or 80-bit _real_, a 16-bit, 32-bit, or 64-bit _integer_, or " @@ -4915,7 +4872,7 @@ msgid "" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2684 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2660 msgid "" "The 80-bit _packed decimal_ is a special case of _binary coded decimal_ " "which is very convenient when converting between the ASCII representation of " @@ -4924,14 +4881,14 @@ msgid "" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2686 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2662 msgid "" "No matter how we represent data in the memory, the FPU always stores it in " "the 80-bit _real_ format in its registers." msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2688 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2664 msgid "" "Its internal precision is at least 19 decimal digits, so even if we choose " "to display results as ASCII in the full 18-digit precision, we are still " @@ -4939,7 +4896,7 @@ msgid "" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2690 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2666 msgid "" "We can perform mathematical operations on the TOS: We can calculate its " "_sine_, we can _scale_ it (i.e., we can multiply or divide it by a power of " @@ -4947,21 +4904,21 @@ msgid "" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2692 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2668 msgid "" "We can also _multiply_ or _divide_ it by, _add_ it to, or _subtract_ it " "from, any of the FPU registers (including itself)." msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2695 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2671 msgid "" "The official Intel op code for the TOS is `st`, and for the _registers_ " "`st(0)`-`st(7)`. `st` and `st(0)`, then, refer to the same register." msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2698 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2674 msgid "" "For whatever reasons, the original author of nasm has decided to use " "different op codes, namely `st0`-`st7`. In other words, there are no " @@ -4969,27 +4926,27 @@ msgid "" msgstr "" #. type: Title ==== -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2700 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2676 #, no-wrap msgid "The Packed Decimal Format" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2704 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2680 msgid "" "The _packed decimal_ format uses 10 bytes (80 bits) of memory to represent " "18 digits. The number represented there is always an _integer_." msgstr "" #. type: delimited block = 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2708 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2684 msgid "" "You can use it to get decimal places by multiplying the TOS by a power of 10 " "first." msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2712 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2688 msgid "" "The highest bit of the highest byte (byte 9) is the _sign bit_: If it is " "set, the number is _negative_, otherwise, it is _positive_. The rest of the " @@ -4997,56 +4954,56 @@ msgid "" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2714 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2690 msgid "" "The remaining 9 bytes store the 18 digits of the number: 2 digits per byte." msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2716 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2692 msgid "" "The _more significant digit_ is stored in the high _nibble_ (4 bits), the " "_less significant digit_ in the low _nibble_." msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2718 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2694 msgid "" "That said, you might think that `-1234567` would be stored in the memory " "like this (using hexadecimal notation):" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2722 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2698 #, no-wrap msgid "80 00 00 00 00 00 01 23 45 67\n" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2725 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2701 msgid "" "Alas it is not! As with everything else of Intel make, even the _packed " "decimal_ is _little-endian_." msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2727 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2703 msgid "That means our `-1234567` is stored like this:" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2731 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2707 #, no-wrap msgid "67 45 23 01 00 00 00 00 00 80\n" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2734 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2710 msgid "Remember that, or you will be pulling your hair out in desperation!" msgstr "" #. type: delimited block = 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2740 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2716 msgid "" "The book to read-if you can find it-is Richard Startz' http://www.amazon.com/" "exec/obidos/ASIN/013246604X/whizkidtechnomag[8087/80287/80387 for the IBM PC " @@ -5058,40 +5015,40 @@ msgid "" msgstr "" #. type: Title === -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2743 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2719 #, no-wrap msgid "Excursion to Pinhole Photography" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2746 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2722 msgid "" "To write meaningful software, we must not only understand our programming " "tools, but also the field we are creating software for." msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2748 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2724 msgid "" "Our next filter will help us whenever we want to build a _pinhole camera_, " "so, we need some background in _pinhole photography_ before we can continue." msgstr "" #. type: Title ==== -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2750 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2726 #, no-wrap msgid "The Camera" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2753 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2729 msgid "" "The easiest way to describe any camera ever built is as some empty space " "enclosed in some lightproof material, with a small hole in the enclosure." msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2758 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2734 msgid "" "The enclosure is usually sturdy (e.g., a box), though sometimes it is " "flexible (the bellows). It is quite dark inside the camera. However, the " @@ -5101,27 +5058,27 @@ msgid "" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2760 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2736 msgid "" "If some light sensitive material (such as film) is placed inside the camera, " "it can capture the image." msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2762 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2738 msgid "" "The hole often contains a _lens_, or a lens assembly, often called the " "_objective_." msgstr "" #. type: Title ==== -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2764 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2740 #, no-wrap msgid "The Pinhole" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2768 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2744 msgid "" "But, strictly speaking, the lens is not necessary: The original cameras did " "not use a lens but a _pinhole_. Even today, _pinholes_ are used, both as a " @@ -5129,7 +5086,7 @@ msgid "" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2772 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2748 msgid "" "The image produced by the _pinhole_ is all equally sharp. Or _blurred_. " "There is an ideal size for a pinhole: If it is either larger or smaller, the " @@ -5137,26 +5094,26 @@ msgid "" msgstr "" #. type: Title ==== -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2774 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2750 #, no-wrap msgid "Focal Length" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2777 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2753 msgid "" "This ideal pinhole diameter is a function of the square root of _focal " "length_, which is the distance of the pinhole from the film." msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2781 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2757 #, no-wrap msgid "D = PC * sqrt(FL)\n" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2787 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2763 msgid "" "In here, `D` is the ideal diameter of the pinhole, `FL` is the focal length, " "and `PC` is a pinhole constant. According to Jay Bender, its value is " @@ -5167,13 +5124,13 @@ msgid "" msgstr "" #. type: Title ==== -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2789 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2765 #, no-wrap msgid "The F-Number" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2793 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2769 msgid "" "The f-number is a very useful measure of how much light reaches the film. A " "light meter can determine that, for example, to expose a film of specific " @@ -5181,25 +5138,25 @@ msgid "" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2796 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2772 msgid "" "It does not matter whether it is a 35-mm camera, or a 6x9cm camera, etc. As " "long as we know the f-number, we can determine the proper exposure." msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2798 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2774 msgid "The f-number is easy to calculate:" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2802 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2778 #, no-wrap msgid "F = FL / D\n" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2807 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2783 msgid "" "In other words, the f-number equals the focal length divided by the diameter " "of the pinhole. It also means a higher f-number either implies a smaller " @@ -5208,7 +5165,7 @@ msgid "" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2810 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2786 msgid "" "Furthermore, while pinhole diameter and focal distance are one-dimensional " "measurements, both, the film and the pinhole, are two-dimensional. That " @@ -5217,33 +5174,33 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2814 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2790 #, no-wrap msgid "t * (B / A)²\n" msgstr "" #. type: Title ==== -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2817 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2793 #, no-wrap msgid "Normalized F-Number" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2820 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2796 msgid "" "While many modern cameras can change the diameter of their pinhole, and thus " "their f-number, quite smoothly and gradually, such was not always the case." msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2822 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2798 msgid "" "To allow for different f-numbers, cameras typically contained a metal plate " "with several holes of different sizes drilled to them." msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2825 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2801 msgid "" "Their sizes were chosen according to the above formula in such a way that " "the resultant f-number was one of standard f-numbers used on all cameras " @@ -5252,7 +5209,7 @@ msgid "" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2828 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2804 msgid "" "A more recently made camera may offer f-numbers of 2.8, 4, 5.6, 8, 11, 16, " "22, and 32 (as well as others). These numbers were not chosen arbitrarily: " @@ -5261,13 +5218,13 @@ msgid "" msgstr "" #. type: Title ==== -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2830 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2806 #, no-wrap msgid "The F-Stop" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2834 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2810 msgid "" "A typical camera is designed in such a way that setting any of the " "normalized f-numbers changes the feel of the dial. It will naturally _stop_ " @@ -5276,7 +5233,7 @@ msgid "" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2838 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2814 msgid "" "Since the f-numbers at each stop are powers of the square root of 2, moving " "the dial by 1 stop will double the amount of light required for proper " @@ -5286,25 +5243,25 @@ msgid "" msgstr "" #. type: Title === -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2840 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2816 #, no-wrap msgid "Designing the Pinhole Software" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2843 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2819 msgid "" "We are now ready to decide what exactly we want our pinhole software to do." msgstr "" #. type: Title ==== -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2845 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2821 #, no-wrap msgid "Processing Program Input" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2849 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2825 msgid "" "Since its main purpose is to help us design a working pinhole camera, we " "will use the _focal length_ as the input to the program. This is something " @@ -5314,7 +5271,7 @@ msgid "" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2851 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2827 msgid "" "Most of the programs we have written so far worked with individual " "characters, or bytes, as their input: The hex program converted individual " @@ -5323,21 +5280,21 @@ msgid "" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2853 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2829 msgid "" "One program, ftuc used the state machine to consider at most two input bytes " "at a time." msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2855 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2831 msgid "" "But our pinhole program cannot just work with individual characters, it has " "to deal with larger syntactic units." msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2857 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2833 msgid "" "For example, if we want the program to calculate the pinhole diameter (and " "other values we will discuss later) at the focal lengths of `100 mm`, `150 " @@ -5345,13 +5302,13 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2861 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2837 #, no-wrap msgid " 100, 150, 210\n" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2866 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2842 msgid "" "Our program needs to consider more than a single byte of input at a time. " "When it sees the first `1`, it must understand it is seeing the first digit " @@ -5360,7 +5317,7 @@ msgid "" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2871 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2847 msgid "" "When it encounters the first comma, it must know it is no longer receiving " "the digits of the first number. It must be able to convert the digits of " @@ -5370,7 +5327,7 @@ msgid "" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2873 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2849 msgid "" "We need to decide what delimiters to accept: Do the input numbers have to be " "separated by a comma? If so, how do we treat two numbers separated by " @@ -5378,7 +5335,7 @@ msgid "" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2878 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2854 msgid "" "Personally, I like to keep it simple. Something either is a number, so I " "process it. Or it is not a number, so I discard it. I do not like the " @@ -5387,14 +5344,14 @@ msgid "" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2880 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2856 msgid "" "Plus, it allows me to break up the monotony of computing and type in a query " "instead of just a number:" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2885 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2861 #, no-wrap msgid "" "What is the best pinhole diameter for the\n" @@ -5402,12 +5359,12 @@ msgid "" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2888 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2864 msgid "There is no reason for the computer to spit out a number of complaints:" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2895 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2871 #, no-wrap msgid "" "Syntax error: What\n" @@ -5417,12 +5374,12 @@ msgid "" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2898 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2874 msgid "Et cetera, et cetera, et cetera." msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2901 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2877 msgid "" "Secondly, I like the `+#+` character to denote the start of a comment which " "extends to the end of the line. This does not take too much effort to code, " @@ -5430,7 +5387,7 @@ msgid "" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2903 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2879 msgid "" "In our case, we also need to decide what units the input should come in: We " "choose _millimeters_ because that is how most photographers measure the " @@ -5438,7 +5395,7 @@ msgid "" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2905 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2881 msgid "" "Finally, we need to decide whether to allow the use of the decimal point (in " "which case we must also consider the fact that much of the world uses a " @@ -5446,7 +5403,7 @@ msgid "" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2909 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2885 msgid "" "In our case allowing for the decimal point/comma would offer a false sense " "of precision: There is little if any noticeable difference between the focus " @@ -5456,13 +5413,13 @@ msgid "" msgstr "" #. type: Title ==== -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2911 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2887 #, no-wrap msgid "Offering Options" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2916 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2892 msgid "" "The most important thing we need to know when building a pinhole camera is " "the diameter of the pinhole. Since we want to shoot sharp images, we will " @@ -5472,20 +5429,20 @@ msgid "" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2918 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2894 msgid "" -"It is traditional in UNIX(R) programming to have two main ways of choosing " +"It is traditional in UNIX programming to have two main ways of choosing " "program parameters, plus to have a default for the time the user does not " "make a choice." msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2920 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2896 msgid "Why have two ways of choosing?" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2922 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2898 msgid "" "One is to allow a (relatively) _permanent_ choice that applies automatically " "each time the software is run without us having to tell it over and over " @@ -5493,7 +5450,7 @@ msgid "" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2927 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2903 msgid "" "The permanent choices may be stored in a configuration file, typically found " "in the user's home directory. The file usually has the same name as the " @@ -5504,7 +5461,7 @@ msgid "" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2932 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2908 msgid "" "The configuration file is used mostly by programs that have many " "configurable parameters. Those that have only one (or a few) often use a " @@ -5514,7 +5471,7 @@ msgid "" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2935 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2911 msgid "" "Usually, a program uses one or the other of the above methods. Otherwise, " "if a configuration file said one thing, but an environment variable another, " @@ -5522,14 +5479,14 @@ msgid "" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2937 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2913 msgid "" "Because we only need to choose _one_ such parameter, we will go with the " "second method and search the environment for a variable named `PINHOLE`." msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2940 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2916 msgid "" "The other way allows us to make _ad hoc_ decisions: _\"Though I usually want " "you to use 0.039, this time I want 0.03872.\"_ In other words, it allows us " @@ -5537,12 +5494,12 @@ msgid "" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2942 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2918 msgid "This type of choice is usually done with command line parameters." msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2950 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2926 msgid "" "Finally, a program _always_ needs a _default_. The user may not make any " "choices. Perhaps he does not know what to choose. Perhaps he is \"just " @@ -5552,45 +5509,45 @@ msgid "" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2952 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2928 msgid "" "Given this system, the program may find conflicting options, and handle them " "this way:" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2955 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2931 msgid "" "If it finds an _ad hoc_ choice (e.g., command line parameter), it should " "accept that choice. It must ignore any permanent choice and any default." msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2956 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2932 msgid "" "_Otherwise_, if it finds a permanent option (e.g., an environment variable), " "it should accept it, and ignore the default." msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2957 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2933 msgid "_Otherwise_, it should use the default." msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2959 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2935 msgid "We also need to decide what _format_ our `PC` option should have." msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2961 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2937 msgid "" "At first site, it seems obvious to use the `PINHOLE=0.04` format for the " "environment variable, and `-p0.04` for the command line." msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2965 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2941 msgid "" "Allowing that is actually a security risk. The `PC` constant is a very small " "number. Naturally, we will test our software using various small values of " @@ -5599,14 +5556,14 @@ msgid "" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2967 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2943 msgid "" "It may crash the program because we have not designed it to handle huge " "numbers." msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2970 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2946 msgid "" "Or, we may spend more time on the program so it can handle huge numbers. We " "might do that if we were writing commercial software for computer illiterate " @@ -5614,19 +5571,19 @@ msgid "" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2972 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2948 msgid "Or, we might say, _\"Tough! The user should know better.\"\"_" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2975 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2951 msgid "" "Or, we just may make it impossible for the user to enter a huge number. " "This is the approach we will take: We will use an _implied 0._ prefix." msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2978 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2954 msgid "" "In other words, if the user wants `0.04`, we will expect him to type `-p04`, " "or set `PINHOLE=04` in his environment. So, if he says `-p9999999`, we will " @@ -5634,7 +5591,7 @@ msgid "" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2981 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2957 msgid "" "Secondly, many users will just want to go with either Bender's constant or " "Connors' constant. To make it easier on them, we will interpret `-b` as " @@ -5642,20 +5599,20 @@ msgid "" msgstr "" #. type: Title ==== -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2983 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2959 #, no-wrap msgid "The Output" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2986 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2962 msgid "" "We need to decide what we want our software to send to the output, and in " "what format." msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2988 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2964 msgid "" "Since our input allows for an unspecified number of focal length entries, it " "makes sense to use a traditional database-style output of showing the result " @@ -5664,7 +5621,7 @@ msgid "" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2991 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2967 msgid "" "Optionally, we should also allow the user to specify the use of the CSV " "format we have studied earlier. In this case, we will print out a line of " @@ -5673,7 +5630,7 @@ msgid "" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:2996 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2972 msgid "" "We need a command line option for the CSV format. We cannot use `-c` " "because that already means _use Connors' constant_. For some strange " @@ -5683,7 +5640,7 @@ msgid "" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:3000 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2976 msgid "" "We will start each line of the output with the focal length. This may sound " "repetitious at first, especially in the interactive mode: The user types in " @@ -5691,7 +5648,7 @@ msgid "" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:3004 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2980 msgid "" "But the user can type several focal lengths on one line. The input can also " "come in from a file or from the output of another program. In that case the " @@ -5699,70 +5656,70 @@ msgid "" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:3006 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2982 msgid "" "By the same token, the output can go to a file which we will want to examine " "later, or it could go to the printer, or become the input of another program." msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:3008 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2984 msgid "" "So, it makes perfect sense to start each line with the focal length as " "entered by the user." msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:3011 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2987 msgid "" "No, wait! Not as entered by the user. What if the user types in something " "like this:" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:3015 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2991 #, no-wrap msgid " 00000000150\n" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:3018 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2994 msgid "Clearly, we need to strip those leading zeros." msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:3020 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2996 msgid "" "So, we might consider reading the user input as is, converting it to binary " "inside the FPU, and printing it out from there." msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:3022 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:3207 +#: documentation/content/en/articles/x86-assembly/_index.adoc:2998 +#: documentation/content/en/articles/x86-assembly/_index.adoc:3183 msgid "But..." msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:3024 +#: documentation/content/en/articles/x86-assembly/_index.adoc:3000 msgid "What if the user types something like this:" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:3028 +#: documentation/content/en/articles/x86-assembly/_index.adoc:3004 #, no-wrap msgid " 17459765723452353453534535353530530534563507309676764423\n" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:3033 +#: documentation/content/en/articles/x86-assembly/_index.adoc:3009 msgid "" "Ha! The packed decimal FPU format lets us input 18-digit numbers. But the " "user has entered more than 18 digits. How do we handle that?" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:3035 +#: documentation/content/en/articles/x86-assembly/_index.adoc:3011 msgid "" "Well, we _could_ modify our code to read the first 18 digits, enter it to " "the FPU, then read more, multiply what we already have on the TOS by 10 " @@ -5770,7 +5727,7 @@ msgid "" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:3039 +#: documentation/content/en/articles/x86-assembly/_index.adoc:3015 msgid "" "Yes, we could do that. But in _this_ program it would be ridiculous (in a " "different one it may be just the thing to do): Even the circumference of the " @@ -5779,7 +5736,7 @@ msgid "" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:3041 +#: documentation/content/en/articles/x86-assembly/_index.adoc:3017 msgid "" "So, if the user enters such a huge number, he is either bored, or testing " "us, or trying to break into the system, or playing games-doing anything but " @@ -5787,23 +5744,23 @@ msgid "" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:3043 +#: documentation/content/en/articles/x86-assembly/_index.adoc:3019 msgid "What will we do?" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:3045 +#: documentation/content/en/articles/x86-assembly/_index.adoc:3021 msgid "We will slap him in the face, in a manner of speaking:" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:3049 +#: documentation/content/en/articles/x86-assembly/_index.adoc:3025 #, no-wrap msgid "17459765723452353453534535353530530534563507309676764423\t???\t???\t???\t???\t???\n" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:3053 +#: documentation/content/en/articles/x86-assembly/_index.adoc:3029 msgid "" "To achieve that, we will simply ignore any leading zeros. Once we find a " "non-zero digit, we will initialize a counter to `0` and start taking three " @@ -5811,45 +5768,45 @@ msgid "" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:3056 +#: documentation/content/en/articles/x86-assembly/_index.adoc:3032 msgid "Send the digit to the output." msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:3057 +#: documentation/content/en/articles/x86-assembly/_index.adoc:3033 msgid "" "Append the digit to a buffer we will use later to produce the packed decimal " "we can send to the FPU." msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:3058 +#: documentation/content/en/articles/x86-assembly/_index.adoc:3034 msgid "Increase the counter." msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:3060 +#: documentation/content/en/articles/x86-assembly/_index.adoc:3036 msgid "" "Now, while we are taking these three steps, we also need to watch out for " "one of two conditions:" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:3062 +#: documentation/content/en/articles/x86-assembly/_index.adoc:3038 msgid "" "If the counter grows above 18, we stop appending to the buffer. We continue " "reading the digits and sending them to the output." msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:3063 +#: documentation/content/en/articles/x86-assembly/_index.adoc:3039 msgid "" "If, or rather _when_, the next input character is not a digit, we are done " "inputting for now." msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:3066 +#: documentation/content/en/articles/x86-assembly/_index.adoc:3042 msgid "" "Incidentally, we can simply discard the non-digit, unless it is a `+#+`, " "which we must return to the input stream. It starts a comment, so we must " @@ -5857,14 +5814,14 @@ msgid "" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:3068 +#: documentation/content/en/articles/x86-assembly/_index.adoc:3044 msgid "" "That still leaves one possibility uncovered: If all the user enters is a " "zero (or several zeros), we will never find a non-zero to display." msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:3071 +#: documentation/content/en/articles/x86-assembly/_index.adoc:3047 msgid "" "We can determine this has happened whenever our counter stays at `0`. In " "that case we need to send `0` to the output, and perform another \"slap in " @@ -5872,20 +5829,20 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:3075 +#: documentation/content/en/articles/x86-assembly/_index.adoc:3051 #, no-wrap msgid "0\t???\t???\t???\t???\t???\n" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:3078 +#: documentation/content/en/articles/x86-assembly/_index.adoc:3054 msgid "" "Once we have displayed the focal length and determined it is valid (greater " "than `0` but not exceeding 18 digits), we can calculate the pinhole diameter." msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:3081 +#: documentation/content/en/articles/x86-assembly/_index.adoc:3057 msgid "" "It is not by coincidence that _pinhole_ contains the word _pin_. Indeed, " "many a pinhole literally is a _pin hole_, a hole carefully punched with the " @@ -5893,7 +5850,7 @@ msgid "" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:3084 +#: documentation/content/en/articles/x86-assembly/_index.adoc:3060 msgid "" "That is because a typical pinhole is very small. Our formula gets the result " "in millimeters. We will multiply it by `1000`, so we can output the result " @@ -5901,12 +5858,12 @@ msgid "" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:3086 +#: documentation/content/en/articles/x86-assembly/_index.adoc:3062 msgid "At this point we have yet another trap to face: _Too much precision._" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:3090 +#: documentation/content/en/articles/x86-assembly/_index.adoc:3066 msgid "" "Yes, the FPU was designed for high precision mathematics. But we are not " "dealing with high precision mathematics. We are dealing with physics " @@ -5914,7 +5871,7 @@ msgid "" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:3094 +#: documentation/content/en/articles/x86-assembly/_index.adoc:3070 msgid "" "Suppose we want to convert a truck into a pinhole camera (we would not be " "the first ones to do that!). Suppose its box is `12` meters long, so we " @@ -5924,7 +5881,7 @@ msgid "" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:3099 +#: documentation/content/en/articles/x86-assembly/_index.adoc:3075 msgid "" "Put either way, the result is absurdly precise. Our truck is not _exactly_ " "`12000` millimeters long. We did not measure its length with such a " @@ -5933,14 +5890,14 @@ msgid "" msgstr "" #. type: delimited block = 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:3104 +#: documentation/content/en/articles/x86-assembly/_index.adoc:3080 msgid "" "I \"only\" used ten digits in the above example. Imagine the absurdity of " "going for all 18!" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:3110 +#: documentation/content/en/articles/x86-assembly/_index.adoc:3086 msgid "" "We need to limit the number of significant digits of our result. One way of " "doing it is by using an integer representing microns. So, our truck would " @@ -5949,7 +5906,7 @@ msgid "" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:3113 +#: documentation/content/en/articles/x86-assembly/_index.adoc:3089 msgid "" "Additionally, we can decide that no matter how big a result we get, we only " "want to display four significant digits (or any other number of them, of " @@ -5958,44 +5915,44 @@ msgid "" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:3115 +#: documentation/content/en/articles/x86-assembly/_index.adoc:3091 msgid "" "We, therefore, must devise an algorithm to reduce the number of significant " "digits." msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:3117 +#: documentation/content/en/articles/x86-assembly/_index.adoc:3093 msgid "" "Here is mine (I think it is awkward-if you know a better one, _please_, let " "me know):" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:3120 +#: documentation/content/en/articles/x86-assembly/_index.adoc:3096 msgid "Initialize a counter to `0`." msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:3121 +#: documentation/content/en/articles/x86-assembly/_index.adoc:3097 msgid "" "While the number is greater than or equal to `10000`, divide it by `10` and " "increase the counter." msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:3122 +#: documentation/content/en/articles/x86-assembly/_index.adoc:3098 msgid "Output the result." msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:3123 +#: documentation/content/en/articles/x86-assembly/_index.adoc:3099 msgid "" "While the counter is greater than `0`, output `0` and decrease the counter." msgstr "" #. type: delimited block = 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:3128 +#: documentation/content/en/articles/x86-assembly/_index.adoc:3104 msgid "" "The `10000` is only good if you want _four_ significant digits. For any " "other number of significant digits, replace `10000` with `10` raised to the " @@ -6003,21 +5960,21 @@ msgid "" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:3131 +#: documentation/content/en/articles/x86-assembly/_index.adoc:3107 msgid "" "We will, then, output the pinhole diameter in microns, rounded off to four " "significant digits." msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:3134 +#: documentation/content/en/articles/x86-assembly/_index.adoc:3110 msgid "" "At this point, we know the _focal length_ and the _pinhole diameter_. That " "means we have enough information to also calculate the _f-number_." msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:3138 +#: documentation/content/en/articles/x86-assembly/_index.adoc:3114 msgid "" "We will display the f-number, rounded to four significant digits. Chances " "are the f-number will tell us very little. To make it more meaningful, we " @@ -6026,7 +5983,7 @@ msgid "" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:3144 +#: documentation/content/en/articles/x86-assembly/_index.adoc:3120 msgid "" "We do that by multiplying the actual f-number by itself, which, of course, " "will give us its `square`. We will then calculate its base-2 logarithm, " @@ -6039,14 +5996,14 @@ msgid "" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:3147 +#: documentation/content/en/articles/x86-assembly/_index.adoc:3123 msgid "" "If all that sounds overwhelming-or too much work, perhaps-it may become much " "clearer if you see the code. It takes 9 op codes altogether:" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:3159 +#: documentation/content/en/articles/x86-assembly/_index.adoc:3135 #, no-wrap msgid "" "fmul\tst0, st0\n" @@ -6061,7 +6018,7 @@ msgid "" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:3163 +#: documentation/content/en/articles/x86-assembly/_index.adoc:3139 msgid "" "The first line, `fmul st0, st0`, squares the contents of the TOS (top of the " "stack, same as `st`, called `st0` by nasm). The `fld1` pushes `1` on the " @@ -6069,7 +6026,7 @@ msgid "" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:3167 +#: documentation/content/en/articles/x86-assembly/_index.adoc:3143 msgid "" "The next line, `fld st1`, pushes the square back to the TOS. At this point " "the square is both in `st` and `st(2)` (it will become clear why we leave a " @@ -6077,21 +6034,21 @@ msgid "" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:3170 +#: documentation/content/en/articles/x86-assembly/_index.adoc:3146 msgid "" "Next, `fyl2x` calculates base-2 logarithm of `st` multiplied by `st(1)`. " "That is why we placed `1` on `st(1)` before." msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:3172 +#: documentation/content/en/articles/x86-assembly/_index.adoc:3148 msgid "" "At this point, `st` contains the logarithm we have just calculated, `st(1)` " "contains the square of the actual f-number we saved for later." msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:3176 +#: documentation/content/en/articles/x86-assembly/_index.adoc:3152 msgid "" "`frndint` rounds the TOS to the nearest integer. `fld1` pushes a `1`. " "`fscale` shifts the `1` we have on the TOS by the value in `st(1)`, " @@ -6099,14 +6056,14 @@ msgid "" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:3178 +#: documentation/content/en/articles/x86-assembly/_index.adoc:3154 msgid "" "Finally, `fsqrt` calculates the square root of the result, i.e., the nearest " "normalized f-number." msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:3181 +#: documentation/content/en/articles/x86-assembly/_index.adoc:3157 msgid "" "We now have the nearest normalized f-number on the TOS, the base-2 logarithm " "rounded to the nearest integer in `st(1)`, and the square of the actual f-" @@ -6114,7 +6071,7 @@ msgid "" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:3187 +#: documentation/content/en/articles/x86-assembly/_index.adoc:3163 msgid "" "But we do not need the contents of `st(1)` anymore. The last line, `fstp " "st1`, places the contents of `st` to `st(1)`, and pops. As a result, what " @@ -6124,7 +6081,7 @@ msgid "" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:3190 +#: documentation/content/en/articles/x86-assembly/_index.adoc:3166 msgid "" "At this point, we are ready to output the normalized f-number. Because it " "is normalized, we will not round it off to four significant digits, but will " @@ -6132,7 +6089,7 @@ msgid "" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:3193 +#: documentation/content/en/articles/x86-assembly/_index.adoc:3169 msgid "" "The normalized f-number is useful as long as it is reasonably small and can " "be found on our light meter. Otherwise we need a different method of " @@ -6140,14 +6097,14 @@ msgid "" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:3195 +#: documentation/content/en/articles/x86-assembly/_index.adoc:3171 msgid "" "Earlier we have figured out the formula of calculating proper exposure at an " "arbitrary f-number from that measured at a different f-number." msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:3198 +#: documentation/content/en/articles/x86-assembly/_index.adoc:3174 msgid "" "Every light meter I have ever seen can determine proper exposure at f5.6. " "We will, therefore, calculate an _\"f5.6 multiplier,\"_ i.e., by how much we " @@ -6156,7 +6113,7 @@ msgid "" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:3200 +#: documentation/content/en/articles/x86-assembly/_index.adoc:3176 msgid "" "From the above formula we know this factor can be calculated by dividing our " "f-number (the actual one, not the normalized one) by `5.6`, and squaring the " @@ -6164,21 +6121,21 @@ msgid "" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:3202 +#: documentation/content/en/articles/x86-assembly/_index.adoc:3178 msgid "" "Mathematically, dividing the square of our f-number by the square of `5.6` " "will give us the same result." msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:3205 +#: documentation/content/en/articles/x86-assembly/_index.adoc:3181 msgid "" "Computationally, we do not want to square two numbers when we can only " "square one. So, the first solution seems better at first." msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:3213 +#: documentation/content/en/articles/x86-assembly/_index.adoc:3189 msgid "" "`5.6` is a _constant_. We do not have to have our FPU waste precious " "cycles. We can just tell it to divide the square of the f-number by " @@ -6187,12 +6144,12 @@ msgid "" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:3215 +#: documentation/content/en/articles/x86-assembly/_index.adoc:3191 msgid "But, they are not!" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:3219 +#: documentation/content/en/articles/x86-assembly/_index.adoc:3195 msgid "" "Having studied the principles of photography above, we remember that the " "`5.6` is actually square root of 2 raised to the fifth power. An " @@ -6200,7 +6157,7 @@ msgid "" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:3225 +#: documentation/content/en/articles/x86-assembly/_index.adoc:3201 msgid "" "Not only is `32` an integer, it is a power of 2. We do not need to divide " "the square of the f-number by `32`. We only need to use `fscale` to shift " @@ -6209,7 +6166,7 @@ msgid "" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:3228 +#: documentation/content/en/articles/x86-assembly/_index.adoc:3204 msgid "" "So, now it has become clear why we have saved the square of the f-number on " "the top of the FPU stack. The calculation of the f5.6 multiplier is the " @@ -6218,7 +6175,7 @@ msgid "" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:3231 +#: documentation/content/en/articles/x86-assembly/_index.adoc:3207 msgid "" "There is one more useful number we can calculate: The number of stops our f-" "number is from f5.6. This may help us if our f-number is just outside the " @@ -6227,7 +6184,7 @@ msgid "" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:3234 +#: documentation/content/en/articles/x86-assembly/_index.adoc:3210 msgid "" "Say, our f-number is 5 stops from f5.6, and the light meter says we should " "use 1/1000 sec. Then we can set our shutter speed to 1/1000 first, then " @@ -6235,7 +6192,7 @@ msgid "" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:3239 +#: documentation/content/en/articles/x86-assembly/_index.adoc:3215 msgid "" "This calculation is quite easy as well. All we have to do is to calculate " "the base-2 logarithm of the f5.6 multiplier we had just calculated (though " @@ -6246,20 +6203,20 @@ msgid "" msgstr "" #. type: Title === -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:3241 +#: documentation/content/en/articles/x86-assembly/_index.adoc:3217 #, no-wrap msgid "FPU Optimizations" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:3244 +#: documentation/content/en/articles/x86-assembly/_index.adoc:3220 msgid "" "In assembly language we can optimize the FPU code in ways impossible in high " "languages, including C." msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:3248 +#: documentation/content/en/articles/x86-assembly/_index.adoc:3224 msgid "" "Whenever a C function needs to calculate a floating-point value, it loads " "all necessary variables and constants into FPU registers. It then does " @@ -6268,7 +6225,7 @@ msgid "" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:3252 +#: documentation/content/en/articles/x86-assembly/_index.adoc:3228 msgid "" "It \"returns\" the value by leaving the result on the TOS. However, before " "it returns, it cleans up. Any variables and constants it used in its " @@ -6276,35 +6233,35 @@ msgid "" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:3254 +#: documentation/content/en/articles/x86-assembly/_index.adoc:3230 msgid "" "It cannot do what we just did above: We calculated the square of the f-" "number and kept it on the stack for later use by another function." msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:3257 +#: documentation/content/en/articles/x86-assembly/_index.adoc:3233 msgid "" "We _knew_ we would need that value later on. We also knew we had enough " "room on the stack (which only has room for 8 numbers) to store it there." msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:3259 +#: documentation/content/en/articles/x86-assembly/_index.adoc:3235 msgid "" "A C compiler has no way of knowing that a value it has on the stack will be " "required again in the very near future." msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:3262 +#: documentation/content/en/articles/x86-assembly/_index.adoc:3238 msgid "" "Of course, the C programmer may know it. But the only recourse he has is to " "store the value in a memory variable." msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:3264 +#: documentation/content/en/articles/x86-assembly/_index.adoc:3240 msgid "" "That means, for one, the value will be changed from the 80-bit precision " "used internally by the FPU to a C _double_ (64 bits) or even _single_ (32 " @@ -6312,7 +6269,7 @@ msgid "" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:3267 +#: documentation/content/en/articles/x86-assembly/_index.adoc:3243 msgid "" "That also means that the value must be moved from the TOS into the memory, " "and then back again. Alas, of all FPU operations, the ones that access the " @@ -6320,21 +6277,21 @@ msgid "" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:3269 +#: documentation/content/en/articles/x86-assembly/_index.adoc:3245 msgid "" "So, whenever programming the FPU in assembly language, look for the ways of " "keeping intermediate results on the FPU stack." msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:3271 +#: documentation/content/en/articles/x86-assembly/_index.adoc:3247 msgid "" "We can take that idea even further! In our program we are using a _constant_ " "(the one we named `PC`)." msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:3274 +#: documentation/content/en/articles/x86-assembly/_index.adoc:3250 msgid "" "It does not matter how many pinhole diameters we are calculating: 1, 10, 20, " "1000, we are always using the same constant. Therefore, we can optimize our " @@ -6342,7 +6299,7 @@ msgid "" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:3277 +#: documentation/content/en/articles/x86-assembly/_index.adoc:3253 msgid "" "Early on in our program, we are calculating the value of the above " "constant. We need to divide our input by `10` for every digit in the " @@ -6350,7 +6307,7 @@ msgid "" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:3280 +#: documentation/content/en/articles/x86-assembly/_index.adoc:3256 msgid "" "It is much faster to multiply than to divide. So, at the start of our " "program, we divide `10` into `1` to obtain `0.1`, which we then keep on the " @@ -6359,7 +6316,7 @@ msgid "" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:3284 +#: documentation/content/en/articles/x86-assembly/_index.adoc:3260 msgid "" "By the way, we do not input `0.1` directly, even though we could. We have a " "reason for that: While `0.1` can be expressed with just one decimal place, " @@ -6368,7 +6325,7 @@ msgid "" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:3289 +#: documentation/content/en/articles/x86-assembly/_index.adoc:3265 msgid "" "We are using other constants: We multiply the pinhole diameter by `1000` to " "convert it from millimeters to microns. We compare numbers to `10000` when " @@ -6378,7 +6335,7 @@ msgid "" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:3295 +#: documentation/content/en/articles/x86-assembly/_index.adoc:3271 msgid "" "Last but not least, we keep `-5` on the stack. We need it to scale the " "square of the f-number, instead of dividing it by `32`. It is not by " @@ -6389,14 +6346,14 @@ msgid "" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:3298 +#: documentation/content/en/articles/x86-assembly/_index.adoc:3274 msgid "" "It is common to create certain constants from scratch instead of loading " "them from the memory. That is what we are doing with `-5`:" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:3307 +#: documentation/content/en/articles/x86-assembly/_index.adoc:3283 #, no-wrap msgid "" "\tfld1\t\t\t; TOS = 1\n" @@ -6408,14 +6365,14 @@ msgid "" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:3310 +#: documentation/content/en/articles/x86-assembly/_index.adoc:3286 msgid "" "We can generalize all these optimizations into one rule: _Keep repeat values " "on the stack!_" msgstr "" #. type: delimited block = 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:3315 +#: documentation/content/en/articles/x86-assembly/_index.adoc:3291 msgid "" "_PostScript(R)_ is a stack-oriented programming language. There are many " "more books available about PostScript(R) than about the FPU assembly " @@ -6423,13 +6380,13 @@ msgid "" msgstr "" #. type: Title === -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:3318 +#: documentation/content/en/articles/x86-assembly/_index.adoc:3294 #, no-wrap msgid "pinhole-The Code" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:3333 +#: documentation/content/en/articles/x86-assembly/_index.adoc:3309 #, no-wrap msgid "" ";;;;;;; pinhole.asm ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;\n" @@ -6446,7 +6403,7 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:3368 +#: documentation/content/en/articles/x86-assembly/_index.adoc:3344 #, no-wrap msgid "" "section\t.data\n" @@ -6482,7 +6439,7 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:3374 +#: documentation/content/en/articles/x86-assembly/_index.adoc:3350 #, no-wrap msgid "" "section .bss\n" @@ -6493,7 +6450,7 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:3385 +#: documentation/content/en/articles/x86-assembly/_index.adoc:3361 #, no-wrap msgid "" "section\t.text\n" @@ -6509,7 +6466,7 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:3394 +#: documentation/content/en/articles/x86-assembly/_index.adoc:3370 #, no-wrap msgid "" "align 4\n" @@ -6523,7 +6480,7 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:3403 +#: documentation/content/en/articles/x86-assembly/_index.adoc:3379 #, no-wrap msgid "" "align 4\n" @@ -6537,7 +6494,7 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:3412 +#: documentation/content/en/articles/x86-assembly/_index.adoc:3388 #, no-wrap msgid "" "align 4\n" @@ -6551,7 +6508,7 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:3436 +#: documentation/content/en/articles/x86-assembly/_index.adoc:3412 #, no-wrap msgid "" "align 4\n" @@ -6562,7 +6519,7 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:3441 +#: documentation/content/en/articles/x86-assembly/_index.adoc:3417 #, no-wrap msgid "" ".arg:\n" @@ -6572,7 +6529,7 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:3449 +#: documentation/content/en/articles/x86-assembly/_index.adoc:3425 #, no-wrap msgid "" "\tinc\tecx\n" @@ -6581,7 +6538,7 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:3467 +#: documentation/content/en/articles/x86-assembly/_index.adoc:3443 #, no-wrap msgid "" "\tor\tah, ah\n" @@ -6591,7 +6548,7 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:3494 +#: documentation/content/en/articles/x86-assembly/_index.adoc:3470 #, no-wrap msgid "" "\t; Find the path to the input file\n" @@ -6603,7 +6560,7 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:3510 +#: documentation/content/en/articles/x86-assembly/_index.adoc:3486 #, no-wrap msgid "" ".p:\n" @@ -6614,7 +6571,7 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:3514 +#: documentation/content/en/articles/x86-assembly/_index.adoc:3490 #, no-wrap msgid "" "\tpop\tecx\n" @@ -6623,13 +6580,13 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:3516 +#: documentation/content/en/articles/x86-assembly/_index.adoc:3492 #, no-wrap msgid "\tmov\tah, [ecx]\n" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:3524 +#: documentation/content/en/articles/x86-assembly/_index.adoc:3500 #, no-wrap msgid "" ".pcheck:\n" @@ -6642,7 +6599,7 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:3532 +#: documentation/content/en/articles/x86-assembly/_index.adoc:3508 #, no-wrap msgid "" ".c:\n" @@ -6655,7 +6612,7 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:3540 +#: documentation/content/en/articles/x86-assembly/_index.adoc:3516 #, no-wrap msgid "" ".b:\n" @@ -6668,7 +6625,7 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:3553 +#: documentation/content/en/articles/x86-assembly/_index.adoc:3529 #, no-wrap msgid "" ".e:\n" @@ -6686,7 +6643,7 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:3560 +#: documentation/content/en/articles/x86-assembly/_index.adoc:3536 #, no-wrap msgid "" "align 4\n" @@ -6698,13 +6655,13 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:3562 +#: documentation/content/en/articles/x86-assembly/_index.adoc:3538 #, no-wrap msgid "\tsub\tecx, ecx\n" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:3567 +#: documentation/content/en/articles/x86-assembly/_index.adoc:3543 #, no-wrap msgid "" ".nextenv:\n" @@ -6714,7 +6671,7 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:3573 +#: documentation/content/en/articles/x86-assembly/_index.adoc:3549 #, no-wrap msgid "" "\t; check if this envar starts with 'PINHOLE='\n" @@ -6725,7 +6682,7 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:3581 +#: documentation/content/en/articles/x86-assembly/_index.adoc:3557 #, no-wrap msgid "" "\t; Check if it is followed by a digit\n" @@ -6738,7 +6695,7 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:3588 +#: documentation/content/en/articles/x86-assembly/_index.adoc:3564 #, no-wrap msgid "" "align 4\n" @@ -6750,7 +6707,7 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:3597 +#: documentation/content/en/articles/x86-assembly/_index.adoc:3573 #, no-wrap msgid "" "align 4\n" @@ -6764,7 +6721,7 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:3606 +#: documentation/content/en/articles/x86-assembly/_index.adoc:3582 #, no-wrap msgid "" "\t; Convert the pinhole constant to real\n" @@ -6778,13 +6735,13 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:3608 +#: documentation/content/en/articles/x86-assembly/_index.adoc:3584 #, no-wrap msgid "\tinc\tdl\n" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:3615 +#: documentation/content/en/articles/x86-assembly/_index.adoc:3591 #, no-wrap msgid "" ".processconst:\n" @@ -6796,7 +6753,7 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:3620 +#: documentation/content/en/articles/x86-assembly/_index.adoc:3596 #, no-wrap msgid "" "align 4\n" @@ -6806,7 +6763,7 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:3623 +#: documentation/content/en/articles/x86-assembly/_index.adoc:3599 #, no-wrap msgid "" "\tfinit\n" @@ -6814,7 +6771,7 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:3627 +#: documentation/content/en/articles/x86-assembly/_index.adoc:3603 #, no-wrap msgid "" "\tfld1\n" @@ -6823,7 +6780,7 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:3630 +#: documentation/content/en/articles/x86-assembly/_index.adoc:3606 #, no-wrap msgid "" "\tfild\tdword [thousand]\n" @@ -6831,7 +6788,7 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:3633 +#: documentation/content/en/articles/x86-assembly/_index.adoc:3609 #, no-wrap msgid "" "\tmov\tebp, ecx\n" @@ -6839,7 +6796,7 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:3637 +#: documentation/content/en/articles/x86-assembly/_index.adoc:3613 #, no-wrap msgid "" ".constdiv:\n" @@ -6848,7 +6805,7 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:3644 +#: documentation/content/en/articles/x86-assembly/_index.adoc:3620 #, no-wrap msgid "" "\tfld1\n" @@ -6860,7 +6817,7 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:3649 +#: documentation/content/en/articles/x86-assembly/_index.adoc:3625 #, no-wrap msgid "" "\t; If we are creating a CSV file,\n" @@ -6870,7 +6827,7 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:3654 +#: documentation/content/en/articles/x86-assembly/_index.adoc:3630 #, no-wrap msgid "" "\tpush\tdword headlen\n" @@ -6880,7 +6837,7 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:3658 +#: documentation/content/en/articles/x86-assembly/_index.adoc:3634 #, no-wrap msgid "" ".bigloop:\n" @@ -6889,7 +6846,7 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:3664 +#: documentation/content/en/articles/x86-assembly/_index.adoc:3640 #, no-wrap msgid "" "\t; Skip to the end of the line if you got '#'\n" @@ -6900,7 +6857,7 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:3671 +#: documentation/content/en/articles/x86-assembly/_index.adoc:3647 #, no-wrap msgid "" ".num:\n" @@ -6912,7 +6869,7 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:3675 +#: documentation/content/en/articles/x86-assembly/_index.adoc:3651 #, no-wrap msgid "" "\t; Yes, we have a number\n" @@ -6921,7 +6878,7 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:3680 +#: documentation/content/en/articles/x86-assembly/_index.adoc:3656 #, no-wrap msgid "" ".number:\n" @@ -6931,7 +6888,7 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:3691 +#: documentation/content/en/articles/x86-assembly/_index.adoc:3667 #, no-wrap msgid "" ".number0:\n" @@ -6947,7 +6904,7 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:3702 +#: documentation/content/en/articles/x86-assembly/_index.adoc:3678 #, no-wrap msgid "" ".nextnumber:\n" @@ -6963,7 +6920,7 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:3706 +#: documentation/content/en/articles/x86-assembly/_index.adoc:3682 #, no-wrap msgid "" ".ungetc:\n" @@ -6972,7 +6929,7 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:3711 +#: documentation/content/en/articles/x86-assembly/_index.adoc:3687 #, no-wrap msgid "" ".work:\n" @@ -6982,7 +6939,7 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:3714 +#: documentation/content/en/articles/x86-assembly/_index.adoc:3690 #, no-wrap msgid "" "\tcmp\tebp, 19\n" @@ -6990,19 +6947,19 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:3716 +#: documentation/content/en/articles/x86-assembly/_index.adoc:3692 #, no-wrap msgid "\tcall\tbcdload\n" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:3718 +#: documentation/content/en/articles/x86-assembly/_index.adoc:3694 #, no-wrap msgid "\t; Calculate pinhole diameter\n" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:3725 +#: documentation/content/en/articles/x86-assembly/_index.adoc:3701 #, no-wrap msgid "" "\tfld\tst0\t; save it\n" @@ -7014,7 +6971,7 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:3735 +#: documentation/content/en/articles/x86-assembly/_index.adoc:3711 #, no-wrap msgid "" "\t; Round off to 4 significant digits\n" @@ -7029,7 +6986,7 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:3738 +#: documentation/content/en/articles/x86-assembly/_index.adoc:3714 #, no-wrap msgid "" ".printdiameter:\n" @@ -7037,13 +6994,13 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:3740 +#: documentation/content/en/articles/x86-assembly/_index.adoc:3716 #, no-wrap msgid "\t; Calculate F-number\n" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:3743 +#: documentation/content/en/articles/x86-assembly/_index.adoc:3719 #, no-wrap msgid "" "\tfdivp\tst1, st0\n" @@ -7051,13 +7008,13 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:3745 +#: documentation/content/en/articles/x86-assembly/_index.adoc:3721 #, no-wrap msgid "\tsub\tebp, ebp\n" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:3754 +#: documentation/content/en/articles/x86-assembly/_index.adoc:3730 #, no-wrap msgid "" ".fnumber:\n" @@ -7071,7 +7028,7 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:3757 +#: documentation/content/en/articles/x86-assembly/_index.adoc:3733 #, no-wrap msgid "" ".printfnumber:\n" @@ -7079,7 +7036,7 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:3768 +#: documentation/content/en/articles/x86-assembly/_index.adoc:3744 #, no-wrap msgid "" "\t; Calculate normalized F-number\n" @@ -7095,8 +7052,8 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:3771 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:3799 +#: documentation/content/en/articles/x86-assembly/_index.adoc:3747 +#: documentation/content/en/articles/x86-assembly/_index.adoc:3775 #, no-wrap msgid "" "\tsub\tebp, ebp\n" @@ -7104,13 +7061,13 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:3773 +#: documentation/content/en/articles/x86-assembly/_index.adoc:3749 #, no-wrap msgid "\t; Calculate time multiplier from F-5.6\n" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:3776 +#: documentation/content/en/articles/x86-assembly/_index.adoc:3752 #, no-wrap msgid "" "\tfscale\n" @@ -7118,7 +7075,7 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:3782 +#: documentation/content/en/articles/x86-assembly/_index.adoc:3758 #, no-wrap msgid "" "\t; Round off to 4 significant digits\n" @@ -7129,7 +7086,7 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:3787 +#: documentation/content/en/articles/x86-assembly/_index.adoc:3763 #, no-wrap msgid "" "\tjb\t.printfmul\n" @@ -7139,7 +7096,7 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:3790 +#: documentation/content/en/articles/x86-assembly/_index.adoc:3766 #, no-wrap msgid "" ".printfmul:\n" @@ -7147,13 +7104,13 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:3792 +#: documentation/content/en/articles/x86-assembly/_index.adoc:3768 #, no-wrap msgid "\t; Calculate F-stops from 5.6\n" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:3796 +#: documentation/content/en/articles/x86-assembly/_index.adoc:3772 #, no-wrap msgid "" "\tfld1\n" @@ -7162,7 +7119,7 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:3803 +#: documentation/content/en/articles/x86-assembly/_index.adoc:3779 #, no-wrap msgid "" "\tmov\tal, 0Ah\n" @@ -7171,7 +7128,7 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:3807 +#: documentation/content/en/articles/x86-assembly/_index.adoc:3783 #, no-wrap msgid "" ".work0:\n" @@ -7180,7 +7137,7 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:3812 +#: documentation/content/en/articles/x86-assembly/_index.adoc:3788 #, no-wrap msgid "" "align 4\n" @@ -7190,7 +7147,7 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:3816 +#: documentation/content/en/articles/x86-assembly/_index.adoc:3792 #, no-wrap msgid "" "align 4\n" @@ -7199,13 +7156,13 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:3825 +#: documentation/content/en/articles/x86-assembly/_index.adoc:3801 #, no-wrap msgid "\tfinit\n" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:3838 +#: documentation/content/en/articles/x86-assembly/_index.adoc:3814 #, no-wrap msgid "" "align 4\n" @@ -7219,7 +7176,7 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:3843 +#: documentation/content/en/articles/x86-assembly/_index.adoc:3819 #, no-wrap msgid "" ".cr:\n" @@ -7229,7 +7186,7 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:3856 +#: documentation/content/en/articles/x86-assembly/_index.adoc:3832 #, no-wrap msgid "" ".fetch:\n" @@ -7240,7 +7197,7 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:3873 +#: documentation/content/en/articles/x86-assembly/_index.adoc:3849 #, no-wrap msgid "" ".read:\n" @@ -7258,7 +7215,7 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:3879 +#: documentation/content/en/articles/x86-assembly/_index.adoc:3855 #, no-wrap msgid "" "align 4\n" @@ -7269,7 +7226,7 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:3908 +#: documentation/content/en/articles/x86-assembly/_index.adoc:3884 #, no-wrap msgid "" "align 4\n" @@ -7281,7 +7238,7 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:3912 +#: documentation/content/en/articles/x86-assembly/_index.adoc:3888 #, no-wrap msgid "" "\tlea\tecx, [ebp+1]\n" @@ -7290,13 +7247,13 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:3914 +#: documentation/content/en/articles/x86-assembly/_index.adoc:3890 #, no-wrap msgid "\tstd\n" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:3920 +#: documentation/content/en/articles/x86-assembly/_index.adoc:3896 #, no-wrap msgid "" "\tmov\tedi, bbuffer\n" @@ -7307,7 +7264,7 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:3929 +#: documentation/content/en/articles/x86-assembly/_index.adoc:3905 #, no-wrap msgid "" ".loop:\n" @@ -7321,13 +7278,13 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:3931 +#: documentation/content/en/articles/x86-assembly/_index.adoc:3907 #, no-wrap msgid "\tfbld\t[bbuffer]\n" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:3938 +#: documentation/content/en/articles/x86-assembly/_index.adoc:3914 #, no-wrap msgid "" "\tcld\n" @@ -7339,7 +7296,7 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:3944 +#: documentation/content/en/articles/x86-assembly/_index.adoc:3920 #, no-wrap msgid "" "align 4\n" @@ -7350,7 +7307,7 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:3948 +#: documentation/content/en/articles/x86-assembly/_index.adoc:3924 #, no-wrap msgid "" "\t; Print the integer at the TOS\n" @@ -7359,7 +7316,7 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:3954 +#: documentation/content/en/articles/x86-assembly/_index.adoc:3930 #, no-wrap msgid "" "\t; Check the sign\n" @@ -7370,7 +7327,7 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:3958 +#: documentation/content/en/articles/x86-assembly/_index.adoc:3934 #, no-wrap msgid "" "\t; We got a negative number (should never happen)\n" @@ -7379,7 +7336,7 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:3967 +#: documentation/content/en/articles/x86-assembly/_index.adoc:3943 #, no-wrap msgid "" ".leading:\n" @@ -7393,7 +7350,7 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:3972 +#: documentation/content/en/articles/x86-assembly/_index.adoc:3948 #, no-wrap msgid "" "\t; We are here because the result was 0.\n" @@ -7403,7 +7360,7 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:3984 +#: documentation/content/en/articles/x86-assembly/_index.adoc:3960 #, no-wrap msgid "" ".first:\n" @@ -7420,7 +7377,7 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:3988 +#: documentation/content/en/articles/x86-assembly/_index.adoc:3964 #, no-wrap msgid "" ".second:\n" @@ -7429,7 +7386,7 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:3992 +#: documentation/content/en/articles/x86-assembly/_index.adoc:3968 #, no-wrap msgid "" ".next:\n" @@ -7438,7 +7395,7 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:4002 +#: documentation/content/en/articles/x86-assembly/_index.adoc:3978 #, no-wrap msgid "" "\tmov\tal, [ebp]\n" @@ -7453,7 +7410,7 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:4005 +#: documentation/content/en/articles/x86-assembly/_index.adoc:3981 #, no-wrap msgid "" "\tdec\tebp\n" @@ -7461,7 +7418,7 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:4010 +#: documentation/content/en/articles/x86-assembly/_index.adoc:3986 #, no-wrap msgid "" ".done:\n" @@ -7471,7 +7428,7 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:4016 +#: documentation/content/en/articles/x86-assembly/_index.adoc:3992 #, no-wrap msgid "" ".zeros:\n" @@ -7482,7 +7439,7 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:4019 +#: documentation/content/en/articles/x86-assembly/_index.adoc:3995 #, no-wrap msgid "" ".ret:\n" @@ -7490,38 +7447,38 @@ msgid "" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:4022 +#: documentation/content/en/articles/x86-assembly/_index.adoc:3998 msgid "" "The code follows the same format as all the other filters we have seen " "before, with one subtle exception:" msgstr "" #. type: delimited block _ 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:4025 +#: documentation/content/en/articles/x86-assembly/_index.adoc:4001 msgid "" "We are no longer assuming that the end of input implies the end of things to " "do, something we took for granted in the _character-oriented_ filters." msgstr "" #. type: delimited block _ 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:4027 +#: documentation/content/en/articles/x86-assembly/_index.adoc:4003 msgid "" "This filter does not process characters. It processes a _language_ (albeit a " "very simple one, consisting only of numbers)." msgstr "" #. type: delimited block _ 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:4029 +#: documentation/content/en/articles/x86-assembly/_index.adoc:4005 msgid "When we have no more input, it can mean one of two things:" msgstr "" #. type: delimited block _ 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:4031 +#: documentation/content/en/articles/x86-assembly/_index.adoc:4007 msgid "We are done and can quit. This is the same as before." msgstr "" #. type: delimited block _ 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:4032 +#: documentation/content/en/articles/x86-assembly/_index.adoc:4008 msgid "" "The last character we have read was a digit. We have stored it at the end of " "our ASCII-to-float conversion buffer. We now need to convert the contents of " @@ -7529,7 +7486,7 @@ msgid "" msgstr "" #. type: delimited block _ 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:4034 +#: documentation/content/en/articles/x86-assembly/_index.adoc:4010 msgid "" "For that reason, we have modified our `getchar` and our `read` routines to " "return with the `carry flag` _clear_ whenever we are fetching another " @@ -7538,21 +7495,21 @@ msgid "" msgstr "" #. type: delimited block _ 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:4037 +#: documentation/content/en/articles/x86-assembly/_index.adoc:4013 msgid "" "Of course, we are still using assembly language magic to do that! Take a " "good look at `getchar`. It _always_ returns with the `carry flag` _clear_." msgstr "" #. type: delimited block _ 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:4039 +#: documentation/content/en/articles/x86-assembly/_index.adoc:4015 msgid "" "Yet, our main code relies on the `carry flag` to tell it when to quit-and it " "works." msgstr "" #. type: delimited block _ 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:4042 +#: documentation/content/en/articles/x86-assembly/_index.adoc:4018 msgid "" "The magic is in `read`. Whenever it receives more input from the system, it " "just returns to `getchar`, which fetches a character from the input buffer, " @@ -7560,7 +7517,7 @@ msgid "" msgstr "" #. type: delimited block _ 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:4045 +#: documentation/content/en/articles/x86-assembly/_index.adoc:4021 msgid "" "But when `read` receives no more input from the system, it does _not_ return " "to `getchar` at all. Instead, the `add esp, byte 4` op code adds `4` to " @@ -7568,7 +7525,7 @@ msgid "" msgstr "" #. type: delimited block _ 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:4049 +#: documentation/content/en/articles/x86-assembly/_index.adoc:4025 msgid "" "So, where does it return to? Whenever a program uses the `call` op code, the " "microprocessor ``push``es the return address, i.e., it stores it on the top " @@ -7578,7 +7535,7 @@ msgid "" msgstr "" #. type: delimited block _ 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:4051 +#: documentation/content/en/articles/x86-assembly/_index.adoc:4027 msgid "" "But since we added `4` to `ESP` (which is the stack pointer register), we " "have effectively given the microprocessor a minor case of _amnesia_: It no " @@ -7586,7 +7543,7 @@ msgid "" msgstr "" #. type: delimited block _ 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:4053 +#: documentation/content/en/articles/x86-assembly/_index.adoc:4029 msgid "" "And since `getchar` never ``push``ed anything before ``call``ing `read`, the " "top of the stack now contains the return address to whatever or whoever " @@ -7595,14 +7552,14 @@ msgid "" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:4056 +#: documentation/content/en/articles/x86-assembly/_index.adoc:4032 msgid "" "Other than that, the `bcdload` routine is caught up in the middle of a " "Lilliputian conflict between the Big-Endians and the Little-Endians." msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:4058 +#: documentation/content/en/articles/x86-assembly/_index.adoc:4034 msgid "" "It is converting the text representation of a number into that number: The " "text is stored in the big-endian order, but the _packed decimal_ is little-" @@ -7610,7 +7567,7 @@ msgid "" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:4061 +#: documentation/content/en/articles/x86-assembly/_index.adoc:4037 msgid "" "To solve the conflict, we use the `std` op code early on. We cancel it with " "`cld` later on: It is quite important we do not `call` anything that may " @@ -7618,14 +7575,14 @@ msgid "" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:4063 +#: documentation/content/en/articles/x86-assembly/_index.adoc:4039 msgid "" "Everything else in this code should be quit eclear, providing you have read " -"the entire chapter that precedes it." +"the entire article that precedes it." msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:4066 +#: documentation/content/en/articles/x86-assembly/_index.adoc:4042 msgid "" "It is a classical example of the adage that programming requires a lot of " "thought and only a little coding. Once we have thought through every tiny " @@ -7633,13 +7590,13 @@ msgid "" msgstr "" #. type: Title === -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:4068 +#: documentation/content/en/articles/x86-assembly/_index.adoc:4044 #, no-wrap msgid "Using pinhole" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:4072 +#: documentation/content/en/articles/x86-assembly/_index.adoc:4048 msgid "" "Because we have decided to make the program _ignore_ any input except for " "numbers (and even those inside a comment), we can actually perform _textual " @@ -7647,14 +7604,14 @@ msgid "" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:4074 +#: documentation/content/en/articles/x86-assembly/_index.adoc:4050 msgid "" "In my humble opinion, forming a textual query, instead of having to follow a " "very strict syntax, makes software much more user friendly." msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:4080 +#: documentation/content/en/articles/x86-assembly/_index.adoc:4056 msgid "" "Suppose we want to build a pinhole camera to use the 4x5 inch film. The " "standard focal length for that film is about 150mm. We want to _fine-tune_ " @@ -7665,24 +7622,24 @@ msgid "" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:4082 +#: documentation/content/en/articles/x86-assembly/_index.adoc:4058 msgid "Our session might look like this:" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:4086 +#: documentation/content/en/articles/x86-assembly/_index.adoc:4062 #, no-wrap msgid "% pinhole\n" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:4088 +#: documentation/content/en/articles/x86-assembly/_index.adoc:4064 #, no-wrap msgid "Computer,\n" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:4101 +#: documentation/content/en/articles/x86-assembly/_index.adoc:4077 #, no-wrap msgid "" "What size pinhole do I need for the focal length of 150?\n" @@ -7700,7 +7657,7 @@ msgid "" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:4104 +#: documentation/content/en/articles/x86-assembly/_index.adoc:4080 msgid "" "We have found that while for the focal length of 150, our pinhole diameter " "should be 490 microns, or 0.49 mm, if we go with the almost identical focal " @@ -7709,55 +7666,55 @@ msgid "" msgstr "" #. type: Title === -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:4106 +#: documentation/content/en/articles/x86-assembly/_index.adoc:4082 #, no-wrap msgid "Scripting" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:4109 +#: documentation/content/en/articles/x86-assembly/_index.adoc:4085 msgid "" "Because we have chosen the `+#+` character to denote the start of a comment, " "we can treat our pinhole software as a _scripting language_." msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:4111 +#: documentation/content/en/articles/x86-assembly/_index.adoc:4087 msgid "You have probably seen shell _scripts_ that start with:" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:4115 +#: documentation/content/en/articles/x86-assembly/_index.adoc:4091 #, no-wrap msgid "#! /bin/sh\n" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:4118 +#: documentation/content/en/articles/x86-assembly/_index.adoc:4094 msgid "...or..." msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:4122 +#: documentation/content/en/articles/x86-assembly/_index.adoc:4098 #, no-wrap msgid "#!/bin/sh\n" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:4125 +#: documentation/content/en/articles/x86-assembly/_index.adoc:4101 msgid "...because the blank space after the `#!` is optional." msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:4128 +#: documentation/content/en/articles/x86-assembly/_index.adoc:4104 msgid "" -"Whenever UNIX(R) is asked to run an executable file which starts with the `#!" -"`, it assumes the file is a script. It adds the command to the rest of the " +"Whenever UNIX is asked to run an executable file which starts with the `#!`, " +"it assumes the file is a script. It adds the command to the rest of the " "first line of the script, and tries to execute that." msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:4130 +#: documentation/content/en/articles/x86-assembly/_index.adoc:4106 msgid "" "Suppose now that we have installed pinhole in /usr/local/bin/, we can now " "write a script to calculate various pinhole diameters suitable for various " @@ -7765,12 +7722,12 @@ msgid "" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:4132 +#: documentation/content/en/articles/x86-assembly/_index.adoc:4108 msgid "The script might look something like this:" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:4138 +#: documentation/content/en/articles/x86-assembly/_index.adoc:4114 #, no-wrap msgid "" "#! /usr/local/bin/pinhole -b -i\n" @@ -7779,7 +7736,7 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:4141 +#: documentation/content/en/articles/x86-assembly/_index.adoc:4117 #, no-wrap msgid "" "### Standard\n" @@ -7787,7 +7744,7 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:4144 +#: documentation/content/en/articles/x86-assembly/_index.adoc:4120 #, no-wrap msgid "" "### Wide angle\n" @@ -7795,7 +7752,7 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:4147 +#: documentation/content/en/articles/x86-assembly/_index.adoc:4123 #, no-wrap msgid "" "### Telephoto\n" @@ -7803,18 +7760,18 @@ msgid "" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:4150 +#: documentation/content/en/articles/x86-assembly/_index.adoc:4126 msgid "Because 120 is a medium size film, we may name this file medium." msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:4152 +#: documentation/content/en/articles/x86-assembly/_index.adoc:4128 msgid "" "We can set its permissions to execute, and run it as if it were a program:" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:4157 +#: documentation/content/en/articles/x86-assembly/_index.adoc:4133 #, no-wrap msgid "" "% chmod 755 medium\n" @@ -7822,23 +7779,23 @@ msgid "" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:4160 -msgid "UNIX(R) will interpret that last command as:" +#: documentation/content/en/articles/x86-assembly/_index.adoc:4136 +msgid "UNIX will interpret that last command as:" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:4164 +#: documentation/content/en/articles/x86-assembly/_index.adoc:4140 #, no-wrap msgid "% /usr/local/bin/pinhole -b -i ./medium\n" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:4167 +#: documentation/content/en/articles/x86-assembly/_index.adoc:4143 msgid "It will run that command and display:" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:4179 +#: documentation/content/en/articles/x86-assembly/_index.adoc:4155 #, no-wrap msgid "" "80\t358\t224\t256\t1562\t11\n" @@ -7853,29 +7810,29 @@ msgid "" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:4182 +#: documentation/content/en/articles/x86-assembly/_index.adoc:4158 msgid "Now, let us enter:" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:4186 +#: documentation/content/en/articles/x86-assembly/_index.adoc:4162 #, no-wrap msgid "% ./medium -c\n" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:4189 -msgid "UNIX(R) will treat that as:" +#: documentation/content/en/articles/x86-assembly/_index.adoc:4165 +msgid "UNIX will treat that as:" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:4193 +#: documentation/content/en/articles/x86-assembly/_index.adoc:4169 #, no-wrap msgid "% /usr/local/bin/pinhole -b -i ./medium -c\n" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:4197 +#: documentation/content/en/articles/x86-assembly/_index.adoc:4173 msgid "" "That gives it two conflicting options: `-b` and `-c` (Use Bender's constant " "and use Connors' constant). We have programmed it so later options override " @@ -7883,7 +7840,7 @@ msgid "" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:4209 +#: documentation/content/en/articles/x86-assembly/_index.adoc:4185 #, no-wrap msgid "" "80\t331\t242\t256\t1826\t11\n" @@ -7898,14 +7855,14 @@ msgid "" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:4213 +#: documentation/content/en/articles/x86-assembly/_index.adoc:4189 msgid "" "We decide we want to go with Bender's constant after all. We want to save " "its values as a comma-separated file:" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:4229 +#: documentation/content/en/articles/x86-assembly/_index.adoc:4205 #, no-wrap msgid "" "% ./medium -b -e > bender\n" @@ -7924,103 +7881,102 @@ msgid "" msgstr "" #. type: Title == -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:4232 +#: documentation/content/en/articles/x86-assembly/_index.adoc:4208 #, no-wrap msgid "Caveats" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:4236 +#: documentation/content/en/articles/x86-assembly/_index.adoc:4212 msgid "" -"Assembly language programmers who \"grew up\" under MS-DOS(R) and Windows(R) " -"often tend to take shortcuts. Reading the keyboard scan codes and writing " +"Assembly language programmers who \"grew up\" under MS-DOS and Windows often " +"tend to take shortcuts. Reading the keyboard scan codes and writing " "directly to video memory are two classical examples of practices which, " -"under MS-DOS(R) are not frowned upon but considered the right thing to do." +"under MS-DOS are not frowned upon but considered the right thing to do." msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:4238 +#: documentation/content/en/articles/x86-assembly/_index.adoc:4214 msgid "" -"The reason? Both the PC BIOS and MS-DOS(R) are notoriously slow when " -"performing these operations." +"The reason? Both the PC BIOS and MS-DOS are notoriously slow when performing " +"these operations." msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:4241 +#: documentation/content/en/articles/x86-assembly/_index.adoc:4217 msgid "" -"You may be tempted to continue similar practices in the UNIX(R) " -"environment. For example, I have seen a web site which explains how to " -"access the keyboard scan codes on a popular UNIX(R) clone." +"You may be tempted to continue similar practices in the UNIX environment. " +"For example, I have seen a web site which explains how to access the " +"keyboard scan codes on a popular UNIX clone." msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:4243 +#: documentation/content/en/articles/x86-assembly/_index.adoc:4219 msgid "" -"That is generally a _very bad idea_ in UNIX(R) environment! Let me explain " -"why." +"That is generally a _very bad idea_ in UNIX environment! Let me explain why." msgstr "" #. type: Title === -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:4245 +#: documentation/content/en/articles/x86-assembly/_index.adoc:4221 #, no-wrap -msgid "UNIX(R) Is Protected" +msgid "UNIX Is Protected" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:4252 +#: documentation/content/en/articles/x86-assembly/_index.adoc:4228 msgid "" -"For one thing, it may simply not be possible. UNIX(R) runs in protected " -"mode. Only the kernel and device drivers are allowed to access hardware " -"directly. Perhaps a particular UNIX(R) clone will let you read the keyboard " -"scan codes, but chances are a real UNIX(R) operating system will not. And " -"even if one version may let you do it, the next one may not, so your " -"carefully crafted software may become a dinosaur overnight." +"For one thing, it may simply not be possible. UNIX runs in protected mode. " +"Only the kernel and device drivers are allowed to access hardware directly. " +"Perhaps a particular UNIX clone will let you read the keyboard scan codes, " +"but chances are a real UNIX operating system will not. And even if one " +"version may let you do it, the next one may not, so your carefully crafted " +"software may become a dinosaur overnight." msgstr "" #. type: Title === -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:4254 +#: documentation/content/en/articles/x86-assembly/_index.adoc:4230 #, no-wrap -msgid "UNIX(R) Is an Abstraction" +msgid "UNIX Is an Abstraction" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:4257 +#: documentation/content/en/articles/x86-assembly/_index.adoc:4233 msgid "" "But there is a much more important reason not to try accessing the hardware " "directly (unless, of course, you are writing a device driver), even on the " -"UNIX(R) like systems that let you do it:" +"UNIX like systems that let you do it:" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:4259 -msgid "_UNIX(R) is an abstraction!_" +#: documentation/content/en/articles/x86-assembly/_index.adoc:4235 +msgid "_UNIX is an abstraction!_" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:4265 +#: documentation/content/en/articles/x86-assembly/_index.adoc:4241 msgid "" -"There is a major difference in the philosophy of design between MS-DOS(R) " -"and UNIX(R). MS-DOS(R) was designed as a single-user system. It is run on " -"a computer with a keyboard and a video screen attached directly to that " -"computer. User input is almost guaranteed to come from that keyboard. Your " -"program's output virtually always ends up on that screen." +"There is a major difference in the philosophy of design between MS-DOS and " +"UNIX. MS-DOS was designed as a single-user system. It is run on a computer " +"with a keyboard and a video screen attached directly to that computer. User " +"input is almost guaranteed to come from that keyboard. Your program's " +"output virtually always ends up on that screen." msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:4268 +#: documentation/content/en/articles/x86-assembly/_index.adoc:4244 msgid "" -"This is NEVER guaranteed under UNIX(R). It is quite common for a UNIX(R) " -"user to pipe and redirect program input and output:" +"This is NEVER guaranteed under UNIX. It is quite common for a UNIX user to " +"pipe and redirect program input and output:" msgstr "" #. type: delimited block . 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:4272 +#: documentation/content/en/articles/x86-assembly/_index.adoc:4248 #, no-wrap msgid "% program1 | program2 | program3 > file1\n" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:4276 +#: documentation/content/en/articles/x86-assembly/_index.adoc:4252 msgid "" "If you have written program2, your input does not come from the keyboard but " "from the output of program1. Similarly, your output does not go to the " @@ -8029,37 +7985,37 @@ msgid "" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:4279 +#: documentation/content/en/articles/x86-assembly/_index.adoc:4255 msgid "" "But there is more! Even if you made sure that your input comes from, and " "your output goes to, the terminal, there is no guarantee the terminal is a " "PC: It may not have its video memory where you expect it, nor may its " -"keyboard be producing PC-style scan codes. It may be a Macintosh(R), or any " +"keyboard be producing PC-style scan codes. It may be a Macintosh, or any " "other computer." msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:4281 +#: documentation/content/en/articles/x86-assembly/_index.adoc:4257 msgid "" "Now you may be shaking your head: My software is in PC assembly language, " -"how can it run on a Macintosh(R)? But I did not say your software would be " -"running on a Macintosh(R), only that its terminal may be a Macintosh(R)." +"how can it run on a Macintosh? But I did not say your software would be " +"running on a Macintosh, only that its terminal may be a Macintosh." msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:4285 +#: documentation/content/en/articles/x86-assembly/_index.adoc:4261 msgid "" -"Under UNIX(R), the terminal does not have to be directly attached to the " +"Under UNIX, the terminal does not have to be directly attached to the " "computer that runs your software, it can even be on another continent, or, " "for that matter, on another planet. It is perfectly possible that a " -"Macintosh(R) user in Australia connects to a UNIX(R) system in North America " -"(or anywhere else) via telnet. The software then runs on one computer, " -"while the terminal is on a different computer: If you try to read the scan " -"codes, you will get the wrong input!" +"Macintosh user in Australia connects to a UNIX system in North America (or " +"anywhere else) via telnet. The software then runs on one computer, while " +"the terminal is on a different computer: If you try to read the scan codes, " +"you will get the wrong input!" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:4288 +#: documentation/content/en/articles/x86-assembly/_index.adoc:4264 msgid "" "Same holds true about any other hardware: A file you are reading may be on a " "disk you have no direct access to. A camera you are reading images from may " @@ -8067,52 +8023,53 @@ msgid "" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:4291 +#: documentation/content/en/articles/x86-assembly/_index.adoc:4267 msgid "" -"That is why under UNIX(R) you must never make any assumptions about where " -"your data is coming from and going to. Always let the system handle the " -"physical access to the hardware." +"That is why under UNIX you must never make any assumptions about where your " +"data is coming from and going to. Always let the system handle the physical " +"access to the hardware." msgstr "" #. type: delimited block = 4 -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:4299 +#: documentation/content/en/articles/x86-assembly/_index.adoc:4275 msgid "" "These are caveats, not absolute rules. Exceptions are possible. For " "example, if a text editor has determined it is running on a local machine, " "it may want to read the scan codes directly for improved control. I am not " "mentioning these caveats to tell you what to do or what not to do, just to " "make you aware of certain pitfalls that await you if you have just arrived " -"to UNIX(R) form MS-DOS(R). Of course, creative people often break rules, " -"and it is OK as long as they know they are breaking them and why." +"to UNIX form MS-DOS. Of course, creative people often break rules, and it " +"is OK as long as they know they are breaking them and why." msgstr "" #. type: Title == -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:4302 +#: documentation/content/en/articles/x86-assembly/_index.adoc:4278 #, no-wrap msgid "Acknowledgements" msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:4305 +#: documentation/content/en/articles/x86-assembly/_index.adoc:4281 msgid "" "This tutorial would never have been possible without the help of many " "experienced FreeBSD programmers from the {freebsd-hackers}, many of whom " "have patiently answered my questions, and pointed me in the right direction " -"in my attempts to explore the inner workings of UNIX(R) system programming " -"in general and FreeBSD in particular." +"in my attempts to explore the inner workings of UNIX system programming in " +"general and FreeBSD in particular." msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:4308 +#: documentation/content/en/articles/x86-assembly/_index.adoc:4284 msgid "" -"Thomas M. Sommers opened the door for me . His https://web.archive.org/web/" -"20090914064615/http://www.codebreakers-journal.com/content/view/262/27[How " -"do I write \"Hello, world\" in FreeBSD assembler?] web page was my first " -"encounter with an example of assembly language programming under FreeBSD." +"Thomas M. Sommers opened the door for me. His link:https://web.archive.org/" +"web/20090914064615/http://www.codebreakers-journal.com/content/view/" +"262/27[How do I write \"Hello, world\" in FreeBSD assembler?] web page was " +"my first encounter with an example of assembly language programming under " +"FreeBSD." msgstr "" #. type: Plain text -#: documentation/content/en/books/developers-handbook/x86/_index.adoc:4310 +#: documentation/content/en/articles/x86-assembly/_index.adoc:4286 msgid "" "Jake Burkholder has kept the door open by willingly answering all of my " "questions and supplying me with example assembly language source code." diff --git a/documentation/content/en/books/developers-handbook/partiv.po b/documentation/content/en/books/developers-handbook/partiv.po index 01bf25f2d8..afe6d0461e 100644 --- a/documentation/content/en/books/developers-handbook/partiv.po +++ b/documentation/content/en/books/developers-handbook/partiv.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: FreeBSD Documentation VERSION\n" -"POT-Creation-Date: 2025-05-01 19:56-0300\n" +"POT-Creation-Date: 2026-04-16 15:39-0300\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -19,11 +19,11 @@ msgstr "" #. type: YAML Front Matter: title #: documentation/content/en/books/developers-handbook/partiv.adoc:1 #, no-wrap -msgid "Part IV. Architectures" +msgid "Part IV. Appendices" msgstr "" #. type: Title = #: documentation/content/en/books/developers-handbook/partiv.adoc:12 #, no-wrap -msgid "Architectures" +msgid "Appendices" msgstr ""