Example 21H/42H: handle = open("c:\\abc.txt",O_RDONLY);

Slides:



Advertisements
Similar presentations
Computer Programming Spring-2007
Advertisements

Recursive Descent Technique CMSC 331. UMBC 2 The Header /* This program matches the following A -> B { '|' B } B -> C { '&' C } C -> D { '^' D } D ->
Hello World!. PC / MS-DOS code segment para assume cs:code,ds:code org 0100h start: mov dx,offset message ;point to message mov ah,09h ;func# to printstring.
Lecture # 12. PIC Printer Interface Printer IRQ7 INT ACK Printer Interface.
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.
C Characters & Strings Character Review Character Handling Library Initialization String Conversion Functions String Handling Library Standard Input/Output.
1 Chapter 10 Strings and Pointers. 2 Introduction  String Constant  Example: printf(“Hello”); “Hello” : a string constant oA string constant is a series.
What is a pointer? First of all, it is a variable, just like other variables you studied So it has type, storage etc. Difference: it can only store the.
 2000 Prentice Hall, Inc. All rights reserved Fundamentals of Strings and Characters String declarations –Declare as a character array or a variable.
Sort the given string, without using string handling functions.
Lecture # 21 Chapter 6 Uptill 6.4. Type System A type system is a collection of rules for assigning type expressions to the various parts of the program.
Union, bitfield, typedef, enum union nama_u{ }; union nama_u{ struct nama_s byte; }; enum{ }; Tipedef var BYTE.
By Senem Kumova Metin 1 POINTERS + ARRAYS + STRINGS REVIEW.
Flow Diagram: Push flags, CS, IP Pop IP,CS,flags Push AX,BX,CX,DX,ES,DS,SI,DI,BP POP BP,DI,SI,DS,ES,DX,CX,BX,AX.
BY Kamran Yousaf Application of Computer Graphics and Animation Using C++ Language.
© Copyright 1992–2004 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved Fundamentals of Strings and Characters Characters.
Character Input and Output C and Data Structures Baojian Hua
C Language Summary HTML version. I/O Data Types Expressions Functions Loops and Decisions Preprocessor Statements.
Tutorial #8 Summer strings #include int main() { char str1[] = {‘h’,’e’,’l’,’l’,’o’}; char str[] = {‘h’,’e’,’l’,’l’,’o’,’\0’}; char p[] = ”hello”;
Pointers Example Use int main() { int *x; int y; int z; y = 10; x = &y; y = 11; *x = 12; z = 15; x = &z; *x = 5; z = 8; printf(“%d %d %d\n”, *x, y, z);
Arrays and Pointers in C Alan L. Cox
POSIX: Files Introduction to Operating Systems: Discussion 1 Read Solaris System Interface Guide: Ch. 5.1 Basic File I/O.
Recursion Examples Fundamentals of CS Case 1: Code /* Recursion: Case 1 */ #include void count (int index); main () { count (0); getchar(); } void count.
Another Example: #include<BIOS.H> #include<DOS.H>
Offset Length Description 0 2 An INT 20h instruction is stored here 2 2 Program ending address 4 1 Unused, reserved by DOS 5 5 Call to DOS function.
ECE 103 Engineering Programming Chapter 53 Generic Algorithms Herbert G. Mayer, PSU CS Status 6/4/2014 Initial content copied verbatim from ECE 103 material.
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:
In Class Program Write, assemble and test a program: –Use the DB directive to define the following list of numbers and name it array: 31h, 32h, 33h, 34h.
CSE 332: C++ template examples Today: Using Class and Function Templates Two examples –Function template for printing different types –Class template for.
1 Advanced Programming Examples Output. Show the exact output produced by the following code segment. char[,] pic = new char[6,6]; for (int i = 0; i
ROM BIOS Chapter 9. The ROM BIOS PC computer come with a set od built in routines collectively called the ROM BIOS. These routines are permanent part.
Print Row Function void PrintRow(float x[ ][4],int i) { int j; for(j=0;j
 Memory setup  Pointer declaration  Address operator  Indirection  Printing addresses or pointers.
BIOS and DOS Interrupts Basic Input /Outpu System Disk Operating System.
Int fact (int n) { If (n == 0) return 1; else return n * fact (n – 1); } 5 void main () { Int Sum; : Sum = fact (5); : } Factorial Program Using Recursion.
Sudeshna Sarkar, IIT Kharagpur 1 Programming and Data Structure Sudeshna Sarkar Lecture 3.
Direct-Access Color Graphics Chapter 11. Graphics modes C++ provides a different combination of graphics characteristics. These characteristics include.
Lecture 26.
Lecture 7 Interrupt ,Trap and System Call
7-Nov Fall 2001: copyright ©T. Pearce, D. Hutchinson, L. Marshall Oct lecture23-24-hll-interrupts 1 High Level Language vs. Assembly.
Prepared by Andrew Jung. Accessing Pointer Data Pointer can be used to access the contents of an array Look at the following syntax: /* Declaration and.
Lecture 15. Modem Controller Register 4310 DTR 0 = Polling Operator 1 = Interrupts Enabled RTS 1 =Self Test 0 =Normal.
#include <dos. h> void interrupt(
Ex-1 #include <stdio.h> struct sample { int a=0; char b='A';
Interrupts and Interrupts Handling
User Interaction and Variables
1st prog! Q: Read a char – from a keyboard & display it at the beginning of the next line! ====== A.
Microprocessor and Assembly Language
LESSON 3 IO, Variables and Operators
CSCI206 - Computer Organization & Programming
Clear1 and Clear2 clear1(int array[], int size) { int i; for (i = 0; i < size; i += 1) array[i] = 0; } clear2(int *array, int size) {
Tejalal Choudhary “C Programming from Scratch” Pointers
Lecture 22.
Introduction to Programming and the C Language
توابع ورودي-خروجي.
Interrupt Mechanism Interrupt Compared With Procedures Call MyProc
Array & Pointers CSCE 121 J. Michael Moore.
Lecture 10.
Lecture 16.
unsigned char far *scr=0xb ;
Lecture 19.
Lecture # 11.
C Security Pre Function
POINTER CONCEPT 4/15/2019.
Week 9 – Lesson 2 Input & Output of Character Strings
EECE.2160 ECE Application Programming
ETE 132 Lecture 8 By Munirul Haque.
Microprocessor and Assembly Language
POINTER CONCEPT 8/3/2019.
Computer Architecture and System Programming Laboratory
Presentation transcript:

Example 21H/42H: handle = open("c:\\abc.txt",O_RDONLY); regs.x.bx = handle; regs.h.ah = 0x42; regs.h.al = 0x01; regs.x.cx = 0; regs.x.dx = 0; int86(0x21,&regs,&regs); *((int*)(&size)) = regs.x.ax; *(((int*)(&size))+1) =regs.x.dx; Printf ("Size is %d“ ,size); } #include<stdio.h> #include<fcntl.h> #include<io.h> #include<BIOS.H> #include<DOS.H> unsigned int handle; void main() { REGS regs; unsigned long int size;

Entry On Exit Example: BIOS Services Int # 10H Service # 01H AH = 01 CH = Beginning Scan Line CL = Ending Scan Line On Exit Unchanged

Example: void main() { char st[80]; union REGS regs; regs.h.ah = 0x01; regs.h.ch = 0x01; regs.h.cl = 0x00; int86(0x21,&regs,&regs); gets(st); }

Use of ISR’s for Library Function Writing ISR’s INT 65H

Getting Interrupt Vector: Offset Segment far Intproc

Integer Pointer: int j; int *p; j = 25; p = 2000; *p = 50;

Function Pointer: void myfunc() { } void (*funcptr) ( ) funcptr = myfunc; (*funcptr) ( ); myfunc();

void interrupt (*intptr) ( ) intptr = getvect (0x08); (*intptr) ( ); Interrupt Pointer: void interrupt (*intptr) ( ) intptr = getvect (0x08); (*intptr) ( );

Setting Interrupt Vector: Offset Segment far Intproc

void interrupt newint ( ) { Interrupt Pointer: void interrupt newint ( ) { } setvect(0x08, newint);

.C Program: void interrupt *oldint65( ); char st[80] = {“Hello World$”}; void interrupt newint65(void); void main() { oldint65 = getvect(0x65); setvect(0x65, newint65); geninterrupt (0x65); setvect(0x65, oldint65); } void interrupt newint65( ) { _AH = 0x09; _DX=(unsigned int)st; geninterrupt (0x21); }

Keep: Keep (0,100); Keep (return code, no. of parse);

TSR Programs: #include<BIOS.H> #include<DOS.H> char st[80] ={"Hello World$"}; void interrupt (*oldint65)( ); void interrupt newint65( ); void main() { oldint65 = getvect(0x65); setvect(0x65, newint65); keep(0, 1000); } void interrupt newint65( ) { _AH = 0x09; _DX=(unsigned int)st; geninterrupt (0x21); }

#include<BIOS.H> #include<DOS.H> void main() { TSR Programs: #include<BIOS.H> #include<DOS.H> void main() { geninterrupt (0x65); }