9/17/2018 Kiến Trúc Máy Tính.

Slides:



Advertisements
Similar presentations
DOS and BIOS Interrupts DOS and BIOS interrupts are used to perform some very useful functions, such as displaying data to the monitor, reading data from.
Advertisements

ICS312 Set 6 Operands. Basic Operand Types (1) Register Operands. An operand that refers to a register. MOV AX, BX ; moves contents of register BX to.
ACOE2511 Assembly Language Arithmetic and Logic Instructions.
Computer Organization & Assembly Language
More about procedures and Video Processing. Lesson plan Review existing concepts More about procedures and boolean expression Video processing.
Video systems (continue). Practice Modify the program to get a string from a keyboard to display the input string on the middle of the screen with reverse.
Important Irvine Library Procedures Randomize Randomize –Initializes the seed of the random-number formula by both the Random32 and the RandomRange procedures.
Direct video practice and Keyboard Operations
Assembly Language for Intel-Based Computers Chapter 15: BIOS-Level Programming (c) Pearson Education, All rights reserved. You may modify and.
Chapter 7 Programming with DOS and BIOS Function Calls Objectives: The use of DOS and BIOS function call How to read the PC’s keyboard How to send text.
Flow Control Instructions
Kip Irvine: Assembly Language for Intel-Based Computers
Screen Display Module M15.2 Sections 9.5, 13.1, 13.2.
CEN 226: Computer Organization & Assembly Language :CSC 225 (Lec#6)
Assembly Programming Timothy C. Rice Jr., MIT. OUTLINE Basic Structure Exit to Dos Print Character Clear Screen Change BG & FG Color Set Curser Location.
Assembly Language for Intel-Based Computers, 5 th Edition Chapter 15: BIOS-Level Programming (c) Pearson Education, All rights reserved. You.
Lab 5 Part C Write to the screen a character string that uses a ‘$’ to indicate the end of the string. Do not write the ‘$’ to the screen. Use DOS Interrupt.
ORG ; FOUR INT 21H and INT 10H Programming and Macros Dec Hex Bin
ECE291 Computer Engineering II Lecture 9 Josh Potts University of Illinois at Urbana- Champaign.
Assembly Language for x86 Processors 6th Edition
PC-technology MASM and Inline Code in C. PC-Teknik © CAAK2 MASM and Inline Code in C Some things to think about –Which size has the register you use AX,
BIOS and DOS Programming in DOS INT 10 and 21H. Interrupts There are some extremely useful subroutines within BIOS or DOS that are available to the user.
1 Screen and Keyboard Operations Suthida Chaichomchuen
Chapter 3 Examining Computer Memory and Executing Instructions.
1 Chapter 5: Procedures and Interrupts Assembly Language for Intel-Based Computers, Kip R. Irvine 3rd edition 3/17/2000.
ICS312 Set 9 Logic & Shift Instructions. Logic & Shift Instructions Logic and Shift Instructions can be used to change the bit values in an operand. The.
Text-Mode Programming Question #1 What are the three levels of access to the video display when writing characters on the screen in text mode?
Lecture 4 Presented By Dr. Shazzad Hosain Asst. Prof. EECS, NSU.
Overview of Assembly Language Chapter 4 S. Dandamudi.
Arithmetic Flags and Instructions
Binary Number Output To display a number in binary format, a program looks at each bit in the number and sends the ASCII equivalent of a ‘1’ (31h) or a.
Video systems. Lesson plan Review the code for the previous exercise Video systems Review for midterm exam.
10H Interrupt. Option 0H – Sets video mode. Registers used: – AH = 0H – AL = Video Mode. 3H - CGA Color text of 80X25 7H - Monochrome text of 80X25 Ex:
String Instructions String instructions were designed to operate on large data structures. The SI and DI registers are used as pointers to the data structures.
4. Kernel and VGA ENGI 3655 Lab Sessions. Richard Khoury2 Textbook Readings  None.
LEA instruction The LEA instruction can be used to get the offset address of a variable Example ORG 100h MOV AL, VAR1 ; check value of VAR1 by moving it.
2/20/2016CAP 2211 Flow Control Instructions. 2/20/2016CAP 2212 Transfer of Control Flow control instructions are used to control the flow of a program.
Computer Organization & Assembly Language University of Sargodha, Lahore Campus Prepared by Ali Saeed.
Lecture 11 Text mode video
Computer and Information Sciences College / Computer Science Department CS 206 D Computer Organization and Assembly Language.
ECE291 Computer Engineering II Lecture 12 Josh Potts University of Illinois at Urbana- Champaign.
CS-401 Computer Architecture & Assembly Language Programming Lecture-16 Display Memory.
Computer Graphics Lecture 04 Point Taqdees A. Siddiqi
Additional Assembly Programming Concepts
Lecture 4 Control Flow Structures (LOOPS)
Assembly IA-32.
Assembly Language Programming Part 2
Calculator in assembly language
Microprocessor and Assembly Language
Defining Types of data expression Dn [name] expression Dn [name]
Symbolic Instruction and Addressing
Introduction to Assembly Language
8086 Registers Module M14.2 Sections 9.2, 10.1.
Microprocessor Lab CSL1543 0:0:2
Morgan Kaufmann Publishers Computer Organization and Assembly Language
Symbolic Instruction and Addressing
Shift & Rotate Instructions)
Microprocessor Lab CSL1543 0:0:2
Symbolic Instruction and Addressing
Programming Graphic LCD
Unit:08 Software Interrupts
Programming Graphic LCD
Programming Graphic LCD
X86 Assembly Review.
COMP2012H: OOP and DS (honors track)
High-level language structures
UNIT-II Assembly Language Programs Involving Logical
Chapter 6 –Symbolic Instruction and Addressing
By Nasser Halasa Assembly Language.
CS-401 Computer Architecture and Assembly Language Programming
Presentation transcript:

9/17/2018 Kiến Trúc Máy Tính

9/17/2018 Kiến Trúc Máy Tính

9/17/2018 Kiến Trúc Máy Tính

9/17/2018 Kiến Trúc Máy Tính

9/17/2018 Kiến Trúc Máy Tính

9/17/2018 Kiến Trúc Máy Tính

9/17/2018 Kiến Trúc Máy Tính

9/17/2018 Kiến Trúc Máy Tính

9/17/2018 Kiến Trúc Máy Tính

9/17/2018 Kiến Trúc Máy Tính

9/17/2018 Kiến Trúc Máy Tính

9/17/2018 Kiến Trúc Máy Tính

9/17/2018 Kiến Trúc Máy Tính

9/17/2018 Kiến Trúc Máy Tính

9/17/2018 Kiến Trúc Máy Tính

9/17/2018 Kiến Trúc Máy Tính

9/17/2018 Kiến Trúc Máy Tính

9/17/2018 Kiến Trúc Máy Tính

9/17/2018 Kiến Trúc Máy Tính

9/17/2018 Kiến Trúc Máy Tính

9/17/2018 Kiến Trúc Máy Tính

9/17/2018 Kiến Trúc Máy Tính

9/17/2018 Kiến Trúc Máy Tính

9/17/2018 Kiến Trúc Máy Tính

9/17/2018 Kiến Trúc Máy Tính

9/17/2018 Kiến Trúc Máy Tính

9/17/2018 Kiến Trúc Máy Tính

9/17/2018 Kiến Trúc Máy Tính

9/17/2018 Kiến Trúc Máy Tính

9/17/2018 Kiến Trúc Máy Tính

9/17/2018 Kiến Trúc Máy Tính

Ví dụ 1 include emu8086.inc ORG 100h PRINT 'Hello CDTH14A for Assemble!' GOTOXY 1, 15 PUTC 65 ; 65 - is an ASCII code for 'A' PUTC 'B' Putc 66 putc 'A' RET ; return to operating system. END ; directive to stop the compiler. 9/17/2018 Kiến Trúc Máy Tính

Ví dụ 2 name "vga" ; this program draws a tiny rectangle in vga mode. org 100h jmp code ; dimensions of the rectangle: ; width: 10 pixels ; height: 5 pixels w equ 100 h equ 50 ; 9/17/2018 Kiến Trúc Máy Tính

set video mode 13h - 320x200 code: mov ah, 0 mov al, 13h int 10h ; draw upper line: mov cx, 100+w ; column mov dx, 20 ; row mov al, 15 ; white u1: mov ah, 0ch ; put pixel dec cx cmp cx, 100 jae u1 ; draw bottom line: 9/17/2018 Kiến Trúc Máy Tính

mov cx, 100+w ; column mov dx, 20+h ; row mov al, 15 ; white u2: mov ah, 0ch ; put pixel int 10h dec cx cmp cx, 100 ja u2 ; draw left line: mov cx, 100 ; column u3: mov ah, 0ch ; put pixel dec dx cmp dx, 20 ja u3 9/17/2018 Kiến Trúc Máy Tính

; draw right line: mov cx, 100+w ; column mov dx, 20+h ; row mov al, 15 ; white u4: mov ah, 0ch ; put pixel int 10h dec dx cmp dx, 20 ja u4 9/17/2018 Kiến Trúc Máy Tính

; pause the screen for dos compatibility: ;wait for keypress mov ah,00 int 16h ; return to text mode: mov al,03 ;text mode 3 int 10h ret 9/17/2018 Kiến Trúc Máy Tính

Ví dụ 3 name "add-sub" org 100h mov al, 5 ; bin=00000101b mov bl, 10 ; hex=0ah or bin=00001010b ; 5 + 10 = 15 (decimal) or hex=0fh or bin=00001111b add bl, al ; 15 - 1 = 14 (decimal) or hex=0eh or bin=00001110b sub bl, 1 9/17/2018 Kiến Trúc Máy Tính

; print result in binary: mov cx, 8 print: mov ah, 2 ; print function ; print result in binary: mov cx, 8 print: mov ah, 2 ; print function. mov dl, '0' test bl, 10000000b ; test first bit. jz zero mov dl, '1' zero: int 21h shl bl, 1 loop print ; print binary suffix: mov dl, 'b' int 21h ; wait for any key press: mov ah, 0 int 16h ret 9/17/2018 Kiến Trúc Máy Tính

Ví dụ 4 9/17/2018 Kiến Trúc Máy Tính name "hi-world" ; this example prints out "hello world!" ; by writing directly to video memory. ; in vga memory: first byte is ascii character, byte that follows is character attribute. ; if you change the second byte, you can change the color of ; the character even after it is printed. ; character attribute is 8 bit value, ; high 4 bits set background color and low 4 bits set foreground color. ; hex bin color ; ; 0 0000 black ; 1 0001 blue ; 2 0010 green ; 3 0011 cyan ; 4 0100 red ; 5 0101 magenta ; 6 0110 brown ; 7 0111 light gray ; 8 1000 dark gray ; 9 1001 light blue ; a 1010 light green ; b 1011 light cyan ; c 1100 light red ; d 1101 light magenta ; e 1110 yellow ; f 1111 white 9/17/2018 Kiến Trúc Máy Tính

org 100h ; set video mode mov ax, 3 ; text mode 80x25, 16 colors, 8 pages (ah=0, al=3) int 10h ; do it! ; cancel blinking and enable all 16 colors: mov ax, 1003h mov bx, 0 int 10h ; set segment register: mov ax, 0b800h mov ds, ax 9/17/2018 Kiến Trúc Máy Tính

; print "hello world" ; first byte is ascii code, second byte is color code. mov [02h], 'S' mov [04h], 'a' mov [06h], 'i' mov [0ah], 'G' mov [0ch], 'o' mov [0eh], 'n' mov [12h], 'd' mov [14h], 'e' mov [16h], 'p' mov [1ah], 'l' mov [1ch], 'a' mov [1eh], 'm' 9/17/2018 Kiến Trúc Máy Tính

; color all characters: mov cx, 15 ; number of characters. mov di, 03h ; start from byte after 'h' c: mov [di], 11111100b ; light red(1100) on yellow(1110) add di, 2 ; skip over next ascii code in vga memory. loop c ; wait for any key press: mov ah, 0 int 16h ret 9/17/2018 Kiến Trúc Máy Tính

Thanks See you next Subjects 9/17/2018 Kiến Trúc Máy Tính