Presentation is loading. Please wait.

Presentation is loading. Please wait.

1/2002JNM1 Positional Notation (Hex Digits). 1/2002JNM2 Problem The 8086 has a 20-bit address bus. Therefore, it can access 1,048,576 bytes of memory.

Similar presentations


Presentation on theme: "1/2002JNM1 Positional Notation (Hex Digits). 1/2002JNM2 Problem The 8086 has a 20-bit address bus. Therefore, it can access 1,048,576 bytes of memory."— Presentation transcript:

1 1/2002JNM1 Positional Notation (Hex Digits)

2 1/2002JNM2 Problem The 8086 has a 20-bit address bus. Therefore, it can access 1,048,576 bytes of memory. How many bits and how many HEX digits are required to access 1M memory? 2 N = 1M (where N is in bits) N = 20 bits =  20/4 = 5 HEX digits

3 1/2002JNM3 Memory Map for an 80x86 computer running MS-DOS

4 1/2002JNM4 The memory space of the 8086 consists of 1,048,576 bytes or 524,288 16-bit words. 1 MB Memory Space of 8086

5 1/2002JNM5 Within the 1 MB of memory, the 8086 defines 4 64KB memory blocks. Segmented Memory 7FFFF The segment registers point to location 0 of each segment. (The base address) DS: E000 CS: B300 SS: 7000 ES: 5D27

6 1/2002JNM6 Assembly Language Statements Instructions - Executable Statements Directives – provide information to assembler about how to generate executable code Format - [name] [mnemonic] [operands] [;comment]

7 1/2002JNM7 Names Max 247 characters (MASM) No distinction between uppercase, lowercase letters. First character can be a letter, ‘@’, ‘_’, ‘$’ Cannot use an assembler reserved word. Identify labels, variables, symbols, keywords

8 1/2002JNM8 OP Codes and Operands Op-code destination operand, source operand HLT; zero operands INC AX; one operand MOV AX, 100; two operands SHLD DX, AX, 4; three operands

9 1/2002JNM9 AL 00 Immediate Addressing Mode Mov AL, 3CH AL 3C

10 1/2002JNM10 Register Addressing Mode Mov AL, BL AL 00 BL4D AL4D BL4D

11 1/2002JNM11 Direct Addressing Mode Mov CL, [0020H] Mov CX, [0020H] Memory (data) Little Endian Format – The “little” end of the number is stored first. CL 78 CX 5678 Mov ECX, [0020H] ECX 12345678

12 1/2002JNM12 Register Indirect Addressing Mode Mov CL, [SI] In the 8086, only BX, BP, SI and DI may be used as memory pointers. Later processors don’t have this restriction. Mov SI, 0022H CL 34 SI 0022

13 1/2002JNM13 BX 0020 Base + Displacement Mov AL, [BX +2] Useful when accessing individual elements in an array. Note that the array begins with element 0, element 2 corresponds to the third location in the array. The displacement corresponds to byte offset from the base, not element number in the array. Mov BX, 0020H AL 34

14 1/2002JNM14 BX 0020 Base + Index + Displacement (Useful when accessing individual elements in an record) Mov BX, 0020H ;BX points to record starting address SI 000C Mov SI, 000CH ;SI points to record three (4 elements ;per record x 3 records = 000C) Mov AL, [BX+SI+1] ;AL now has the data in element 1 of ;record #3 (assumes elements are 1 byte)

15 1/2002JNM15 Base + Displacement –Mov AL, [BX + 4] Base + Index + Displacement –Mov AL, [BX+SI+3] Base + Index*Scale + Displacement –Mov AL,[BX+SI*4+3] Immediate –Mov AL, 4CH Register –Mov AL, BL Direct –Mov AL, [20H] Register Indirect –Mov AL, [SI] Instruction Addressing Modes

16 1/2002JNM16 Segment Register Defaults

17 1/2002JNM17 Standard Assembler Directives

18 1/2002JNM18 Data Allocation Directives Char1 db ‘A’hex db 41h Signed1 db -128dec db 65 Signed2 db +127bin db 01000001b Unsigned db 255hex2 db 0A3h

19 1/2002JNM19 Lists and Strings List1 db 10, ‘A’, 41h, 0Ah, 00100010b, 101q Listptr db List1 Cstring db “This is a string”,0 Clength = ($ - Cstring); sets Clength to length of Cstring db 20 dup(0); 20 bytes, all equal to zero db 4 dup(“ABC”); 12 bytes, “ABCABCABCABC”

20 1/2002JNM20 Ptr Operator Ptr Operator - For some instructions, the size of the operand is not clear (INC [20H]). INC Byte Ptr [0020]INC Word Ptr [0020]

21 1/2002JNM21 Direct Addressing Direct-Offset Addressing Offset operator – returns the 16-bit address of the variable. Good for strings and arrays..data Bytelist db 35h, 63h, 79h Wordlist dw 1234h, 5678h.code … Moval, Bytelist; al = 35 Moval, Bytelist+1; al = 63 Movbx, Wordlist; bx = 1234 Movbx, Wordlist+2; bx = 5678

22 1/2002JNM22 Direct-Offset Addressing with Strings.data aString db “ASTRING”.code … Moval, aString; al = 41 Moval, aString+1; al = 53 Moval, aString+2; al = 54 Moval, aString+3; al = 52

23 1/2002JNM23 8086 Flags - Bit Positions and Names

24 1/2002JNM24

25 1/2002JNM25 Interrupt Functions (Listed in Appendix G of Irvine Book) INT 10h – (Video Bios) INT 16h – (Keyboard) INT 33h – (Mouse) INT 20 – terminate COM program (use INT 21,4C instead) INT 21h – DOS Functions (AH holds function number) 1 – Keyboard input (char; store in AL ) 2 – Display char (DL holds char) 3 – print char (DL holds char) 9 – print string (DX points to string) 4Ch – terminate process


Download ppt "1/2002JNM1 Positional Notation (Hex Digits). 1/2002JNM2 Problem The 8086 has a 20-bit address bus. Therefore, it can access 1,048,576 bytes of memory."

Similar presentations


Ads by Google