Survey
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
EE314 Microprocessor Systems Chapter 3 80x86 Instruction, Part 1: Addressing Modes, Flags, Data Transfer, and String Instructions Objectives: The style of source files written in 80x86 assembly language The different addressing modes of the 80x86 The operation and use of the processor flags Data transfer and string instructions Based on "An Introduction to the Intel Family of Microprocessors" by James L. Antonakos 3.2 Assembly language programming Source file (TOTAL.ASM) Assembler Object files ... List file (TOTAL.LST) Object file (TOTAL.OBJ) Linker Final object file or executable file Library 3.2 Assembly language programming A Sample Source File 8000 B8 8001 00 8002 70 DATA Data name Label POINTS SUM DATA CODE 1 2 3 4 5 6 7 8 9 10 11 12 13 8000 8000 8003 8005 8007 8009 800C 800E 800F 8011 8013 8015 B8 7000 8E D8 B0 00 B3 10 BE 0000 02 04 46 FE CB 75 F9 88 04 CB TOTAL: ADDUP: CODE Begin of Data segment SEGMENT PARA ‘DATA’ ORG 7000H DB 16 DUP (?) DB (?) ENDS End Segment SEGMENT PARA ‘CODE’ ASSUME CS:CODE, DS:DATA ORG MOV MOV MOV MOV MOV ADD INC DEC JNZ MOV RET ENDS END END 8000H AX,7000H DS,AX AL,0 BL,16 SI,0 AL,[SI] SI BL ADDUP [SI],AL Begin of Code segment ;load address of data area; ;init data segment register ;clear result ;init loop counter ;init data pointer ;add data value to result ;increment data pointer ;decrement loop counter ;jump if counter not zero ;save sum ;return TOTAL End Source file Start execution address 3.2 Assembly language programming A Sample Source File POINTS SUM 1 2 3 4 5 6 7 8 9 10 11 12 13 8000 8000 8003 8005 8007 8009 800C 800E 800F 8011 8013 8015 B8 7000 8E D8 B0 00 B3 10 BE 0000 02 04 46 FE CB 75 F9 88 04 CB TOTAL: ADDUP: .MODEL .DATA ORG DB DB .CODE ORG MOV MOV MOV MOV MOV ADD INC DEC JNZ MOV RET END SMALL 7000H 16 DUP (?) (?) 8000H AX,7000H DS,AX AL,0 BL,16 SI,0 AL,[SI] SI BL ADDUP [SI],AL TOTAL ;load address of data area; ;init data segment register ;clear result ;init loop counter ;init data pointer ;add data value to result ;increment data pointer ;decrement loop counter ;jump if counter not zero ;save sum ;return 3.2 Assembly language programming Predefined .MODEL types Memory Model Data Copde Segments Segments TINY SMALL MEDIUM COMPACT LARGE HUGE FLAT one one one multiple multiple multiple one one one multiple one multiple multiple one Special Features .COM files. CS and DS combined smallest .EXE model Uses normalized address 32 bit addressing 3.3 Instruction Types Instruction Types Scope Data transfer reg<->reg; reg<->mem Strings move, scan, compare strings in memory Arithmetic add, sub (signed or no), mul, div, BCD, ASCII Bit manipulation AND, OR, XOR, NOT, shift, rotate Loops and jumps Conditional and unconditional program jumps Subrutine and interrupt Subrutine (far, near) and interrupt, stack control Processor control control flags, enable/disable interrupts, Data size 8, 16, 32 bit 64KB 8, 16, 32 bit 8, 16, 32 bit