Service and Supports for People with Intellectual/Developmental Disabilities
This information discusses service and support options for individuals with intellectual/developmental disabilities, including eligibility criteria and assessment requirements. It also outlines the definition of developmental disabilities in Colorado and the importance of documenting neurological conditions for determination of eligibility for services.
Download Presentation

Please find below an Image/Link to download the presentation.
The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author.If you encounter any issues during the download, it is possible that the publisher has removed the file from their server.
You are allowed to download the files provided on this website for personal or commercial use, subject to the condition that they are used lawfully. All files are the property of their respective owners.
The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author.
E N D
Presentation Transcript
x86 Assembly Language Fundamentals Professor John Carelli Kutztown University Computer Science Department
x86 Assembly Languages x86 assemblers have two main variants: Intel dominant in the DOS/Windows world MASM (and many others) AT&T dominant in the Unix world GAS, an open source, Gnu assembler is an example Gnu also provides g++, gdb, etc GAS actually supports both Intel and AT&T There are significant syntactical differences between the two Opposite order of operands in instructions AT&T: mnemonics (i.e. commands) change based on operand size Not in Intel syntax Professor John Carelli Kutztown University Computer Science Department
MASM Microsoft Macro Assembler Based on the Intel Syntax Used for MS-DOS and Windows Supported by Microsoft Comes packaged with SDK s and C compiler Supported in Visual Studio Microsoft IDE (Integrated Development Environment) This course will be Windows based and use MASM Visual Studio will be used as an IDE Professor John Carelli Kutztown University Computer Science Department
First Example (AddTwo) main PROC mov eax,5 ; move 5 to the EAX register add eax,6 ; add 6 to the EAX register INVOKE ExitProcess,0 main ENDP Define the main procedure starting point for the program Instructions mov: move the integer value 5 into the eax register add: add the integer value 6 to the value stored in eax Note: text after the ; is a comment Call a Windows service (function) to end the program Professor John Carelli Kutztown University Computer Science Department
Add a Variable (AddTwoSum) .data ; data area (in memory) sum DWORD 0 ; create a variable called sum .code ; code area (in memory) main PROC mov eax,5 ; move 5 to the EAX register add eax,6 ; add 6 to the EAX register mov sum, eax ; move the result to sum INVOKE ExitProcess,0 main ENDP .data and .code are Directives Define segments of memory to store data (variables) or instructions (code) Reserve location in memory to store a variable named sum DWORD (also a Directive) makes the variable 32 bits Move the contents of eax to the memory location for sum Professor John Carelli Kutztown University Computer Science Department
Basic Elements of Assembly Language Literals Fixed values Integer, Real, Character, String Directives and instructions Labels Mnemonics and Operands Comments Professor John Carelli Kutztown University Computer Science Department
Numeric Literals Optional leading + or sign Non-decimal representations require radix suffixes h hexadecimal b binary o octal r real (used for IEEE formatted floating point numbers) d (or nothing) decimal Integer Examples: 30d, 6Ah, 42, 1101b Hex beginning with letter: 0A5h (to avoid confusion with an identifier) Real values are allowed Decimal and floating point (similar to C ) Expressions are allowed Follow usual precedence rules They are not variables! - evaluated once at assembly time Professor John Carelli Kutztown University Computer Science Department
Character and String Literals Enclose character in single or double quotes 'A', "x" ASCII character = 1 byte Enclose strings in single or double quotes "ABC" 'xyz' Each character occupies a single byte* Embedded quotes: 'Say "Goodnight," Gracie *Note: characters are stored as integer values using the character's binary ASCII code Irvine, Kip R. Assembly Language for x86 Processors 7/e, 2015. Modified, John Carelli 8
Reserved Words and Identifiers Reserved words cannot be used as identifiers Instruction mnemonics, directives, type attributes, operators, predefined symbols See MASM reference in Appendix A Identifiers Programmer-specified names variables, constants, procedure (function) names, labels, 1-247 characters, including digits not case sensitive first character must be a letter, _, @, ?, or $ Irvine, Kip R. Assembly Language for x86 Processors 7/e, 2015. modified, John Carelli 9
Basic Elements of Assembly Language Literals Fixed values Integer, Real, Character, String Instructions Directives Labels Mnemonics and Operands Comments Professor John Carelli Kutztown University Computer Science Department
Instructions Instructions tell the computer what tasks to perform Use a mnemonic code for readability Mnemonic is converted into machine code* by the assembler Executed at runtime by the CPU We use the Intel IA-32 instruction set * Machine code is the bit pattern representing a given instruction - Decoded by the circuitry to perform the specified task Professor John Carelli Kutztown University Computer Science Department
Basic Instruction Format Label: mnemonic destination, source ; comment mnemonic (or opcode) is required Assembler shorthand for the machine operation to be performed (ex: mov, add, ) Operands Instruction input and/or output Requirements vary with the instruction Label is optional Identifies the memory location of the instruction Used in branching Professor John Carelli Kutztown University Computer Science Department
Types of Instruction Operands Constants* constant expression* Gets evaluated when assembled not at runtime! A register A memory location (data label) * Constants and constant expressions are often called immediate values Professor John Carelli Kutztown University Computer Science Department
Instruction Examples No operands stc One operand inc eax inc myByte Two operands add ebx,ecx sub myByte,25 add eax,36 * 25 ; set Carry flag ; register ; memory ; register, register ; memory, constant ; register, constant-expression Irvine, Kip R. Assembly Language for x86 Processors 7/e, 2015. 14
Basic Elements of Assembly Language Literals Fixed values Integer, Real, Character, String Instructions Directives Labels Mnemonics and Operands Comments Professor John Carelli Kutztown University Computer Science Department
Directives Commands that are recognized and acted upon by the assembler Not part of the Instruction set So, no opcode associated with them Used to guide the assembler Declare variables, code or data areas, select memory model, declare procedures, etc. Not case sensitive Different assemblers have different directives NASM not the same as MASM, for example .data, .code, and DWORD are examples Irvine, Kip R. Assembly Language for x86 Processors 7/e, 2015. 16
Basic Elements of Assembly Language Literals Fixed values Integer, Real, Character, String Instructions Directives Labels Mnemonics and Operands Comments Professor John Carelli Kutztown University Computer Science Department
Labels Act as place markers marks the address (offset) of code and data Follow identifier rules Data label must be unique example: myArray Code label target of jump and loop instructions example: L1: (not followed by colon) (followed by colon) Again - not part of the Intel instruction set! Irvine, Kip R. Assembly Language for x86 Processors 7/e, 2015. 18
Basic Elements of Assembly Language Literals Fixed values Integer, Real, Character, String Directives and instructions Labels Mnemonics and Operands Comments Professor John Carelli Kutztown University Computer Science Department
Comments Comments are good especially for assembly code! explain the program's purpose when it was written, and by whom revision information tricky coding techniques application-specific explanations Single-line comments begin with semicolon (;) Multi-line comments begin with COMMENT directive and a programmer- chosen character end with the same programmer-chosen character Irvine, Kip R. Assembly Language for x86 Processors 7/e, 2015. 20
Comment Examples ; we have seen this comment before! COMMENT ! This is another style of comment It is multiline ! Professor John Carelli Kutztown University Computer Science Department
Defining Data (variables!) A mechanism for setting aside memory for storing data (basically, a variable) Must be defined in the .data section of the program Accomplished with a Data Definition statement The type of data to define must be provided Using a supported directive Anything from a single byte up to multi-byte words An initializer (at least one) must be provided An optional name may be provided Serves as a variable name that can be accessed elsewhere in the program
Data Definition Statement A data definition statement sets aside storage in memory for a variable. May optionally assign a name (label) to the data The name/label refers to the memory location of the data value It can be used in the program as a variable name Syntax: [name] directiveinitializer [,initializer] . . . value1 BYTE 10 All initializers become binary data in memory Use a ? to leave a variable uninitialized Irvine, Kip R. Assembly Language for x86 Processors 7/e, 2015. 23
Intrinsic Data Types BYTE, SBYTE 8-bit unsigned integer; 8-bit signed integer WORD, SWORD 16-bit unsigned & signed integer DWORD, SDWORD 32-bit unsigned & signed integer Irvine, Kip R. Assembly Language for x86 Processors 7/e, 2015. Modified John Carelli 24
Other Intrinsic Data Types QWORD, TBYTE 64 and 80 bit integers REAL4, REAL8, REAL10 4-byte IEEE short real 8-byte IEEE long real 10-byte IEEE extended real For floating point values Professor John Carelli Kutztown University Computer Science Department
Defining BYTE and SBYTE Data Each of the following defines a single byte of storage: value1 BYTE 'A' value2 BYTE 0 value3 BYTE 255 value4 SBYTE -128 value5 SBYTE +127 value6 BYTE ? ; character constant ; smallest unsigned byte ; largest unsigned byte ; smallest signed byte ; largest signed byte ; uninitialized byte MASM does not prevent you from initializing a BYTE with a negative value, but it's considered poor style. If you declare a SBYTE variable, the Microsoft debugger will automatically display its value in decimal with a leading sign. Irvine, Kip R. Assembly Language for x86 Processors 7/e, 2015. 26
Defining Byte Arrays Examples that use multiple initializers: list1 BYTE 10,20,30,40 list2 BYTE 10,20,30,40 BYTE 50,60,70,80 BYTE 81,82,83,84 list3 BYTE ?,32,41h,00100010b list4 BYTE 0Ah,20h, A ,22h Values are stored in successive memory locations Location list1 contains 10 Location list1+1 contains 20 Irvine, Kip R. Assembly Language for x86 Processors 7/e, 2015. 27
Defining Strings (1 of 3) A string is implemented as an array of characters For convenience, it is usually enclosed in quotation marks It often will be null-terminated Examples: str1 BYTE "Enter your name",0 str2 BYTE 'Error: halting program',0 str3 BYTE 'A','E','I','O','U' greeting BYTE "Welcome to the Encryption Demo program " BYTE "created by Kip Irvine.",0 Irvine, Kip R. Assembly Language for x86 Processors 7/e, 2015. 28
Defining Strings (2 of 3) To continue a single string across multiple lines, end each line with a comma: menu BYTE "Checking Account",0dh,0ah,0dh,0ah, "1. Create a new account",0dh,0ah, "2. Open an existing account",0dh,0ah, "3. Credit the account",0dh,0ah, "4. Debit the account",0dh,0ah, "5. Exit",0ah,0ah, "Choice> ",0 Irvine, Kip R. Assembly Language for x86 Processors 7/e, 2015. 29
Defining Strings (3 of 3) End-of-line character sequence: 0Dh = carriage return 0Ah = line feed str1 BYTE "Enter your name: ",0Dh,0Ah BYTE "Enter your address: ",0 newLine BYTE 0Dh,0Ah,0 Idea: Define all strings used by your program in the same area of the data segment. Irvine, Kip R. Assembly Language for x86 Processors 7/e, 2015. 30
Using the DUP Operator Use DUP to allocate (create space for) an array or string. Syntax: counter DUP ( argument ) Counter and argument must be constants or constant expressions var1 BYTE 20 DUP(0) ; 20 bytes, all equal to zero var2 BYTE 20 DUP(?) ; 20 bytes, uninitialized var3 BYTE 4 DUP("STACK") ; 20 bytes: "STACKSTACKSTACKSTACK" var4 BYTE 10,3 DUP(0),20 ; 5 bytes Irvine, Kip R. Assembly Language for x86 Processors 7/e, 2015. 31
Defining WORD and SWORD Data Define storage for 16-bit integers or double characters single value or multiple values word1 WORD 65535 word2 SWORD 32768 word3 WORD ? word4 WORD "AB" myList WORD 1,2,3,4,5 array WORD 5 DUP(?) ; largest unsigned value ; smallest signed value ; uninitialized, unsigned ; double characters ; array of words ; uninitialized array Irvine, Kip R. Assembly Language for x86 Processors 7/e, 2015. 32
Defining DWORD and SDWORD Data Storage definitions for signed and unsigned 32-bit integers: val1 DWORD 12345678h val2 SDWORD 2147483648 val3 DWORD 20 DUP(?) val4 SDWORD 3, 2, 1,0,1 ; unsigned ; signed ; unsigned array ; signed array Irvine, Kip R. Assembly Language for x86 Processors 7/e, 2015. 33
Little Endian Order All data types larger than a byte store their individual bytes in reverse order. The least significant byte occurs at the first (lowest) memory address. Example: val1 DWORD 12345678h Irvine, Kip R. Assembly Language for x86 Processors 7/e, 2015. 34
Adding Variables to AddSub TITLE Add and Subtract, Version 2 (AddSub2.asm) ; This program adds and subtracts 32-bit unsigned ; integers and stores the sum in a variable. INCLUDE Irvine32.inc .data val1 DWORD 10000h val2 DWORD 40000h val3 DWORD 20000h finalVal DWORD ? .code main PROC mov eax,val1 add eax,val2 sub eax,val3 mov finalVal,eax call DumpRegs exit main ENDP END main ; start with 10000h ; add 40000h ; subtract 20000h ; store the result (30000h) ; display the registers Example: AddVariables Irvine, Kip R. Assembly Language for x86 Processors 7/e, 2015. 35
Declaring Uninitialized Data Use the .data ? directive to declare an uninitialized data segment: .data ? Within the segment, declare variables with "?" initializers: smallArray DWORD 10 DUP(?) Advantage: the program's EXE file size is reduced. Irvine, Kip R. Assembly Language for x86 Processors 7/e, 2015. 36
Symbolic Constants Equal-Sign Directive Calculating the Sizes of Arrays and Strings Note: these directives are evaluated during assembly They are not variables They cannot change at runtime Irvine, Kip R. Assembly Language for x86 Processors 7/e, 2015. 37
Equal-Sign Directive name = expression expression is a 32-bit integer (expression or constant) may be redefined name is called a symbolic constant good programming style to use symbols COUNT = 500 . . mov ax,COUNT Irvine, Kip R. Assembly Language for x86 Processors 7/e, 2015. 38
Calculating the Size of a Byte Array current location counter: $ subtract address of list difference is the number of bytes list BYTE 10,20,30,40 ListSize = ($ - list) Irvine, Kip R. Assembly Language for x86 Processors 7/e, 2015. 39
Calculating the Size of a Word Array Divide total number of bytes by 2 (the size of a word) list WORD 1000h,2000h,3000h,4000h ListSize = ($ - list) / 2 Irvine, Kip R. Assembly Language for x86 Processors 7/e, 2015. 40
Calculating the Size of a Doubleword Array Divide total number of bytes by 4 (the size of a doubleword) list DWORD 1,2,3,4 ListSize = ($ - list) / 4 Irvine, Kip R. Assembly Language for x86 Processors 7/e, 2015. 41