aboutsummaryrefslogtreecommitdiff
path: root/documentation/content/zh-tw/books/developers-handbook/x86/chapter.adoc
diff options
context:
space:
mode:
Diffstat (limited to 'documentation/content/zh-tw/books/developers-handbook/x86/chapter.adoc')
-rw-r--r--documentation/content/zh-tw/books/developers-handbook/x86/chapter.adoc56
1 files changed, 28 insertions, 28 deletions
diff --git a/documentation/content/zh-tw/books/developers-handbook/x86/chapter.adoc b/documentation/content/zh-tw/books/developers-handbook/x86/chapter.adoc
index ceb9af91de..876f940252 100644
--- a/documentation/content/zh-tw/books/developers-handbook/x86/chapter.adoc
+++ b/documentation/content/zh-tw/books/developers-handbook/x86/chapter.adoc
@@ -139,7 +139,7 @@ This convention has a great disadvantage over the UNIX(R) way, at least as far a
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 executable:
-[source,bash]
+[source,shell]
....
% brandelf -t Linux filename
....
@@ -505,7 +505,7 @@ Type the code (except the line numbers) in an editor, and save it in a file name
If you do not have nasm, type:
-[source,bash]
+[source,shell]
....
% su
Password:your root password
@@ -526,7 +526,7 @@ If your system is not FreeBSD, you need to get nasm from its https://sourceforge
Now you can assemble, link, and run the code:
-[source,bash]
+[source,shell]
....
% nasm -f elf hello.asm
% ld -s -o hello hello.o
@@ -604,7 +604,7 @@ Once there is no more input left, we ask the system to exit our program, returni
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 holding the control key down):
-[source,bash]
+[source,shell]
....
% nasm -f elf hex.asm
% ld -s -o hex hex.o
@@ -679,7 +679,7 @@ That means we only need to set `CL` once. We have, therefore, added a new label
Once you have changed [.filename]#hex.asm# to reflect these changes, type:
-[source,bash]
+[source,shell]
....
% nasm -f elf hex.asm
% ld -s -o hex hex.o
@@ -807,7 +807,7 @@ We use `EDI` and `ESI` as pointers to the next byte to be read from or written t
Let us see how it works now:
-[source,bash]
+[source,shell]
....
% nasm -f elf hex.asm
% ld -s -o hex hex.o
@@ -923,7 +923,7 @@ write:
Now, let us see how it works:
-[source,bash]
+[source,shell]
....
% nasm -f elf hex.asm
% ld -s -o hex hex.o
@@ -1461,7 +1461,7 @@ This code produces a 1,396-byte executable. Most of it is data, i.e., the HTML m
Assemble and link it as usual:
-[source,bash]
+[source,shell]
....
% nasm -f elf webvars.asm
% ld -s -o webvars webvars.o
@@ -1482,7 +1482,7 @@ One of the first programs I wrote for UNIX(R) was link:ftp://ftp.int80h.org/unix
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:
-[source,bash]
+[source,shell]
....
% tuc myfile tempfile
% mv tempfile myfile
@@ -1490,7 +1490,7 @@ I have used tuc extensively, but always only to convert from some other OS to UN
It would be nice to have a ftuc, i.e., _fast tuc_, and use it like this:
-[source,bash]
+[source,shell]
....
% ftuc myfile
....
@@ -2038,7 +2038,7 @@ This time I decided to let it do a little more work than a typical tutorial prog
Here is its usage message:
-[source,bash]
+[source,shell]
....
Usage: csv [-t<delim>] [-c<comma>] [-p] [-o <outfile>] [-i <infile>]
....
@@ -2057,7 +2057,7 @@ I made sure that both `-i filename` and `-ifilename` are accepted. I also made s
To get the 11th field of each record, I can now do:
-[source,bash]
+[source,shell]
....
% csv '-t;' data.csv | awk '-F;' '{print $11}'
....
@@ -2561,7 +2561,7 @@ But our pinhole program cannot just work with individual characters, it has to d
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 mm`, and `210 mm`, we may want to enter something like this:
-[source,bash]
+[source,shell]
....
100, 150, 210
....
@@ -2576,7 +2576,7 @@ Personally, I like to keep it simple. Something either is a number, so I process
Plus, it allows me to break up the monotony of computing and type in a query instead of just a number:
-[source,bash]
+[source,shell]
....
What is the best pinhole diameter for the
focal length of 150?
@@ -2584,7 +2584,7 @@ What is the best pinhole diameter for the
There is no reason for the computer to spit out a number of complaints:
-[source,bash]
+[source,shell]
....
Syntax error: What
Syntax error: is
@@ -2675,7 +2675,7 @@ So, it makes perfect sense to start each line with the focal length as entered b
No, wait! Not as entered by the user. What if the user types in something like this:
-[source,bash]
+[source,shell]
....
00000000150
....
@@ -2688,7 +2688,7 @@ But...
What if the user types something like this:
-[source,bash]
+[source,shell]
....
17459765723452353453534535353530530534563507309676764423
....
@@ -2705,7 +2705,7 @@ What will we do?
We will slap him in the face, in a manner of speaking:
-[source,bash]
+[source,shell]
....
17459765723452353453534535353530530534563507309676764423 ??? ??? ??? ??? ???
....
@@ -2730,7 +2730,7 @@ That still leaves one possibility uncovered: If all the user enters is a zero (o
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 the face":
-[source,bash]
+[source,shell]
....
0 ??? ??? ??? ??? ???
....
@@ -3657,7 +3657,7 @@ Suppose we want to build a pinhole camera to use the 4x5 inch film. The standard
Our session might look like this:
-[source,bash]
+[source,shell]
....
% pinhole
@@ -3726,7 +3726,7 @@ Because 120 is a medium size film, we may name this file medium.
We can set its permissions to execute, and run it as if it were a program:
-[source,bash]
+[source,shell]
....
% chmod 755 medium
% ./medium
@@ -3734,14 +3734,14 @@ We can set its permissions to execute, and run it as if it were a program:
UNIX(R) will interpret that last command as:
-[source,bash]
+[source,shell]
....
% /usr/local/bin/pinhole -b -i ./medium
....
It will run that command and display:
-[source,bash]
+[source,shell]
....
80 358 224 256 1562 11
30 219 137 128 586 9
@@ -3756,21 +3756,21 @@ It will run that command and display:
Now, let us enter:
-[source,bash]
+[source,shell]
....
% ./medium -c
....
UNIX(R) will treat that as:
-[source,bash]
+[source,shell]
....
% /usr/local/bin/pinhole -b -i ./medium -c
....
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 early ones-our program will calculate everything using Connors' constant:
-[source,bash]
+[source,shell]
....
80 331 242 256 1826 11
30 203 148 128 685 9
@@ -3785,7 +3785,7 @@ That gives it two conflicting options: `-b` and `-c` (Use Bender's constant and
We decide we want to go with Bender's constant after all. We want to save its values as a comma-separated file:
-[source,bash]
+[source,shell]
....
% ./medium -b -e > bender
% cat bender
@@ -3829,7 +3829,7 @@ There is a major difference in the philosophy of design between MS-DOS(R) and UN
This is NEVER guaranteed under UNIX(R). It is quite common for a UNIX(R) user to pipe and redirect program input and output:
-[source,bash]
+[source,shell]
....
% program1 | program2 | program3 > file1
....