FrHackNight023

From Hackerspace Brussels
Jump to: navigation, search


FrHackNight023
Fri 04 Mar 2011 19:30
till Sat 05 Mar 2011 6:00
Hack.jpg
What:
Friday Hack Night
Tagline:
8 bits wide and exhume old demons from the DOS era
Where:
HSB Brussels,Belgium
Cost:
0
Who:
URL:
  • Due to lack of preparation, we will just collect documentation about the parallel port for a few future projects:
    • Simple printer emulation, to study the timing and handshaking. Good moment to dust off our logic analyser.
    • LCD interface
    • Eprom programmer
    • Relay board for The Gate
    • Add your own :-)

What we have so far

  • A bunch of links to documentation
  • A breadboard with LEDs and a DIP switch
  • Some code to make it work (Free Pascal FTW)

Talk is cheap. Show me the code !!

program lpttest;                                                                                                                
uses crt, go32, strings;                                                                                                        
CONST ppdata=$378; ppstatus=ppdata+1; ppcontrol=ppdata+2; eppdata=ppdata+4;                                                     
var i: byte;                                                                                                                    
                                                                                                                                
function bytetobits (bytetodump: byte): string[8];                                                                              
const bits: ARRAY[0..1] of char='_�';                                                                                           
var j: byte;                                                                                                                    
begin                                                                                                                           
bytetobits[0]:=#8;                                                                                                              
for j:=8 downto 1 do                                                                                                            
        begin                                                                                                                   
        bytetobits[j]:=bits[(bytetodump and 1) mod 2];                                                                          
        bytetodump:=bytetodump shr 1;                                                                                           
        end;                                                                                                                    
end;                                                                                                                            
                                                                                                                                
begin                                                                                                                           
outportb (ppcontrol, (inportb (ppcontrol) or 32 ));                                                                             
                                                                                                                                
clrscr;                                                                                                                         
                                                                                                                                
gotoxy (10,8); write ('statusport:'); gotoxy (40,8); write ('dataport:');                                                       
gotoxy (10,9); write ('76543210'); gotoxy (40,9); write ('76543210');                                                           
gotoxy (10,18); write ('controlport:'); gotoxy (40,18); write ('eppdata:');                                                     
gotoxy (10,19); write ('76543210'); gotoxy (40,19); write ('76543210');                                                         
                                                                                                                                
{for i:=0 to 255 do                                                                                                             
        begin                                                                                                                   
        gotoxy (6,10); write (i);                                                                                               
        gotoxy (10,10);                                                                                                         
        write (bytetobits (i));                                                                                                 
        outportb (ppdata,i);                                                                                                    
        delay (100);                                                                                                                        
        end;                                                                                                                    
}                                                                                                                               
                                                                                                                                
repeat                                                                                                                          
        i:=inportb (ppstatus);                                                                                                  
        gotoxy (3,10); write ('  ',i,'  ');                                                                                     
        gotoxy (10,10);                                                                                                         
        write (bytetobits (i));                                                                                                 

{        outportb (eppdata,0);}                                                                                                 
        i:=inportb (ppdata);                                                                                                    
        gotoxy (33,10); write ('  ',i,'  ');                                                                                    
        gotoxy (40,10);                                                                                                         
        write (bytetobits (i));                                                                                                 

        i:=inportb (ppcontrol);                                                                                                 
        gotoxy (3,20); write ('  ',i,'  ');                                                                                     
        gotoxy (10,20);                                                                                                         
        write (bytetobits (i));                                                                                                 

        i:=inportb (eppdata);                                                                                                   
        gotoxy (33,20); write ('  ',i,'  ');                                                                                    
        gotoxy (40,20);                                                                                                         
        write (bytetobits (i));                                                                                                 
                                                                                                                                
        delay (100);                                                                                                            
until keypressed;                                                                                                               
                                                                                                                                
readkey;                                                                                                                        
                                                                                                                                
{repeat                                                                                                                         
         outportb (ppdata,$aa);                                                                                                 
        delay (200);                                                                                                            
        outportb (ppdata,$55);                                                                                                  
        delay (200 );                                                                                                           
until keypressed;                                                                                                               
}                                                                                                                               
                                                                                                                                
{for i:=1 to 255 do                                                                                                             
        begin                                                                                                                   
        outportb (ppdata,i);                                                                                                    
        delay (200);                                                                                                            
        end;                                                                                                                    
}                                                                                                                               
                                                                                                                                
{                                                                                                                               
outportb (ppdata,$55);                                                                                                          
delay (400);                                                                                                                    
outportb (ppcontrol, $00);                                                                                                      
delay (400);                                                                                                                    
outportb (ppdata,$aa);                                                                                                          
delay (400);                                                                                                                    
outportb (ppcontrol, $ff);                                                                                                      
delay (400);                                                                                                                    
outportb (ppdata,$55);                                                                                                          
}                                                                                                                               
                                                                                                                                
end.                                                                                                                                

In pictures:

IMG 0664.JPG

The goal:

Relay Board IFace Proto.JPG


also

and also (unrelated) : a first look at Gameduino FPGA/gameduino