whats new ¦  programming tips ¦  indy articles ¦  intraweb articles ¦  informations ¦  links ¦  interviews
 misc ¦  tutorials ¦  Add&Win Game

Tips (1541)

Database (90)
Files (137)
Forms (107)
Graphic (114)
IDE (21)
Indy (5)
Internet / LAN (130)
IntraWeb (0)
Math (76)
Misc (126)
Multimedia (45)
Objects/
ActiveX (51)

OpenTools API (3)
Printing (35)
Strings (83)
System (266)
VCL (242)

Top15

Tips sort by
component


Search Tip

Add new Tip

Add&Win Game

Advertising

28 Visitors Online


 
...write data to the printer port?
Autor: Ramon Schenkel
[ Print tip ]  

Tip Rating (4):  
     


procedure Out32(portadresse: Word; wert: Byte);
var
  
val: Byte;
begin
  
val := Byte(wert);
  asm
    
push dx
    mov dx,portadresse
    mov al,val
    out dx,al
    pop dx
  end;
end;

function Inp32(portadresse: Word): Byte;
var
  
val: Byte;
begin
  asm
    
push dx
    mov dx,portadresse
    in al,dx
    mov val,al
    pop dx
  end;
  Inp32 := Byte(val) and $00ff;
end;


// Example/Beispiel:

  
Out32($378, 0)  {= Dataport all 8 Bit Low}
  
Out32($378, (Inp32($378) or 1); {Dataport Bit 1 High}
  
Out32($378, (Inp32($378) and 254);  {Datap. Bit 1, Low}


 

Rate this tip:

poor
very good


Copyright © by SwissDelphiCenter.ch
All trademarks are the sole property of their respective owners