Lecture (09) x86 programming 8

Similar documents
Fundamentals of Programming (C)

Experiment 3. TITLE Optional: Write here the Title of your program.model SMALL This directive defines the memory model used in the program.

Data Representation and Binary Arithmetic. Lecture 2

PureScan - ML1. Configuration Guide. Wireless Linear Imager Wireless Laser scanner - 1 -

CS/ECE 252: INTRODUCTION TO COMPUTER ENGINEERING UNIVERSITY OF WISCONSIN MADISON

CS/ECE 252: INTRODUCTION TO COMPUTER ENGINEERING UNIVERSITY OF WISCONSIN MADISON

1.1. INTRODUCTION 1.2. NUMBER SYSTEMS

Connecting UniOP to Datalogic Barcode Readers

Chapter 8. Characters and Strings

CS341 *** TURN OFF ALL CELLPHONES *** Practice NAME

Fundamentals of Programming

Binary Numbers. The Basics. Base 10 Number. What is a Number? = Binary Number Example. Binary Number Example

Table of Contents Sleep Settings How to Configure the Scanner. 7 Chapter 2 System Setup

2D BARCODE SCANNER CA-SC-20200B

EXPERIMENT 8: Introduction to Universal Serial Asynchronous Receive Transmit (USART)

Bits and Bytes. Data Representation. A binary digit or bit has a value of either 0 or 1; these are the values we can store in hardware devices.

Chapter 2 Bits, Data Types, and Operations

CPS 104 Computer Organization and Programming Lecture-2 : Data representations,

ASSIGNMENT 5 TIPS AND TRICKS

EXPERIMENT 7: Introduction to Universal Serial Asynchronous Receive Transmit (USART)

5/17/2009. Digitizing Discrete Information. Ordering Symbols. Analog vs. Digital

Chapter 2 Bits, Data Types, and Operations

Positional Number System

The Binary Number System

CS/ECE 252: INTRODUCTION TO COMPUTER ENGINEERING COMPUTER SCIENCES DEPARTMENT UNIVERSITY OF WISCONSIN-MADISON

Introduction to Decision Structures. Boolean & If Statements. Different Types of Decisions. Boolean Logic. Relational Operators

Oberon Data Types. Matteo Corti. December 5, 2001

Experiment #5. Using BIOS Services and DOS functions Part 1: Text-based Graphics

S-Series Sensor ASCII Protocol v8.1.0

Chapter 3. Information Representation

Chapter 2 Bits, Data Types, and Operations

Fundamental Data Types

Number System (Different Ways To Say How Many) Fall 2016

Chapter 2 Number System

Universal Asynchronous Receiver Transmitter Communication

User s Manual. Xi3000 Scanner. Table of Contents

Number Representations

PD1100 STAND-ALONE PROGRAMMING & USER S GUIDE. use the freedom

Hardware. ( Not so hard really )

Serial Communication. Transmit. Receive To EECC250 - Shaaban. From Universal Asynchronous Receiver/Transmitter (UART) Parity Bit

CSE-1520R Test #1. The exam is closed book, closed notes, and no aids such as calculators, cellphones, etc.

DATA REPRESENTATION. Data Types. Complements. Fixed Point Representations. Floating Point Representations. Other Binary Codes. Error Detection Codes

NC-1200 BARCODE SCANNER. Configuration Guide - 1 -

MOBILE THERMAL PRINTER

CSE-1520R Test #1. The exam is closed book, closed notes, and no aids such as calculators, cellphones, etc.

2a. Codes and number systems (continued) How to get the binary representation of an integer: special case of application of the inverse Horner scheme

BARCODE SCANNER. Configuration Guide - 1 -

Do not start the test until instructed to do so!

Addmaster Corporation

Start Configuration. Chap.1 System Information. Set All default

CMSC 313 Lecture 03 Multiple-byte data big-endian vs little-endian sign extension Multiplication and division Floating point formats Character Codes

Chapter 1. Hardware. Introduction to Computers and Programming. Chapter 1.2

Do not start the test until instructed to do so!

Chapter 2 Bits, Data Types, and Operations

4/14/2015. Architecture of the World Wide Web. During this session we will discuss: Structure of the World Wide Web

Unit 3, Lesson 2 Data Types, Arithmetic,Variables, Input, Constants, & Library Functions. Mr. Dave Clausen La Cañada High School

Configuration Manual PULSAR C CCD SCANNER. Table of Contents

Xi2000-BT Series Configuration Guide

Laser Barcode Scanner ARP Nr User s Manual

Numbers and Computers. Debdeep Mukhopadhyay Assistant Professor Dept of Computer Sc and Engg IIT Madras

CS/ECE 252: INTRODUCTION TO COMPUTER ENGINEERING UNIVERSITY OF WISCONSIN MADISON

Number Systems II MA1S1. Tristan McLoughlin. November 30, 2013

BARCODE SCANNER. FUZZYSCAN FAMILY Quick Start Guide

CMSC 313 COMPUTER ORGANIZATION & ASSEMBLY LANGUAGE PROGRAMMING LECTURE 02, FALL 2012

APPENDIX B. ASSEMBLER DIRECTIVE SUMMARY

TSP552 TSP552II TSP2000

Do not start the test until instructed to do so!

Variables and data types

Introduction. Chapter 1. Hardware. Introduction. Creators of Software. Hardware. Introduction to Computers and Programming (Fall 2015, CSUS)

DLL2020. Software Configuration Manual

EE 109 Unit 3. Analog vs. Digital. Analog vs. Digital. Binary Representation Systems ANALOG VS. DIGITAL

Unit 3. Analog vs. Digital. Analog vs. Digital ANALOG VS. DIGITAL. Binary Representation

n NOPn Unary no operation trap U aaa NOP Nonunary no operation trap i

PS232. RS-232 to PS/2 Keyboard Port Adapter Part # SA0009 (Version 4.0) Copyright 2003 L3 Systems, Inc. Redmond

Chapter 2 Bits, Data Types, and Operations

Number Systems Base r

Under the Hood: Data Representation. Computer Science 104 Lecture 2

Data Representa5on. CSC 2400: Computer Systems. What kinds of data do we need to represent?

Data Representa5on. CSC 2400: Computer Systems. What kinds of data do we need to represent?

RS-422 Code-Operated Switches

plc numbers Encoded values; BCD and ASCII Error detection; parity, gray code and checksums

Number Systems for Computers. Outline of Introduction. Binary, Octal and Hexadecimal numbers. Issues for Binary Representation of Numbers

^BC Code 128 Bar Code (Subsets A, B, and C)

Pins 2, 3 - Baud rate select - Selects the baud rate for the serial transmission.

FD-011WU. 2D Barcode Reader User Guide V1.6CC

1. Character/String Data, Expressions & Intrinsic Functions. Numeric Representation of Non-numeric Values. (CHARACTER Data Type), Part 1

o Echo the input directly to the output o Put all lower-case letters in upper case o Put the first letter of each word in upper case

EXPERIMENT NINE DEVELOPING MACRO SEQUENCES

Flow chart of bar code reader setting

Midterm Exam, Fall 2015 Date: October 29th, 2015

EE 109 Unit 2. Analog vs. Digital. Analog vs. Digital. Binary Representation Systems ANALOG VS. DIGITAL

marson MT8200S 2D Handheld Scanner User Manual V / 6 / 25 - I -

Serial I/O. 4: Serial I/O. CET360 Microprocessor Engineering. J. Sumey

QTERM-J10/N15 USER'S MANUAL REVISION 13

Source coding and compression

3.1. Unit 3. Binary Representation

First Data U.S. Debit Test Card Set. Version 1.20

RS-232 Control of the Advantage EQ281/8, EQ282/8 and Advantage SMS200

CPSC 213. Introduction to Computer Systems. Procedures and the Stack. Unit 1e

PD1100 PASS-THROUGH PROGRAMMING & USER S GUIDE. use the freedom

Transcription:

Lecture (09) x86 programming 8 By: Dr. Ahmed ElShafee 1 Basic Input Output System BIOS BIOS refers to a set of procedures or functions that enable the programmer have access to the hardware of the computer. A BIOS function is invoked using the instruction. The actual function is specified by the contents of AH. ROM BIOS refers to BIOS procedures that are stored in a ROM placed on the motherboard. Some typical ROM BIOS are: 10H Video Driver 13H Disk Driver 14H Serial Port Driver 16H Keyboard Driver DOS BIOS refers to BIOS that are loaded from a disk after the computer is booted up. Most DOS BIOS are invoked using the 2 instruction.

Character Input from keyboard with Echo: Function 01H: Call With: AH = 01H Returns: AL = ASCII character pressed. Note: If AL is zero, then a function key is pressed. Example: The following macro reads a one digit number from the keyboard and returns the corresponding binary value in AL. AH,01 ;Specify function 01 ;Call DOS BIOS 3 Display Character on Standard Output Device Function 02H: Call With: AH = 02H DL = ASCII code of character to be displayed Returns: AL = ASCII code of character displayed Note: Standard output device is normally the monitor. Example: The following macro displays a one digit number on the screen. The number is passed in DL as a binary number. 4 add DL,30H ;Convert from binary to ASCII AH,02 ;Specify function 02 ;Call DOS BIOS

Display a Character String Function 09H: 5 Call With: AH = 09H DS:DX = Segment:Offset address of the string. Returns: All registers unchanged. Note: Displays a character string up to the first occurrence of the dollar sign "$". Example: The following macro displays the character string MSG on the screen. DMSG MSG DX, Offset MSG ;Point to MSG AH,09 ;Specify function 09 ;Call DOS BIOS DMSG Buffered Keyboard Input Function 0AH: 6 Call With: AH = 0AH DS:DX = Segment:Offset address of the buffer The first byte in the buffer should be loaded with the size of the buffer, i.e. the maximum numberof characters to be input. Returns: All registers unchanged. The second byte in the buffer is equal to the number of characters entered. The characters entered are stored in the buffer starting from the third byte. Note: The functions ends if the user has typed in a number of characters equal to the first value in the buffer, or if the user has pressed the Enter key.

The following procedure prompts the user to type in a text up to 30 characters long. The text entered is stored in the buffer BUF1. The procedure uses the DSPM macro of the previous example. 7 ORG 100H MSG1 DB Type in a text up to 30 characters long, 0AH, 0DH, $ BUF1 DB 30, 00, 30 DUP(?) MAIN PROC NEAR DSPM MSG1 ;Display MSG1 DX, Offset BUF1 ;Point to BUF1 AH,0AH ;Specify function 0A ;Call DOS BIOS RET MAIN ENDP Example 01 ORG 100H jmp MAIN MSG1 DB "Type in a text up to 30 characters long", 0AH, 0DH,'$' BUF1 DB 30, 00, 30 DUP(?) MSG2 DB "press any key to continue,..$" ADD DL,30H AH,02 DMSG DMSG MSG DX, Offset MSG AH,09 AH,01 8

MAIN PROC NEAR DMSG MSG1 DX, Offset BUF1 AH,0AH DMSG MSG2 RET MAIN ENDP 9 10

11 Example 02 ORG 100H jmp MAIN MSG1 DB "Type in a text up to 30 characters long", 0AH, 0DH,'$' BUF1 DB 30, 00, 30 DUP(?) MSG2 DB "press any key to continue,..$" DMSG MSG DX, Offset MSG AH,09 ADD DL,30H AH,02 DMSG AH,01 12

GET2 GET2 BUF DX, Offset BUF AH,0AH MAIN PROC NEAR DMSG MSG1 GET2 BUF1 DMSG MSG2 RET MAIN ENDP 13 ASCII Codes ASCII code is a standard 8-bit binary code for alphanumeric characters. It defines: a group of control characters (00H to 20H and 7FH for Delete) a group of printable characters ( to 7EH) a group of special graphics or multilingual characters (80H to FFH) ASCII Control Characters 00 NUL 01 SOH 02 STX 03 ETX 04 EOT 05 ENQ 06 ACK 07 BEL 08 BS 09 HT 0A LF 0B VT 0C FF 0D CR 0E SO 0F SI 10 DLE 11 DC1 12 DC2 13 DC3 14 DC4 15 NAK 16 SYN 17 ETB 18 CAN 19 EM 1A SUB 1B ESC 1C FS 1D GS 1E RS 1F US 14 BIOS

ASCII Codes - Printable Characters 20 Space 21! 22 23 # 24 $ 25 % 26 & 27 28 ( 29 ) 2A * 2B + 2C, 2D - 2E. 2F / 30 0 31 1 32 2 33 3 34 4 35 5 36 6 37 7 38 8 39 9 3A : 3B ; 3C < 3D = 3E > 3F? 40 @ 41 A 42 B 43 C 44 D 45 E 46 F 47 G 48 H 49 I 4A J 4B K 4C L 4D M 4E N 4F O 50 P 51 Q 52 R 53 S 54 T 55 U 56 V 57 W 58 X 59 Y 5A Z 5B [ 5C \ 5D ] 5E ^ 5F _ 60 ` 61 a 62 b 63 c 64 d 65 e 66 f 67 g 68 h 69 i 6A j 6B k 6C l 6D m 6E n 6F o 70 p 71 q 72 r 73 s 74 t 75 u 76 v 77 w 78 x 79 y 7A z 7B { 7C 7D } 7E ~ 7F Del 15 BIOS Thanks,.. 16