





Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
This lecture handout is for System Programming course. It was provided by Prof. Indubhushan Vijayabhas at Ambedkar University, Delhi. It includes: File, System, Include, Void, Main, Unsigned, Program, Address, Register, String, Source, Channel
Typology: Study notes
1 / 9
This page cannot be seen from the preview
Don't miss anything!






This program attempts to perform memory to memory transfer operation. This program
will only work for a 8086 processor, higher processors’ DMA may not support memor to
memory transfer.
#include <dos.h> #include <bios.h>
char st[2048]="hello u whats up?\0"; char st1[2048]="xyz"; unsigned long int temp; unsigned int i;
void main (void) { temp=_DS; temp = temp<<4; i = *((unsigned int *)(&temp)); temp = temp >>16;
outportb(0x87,*((unsigned char )(&temp))); outportb(0,((unsigned char )(&i))); outportb(0,(((unsigned char *)(&i))+1)); outportb(1,0xff); outportb(1,0x07); outportb(0x0b,0x88); temp=_DS; temp= temp+128; temp=temp<<4; i= *((unsigned int )(&temp)); temp=temp>>16; outportb(0x83,((unsigned char )(&temp))); outportb(2,((unsigned char )(&i))); outportb(2,(((unsigned char *)(&i))+1));
This program, programs the channel 0 and channel 1 of the DMA. It loads the address of
Source string st in base register and the Latch B and loads the count register for channel 0
and does the same for st1. It then programs the mode, mask and command register for
memory to memory transfer and to unmask channel 0 and channel 1.
outportb(3,0xff); outportb(3,0x07); outportb(0x0b,0x85); outportb(0x08,1); outportb(0x0f,0x0c); outportb(0x09,0x04); while (!kbhit()) { printf("Channel 0 = %x,% x\n",inportb(0x01),inportb(0x01)); printf("Channel 1 = %x,% x\n",inportb(0x03),inportb(0x03)); printf("Status = % x\n",inportb(0x08)); } puts(st1); }
File Systems
An addressable unit on disk can be addressed by three parameters i.e. head #, sector # and
track #. The disk rotates and changing sectors and a head can move to and fro changing
tracks. Each addressable unit has a unique combination of sec#, head# and track# as its
physical address.