Presentation is loading. Please wait.

Presentation is loading. Please wait.

Lecture 10.

Similar presentations


Presentation on theme: "Lecture 10."— Presentation transcript:

1 Lecture 10

2 unsigned int divisor = 0x21FF; while (divisor >= 0x50) {
unsigned long int * time = (unsigned long int *) 0x C void main() { unsigned long int tx; unsigned int divisor = 0x21FF; while (divisor >= 0x50) { outportb(0x43,0xB4); outportb(0x42,*((char*)(&divisor))); outportb(0x42,*(((char*)(&divisor))+1)); outportb(0x61,Inportb(0x61) | 3); tx = *time; tx = tx + 4; while (*time <= tx); divisor =divisor -30; }

3 #include <dos.h>
#include <bios.h> void interrupt (*oldint15) ( ); void interrupt newint15 (unsigned int BP, unsigned int DI, unsigned int SI, unsigned int DS, unsigned int ES, unsigned int DX, unsigned int CX, unsigned int BX, unsigned int AX, unsigned int CS, unsigned int IP, unsigned int flags); void main ( ) { oldint15 = getvect (0x15); setvect (0x15, newint15); keep (0, 1000); }

4 void interrupt newint15( unsigned int BP, unsigned int DI,
unsigned int SI, unsigned int DS, unsigned int ES, unsigned int DX, unsigned int CX, unsigned int BX, unsigned int AX, unsigned int CS, unsigned int IP, unsigned int flags) { if (_AH = = 0x4F) { if (_AL == 0x1F) outport (0x43, 0xB4); outport (0x42, 0xFF); outport (0x42, 0x21); outport (0x61, Inport(0x61) ^ 3); } else (*oldint15) ( );

5 #include <dos. h> #include <bios
#include <dos.h> #include <bios.h> unsigned int divisors[4]={0x21ff,0x1d45,0x1b8a,,0x1e4c}; unsigned long int far *time =(unsigned long int far *)0x C; void main () { unsigned long int tx; int i=0; while (!kbhit()) { while (i<4) { outport(0x43,0xB4); outport(0x42,*((char *)(&divisor[i]))); outport(0x42,*(((char *)(&divisor[i]))+1)); outport(0x61, inport(0x61)|3); tx=*time; tx=tx+4; while (tx >= (*time)); i++; } i=0; } outport(0x61,inport(0x61)&0xFC); }

6 #include <stdio. h> #include <dos. h> #include <bios
#include <stdio.h> #include <dos.h> #include <bios.h> struct tagTones { unsigned int divisor; unsigned int delay; }; struct tagTones Tones[4]={ {0x21ff,3},{0x1d45,2},{0x1b8a,3},{0x1e4c,4}}; int i,ticks,flag=0 ; void interrupt (*oldint15)(); void interrupt (*oldint8)(); void interrupt newint15(); void interrupt newint8();

7 unsigned char far *scr =
(unsigned char far *)(0x ); void main () { oldint15=getvect(0x15); setvect(0x15,newint15); oldint8=getvect(0x08); setvect(0x08,newint8); keep(0,1000); }

8 void interrupt newint15() { if (_AH==0x4f) {. if ((_AL==0x1f)&&(((
void interrupt newint15() { if (_AH==0x4f) { if ((_AL==0x1f)&&(((*scr)&12)==12)) { ticks=0; i=0; outport(0x43,0xb4); outport(0x42,*((char *)(&Tones[i].divisor))); outport (0x42,*(((char *)(&Tones[i].divisor))+1)); outport(0x61,inport(0x61)|3); flag=1; } else if ((_AL==0x1E)&&(((*scr)&12)==12)) { outport(0x61,inport(0x61)&0xfc); flag=0; } return; } (*oldint15)(); }

9 void interrupt newint8() { if (flag==1) {. ticks++;
void interrupt newint8() { if (flag==1) { ticks++; if (ticks == Tones[i].delay) { if (i==3) i=0; else i++; outport (0x43, 0xB4); outport(0x42,*((char *)(&Tones[i].divisor))); outport(0x42,*(((char *)(&Tones[i].divisor))+1)); outport(0x61,inport(0x61)|3); ticks = 0; } } (*oldint8)(); }

10 Parallel Ports (PPI)

11 Parallel Communication
Output D0 D7 Strobe Busy CPU D1 D2 Parallel Out Put Device

12 Parallel Communication
Input D0 D1 D2 Parallel Input Device CPU D7 DR CPU I/O Controller

13 Only Economically Feasible For Small Distances
Parallel Communication Faster Only Economically Feasible For Small Distances


Download ppt "Lecture 10."

Similar presentations


Ads by Google