TIn 1: Lecture 3: Lernziele. Lecture 3 The Belly of the Architect. Basic internal components of the 8086. Pointers and data storage in memory



Similar documents
Faculty of Engineering Student Number:

ida.com excellence in dependable automation

Operating System Overview. Otto J. Anshus

8. MACROS, Modules, and Mouse

Memory Systems. Static Random Access Memory (SRAM) Cell

Complete 8086 instruction set

SPICE auf der Überholspur. Vergleich von ISO (TR) und Automotive SPICE

Linux & Docker auf Azure

Let s put together a Manual Processor

ASSEMBLY PROGRAMMING ON A VIRTUAL COMPUTER

Exchange Synchronization AX 2012

Software / FileMaker / Plug-Ins Mailit 6 for FileMaker 10-13

Microsoft Certified IT Professional (MCITP) MCTS: Windows 7, Configuration ( )

Is Cloud relevant for SOA? Corsin Decurtins

COMPUTERS ORGANIZATION 2ND YEAR COMPUTE SCIENCE MANAGEMENT ENGINEERING JOSÉ GARCÍA RODRÍGUEZ JOSÉ ANTONIO SERRA PÉREZ

Developments in the Austrian Surveying Education

Die Versant-DB ist ein wesentlicher Bestandteil von CADISON.

BCD (ASCII) Arithmetic. Where and Why is BCD used? Packed BCD, ASCII, Unpacked BCD. BCD Adjustment Instructions AAA. Example

Embedded Software Development and Test in 2011 using a mini- HIL approach

Microsoft Nano Server «Tuva» Rinon Belegu

AnyWeb AG

Chapter 5 Instructor's Manual

Programming Interface. for. Bus Master IDE Controller. Revision 1.0

CSE 141L Computer Architecture Lab Fall Lecture 2

Welcome Unveiling the Results of the First Comprehensive Study on Structured Products in Switzerland

Elena Chiocchetti & Natascia Ralli (EURAC) Tanja Wissik & Vesna Lušicky (University of Vienna)

Lernsituation 9. Giving information on the phone. 62 Lernsituation 9 Giving information on the phone

Diese Liste wird präsentiert von. Netheweb.de

Computer System: User s View. Computer System Components: High Level View. Input. Output. Computer. Computer System: Motherboard Level

Computer Organization and Architecture

Lecture 7: Machine-Level Programming I: Basics Mohamed Zahran (aka Z)

Advanced Computer Architecture-CS501. Computer Systems Design and Architecture 2.1, 2.2, 3.2

Search Engines Chapter 2 Architecture Felix Naumann

MACHINE ARCHITECTURE & LANGUAGE

Effiziente Kundenbetreuung auch von unterwegs: SAP CRM Sales. Michael Wallenczus, SAP (Schweiz) AG 17. April 2012

How It All Works. Other M68000 Updates. Basic Control Signals. Basic Control Signals

Information Systems 2

Systems Design & Programming Data Movement Instructions. Intel Assembly

A: Ein ganz normaler Prozess B: Best Practices in BPMN 1.x. ITAB / IT Architekturbüro Rüdiger Molle März 2009

Keil C51 Cross Compiler

Rainer Stropek software architects gmbh. Entwicklung modularer Anwendungen mit C# und dem Managed Extensibility Framework (MEF)

Update to V10. Automic Support: Best Practices Josef Scharl. Please ask your questions here Event code 6262

EMC Greenplum. Big Data meets Big Integration. Wolfgang Disselhoff Sr. Technology Architect, Greenplum. André Münger Sr. Account Manager, Greenplum

Computer Architecture Lecture 2: Instruction Set Principles (Appendix A) Chih Wei Liu 劉 志 尉 National Chiao Tung University

Chapter 7D The Java Virtual Machine

Kapitel 2 Unternehmensarchitektur III

MICROPROCESSOR. Exclusive for IACE Students iacehyd.blogspot.in Ph: /422 Page 1

1Copyright 2013, Oracle and/or its affiliates. All rights reserved.

Return-oriented programming without returns

QAS DEBUG - User und Computer

Introduction to MIPS Assembly Programming

Produktfamilienentwicklung

SAP GLOBAL DIVERSITY POLICY

CPU performance monitoring using the Time-Stamp Counter register

Instruction Set Architecture

A Tiny Guide to Programming in 32-bit x86 Assembly Language

Upgrading Your Skills to MCSA Windows Server 2012 MOC 20417

(Refer Slide Time: 02:39)

Vergleich der Versionen von Kapitel 1 des EU-GMP-Leitfaden (Oktober 2012) 01 July November Januar 2013 Kommentar Maas & Peither

Testen mit Produktionsdaten Fluch oder Segen?

Application example AC500 Scalable PLC for Individual Automation Communication between AC500 and KNX network abb

Innovative network monitoring technologies for hydraulically not separated large zones

Dokumentation über die Übernahme von. "GS-R-3" (The Management System for Facilities and Activities) "Sicherheitskriterien für Kernkraftwerke"

Building a computer. Electronic Numerical Integrator and Computer (ENIAC)

HYPO TIROL BANK AG. EUR 5,750,000,000 Debt Issuance Programme (the "Programme")

Contents. What is Wirtschaftsmathematik?

Hacking Techniques & Intrusion Detection. Ali Al-Shemery arabnix [at] gmail

TBarCode.NET Barcodes in MS SQL Reporting Services

The x86 PC: Assembly Language, Design, and Interfacing 5 th Edition

Embedded Software development Process and Tools: Lesson-4 Linking and Locating Software

MICROPROCESSOR AND MICROCOMPUTER BASICS

How To Run A Server On A Linux Computer (For Free) On A Microsoft Server (For Linux) On An Ipad Or Ipad (For Microsoft) On Free Software (For Ubuntu) On Your Computer Or Ipa (

Certificate SAP INTEGRATION CERTIFICATION

How To Use A Computer With A Screen On It (For A Powerbook)

Voraussetzungen/ Prerequisites *for English see below*

PART B QUESTIONS AND ANSWERS UNIT I

Cloud Performance Group 1. Event. 14. Januar 2016 / Matthias Gessenay (matthias.gessenay@corporatesoftware.ch)

CPU Organisation and Operation

The programming language C. sws1 1

Stefan Engelberg (IDS Mannheim), Workshop Corpora in Lexical Research, Bucharest, Nov [Folie 1]

CS61: Systems Programing and Machine Organization

PROBLEMS #20,R0,R1 #$3A,R2,R4

Technical Properties. Mobile Operating Systems. Overview Concepts of Mobile. Functions Processes. Lecture 11. Memory Management.

Mit einem Auge auf den mathema/schen Horizont: Was der Lehrer braucht für die Zukun= seiner Schüler

An Introduction to Assembly Programming with the ARM 32-bit Processor Family

CHAPTER 1 ENGINEERING PROBLEM SOLVING. Copyright 2013 Pearson Education, Inc.

System Requirements Table of contents

CS 3530 Operating Systems. L02 OS Intro Part 1 Dr. Ken Hoganson

IA-64 Application Developer s Architecture Guide

IAC-BOX Network Integration. IAC-BOX Network Integration IACBOX.COM. Version English

How To Manage Build And Release With Tfs 2013

Last Class: OS and Computer Architecture. Last Class: OS and Computer Architecture

8086 Microprocessor (cont..)

8051 hardware summary

Where we are CS 4120 Introduction to Compilers Abstract Assembly Instruction selection mov e1 , e2 jmp e cmp e1 , e2 [jne je jgt ] l push e1 call e

Transcription:

Mitglied der Zürcher Fachhochschule TIn 1: Lecture 3 The Belly of the Architect. Lecture 3: Lernziele Basic internal components of the 8086 Pointers and data storage in memory

Architektur 8086 Besteht aus Bus Interface Unit und Execution Unit Execution Unit Register ALU Flags Control Unit Bus Interface Unit Segment Register / Instruction Pointer Control Unit Instruction Queue Instruction Pointer What isan Instruction Pointer? Q: What is a pointer? Something that caused your blue-screen Java 101 Passing values by reference Lets look at passing by reference in C

Passing by reference x = swap(a,b) How can you get the result of a swap operation? array[1] = a; array[2] = b; x = swap(address_of_array, index_1, index_2) Lets look at arrays! array[0] = H ; array[1] = e ; array[2] = l array = H e l x x x x Adressen [))))) [))))) [))))) LW EUHLWHV0HPRU\ LW EUHLWHV0HPRU\

Adressen 8-Bit Zugriff Adress-Zeiger = 0x000000 Data = 0x48 Adress-Zeiger = 0x000001 Data = 0x65 Adress-Zeiger = 0x000002 Data = 0x6c Adress-Zeiger = 0x000003 Data = 0x6c

16-Bit Zugriff Adress-Zeiger = 0x000000 Data = 0x6548 Adress-Zeiger = 0x000002 Data = 0x6c6c Adress-Zeiger = 0x000004 Data = 0x??6f Muss das so sein? 16-Bit Zugriff und Address Boundaries Adress-Zähler = 0x000001 Data = 0x6c65 [))))) [))))) Nachteil? 2 Buszugriffe nötig Optimierungsmöglichkeit durch variable Positionierung auf gleichen Speicher-Adressen. F I F

Endian Unterschiede 16-bit Variablen können unterschiedlich gespeichert werden Intel = Little Endian Architektur Fazit Ein Zeiger zeigt auf Informationen und kann inkrementiert werden um auf die nächste Information zu zeigen Ein Zeiger wird um 1 inkrementiert um den nächsten Byte zu lesen, um 2 um den nächsten Wort (16-bit) zu lesen um 4 um den nächsten Longword (32-bit) zu lesen etc. Es gibt, für 16-bit Werte, zwei Speicherungs Möglichkeiten, für 32-bit Werte wie viele? Ein Address Zeiger kennen wir jetzt und zwar den Instruktion- Pointer. Mit dieser lässt sich aber nur Kode und Konstanten lesen.

Passing by reference X = swap(address_of_a, address_of_b); instead of X= sway(address_of_array, offset_a, offset_b); Why the bit about arrays? Because the relationship between pointers and arrays is very tight. What next? We will look at pointers in Assembler Then we will look at memory addressing and segmentation Then we will look further at command abstraction.

Mitglied der Zürcher Fachhochschule TIn 1: Lecture 4 Geiz ist nicht Geil! Lecture 3: Lernziele How the 8086 actually accesses memory What segmentation means Moving data in and out of memory

Memory addressing Immediate AND AL, 050H Implizit POP AX Register Direkt AND AL, AH IN AL, 020H OR DX, Byte_Array Register Indirect XOR AX, [DX] Pointers A pointer = memory indirect XOR AX, [DX] The content of the address which is in DX is XOR ed with the contents of AX. So if AX = 05H and DX = 0001H what is in AX after the operation XOR AL, [DX]?

What next? Easy oder? Hmmm.. How big is the DX register? What isthe address range of the 8086? Does it fit? What next? I don t think so. To save costs Intel decided to reduce the complexity of the architecture by allowing only 16 bit addresses internally = 64K Since the hardware has a 1MB address range another register is needed to store the upper 4 bits of the address This makes the Intel architecture a joy to work with

Consequences Memory is segmented The programmer has to KNOW in which segment he is currently operating in. Why? Because if code = read-only and data is read-write then two different segments are needed for data and code. AND the programmer must know where in the segment he is operating. Why? Because you can t place arrays in memory that crosses a segment that cross a segment The programmer has to SWITCH between segments Consequences Where are the segments stored in the CPU? Picture: Abb. 7.5 How is the memory segmented? Picture: Abb. 7.8 How does the CPU translate between the segment registers and the address register to generate the physical address? Picture: Abb. 7.6 and Abb.7.7

Discussion Questions What happens if there are more segments than physical memory? How large can a programm be if the code segment and the data segment are the same? How large is the I/O address range? Mitglied der Zürcher Fachhochschule TIn 1: Back to memory

Remember when We said that every Java operation has a direct equivalent Assembler command? Path from Java Application to? Java C/C++ Assembler Machine Code Hardware &,, ^, ~ +, -, *, / &,, ^, ~ +, -, *, / AND, OR, XOR, NOT ADD, SUB, MUL, DIV 20H-25H, 08H-0DH, 30H-35H, 5FH 00H.15H Gates: and, or, xor, not Full/half adder, subtractor >>, >>>, << >>, << SHR, SAR, SHL, SAL Shift registers

Remember when We said that every Java operation has a direct equivalent Assembler command? And that the assembler provides a first layer of abstraction from machine code. But we also said that there is a JNZ command, which is dependent on what? Which means that Java provides an abstraction from this operation. What else? Suppose byte a = 02, b = 03, c= 0; c = a & b; Translates into AND AL, BL What step is missing? Initalising AL and BL Filling CL with the result

How does this code translate? Therefore byte a = 02, b = 03, c= 0; c = a & b; Translates into MOV AL, 02H MOV BL, 03H MOV CL, 00H AND AL, BL MOV CL, AL And what is missing? How does this code translate? Translates into MOV AL, 02H MOV BL, 03H MOV CL, 00H AND AL, BL MOV CL, AL And what can be optimised?

Exercise? Translate short a = 300; byte b = 05, c=0; c = a & b; What does the compiler do for us automatically? String Ausgabe V1.0 ; --- Define String Hello DB 048H, 065H, 06cH, 06cH, 06fH, ; --- Hello DB 020H, ; --- DB 057H, 06fH, 072H, 06cH, 064H, ; --- World DB 00H, 13H ; ----- Print Hello World Print_Hello_World: MOV DX, Hello Printline: MOV AL, [DX] CALL Character_Out INC CMP JNZ DX [DX], 00H Printline

Questions What is the difference between the string Hello World in Java and in Assembler? In which segment is Hello stored? In which segment does the processor presume that Hello is stored? Will the loop ever end?