Rob van der Woude's Scripting Pages
Powered by GeSHi

Source code for videorom.rex

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

  1. /* Read video display adapter manufacturer info from adapter ROM */
  2.  
  3. /* Display blank line */
  4. Say
  5.  
  6. /* Check for command line parameters (none required) */
  7. Parse arg strArgs
  8. If strArgs <> "" Then Call Syntax
  9.  
  10. /* Disable unwanted screen output */
  11. "@ECHO OFF"
  12. Trace Off
  13.  
  14. /* Initialize variables */
  15. rxCrLf = X2C( 0D0A )
  16. strDbg = "D C000:0040" || rxCrLf || "D C000:00C0" || rxCrLf || "Q"
  17. strRom = ""
  18.  
  19. /* Define temporary file names */
  20. Parse Source . . strSrc .
  21. filDbg = SubStr( strSrc, 1, LastPos( ".", strSrc ) ) || "dbg"
  22. filRom = SubStr( strSrc, 1, LastPos( ".", strSrc ) ) || "rom"
  23.  
  24. /* Create temporary Debug script */
  25. Call LineOut filDbg, strDbg
  26. Call LineOut filDbg
  27.  
  28. /* Read video ROM using Debug script and store info in temporary file */
  29. "DEBUG < " || filDbg || " > " || filRom
  30.  
  31. /* Read video ROM info from temporary file and store in string */
  32. Call LineIn filRom, 1, 0
  33. Do Until Lines( filRom ) = 0
  34. 	strRom = strRom || SubStr( LineIn( filRom ), 62 )
  35. End
  36.  
  37. /* Close temporary files */
  38. Call LineOut filDbg
  39. Call LineOut filRom
  40.  
  41. /* Delete temporary files */
  42. "DEL " || filDbg || " > NUL"
  43. "DEL " || filRom || " > NUL"
  44.  
  45. /* Cut everything from string before the first "word" */
  46. strRom = StripString( 1, strRom )
  47.  
  48. /* Convert string to array of chars */
  49. Do i = 1 by 1 To Length( strRom )
  50. 	chrRom.0 = i
  51. 	chrRom.i = SubStr( strRom, i, 1 )
  52. End
  53.  
  54. /* Remove non-ASCII and other unwanted characters. */
  55. /* This part may need some fine tuning; please     */
  56. /* notify me of any changes you need to make.      */
  57. strRom = ""
  58. Do i = 2 To chrRom.0
  59. 	If DataType( chrRom.j, "S" ) = 1 Then boolAppend = 1
  60. 	j = i - 1
  61. 	If chrRom.i = "." Then Do
  62. 		boolAppend = 0
  63. 		If DataType( chrRom.j, "A" ) = 1 Then boolAppend = 1
  64. 		If chrRom.j = " " Then boolAppend = 1
  65. 		If chrRom.j = "-" Then boolAppend = 1
  66. 		If chrRom.j = "_" Then boolAppend = 1
  67. 	End
  68. 	If boolAppend = 1 Then strRom = strRom || chrRom.j
  69. End
  70.  
  71. /* Display result */
  72. Say strRom
  73.  
  74. /* Done */
  75. EXIT 0
  76.  
  77.  
  78. /* Cut everything from string before the first "word". */
  79. /* This part may need some fine tuning; please         */
  80. /* notify me of any changes you need to make.          */
  81. StripString:
  82. 	Parse Arg start, strIn
  83. 	posSpace = Pos( " ", strIn, start )
  84. 	If posSpace > 0 Then Do
  85. 		lposDot = LastPos( ".", SubStr( strIn, 1, posSpace ) )
  86. 		If lposDot > 0 Then Do
  87. 			strIn = SubStr( strIn, lposDot + 1 )
  88. 			/* Repeat if length of first word is less then 3 */
  89. 			posDot  = Pos( ".", strIn )
  90. 			If posDot > 0 & posDot < 4 Then Do
  91. 				Call StripString 4, strIn
  92. 			End
  93. 		End
  94. 	End
  95. Return strIn
  96.  
  97. Syntax:
  98. 	Say "VideoROM.rex,  Version 1.00"
  99. 	Say "Display video adapter manufacturer information read from video ROM"
  100. 	Say
  101. 	Say "Usage:  <REXX>  VIDEOROM.REX"
  102. 	Say
  103. 	Say 'Where:  "<REXX>" is your Rexx interpreter:'
  104. 	Say "                 - Windows:  REGINA.EXE or REXX.EXE, whichever you installed"
  105. 	Say "                             (tested with Regina Rexx only!)"
  106. 	Say "                 - OS/2:     no need to specify, just rename script to *.cmd"
  107. 	Say
  108. 	Say "This Rexx script uses DEBUG.EXE to read the video ROM"
  109. 	Say
  110. 	Say "Written by Rob van der Woude"
  111. 	Say "http://www.robvanderwoude.com"
  112. 	Say "Original idea by ComputerHope"
  113. 	Say "http://www.computerhope.com/rdebug.htm"
  114. 	EXIT 1
  115. Return
  116.  

page last uploaded: 2017-04-06, 13:33