MIDTERM: COSC2425
3 primary I/O levels
1) high-level language functions: contains functions to perform I/O. These functions are portable because they work on a variety of different computer systems and are not dependent on any one operating system. 2)Operating system(OS): Programmers can call operating system functions from a library known as the API(application programming interface). The operating system provides high-level operations such as writing strings to files, reading strings from the keyboard, and allocations blocks of memory. 3)BIOS: a collection of low-level subroutines that communicate directly with hardware devices. Tailored to fit the computer's hardware. Operating systems typically communicate with the BIOS.
word
16 bits
doubleword
32 bits
double quadword
64 bits
byte
8 bits
Assembler
A program that converts source-code programs from assembly language into machine language. Produces both object and listing files.
Input/Output (I/O)
Application programs routinely read input from keyboard and disk files and write output to the screen and to files. I/O need not be accomplished by directly accessing hardware-instead you, can call functions provided by the OS. I/O is available at different access levels, similar to the virtual machine concept.
notional tools
Binary(base2) and hexadecimal(base16) base number systems
stack pointer registers
ESP, & EBP
CPU Status Flags
Sign(when arithmetic generates a negative), Overflow(when arithmetic generates a # too large or too small to fit [-128,127]), Carry(when too large [n>127]), Zero(when 0), Auxiliary(when arithmetic causes a carry from bit 3 to bit 4 in an 8-bit operand), Parity(when LSB is even)
Assembly language
The first language. Has a one-to-one relationship with machine language (one ASM instruction converts to one machine language instruction). Also, it is not portable because it is tied to a specific processor family.
4-basic parts of assembly language
[LABEL] Operands Instruction Mnemonic ;Comments
MOV
a data transfer instruction, copies a source operand to a destination operand. -MOVZX: zero-extends a smaller operand into a larger one. -MOVSX: sign-extends a smaller operand into a larger one.
Registers
a limited number of storage locations that are within a CPU. These can be accessed much more quicker than conventional memory.
debugger
a way to trace the execution of a program and examine the contents of memory at runtime.
INC instruction
adds 1 to an operand
Direct-Offset Operand
adds a displacement to the name of a variable, generating a new offset. This new offset can be used to access data in memory.
ADD instruction
adds a source operand to a destination operand
Logical Segments
are contained in the programs that are named code, data, and stack. Code contains executable instructions. Stack segment holds procedures parameters, local variables, and return addresses. Data holds variables.
General-purpose registers
are primarily used for arithmetic, data movement, and logical operations.
Segment registers
are used as base locations for preassigned memory areas called segments.
Operands
are values passed to instructions. Assembly language instruction can between zero and three operands, each of which can be a register, memory operand, integer expresion, or I/O port number.
Reserved words
are words with special meanings and uses in assembly language that may only be used in the correct context. This is pretty much what syntax means.
Symbolic Constant
associates an identifier with an integer or text expression. 3 directives create symbolic constants: 1)the equal-sign directive(=) associates a symbol name with a constant integer expression. 2)The EQU and TEXTEQU directives associate a symbolic name with a constant integer expression or some arbitrary text.
little-endian order
basically means low-to-high. x86 processors store and retrieve data from memory using this order. The LSB is stored at the first memory address allocated for the data. The remaining bytes are stored in the next consecutive memory positions.
EPROM
can be erased slowly with ultraviolet light and reprogrammed.
Indexed operand
combines a constant with an indirect operand. The constant and register value are added, and the resulting offset is dereferenced.
Linker
combines individual files created by an assembler into a single executable program.
2 basic modes of operation
compatibility and 64-bit mode
flags register
consists of individual binary bits that control the operation of the CPU and reflect the outcome of ALU operations.
Listing file
contains a copy of the program's source code, suitable for printing, with line #s, offset addresses, translated machine language, and a symbol table.
Source file
contains assembly language statements. It is created by a text-editor.
instruction pointer register
contains the address of the next instruction to be executed.
TYPEDEF operator
creates a user-defined type
QWORD/TBYTE
define 8-byte and 10-byte variables, respectively
WORD/SWORD
defines 16-bit variables
DWORD/SDWORD
defines 32 bit-variables
REAL4/REAL8/REAL10
defines 4-byte, 8-byte, and 10-byte real number variables respectively.
BYTE/SBYTE
defines 8-bit variables
XCHG
exchanges the contents of two operands. At least one must be a register.
3 Primary operations
fetch, decode, and execute
VRAM
holds video data. Dual ported, allowing one port to continuously refresh the display while another port writes data to the display.
END
indicates the end point of the execution process to the assembler.
BIOS(basic I/O system)
is a collection of functions that communicate directly with hardware devices.
Directive
is a command embedded in the source code and interpreted by the assembler.
Virtual Machine
is a concept that is an effective way of showing how each layer in a computer architecture represents an abstraction of a machine. Layers can be constructed of hardware or software, and programs written at any layer can related to real-world computer layers, including digital logic, instruction set architecture, assembly language, and high-level languages.
ENDP
is a directive that ends a procedure
Constant Integer Expression
is a mathematical expression involving integer literals, symbolic constants, and arithmetic operators.
Identifier
is a programmer-chosen name identifying a variable, a symbolic constant, a procedure, or a code label. THEY CAN NOT BE RESERVED WORDS.
Indirect Operand
is a register containing the address of data. By surrounding the register with brackets, a program dereferences the address and retrieves the memory data.
String literal
is a sequence of characters enclosed in quotes, optionally ending with a null byte.
Bus
is a series of parallel wires that transmit data among various parts of the computer.
Instruction Mnemonic
is a short keyword that identifies the operation carried out by an instruction.
Character literal
is a single character enclosed in quotes. The assembler converts a character to a byte containing the character's binary ASCII code.
Instruction
is a source code statement that is executed by the processor at runtime.
virtual-8086
is a special case of protected mode.
Label
is an identifier that acts a place marker for instructions or data.
CMOS RAM
is on the system motherboard and stores system setup info. It is refreshed by a battery, so its contents are retained when the computer's power is off.
Direct Operand
is the name of a variable, and represents the variable's address.
LOOP instruction
is used in counting-type loops. It uses ECX as its loop counter in 32bit, and RCX in 64bit.
Central Processor Unit(CPU)
is where calculations and logic processing occur. This is pretty much the most important thing ever created.
Memory Storage unit
is where instructions and data are held while a computer program is running.
DRAM
known as main memory, is where programs and data are kept when a program is running. Inexpensive but must be refreshed every millisecond to avoid losing contents.
PTR operator
overrides a variable's declared size.
ROM
permanently burned into a chip and cannot be erased.
Peripheral Component Interconnect(PCI) bus
provides a convenient upgrade path for Pentium processors.
Precedence
refers to the implied order of operations when an expression contains two or more operators.
SIZEOF operator
returns the # bytes used by an array initializer
LENGTHOF operator
returns the # of elements in an array
OFFSET operator
returns the distance(in bytes) of a variable from the beginning of its enclosing segment.
TYPE operator
returns the size(in bytes) of single variable or of a single element in an array
NEG instruction
reverses the sign of an operand
PROTO
set the function to a prototype
Data Definition Statement
sets aside storage in memory for a variable, and may optionally assign it a name. If multiple intializers are used in the same data definition, its label refers only to the offset of the first initializer.
DEC instruction
subtracts 1 from an operand
SUB instruction
subtracts a source operand from a destination operand
Calling Convention
tells us how to manage a runtime-stack when procedures are called(i.e stdcall), and it's used within the .model directive.
Instruction Execution cycle(IEC)
the execution of a single machine instruction can be divided into a sequence of individual operations is called IEC. Each step within this cycle takes at least one tick of the system clock, which is called the clock cycle.
motherboard
the heart of the computer, which holds the brain(CPU), supports the processors, main memory, I/O connectors, power supply connectors, and expansion slots. Most boards contain an integrated set of several microprocessors and controllers called a chipset. This chipset largely determines the capabilities of the computer.
Floating-point Unit
the x86 has a FPU expressly used for the execution of high-speed floating-point instructions.
Load and execute
this sequence describes how a program is located by the operation system. (loaded into memory and executed by the operating system)
JMP instruction
unconditionally branches to another location
SRAM
used primarily for expensive, high speed cache memory. Doesn't have to be refreshed. CPU cache memory is comprised of SRAM.