Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

Lab Manual

Download as doc, pdf, or txt
Download as doc, pdf, or txt
You are on page 1of 51

INDEX

Exp No.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17

Name of Experiment
STUDY OF PC COMPONENTS STUDY OF MOTHERBOARD STUDY OF OS INSTALLATION AND NETWORKING CONCEPTS RETRIEVE THE ATTRIBUTES OF A FILE FILE DELETION DIRECTORY CREATION SCAN CODE & ASCII CODE GENERATION SETTING CURSOR SIZE TOGGLE KEYS MOUSE POINTER DETECTION MOUSE POINTER RESTRICTION DISPLAY SYSTEM TIME ACCESS VIDEO MEMORY IN TEXT MODE DANCING DOLLS USING TSR TIME BOUND TSR RAINDROPS USING TSR SOUND PLAYING USING TSR

Page No.
4 8 17 23 25 27 29 31 32 34 37 39 41 43 45 47 49

Exp.No. 1

STUDY OF PC COMPONENTS

PROBLEM DEFINITION
To study the PC components.

THEORETICAL BACKGROUND
The basic components of a PC are:

System Unit
The part of a PC that most people usually think of as the computerthe box that holds all the essential components except, in the case of desktop machines, the keyboard and monitoris the system unit. Sometimes called CPUfor Central Processing Unit, a term also used to describe microprocessors as well as mainframe computersthe system unit is the basic computer component. It houses the main circuitry of the computer and provides the jacks (or outlets) that link the computer to the rest of its accouterments including the keyboard, monitor, and peripherals. A notebook computer combines all of these external components into one but is usually called simply the computer rather than the system unit or CPU. One of the primary functions of the system unit is physical. It gives everything in your computer a place to be. It provides the mechanical mounting for all the internal components that make up your computer, including the motherboard, disk drives and expansion boards. The system unit is the case of the computer that you see and everything that is inside it. The system unit supplies power to operate the PC and its internal expansion, disk drives, and peripherals. The system Unit consist of the following components: Motherboard The centerpiece of the system unit is the motherboard. All the other circuitry of the system unit is usually part of the motherboard or plugs directly into it. The electronic components on the motherboard carry out most of the function of the machine: running programs, making calculations, and even arranging the bits that will display on the screen. It provides the connectors for the CPU, the memory, BIOS, CMOS, Video devices, sound devices, storage devices, chipsets, etc. in order to form an integrated set of components. It has each of the following components: 1. 2. 3. 4. 5. 6. 7. 8. ISA Expansion Slots PCI Expansion Slots CPU Slot Memory (SIMM) bank Memory (DIMM) bank External Cache (L2) ROM Chip (BIOS Chip) Clock Oscillator

Microprocessor

The most important of the electronic components on the motherboard is the microprocessor. It does the actual thinking inside the computer. Which microprocessor, of the dozens currently available, determines not only the processing power of the computer but also what software language it understands (and thus what programs it can run). Many older computers also had a coprocessor that added more performance to the computer on some complex mathematical problems such as trigonometric functions. Modern microprocessors generally internally incorporate all the functions of the coprocessor.

Memory
Memory is the storage that has instantaneous access by the CPU. It is usually located on the motherboard. The PCs microprocessor needs memory to carry out its calculations. The amount and architecture of the memory of a system determines how it can be programmed and, to some extent, the level of complexity of the problems that it can work on. Modern software often requires that you install a specific minimum of memorya minimum measured in megabytesto execute properly. With modern operating systems, more memory often equates to faster overall system performance. Most often memory refers to Random Access Memory (RAM). RAM is the primary memory used for the boot process and the PC's operating system and device drivers are loaded into RAM. RAM has many functions, but its primary function is to store programs and drivers for the various system devices. It is probably the most important type of memory in your PC. Three types of memory: a.RAM b.ROM c.Cache

Mass Storage
To provide the computer with a way to store the huge amounts of programs and data that it works with every day, the PC uses mass storage devices. The different types of mass Storage devices are: Hard Disk Drives Hard drive is storage with metal disks (called platters) arranged on a spindle with a read/write head.

The platters on a hard disk drive are coated with some magnetic film material that can record data in the form of magnetized spots on the surface. The disk surface has tracks, which are concentric circles that are next

to each other on each surface. Then each surface is divided into sectors. Each sector on each surface contains usually 512 bytes per each section of a track per sector. The disk rotates at 4500 to 7200 RMP the rotation speed is a factor in the access speed of the drive. The read/write head must move to the proper track before it can read. Once at the proper track, it must wait for the proper sector to rotate under the head to read the data. CD ROM Drives CD-ROM stands for Compact Disk - Read Only Memory

CDs hold approximately 650 MB of information. A compact disk (CD) is a plastic disk, coated with aluminum alloy. The plastic base is made of a polycarbonate wafer. The CD is written to by a laser, and read by a laser. . A single CD, that costs about the same as a floppy disk holds hundreds of times more information and keeps it more secure. CDs are vulnerable to neither random magnetic fields nor casual software pirates. Floppy Disk Drives It is an inexpensive and exchangeable storage medium. It provides a storage place for data and programs and also it served well as a distribution system. It consists of a platter and there are tracks on this platter on which the data are stored. The platter on a floppy diskette drive is coated with some magnetic film material that can record data in the form of magnetized spots on the surface. The disk surface has tracks that are concentric circles that are next to each other on each surface. Then each surface is subdivided into sectors. Each sector on each surface contains usually 512 bytes per sector. Tape Drives They are basically used to store "system" backup data, and to provide long-term storage. It provides an inexpensive place to put your data. Tape Drives normally have a drive that connects to either a serial or a parallel port on computer. Computer tape drives work on the same principles as the cassette recorder in the stereo. Some are, in fact, cassette drives.

Display Systems
Display system is the combination of a graphics adapter or video board and a monitor or flat-panel display. The display system gives the PC the means to tell what it is thinking, to show the data in the form that is best understood, be it numbers, words, or pictures. The two halves of the display system work hand-in-hand. The graphics adapter uses the digital signals inside the PC to built an electronic map of what the final image should look like, storing the data for every dot on the monitor in memory. Electronics generate the image that appears on the monitor screen. Graphics Adapters

Graphics adapter forms the image that is seen on the monitor screen. It converts digital code into a bit pattern that maps each dot that is seen. Because it makes the actual conversion, the graphics adapter determines the number of colors that can appear on the monitor as well as the ultimate resolution of the image. In other words, the graphics adapter sets the limit on the quality of the images the PC can produce. A monitor cannot make an image any better than what comes out of the graphics adapter. The graphics adapter also determines the speed of the PCs video system; a faster board will make smoother video displays.

Monitors
The monitor is the basic display system thats attached to most PCs. The quality of the monitor attached to the PC determines the quality of the image seen. Although it cannot make anything look better than whats in the signals from the graphics adapter, it can make them look much worse and limit both the range of colors and the resolution (or sharpness) of the images.

Peripherals
The accessories you plug into your computer are usually called peripherals. Todays PCs have two types of peripherals, the internal and external. Internal peripherals fit inside the system unit and usually directly connect to its expansion bus. External peripherals are physically separate from the system unit, connect to the port connectors on the system unit, and often (but not always) require their own source of power. Although the keyboard and monitor of a PC fit the definition of external peripherals, they are usually considered to be part of the PC itself and not peripherals.

Keyboard
One can communicate with the PC, telling it what to do, using the input devices such as the keyboard. The keyboard remains the most efficient way to enter text into applications, faster than even the most advanced voice recognition systems that let one talk to a PC. A keyboard must be responsive to the touch of the fingers when pressed down, the keys actually have to go down. Printers A printer is a device that can produce on paper, or plastic, images that can be seen or read by a user. Printer Types 1.Impact Printers. Most impact printers are Dot Matrix; however, there may still be a few Daisy Wheel printers left, but probably no hammer printers except with large volume mainframe printers. First, a character on a dot matrix is represented by anywhere from 14 to 24 pins, with 24 pins being the common number today. Not all pins are used to display a character. Certain pins are used to represent each character. Various codes may cause different pins to be used, i.e. italic letters versus a courier font would use different codes. A code is used for each character that is used to determine which of the pins to strike a ribbon that is pressed against the paper. Dot matrix printers are an inexpensive means for printing draft copies of documents for editing. 2.Non-Impact Ink Jet

Ink Jet printers basically spray ink onto the paper, but the spraying of ink is controlled as strictly as are the pins in a dot matrix printer, or the points that are charged on a laser printer's image drum. The price of ink jet printers is between that of dot matrix and laser printers. They are quieter that impact printers. 3.Non-Impact LASER Printers The laser printer is the fastest and most popular printer on the market. It does not however, print multiple copy forms. It does produce a printer quality document, both for text and graphics. It is somewhat more expensive than a dot matrix printer, especially if you purchase a high volume, high quality laser printer.

Connectivity
The real useful work that PCs do involves not just you but also the outside world. The ability of a PC to send and receive data to different devices and computers is called connectivity. Your PC can link to any of a number of hardware peripherals through its input/output ports. Better still, through modems, networks, and related technologies it can connect with nearly any PC in the world. Parallel Port Parallel ports are well-defined, convenient, and quick connection to make with a PC . The port is parallel because it conducts its signals through eight separate wiresone for each bit of a byte of datathat are enclosed together in a single cable. The signal wires literally run in parallel from your PC to their destination. Serial Port They transfer 1 bit at a time. They are quick enough not only to transfer text messages but to move your voice digitally or even handle full motion video in real time. The classic serial port (best known by its official EIA standard designation, RS-232C), ACCESS.bus, the IrDA optical connection, the Universal Serial Bus, and P1394. Modems

To connect with other PCs and information sources such as the Internet through the international telephone system, one need a modem. Essentially a signal converter, the modem adapts the PCs data to a form compatible with the telephone system. In function, a modern PC modem has five elementsits interface circuitry for linking with the host PC; circuits to prepare data for transmission by adding the proper start, stop, and parity bits; the modulator that makes the modem compatible with the telephone line; the user interface that gives you command of the modem's operation; and the package that gives the modem its physical embodiment.

CONCLUSION
The study of PC components has been done successfully.

Exp.No. 2

STUDY OF PC MOTHERBOARD
PROBLEM DEFINITION

To make a study of the PC Motherboard.

THEORETICAL BACKGROUND
Motherboard, Processor and Memory form the main components of a computer system. Motherboard is the main circuit board of a computer. It contains connectors and ports for attaching additional boards and peripheral devices. It has multiple controller chips on the motherboard to control standard devices such as keyboard, disk drive, etc. All the controller chips together are called as chipset. Processor, sometimes referred as CPU (central processing unit), performs the actual processing of data. The data is obtained, via the system bus, from the main memory and the results are then sent back to main memory via the system bus. Apart from computation, the processor controls and co-ordinates the operations of major components. Memory, sometimes referred as Main Memory, is an electronic component that stores programs and data either permanently or temporarily before transmitting between CPU and I/O devices. The Motherboard has two main processing chips on it called the Northbridge and the Southbridge. The Northbridge handles all the data flows to and from the main memory and also all the CPU transactions. The Southbridge handles the data for most of the ports. PROCESSOR Most of the calculations take place in the Processor (CPU). The computing power of the CPU is the most important element in the computer system. On a small workstation and personal computer, the CPU is housed in a single chip called a microprocessor. On bigger computers such as servers CPUs require one or more printed circuit boards to house multiple processors. The CPU has two main components, the Control Unit & Arithmetic Logical Unit (ALU). The Control Unit controls getting the instructions from the main memory and its execution. Other tasks include, control of input and output devices and passing the data to the ALU for computation. The Arithmetic Logical Unit (ALU) performs arithmetic operations on integer (whole number) and real (with a decimal point) operands. It also performs logical operations (equality, greater than and less than) between operands. The rate of speed at which a processor executes commands is measured by clock speed, often referred to as MHz (megahertz). The processor needs fixed number of clock cycles to perform each instruction. The faster the clock speed, the more number of instructions it can execute, thus resulting in a faster computer system.

ROM The classification reflects the evolution of ROM devices from hardwired to programmable to erasable-andprogrammable devices. A common feature of all these devices is their ability to retain data and programs forever, even during a power failure.

Masked ROMs: The very first ROMs were hardwired devices the contents of which had to be specified before chip production. They are now called masked ROMs to distinguish them from other types of ROM. PROM: One step up from the masked ROM is the PROM (programmable ROM. A Device programmer is used for writing the data to the PROM; it writes data one word at a time by applying an electrical charge to the input pins of the chip. Once programmed the PROM's contents can never be changed. EPROM (erasable-and-programmable ROM): is programmed in the same manner as a PROM. The advantage EPROM has over PROM is that it can be erased and reprogrammed repeatedly. Data on an EPROM is erased by exposing it to a strong source of ultraviolet light which resets EPROM to its initial un-programmed state

10

EEPROM: Electrically-erasable-and-programmable. In EPROMs the erase operation is accomplished electrically, rather than exposure to ultraviolet light.

RAM RAM - Random Access Memory is a collection of memory chips, which function as the computer's primary workspace. In today's computer, 64MB (64 megabytes) of SDRAM is a minimum for a desktop computer. The "random" in RAM means that the contents of each byte of storage in the chip can be accessed directly without accessing the bytes before or after it. RAM chips require power to maintain their content that is why the data must be saved to disk before turning off the computer. There are mainly two types of RAM: 1. Static RAM (SRAM) retains its contents as long as electrical power is applied to the chip. If the power even if lost temporarily, its contents will be lost forever. They are faster than DRAM but are expensive. SRAM is used only where access speed is extremely important. SRAM is often used as cache memory due to its speed.

2. Dynamic RAM (DRAM) Is an enhancement over SRAM. DRAM has a different approach towards storing the 1s and 0s. DRAM stores information as charges in very small capacitors, instead of transistors. Stores each bit of data in a separate capacitor. If a charge exists in a capacitor, it's interpreted as a 1. The absence of a charge will be interpreted as a 0. Uses capacitors instead of switches. As the capacitor leaks electrons, the information gets lost eventually, unless the charge is refreshed periodically, therefore it uses a constant refresh signal to retain its data.

Apart from SRAM and DRAM, there are EDO RAM, VRAM (Designed for graphics), SDRAM (next level of DRAM), DDR RAM (Next level of SDRAM) and RDRAM 3. EDO (Extended Data Out) RAM: Increases performance up to 15 percent over DRAM by eliminating memory wait states, this means eliminating few steps to access memory. Extends the availability of data in the memory as the read time does not expire until an additional signal is sent to the chip. Hence it is called an Extended Data Out RAM. In comparison a DRAM discharges its contents after read and must be refreshed before another read can occur.

4. VRAM (Video RAM) VRAM is a term used in computers to describe RAM dedicated for displaying bitmap graphics in graphics hardware. VRAM resides on the motherboard physically and is separate from the main RAM. In few systems the VRAM is shared with the system RAM. 5. SDRAM (Synchronous DRAM)

11

SDRAM was introduced in 1996. SDRAM was developed to match the ever-increasing processing speeds of the Pentium systems. An SDRAM's timing is synchronized to the system clock. By running in sync to an external clock signal, SDRAM can run at the same speed as the CPU/memory bus, there by eliminating the CPU wait states. The chip is divided into two cell blocks, and data is split between the two. While a bit in one block is accessed, a bit in the other is buffered for access. This allows SDRAM to burst subsequent, contiguous characters at a much faster rate than the first character. SDRAM are DIMMs and have 168-pins running at 3.3 volts. 6. DDR SDRAM (Double-data-rate synchronous dynamic RAM) Double-data-rate synchronous dynamic random access memory is a type of memory used in computers. It is designed to double the clock speed of the memory. It achieves greater bandwidth by transferring data on both the rising and falling edges of the clock signal. Thus a 100 MHz DDR system has an effective clock rate of 200MHz. FORM FACTORS (MEMORY SLOTS ON MOTHERBOARD) 1. SIMM Single In-line Memory Module (SIMM) is a small circuit board with integrated circuit chips used to hold RAM (Random Access Memory). SIMMS clip into the memory expansion socket s on the motherboard.SIMMs offer two main advantages, minimal consumption of board surface and ease of installation .A SIMM is an older type of memory module used for RAM in PC. 2. DIMM DIMM (Dual In-line Memory Module) is an assembly of several memory chips on a single PCB used to upgrade RAM capacity. DIMMs have gradually replaced SIMMs used in earlier machines. SIMMs only had contacts on one side of the card. DIMMs have contacts on both sides that hold twice as many chips as a SIMM. DRAM and SDRAM are two types of memory chips used in DIMMs. Extended Data Out (EDO) DRAM is the most common type of asynchronous DRAM used. At times it is also called hyper page mode DRAM. DIMMs gradually began replacing SIMMs as the predominant type of memory module when Intel's Pentium processors were in the mainstream market. The most common types of DIMMs are: 168-pin-DIMMs, used for SDRAM 184-pin-DIMMs, used for DDR SDRAM 240-pin-DIMMs, used for DDR2 SDRAM

3. RIMM

12

It stands for "Rambus In-Line Memory Module".RIMM is a memory module that takes up less space inside the computer than the older DIMM module and has different PIN architecture. It is similar to DIMMs using Direct Rambus DRAM memory subsystems. A RIMM has a 184-pin connector and an SO-RIMM module has a 160-pin connector. An SO-RIMM is smaller and is used in systems that require smaller form factors. TYPES OF MOTHERBOARD (MOTHERBOARD FORM FACTORS) PC motherboards are classified based on their form factors (design): mainly into 2 types AT and ATX. AT The AT motherboards are the first modern form factor to be widely used. AT stands for Advanced Technology & it was released by IBM in 1984. The PC and XT form factors that preceded it were quite uncommon. There are a few computers that still use AT and its variant Baby AT, but current standards are in favor of ATX. AT and Baby AT motherboards were the first PC motherboards to have built in sockets (headers) for I/O ports (serial, parallel, etc.). The serial and parallel port connectors are usually attached using cables that go between the physical connectors mounted on the back of the case and headers (pin connectors). These motherboards are distinguished by their shape, and by the presence keyboard connector soldered onto the motherboard. They were widely used in 386, 486 and early Pentium computers. ATX The ATX form factor was later on designed by Intel in order to overcome the various issues of the AT motherboards ATX (Advanced Technology EXtended motherboard) improves on the previous Baby AT & AT form factors, by rotating the orientation of the board 90 degrees. This allowed for a more efficient design, with disk drive cable connectors nearer to the drive bays and the CPU closer to the power supply and cooling fan. ATX is not an abbreviation and is actually a trademark that belongs to Intel. The AT standard had only a keyboard connector. Other common I/O connectors (serial & parallel ports etc) had to be mounted individually. The ATX was the first computer motherboard to not only include I/O support (serial, parallel, mouse, etc.), but to place all the connectors directly (soldered) onto the motherboard. ATX allowed each motherboard manufacturer to put these ports in a rectangular area on the back of the system, with an arrangement they could define themselves. COMMUNICATION PORTS IN MOTHERBOARD Ports are connectors used to connect external cables and devices to the motherboard. Motherboards that don't use integrated ports; they use headers on the motherboard instead. Headers are groups of pins used to connect devices or ports to the motherboard. A cable runs from the port and is plugged into the header on the board Listed here, are few communication ports: Serial Ports: It is A male 9-pin or 25-pin port on a computer system used by slower I/O devices such as a mouse or modem. The name "serial" comes from the fact that a serial port "serializes" data.

13

Parallel Port: This header has 26 pins. A parallel port is used for simultaneous transmission of data, one byte at a time but over multiple wires i.e. one bit per wire. This port on the back of the computer normally connects printers and scanners. PS/2 Mouse Port: Few motherboards provide a header for a PS/2 mouse port when this port is not already on the board. The PS/2 mouse header has 5 pins. USB (Universal Serial Bus): The USB technology is proposed to be the new standard for connecting devices such as keyboards, mice and other external devices to the PC. Some motherboards provide a 10 pin header to connect a port. Most of the present motherboards have built in USB ports. Primary and Secondary IDE/ATA Hard disk Interface: Most of the new motherboards have integrated headers for two IDE channels. Each has 40 pins. Floppy Disk Interface: Most motherboards provide a 34-pin header for the floppy disk cable. SCSI: Few motherboards have integrated SCSI ports or headers, though they were uncommon, they are becoming increasingly popular. They are either 50 or 68 pins in size, depending on the type of SCSI implemented. OTHER COMPONENTS PROCESSOR SOCKETS There are different slots and sockets for CPUs, and it is necessary for a motherboard to have the appropriate slot or socket for the CPU. Most sockets are square. Several precautions are taken to ensure that both the socket and the processor are indicated to ensure proper orientation. Different kinds of Slots

Slot 1 - Celeron, Pentium II, Pentium III Slot 2 - Pentium II Xeon, Pentium III Xeon Slot A - Early Athlons Slot B - DEC Alpha

CACHE LEVELS Cache memory is a fast storage area used to store frequently used data and instructions. It uses a small amount of physical RAM for storage. A cache used by the CPU to reduce the average time to access memory. As long as most memory accesses are to cached memory locations, the average time taken for memory accesses will be less than time taken to access main memory. The processor has an internal cache controller that integrates the cache with the CPU. This cache controller stores frequently accessed RAM locations to provide faster execution of data and instruction. Such a cache is known as a level 1 Cache. There is a similar cache external to the CPU, called a level 2 Cache. The level 2 Cache performs the same functions as level 1 Cache and can speed up the performance. Basically, a larger cache leads to a faster CPU. L1 cache

14

Level 1 cache also referred to as L1 cache is a memory cache built into the CPU chip or packaged within the same module as the chip. Sometimes known as the "primary cache," an L1 cache is the memory closest to the CPU. L2 cache The L2 cache also referred to as secondary cache is a memory cache that is external to the CPU chip, typically located on the motherboard. An L2 cache feeds the L1 cache. L3 cache If the L2 cache is also integrated on the CPU chip, then the external motherboard cache becomes the L3 cache. The L3 cache feeds the L2 cache, which feeds the L1 cache, which in turn feeds the CPU. EXPANSION SLOTS They are used to install various devices in the computer to expand its capabilities. Few such expansion devices are video, network, sound, and disk interface cards. A motherboard is likely to have three main types of expansion slots namely,

ISA PCI AGP

Each type differs in its appearance and function. ISA Almost all the PC's made before 1997, have a few Industry Standard Architecture (ISA) slots. It is recognizable by its brown or black color and has two parts, a shorter part and a longer part. The 8-bit ISA bus operated at 4.77 MHz, while the 16-bit bus operated at 8 MHz. IBM replaced the ISA bus with their proprietary Micro Channel Architecture (MCA). The system was far more advanced than ISA, and computer manufacturers responded with the Extended Industry Standard Architecture (EISA) and later, the VESA Local Bus (VLB). PCI PCI Express Bus has been released using a differential serial bus instead of a parallel bus. The PCI Express bus requires only a few sets of differential lines. The newer motherboards will have a PCI Express bus instead of an AGP slot.PCI slots are characterized by 33.33 MHz clock speed with a peak transfer rate of 133 MB per second. PCI-X, runs at 133MHz on 64 bit bus.PCI devices are plug and play.

AGP Advanced Graphics Port is a high-speed point-to-point channel for attaching a video graphics card to the motherboard, primarily to accelerate the computer graphics. Earlier PCI or ISA slots were used for accelerated graphics video cards. As games adapted to better graphics, more realism and more speed there was a need for a

15

slot dedicated to video graphics. AGP slots were designed to be a direct connection between the video circuitry and the PC's memory. AGP slots are easily recognizable because they are usually brown, shorter than the PCI slots and located right next to the PCI slots on the motherboard. Basically, AGP runs at twice the speed of a memory bus. USB USB supports data transfer rates of 12 Mbps (12 million bits per second). A single USB port can be used to connect up to 127 peripheral devices, such as mice, modems, and keyboards. USB supports Plug-and-Play installation. USB, typically located on the back of the computer (sometimes accessible through front-mounted ports), provides an easy way to connect USB-compatible peripherals such as scanners, cameras, joysticks, mice and keyboards etc? A USB hub is used to connect more than two USB devices. Generally, "powered" USB hubs provide better compatibility with cameras and other USB devices than do inexpensive un-powered hubs. The 12Mbps USB 1.1 spec is officially referred to as "full-speed" USB. USB 1.0 and USB 2.0 USB 1.0 and 1.1 has a maximum bandwidth of 12 Mbps and Hi-Speed USB 2.0 up to 480 Mbps. USB 2.0 ports is backward compatible which means USB 1.1 devices can plug into USB 2.0 ports.

CHIPSETS A chipset is a group of integrated circuits, or chips, on a computer's motherboard that are designed to work together, and are usually marketed as a single product. it controls communications between the processor and

16

external devices .The chipset is the largest chip (chips) on the motherboard. Few motherboards have heat sinks integrated on it to reduce the temperature as chipsets can get pretty hot

In personal computers based on Intel Pentium-class microprocessors, there are two types of chipsetsl; northbridge and the southbridge. The northbridge links the CPU to very high-speed devices, especially main memory and graphics controllers, and the southbridge connects to lower-speed peripheral buses (such as PCI or ISA). In many modern chipsets, the southbridge actually contains some on-chip integrated peripherals, such as Ethernet, USB, and audio devices. A chipset is usually designed to work with a specific family of microprocessors. Because it controls communications between the processor and external devices, the chipset plays a crucial role in determining system performance.

CONCLUSION
The study of PC motherboard has been done successfully.

Exp.No.3

STUDY OF OS INSTALLATION AND NETWORKING CONCEPTS


PROBLEM DEFINITION

17

To study the installation of Windows 2000 OS

INSTALLATION of OS
(1)

Partitioning
A FAT 32 partition can be created only under the following circumstances:

Hard drive must be greater than 528 MB in capacity Partition size must be greater than 528 MB When the FDISK prompts Do you wish to enable large disk support? Y or N, youll need to answer Y The procedure below is followed to partition hard drives using FAT 32 version of FDISK 1. 2. 3. 4. 5. 6. 7. 8. Boot the Pc with the Windows start up disk. It takes you to the A: prompt Type FDISK and press ENTER. Youll be prompted with Do you wish to enable large disk support? Y or N Press Y to create FAT 32 partition and press ENTER. At this point the FDISK options menu will appear on the screen. Select option 4: Display partition information and press ENTER Press the ESC key to return to the FDISK options menu, then select option 1: Create DOS partition or Logical DOS drive and press ENTER. Next select option 1: Create primary DOS partition and press ENTER. After FDISK verifies the drive integrity, it will prompt you with the message Do you wish to use the maximum available size for a primary DOS partition and make the partition active(Y/N)? Press Y and press ENTER. Exit FDISK by pressing the ESC key until you see the message You must restart the system for changes to take effect. Press ESC key to exit FDISK and remove start up disk. Reboot using Alt+Ctrl+Delete.

(2)

Formatting
Follow the procedure below:

1. 2. 3.

Boot the PC with Windows start up disk At the A: prompt type FORMAT <drive letter>: and press ENTER to start formatting (such as FORMAT D :) After FORMAT starts youll see the message: WARNING- all data on non removable disk drive <letter :> will be lost. Proceed with format? Y/N Press Y and press ENTER. The FORMAT utility will then prepare the selected hard drive partition for use with the FAT 32.

(3) Installation of 2000 server (3.1) Windows 2000 server Setup


Insert the Windows 2000 CD into the CD ROM drive and reboot your machine so that it boots from the CD. Then follow the steps below:

18

1.The Welcome to the Windows 2000 Setup Wizard appears, click Next. Windows 2000 then detects and installs devices. This can take several minutes, and during the process your screen may flicker. 2.In the Regional Settings dialog box, make changes required for your locale (typically, none are required for the United States), and click Next. 3.In the Personalize Your Software dialog, type CS in the Name box and type SJCET in the Organization box. Click Next. 4.Type the Product Key (found on the back of your Windows 2000 CD case) in the text boxes provided. Click Next. 5.In the Licensing Modes dialog box, select the appropriate licensing mode for your organization and click Next. 6.In the Computer Name and Administrator Password dialog box, type the new computer name (say) HQ-RES-DC-01 in the computer name box and click Next. 7.In the Windows 2000 Components dialog box, click Next. Wait while networking components are installed. This takes a few minutes. 8.In the Date and Time Settings dialog, correct the current date and time if necessary and click Next. 9.In the Networking Settings dialog, make sure Typical Settings is selected and then click Next. 10. In the Workgroups or Computer Domain dialog box, No is selected by default, then click Next. Windows 2000 Server Installation continues and configures the necessary components. This takes a few minutes. 11. from When you reach the Completing the Windows 2000 Setup Wizard, remove the CD-ROM the drive and click Finish.

The server restarts and the operating system loads from the hard drive. (3.2) Configuring server as a Domain Controller Dynamic Host Configuration Protocol (DHCP), Domain Name Service (DNS), and DCPromo (the command-line tool that creates DNS and Active Directory) can be installed manually or by using the Windows 2000 Configure Your Server Wizard. This guide uses the wizard; the manual procedures are not covered here. 1. Press Ctrl-Alt-Del and log on to the server as administrator. Leave the password blank. 2. When the Windows 2000 Configure Your Server page appears, select This is the only server in my network and click Next. 3. Click Next to configure the server as a domain controller and set up Active Directory, DHCP, and DNS. 4. On the What do you want to name your domain page, type CS02. 5. In the Domain name box, type com. Click on the screen outside of the textbox to see the Preview of the Active Directory domain name. Click Next. 6. Click Next to run the wizard. When prompted, insert the Windows 2000 Server CD-ROM. When the wizard is finished, the machine reboots. The Configure Your Server Wizard installs DNS and DHCP and configures DNS, DHCP, and Active Directory.

19

(3.3) Populating Active Directory


To create Organizational Units and Groups 1. Click Start, point to Programs, then point to Administrative Tools, and click Active Directory Users and Computers. 2. Click the + next to CS02.com to expand it. Click CS02.com itself to show its contents in the right pane. 3. In the left pane, right-click CS02.com, point to New, and click Organizational Unit. 4. Type the required name (say staff) in the name box, and click OK. 5. Repeat steps 3 and 4 to create rest of the Organizational Units. These three Organizational Units now show up in the right pane. 6. Click staff in the left pane. Its contents now display in the right pane (it is empty to start). 7. Right-click staff, point to New, and click Organizational Unit. 8. Type the name of the subdivisions (say A, B etc.) in staff, and click OK. 9. Repeat steps 6 and 7 to create rest of the Organizational Units under each of the main unit. (3.4) To create user accounts

1. In the left-hand screen, click the + next to the staff folder to expand it. 2. Click A (under staff) in the left-hand screen. Its contents now display in the right pane (it is empty at the beginning of this procedure). 3. Right-click A, point to New, and click User. 4. Type Kevin for the first name and Peter for the last name 5. Type Kevin for the User logon name. 6. Click Finish. 7. Repeat steps 2 to 5 to add other users (3.5) 1. 2. 3. 4. To add users to security groups

In the left pane, click Groups. In the right pane, double-click the group Management. Click the Members tab and then click Add. Select the users in the upper pane by holding down the ctrl key while clicking each name; click Add to add them all at once. Their names will display in the bottom pane. Click OK to accept. 5. Repeat steps 2 through 4 to add members to the Non-management group. 6. Close the Active Directory Users and Computers snap-in.

4) Installation of Windows 2000 professional (4.1) Windows 2000 professional setup 1. Insert the Windows 2000 Professional CD into the CD-ROM drive and reboot your machine so that it boots from the CD. Setup begins by checking the machine configuration and loading files. 2. When the Welcome to Setup screen appears, press Enter. 3. Review the Licensing Agreement, and if you find it acceptable, press F8. 4. Change any of the default parameters you desire for language, advanced, and accessibility options. Or you can just accept the defaults and configure these settings later. Click Next.

20

5. In the Name box, type your name. In the Organization box, type CS02, and click Next. 6. Type the Product Key (found on the back of your Windows 2000 CD case) in the text boxes provided. Click Next. 7. Enter the computer name as HQ-RES-WRK-01. Leave the administrator password blank and click Next. 8. Adjust the time and date settings as necessary and click Next . Setup installs networking components. This takes a few minutes. 9. Click Next to accept Typical settings, and then click Next again. 10. Select No, this computer is not on a network, and click OK . 11. Setup installs and configures Windows 2000 components and performs these final tasks: I. Installs Start menu items II. Registers components III. Saves settings IV. Removes any temporary files. 12. After Setup has completed these processes, click Finish to terminate the wizard. Remove the Windows 2000 Professional CD, and the computer restarts. 13. After the computer reboots, the Network Identification Wizard starts. Click Next. 14. Select the default user logged on, click Next, and then click Finish. (4.2) Adding the Workstation to the Domain 1. 2. 3. 4. 5. 6. Click Start, point to Settings, click Control Panel, and then double-click the System icon. Click the Network Identification tab and click Properties. The Computer name should be SYSTEM-01. Click the Domain button. In the Domain box, type CSLAB, and click OK. The Domain Username and Password dialog appears. You must supply an account that has privileges to join the domain. In the Name box, type CSLAB\administrator and click OK 7. When you receive the message, Welcome to the CSLAB domain, the workstation has successfully joined the domain. Click OK

NETWORK CABLING, SWITCHES


Hubs It is used to create connection between two stations in a physical star topology. It is used to create multiple levels of hierarchy. The hierarchical use of hubs removes the length limitation of 10 Base T Ethernet LAN. When a bit comes into a hub interface the hub simply broadcast the bit on all other interfaces. Because hubs operate on bits rather than frames, hubs are physical layer device. In hubs the total bandwidth is divided equally to all lines. The entire LAN segment belongs to the same collision domain and collision will be higher. Speed is less when we use hubs. In hub there is no dedicated path for communication.

21

Repeaters For connecting different LAN segments we can use this. They belong to the physical path of the OSI model. The task of the repeater is to amplify the signal. Therefore repeater does not read the signal neither the data part or address part. A repeater receives a signal and before it becomes too weak or corrupted, regenerates the original bit pattern. The repeater then sends the refreshed signal. It can extend the physical length of the LAN. Repeaters actually connect two segments of the same LAN. In modern repeaters as well as amplifying the signal it has the function of filtering the signal with long segments the signal will become unclear & distorted. Noise that is not readable as a signal will not be amplified on the other side of the repeater. Bridge They are one step ahead to repeaters. They belong to Data Link Layer of OSI model. The task is to look at the MAC address and thus restrict traffic. Traditionally the function of bridges was to connect the networks of the same type. Now bridges are become more advanced, and are doing more and more of the routers work. A bridge does not change the MAC address in a frame. Modern bridges are often of the transparent (learning) type. A bridge that is positioned between two segments must know what kind of stations are to be found on the other side. A transparent bridge will be able to create the routing table itself. If the bridge is not transparent you will need to create the routing table based on MAC addresses yourself. Routers Routers accept incoming packets from one input ports, uses a routing table to find the output port from which the packet departs and sends the packets from this port. It works in the network layer of the OSI model. They must have the ability to communicate between themselves in order to identify the optimal route at any given time & run their own algorithms & protocols for this purpose. The most important area is managing traffic in and out of the local area network. The primary area of application for a router is a wide area network. In addition, routers are an important component in most of the firewall solutions, most likely in the shape of filtering routers. A switch has four components: Input ports, Output ports, Routing processor and the switching fabrics.

Switches A switch that contain no. of ports for connecting no. of devices. Each device will get a dedicated path. In this bandwidth will not be divided, each will get total bandwidth. Collision will be very less, speed is higher. Switching allows a network to maintain a full duplex Ethernet. An intelligent switch maintains a table of connected nodes for every node on the switch and has a physical network of lines that makes it possible to have connection between various ports. In this case, switch is able to create its own address table. If the receiver address is unknown to the switch it will send the message to all the port, then the objectives will be fulfilled. 3 types of Switches: Cut-Through Switch

22

With it switch reads the messages head and looks at the address to sort out which port it is supposed to go. Then the message is put directly on this port without any intermediate string of processing. Store-Forward Switch It intermediately stores the message and runs a check on errors on all data before sending to the requested port. It then uses built in error checker. If no error it will send otherwise stores it on a switch. Adaptive Switch It is the combination of the above two technologies. Adaptive switches are likely to start as cut through. It continuously monitors the package that contain error and when the no. of errors reaches a certain value the switch changes to store-forward. In this way, the best of both technologies is used to the best advantage. This switch method is called hybrid switching and has exactly the same meaning as adaptive switching. The term hybrid is used simply because it is a combination of two technologies. Switching can also be divided into: Port Switching Port switching means that a machine is directly connected to the switchs port. Then you can run parallel full speed between machines. This will become expensive solution. Therefore, it is especially important to users who require large capacity. Segment Switching Segment Switching means that a whole segment is connected to the port of the switch.

CONCLUSION
Windows 2000 Server and Professional are installed successfully .

Exp.No.4

RETRIEVE THE ATTRIBUTES OF A FILE


PROBLEM DEFINITION
To retrieve the attributes of a file.

THEORETICAL BACKGROUND
The file attribute is a on-byte bit-flag associated with each file, found in the files directory entry. The details of the file-attribute byte are as follows:

23

Read Only Hidden System Volume Label Entry Sub Directory Entry Archive A value 1 at the corresponding bit position will indicate each attribute. DOS function 43H is used to read the file attribute. The register AH should be set to 43H. The DS: DX should contain the address of an ASCII string of a file specified. AH should contain a sub function code 0 indicating fetching current attribute and 1 indicating setting file attribute. Then the interrupt 21H is called. The result will be in CX. AX will contain an error code if CF is set to C4.

PSEUDOCODE
Begin 1. 2. 3. 4. 5. Declare the register variables Read the file name. Initialize ah register with 0x43 to read file. Get the offset address of the file into dx register Call intdos interrupt interface which in turn execute the dos interrupt 0x21 to perform the specified file operation 6. If the result of the logical AND operation of content in cl register and 0x1 is true, then it is read only file. 7. If the result of the logical AND operation of content in cl register and 0x2 is true, then it is a hidden file. 8. If the result of the logical AND operation of content in cl register and 0x4 is true, then it is a system file. 9. If the result of the logical AND operation of content in cl register and 0x8 is true, then volume label. End

PROGRAM DEVELOPMENT
#include<stdio.h> #include<dos.h> void main() { union REGS in,out; char far(fname[20]); unsigned char attr; clrscr(); printf("\nEnter the file name"); scanf("%s",fname); in.h.ah = 0x43; in.h.al = 0x00; in.x.dx = FP_OFF(fname);

24

intdos(&in,&out); attr = out.h.cl; if(attr & 0x1) printf("\n\t Read only"); if(attr & 0x2) printf("\n\t Hidden"); if(attr & 0x4) printf("\n\t System"); if(attr & 0x8) printf("\n\t Volume Label"); if(attr & 0x10) printf("\n\t Directory"); if(attr & 0x20) printf("\n\t Archive"); getch(); }

OUTPUT
Enter a file name: c:\io.sys Read only Hidden System

CONCLUSION
The attributes of a file are successfully retrieved.

Exp.No.5

FILE DELETION
PROBLEM DEFINITION
Write a program to delete a file from the system THEORITICAL BACKGROUND To delete a file there exists a service 0x41 under interrupt number 0x21. Since this is a DOS service under interrupt 0x21, we should use the intdos() function to carry out the file deletion. The service number is always placed in the AH register. The segment address of the file to be deleted must be stored in the DS register whereas the offset address must be stored in the DX register.

25

PSUEDOCODE Begin 1. Read the filename into a variable 2. Initialize ah register with 0x41 to perform file deletion 3. Get the offset address of the file into dx register 4. Call intdos() interrupt service. 5. If the cflag=0 then print file has been deleted 6. Else print file cannot be deleted End

PROGRAM DEVELOPMENT #include<stdio.h> #include<conio.h> #include<dos.h> void main() { union REGS i,o; char far(fname[50]); clrscr(); puts(\nEnter the file name ); gets(fname); i.h.ah=0x41; i.x.dx=FP_OFF(fname); intdos(&i,&o); if(o.x.cflag==0)

26

printf(\n File %s has been deleted successfully, fname); else printf(\n File %s cannot be deleted or file doesnot exist, fname); getch(); }

OUTPUT
Enter the file name : D:\abc.doc File abc.doc has been deleted successfully

CONCLUSION
The program was implemented and tested successfully.

Exp.No.6

DIRECTORY CREATION
PROBLEM DEFINITION
Write a program to create a directory. THEORITICAL BACKGROUND When we use the DOS command MD (make directory), what happens is that internally DOS calls interrupt 0x21 to achieve this. If we know the service number we can easily get the hob of MD done through our program. To have an access to the variable corresponding to the DS register we are required to declare a variable of the type struct SREGS. This structure is defined in the file dos.h. Since we are using the DS register we must use the function intdosx() rather than the normal intdos() function.

27

PSUEDOCODE Begin 1. Read the directory name 2. Initialize register ah with service number 0x39 to read the directory 3. Store the segment address of the directory in ds register 4. Store the offset address of the directory in dx register 5. Call the function intdosx() 6. If the cflag= 0 then print directory created 7. Else print directory cannot be created End

PROGRAM DEVELOPMENT #include<stdio.h> #include<conio.h> #include<dos.h> void main() { union REGS i,o; struct SREGS s; char far(dname[50]); clrscr(); puts(\n Enter the directory name); gets(dname); i.h.ah=0x39; s.ds=FP_SEG(dname); i.x.dx=FP_OFF(dname); intdosx(&i,&o,&s); if(o.x.cflag==0)

28

printf(\n Directory is created); else printf(\n Directory cannot be created); getch(); }

OUTPUT
Enter the directory name : D:\New Folder Directory created

CONCLUSION
The program was implemented and tested successfully.

Exp.No.7

SCAN CODE & ASCII CODE GENERATION


PROBLEM DEFINITION
Write a program to get the scan code and ASCII code of keys pressed on a keyboard.

THEORETICAL BACKGROUND
Each time a key is pressed, the keyboard circuit transmits a sequence of one or more 8-bit numbers to the computer through the connector cable. This sequence of 8-bits is called scan code and it uniquely identifies the key that is pressed. The keyboard produces different scan codes depending on whether the key was pressed or released. Whenever a key is pressed, the scan code byte contains a number ranging from 1 to 83. When the key is released the keyboard generates a scan code, which is 128 higher that the scan code generated when the key was pressed. The keyboard control circuitry on the motherboard monitors the keyboard for input. The keyboard controller generates an interrupt each time it receives a scan code from the keyboard. The ROM BIOS contains the corresponding routine, which reads this scan code from the keyboard controller and then processes it. The

29

ROM BIOS routine translates scan code into a 2-byte sequence. The first byte contains the ASCII value corresponding to the key pressed; the second byte contains the scan code of the key hit. The PC keyboard interface is designed so the system software has maximum flexibility in defining certain keyboard operations. This is accomplished by having the keyboard return scan codes rather than ASCII codes. Each key generates a 'make' scan code when pressed and a 'break' scan code when released. The computer system interprets the scan codes to determine what operation it is to perform. For historical compatibility reasons computers can employ different sets of scan codes for different purposes. Earlier PC computers tend to use the XT scan code set. Current PC computers tend to use the AT scan code set.

PSEUDOCODE
Begin 1. Execute interrupt int86() with service number 0x16 for reading next keyboard character 2. The AL register gives the ASCII code of the key pressed 3. The AH register gives the scan code of the key pressed End

PROGRAM DEVELOPMENT
#include<stdio.h> #include<conio.h> #include<dos.h> void main() { union REGS in,out; int scan,asc; char key; clrscr(); int86(0x16,&in,&out); asc=out.h.al; key=out.h.al; scan=out.h.ah; printf("\n KEY = %c ASCII CODE=%d SCAN CODE=%d ",key,asc,scan); } }

30

OUTPUT
KEY = a ASCII CODE=30 SCAN CODE=97

CONCLUSION
The program was implemented and tested successfully.

Exp.No.8

SETTING CURSOR SIZE


PROBLEM DEFINITION
Write a program to set the cursor size on the screen.

THEORETICAL BACKGROUND
The interrupt 16 is used for Video Display services like positioning the cursor, changing the size of the cursor, writing a character on the screen etc. Here we have to use the function int86() and it takes the service number 1 as argument for setting the cursor size. Also we need to specify the starting and ending line values of the cursor through ch and cl registers.

PSEUDOCODE
Begin 1. Create the register variables

31

2. 3. 4. 5. End

Read the starting and ending values for the cursor size ie. 0-4. Initialize register ah with service number 1 for setting the cursor size. Store the starting and ending values on ch and cl register respectively. Call the function int86() with interrupt number 16 that will set the new cursor size

PROGRAM DEVELOPMENT
#include<stdio.h> #include<conio.h> #include<dos.h> void main() { int x,y; union REGS regs; clrscr(); printf(" Enter the starting line of the cursor(0-4) - "); scanf("%d",&x); printf(" Enter the ending line of the cursor - "); scanf("%d",&y); gotoxy(40,12); regs.h.ah = 1; regs.h.ch = x; regs.h.cl = y; int86(16,&regs,&regs); getch(); }

CONCLUSION
The cursor has been resized successfully.

Exp.No.9

TOGGLE KEYS
PROBLEM DEFINITION
Write a program to read the status of CAPS, NUM and SCROLL locks on a keyboard and toggle it.

THEORETICAL BACKGROUND
The bits of the byte in the location 0x417 keep track of the status of the toggle keys, whereas the byte in the location 0x418 monitor whether these keys are pressed or not. 7 1 . . . . 6 . 1 . . . 5 . . 1 . . 4 . . . 1 . 3 . . . . 1 2 . . . . . 1 . . . . . 0 . . . . . Byte 0x417 Insert state CAPS lock NUM lock SCROLL lock ALT pressed

32

. . . 7 1 . . . . . . .

. . . 6 . 1 . . . . . .

. . . 5 . . 1 . . . . .

. . . 4 . . . 1 . . . .

. . . 3 . . . . 1 . . .

1 . . 2 . . . . . 1 . .

. 1 . 1 . . . . . . 1 .

. . 1 0 . . . . . . . 1

CTRL pressed Left SHIFT pressed Right SHIFT pressed Byte 0x418 Insert pressed CAPS pressed NUM pressed SCROLL pressed Hold state active Sys Req key pressed Left ALT pressed Right ALT pressed

PSEUDOCODE
Begin Initialize a pointer that points to location 417H Read the status of CAPS, NUM and SCROLL locks Toggle the status End

PROGRAM DEVELOPMENT
#include<stdio.h> #include<conio.h> void main() { int caps, num, scroll; char far *ptr; // Bit pattern in location 417H // contains status of CAPS, NUM, SCROLL locks ptr = (char far *) 0x417; // Status of CAPS lock is in the sixth bit caps = *ptr & 0x40; // Status of NUM lock is in the fifth bit num = *ptr & 0x20; // Status of SCROLL lock is in the fourth bit scroll = *ptr & 0x10; clrscr(); if(scroll) printf("\nScroll lock is on, turning off\n"); else printf("\nScroll lock is off, turning on\n");

33

if(caps) printf("\nCaps lock is on, turning off\n"); else printf("\nCaps lock is off, turning on\n"); if(num) printf("\nNumber lock is on, turning off\n"); else printf("\nNumber lock is off, turning on\n"); //toggle the keys *ptr = *ptr ^= 0x70; getch(); }

OUTPUT
Scroll lock is off, turning on Caps lock is off, turning on Number lock is on, turning off Note: Check keyboard LED status for output.

CONCLUSION
The program was implemented and tested successfully.

Exp.No.10

MOUSE POINTER DETECTION


PROBLEM DEFINITION
Write a program to display the current coordinates of the mouse cursor and determine the status of the mouse buttons.

THEORETICAL BACKGROUND
A mouse is used to point at the icons, which form the menu in a GUI. The use of mouse requires a program to sense its presence. A device driver program that understands the mouse should also be loaded. A device driver is a program that senses the signals coming from the port to which the mouse is attached. On sensing the signals, the driver translates these into related action on the screen. This device driver is usually available as a program called MOUSE.COM, which works with different variety of mice. A mouse has a separate cursor (often called a mouse pointer), which works like an arrow and functions in the same way as the cursor. As we move the mouse, the mouse pointer moves correspondingly. Once the mouse driver is loaded the various mouse functions can be accessed by setting up the AX register with different values (service numbers) and issuing interrupt number 33h.

34

List of some important mouse services: Interrupt 33h Service 0 Purpose Reset mouse and get status Call with: AX = 0 Returns: AX = FFFFh If mouse support is available AX = 0 If mouse support is not available Show mouse pointer Call with: AX = 1 Returns: Nothing Hide mouse pointer Call with: AX = 2 Returns: Nothing Get mouse position and button status Call with: AX = 3 Returns: BX = mouse button status Bit Significance: 0 Left button is down 1 Right button is down 2 Center button is down CX = x coordinate DX = y coordinate

33h 33h

1 2

33h

PSEUDOCODE
Begin 1. Initialize the graphics mode. 2. Set horizontal and vertical limits for mouse pointer. 3. While no keyboard strokes Trigger interrupt 33h with service no. 3 to get mouse button status and current mouse coordinates End while End if End PROGRAM #include<stdio.h> #include<graphics.h> #include<dos.h> #include<string.h> union REGS in,out; //Initializes the mouse int initm() { in.x.ax = 0x00; int86(0x33,&in,&out);

35

return out.x.ax; } //Shows the cursor void showmouse() { in.x.ax=0x01; int86(0x33,&in,&out); } void mousestat(int *x,int *y,int *button) { in.x.ax=0x03; int86(0x33,&in,&out); *x = out.x.cx; *y = out.x.dx; *button = out.x.bx; }

void main() { int gd=DETECT,gm,maxx,maxy,x,y,btn; char btn1stat[50]; char btn2stat[50]; clrscr(); initgraph(&gd,&gm,"d:\\tc\\bgi."); if(!initm()) { closegraph(); printf("Mouse driver not loaded\n"); getch(); exit(1); } showmouse(); while(!kbhit()) { mousestat(&x,&y,&btn); gotoxy(10,20); printf("\nMouse co-ordinates are x=%d & y=%d",x,y); (btn&0x1)?strcpy(btn1stat,"Left Button:DOWN"):strcpy(btn1stat,"Left Button:UP"); (btn&0x2)?strcpy(btn2stat,"Right Button:DOWN"):strcpy(btn2stat,"Right Button:UP"); outtextxy(300,10,btn1stat); outtextxy(300,20,btn2stat); delay(100); setcolor(BLACK); outtextxy(300,10,btn1stat);

36

outtextxy(300,20,btn2stat); setcolor(WHITE); } OUTPUT Mouse co-ordinates are x=100 & y=200 Left Button : DOWN Right Button : UP

CONCLUSION
The program was implemented and tested successfully

Exp.No.11

MOUSE POINTER RESTRICTION


PROBLEM DEFINITION
Write a program to restrict the movement of mouse pointer inside a rectangle THEORITICAL BACKGROUND Once the mouse driver is loaded the various mouse functions can be accessed by setting up the AX register with different values (service numbers) and issuing interrupt number 33h to the function int86. The mouse pointer movement can be restricted both vertically and horizontally by using service numbers 7 and 8 with interrupt 33H. List of some important mouse services:

37

33h

33h

33h

Set mouse pointer position Call with: AX = 4 CX = x coordinate DX = y coordinate Returns: Nothing Set horizontal limits for mouse pointer Call with: AX = 7 CX = minimum x coordinate DX = maximum x coordinate Returns: Nothing Set vertical limits for mouse pointer Call with: AX = 8 CX = minimum y coordinate DX = maximum y coordinate

PSEUDOCODE
Procedure Begin 1. Initialize to graphics mode. 2. Initialize mouse using interrupt 33 H and service number 0 3. Show the mouse pointer using service no. 1 and interrupt 33h 4. Trigger interrupt 33h with service numbers 7 and 8 to set horizontal and vertical limits for mouse pointer 5. using service numbers 7 and 8. 6. Remove the restriction by repeating the above step. End

PROGRAM DEVELOPMENT #include<stdio.h> #include<conio.h> #include<dos.h> #include<graphics.h> void restrcitmouse(int xl,int yl,int xr,int yr); void removerestrict(int xl,int yl,int xr,int yr); union REGS i,o; void main() { int gd=DETECT,gm; int a,b,xl,xr,yl,yr; initgraph(&gd,&gm,D:\TC\BGI); i.x.ax=0; int86(0x33,&i,&o);

38

printf(Enter the co-ordinates of rectangle:); scanf(%d,%d,%d,%d,&xl,&yl,&xr,&yr) ; rectnagle(xl,yl,xr,yr) ; restrictmouse(xl,yl,xr,yr); getch(); removerestrict(0,0,640,480); } void restrictmouse(int xl,int yl,int xr,int yr) { i.x.ax=7; i.x.cx=xl; i.x.dx=xr; int86(0x33,&i,&o); i.x.ax=8; i.x.cx=yl; i.x.dx=yr; int86(0x33,&i,&o); i.x.ax=1; int86(0x33,&i,&o); } OUTPUT

CONCLUSION
The program was implemented and tested successfully

Exp.No.12

DISPLAY SYSTEM TIME


PROBLEM DEFINITION Write a program to display the current system time THEORITICAL BACKGROUND To get the system time, we need to use the interrupt 0x1A to invoke the corresponding ROM-BIOS function. The service number 0x02 must be given as an argument for the function int86(). Upon calling this function, it will return the system time from BIOS to the registers in BCD format. To display the time, we need to convert that BCD into decimal values. PSEUDOCODE

39

Begin Initailize graphics While not a keyboard stroke Store 0x02 in ah register Call int86() with service number 0x1A Read hour from ch register (in BCD) and convert it into decimal Read minute from cl register (in BCD) and convert it into decimal Read seconds from dh register (in BCD) and convert it into decimal Display the time in the format h:min:sec End While End PROGRAM DEVELOPMENT #include<stdio.h> #include<conio.h> #include<dos.h> #include<stdlib.h> #include<graphics.h> void main() { int gd=DETECT,gm; union REGS in,out; int hr,min,sec,m,n,o,p,q,r,x,i; char c; clrscr(); initgraph(&gd,&gm,d:\tc\bgi); while(!kbhit()) { in.h.ah=0x02; int86(0x1A,&in,&out); hr=out.h.ch; min=out.h.cl; sec=out.h.dh; m=hr/16; n=ht%16; o=min/16; p=min%16; q=sec/16; r=sec%16 ; gotoxy(25,15); printf(\Current Time : %d%d:%d%d:%d%d,m,n,o,p,q,r); delay(100); clrscr(); } getch(); }

OUTPUT
Current Time : 13:20:57

40

CONCLUSION
The program was implemented and tested successfully

Exp.No.13

ACCESS VIDEO MEMORY IN TEXT MODE


PROBLEM DEFINITION
Write a program to access the video memory in text mode.

THOERETICAL BACKGROUND
Video Display Unit The Video Display Unit (VDU) consists of two basic components: 1. A monitor on which we see the images either in text or in graphics. 2. Video or graphics circuitry usually fitted on a card but sometimes found on the motherboard itself. The modern PC graphics card consists of six main components: 1. Graphics processor 2. Video memory 3. Digital to Analog converter (DAC) 4. Display connector 5. Bus Connector 6. Graphics BIOS Video Memory The memory that holds the video image is called the video memory. It is also referred to as the frame buffer. Anything drawn on the screen is made of individual dots. These dots are called pixels and each pixel has a color.

41

The memory is used to hold the color of each pixel. Todays graphics cards typically have 4MB or 8MB of video memory. The amount of video memory installed on the graphics card has a direct bearing on the number of colors and the resolution that it can support.

Writing to Video Memory in Text Mode


While working under DOS, two blocks of memory A block and B block, each of 64 KB are reserved for access to the video memory. In fact, these blocks act as a window to the video memory. Anytime we are to display anything on the screen we write to these blocks, which are mapped into the video memory. The B block is used by conventional adapters like Monochrome Adapter (MA) and Color Graphics Adapter (CGA), whereas A block is used by VGA and SVGA. The B block is further divided into two parts of 32KB each. The first 32 KB are used by MA and the rest by CGA. To be able to write directly into video memory, one must first know the address of the beginning of the video memory block. This beginning address of MA is 0xB0000000L and that for CGA is 0xB8000000L. Each character present on the screen has two bytes corresponding to it in the video memory. The first byte contains the ASCII value of the character, whereas the next byte contains the color of the character. Thus, if one character occupies two bytes in B block, 80 characters of 0th row will be represented by first 160 bytes from 0xB8000000 onwards. Similarly one screenful of characters would need 4000 bytes (80*25*2).

PSEUDOCODE
Begin Initialize a constant pointer with the address of video memory in text mode- 0xB8000000L Print a text in the video memory for watching the access process While (any key is not hit by the user) Check the characters in the memory (full area) and reverse the case of all available characters End while End

PROGRAM DEVELOPMENT
#include<stdio.h> #include<dos.h> #include<conio.h> #include<ctype.h> void main() { char far *const vidmem = 0xb8000000; int i; char ch; clrscr(); gotoxy(24,12); printf("DaNcInG dOlLs! "); while(!kbhit()) { for(i=0;i<3999;i+=2) {

42

ch=*(vidmem+i); if(ch>='A' && ch <= 'Z') *(vidmem+i)=tolower(ch); else *(vidmem+i)=toupper(ch); } delay(500); }}

OUTPUT
DaNcInG dOlLs! dAnCiNg DoLlS! CONCLUSION The video memory was successfully accessed in the text-mode.

Exp.No.14

DANCING DOLLS USING TSR


PROBLEM DEFINITION
Write a TSR program to change the capital letters on the screen to small letters and vise versa .

THOERETICAL BACKGROUND
To change the characters we must check the ASCII values of the characters present on the screen. These ASCII values are available in VDU memory which begins at address 0xB8000000L. We need to change the contents of the IVT such that location number 36,37,38,39 contain the address of function our(), instead of the normal ROM BIOS routine. Then make the program resident in memory even its execution is terminated. The program is made resident by calling a standard library function keep().

PSEUDOCODE
Begin Initialize a variable with the address of the video memory 0xB8000000L. Assign the address of the timer interrupt routine present on the IVT into a variable. Assign that address to the interrupt function our() Convert the uppercase characters on the screen to lower case and vise versa Make the program resident in memory End

PROGRAM DEVELOPMENT
#include<stdio.h>

43

#include<dos.h> #include<conio.h> void interrupt our(); void interrupt(*prev)(); char far *scr=(char far*)0xB8000000L; void main() { unsigned long int far *p; p=(char far*)36; prev=*p; /*save the existing address*/ *p=our; /* set up new address*/ keep(0,500); /*make the program resident in memory*/ } void interrupt our() { int i; for(i=0;i<=3999;i+=2) { if(*(scr+i)>='A'&&*(scr+i)<='Z') *(scr+i)+=32; else if (*(scr+i)>='a'&&*(scr+i)<='z') *(scr+i)-=32; } (*prev)(); } CONCLUSION The program was successfully executed and the output is obtained correctly

44

Exp.No.15

TIME BOUND TSR


PROBLEM DEFINITION
Write a TSR program to change the colors of the screen every 10 seconds.

THOERETICAL BACKGROUND
In this program, changing the address in IVT and preserving the original address has been done through call to two standard C library functions called setvect() and getvect(). The getvect() first multiplies the interrupt number passed to it by 4. In this case the multiplication would result into 32. Then it returns the address present at locations 32 to 35. setvect() does just the reverse. It accepts the interrupt number and address of the function and places the address at location number resulting from multiplying the interrupt number by 4. The timer interrupt occurs whenever the timer ticks, which it does 18.2 times in one second. This means that control would reach our() 182 times in 10 seconds. It is only when the control reaches our() the 182ndtime the color change should take place. This can be easily achieved by setting up a global variable ticks and incrementing every time the control reaches our().

PSEUDOCODE
Begin Initialize a variable with the address of the video memory 0xB8000000L. Assign the address of the timer interrupt routine present on the IVT into a variable. Assign that address to the interrupt function our() Initialize a variable to keep track of the time At every 10 second, change the color value of each location on the screen Make the program resident in memory End

PROGRAM DEVELOPMENT
#include<stdio.h> #include<dos.h> #include<conio.h> void interrupt our(); void interrupt(*prev)();

45

char far *scr=(char far*)0xB8000000L; int ticks; unsigned char color; void main() { prev=getvect(8); setvect(8,our); keep(0,500); } void interrupt our() { int i; ticks++; if(ticks==182) { for(i=1;i<=3999;i+=2) *(scr+i)=color; } color++; ticks=0; (*prev)(); } CONCLUSION The program was successfully executed and the output is obtained correctly

46

Exp.No.16

RAINDROPS USING TSR


PROBLEM DEFINITION
Write a TSR program to make the raindrops effect on the screen

THOERETICAL BACKGROUND
The raindrop effect is made by picking up characters at random from the screen and make them fall down to the bottom of the screen. We can simulate this activity through a TSR. Here we will capture the timer interrupt and let the function our() get called in place of the normal ROM-BIOS routine. In our() an if would keep track of the time. If 5 seconds have elapsed then we will choose the character at random and make it fall down.

PSEUDOCODE
Begin Initialize a variable with the address of the video memory 0xB8000000L. Assign the address of the timer interrupt routine present on the IVT into a variable. Assign that address to the interrupt function our() Initialize a variable ticks o keep track of the time Pick a random character from the screen and make it fall down. Make the program resident in memory End

PROGRAM DEVELOPMENT
#include<dos.h> #include<stdlib.h> void interrupt our(); void interrupt(*prev)(); char far *scr=(char far*)0xB8000000L; int ticks; void main() { prev=getvect(8); setvect(8,our); keep(0,1000);

47

void interrupt our() { int row,col; char far *v,ch; ticks++; if(ticks==91) { col=random(79); row=random(24); ch=*(scr+row*160+col*2); for(;row<=24;row++) { v=scr+row*160+col*2; *(v-160)=' '; *v=ch; delay(100); } ticks=0; } (*prev)(); } CONCLUSION The program was successfully executed and the output is obtained correctly

48

Exp.No.16

SOUND PLAYING USING TSR


PROBLEM DEFINITION
Write a TSR program to switch on the PC speaker for 50ms and display a random alphabet on the center of the screen.

THOERETICAL BACKGROUND
First, we have to initialize a far pointer with the starting location of the video memory 0xB8000000L. Assign the address of the keyboard interrupt routine present on the IVT into a variable and assign that address to the interrupt function our(). Find the ASCII value of the random alphabet. To produce a sound we have to use the library function sound() by using the random alphabet with a delay.

PSEUDOCODE
Begin Initialize a far pointer with the starting location of the video memory 0xB8000000L Assign the address of the keyboard interrupt routine present on the IVT into a variable Assign that address to the interrupt function our() Take the ASCII value of the random alphabet Produce a sound calculated by using the random alphabet with a delay Keep the program resident in memory End

PROGRAM DEVELOPMENT
#include<stdio.h> #include<conio.h> #include<dos.h> #include<stdlib.h> void interrupt our(); void interrupt(*prev)(); char far *scr=(char far*)0xB8000000L; void main() { unsigned long int far *p; p=(char far*)36; prev=*p; *p=our; keep(0,1000);

49

} void interrupt our() { int i,col=40; int row=5,rnd; randomize(); rnd=(random(100)%25); sound(rnd*100); *(scr+row*160+col*2)=(65+rnd); delay(50); nosound(); (*prev)(); } CONCLUSION The program was successfully executed and the output is obtained correctly

50

Exp.No.17

MIRROR IMAGE OF SCREEN


PROBLEM DEFINITION
Write a TSR program to change the current DOS screen with its mirror image

THOERETICAL BACKGROUND
First, we have to initialize a far pointer with the starting location of the video memory 0xB8000000L. Assign the address of the keyboard interrupt routine present on the IVT into a variable and assign that address to the interrupt function mytimer().

PSEUDOCODE
Begin Initialize a far pointer with the starting location of the video memory 0xB8000000L Assign the address of the keyboard interrupt routine present on the IVT into a variable Assign that address to the interrupt function our() Display character on the first line on the last and on last must be displayed on first. Keep the program resident in memory End

#include"dos.h" void interrupt (*prev)(); void interrupt our(); void writechar(char ch,int row,int col,int attr); int ticks=0; int running=0; unsigned long far *time=(unsigned long far*) 0x46c; char far* scr; char far* mode; void main() { scr=(char far*) 0xb8000000; prev=getvect(8); setvect(8,our); keep(0,1000); } void interrupt our() { int i,j,k; char t[80]; ticks++; if(ticks==18) {

51

ticks=0; if(running==0) { running=1; } for(i=0;i<25;i++) { for(k=0;k<=79;k++) { t[k]=*(scr+i*160+k*2); } k=0; for(j=79;j>=0;j--) { writechar(t[k],i,j,7); k++; } } } running=0; (*prev)(); } void writechar(char ch,int row,int col,int attr) { *(scr+row*160+col*2)=ch; *(scr+row*160+col*2+1)=attr; }

You might also like