Well, Amazon has posted a preliminary (pre-order) ad for it, so I may as well announce it:
The Art of 64-Bit Assembly Language is coming soon!
(Amazon claims August 31; that usually means late Sept/early October).
The book has gone through two-and-a-half sets of editing thus far: initial editing, technical review, and it’s about ⅔ of the way through a final edit phase now (I just returned chapter 10 of 16 to No Starch). Once the final editing (copy editing) is done, it goes to layout. There will be two passes on that (one pass with individual chapters in PDF form, one pass with the whole book in PDF form) and then it’s off to the printers. Based on my past experience, Sept/Oct looks very good.
Next week I’m supposed to start getting PDF proofs for the individual chapters. That probably means that No Starch will put the book into their “early access program” within a month or two.
In any case, the new support web page is now active. You can check it out at https://artofasm.randallhyde.com/
It used to point at the 32-bit stuff, now it’s been hijacked for The Art of 64-bit Assembly Language.
Thanks for this information.
Even though the book is in masm, at least I’ve seen that you’ve provided code examples for nasm and gas.
I’m missing gas for windows, though!
The best way to try that is to get msys2, which has a lot of assemblers: gas, nasm, uasm, yasm
Once installed, note this:
You have 4 shells in the start menu:
1. MSYS2 MSYS (C:\msys64\msys2_shell.cmd -msys)
# this is like cygwin
2. MSYS2 MinGW 32-bit (C:\msys64\msys2_shell.cmd -mingw32)
# this is 32 bit windows
3. MSYS2 MinGW 64-bit (C:\msys64\msys2_shell.cmd -mingw64)
# this is 64 bit windows
4. MSYS2 MinGW UCRT 64-bit (C:\msys64\msys2_shell.cmd -ucrt64)
# this is 64 bit windows with the universal CRT
Here are some commands for you to run in msys2
pacman -Syuu # update installed stuff
pacman -Fyy # update the database
pacman -F as.exe # which package contains the assembler as.exe
pacman -Ss assembler # what other assemblers are available: I see nasm and uasm
pacman -Ss asm # I see yasm
# get some gcc
pacman -S –needed gcc
pacman -S –needed mingw-w64-i686-gcc
pacman -S –needed mingw-w64-x86_64-gcc
pacman -S –needed mingw-w64-ucrt-x86_64-gcc
Windows 64 bit gas GNU assembler in Msys2
=========================================
Here’s listing1-5-windows-gas.s
.data
fmtStr: .asciz “Hello, World!\n”
.text
.extern printf
.global asmFunc
asmFunc:
subq $56,%rsp
leaq fmtStr,%rcx
call printf
addq $56,%rsp
ret #Returns to caller
Works as follows:
Open MSYS2 MinGW 64-bit
->
pacman -S –needed mingw-w64-x86_64-gcc
gcc -nostartfiles -x assembler -o go.exe -Wl,–default-image-base-low listing1-5-windows-gas.s
./go.exe
I got the information about –default-image-base-low from here:
https://github.com/mykolav/coollang-2020-fs#-relocation-truncated-to-fit-r_x86_64_32s-
I’ve tried to compile the 32bit assembler files from this website:
https://github.com/ncellar/asm-examples
Works as follows:
Open MSYS2 MinGW 32-bit (those are 32 bit examples)
->
cd printf
gcc -nostartfiles -x assembler -o printf.exe printf.asm
./printf.exe
cd ..
cd box
gcc -nostartfiles -x assembler -o box.exe box.asm
./box.exe
cd ..
NASM in msys2
=============
Works as follows:
Open MSYS2 MinGW 64-bit
->
pacman -Ss mingw-w64-x86_64-nasm
nasm -Ov -f win64 listing1-5.asm -o listing1-5.obj
gcc -nostartfiles listing1-5.obj -o listing1-5.exe
./listing1-5.exe
Thanks for the input.
I’ve provided gas (Linux/macOS) and NASM (generally portable) examples because they’re probably the next most popular assemblers for the x86. Someday, if I get the time, a FASM translation would make sense, too.
Gas for Windows is fun, but probably not popular enough to warrant my effort (too many other projects in the works with a higher priority, like “Art of ARM Assembly”). That said, I do welcome submissions. At some point (probably when the treeware publication occurs), I’ll probably set up an official GitHub page for the code so it’s easy to contribute.
Ok great. Go Github! Better today, than tomorrow.
But just don’t underestimate gas: Just think if inline assembly in gcc!
“Art of ARM Assembly” – As a book? An entire book? If so: is arm assembly so radically different, that would really need a book?
I’d say “Write Great Code – Designing Software” is important: High level abstractions and problem domain modelling for handling projects, esp. large-scale project, etc.
Inversion of control, Testability concepts, reactive software, eventloops, statemachines, interprocess communication, serialization, communication, Simulation of embedded software on a PC, etc. -> That’s where it’s at!
PS:
I’ll never be caught writing assembly code in the real world.
Once you’re handling a 5 thousand file c++ codebase (for an embedded product!), you’re quite happy that you’re not writing assembly.
Of course assembly has it’s reasons:
* people go to godbolt, to check/compare generated assembly instructions.
* some people write compilers, where you obviously need to handle low-level platform details (yes, I really am talking about compilers, not assemblers. To write a C++ compiler is SO far more complex than any assembler, it’s like comparing NASA engineering, with a children’s toy. Not joking!!!)
* and it is important for understanding the machine.
Which means: I like assembly books. But they won’t help me handle complex largescale software projects.
For any reader stumbling accross the top comment:
The blog software has modified my double minus — to long em dashes.
So whereever you see that long dash: type double minus instead.
* — -> em dash
* – -> minux (simple dash)
Well, “The Art of Assembly” has always sold better than my Write Great Code series, so, yeah, Art of ARM Assembly is a reasonable project as a book.
Also, given the hype around Apple Silicon’s M1, there is a lot of interest in ARM assembly at this point.
And point 3 in your list (“understanding the machine”) is what assembly books are really all about. And there’s a lot of people on ARM machines (Raspberry Pi and Apple M1) who don’t have any need for an x86 assembly book to teach them machine organization. That’s the reason for Art of ARM Assembly in a nutshell.
I’ve actually written software that controls a nuclear reactor using assembly language (that was the underlying network code). Now the higher-level stuff was written in a specialized HLL (TRIGA Basic) and a little C++ for the device driver components. I wouldn’t do that again, but not for the reasons you suggest, only for portability — it’s getting harder to find machines that will run 32-bit OSes these days :(.
FWIW, the Write Great Code series doesn’t drop quite down to the design level you’re suggesting. WGC4 (Design Great Code) covers more high-level concepts (though it does cover state machines). Reactive software, event loops, IPC, synchronization/serialization, and stuff like that makes for interesting material, but way too low level for the WGC series. I would love to cover those subjects with a series of books (like “Write Great Embedded Code” and “Write Great Parallel Code” at some point. The original intent of WGC3 was to cover all that; the project, however, grew totally out of control and I had to break up WGC3 into four separate volumes. To prevent WGC4 from blowing up in a similar fashion, I have to limit the scope quite a bit. FWIW, here’s the tentative table of contents for WGC4 (which has already changed a bit since I started and I guarantee it will change a bit before I finish):
Introduction 11
Forward & Acknowledgements 13
I Introduction 15
1 Characteristics of Great Design 27
2 Analysis, Requirements, and Incremental Development 43
Old School Software Design 77
3 Top-Down Design 79
4 Bottom-Up Design 109
5 Modularization 115
6 Induction, Recursion, and Functional Design 145
7 State Machines 155
8 Indirection 175
9 Structured Design 185
10 A Structured Design-Based Software Design Description 253
Object-Oriented Software Design 301
11 Rethinking Design with Objects 303
12 Inheritance Versus Composition 305
13 Object-Oriented Analysis 307
14 Object-Oriented Design 309
15 Design Patterns 311
16 State Machines, Part II 313
17 Design Reviews 315
(As you can see by the page numbers, I’ve actually written about ½ of the rough draft at this point; however, that’s misleading because I’m currently reworking many of the early chapters after changing my mind about the project I wanted to use throughout the book as an example.)
Also, I’ve current divided the book up into three main sections: introduction, old-school design, and object-oriented design. During the rewrite I’m going to break the second section up into old-school design and structured analysis and design. Probably break up the chapter on structured design (which should really be called “structured analysis and design” into two pieces to cover entity-relationship diagrams, as well.
As you can see, this book is much higher level than what you are proposing. Again, more detailed/focused books would be interesting, but they are too limited in scope for the main series (or would result in a gigantic book if you tried to cover all the material in a single volume; I already made that mistake once, that’s why Volume 3 didn’t show up until ten years after Volume 2).
As I already mentioned, I think that a “Design Great XXXXX Code” series would be a great set of companion volumes. But I have to get the main WGC set completed before thinking about that.
(FWIW, I think the same thing will happen with WGC5- Great Coding; there will be the opportunity to create a set of companion volumes like “Great Python Coding” or “Great Swift Coding” that focuses on coding for particular languages.)
Cheers,
Randy Hyde
Hello again and thanks for your detailed description.
Yes, you’re right about the software design book: a solid grip of essentials is good.
High level abstractions and modelling the problem correctly in software is vital.
By the way: I’d like to contribute to your forum (I’d specifically like to write up that stuff about msys2 and its assemblers using better formatting; and some more extended information).
But it says “The specified username is currently inactive. If you have problems activating your account, please contact a board administrator.”
I think you still need to activate my account.
Regards,
Al
Hmm….
Activation should be totally on your end (via email). Now I did go in an disable a bunch of accounts when the site got hit by a spambot, maybe I accidentally shut your’s down. What was your user name? I can go check and see what’s happening.
Cheers,
Randy Hyde
Oh, sorry… I forgot to check google’s spam folder: that’s where the activation mail landed.
(false positive…)
Looking forward to writing up a few things, that others will hopefully also find useful.
Here’s how to use gas for linux with an online compiler:
https://wandbox.org/permlink/qwW3TdmUUtMxw1WQ
Full Write-up
52836 284208Quite intriguing information !Perfect just what I was seeking for! 539505