Sunday, July 31, 2011

Chapter 9 slides on seyfarth.tv/asm

I have uploaded the PDF slides for Chapter 9 to http://seyfarth.tv/asm where they are now available for download.  Chapter 9 is about functions.  It discusses the registers involved with Linux and Windows function parameters along with the registers which must be preserved across function calls.

The standard way of creating a stack frame for a function is explained which is quite helpful in debugging.  The chapter ends with a recursive factorial function.

Amazon search now works for my Assembly TextBook

If you search for "64 bit assembly" you should find my book listed on the first page on Amazon.  Unfortunately you can't buy the book directly from Amazon.  I hope that soon becomes an option.  There are 4 resellers listed and I expect that all will deliver the book.  Three of the four offer the book for slightly less than CreateSpace, but not a lot less when considering shipping.  CreateSpace prints the books, so perhaps their shipping is quicker, but these days things could be automated so that an order placed is transferred to CreateSpace within a second or two.  In any case I have made several orders from CreateSpace and have been quite pleased with their delivery times.

Chapter 8 slides now on www.seyfarth.tv/asm

I have prepared PDF slides for Chapter 8 and placed them on www.seyfarth.tv/asm.  I have also added a few errata to the web site.

Chapter 8 is about branching and looping.  The strategy is to convert C if/else statements and loops to equivalent assembly instructions.  This chapter is where the optimizations employed by the compiler start to become more comprehensible.

One of the simple optimizations is to convert loops to test at the bottom of loops which can mean one less jump statement in a loop.  Another is to count down if the only purpose is to do the loop a certain number of times.

This chapter discusses how the gcc compiler performs loop unrolling and why this matters.

The next chapter is functions, followed immediately by arrays.  After those chapters the student will be able to write some very interesting programs.

Saturday, July 30, 2011

Updated Bluehost to serve up http://rayseyfarth.com and updated DynDNS

I have used dyndns.com for my dns entries for a few years now.  I registered seyfarth.tv with them and have been moderately happy with that plans so far.

Unfortunately now I have to use WebHop DNS records in DynDNS to map my URLs to Blue Host's URL's.  I added rayseyfarth.com as my domain for Blue Host and updated the DynDNS entries to match the change.  This results in a request to http://seyfarth.tv/asm being redirected to http://rayseyfarth.com/asm which shows as the URL in the browser.

The main benefit to this is that further use of my web site will be independent of DynDNS.  This should improve the performance a little bit and avoid seeing horrible numeric IP addresses in the URL bar.

You can find my book easily at Amazon or Barnes and Noble.  You can also find the direct link at  CreateSpace using https://www.createspace.com/3651611.

Chapter 7 slides now on www.seyfarth.tv/asm

I have completed the PDF slides for Chapter 7 which is about bit instructions.  It covers negation, and, or, exclusive-or, shifting, rotating and testing individual bits.  In all cases examples are given to try to point out a possible use for the instructions.

One use for these instructions is in extracting and filling bit fields in a register or in memory.  Extraction is documented fairly well with 2 techniques illustrated with examples.  Perhaps a little later I will add some illustrations of insertion of bit-fields.

A second use for these instructions is the  maintenance of a set implemented as an array of bits.  Some sample code is given in Chapter 7 giving the fundamental techniques for managing a bit set, but there is not a complete program given for managing a set.  This would make a good exercise for this chapter, except that arrays are not fully introduced yet.  They are used with an index register in Chapter 7 with little fanfare.

Friday, July 29, 2011

Slides for Chapters 5 and 6 Ready

I have uploaded PDF slides for "Chapter 5: Registers" and "Chapter 6: A Little Bit of Math" to http://www.seyfarth.tv/asm so now there are 6 of 19 chapters prepared.

Chapter 5 introduces how to move data between registers and memory.  It also introduces the conditional move instructions which can add efficiency for fairly short if/else sequences.  That is a poor substitute for branching statements which come later, but they can be more efficient.

Chapter 6 adds in integer mathematics instructions.  With those you can do quite a lot.  You still need branching and input/output statements to make real programs, but it takes some time to get enough things covered to write more realistic programs.

Thursday, July 28, 2011

Cloud adventure continued

Goodbye Amazon Cloud Front
I gave it a pretty good effort with Amazon's Cloud Front, but grew tired and confused.  If I used the S3 storage, I could not use http://www.seyfarth.tv/asm and get a default index.html.  If I set it up to feed from my own computer, it seemed to always fetch PDF files from my computer.  It also would not work with my computer down.  Fighting against down time was a big part of my reason for choosing Cloud Front.

I tried several times with both modes.  The S3 storage system uses a 24 hour time to live (TTL) by default.  I quickly grew tired of all the confusion over changing data in files.  Web sites are never static and I don't wait 24 hours very well.  I got a wide array of strange behavior during all this time.  I would use curl to view what html I should get and it would look great, but no amount of clearing cache would make any browser give me what I saw with curl.  I fail to comprehend the problem, so I have given up on Amazon's Cloud Front.

Cloud Front was dirt cheap for light usage and very fast, but at some point I decided that I had to start valuing my own time and decided to fork out money to a hosting service.  I selected Blue Host  which was rated very well for a cheap price.

Wednesday, July 27, 2011

Moving to the cloud

I have decided to move my web sites to the Amazon CloudFront service, using their S3 storage service as the mechanism for storing files.  They are supposed to automatically direct browsers to closer servers, so there will be much better response world wide.

I also have fairly regular DSL outages, which might frustrate potential customers.  I would not enjoy trying to browse somewhere and getting no response.  Maybe Amazon will be amazing.  I have been using S3 for a while now and paying a few cents a months (normally 2 cents).  I might have to start paying 10 or 20 cents a month.

I suppose ATT might be happier with me not running a web server from my house.  It should be a win all-around.

I'll post an update with my charges for the web site.  I really think it will be quite cheap.

Tuesday, July 26, 2011

Chapter 4 slides now on asm.seyfarth.tv

I have spent some time today touching up the seyfarth.tv web site.  I am trying to use simply HTML for some pages and htlatex for others.  I find htlatex better for writing report-like pages.  I find it easier to use HTML pages for pages with lots of links.

I found a picture of my book on Amazon earlier, but it's gone now.  It seems a bit mysterious to me, but I think it will be available on Amazon later this week.

I have completed the slides for Chapter 4 which is about how the CPU uses the 4 level page table hierarchy to do logical to physical address translation.  I initially though I would skip it, but it seems fairly easy to understand, so I plan to teach it this fall.

I updated my web sites to run on Amazon's Cloud Front with their S3 storage.  I was forced to change my plan a little since seyfarth.tv/asm would not load the default index,html file.  So the real web site is asm.seyfarth.tv which I hope will be quicker and more reliable.  My DSL service goes out every time it rains in Southern California and I live in Southern Mississippi.

My Book is almost on Amazon

You can find some information about the Assembly Language textbook by searching for "64 bit assembly language".  My book is number 7 in that list.  Amazon says is is unavailable but is available at CreateSpace.

I feel sure that Amazon will have details available very soon.  I hope it comes up with the "Look inside the book" option.  I think that is the way things work for CreateSpace books.

It's nice to be on Amazon.  I hope I get somewhat favorable reviews.  I will read all the reviews to learn more about what people prefer in a book.  If I can supply what people want, then the book will sell itself.

Monday, July 25, 2011

Chapter 3 slides now on asm.seyfarth.tv

I have completed the slides for Chapter 3 of the assembly language book.  I have updated the asm.seyfarth.tv web site to have links for the first 3 PDF files.

Sunday, July 24, 2011

No eBooks for Me

I have spent too many hours trying to get things in order for the Kindle.  I figured out how to get a nice HTML book using htlatex, but the mobi book creator screwed it up pretty bad.  I've also reviewed some software for cracking DRM.   It's not a pleasant prospect to work a week or two getting a few eBook choices available and having someone start giving the book away.

Sometimes it seems that you are swimming upstream and you might as will turn around and go with the flow.  CreateSpace makes it possible to print books fairly cheaply and perhaps I need to focus on printed books.  For the next edition I think I will choose bigger pages, since it was a little challenging fitting assembly code with comments in the 6.14 inch width.  Next time I will go for 7x10.   It will make it possible to produce higher quality.

I will make my slides next. I have 2 of the 19 chapters' slides prepared now.  It will probably take a day or two per chapter.  I would like to be done by August 24 when classes start.

Assembly Language Textbook Web Site Started

I have made a minimal web site for the assembly book at seyfarth.tv/asm.  The skeleton is there with a tiny bit of meat - I have links to download the PDF slides for the first 2 chapters along with a brief introduction to the book.

There will be no errata for a few more days - maybe.  I have made 1 sale, so I may start hearing about mistakes real soon now.  I expect to find many corrections during the fall semester and will hopefully incorporate them into an updated book in January.  I will probably spend some more time on graphics.  My schedule this summer was a little tight: publishing a book and preparing slides in about 3-4 months.

You can find my book easily at Amazon or Barnes and Noble.  You can also find the direct link at  CreateSpace using https://www.createspace.com/3651611.

Assembly Language Textbook


Introduction to 64 Bit Intel Assembly Language Programming

I have written the first version of my 64 bit Assembly Language text book for Intel and AMD CPUs. I will be teaching from the textbook this fall (2011) and by that time I will have slides for the book, errata and code at my web site at seyfarth.tv/asm.

The web site is not very functional today. I have replaced my main computer with a new Core i7 computer which I have used for testing code for the text book. The web site needs a little work...

I managed to get 20.5 GFLOPS on my double precision correlation computation which is a testament to the design of the Core i series. I used the AVX instructions which allow me to specify instructions which can perform 4 double precision operations at a time. These operations take more than 1 cycle, so it is a little surprising to me to achieve about 6 double precision results per cycle. The CPU is performing out-of-order execution pretty nicely. I did make some effort to make a lot of the instructions within the main loop independent of each other to allow the CPU to do its job, but given the complexity of x86-64 instruction decoding I find it to be pretty impressive.