Current area: HOME ->

Zip File view

I wrote this program to show me just which ports were being


This page allows you to view the contents of a file contained inside a ZIP archive available at Programmer's Heaven. This means you can view the code and find what you need from it without having to download the ZIP file first. If the file contains source code for a language we recognize, we have syntax highlighted it.

Filename displayed: PORTUSE.PAS
Found in file: PORTUSE.ZIP

Download: League For Programming Freedom Programming Freedom, Number 8
program portuse;
{read io ports twice, compare, report differences}
{Dec 13 89 Bob Gardner initial edit}
{Jan 3 94 Bob G use hex unit}
{Dec 2 96 Bob G clean up to send to aol}

uses
  crt,hex;

type
  Tarr=array[0..$ff] of byte;

var
  i,baseport,err: integer;
  buf: Tarr;
  linbuf: array[0..15] of byte;
  c: char;

{--------------------}
procedure compbuf(p: integer);
{compare port contents starting at port p to buf}

var
  i,j,b,ndx: integer;
  c: char;

begin
  gotoxy(1,1);
  lowvideo;
  write('     ');
  for i:=0 to 15 do begin
    write(btohex(i),' ');       {header}
    if i=7 then write(' ');
  end;
  writeln;
  writeln;
  for i:=0 to 15 do begin       {for 16 rows}
    lowvideo;
    write(itohex(p+i*16),' '){port addr}
    for j:=0 to 15 do begin     {16 hex bytes}
      ndx:=i*16+j;
      b:=port[p+ndx];           {get byte from port}
      linbuf[j]:=b;             {save it in linbuf for ascii dump}
      if b=buf[ndx] then        {same as last pass?}
        lowvideo
      else
        highvideo;
      write(btohex(b),' ');     {dump hex}
      if j=7 then write(' ');
    end;
    write('  ');

    for j:=0 to 15 do begin
      ndx:=i*16+j;
      c:=chr(linbuf[j]);        {dump ascii}

      if c=chr(buf[ndx]) then   {same as last pass?}
        lowvideo
      else
        highvideo;
      if ord(c)>$20 then
        write(c)
      else
        write('.');
      if j=7 then write(' ');

      buf[ndx]:=b;              {update last pass buf}
    end;
    writeln;
  end;
  writeln;
end;

{--------------------}
begin {main program}
  writeln('Portuse     Dec 2 96 [[Email Removed]]');
  if paramcount<>1 then begin
    writeln('usage: C>portuse 0|$100|$200|$300');
    exit;
  end;
  val(paramstr(1),baseport,err);
  for i:=0 to $ff do begin {fill buff initially}
    buf[i]:=port[baseport+i];
  end;
  clrscr;
  repeat
    compbuf(baseport);
  until keypressed;
  c:=readkey;
end.


How to hook-up a MicroSoft mouse to an Atari ST

TP&Asm Integrated Compile-Time Assembler Version 2.2
Built-In Assembly Language Support for Turbo Pascal Compilers TP&Asm is an integrated assembler for Turbo Pascal versions 5.5, 5.0, and 4.0 which operates during the compile step to provide...
League For Programming Freedom Programming Freedom, Number 8

Download How to hook-up a MicroSoft mouse to an Atari ST Download TP&Asm Integrated Compile-Time Assembler Version 2.2 Built-In Assembly Language Support for Turbo Pascal Compilers  TP&Asm is an integrated assembler for Turbo Pascal versions  5.5, 5.0, and 4.0 which operates during the compile step to  provide... Download League For Programming Freedom Programming Freedom, Number 8







Sponsored links

Build IT Knowledge with Current & Trusted Content
Helps Employees Develop & Hone New Technical Programming Skills. Sign Up & Get Full Access.
Check Out IT Certification Preparation Materials
Sign Up With SkillSoft & Get Access to Training Materials for Over 50 Professional Certifications.
Villanova University Six Sigma & IT Certificate Programs
100% Online programs in Six Sigma, IS Security, CISSP Prep, Business Analysis, Proj. Mgmt. and more!
Localize software in three simple steps
Localize .Net, C/C++ & Delphi apps visually. HTML, HTML Help, XML & databases. Try Sisulizer now!
Localize Delphi software in three simple steps
Localize Delphi VCL & .Net apps visually. Plus HTML, HTML Help, XML & databases. Try Sisulizer now!


Newsletter | Submit Content | About | Advertising | Awards | Contact Us | Link to us |
© 1996-2008 Community Networks Ltd All rights reserved. Reproduction in whole or in part, in any form or medium without express written permission is prohibited. Violators of this policy may be subject to legal action. Please read Terms Of Use and Privacy Statement for more information. Development by Synchron Data - .NET development.