Some assembly required : assembly language programming with the AVR microcontroller - Margush, Timothy S. (Boca Raton, Florida : CRC Press, 2012)
"A family of internationally popular microcontrollers, the Atmel AVR microcontroller series is a low-cost hardware development platform suitable for an educational environment. Until now, no text focused on the assembly language programming of these microcontrollers. Through detailed coverage of assembly language programming principles and techniques, Some Assembly Required: Assembly Language Programming with the AVR Microcontroller teaches the basic system capabilities of 8-bit AVR microcontrollers.The text illustrates fundamental computer architecture and programming structures using AVR assembly language. It employs the core AVR 8-bit RISC microcontroller architecture and a limited collection of external devices, such as push buttons, LEDs, and serial communications, to describe control structures, memory use and allocation, stacks, and I/O. Each chapter contains numerous examples and exercises, including programming problems.By studying assembly languages, computer scientists gain an understanding of the functionality of basic processors and how their capabilities support high level languages and applications. Exploring this connection between hardware and software, this book provides a foundation for understanding compilers, linkers, loaders, and operating systems in addition to the processors themselves"--. "Introduction What is Assembly Language? The functionality of every computer system is centered on a processor. The processor is responsible for controlling most aspects of the computer system. Its name indicates its function; processing data, performing arithmetic and logical operations, storing and retrieving information, and communicating with or controlling peripheral devices. Every processor has its own native language, called machine language. These are the processing instructions that are unique to each processor. Machine language instructions are simply binary codes that are interpreted by the processor's hardware and converted to a sequence of electrical signals that alter the state of the computer system. Machine language programming is accomplished by carefully devising sequences of bits, usually organized into bytes or words that need to be placed in appropriate memory locations before execution begins. Programming at the machine language level requires knowledge of what is called the Instruction Set Architecture of the processor. This level of the processor's design is realized by an even lower level, called the microarchitecture. In some cases, the microarchitecture level is implemented using even more primitive instructions called microcode. The Instruction Set Architecture of a processor includes its instruction set and the system components the instructions directly or indirectly affect. These components include registers, memory, addressing, interrupts, exceptions, and even the primitive data types that can be manipulated by the instructions. For each particular machine language, an Assembly Language can be designed to aid a programmer in the process of writing a machine language program. Assembly Language is a plain text expression of a machine"--.
IntroductionComputer SystemsBasic Processor Architecture Components of a Computer System Classification of Processors Numeration Systems Boolean DataExercisesThe Atmel AVR Microcontroller Family The AVR Core Machine Language for the AVR Microcontroller AVR Studio AVR Development Platforms Introduction to AVR Assembly LanguageSample AVR Assembly Language ProgramExercisesProgramming ExercisesAlternate Programs for the XPLAIN Demonstration KitAssembly LanguageDirectives Expressions Data Definition Directives Instructions The Toggler Program: Sample I/O ExercisesProgramming ExercisesAlternate Programs for the XPLAIN Demonstration KitInteger Data RepresentationUnsigned Integer Data Character Data Signed Integer Data Binary Coded Decimal Data Values in Programs Assignment Statements Branch Instructions ExercisesProgramming ExercisesAVR Core: Startup, Reset, and MemoriesAVR Reset Signal Basic System OrganizationProgram Memory Data SpaceEEPROMExercisesProgramming ExercisesAlternate Programs for the XPLAIN Demonstration KitThe Stack and Function CallsStack Functions Arguments, Parameters, and Return ValuesLocal StorageAuxiliary Data Stack (Software Stack) Call By Reference ExampleExercisesProgramming ExercisesSerial Communications Using the Universal Synchronous and Asynchronous Serial Receiver and TransmitterRS-232 Serial Communication Basics AVR USART Configuration AVR USART Transmit and Receive Serial Transmission Errors Polled I/O Seri al Communications ExampleExercisesProgramming ExercisesAlternate Programs for the XPLAIN Demonstration KitLogical OperationsBitwise Logical Operations Uses of Logical Instructions Shift and Rotate Special Bitwise Operations AV R Timer/Counter Timer/Counter Example: LED BlinkerExercisesProgramming ExercisesAlternate Programs for the XPLAIN Demonstration KitControl StructuresAltering the Flow of Control Jump and Conditional Branch Instructions Selection Looping Pseudocode Development: A Checksum ProgramExercisesProgramming ExercisesAlternate Programs for the XPLAIN Demonstration KitInterruptsInterrupt Processing General External Interrupts Interrupt -Controlled Up/Down Counter Timer Counter Interrupts Interrupt-Based Switch Bounce Elimination USART Interrupts ExercisesProgramming ExercisesAlternate Programs for the XPLAIN Demonstration KitArithmetic OperationsAddition and Subtraction AVR Addition and SubtractionBCD Addition and Subtraction Binary/BCD Conversion Multiplication and Division Numeric I/O and Type Conversions Sieve of EratosthenesExercisesProgramming ExercisesAlternate Programs for the XPLAIN Demonstration KitArraysDeclaring and Using Arrays Multidimensional Arrays Strings Storage Allocation Dynamic Memory Allocation Structures A Better HeapExercisesProgramming ExercisesReal NumbersIEEE Floating Point Representation Addition and Subtraction of IEEE Floating Point Numbers Multiplication and Division of Floating Point Numbers Fixed Point ArithmeticSummaryExercisesProgramming ExercisesProgramming the AVR in CObject Files and Linkers Anatomy of a C Program Fundamentals of C ProgrammingAssembly Language and CExercisesProgramming ExercisesAppendix: Getting Started with the XPLAIN Evaluation KitIndex
Includes bibliographical references.
Keywords: ASSEMBLY LANGUAGES (ELECTRONIC COMPUTERS)