asm Keyword 17: Data Instructions(Data Movement, Address Movement, Data Conversion, Bit Manipulation)
Data Movement:just as one would guess this instruction moves data from one location to another. Source and destination can be registers or memory and will be determined by addressing. The destination contents before the move are destroyed. Data movement instructions typically set or clear processor flags.
Address Movement: much like Data Movement except with addresses. This instructions moves an address from one location to another another. Source and destination can be registers or memory and will be determined by addressing. The destination contents before the move are destroyed. unlike movement instructions, address movement instructions typically do not modify processor flags.
Data Conversion: an instruction that changes data from one format to another. All data is stored as binary information but there are various storage formats as well as sizes. Data conversion can take a small value and and extend it to a larger format or just simply change a value as in a character value into an integer value.
Bit manipulation: instructions that manipulate a specific bit of a bit string. Bit clear changes the specified bit to zero. Bit set changes the specified bit to one. Bit change modifies a specified bit, clearing a one bit to zero and setting a zero bit to one.
asm Keyword 18: Control and Data Flow
Control and Data Flow: is accomplished by instructions to modify the flow of a program. This is commonly done with Branches or more specifically conditional branches and unconditional branches. An unconditional branch is going to modify the flow of the program once executed, whereas a conditional branch may or may not change the flow depending on the condition.
Subroutines are a group of instructions that come from the pool of processor instructions. Subroutines are used to when it is often need for a task to be completed on data. Since this “sub-task” is not needed every time these instructions that are included in the subroutine could be included in the processors main program but would waste resources and be unnecessary.
To access a subroutine the processor will use its Call instruction to access the first instruction of the subroutine.
The last instruction of the subroutine will be a Return instruction which will an address. This address will either be the next instruction address of the program that called it or if some condition was met will be a new instruction address.
asm Keyword 20: Storage
Storage is the retention of data for future use. It can be short term(volatile) or long term(non-volatile), but for this topic we are dealing with registers and memory which are both volatile.
Registers offer the best access speed but the least amount of storage space.
Memory offers a slower access speed than registers but has the greatest amount of storage space.
asm Keyword 21: Stack Operations
At this stage of the game everyone should know what a stack is, but to be safe Ill reiterate; a Stack is a “lifo” data structure, the last data stored to the stack is now the top of the stack and the first data to be removed. Stack operations include push which stores data to the top of the stack, pop removes the data from the top of the stack and the moves the stack thus moving the top of the stack down one. There can also be a an operation to simply view the top of the stack but I would venture a guess most processors don't have one(they certainly wouldn't need it).
Stacks and their operations are useful in cpus for many reasons, a great example is when you call a subroutine. When you call a subroutine you are going to a different instruction in memory completing each instruction in the subroutine until you get to the last instruction which is a return. The return will take you back to the next address before you called the subroutine. Well how do we know how to do this? When you call the subroutine you push the next address onto the stack, when you return from the subroutine you pop it and know where to return to!
asm Keyword 22: Data Representation (Big Endian, Little Endian, Size, Integer, Floating Point, ASCII)
Data Representation is is just what you would guess, how data is represented which can be done in several ways
Size: a bit is the is the basic building block of a system but there isn't much you can do with a bit, in fact there is only two things. However once we combine bits together we can do much much more. A byte is the basic grouping and in virtually all modern processors is 8 bits. A word is the default data size for the processor which is chosen by the designer, most are between 16 and 32 bits though. It is important to know this information when dealing with a processor. On a side note a Nibble is half a byte.
Integer and floating point are data types. If it is an integer type, then the binary value will be treated as a whole number. If it is floating point it will be treated as a real number, aka fraction.
ASCII is a character code that will take an integer value and convert it to some character. For example the integer 64 equates to 'A'.
Big Endian stores values in a natural order with the most significant byte in the lowest numerical byte address. In simpler terms it is the way most of us are used to, lets say you use 4 bytes to represent values and broke that up into 32 bits going from left to right the most significant bit would be the left most with the right most being the least significant.
Little Endian is the oppositing of Big endian in which the least significant byte is in the lowest numerical bye address. 4 bytes represented as 32 bits the most significant bit would be the right most with the least being the right most.
Address
Big-Endian representation of 1025
Little-Endian representation of 1025
1
00000000
00000001
2
00000000
00000100
3
00000100
00000000
4
00000001
00000000
asm Keyword 23: Data Representation(Sign Representation, One's Complement, Two's Complement)
Sign representation is a way to determine if number is positive or negative. Usually the most significant bit will be used to determine positive or negative, but there can be issues with “0”
One's Complement is another way to deal with negative values. each bit in the binary value is swapped with its counter parts, 0's become 1's and vice versa.This “complement” of the number then behaves like the negative of the original number in most arithmetic operations. This will still have issues with “0”.
Two's Complement is currently the most common method to represent sign. Each binary value is swapped with its counter part just like the ones complement but when finished 1 is added. By doing this you take away any issues with “0”.
asm Keyword 24: Linker, Object and Machine code
A Linker is a program that will take one more more object file's and turn them into executable machine code.
Object code is generated by a language translator like a compiler or assembler when run on source code. (we compile our c/c++ code). This is the middle step between source code and machine code. It is much closer to machine code but still might have some debugging tokens and other information the processor would not recognize.
Machine Code is the output of the linker on one ore more object files and is pure machine code ready to execute on the processor it was designed for.
asm Objective
asm Objective: Understanding the concepts of Assembly
The key concept of Assembly is unlike other programming languages, assembly is not a single language. It is actually many languages(although usually similar). Each processor family and sometimes even individual processors in a family will have their own assembly language.
Another key concept is that data structures and program structures are created by implementing them right on the hardware, this is not done in high level languages.
opus/spring2012/kkrauss1/asmpart3.txt · Last modified: 2012/04/25 00:14 by wedge