Download presentation
Presentation is loading. Please wait.
Published byDaniel Hunter Modified over 9 years ago
1
ECE 353 Introduction to Microprocessor Systems Michael G. Morrow, P.E. Week 3
2
Objectives 80C188EB Organization (continued) Segmentation Reset Processing Programmer’s Model 80C188EB Machine Language 80C188EB Assembly Language and Assemblers 80C188EB Debuggers
3
80C188EB Architecture
4
Segmented Memory Architecture Memory Segmentation Logical vs. Physical Addresses Segment Organization Topologies Disjoint Overlapping Identical Physical Address Generation Advantages Disadvantages
5
80C188EB Implementation
6
80C188EB Programmer’s Model
7
Programming Programming Languages HLL Assembly Language Machine Language Machine Language Instructions 1 – 6 bytes in length Encoding
8
Assembler Primer Assembler Types Native Assembler Cross Assembler General Instruction Syntax Instruction Examples Assembler Functions Syntax checking Offset calculation Encoding to machine code
9
Example Program Hardware
10
Source Code File.186;use 80186 instructions SWITCHESequ1234h;define symbols LEDSequ5678h assumecs:code;establish CS addressability codesegment;start of code segment main:movdx, SWITCHES;load switch port address inal, dx;read switches notal;switch off turns LED on movdx, LEDS;load LED port address outdx, al;write to LED port jmpmain;and repeat indefinitely codeends;end of code segment endmain;code entry point is at main
11
Assembler Listing File (page 1) Turbo Assembler Version 4.1 09/12/01 08:49:11 Page 1 week3.ASM 1.186 ;use 80186 instructions 2 3 =1234SWITCHES equ 1234h ;define symbols 4 =5678LEDS equ 5678h 5 6assume cs:code ;establish CS addressability 7 80000code segment ;start of code segment 9 100000 BA 1234main: mov dx, SWITCHES ;load switch port address 110003 ECin al, dx ;read switches 120004 F6 D0not al ;SW=1 --> LED on 130006 BA 5678mov dx, LEDS ;load LED port address 140009 EEout dx, al ;write to LED port 15000A EB F4jmp main ;and repeat indefinitely 16 17000Ccode ends ;end of code segment 18 19end main ;code entry point is at main
12
Assembler Listing File (page 2) Turbo Assembler Version 4.1 09/12/01 08:49:11 Page 2 Symbol Table Symbol Name Type Value ??DATE Text "09/12/01" ??FILENAME Text "week3 " ??TIME Text "08:49:11" ??VERSION Number 040A @CPU Text 0103H @CURSEG Text CODE @FILENAME Text WEEK3 @WORDSIZE Text 2 LEDS Number 5678 MAIN Near CODE:0000 SWITCHES Number 1234 Groups & Segments Bit Size Align Combine Class CODE 16 000C Para none
13
Code Generation Process
14
Intel Hex Record Format :020000021000EC :0C000000BA3412ECF6D0BA7856EEEBF4ED :00000001FF Record Mark Record Length Load Address or 0000 Record Type DataChecksumRecord Description :020000021000ECExtended address record :0C000000BA3412ECF6D0BA78 56EEEBF4 EDData record :02000001FFEnd-of-file record BA3412(mov dx, 1234h)EC(in al, dx)F6D0(not al) BA7856(mov dx, 5678h)EE(out dx, al)EBF4(jmp –12) Disassembling the data record payload.
15
Borland Development Tools
16
Debugger Primer So, why is it called a bug, anyway? Terminology Typical Debugger Operation Debugging Tools Software Hardware Comparison of Debugging Tools
17
Paradigm C++ Demonstration Paradigm C++ (PCPP) is used in ECE 315 PCPP is an integrated development environment (IDE) Code generation Debugging Code Development Tips Use structured programming methods / no spaghetti code. Use descriptive symbols and names. Write comments as you go. When fixing assembler errors, fix only the top one or two and re-assemble – a lot of the later errors may be due to the first few. When debugging, verify what the registers are loaded with as compared to what you think they should be loaded with.
18
Instruction Decoding Exercise The following memory dump was obtained from an 80C188EB-based system CS:0013 is a valid instruction Decode the memory data to determine the instructions that were assembled to produce it. CS:0013 B0 12 BA 34 12 FE C7 EB F7
19
Instruction Decoding Solution 16000A B0 12 Target:mov al, 12h 17000C BA 1234mov dx, 1234h 18000F FE C7inc bh 190011 EB F7jmp Target
20
Wrapping Up Homework #2 due Friday 9/28
21
80C188EB Instruction Encoding Byte 1Byte 2Byte 3Byte 4Byte 5Byte 6 LOW DISP/DATA HIGH DISP/DATA LOW DATAHIGH DATA OPCODEDWMODREGR/M Register operand/registers to use in EA calculation Register operand/extension of opcode Register mode/memory mode with displacement length Word/byte operation Direction is to register/direction is from register Operation (instruction) code [opcode]
22
JMP Instruction Encoding
23
INC Instruction Encoding
24
Debugging Tools
25
Disjoint Segments 00000h FFFFFh CS DS SS
26
Overlapping Segments CS DS SS 00000h FFFFFh
27
Identical Segments CS DS SS 00000h FFFFFh
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.