Converting a Spreadsheet to a Different Bit3 Model or Op. Sys.!

by
R. Angstadt

Introduction (Goal)

To change a spreadsheet over from one bit3 flavor to another (say from a model 40x to a model 617) and/or from one operating system (say win 9x) to another (say NT) is conceptually simple as the code is modular: all of the bit3 code is in one vba (visual basic for applications) module. by cutting and pasting in the appropriate module one can change a sheet over pretty quickly (provided one is not going from a 617 to a 40x and there are calls to the routines that do a 32 bit long operation on the vme backplane which the 40x does not support as one end of it hangs on a 16 bit isa bus) to go from a 40x to a 617 should always work though! (upgrading... not downgrading)

To change a Win 9x worksheet for a 40x to an NT 617...

1. copy the desired spreadsheet to the target machine. (driver has been installed on the target machine previously... this does not cover driver installation...)

2. open it

3. press alt-f11 to get into the vb ide (visual basic integraded development environment)

4. in the upper left window scroll down to the "modules" branch and expand it by clicking on the plus to the left of it.... there should be an "io_32" module...

5. open the io_32 module by double clicking on it. the main window to the right should now show the code for this module:

"
' "mangled names" are a terrific (horrific) problem: below are the
' names as bit3_32.dll really exports them obtained by running microsoft's
' "dumpbin[.exe] /exports bit3_32.dll" [ > bit3_32.txt] (piped to a text file)
' that comes with the developers network sdk. (software develpment kit).
' note that quickview (the dll entry point viewer that ships with win95)
' does not find 32 bit names in 32 bit code either because of mangling) argh!
' note that 32 bit code exports are
' all lower case and that my 16 bit code was all upper.
' the @x is the number of bytes in the arguments. i read somewhere in the
' sdk help notes that arguements are always passed in extended registers
' (i.e., 32 bits) so a 16 bit integer takes up 4 bytes and not 2 bytes.
' the "_" means maybe something like "far" or export or microsoft (god)
' knows what. ("far" or "FAR" in 32 bit land is undefined as it's all
' 32... so it's probably a vestigal remnant (too late to change it now
' because it would break even more than mangling names!) now it most
' probably implies importing an externally exported function.
''
' ordinal hint name
'
' 1 0 _bootvme@0 (00001220)
' 2 1 _clrlatcherri@0 (000010AC)
' 3 2 _getlasterrps@4 (000010C1)
' 4 3 _initio@8 (000010FA)
' 5 4 _islatcherri@0 (00001097)
' 6 5 _readvmeb@4 (00001175)
' 7 6 _readvmei@4 (0000115A)
' 8 7 _readvmew@4 (00001134)
' 9 8 _setaddmoda@4 (00001119)
' 10 9 _setb32flgi@4 (000010DF)
' 11 A _writevmeb@8 (000011AF)
' 12 B _writevmei@8 (000011CE)
' 13 C _writevmeli@8 (000011ED)
' 14 D _writevmew@8 (00001190)
'
Declare Function InitIO Lib "BIT3_32.DLL" Alias "_initio@8" (i As Integer, l As Long) As Integer
' Besides initing the bit3, setting the address modifier, it initializes all
' secondary error handling bite.dll flags to the correct state including
' the internal static variable "abortflg"=0 =false (no failures) or 1= a failure
Declare Function islatcherri Lib "BIT3_32.DLL" Alias "_islatcherri@0" () As Integer
'returns true=1=a failure if a bit3 error detected since the last time
'initio() or clrlatcherri() was called. call getlasterrps() to find last error!
Declare Function clrlatcherri Lib "BIT3_32.DLL" Alias "_clrlatcherri@0" () As Integer
' set static variable "abortflg" to 0= false = no failures and should always return 0.
' the "c" code is:
'{ abortflg=FALSE;
' return abortflg; };
Declare Function getlasterrps Lib "BIT3_32.DLL" Alias "_getlasterrps@4" (ByVal s As String) As Integer
' tells what the last bit3 error was in english (more or less).
....
"

6. press ctrl-a (selects all of the text)

7. press the [backspace] key to delete it all!

8. double click on the file: \\d0server4\users\angstadt\b6nt\xlsnt617\io_NT617.txt notepad (or some other editor) should show the text:
"
'have managed to unmangle the names for the 617 driver!
'
Declare Function initio Lib "bntdv617.dll" (i As Integer, l As Long) As Integer
' Besides initing the bit3, setting the address modifier, it initializes all
' secondary error handling bite.dll flags to the correct state including
' the internal static variable "abortflg"=0 =false (no failures) or 1= a failure
Declare Function islatcherri Lib "bntdv617.dll" () As Integer
'returns true=1=a failure if a bit3 error detected since the last time
'initio() or clrlatcherri() was called. call getlasterrps() to find last error!
Declare Function clrlatcherri Lib "bntdv617.dll" () As Integer
' set static variable "abortflg" to 0= false = no failures and should always return 0.
' the "c" code is:
'{ abortflg=FALSE;
' return abortflg; };
Declare Function getlasterrps Lib "bntdv617.dll" (ByVal s As String) As Integer
' tells what the last bit3 error was in english (more or less).
' this is a noteworthy example of how to return call a "c" function that
' returns a pointer to a null terminated string which VBasic has troubles with.
....
"

9. select it all and paste it in the window of the vba ide where you deleted the previous text in it.

10. press alt-f11 to go back to excel.

your sheet should now work under NT with a 617. If you get any error messages saying something to the effect "Bit3_32.dll" not found then you didn't get it converted or you are exectuing code in another sheet (inadvertantly?) opened and not yet converted.

(any to any is possible if no calls specific to the 617 are used by a sheet, i.e. (from the file above): "
...
'new functions for the 617
Declare Function readvmeul Lib "bntdv617.dll" (lAdd As Long) As Long
Declare Function putvmeli Lib "bntdv617.dll" (lAdd As Long, lVal As Long) As Long
Declare Function getvmedmai Lib "bntdv617.dll" Alias "getvmedmal" (puladdress As Long, pulsize As Long, _
pulDMAaddmod As Long, pulislongDMA As Long, _
pulSwap As Long, puiary As Integer) As Long

Declare Function getvmedmal Lib "bntdv617.dll" (puladdress As Long, pulsize As Long, _
pulDMAaddmod As Long, pulislongDMA As Long, _
pulSwap As Long, pulary As Long) As Long

...
"

optional (extra) steps after 9 above:

10 (optional) instead of pressing alt-f11 to go back to excel help yourself and others keep track of what bit3 is in use by changing the module name from "io_32" to the suggested "io_nt617" for quick and easy bit3 identification. (in point of fact the "Declare Function anyfunctionname Lib "bntdv617.dll..." or ""Declare Function anyfunctionname Lib "any.dll"..." is what really determines what driver code the spreadsheet is trying to use.

11.(optional) then compile the code to see if vba is completely happy: vba ide "debug" menu pick and then "compile vba project" everything should be hunky dory but if it is not it will most probably call up the following flawed code in the "iomod1" module:

"....
Sub changetooltips()
' from p.c. magazine pg.342 Sept. 27, 1974. this is how to (re-)name the little button
' pop up menus labels. if cancel is selected in the pop up menu the name reverts back to default
' work in all cases. Reputedly written by Microsoft...
   Set MyToolbar = Toolbars("Bit3")
   For Each MyTool In MyToolbar.ToolbarButtons
     Message = "Enter a new tooltip description"
     Title = "Tooltip Changer"
     Default = MyTool.Name

     'If tool is not a gap, display input box
     If Not MyTool.IsGap Then
       myvalue = InputBox(Message, Title, Default)
       'Change tooltip name
       MyTool.Name = myvalue
     End If
   Next
End Sub
.....
"

apologies this was early code that originally worked under an earlier excel version but sometimes fails under later 32 bit ones. better code that is think always should compile is:

"
Sub changetooltips()
' from p.c. magazine pg.342 Sept. 27, 1974. this is how to (re-)name the little button
' pop up menus labels. if cancel is selected in the pop up menu the name reverts back to default
' work in all cases. Reputedly written by Microsoft...
   Dim szMessage As String
   Dim szTitle As String
   Dim szDefault As String
     Set MyToolbar = Toolbars("Bit3")
     For Each MyTool In MyToolbar.ToolbarButtons
       szMessage = "Enter a new tooltip description"
       szTitle = "Tooltip Changer"
       zDefault = MyTool.Name

       'If tool is not a gap, display input box
       If Not MyTool.IsGap Then
         myvalue = InputBox(szMessage, szTitle, szDefault)
         'Change tooltip name
         MyTool.Name = myvalue
       End If
     Next
End Sub
"

or you can try deleting this subroutine as its pretty much dead code and
not called by anything..

the sheet should now compile....

12. press alt-f11 to go back to excel and run the macros.

Addendium:

The Bit3 "Button Bar" that some spreadsheets use and that the above code refers to is in a file excel8.xlb. If you need or want to use it do the following:

1. copy the file: "\\d0server4\users\angstadt\b6nt\xlsnt617\excel8.xlb" into his "c:\winnt" sub directory...

2. replace the vb code in the "iomod1" module with the code from the file "\\d0server4\users\angstadt\xlsnt617\iomod1b.txt" (this has the code fix the "Default" changetooltips patch above in it as well so you can just do this and upgrade the sheet to the latest patches of this module....)

compile, alt-f11, and the "aaafixbuttonbar" should work.... if it doesn't you can open it yourself by going to the "file", "open", and selecting "c:\winnt\excel8.xlb" and it should now appear.... (sometimes windows seem to catch on that the file is now suddenly there... and returns that it is not when it is... so you have to do it the first time manually...)

now does the "aafixbuttonbar" button (finally) work???

(if not copy a few buttons, rename them to "kick crate", and "init 617" and assign them to the macros "initvme" "VB_bootVME" by right clicking on the button you copied and selecting the appropriate macro and then clicking on o.k.) on the pages you want to use.

note(s).

1. its a lot easier to work on the sheet if you only have one open at a time. Its very useful to check this from time to time: when in excel and not the VBA IDE go to "Window" menu pick and check how many workbooks are actually open!

2. sources of other vba modules to paste in in place of io_*: (correct driver previously installed...)

Converting (most) any sheet to work under windows 9x with a 40x:

Copy the vb code from "\\d0server4\users\angstadt\b3allms\xls32\io_32.txt"
(for office 97 code or above)
(for old excel version 5 (office 4.x) use the vb code
from "\\d0server4\users\angstadt\xls\io_p.txt"
(be nice and rename the module similar to the source file name...)

Converting (most) any sheet to work under NT with a 40x:

copy the vb code from "\\d0server4\users\angstadt\b4nt\io_NT40x.txt"

Converting (most) any sheet to work under NT with a 616,617,or 618:

copy the vb code from
"\\d0server4\users\angstadt\b6nt\xlsnt617\io_NT617.txt"

Converting (most) any sheet to work under win 9x with a 616,617,or 618:

Copy the vb code from "\\d0server4\users\angstadt\b6_2\32\io_617.txt"
(no version available for old 16 bit excel version 5 under nt for the 61x
series! only true 32 bit versions of excel supported!)

Converting (most) any sheet to work under NT with a Bit3 V5B embedded processor:

(pentium @200 mhz with a tundra universe pci to vme bridge chipset) use
the vb code from "\\d0server4\users\angstadt\embedv5bnt\xlsntv5b\io_NTv5b.txt"
Sorry, I don't have anything for running win 9x on this processor!
also this is for 32 bit versions of excel only. (no code for
old office 4.x excel versions 5 and/or first version of office 95= excel version 6.)