background preloader

Desktop

Facebook Twitter

Download.intel.com/products/processor/manual/325462.pdf. Why Learn Assembly Language? Introduction "Assembly language? Isn't that the hard to read instructions on how to assemble your brand new computer desk? "... No.. What is Assembly Language? x86 Assembly is a programming language for the x86 class of processors (specifically the 32bit x86 processors IA-32 - The instruction set defined by the IA-32 architecture is targeted towards the family of microprocessors installed in the vast majority of personal computers on the planet. Assembly language is machine specific and considered a "low level" language. Background I thought assembly was a dead language, why waste the time?

Though it's true, you probably won't find yourself writing your next customer's app in assembly, there is still much to gain from learning assembly. So why should you care? Points of Interest Wirth's Law I remember dialling into a BBS on my 486 with my brand new 2400bps modem. My Eyes are Open! Resources on Learning Assembly Introduction to x86 Assembly Language History. The Tao Of Programming. Translated by Geoffrey James Transcribed by Duke Hillard Transmitted by Anupam Trivedi, Sajitha Tampi, and Meghshyam Jagannath Re-html-ized and edited by Kragen Sittler Last modified 1996-04-10 or earlier Table of Contents Book 1 - The Silent Void Thus spake the master programmer: ``When you have learned to snatch the error code from the trap frame, it will be time for you to leave.'' Something mysterious is formed, born in the silent void.

If the Tao is great, then the operating system is great. The Tao of Programming flows far away and returns on the wind of morning. The Tao gave birth to machine language. The assembler gave birth to the compiler. Each language has its purpose, however humble. But do not program in COBOL if you can avoid it. In the beginning was the Tao. Programmers that do not comprehend the Tao are always running out of time and space for their programs. How could it be otherwise? The wise programmer is told about Tao and follows it. The highest sounds are hardest to hear.

Version Control

Low Level Details. When I started programming many of the elements we take for granted now, did not exist. There was no DirectX and not many compatible libs were available for the free compilers of the day. So I had to write my own code for most basic programs, keyboard handlers, mouse handlers, video memory accessors, rasterizers, texture mappers, blitters… the programs I wrote then were 100% my own code and I had to be able to handle anything and everything. Personally I’ve always been interested in what was going on under the hood so this suited me just fine. I always dug into the details and I almost always end up programming as close to the bone ON the hardware (or OS) as I possibly can both to eek out as much performance as possible AND to satisfy my own hunger for knowledge.

Over the last decade I’ve been involved in the hiring process at many studios and in more recent years I’ve noticed a pattern. It depresses me that so much of what I consider to be essential is simply not being taught anymore. Low Level Bit Hacks. I decided to write an article about a thing that is second nature to embedded systems programmers - low level bit hacks. Bit hacks are ingenious little programming tricks that manipulate integers in a smart and efficient manner. Instead of performing some operation (such as counting the 1 bits in an integer) by looping over individual bits, these programming nuggets do the same with one or two carefully chosen bitwise operations.

To get things going I'll assume that you know what the two's complement binary representation of an integer is and also that you know all the the bitwise operations. I'll use the following notation for bitwise operations in the article: & - bitwise and | - bitwise or ^ - bitwise xor ~ - bitwise not << - bitwise shift left >> - bitwise shift right The numbers in the article are 8 bit signed integers (though the operations work on arbitrary length signed integers) that are represented as two's complement and they are usually named 'x'. Here we go. Bit Hack #1. 1. 2. Cache Coherency explained.

Cache coherency explained The Intel SA-110 StrongARM processor is a Harvard cache architecture processor – hence it uses separate instruction and data caches, and in addition its data cache is a write-back cache. This raises cache coherency problems in a multiprocessing configuration. Caching explained Most modern microprocessors contain some form of instruction and data caching where a small but fast bit of memory is used to speed up access to main memory. Again at its simplest level, a cache must be write-through cache whenever the processor performs a write to main memory. The problem is, writes to main memory are usually even slower than reads. Write-back Caching explained A write-back cache is for obvious reasons somewhat more complicated than that for a write-through cache. Cache incoherency Now imagine if there were two processors of this type accessing a particular area of memory at the same time. Software based Cache Coherency 1. 2. 3.

Conclusions.

Languages Frameworks

Computer Science. Higher Order Macros in C++