2.9hayvailon

// 2_9.cpp : Defines the entry point for the console application.

#include "stdafx.h"

#include <PCIXP.h>

#include <conio.h>

void QuayPhai(int PortA, int delay)

{

int Temp=1;

for(int i=0;i<4;i++)

{

outportb(PortA,Temp);

Sleep(delay);

Temp=Temp*2;

}

}

void QuayTrai(int PortA, int delay)

{

int Temp=8;

for(int i=0;i<4;i++)

{

outportb(PortA,Temp);

Sleep(delay);

Temp=Temp/2;

}

}

int main(int argc, char* argv[])

{

int PortA;

PortA=Get_Addr("PCI_8255");

outportb(PortA+3,0x80);

int delay=70;

do

{

if(getch()=='t') QuayTrai(PortA,delay);

else if(getch()=='p') QuayPhai(PortA,delay);

if(getch()=='u') delay=delay-5;

else if(getch()='d') delay=delay+5;

}while(getch()!='e');

return 0;

}

Bạn đang đọc truyện trên: AzTruyen.Top

Tags: #may#tinh