Important Irvine Library Procedures Randomize Randomize –Initializes the seed of the random-number formula by both the Random32 and the RandomRange procedures.

Slides:



Advertisements
Similar presentations
RAPTOR Syntax and Semantics By Lt Col Schorsch
Advertisements

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.
Chapter 2 Programming by Example. A Holistic Perspective Three sections separated by blank lines. Program comment File: FileName.java
The Binary Numbering Systems
Assembly Language for Intel-Based Computers Chapter 15: BIOS-Level Programming (c) Pearson Education, All rights reserved. You may modify and.
Chapter 3 Simple Graphics. Side Effects and Haskell  All the programs we have seen so far have no “side-effects.” That is, programs are executed only.
Bellevue University CIS 205: Introduction to Programming Using C++ Lecture 3: Primitive Data Types.
Runtime Stack Managed by the CPU, using two registers
Assembly Language for Intel-Based Computers, 4 th Edition Chapter 5: Procedures (c) Pearson Education, All rights reserved. You may modify and copy.
Connecting with Computer Science, 2e
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.
Kip Irvine: Assembly Language for Intel-Based Computers
Assembly Language for Intel-Based Computers, 4 th Edition Chapter 5: Procedures (c) Pearson Education, All rights reserved. You may modify and copy.
CS2422 Assembly Language & System Programming October 24, 2006.
Irvine, Kip R. Assembly Language For Intel-Based Computers XADD Instruction.code mov ax,1000h mov bx,2000h ; AX = 1000h, BX = 2000h xadd ax,bx ; AX = 3000h,
Coding.
ANSI command-sequences A look at some terminal emulation features utilized in the “console- redirection” mechanism.
BR 6/001 Ways to Handle I/O (Input/Ouput) For Output –Use Irvine16 Functions Writechar, WriteBin, WriteInt, Writehex, Writestring –Use DOS (Int 21h) Functions.
Connecting with Computer Science 2 Objectives Learn why numbering systems are important to understand Refresh your knowledge of powers of numbers Learn.
Basic Input - Output. Output functions  printf() – is a library function that displays information on-screen. The statement can display a simple text.
Assembly Language for Intel-Based Computers, 5 th Edition Chapter 15: BIOS-Level Programming (c) Pearson Education, All rights reserved. You.
Addison Wesley is an imprint of © 2010 Pearson Addison-Wesley. All rights reserved. Chapter 3 Variables, Calculations, and Colors Starting Out with Games.
ORG ; FOUR INT 21H and INT 10H Programming and Macros Dec Hex Bin
Chapter Nine Advanced Shell Scripting1 System Programming Advanced Shell Scripting.
Chapter 4 The If…Then Statement
Introduction to Python
Objective Understand concepts used to create digital graphics. Course Weight : 15% Part Three : Concepts of Digital Graphics.
Lesson 13 – Color and Typography. 2 Objectives Discuss basic color theory. Understand the color wheel. Understand how color is presented on a computer.
ECE291 Computer Engineering II Lecture 9 Josh Potts University of Illinois at Urbana- Champaign.
Copyright © 2012 Pearson Education, Inc. Publishing as Pearson Addison-Wesley C H A P T E R 6 Value- Returning Functions and Modules.
Assembly Language for x86 Processors 6th Edition
Pascal Programming Strings, Arithmetic operators and output formatting National Certificate – Unit 4 Carl Smith.
1 Screen and Keyboard Operations Suthida Chaichomchuen
© Copyright 1992–2005 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. Tutorial 5 – Dental Payment Application: Introducing.
Functions available for Writing to the Video Display Three different ways to write to the display –Irvine library functions –DOS Video Functions (Interrupt.
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?
1 Workshop Topics - Outline Workshop 1 - Introduction Workshop 2 - module instantiation Workshop 3 - Lexical conventions Workshop 4 - Value Logic System.
Assembly Language for Intel-Based Computers, 6th Edition Chapter 5: Procedures (c) Pearson Education, All rights reserved. You may modify and copy.
File I/O MS-DOS Interrupt 21h has many functions dealing with file and directory I/O services. Both MS-DOS and MS_Windows use 16- bit integers called HANDLES.
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.
ASSEMBLY LANGUAGE FOR INTEL-BASED COMPUTERS, PROCEDURES.
Video systems. Lesson plan Review the code for the previous exercise Video systems Review for midterm exam.
Algorithms Writing instructions in the order they should execute.
3 Types of Video Output for Text DOS-level INT (Int 21) Output can be easily redirected to other devices (printer, disk) Slow Speed Cannot control the.
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:
Assembly Language for Intel-Based Computers, 5 th Edition Chapter 10: Structures and Macros (c) Pearson Education, All rights reserved. You.
Introduction to Python Dr. José M. Reyes Álamo. 2 Three Rules of Programming Rule 1: Think before you program Rule 2: A program is a human-readable set.
Assembly Language for Intel-Based Computers, 4 th Edition Chapter 5: Procedures Lecture 18 Linking to External Library The Book’s Link Library Stack Operations.
PART TWO Electronic Color & RGB values 1. Electronic Color Computer Monitors: Use light in 3 colors to create images on the screen Monitors use RED, GREEN,
Controlling Program Flow with Decision Structures.
Irvine, Kip R. Assembly Language for x86 Processors 7/e, What's Next Linking to an External Library The Book's Link Library Stack Operations Defining.
Chapter Six. Exercises Clear the screen Write a procedure to show a symbol at (dl, dh). AL stores the symbol. Write a procedure to control a character.
Lecture 11 Text mode video
Lesson 13 – Color and Typography. 2 Objectives Understand basic color theory. Understand the color wheel. Understand how color is presented on a computer.
OPERATORS IN C CHAPTER 3. Expressions can be built up from literals, variables and operators. The operators define how the variables and literals in the.
Some of the utilities associated with the development of programs. These program development tools allow users to write and construct programs that the.
Chapter 5: Procedures.
Chapter 2 Introduction to C++ Programming
9/17/2018 Kiến Trúc Máy Tính.
Microprocessor and Assembly Language
Chapter 3 Variables, Calculations, and Colors
INPUT & OUTPUT scanf & printf.
Introduction to C++ Programming
تهیه و تنظیم: فاطمه قاسمی دانشگاه صنعتی شریف – پاییز 86
Libraries and Procedures
CSc 110, Spring 2018 Lecture 9: Parameters, Graphics and Random
Assembly Language for Intel-Based Computers, 4th Edition
Two ways to discuss color 1) Addition 2) Subtraction
What Color is it?.
More on operators and procedures in the Linked
Presentation transcript:

Important Irvine Library Procedures Randomize Randomize –Initializes the seed of the random-number formula by both the Random32 and the RandomRange procedures. –The seed equals the time of day, accurate to 1/100 th of a second. –Only call it once at the beginning of a program –This ensures that each time you run a program, the starting random integer will be different, and any sequence of random integers will also be unique.

RandomRange Produces a random integer within the range of 0 to (n-1) Produces a random integer within the range of 0 to (n-1) N is passed in the EAX register. N is passed in the EAX register. The random integer is returned in EAX. The random integer is returned in EAX.

How to choose a random number between 0 and 4999.data RandvalDWORD?.code Call Randomize Moveax, 5000 CallRandomRange Movrandval, eax

SetTextColor Sets the current foreground and background colors for text output. The color constants are predefined and can be used for both the foreground and background. Sets the current foreground and background colors for text output. The color constants are predefined and can be used for both the foreground and background. black = 0 red = 4 gray = 8 lightRed = 12 blue = 1 magenta = 5 lightBlue = 9 lightMagenta = 13 green = 2 brown = 6 lightGreen = 10 yellow = 14 cyan = 3 lightGray = 7 lightCyan = 11 white = 15

SetTextColor Not available in Irvine16.inc Not available in Irvine16.inc –(only Irvine32.inc) The background color must by multiplied by 16 before being added to the foreground color. The background color must by multiplied by 16 before being added to the foreground color. Example Example –Moveax, yellow + (blue * 16) –CallSetTextColor;yellow on blue

GoToXY Locates the cursor at a given row and column on the screen. Using a console screen, the x-coordinate range is 0-79, and the y-coordinate range is Locates the cursor at a given row and column on the screen. Using a console screen, the x-coordinate range is 0-79, and the y-coordinate range is Inputs: Inputs: –DH = Y-coordinate (row value) –DL = X-coordinate (column value)

ReadChar Reads a single character from standard input and returns the character in the AL register. The character is not echoed to the screen. Reads a single character from standard input and returns the character in the AL register. The character is not echoed to the screen.

Clrscr Clears the console and locates the cursor at the upper left corner. Clears the console and locates the cursor at the upper left corner.

Programming Assignment Programming Assignment 1) Draw Text Colors Write a program that clears the screen, generates and displays 50 random numbers (0-9), in 50 random colors (only use the 16 different colors available to you, but call the random number generator each time a number is generated). Use the Irvine library functions (Randomize, RandomRange, and SetTextColors) to generate and display the results. Wait for a keyboard input before exitting the program. You may use the library function (Readchar, ReadInt, or ReadString) to read the character. Write a program that clears the screen, generates and displays 50 random numbers (0-9), in 50 random colors (only use the 16 different colors available to you, but call the random number generator each time a number is generated). Use the Irvine library functions (Randomize, RandomRange, and SetTextColors) to generate and display the results. Wait for a keyboard input before exitting the program. You may use the library function (Readchar, ReadInt, or ReadString) to read the character.

Programming Assignment (cont) 2) In class, we discussed the evaluation of the expression (-3)*VALUE using only shifts, adds and subtracts. Will this same code work to evaluate the expression (+5)*VALUE? If not, create a program to implement this. Will this same code work to evaluate the expression (- 5)*VALUE? If not, add this to your program. Display on the screen a message allowing the user to input an 8-bit input(values between 0 and 255, evaluate each of the above expressions and display 16-bit results in binary, hex and in decimal. You do not have to provide error checking for the input data. You may use the Irvine library functions for I/O.

What to turn in for the Programming Assignment Structure Chart or detailed outline Structure Chart or detailed outline Listing File Listing File Executable on Diskette Executable on Diskette