bonjours a tous j'ai un probleme je voudrais traduir un programme c en pascal et je n'arrive pas s'ils vous plais aidez moi
voici le programme#include <dos.h>
#include <stdio.h>
#include <conio.h>
#include <stdlib.h>
#define COM1 0
#define COM2 1
#define COM3 2
#define COM4 3
#define PAIRE 24
#define IMPAIRE 8
#define SANS 0
#define COM COM2
/* definition des registres du 8250 */
int RBR[4]={0x3F8, 0x2F8, 0x370, 0x270},
THR[4]={0x3F8, 0x2F8, 0x370, 0x270},
DLL[4]={0x3F8, 0x2F8, 0x370, 0x270},
DLH[4]={0x3F9, 0x2F9, 0x371, 0x271},
IER[4]={0x3F9, 0x2F9, 0x371, 0x271},
IIR[4]={0x3FA, 0x2FA, 0x372, 0x272},
LCR[4]={0x3FB, 0x2FB, 0x373, 0x273},
MCR[4]={0x3FC, 0x2FC, 0x374, 0x274},
LSR[4]={0x3FD, 0x2FD, 0x375, 0x275},
MSR[4]={0x3FE, 0x2FE ,0x376, 0x276};
void INIT_COM(char port, long vitesse, int longueur, char parite, char stop)
{
unsigned char tempo;
outportb(IER[port], 0);
outportb(LCR[port], 128);
tempo = (unsigned char)((115200 / vitesse)&0x000000FF);
outportb(DLL[port], tempo);
tempo = (unsigned char)(((115200 / vitesse)&0x0000FF00)>>8);
outportb(DLH[port], tempo);
switch(parite)
{
case 'P': tempo = PAIRE; break;
case 'T': tempo = IMPAIRE; break;
case 'S': tempo = SANS; break;
}
if (stop == 2)
tempo = tempo | 0x04;
tempo = tempo | (longueur - 5);
outportb(LCR[port], tempo);
}
// Transmission d'un caractère
void TRANS_CAR(char port, char car)
{
while ((inportb(LSR[port])&32)!=32);
outportb(THR[port],car);
}
//Réception d'un caractère
unsigned RECEPT_CAR(char port)
{
if ((inportb(LSR[port])&0x01)==1)
return(inportb(RBR[port]));
else
return(0);
}
Pour transmettre un caractère
void main(void)
{
INIT_COM(COM2, 2400, 8, 'P', 2);
TRANS_CAR(COM2,'a');
}
Pour transmettre une suite de caractère
void main(void)
{
int i;
INIT_COM(COM2, 2400, 8, 'P', 2);
for (i=1;i<27;i++)
TRANS_CAR(COM2,'a'+i);
}
Pour réceptionner un caractère
void main(void)
{
char reception;
int i;
INIT_COM(COM2, 2400, 8, 'P', 2);
reception =RECEPT_CAR(COM2);
printf("%c",reception);
}