da li ti ovo treba?? (radjeno u Borland c++ Builder-u)
// Program upisuje i ocitava Bajt sa hardverskog porta.
//
// U programu se koristi paralelni port (njegov "Data" registar)
// sa adresom 0x378. Na bit D0 (hardverski pin 2) treba spojiti
// LE Diodu koja ce biti paljena i gasena
//
// Za kreiranje aplikacije
// korisceno je integrisano okruzenje
// "Borland Builder 3.0 (Client/Server Suite)"
//
// Autor: Boris Markovic
// 25/05/1999
//
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "UPortovi.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void outp(short int portid, unsigned char byte_value)
{
asm
{
mov al,byte_value // upis vrijednosti u al
mov dx,portid // upis adrese porta u dx
out dx,al // upis al (byte_value) na dx (portid)
}
}
unsigned char inp(short int portid)
{unsigned char byte_value;
asm
{
mov dx,portid // upis adrese porta u dx
in al,dx // upis vrijednosti sa dx (portid) u al
mov byte_value,al // upis al u byte_value
}
return byte_value;
}
void __fastcall TForm1::Button1Click(TObject *Sender)
{
outp(0x378,0x01);
Panel1->Caption="Stanje na portu 0x378: "+IntToStr(inp(0x378));
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button2Click(TObject *Sender)
{
outp(0x378,0x00);
Panel1->Caption="Stanje na portu 0x378: "+IntToStr(inp(0x378));
}
//---------------------------------------------------------------------------
void __fastcall TForm1::FormCreate(TObject *Sender)
{
Panel1->Caption="Stanje na portu 0x378: "+IntToStr(inp(0x378));
}
//---------------------------------------------------------------------------
[Ovu poruku je menjao fucking voodoo dana 10.07.2005. u 10:53 GMT+1]
there's something out there
waiting for us,
and it ain't no man...