Rob van der Woude's Scripting Pages
Powered by GeSHi

Source code for videorom.pl

(view source code of videorom.pl as plain text)

  1. #! perl
  2.  
  3. # Store help text in variable
  4. $syntax = "\nVideoROM.pl,  Version 2.00 for DOS, Windows & OS/2\n";
  5. $syntax = $syntax."Display video adapter manufacturer information read from video ROM\n\n";
  6. $syntax = $syntax."Usage:  VIDEOROM.PL  [ DEBUG ]\n\n";
  7. $syntax = $syntax."Where:  \"DEBUG\" will display intermediate results for debugging purposes.\n\n";
  8. $syntax = $syntax."This script uses DEBUG.EXE to read the information from video ROM.\n";
  9. $syntax = $syntax."Tested in Windows 2000 only.\n\n";
  10. $syntax = $syntax."Written by Rob van der Woude\n";
  11. $syntax = $syntax."http://www.robvanderwoude.com\n\n";
  12. $syntax = $syntax."Original idea by ComputerHope\n";
  13. $syntax = $syntax."http://www.computerhope.com/rdebug.htm\n\n\n\n\n";
  14.  
  15. # Check command line argument(s)
  16. if ( $ARGV[0] ) {
  17. 	if ( $ARGV[0] =~ m/^DEBUG$/i ) {
  18. 		$debugmode = true;
  19. 	} else {
  20. 		print $syntax;
  21. 	}
  22. }
  23.  
  24. # Create temporary DEBUG script
  25. $dbg = "D C000:0040\nD C000:00C0\nQ\n";
  26. open( DBGSCR, "> videorom.dbg" ) || die( "Cannot open temporary DEBUG script: $!" );
  27. print DBGSCR $dbg;
  28. close DBGSCR;
  29.  
  30. # Run DEBUG script and store output in array
  31. @viddbg = `debug.exe < videorom.dbg`;
  32.  
  33. if ( $debugmode ) {
  34. 	foreach $_ (@viddbg) {
  35. 		print $_;
  36. 	}
  37. }
  38.  
  39. # Concatenate relevant parts of screen output into one single line
  40. $line = "";
  41. foreach $_ (@viddbg) {
  42. 	chomp $_;
  43. 	$line = $line.substr( $_, 61 );
  44. 	if ( $debugmode ) {
  45. 		print substr( $_, 61 )."\n";
  46. 	}
  47. }
  48.  
  49. if ( $debugmode ) {
  50. 	print "$line\n";
  51. }
  52.  
  53. # Use some regular expressions to tidy up the output before display
  54. $line =~ m/\.([\w]+ +[^\s.]+.*$)/;
  55. $line = $1;
  56. $line =~ s/\.*$//;
  57.  
  58. # Display the result
  59. print "\nYour video adapter info:\n\n".$line."\n";
  60.  
  61. # Delete temporary DEBUG script
  62. `DEL videorom.dbg >NUL 2>&1`;
  63.  

page last modified: 2024-04-16; loaded in 0.0067 seconds