Discussion:
Native Code vs PCode
(too old to reply)
Ivan Debono
2005-09-02 06:15:42 UTC
Permalink
Hi all,

I've got some activex dlls that access a database, retrieve recordsets, loop
through them, calculate stuff, etc...

Would it make a big difference if I compiled to PCode instead of Native Code
(Fast Code)??

The difference is in the size which is important for me as I need to package
everything in a setup file and make it available on the internet for
downloading.

Thanks,
Ivan
Tom Esh
2005-09-02 07:45:36 UTC
Permalink
On Fri, 2 Sep 2005 08:15:42 +0200, "Ivan Debono"
Post by Ivan Debono
Hi all,
I've got some activex dlls that access a database, retrieve recordsets, loop
through them, calculate stuff, etc...
Would it make a big difference if I compiled to PCode instead of Native Code
(Fast Code)??
The difference is in the size which is important for me as I need to package
everything in a setup file and make it available on the internet for
downloading.
Very unlikely you would see much improvement with native unless you're
doing a ~lot~ of calculations. It's easy enough to build & test each
way though if you want to be certain.

-Tom
MVP - Visual Basic
(please post replies to the newsgroup)
M. Posseth
2005-09-02 09:54:12 UTC
Permalink
If you have the Professional or Enterprise edition of Visual Basic, you can
compile your code either in standard Visual Basic p-code format or in native
code format. Native code compilation provides several options for optimizing
and debugging that aren't available with p-code.

P-code, or pseudo code, is an intermediate step between the high-level
instructions in your Basic program and the low-level native code your
computer's processor executes. At run time, Visual Basic translates each
p-code statement to native code. By compiling directly to native code format,
you eliminate the intermediate p-code step.

You can debug compiled native code using standard native code debugging
tools, such as the debugging environment provided by Visual C++. You can also
use options available in languages such as Visual C++ for optimizing and
debugging native code. For example, you can optimize code for speed or for
size.

Note All projects created with Visual Basic use the services of the
run-time DLL (MSVBVM60.DLL). Among the services provided by this DLL are
startup and shutdown code for your application, functionality for forms and
intrinsic controls, and run-time functions like Format and CLng.

Compiling a project with the Native Code option means that the code you
write will be fully compiled to the native instructions of the processor
chip, instead of being compiled to p-code. This will greatly speed up loops
and mathematical calculations, and may somewhat speed up calls to the
services provided by MSVBVM60.DLL. However, it does not eliminate the need
for the DLL.

regards

Michel Posseth [MCP]
Post by Tom Esh
On Fri, 2 Sep 2005 08:15:42 +0200, "Ivan Debono"
Post by Ivan Debono
Hi all,
I've got some activex dlls that access a database, retrieve recordsets, loop
through them, calculate stuff, etc...
Would it make a big difference if I compiled to PCode instead of Native Code
(Fast Code)??
The difference is in the size which is important for me as I need to package
everything in a setup file and make it available on the internet for
downloading.
Very unlikely you would see much improvement with native unless you're
doing a ~lot~ of calculations. It's easy enough to build & test each
way though if you want to be certain.
-Tom
MVP - Visual Basic
(please post replies to the newsgroup)
Tony Proctor
2005-09-02 11:33:26 UTC
Permalink
I guess you haven't seen any of the previous threads on this subject, e.g.
http://groups.google.ie/group/microsoft.public.vb.general.discussion/browse_frm/thread/0d579a81dc11e19c/117fe49d249e3c8a?hl=en#117fe49d249e3c8a

The point being that P-code is interpreted rather than being converted to
native code via a JIT compiler

Tony Proctor
Post by M. Posseth
If you have the Professional or Enterprise edition of Visual Basic, you can
compile your code either in standard Visual Basic p-code format or in native
code format. Native code compilation provides several options for optimizing
and debugging that aren't available with p-code.
P-code, or pseudo code, is an intermediate step between the high-level
instructions in your Basic program and the low-level native code your
computer's processor executes. At run time, Visual Basic translates each
p-code statement to native code. By compiling directly to native code format,
you eliminate the intermediate p-code step.
You can debug compiled native code using standard native code debugging
tools, such as the debugging environment provided by Visual C++. You can also
use options available in languages such as Visual C++ for optimizing and
debugging native code. For example, you can optimize code for speed or for
size.
Note All projects created with Visual Basic use the services of the
run-time DLL (MSVBVM60.DLL). Among the services provided by this DLL are
startup and shutdown code for your application, functionality for forms and
intrinsic controls, and run-time functions like Format and CLng.
Compiling a project with the Native Code option means that the code you
write will be fully compiled to the native instructions of the processor
chip, instead of being compiled to p-code. This will greatly speed up loops
and mathematical calculations, and may somewhat speed up calls to the
services provided by MSVBVM60.DLL. However, it does not eliminate the need
for the DLL.
regards
Michel Posseth [MCP]
Post by Tom Esh
On Fri, 2 Sep 2005 08:15:42 +0200, "Ivan Debono"
Post by Ivan Debono
Hi all,
I've got some activex dlls that access a database, retrieve recordsets, loop
through them, calculate stuff, etc...
Would it make a big difference if I compiled to PCode instead of Native Code
(Fast Code)??
The difference is in the size which is important for me as I need to package
everything in a setup file and make it available on the internet for
downloading.
Very unlikely you would see much improvement with native unless you're
doing a ~lot~ of calculations. It's easy enough to build & test each
way though if you want to be certain.
-Tom
MVP - Visual Basic
(please post replies to the newsgroup)
M. Posseth
2005-09-02 11:54:04 UTC
Permalink
well ...

I justed wanted to make clear what is exactly the difference as an extra
comment to Tom`s reply

my own experience tells me that Tom is absolutely right in his statement
"It's easy enough to build & test each way though if you want to be certain."

in my situation ,,, ( programs with lots of array`s , database handling ,
generating of text files ) native code is superior to p-code in execution
speed . i know this for the simple fact that i benchmarked my app in all
situations ( p-code , native code with and without the different optimization
options )

Also be aware of the following , P-code can eventually be easier to
decompile as native code , this might also be something worth mentioning
Post by Tony Proctor
I guess you haven't seen any of the previous threads on this subject, e.g.
http://groups.google.ie/group/microsoft.public.vb.general.discussion/browse_frm/thread/0d579a81dc11e19c/117fe49d249e3c8a?hl=en#117fe49d249e3c8a
The point being that P-code is interpreted rather than being converted to
native code via a JIT compiler
Tony Proctor
Post by M. Posseth
If you have the Professional or Enterprise edition of Visual Basic, you
can
Post by M. Posseth
compile your code either in standard Visual Basic p-code format or in
native
Post by M. Posseth
code format. Native code compilation provides several options for
optimizing
Post by M. Posseth
and debugging that aren't available with p-code.
P-code, or pseudo code, is an intermediate step between the high-level
instructions in your Basic program and the low-level native code your
computer's processor executes. At run time, Visual Basic translates each
p-code statement to native code. By compiling directly to native code
format,
Post by M. Posseth
you eliminate the intermediate p-code step.
You can debug compiled native code using standard native code debugging
tools, such as the debugging environment provided by Visual C++. You can
also
Post by M. Posseth
use options available in languages such as Visual C++ for optimizing and
debugging native code. For example, you can optimize code for speed or for
size.
Note All projects created with Visual Basic use the services of the
run-time DLL (MSVBVM60.DLL). Among the services provided by this DLL are
startup and shutdown code for your application, functionality for forms
and
Post by M. Posseth
intrinsic controls, and run-time functions like Format and CLng.
Compiling a project with the Native Code option means that the code you
write will be fully compiled to the native instructions of the processor
chip, instead of being compiled to p-code. This will greatly speed up
loops
Post by M. Posseth
and mathematical calculations, and may somewhat speed up calls to the
services provided by MSVBVM60.DLL. However, it does not eliminate the need
for the DLL.
regards
Michel Posseth [MCP]
Post by Tom Esh
On Fri, 2 Sep 2005 08:15:42 +0200, "Ivan Debono"
Post by Ivan Debono
Hi all,
I've got some activex dlls that access a database, retrieve recordsets,
loop
Post by M. Posseth
Post by Tom Esh
Post by Ivan Debono
through them, calculate stuff, etc...
Would it make a big difference if I compiled to PCode instead of Native
Code
Post by M. Posseth
Post by Tom Esh
Post by Ivan Debono
(Fast Code)??
The difference is in the size which is important for me as I need to
package
Post by M. Posseth
Post by Tom Esh
Post by Ivan Debono
everything in a setup file and make it available on the internet for
downloading.
Very unlikely you would see much improvement with native unless you're
doing a ~lot~ of calculations. It's easy enough to build & test each
way though if you want to be certain.
-Tom
MVP - Visual Basic
(please post replies to the newsgroup)
M. Posseth
2005-09-02 11:58:03 UTC
Permalink
for those interested of performing some benchmarks

copy this in a module

and start testing what is for you, the optimal compiler settings

###############

Option Explicit



'//**************************************************************************
'// Api declares
'//**************************************************************************
Public Declare Function QueryPerformanceCounter Lib "kernel32"
(lpPerformanceCount As LARGE_INTEGER) As Long
Public Declare Function QueryPerformanceFrequency Lib "kernel32"
(lpFrequency As LARGE_INTEGER) As Long

Public Type LARGE_INTEGER
lowpart As Long
highpart As Long
End Type


'//**************************************************************************
'// Variables
'//**************************************************************************
Private m_Initialized As Boolean
Private m_Frequency As Double '// Frequency of the hi-res counter
Private m_Start As LARGE_INTEGER '// Hi-res timer value (Before timing)
Private m_End As LARGE_INTEGER '// Hi-res timer value (After timing)
Private m_CallingDelay As Double '// Time required to call the stoptiming
function
Private m_isTiming As Boolean '// Timing in progress flag
Private m_TimingComplete As Boolean


'//**************************************************************************
'// Const
'//**************************************************************************
'//--- Conversion units ---
Public Const Units_MilliSeconds = &H0
Public Const Units_MicroSeconds = &H1
Public Const Units_Seconds = &H2
Public Const Units_NoConversion = &H3
Public Enum UnitsType
Milliseconds = Units_MilliSeconds
MicroSeconds = Units_MicroSeconds
seconds = Units_Seconds
NoConversion = Units_NoConversion
End Enum



'//**************************************************************************
'// Timing functions
'//**************************************************************************
Public Function InitializeTimer() As Boolean

'//**** Get the high resolution counter frequency (Beats per seconds) ****
Dim iFreq As LARGE_INTEGER
If (QueryPerformanceFrequency(iFreq) = 0) Then

'//**** There performance counter doesn't work... ****
Exit Function
End If
m_Frequency = LargeIntToDouble(iFreq)
m_Initialized = True

InitializeTimer = True
End Function
Public Sub StartTiming()
If (m_isTiming) Then Exit Sub

'//**** If the timer is not initialized, initialize it ****
If (Not m_Initialized) Then
If (Not InitializeTimer) Then Exit Sub
End If

'//**** Calculate the time required to call the StopTiming function ****
m_isTiming = True
Call QueryPerformanceCounter(m_Start)
m_CodeTiming.StopTiming
m_CallingDelay = (LargeIntToDouble(m_End) - LargeIntToDouble(m_Start))

'//**** Read the current value of the hi-res timer ****
m_isTiming = True
Call QueryPerformanceCounter(m_Start) '//**** This MUST be the last
line in the sub ****
End Sub
Public Sub StopTiming()
If (Not m_isTiming) Then Exit Sub

'//**** Read the current value of the hi-res timer ****
Call QueryPerformanceCounter(m_End)

m_isTiming = False
m_TimingComplete = True
End Sub
Public Function ReadCodeTiming(Optional Units As UnitsType =
Units_MicroSeconds) As Double
Dim nCounts As Long
nCounts = (LargeIntToDouble(m_End) - LargeIntToDouble(m_Start)) -
m_CallingDelay
If (nCounts < 0) Then nCounts = 0

Select Case Units
Case Units_MicroSeconds
ReadCodeTiming = (nCounts / (m_Frequency / 1000000))

Case Units_MilliSeconds
ReadCodeTiming = (nCounts / (m_Frequency / 1000))

Case Units_Seconds
ReadCodeTiming = (nCounts / m_Frequency)

Case Else
ReadCodeTiming = nCounts
End Select
End Function



'//**************************************************************************
'// Conversion functions
'//**************************************************************************
Public Function LargeIntToDouble(LINT As LARGE_INTEGER) As Double
Const Shift32bit = (4# * 1024# * 1024# * 1024#)

Dim LoInt As Double
LoInt = LINT.lowpart
If (LoInt < 0) Then
LoInt = (LoInt + Shift32bit)
End If

LargeIntToDouble = (LINT.highpart * Shift32bit) + LoInt
End Function


###############
Post by M. Posseth
well ...
I justed wanted to make clear what is exactly the difference as an extra
comment to Tom`s reply
my own experience tells me that Tom is absolutely right in his statement
"It's easy enough to build & test each way though if you want to be certain."
in my situation ,,, ( programs with lots of array`s , database handling ,
generating of text files ) native code is superior to p-code in execution
speed . i know this for the simple fact that i benchmarked my app in all
situations ( p-code , native code with and without the different optimization
options )
Also be aware of the following , P-code can eventually be easier to
decompile as native code , this might also be something worth mentioning
Post by Tony Proctor
I guess you haven't seen any of the previous threads on this subject, e.g.
http://groups.google.ie/group/microsoft.public.vb.general.discussion/browse_frm/thread/0d579a81dc11e19c/117fe49d249e3c8a?hl=en#117fe49d249e3c8a
The point being that P-code is interpreted rather than being converted to
native code via a JIT compiler
Tony Proctor
Post by M. Posseth
If you have the Professional or Enterprise edition of Visual Basic, you
can
Post by M. Posseth
compile your code either in standard Visual Basic p-code format or in
native
Post by M. Posseth
code format. Native code compilation provides several options for
optimizing
Post by M. Posseth
and debugging that aren't available with p-code.
P-code, or pseudo code, is an intermediate step between the high-level
instructions in your Basic program and the low-level native code your
computer's processor executes. At run time, Visual Basic translates each
p-code statement to native code. By compiling directly to native code
format,
Post by M. Posseth
you eliminate the intermediate p-code step.
You can debug compiled native code using standard native code debugging
tools, such as the debugging environment provided by Visual C++. You can
also
Post by M. Posseth
use options available in languages such as Visual C++ for optimizing and
debugging native code. For example, you can optimize code for speed or for
size.
Note All projects created with Visual Basic use the services of the
run-time DLL (MSVBVM60.DLL). Among the services provided by this DLL are
startup and shutdown code for your application, functionality for forms
and
Post by M. Posseth
intrinsic controls, and run-time functions like Format and CLng.
Compiling a project with the Native Code option means that the code you
write will be fully compiled to the native instructions of the processor
chip, instead of being compiled to p-code. This will greatly speed up
loops
Post by M. Posseth
and mathematical calculations, and may somewhat speed up calls to the
services provided by MSVBVM60.DLL. However, it does not eliminate the need
for the DLL.
regards
Michel Posseth [MCP]
Post by Tom Esh
On Fri, 2 Sep 2005 08:15:42 +0200, "Ivan Debono"
Post by Ivan Debono
Hi all,
I've got some activex dlls that access a database, retrieve recordsets,
loop
Post by M. Posseth
Post by Tom Esh
Post by Ivan Debono
through them, calculate stuff, etc...
Would it make a big difference if I compiled to PCode instead of Native
Code
Post by M. Posseth
Post by Tom Esh
Post by Ivan Debono
(Fast Code)??
The difference is in the size which is important for me as I need to
package
Post by M. Posseth
Post by Tom Esh
Post by Ivan Debono
everything in a setup file and make it available on the internet for
downloading.
Very unlikely you would see much improvement with native unless you're
doing a ~lot~ of calculations. It's easy enough to build & test each
way though if you want to be certain.
-Tom
MVP - Visual Basic
(please post replies to the newsgroup)
Ralph
2005-09-03 17:37:47 UTC
Permalink
Post by Tony Proctor
I guess you haven't seen any of the previous threads on this subject, e.g.
http://groups.google.ie/group/microsoft.public.vb.general.discussion/browse_frm/thread/0d579a81dc11e19c/117fe49d249e3c8a?hl=en#117fe49d249e3c8a
Post by Tony Proctor
The point being that P-code is interpreted rather than being converted to
native code via a JIT compiler
Tony Proctor
<snipped>

I was going to let this go, for as a 'high-level' view it is mildly useful.
However, much of the mythology and confusion concerning VB PCode comes from
taking the above view and then attempting to extrapolate performance and
implementation issues from it.

First off, VB's version of P-Code is MS's own highly optimized proprietary
implementation of "pseudo code". While it has roots in BASIC's historically
interpreted environment and Dr. Wirth's original concept, it is a unique
product. Any similarity to Java and .Net, or to archaic 'interpreted'
languages (early BASICs included) is purely superficial and attempts at
homomorphism will lead to erroneous conclusions.

Second, when a VB6 application is compiled to P-Code the result is a PE COFF
executable file. It makes 'service' calls to the VBRuntime Dll the same as
native compiled code. Albeit, often not the same calls and with somewhat
strange setups before and after if you are used to VC, but "native" calls
none the less. There is no special invocation of a separate VB Runtime
process - no separate 'engine' running in the back room. The runtime doesn't
magically create any new assembly either - it just runs code with the
supplied data (parameters, stack, memory) like any other library procedure.
In effect the 'interpretation' or 'translation' has already been done at
compile time - there is no intermediate process going on, no 'conversion' to
machine code - it is machine code.

P-Code is not 'interpreted' at runtime. There is no JIT compiler involved. P
eriod.

Third, one has to be careful when reading older articles concerning VB's
p-code implementation. It has evolved dramatically over the years. What you
see with VB5/6 is a far better product than what we had with VB1/4. Another
complication is P-Code is undocumented. There were tech papers available for
earlier versions, but since then MS really tighten down the hatches. Much of
what you will read is really just a 'best guess'.

Often MS's p-code is sneered at based on the delusion that it is
'interpreted', but it is a very different advanced technology. So much so
that you will find earlier developers hoping that MS would expand the
technology to other languages and environments. That was when Java-type
common-code, run everywhere, language/environments were coming in vogue. In
many ways MS had a step on the competition with this kind of technology.
There are reasons MS's implementation of Java ran circles around Sun's.

You will also find that when the hype and calls for a native compiler were
the loudest, there were several articles by VB gurus suggesting that one
should be - "careful for what you wish for". <g>

P-Code runs faster than native code (with the exceptions others have noted).
It compiles into a smaller executable. It is often more robust and presents
fewer surprises - if it runs in the IDE, it will run in the wild. For many
reasons it should be the average VBers first choice when making an
executable.

hth
-ralph
sali
2005-09-03 21:37:36 UTC
Permalink
----- Original Message -----
From: "Ralph" <***@yahoo.com>
Newsgroups: microsoft.public.vb.general.discussion
Sent: Saturday, September 03, 2005 6:37 PM
Subject: Re: Native Code vs PCode
Post by Ralph
Post by Tony Proctor
I guess you haven't seen any of the previous threads on this subject, e.g.
http://groups.google.ie/group/microsoft.public.vb.general.discussion/browse_
frm/thread/0d579a81dc11e19c/117fe49d249e3c8a?hl=en#117fe49d249e3c8a
Post by Ralph
Post by Tony Proctor
The point being that P-code is interpreted rather than being converted to
native code via a JIT compiler
Tony Proctor
<snipped>
I was going to let this go, for as a 'high-level' view it is mildly useful.
However, much of the mythology and confusion concerning VB PCode comes from
taking the above view and then attempting to extrapolate performance and
implementation issues from it.
First off, VB's version of P-Code is MS's own highly optimized proprietary
implementation of "pseudo code". While it has roots in BASIC's
historically
Post by Ralph
interpreted environment and Dr. Wirth's original concept, it is a unique
product. Any similarity to Java and .Net, or to archaic 'interpreted'
languages (early BASICs included) is purely superficial and attempts at
homomorphism will lead to erroneous conclusions.
Second, when a VB6 application is compiled to P-Code the result is a PE COFF
executable file. It makes 'service' calls to the VBRuntime Dll the same as
native compiled code. Albeit, often not the same calls and with somewhat
strange setups before and after if you are used to VC, but "native" calls
none the less. There is no special invocation of a separate VB Runtime
process - no separate 'engine' running in the back room. The runtime doesn't
magically create any new assembly either - it just runs code with the
supplied data (parameters, stack, memory) like any other library procedure.
In effect the 'interpretation' or 'translation' has already been done at
compile time - there is no intermediate process going on, no 'conversion' to
machine code - it is machine code.
P-Code is not 'interpreted' at runtime. There is no JIT compiler involved. P
eriod.
is p-code placed into "code" or "data" segment of process?

if it is in "data" then p-code is "interpreted" on one way or another ...
Ralph
2005-09-03 23:02:30 UTC
Permalink
Post by sali
----- Original Message -----
Newsgroups: microsoft.public.vb.general.discussion
Sent: Saturday, September 03, 2005 6:37 PM
Subject: Re: Native Code vs PCode
Post by Ralph
Post by Tony Proctor
I guess you haven't seen any of the previous threads on this subject,
e.g.
http://groups.google.ie/group/microsoft.public.vb.general.discussion/browse_
Post by sali
frm/thread/0d579a81dc11e19c/117fe49d249e3c8a?hl=en#117fe49d249e3c8a
Post by Ralph
Post by Tony Proctor
The point being that P-code is interpreted rather than being converted
to
Post by Ralph
Post by Tony Proctor
native code via a JIT compiler
Tony Proctor
<snipped>
I was going to let this go, for as a 'high-level' view it is mildly
useful.
Post by Ralph
However, much of the mythology and confusion concerning VB PCode comes
from
Post by Ralph
taking the above view and then attempting to extrapolate performance and
implementation issues from it.
First off, VB's version of P-Code is MS's own highly optimized proprietary
implementation of "pseudo code". While it has roots in BASIC's
historically
Post by Ralph
interpreted environment and Dr. Wirth's original concept, it is a unique
product. Any similarity to Java and .Net, or to archaic 'interpreted'
languages (early BASICs included) is purely superficial and attempts at
homomorphism will lead to erroneous conclusions.
Second, when a VB6 application is compiled to P-Code the result is a PE
COFF
Post by Ralph
executable file. It makes 'service' calls to the VBRuntime Dll the same as
native compiled code. Albeit, often not the same calls and with somewhat
strange setups before and after if you are used to VC, but "native" calls
none the less. There is no special invocation of a separate VB Runtime
process - no separate 'engine' running in the back room. The runtime
doesn't
Post by Ralph
magically create any new assembly either - it just runs code with the
supplied data (parameters, stack, memory) like any other library
procedure.
Post by Ralph
In effect the 'interpretation' or 'translation' has already been done at
compile time - there is no intermediate process going on, no
'conversion'
Post by sali
to
Post by Ralph
machine code - it is machine code.
P-Code is not 'interpreted' at runtime. There is no JIT compiler
involved.
Post by sali
P
Post by Ralph
eriod.
is p-code placed into "code" or "data" segment of process?
if it is in "data" then p-code is "interpreted" on one way or another ...
Pull out your favorite PE COFF viewer and take a look.

There is no more 'interpretation' than what goes on when a call to a method
in GUI.DLL is 'interpreted' to present a specific window or control. I
suppose you could look at things that way. But it seems a bit
transcendental.

-ralph
sali
2005-09-04 09:31:07 UTC
Permalink
Post by Ralph
Post by sali
----- Original Message -----
Newsgroups: microsoft.public.vb.general.discussion
Sent: Saturday, September 03, 2005 6:37 PM
Subject: Re: Native Code vs PCode
Post by Ralph
Post by Tony Proctor
I guess you haven't seen any of the previous threads on this subject,
e.g.
http://groups.google.ie/group/microsoft.public.vb.general.discussion/browse_
Post by Ralph
Post by sali
frm/thread/0d579a81dc11e19c/117fe49d249e3c8a?hl=en#117fe49d249e3c8a
Post by Ralph
Post by Tony Proctor
The point being that P-code is interpreted rather than being converted
to
Post by Ralph
Post by Tony Proctor
native code via a JIT compiler
Tony Proctor
<snipped>
I was going to let this go, for as a 'high-level' view it is mildly
useful.
Post by Ralph
However, much of the mythology and confusion concerning VB PCode comes
from
Post by Ralph
taking the above view and then attempting to extrapolate performance and
implementation issues from it.
First off, VB's version of P-Code is MS's own highly optimized
proprietary
Post by sali
Post by Ralph
implementation of "pseudo code". While it has roots in BASIC's
historically
Post by Ralph
interpreted environment and Dr. Wirth's original concept, it is a unique
product. Any similarity to Java and .Net, or to archaic 'interpreted'
languages (early BASICs included) is purely superficial and attempts at
homomorphism will lead to erroneous conclusions.
Second, when a VB6 application is compiled to P-Code the result is a PE
COFF
Post by Ralph
executable file. It makes 'service' calls to the VBRuntime Dll the
same
Post by Ralph
as
Post by sali
Post by Ralph
native compiled code. Albeit, often not the same calls and with somewhat
strange setups before and after if you are used to VC, but "native"
calls
Post by sali
Post by Ralph
none the less. There is no special invocation of a separate VB Runtime
process - no separate 'engine' running in the back room. The runtime
doesn't
Post by Ralph
magically create any new assembly either - it just runs code with the
supplied data (parameters, stack, memory) like any other library
procedure.
Post by Ralph
In effect the 'interpretation' or 'translation' has already been done at
compile time - there is no intermediate process going on, no
'conversion'
Post by sali
to
Post by Ralph
machine code - it is machine code.
P-Code is not 'interpreted' at runtime. There is no JIT compiler
involved.
Post by sali
P
Post by Ralph
eriod.
is p-code placed into "code" or "data" segment of process?
if it is in "data" then p-code is "interpreted" on one way or another ...
Pull out your favorite PE COFF viewer and take a look.
There is no more 'interpretation' than what goes on when a call to a method
in GUI.DLL is 'interpreted' to present a specific window or control. I
suppose you could look at things that way. But it seems a bit
transcendental.
-ralph
not sure what happens on gui call [thanks for coff viewer suggestion!], but
this article clearly states that ms p-code [p is for packed] is not machine
code but there is p-code runtime engine instead.

http://msdn.microsoft.com/archive/default.asp?url=/archive/en-us/dnarvc/html
/msdn_c7pcode2.asp

p-code has space saving ratio of ~50%, and decreasing swapping requests [due
to smaller code size], may even be *faster* than pure machine code [few cpu
cycles spent in p-code engine is less than waiting the huge code to be
swapped in, of course depends on hw config]
however, article states that [at least for c runtime], programmer may at
local point of interest [tight loops] temporarly *disable* p-code and force
pure machine code compiler output to speed up just critical parts, and let
major part of code to be left compressed.
sali
2005-09-04 09:31:07 UTC
Permalink
Post by Ralph
Post by sali
----- Original Message -----
Newsgroups: microsoft.public.vb.general.discussion
Sent: Saturday, September 03, 2005 6:37 PM
Subject: Re: Native Code vs PCode
Post by Ralph
Post by Tony Proctor
I guess you haven't seen any of the previous threads on this subject,
e.g.
http://groups.google.ie/group/microsoft.public.vb.general.discussion/browse_
Post by Ralph
Post by sali
frm/thread/0d579a81dc11e19c/117fe49d249e3c8a?hl=en#117fe49d249e3c8a
Post by Ralph
Post by Tony Proctor
The point being that P-code is interpreted rather than being converted
to
Post by Ralph
Post by Tony Proctor
native code via a JIT compiler
Tony Proctor
<snipped>
I was going to let this go, for as a 'high-level' view it is mildly
useful.
Post by Ralph
However, much of the mythology and confusion concerning VB PCode comes
from
Post by Ralph
taking the above view and then attempting to extrapolate performance and
implementation issues from it.
First off, VB's version of P-Code is MS's own highly optimized
proprietary
Post by sali
Post by Ralph
implementation of "pseudo code". While it has roots in BASIC's
historically
Post by Ralph
interpreted environment and Dr. Wirth's original concept, it is a unique
product. Any similarity to Java and .Net, or to archaic 'interpreted'
languages (early BASICs included) is purely superficial and attempts at
homomorphism will lead to erroneous conclusions.
Second, when a VB6 application is compiled to P-Code the result is a PE
COFF
Post by Ralph
executable file. It makes 'service' calls to the VBRuntime Dll the
same
Post by Ralph
as
Post by sali
Post by Ralph
native compiled code. Albeit, often not the same calls and with somewhat
strange setups before and after if you are used to VC, but "native"
calls
Post by sali
Post by Ralph
none the less. There is no special invocation of a separate VB Runtime
process - no separate 'engine' running in the back room. The runtime
doesn't
Post by Ralph
magically create any new assembly either - it just runs code with the
supplied data (parameters, stack, memory) like any other library
procedure.
Post by Ralph
In effect the 'interpretation' or 'translation' has already been done at
compile time - there is no intermediate process going on, no
'conversion'
Post by sali
to
Post by Ralph
machine code - it is machine code.
P-Code is not 'interpreted' at runtime. There is no JIT compiler
involved.
Post by sali
P
Post by Ralph
eriod.
is p-code placed into "code" or "data" segment of process?
if it is in "data" then p-code is "interpreted" on one way or another ...
Pull out your favorite PE COFF viewer and take a look.
There is no more 'interpretation' than what goes on when a call to a method
in GUI.DLL is 'interpreted' to present a specific window or control. I
suppose you could look at things that way. But it seems a bit
transcendental.
-ralph
not sure what happens on gui call [thanks for coff viewer suggestion!], but
this article clearly states that ms p-code [p is for packed] is not machine
code but there is p-code runtime engine instead.

http://msdn.microsoft.com/archive/default.asp?url=/archive/en-us/dnarvc/html
/msdn_c7pcode2.asp

p-code has space saving ratio of ~50%, and decreasing swapping requests [due
to smaller code size], may even be *faster* than pure machine code [few cpu
cycles spent in p-code engine is less than waiting the huge code to be
swapped in, of course depends on hw config]
however, article states that [at least for c runtime], programmer may at
local point of interest [tight loops] temporarly *disable* p-code and force
pure machine code compiler output to speed up just critical parts, and let
major part of code to be left compressed.
Ralph
2005-09-04 12:14:48 UTC
Permalink
Post by Tony Proctor
Post by Ralph
Post by sali
----- Original Message -----
Newsgroups: microsoft.public.vb.general.discussion
Sent: Saturday, September 03, 2005 6:37 PM
Subject: Re: Native Code vs PCode
Post by Ralph
Post by Tony Proctor
I guess you haven't seen any of the previous threads on this
subject,
Post by Ralph
Post by sali
e.g.
http://groups.google.ie/group/microsoft.public.vb.general.discussion/browse_
Post by Tony Proctor
Post by Ralph
Post by sali
frm/thread/0d579a81dc11e19c/117fe49d249e3c8a?hl=en#117fe49d249e3c8a
Post by Ralph
Post by Tony Proctor
The point being that P-code is interpreted rather than being
converted
Post by Ralph
Post by sali
to
Post by Ralph
Post by Tony Proctor
native code via a JIT compiler
Tony Proctor
<snipped>
I was going to let this go, for as a 'high-level' view it is mildly
useful.
Post by Ralph
However, much of the mythology and confusion concerning VB PCode comes
from
Post by Ralph
taking the above view and then attempting to extrapolate performance
and
Post by Ralph
Post by sali
Post by Ralph
implementation issues from it.
First off, VB's version of P-Code is MS's own highly optimized
proprietary
Post by sali
Post by Ralph
implementation of "pseudo code". While it has roots in BASIC's
historically
Post by Ralph
interpreted environment and Dr. Wirth's original concept, it is a
unique
Post by Ralph
Post by sali
Post by Ralph
product. Any similarity to Java and .Net, or to archaic
'interpreted'
Post by Tony Proctor
Post by Ralph
Post by sali
Post by Ralph
languages (early BASICs included) is purely superficial and attempts
at
Post by Ralph
Post by sali
Post by Ralph
homomorphism will lead to erroneous conclusions.
Second, when a VB6 application is compiled to P-Code the result is a
PE
Post by Ralph
Post by sali
COFF
Post by Ralph
executable file. It makes 'service' calls to the VBRuntime Dll the
same
Post by Ralph
as
Post by sali
Post by Ralph
native compiled code. Albeit, often not the same calls and with
somewhat
Post by Ralph
Post by sali
Post by Ralph
strange setups before and after if you are used to VC, but "native"
calls
Post by sali
Post by Ralph
none the less. There is no special invocation of a separate VB Runtime
process - no separate 'engine' running in the back room. The runtime
doesn't
Post by Ralph
magically create any new assembly either - it just runs code with the
supplied data (parameters, stack, memory) like any other library
procedure.
Post by Ralph
In effect the 'interpretation' or 'translation' has already been
done
Post by Tony Proctor
at
Post by Ralph
Post by sali
Post by Ralph
compile time - there is no intermediate process going on, no
'conversion'
Post by sali
to
Post by Ralph
machine code - it is machine code.
P-Code is not 'interpreted' at runtime. There is no JIT compiler
involved.
Post by sali
P
Post by Ralph
eriod.
is p-code placed into "code" or "data" segment of process?
if it is in "data" then p-code is "interpreted" on one way or another
...
Post by Ralph
Pull out your favorite PE COFF viewer and take a look.
There is no more 'interpretation' than what goes on when a call to a
method
Post by Ralph
in GUI.DLL is 'interpreted' to present a specific window or control. I
suppose you could look at things that way. But it seems a bit
transcendental.
-ralph
not sure what happens on gui call [thanks for coff viewer suggestion!], but
this article clearly states that ms p-code [p is for packed] is not machine
code but there is p-code runtime engine instead.
http://msdn.microsoft.com/archive/default.asp?url=/archive/en-us/dnarvc/html
Post by Tony Proctor
/msdn_c7pcode2.asp
p-code has space saving ratio of ~50%, and decreasing swapping requests [due
to smaller code size], may even be *faster* than pure machine code [few cpu
cycles spent in p-code engine is less than waiting the huge code to be
swapped in, of course depends on hw config]
however, article states that [at least for c runtime], programmer may at
local point of interest [tight loops] temporarly *disable* p-code and force
pure machine code compiler output to speed up just critical parts, and let
major part of code to be left compressed.
This is not the same technology:
"Microsoft has introduced a code compression technology in its C/C++
Development System for Windows version 7.0 (C/C++ 7.0) called p-code (short
for packed code)."

The one has nothing to do with the other.

-ralph
Tony Proctor
2005-09-04 13:39:03 UTC
Permalink
Steady on Ralph! We're saying the same basic (<grin>) thing here, apart from
a disagreement over the term "interpret". I'm using the term in the context
of a virtual machine and its dispatching of soft instruction codes, which is
how this p-code is executed. This is obviously distinct from source-level
interpretation, but I took that to be obvious.

I personally wasn't trying to denigrate VB or it run-time environment. I
have a large experience with proprietary soft instruction codes and their
virtual machines. I mainly wanted to emphasise that there's no JIT or other
form of run-time translation of p-code to native code, and you've confirmed
you agree with that here.

Tony Proctor
Post by Ralph
Post by Tony Proctor
I guess you haven't seen any of the previous threads on this subject, e.g.
http://groups.google.ie/group/microsoft.public.vb.general.discussion/browse_frm/thread/0d579a81dc11e19c/117fe49d249e3c8a?hl=en#117fe49d249e3c8a
Post by Ralph
Post by Tony Proctor
The point being that P-code is interpreted rather than being converted to
native code via a JIT compiler
Tony Proctor
<snipped>
I was going to let this go, for as a 'high-level' view it is mildly useful.
However, much of the mythology and confusion concerning VB PCode comes from
taking the above view and then attempting to extrapolate performance and
implementation issues from it.
First off, VB's version of P-Code is MS's own highly optimized proprietary
implementation of "pseudo code". While it has roots in BASIC's
historically
Post by Ralph
interpreted environment and Dr. Wirth's original concept, it is a unique
product. Any similarity to Java and .Net, or to archaic 'interpreted'
languages (early BASICs included) is purely superficial and attempts at
homomorphism will lead to erroneous conclusions.
Second, when a VB6 application is compiled to P-Code the result is a PE COFF
executable file. It makes 'service' calls to the VBRuntime Dll the same as
native compiled code. Albeit, often not the same calls and with somewhat
strange setups before and after if you are used to VC, but "native" calls
none the less. There is no special invocation of a separate VB Runtime
process - no separate 'engine' running in the back room. The runtime doesn't
magically create any new assembly either - it just runs code with the
supplied data (parameters, stack, memory) like any other library procedure.
In effect the 'interpretation' or 'translation' has already been done at
compile time - there is no intermediate process going on, no 'conversion' to
machine code - it is machine code.
P-Code is not 'interpreted' at runtime. There is no JIT compiler involved. P
eriod.
Third, one has to be careful when reading older articles concerning VB's
p-code implementation. It has evolved dramatically over the years. What you
see with VB5/6 is a far better product than what we had with VB1/4. Another
complication is P-Code is undocumented. There were tech papers available for
earlier versions, but since then MS really tighten down the hatches. Much of
what you will read is really just a 'best guess'.
Often MS's p-code is sneered at based on the delusion that it is
'interpreted', but it is a very different advanced technology. So much so
that you will find earlier developers hoping that MS would expand the
technology to other languages and environments. That was when Java-type
common-code, run everywhere, language/environments were coming in vogue. In
many ways MS had a step on the competition with this kind of technology.
There are reasons MS's implementation of Java ran circles around Sun's.
You will also find that when the hype and calls for a native compiler were
the loudest, there were several articles by VB gurus suggesting that one
should be - "careful for what you wish for". <g>
P-Code runs faster than native code (with the exceptions others have noted).
It compiles into a smaller executable. It is often more robust and presents
fewer surprises - if it runs in the IDE, it will run in the wild. For many
reasons it should be the average VBers first choice when making an
executable.
hth
-ralph
Ralph
2005-09-04 16:40:00 UTC
Permalink
Post by Tony Proctor
Steady on Ralph! We're saying the same basic (<grin>) thing here, apart from
a disagreement over the term "interpret". I'm using the term in the context
of a virtual machine and its dispatching of soft instruction codes, which is
how this p-code is executed. This is obviously distinct from source-level
interpretation, but I took that to be obvious.
I personally wasn't trying to denigrate VB or it run-time environment. I
have a large experience with proprietary soft instruction codes and their
virtual machines. I mainly wanted to emphasise that there's no JIT or other
form of run-time translation of p-code to native code, and you've confirmed
you agree with that here.
Tony Proctor
Yes, of course we would agree on how pcode is actually implemented.

I never meant to suggest otherwise, nor to target your post personally, only
that the terms "interpret" and "JIT" are often charged by experience with
other language platforms and that erroneous conclusions are often the
result.

This is in many cases a difficult media, because of the limitations in space
and the wordsmithing abilities of its general participants. (The latter is
especially applicable to me. <g>) When one aims at a short unity of effect,
one often comes across as shrill, combative, or worse - pedantically ill
tempered.

<g>
-ralph
Post by Tony Proctor
Post by Ralph
Post by Tony Proctor
I guess you haven't seen any of the previous threads on this subject,
e.g.
http://groups.google.ie/group/microsoft.public.vb.general.discussion/browse_frm/thread/0d579a81dc11e19c/117fe49d249e3c8a?hl=en#117fe49d249e3c8a
Post by Tony Proctor
Post by Ralph
Post by Tony Proctor
The point being that P-code is interpreted rather than being converted
to
Post by Ralph
Post by Tony Proctor
native code via a JIT compiler
Tony Proctor
<snipped>
I was going to let this go, for as a 'high-level' view it is mildly
useful.
Post by Ralph
However, much of the mythology and confusion concerning VB PCode comes
from
Post by Ralph
taking the above view and then attempting to extrapolate performance and
implementation issues from it.
First off, VB's version of P-Code is MS's own highly optimized proprietary
implementation of "pseudo code". While it has roots in BASIC's
historically
Post by Ralph
interpreted environment and Dr. Wirth's original concept, it is a unique
product. Any similarity to Java and .Net, or to archaic 'interpreted'
languages (early BASICs included) is purely superficial and attempts at
homomorphism will lead to erroneous conclusions.
Second, when a VB6 application is compiled to P-Code the result is a PE
COFF
Post by Ralph
executable file. It makes 'service' calls to the VBRuntime Dll the same as
native compiled code. Albeit, often not the same calls and with somewhat
strange setups before and after if you are used to VC, but "native" calls
none the less. There is no special invocation of a separate VB Runtime
process - no separate 'engine' running in the back room. The runtime
doesn't
Post by Ralph
magically create any new assembly either - it just runs code with the
supplied data (parameters, stack, memory) like any other library
procedure.
Post by Ralph
In effect the 'interpretation' or 'translation' has already been done at
compile time - there is no intermediate process going on, no
'conversion'
Post by Tony Proctor
to
Post by Ralph
machine code - it is machine code.
P-Code is not 'interpreted' at runtime. There is no JIT compiler
involved.
Post by Tony Proctor
P
Post by Ralph
eriod.
Third, one has to be careful when reading older articles concerning VB's
p-code implementation. It has evolved dramatically over the years. What
you
Post by Ralph
see with VB5/6 is a far better product than what we had with VB1/4.
Another
Post by Ralph
complication is P-Code is undocumented. There were tech papers available
for
Post by Ralph
earlier versions, but since then MS really tighten down the hatches.
Much
Post by Tony Proctor
of
Post by Ralph
what you will read is really just a 'best guess'.
Often MS's p-code is sneered at based on the delusion that it is
'interpreted', but it is a very different advanced technology. So much so
that you will find earlier developers hoping that MS would expand the
technology to other languages and environments. That was when Java-type
common-code, run everywhere, language/environments were coming in vogue.
In
Post by Ralph
many ways MS had a step on the competition with this kind of technology.
There are reasons MS's implementation of Java ran circles around Sun's.
You will also find that when the hype and calls for a native compiler were
the loudest, there were several articles by VB gurus suggesting that one
should be - "careful for what you wish for". <g>
P-Code runs faster than native code (with the exceptions others have
noted).
Post by Ralph
It compiles into a smaller executable. It is often more robust and
presents
Post by Ralph
fewer surprises - if it runs in the IDE, it will run in the wild. For many
reasons it should be the average VBers first choice when making an
executable.
hth
-ralph
Tony Proctor
2005-09-04 17:40:29 UTC
Permalink
Actually Ralph, some of worst misconceptions and unjustified diatribes about
VB that I've seen were from C/C++ programmers. Some of these actually
suggested that VB6 was interpreted at source level. Obviously they had no
real experience or knowledge to back this up, and were simply spouting
second-hand mythology, as you suggested earlier.

Tony Proctor
Post by Tony Proctor
Post by Tony Proctor
Steady on Ralph! We're saying the same basic (<grin>) thing here, apart
from
Post by Tony Proctor
a disagreement over the term "interpret". I'm using the term in the
context
Post by Tony Proctor
of a virtual machine and its dispatching of soft instruction codes,
which
Post by Tony Proctor
is
Post by Tony Proctor
how this p-code is executed. This is obviously distinct from
source-level
Post by Tony Proctor
Post by Tony Proctor
interpretation, but I took that to be obvious.
I personally wasn't trying to denigrate VB or it run-time environment. I
have a large experience with proprietary soft instruction codes and their
virtual machines. I mainly wanted to emphasise that there's no JIT or
other
Post by Tony Proctor
form of run-time translation of p-code to native code, and you've
confirmed
Post by Tony Proctor
you agree with that here.
Tony Proctor
Yes, of course we would agree on how pcode is actually implemented.
I never meant to suggest otherwise, nor to target your post personally, only
that the terms "interpret" and "JIT" are often charged by experience with
other language platforms and that erroneous conclusions are often the
result.
This is in many cases a difficult media, because of the limitations in space
and the wordsmithing abilities of its general participants. (The latter is
especially applicable to me. <g>) When one aims at a short unity of effect,
one often comes across as shrill, combative, or worse - pedantically ill
tempered.
<g>
-ralph
Post by Tony Proctor
Post by Ralph
Post by Tony Proctor
I guess you haven't seen any of the previous threads on this subject,
e.g.
http://groups.google.ie/group/microsoft.public.vb.general.discussion/browse_frm/thread/0d579a81dc11e19c/117fe49d249e3c8a?hl=en#117fe49d249e3c8a
Post by Tony Proctor
Post by Tony Proctor
Post by Ralph
Post by Tony Proctor
The point being that P-code is interpreted rather than being converted
to
Post by Ralph
Post by Tony Proctor
native code via a JIT compiler
Tony Proctor
<snipped>
I was going to let this go, for as a 'high-level' view it is mildly
useful.
Post by Ralph
However, much of the mythology and confusion concerning VB PCode comes
from
Post by Ralph
taking the above view and then attempting to extrapolate performance and
implementation issues from it.
First off, VB's version of P-Code is MS's own highly optimized
proprietary
Post by Tony Proctor
Post by Ralph
implementation of "pseudo code". While it has roots in BASIC's
historically
Post by Ralph
interpreted environment and Dr. Wirth's original concept, it is a unique
product. Any similarity to Java and .Net, or to archaic 'interpreted'
languages (early BASICs included) is purely superficial and attempts at
homomorphism will lead to erroneous conclusions.
Second, when a VB6 application is compiled to P-Code the result is a PE
COFF
Post by Ralph
executable file. It makes 'service' calls to the VBRuntime Dll the
same
Post by Tony Proctor
as
Post by Tony Proctor
Post by Ralph
native compiled code. Albeit, often not the same calls and with somewhat
strange setups before and after if you are used to VC, but "native"
calls
Post by Tony Proctor
Post by Ralph
none the less. There is no special invocation of a separate VB Runtime
process - no separate 'engine' running in the back room. The runtime
doesn't
Post by Ralph
magically create any new assembly either - it just runs code with the
supplied data (parameters, stack, memory) like any other library
procedure.
Post by Ralph
In effect the 'interpretation' or 'translation' has already been done at
compile time - there is no intermediate process going on, no
'conversion'
Post by Tony Proctor
to
Post by Ralph
machine code - it is machine code.
P-Code is not 'interpreted' at runtime. There is no JIT compiler
involved.
Post by Tony Proctor
P
Post by Ralph
eriod.
Third, one has to be careful when reading older articles concerning VB's
p-code implementation. It has evolved dramatically over the years. What
you
Post by Ralph
see with VB5/6 is a far better product than what we had with VB1/4.
Another
Post by Ralph
complication is P-Code is undocumented. There were tech papers available
for
Post by Ralph
earlier versions, but since then MS really tighten down the hatches.
Much
Post by Tony Proctor
of
Post by Ralph
what you will read is really just a 'best guess'.
Often MS's p-code is sneered at based on the delusion that it is
'interpreted', but it is a very different advanced technology. So much
so
Post by Tony Proctor
Post by Ralph
that you will find earlier developers hoping that MS would expand the
technology to other languages and environments. That was when Java-type
common-code, run everywhere, language/environments were coming in vogue.
In
Post by Ralph
many ways MS had a step on the competition with this kind of technology.
There are reasons MS's implementation of Java ran circles around Sun's.
You will also find that when the hype and calls for a native compiler
were
Post by Tony Proctor
Post by Ralph
the loudest, there were several articles by VB gurus suggesting that one
should be - "careful for what you wish for". <g>
P-Code runs faster than native code (with the exceptions others have
noted).
Post by Ralph
It compiles into a smaller executable. It is often more robust and
presents
Post by Ralph
fewer surprises - if it runs in the IDE, it will run in the wild. For
many
Post by Tony Proctor
Post by Ralph
reasons it should be the average VBers first choice when making an
executable.
hth
-ralph
Ralph
2005-09-04 22:19:42 UTC
Permalink
Post by Tony Proctor
Actually Ralph, some of worst misconceptions and unjustified diatribes about
VB that I've seen were from C/C++ programmers. Some of these actually
suggested that VB6 was interpreted at source level. Obviously they had no
real experience or knowledge to back this up, and were simply spouting
second-hand mythology, as you suggested earlier.
Tony Proctor
My favorite "Windows Myth".

Years ago, I was once was confronted by my Unix buddies that Windows was
actually written in Pascal. When I laughed I was immediately shown the SDK
manual which did in fact clearly declare all functions as "FAR PASCAL". <g>

It still shows up occasionally.

-ralph
Michael D. Ober
2005-09-05 04:47:22 UTC
Permalink
Not a myth. Windows 1.0 was written in Pascal. At the time, MS didn't have
a decent C compiler but did have one of the best rated Pascal compilers. At
some point, I don't know when, but I suspect it was Windows 386 (written for
Compaq), Windows was completely rewritten in C. However, to maintain
backwards compatibility, all the 16-bit stuff still used the Pascal calling
conventions.

Mike Ober.
Post by Ralph
Post by Tony Proctor
Actually Ralph, some of worst misconceptions and unjustified diatribes
about
Post by Tony Proctor
VB that I've seen were from C/C++ programmers. Some of these actually
suggested that VB6 was interpreted at source level. Obviously they had no
real experience or knowledge to back this up, and were simply spouting
second-hand mythology, as you suggested earlier.
Tony Proctor
My favorite "Windows Myth".
Years ago, I was once was confronted by my Unix buddies that Windows was
actually written in Pascal. When I laughed I was immediately shown the SDK
manual which did in fact clearly declare all functions as "FAR PASCAL". <g>
It still shows up occasionally.
-ralph
Ralph
2005-09-06 18:04:11 UTC
Permalink
Post by Michael D. Ober
Not a myth. Windows 1.0 was written in Pascal. At the time, MS didn't have
a decent C compiler but did have one of the best rated Pascal compilers.
At
Post by Michael D. Ober
some point, I don't know when, but I suspect it was Windows 386 (written for
Compaq), Windows was completely rewritten in C. However, to maintain
backwards compatibility, all the 16-bit stuff still used the Pascal calling
conventions.
Mike Ober.
Post by Ralph
Post by Tony Proctor
Actually Ralph, some of worst misconceptions and unjustified diatribes
about
Post by Tony Proctor
VB that I've seen were from C/C++ programmers. Some of these actually
suggested that VB6 was interpreted at source level. Obviously they had
no
Post by Ralph
Post by Tony Proctor
real experience or knowledge to back this up, and were simply spouting
second-hand mythology, as you suggested earlier.
Tony Proctor
My favorite "Windows Myth".
Years ago, I was once was confronted by my Unix buddies that Windows was
actually written in Pascal. When I laughed I was immediately shown the SDK
manual which did in fact clearly declare all functions as "FAR PASCAL".
<g>
Post by Ralph
It still shows up occasionally.
-ralph
[Way, way, off topic.]
[My apologies to the rest of the group, but I find this difficult to ignore.
Perhaps related to early Germanic elimination training. <g>]

It is a myth. It is interesting to see it is still alive and well.

Like all myths this one also relies on interesting extraneous "facts" but
draws the wrong conclusion.

It is true that MS didn't have a 'decent' compiler until at least version
5.0. (some would argue they still don't <g>) But MS hasn't "eaten their own
dog food" until recently (and AFAIK, they still don't). There has been a lot
of speculation about what compiler they did use. Best evidence is it was an
IBM/Intel compiler, internally modified and optimized. A great deal is also
written in ASM.

[There is also some confusion as Gates launched into a Ms-Unix product
(XENIX) around this time which caused the need for a new "Unix-based"
compiler. Earlier versions of the MS C compiler were predominately pure
"PC-based" (Lattice-C) with lots of vendor-extensions. There is no doubt
that MS-C 5.1 was the result of this effort. It is quite possible that Ms
didn't have "A" c-compiler, but likely used many different ones for separate
pieces/products.]

So yes, Windows was not written with their published C-Compiler products.

"Windows" development actually goes back a lot farther than published
products would indicate. Back then (early 80's) the major thrust for system
developers everywhere was the creation of a Multi-tasking application and
'extended' memory managers. (What good was it to be able to run multiple
tasks, if each task only got a piece of 640k - a quickly diminishing
resource.) The most popular was DESQview and QEMM (Quarterdeck). The earlier
windows products were merely Ms's versions of these types of products.
(Albeit, DESQview was character-based and Windows was Graphical-based). The
Pascal languages available at that time were remarkably useless for
developing these types of utilities, but quite useful for creating
applications that ran in this new environment. Memory Management and graphic
environments were for the most part were written in ASM.

At the time the most common "Graphics Library" for a PC was Turbo-Pascal. As
the Ms compiler had a limited clunky graphics package - it was easy for
outsiders to assume they were looking at a Borland product. I believe that
has given some strength to the myth.

Windows 286/386 were not particularly successful and not near the quality of
QEMM and BlueMax. But everyone needed/wanted a memory manager. [Next to
MS-DOS itself, memory mangers were the second most pirated software. I am
the only person I know that actually bought a copy of Windows 386.] Many
vendors started shipping QEMM et al, with their shiny new 386 boxes. This
annoyed Ms to no end. <g> So Ms bundled the product with their MS-DOS
licensing and forced many OEMs to ship it and not someone else's. That is
where the rumor about Windows 386 being "written" for certain vendors comes
from. The fact that memory managers often needed to be tweaked for some
hardware added to the confusion. That's where the "Compaq" part of the myth
comes from.

However, the myth often skips the fact that about this same time Ms was in
league with IBM in creating OS/2. I can assure you no part of OS/2 was
written in Pascal. However, along with explanations of the Presentation
Manager in the various publications at the time (byte, Dr. Dobbs, ...) you
will also find programs written in Pascal to utilize this new environment.
Why? Turbo-Pascal was the most popular programming tool around at the time.

While naturally incorporating similar memory management and multi-tasking
abilities found in Windows 286/386, later Windows were a different very
expanded product. I guess that is where the myth that Window was
're-written' comes from.

As for why the "Pascal" convention, (there have been and still are various
different conventions that a C compiler can employ. _pascal was also know
as _fortran), became the "standard windows" convention, is based merely on
the nature of the convention itself and the unsuitability of _cdecl for
managing shared libraries (dynamically linked). It has nothing to do with
the Pascal language.

The major feature of the _pascal (_fortran) convention is that it requires
the caller to setup a stack frame before calling the function and to
dismantle it afterwards. When the compiler compiled a Windows application it
inserted a prolog and epilog to this stack framing. These segments contained
nop instructions. At runtime Windows then used these 'empty' instructions to
insert mappings to the dlls from the application's address space.
(thunking). You can't use _cdecl in this case, because with it the callee
controlled the stack and if you fiddled with the address space of a shared
component during runtime - copy on write would create multiple different
instances of paragraphs and segments of the library - a couple of extra ones
for each application using its services, and what would be the point in
that?

While, how all that "thunking" is done did changed with the migration to
32-bit, the _pascal convention was not kept to be backward-compatible - it
was kept because it is still needed to managed shared libraries. There are
other issues as well, but this is the main one.

I suppose Ms could have come up with their own unique directive, but it is
important to note, that _pascal, __pascal, PASCAL, _Pascal, etc. were
already a commonly known directive and supported by all mainstream C
compilers. (Many compilers that also supported _fortran treated the case of
the exported names somewhat differently - most supported _pascal very
consistently across the board) Ms would have annoyed quite a few software
vendors and independent programmers if they would suddenly have required
everyone to add a new define to their code or require a Ms compiler. Of
course now most compilers do support "windows extensions" and it is a mute
point.

hope this helps to clear up the myth.

-ralph
m.posseth
2005-09-06 18:51:48 UTC
Permalink
Ralph ,,

Interesting information ,thank you for sharing

regards

Michel Posseth
Post by Michael D. Ober
Post by Michael D. Ober
Not a myth. Windows 1.0 was written in Pascal. At the time, MS didn't
have
Post by Michael D. Ober
a decent C compiler but did have one of the best rated Pascal compilers.
At
Post by Michael D. Ober
some point, I don't know when, but I suspect it was Windows 386 (written
for
Post by Michael D. Ober
Compaq), Windows was completely rewritten in C. However, to maintain
backwards compatibility, all the 16-bit stuff still used the Pascal
calling
Post by Michael D. Ober
conventions.
Mike Ober.
Post by Ralph
Post by Tony Proctor
Actually Ralph, some of worst misconceptions and unjustified diatribes
about
Post by Tony Proctor
VB that I've seen were from C/C++ programmers. Some of these actually
suggested that VB6 was interpreted at source level. Obviously they had
no
Post by Ralph
Post by Tony Proctor
real experience or knowledge to back this up, and were simply spouting
second-hand mythology, as you suggested earlier.
Tony Proctor
My favorite "Windows Myth".
Years ago, I was once was confronted by my Unix buddies that Windows was
actually written in Pascal. When I laughed I was immediately shown the
SDK
Post by Michael D. Ober
Post by Ralph
manual which did in fact clearly declare all functions as "FAR PASCAL".
<g>
Post by Ralph
It still shows up occasionally.
-ralph
[Way, way, off topic.]
[My apologies to the rest of the group, but I find this difficult to ignore.
Perhaps related to early Germanic elimination training. <g>]
It is a myth. It is interesting to see it is still alive and well.
Like all myths this one also relies on interesting extraneous "facts" but
draws the wrong conclusion.
It is true that MS didn't have a 'decent' compiler until at least version
5.0. (some would argue they still don't <g>) But MS hasn't "eaten their own
dog food" until recently (and AFAIK, they still don't). There has been a lot
of speculation about what compiler they did use. Best evidence is it was an
IBM/Intel compiler, internally modified and optimized. A great deal is also
written in ASM.
[There is also some confusion as Gates launched into a Ms-Unix product
(XENIX) around this time which caused the need for a new "Unix-based"
compiler. Earlier versions of the MS C compiler were predominately pure
"PC-based" (Lattice-C) with lots of vendor-extensions. There is no doubt
that MS-C 5.1 was the result of this effort. It is quite possible that Ms
didn't have "A" c-compiler, but likely used many different ones for separate
pieces/products.]
So yes, Windows was not written with their published C-Compiler products.
"Windows" development actually goes back a lot farther than published
products would indicate. Back then (early 80's) the major thrust for system
developers everywhere was the creation of a Multi-tasking application and
'extended' memory managers. (What good was it to be able to run multiple
tasks, if each task only got a piece of 640k - a quickly diminishing
resource.) The most popular was DESQview and QEMM (Quarterdeck). The earlier
windows products were merely Ms's versions of these types of products.
(Albeit, DESQview was character-based and Windows was Graphical-based). The
Pascal languages available at that time were remarkably useless for
developing these types of utilities, but quite useful for creating
applications that ran in this new environment. Memory Management and graphic
environments were for the most part were written in ASM.
At the time the most common "Graphics Library" for a PC was Turbo-Pascal. As
the Ms compiler had a limited clunky graphics package - it was easy for
outsiders to assume they were looking at a Borland product. I believe that
has given some strength to the myth.
Windows 286/386 were not particularly successful and not near the quality of
QEMM and BlueMax. But everyone needed/wanted a memory manager. [Next to
MS-DOS itself, memory mangers were the second most pirated software. I am
the only person I know that actually bought a copy of Windows 386.] Many
vendors started shipping QEMM et al, with their shiny new 386 boxes. This
annoyed Ms to no end. <g> So Ms bundled the product with their MS-DOS
licensing and forced many OEMs to ship it and not someone else's. That is
where the rumor about Windows 386 being "written" for certain vendors comes
from. The fact that memory managers often needed to be tweaked for some
hardware added to the confusion. That's where the "Compaq" part of the myth
comes from.
However, the myth often skips the fact that about this same time Ms was in
league with IBM in creating OS/2. I can assure you no part of OS/2 was
written in Pascal. However, along with explanations of the Presentation
Manager in the various publications at the time (byte, Dr. Dobbs, ...) you
will also find programs written in Pascal to utilize this new environment.
Why? Turbo-Pascal was the most popular programming tool around at the time.
While naturally incorporating similar memory management and multi-tasking
abilities found in Windows 286/386, later Windows were a different very
expanded product. I guess that is where the myth that Window was
're-written' comes from.
As for why the "Pascal" convention, (there have been and still are various
different conventions that a C compiler can employ. _pascal was also know
as _fortran), became the "standard windows" convention, is based merely on
the nature of the convention itself and the unsuitability of _cdecl for
managing shared libraries (dynamically linked). It has nothing to do with
the Pascal language.
The major feature of the _pascal (_fortran) convention is that it requires
the caller to setup a stack frame before calling the function and to
dismantle it afterwards. When the compiler compiled a Windows application it
inserted a prolog and epilog to this stack framing. These segments contained
nop instructions. At runtime Windows then used these 'empty' instructions to
insert mappings to the dlls from the application's address space.
(thunking). You can't use _cdecl in this case, because with it the callee
controlled the stack and if you fiddled with the address space of a shared
component during runtime - copy on write would create multiple different
instances of paragraphs and segments of the library - a couple of extra ones
for each application using its services, and what would be the point in
that?
While, how all that "thunking" is done did changed with the migration to
32-bit, the _pascal convention was not kept to be backward-compatible - it
was kept because it is still needed to managed shared libraries. There are
other issues as well, but this is the main one.
I suppose Ms could have come up with their own unique directive, but it is
important to note, that _pascal, __pascal, PASCAL, _Pascal, etc. were
already a commonly known directive and supported by all mainstream C
compilers. (Many compilers that also supported _fortran treated the case of
the exported names somewhat differently - most supported _pascal very
consistently across the board) Ms would have annoyed quite a few software
vendors and independent programmers if they would suddenly have required
everyone to add a new define to their code or require a Ms compiler. Of
course now most compilers do support "windows extensions" and it is a mute
point.
hope this helps to clear up the myth.
-ralph
Tony Proctor
2005-09-06 18:52:37 UTC
Permalink
So was that a 'yes' or a 'no' Ralph? :-))

Tony Proctor
Post by Michael D. Ober
Post by Michael D. Ober
Not a myth. Windows 1.0 was written in Pascal. At the time, MS didn't
have
Post by Michael D. Ober
a decent C compiler but did have one of the best rated Pascal compilers.
At
Post by Michael D. Ober
some point, I don't know when, but I suspect it was Windows 386 (written
for
Post by Michael D. Ober
Compaq), Windows was completely rewritten in C. However, to maintain
backwards compatibility, all the 16-bit stuff still used the Pascal
calling
Post by Michael D. Ober
conventions.
Mike Ober.
Post by Ralph
Post by Tony Proctor
Actually Ralph, some of worst misconceptions and unjustified diatribes
about
Post by Tony Proctor
VB that I've seen were from C/C++ programmers. Some of these actually
suggested that VB6 was interpreted at source level. Obviously they had
no
Post by Ralph
Post by Tony Proctor
real experience or knowledge to back this up, and were simply spouting
second-hand mythology, as you suggested earlier.
Tony Proctor
My favorite "Windows Myth".
Years ago, I was once was confronted by my Unix buddies that Windows was
actually written in Pascal. When I laughed I was immediately shown the
SDK
Post by Michael D. Ober
Post by Ralph
manual which did in fact clearly declare all functions as "FAR PASCAL".
<g>
Post by Ralph
It still shows up occasionally.
-ralph
[Way, way, off topic.]
[My apologies to the rest of the group, but I find this difficult to ignore.
Perhaps related to early Germanic elimination training. <g>]
It is a myth. It is interesting to see it is still alive and well.
Like all myths this one also relies on interesting extraneous "facts" but
draws the wrong conclusion.
It is true that MS didn't have a 'decent' compiler until at least version
5.0. (some would argue they still don't <g>) But MS hasn't "eaten their own
dog food" until recently (and AFAIK, they still don't). There has been a lot
of speculation about what compiler they did use. Best evidence is it was an
IBM/Intel compiler, internally modified and optimized. A great deal is also
written in ASM.
[There is also some confusion as Gates launched into a Ms-Unix product
(XENIX) around this time which caused the need for a new "Unix-based"
compiler. Earlier versions of the MS C compiler were predominately pure
"PC-based" (Lattice-C) with lots of vendor-extensions. There is no doubt
that MS-C 5.1 was the result of this effort. It is quite possible that Ms
didn't have "A" c-compiler, but likely used many different ones for separate
pieces/products.]
So yes, Windows was not written with their published C-Compiler products.
"Windows" development actually goes back a lot farther than published
products would indicate. Back then (early 80's) the major thrust for system
developers everywhere was the creation of a Multi-tasking application and
'extended' memory managers. (What good was it to be able to run multiple
tasks, if each task only got a piece of 640k - a quickly diminishing
resource.) The most popular was DESQview and QEMM (Quarterdeck). The earlier
windows products were merely Ms's versions of these types of products.
(Albeit, DESQview was character-based and Windows was Graphical-based). The
Pascal languages available at that time were remarkably useless for
developing these types of utilities, but quite useful for creating
applications that ran in this new environment. Memory Management and graphic
environments were for the most part were written in ASM.
At the time the most common "Graphics Library" for a PC was Turbo-Pascal. As
the Ms compiler had a limited clunky graphics package - it was easy for
outsiders to assume they were looking at a Borland product. I believe that
has given some strength to the myth.
Windows 286/386 were not particularly successful and not near the quality of
QEMM and BlueMax. But everyone needed/wanted a memory manager. [Next to
MS-DOS itself, memory mangers were the second most pirated software. I am
the only person I know that actually bought a copy of Windows 386.] Many
vendors started shipping QEMM et al, with their shiny new 386 boxes. This
annoyed Ms to no end. <g> So Ms bundled the product with their MS-DOS
licensing and forced many OEMs to ship it and not someone else's. That is
where the rumor about Windows 386 being "written" for certain vendors comes
from. The fact that memory managers often needed to be tweaked for some
hardware added to the confusion. That's where the "Compaq" part of the myth
comes from.
However, the myth often skips the fact that about this same time Ms was in
league with IBM in creating OS/2. I can assure you no part of OS/2 was
written in Pascal. However, along with explanations of the Presentation
Manager in the various publications at the time (byte, Dr. Dobbs, ...) you
will also find programs written in Pascal to utilize this new environment.
Why? Turbo-Pascal was the most popular programming tool around at the time.
While naturally incorporating similar memory management and multi-tasking
abilities found in Windows 286/386, later Windows were a different very
expanded product. I guess that is where the myth that Window was
're-written' comes from.
As for why the "Pascal" convention, (there have been and still are various
different conventions that a C compiler can employ. _pascal was also know
as _fortran), became the "standard windows" convention, is based merely on
the nature of the convention itself and the unsuitability of _cdecl for
managing shared libraries (dynamically linked). It has nothing to do with
the Pascal language.
The major feature of the _pascal (_fortran) convention is that it requires
the caller to setup a stack frame before calling the function and to
dismantle it afterwards. When the compiler compiled a Windows application it
inserted a prolog and epilog to this stack framing. These segments contained
nop instructions. At runtime Windows then used these 'empty' instructions to
insert mappings to the dlls from the application's address space.
(thunking). You can't use _cdecl in this case, because with it the callee
controlled the stack and if you fiddled with the address space of a shared
component during runtime - copy on write would create multiple different
instances of paragraphs and segments of the library - a couple of extra ones
for each application using its services, and what would be the point in
that?
While, how all that "thunking" is done did changed with the migration to
32-bit, the _pascal convention was not kept to be backward-compatible - it
was kept because it is still needed to managed shared libraries. There are
other issues as well, but this is the main one.
I suppose Ms could have come up with their own unique directive, but it is
important to note, that _pascal, __pascal, PASCAL, _Pascal, etc. were
already a commonly known directive and supported by all mainstream C
compilers. (Many compilers that also supported _fortran treated the case of
the exported names somewhat differently - most supported _pascal very
consistently across the board) Ms would have annoyed quite a few software
vendors and independent programmers if they would suddenly have required
everyone to add a new define to their code or require a Ms compiler. Of
course now most compilers do support "windows extensions" and it is a mute
point.
hope this helps to clear up the myth.
-ralph
J French
2005-09-07 11:28:33 UTC
Permalink
On Tue, 6 Sep 2005 13:04:11 -0500, "Ralph" <***@yahoo.com>
wrote:

<snip>
Post by Ralph
[Way, way, off topic.]
[My apologies to the rest of the group, but I find this difficult to ignore.
Perhaps related to early Germanic elimination training. <g>]
Just for clarification :-

Directive Parameter order Clean-up Passes parameters in registers?
register Left-to-right Routine Yes
pascal Left-to-right Routine No
cdecl Right-to-left Caller No
stdcall Right-to-left Routine No
safecall Right-to-left Routine No

There is a rumour that parts of MSDOS 1.0 (AKA QDOS from Seattle
Systems) was written in Pascal
Ralph
2005-09-07 13:25:03 UTC
Permalink
Post by J French
<snip>
Post by Ralph
[Way, way, off topic.]
[My apologies to the rest of the group, but I find this difficult to ignore.
Perhaps related to early Germanic elimination training. <g>]
Just for clarification :-
Directive Parameter order Clean-up Passes parameters in registers?
register Left-to-right Routine Yes
pascal Left-to-right Routine No
cdecl Right-to-left Caller No
stdcall Right-to-left Routine No
safecall Right-to-left Routine No
There is a rumour that parts of MSDOS 1.0 (AKA QDOS from Seattle
Systems) was written in Pascal
Your Delphi roots are showing. <g>

The "This Was Really Written In PASCAL First" phenomena has always
interested me. It shows up everywhere. There isn't a single tool, utility,
or operating system feature in the PC World that someone, someplace, doesn't
claim influence or invention from Pascal. It reminds me of that Cold War
tradition where there was nothing of a technological nature that wasn't
invented by a Russian first.

I have been informed on occasion that "Thunder", VB's root, was written in
Pascal.

IMHO: most of it comes from sour grapes. Of all the bizarre events of PC's
early years one of the most amazing is the fall of Pascal. Although it was a
time associated with a multitude of tools - Pascal ruled. Pascal was taught
as a first language everywhere. It was hailed as the primary tool on our way
to that new concept - Structured Programming. Everyone, even us die-hard C
programmers admitted that C was perhaps not 'suitable' for high-level
programming and agreed it was awkward for user interfaces, unless you paid
big bucks for graphical libraries. In comparison after comparison, C vs.
Pascal, C lost.

Then suddenly it was gone.

I feel this view is substantiated by the fact most 'rumors' can be found on
LINIX, Java, or Borland sites, i.e., where ever an anti-Microsoft crowd
gathers. It is although this in some way reflects on the superiority of
Pascal or <insert tool> and cheapens Microsoft's achievements.

However, I am not surprised to discover that in many cases it is true.
Pascal was at one time the premier language. Anyone, with $99, could buy
Turbo-Pascal and conquer the PC. It brought tons of people into programming
who wouldn't have made it past pg32 in the K&R - not because they couldn't
understand it - but out of shear boredom. <g> Also lets not forget that for
a time every 'computer' student was exposed to Pascal. How can there not be
an influence on what we see today?

There are definitely "Pascal influences" in many PC products. Especially
anything requiring a 'front end'. And many inventions were thought of by
Russians first, as well.

-ralph
Ralph
2005-09-07 13:54:29 UTC
Permalink
Post by J French
<snip>
Post by Ralph
[Way, way, off topic.]
[My apologies to the rest of the group, but I find this difficult to ignore.
Perhaps related to early Germanic elimination training. <g>]
Just for clarification :-
Directive Parameter order Clean-up Passes parameters in registers?
register Left-to-right Routine Yes
pascal Left-to-right Routine No
cdecl Right-to-left Caller No
stdcall Right-to-left Routine No
safecall Right-to-left Routine No
There is a rumour that parts of MSDOS 1.0 (AKA QDOS from Seattle
Systems) was written in Pascal
Also, it is interesting to point out to those that claim that using the
_pascal calling convention is a sign of a "Pascal language" influence, that
_pascal is not the default calling convention for most Pascal compilers.
Register is. <g>

-ralph
J French
2005-09-07 14:25:30 UTC
Permalink
On Wed, 7 Sep 2005 08:54:29 -0500, "Ralph" <***@yahoo.com>
wrote:

<snip>
Post by Ralph
Also, it is interesting to point out to those that claim that using the
_pascal calling convention is a sign of a "Pascal language" influence, that
_pascal is not the default calling convention for most Pascal compilers.
Register is. <g>
Personally I reckon that BASIC syntax is far stronger than that of
Pascal or the later offering from K&R - curiously called 'C'

I have a total loathing of 'C', probably because I read K&R's White
Book just after I had understood ASM, which was 10 years after I had
discovered that programming was rather useful.

Anyway - I rather like your disssertations
- especially when they turn 'boorish' (your phrase)

I just wish that Borland would produce a variation that was BASIC
- with in-line 'anything'

<g>
Ralph
2005-09-07 15:59:50 UTC
Permalink
Post by J French
<snip>
Post by Ralph
Also, it is interesting to point out to those that claim that using the
_pascal calling convention is a sign of a "Pascal language" influence, that
_pascal is not the default calling convention for most Pascal compilers.
Register is. <g>
Personally I reckon that BASIC syntax is far stronger than that of
Pascal or the later offering from K&R - curiously called 'C'
I have a total loathing of 'C', probably because I read K&R's White
Book just after I had understood ASM, which was 10 years after I had
discovered that programming was rather useful.
Anyway - I rather like your disssertations
- especially when they turn 'boorish' (your phrase)
I just wish that Borland would produce a variation that was BASIC
- with in-line 'anything'
<g>
I really don't know much about the early history of BASIC because back then
I "loathed" it. <g>

In my circle - real programmers just didn't use basic. To bring up 'basic'
in a conversation was met with the same response as if you had announced you
were a pedophile. Actually you stood a better chance of being forgiven if
the latter.

The first time I was confronted with Basic was on a contract in '92 (?). I
was employed to write "custom controls" (anyone remember the CDK?) and Dlls
to support a suite of VB 1 programs. I was given several books on VB to
catch-up. I immediately went out and bought some school bookcovers so no one
could see what I was reading or carrying. <g>

Basic was quite prevalent before that and in looking back I remember many,
many very good business applications written in Microsoft Basic. They were
always met with the "Dancing Bear" analogy. Total amazement that it danced
at all with no attempt to look beyond that.

Visual Basic is likely more responsible for killing off Borland as anything.
(Except sometimes it is very difficult to determine if it was murder or
suicide. <g>)

-ralph
J French
2005-09-08 08:49:17 UTC
Permalink
On Wed, 7 Sep 2005 10:59:50 -0500, "Ralph" <***@yahoo.com>
wrote:
<snip>
Post by Ralph
I really don't know much about the early history of BASIC because back then
I "loathed" it. <g>
In my circle - real programmers just didn't use basic. To bring up 'basic'
in a conversation was met with the same response as if you had announced you
were a pedophile. Actually you stood a better chance of being forgiven if
the latter.
I first encountered BASIC on a very early Commodore PET in about 1977

I went through various dialects of MS BASICs then in 1987 I got
heavily into ASM

The combination of BASIC and ASM was incredibly powerful, we could
write lightning fast code that could do just about anything.

It really hacked us off when people (typically non-programming
techies) turned up their noses.

Finally the SW House I then worked for migrated to C
- turning formerly highly productive programmers into coders that took
an age to get anything out of the door.

Fortunately I left before the migration was complete
Ralph
2005-09-08 11:05:27 UTC
Permalink
Post by J French
<snip>
Post by Ralph
I really don't know much about the early history of BASIC because back then
I "loathed" it. <g>
In my circle - real programmers just didn't use basic. To bring up 'basic'
in a conversation was met with the same response as if you had announced you
were a pedophile. Actually you stood a better chance of being forgiven if
the latter.
I first encountered BASIC on a very early Commodore PET in about 1977
I went through various dialects of MS BASICs then in 1987 I got
heavily into ASM
The combination of BASIC and ASM was incredibly powerful, we could
write lightning fast code that could do just about anything.
It really hacked us off when people (typically non-programming
techies) turned up their noses.
Finally the SW House I then worked for migrated to C
- turning formerly highly productive programmers into coders that took
an age to get anything out of the door.
Fortunately I left before the migration was complete
Ralph
2005-09-08 13:17:59 UTC
Permalink
Post by J French
<snip>
Post by Ralph
I really don't know much about the early history of BASIC because back then
I "loathed" it. <g>
In my circle - real programmers just didn't use basic. To bring up 'basic'
in a conversation was met with the same response as if you had announced you
were a pedophile. Actually you stood a better chance of being forgiven if
the latter.
I first encountered BASIC on a very early Commodore PET in about 1977
I went through various dialects of MS BASICs then in 1987 I got
heavily into ASM
The combination of BASIC and ASM was incredibly powerful, we could
write lightning fast code that could do just about anything.
It really hacked us off when people (typically non-programming
techies) turned up their noses.
Finally the SW House I then worked for migrated to C
- turning formerly highly productive programmers into coders that took
an age to get anything out of the door.
Fortunately I left before the migration was complete
I have always been amazed at people who could couple the terms "highly
productive" and "ASM" and mean it. Watching a good assembly programmer at
work is like having a front seat at the Magic Castle. <g>

I dabbled in ASM. Back then it was impossible to avoid it. Mostly with
printers and other devices. Plug 'n Play is so pervausive today, people
forget that once upon a time opening any new crate was just the beginning of
an adventure and launched another round of "How do I get that d**n thing to
talk to this d**n thing". And of course it was a time when processing speeds
were often measured in 'coffee breaks'. Anything to squeeze that last little
bit of performance.

So I did a lot of ASM, but was never particularly good at it. My creations
were more like ransom notes that anything 'crafted'. I turned thievery into
an avocation. I stole bits and pieces from everywhere. My "MASM" was more
"Macro" than "ASM". <g>

I just sort of cobbled things together. I remember one particular moment
when showing off one of my achievements. My boss looked over the code and
announced that I done an excellent job in improving the processing of a
particular loop to all within hearing. (Imagine my wide grin and pleasure.)
"But is it really necessary to call the loop three times?". <G>

I also often wrote C code, then dumped the assembly, tweaked it, then
recompiled. Ha. Talk about a maintenance nightmare. It was great when
contracting, because you were guaranteed to get called back. But then you
looked like an idiot while you sat there trying to figure out what you had
done. <g>

I no longer do much ASM, but the latter is still not an unfrequent event.
Somethings never change.

-ralph
J French
2005-09-08 15:22:38 UTC
Permalink
On Thu, 8 Sep 2005 08:17:59 -0500, "Ralph" <***@yahoo.com>
wrote:

<snip>
Post by Ralph
I have always been amazed at people who could couple the terms "highly
productive" and "ASM" and mean it. Watching a good assembly programmer at
work is like having a front seat at the Magic Castle. <g>
I dabbled in ASM. Back then it was impossible to avoid it. Mostly with
printers and other devices. Plug 'n Play is so pervausive today, people
forget that once upon a time opening any new crate was just the beginning of
an adventure and launched another round of "How do I get that d**n thing to
talk to this d**n thing". And of course it was a time when processing speeds
were often measured in 'coffee breaks'. Anything to squeeze that last little
bit of performance.
So I did a lot of ASM, but was never particularly good at it. My creations
were more like ransom notes that anything 'crafted'. I turned thievery into
an avocation. I stole bits and pieces from everywhere. My "MASM" was more
"Macro" than "ASM". <g>
I just sort of cobbled things together. I remember one particular moment
when showing off one of my achievements. My boss looked over the code and
announced that I done an excellent job in improving the processing of a
particular loop to all within hearing. (Imagine my wide grin and pleasure.)
"But is it really necessary to call the loop three times?". <G>
I also often wrote C code, then dumped the assembly, tweaked it, then
recompiled. Ha. Talk about a maintenance nightmare. It was great when
contracting, because you were guaranteed to get called back. But then you
looked like an idiot while you sat there trying to figure out what you had
done. <g>
I no longer do much ASM, but the latter is still not an unfrequent event.
Somethings never change.
The thing is that a coder needs three hats

1) Application coder (system analyst who can code)
2) Library coder - writing re-useable utilities
(not frigging AX stuff)
3) Deep level coder writing heavily tested OBJ files for the above two

Provided one does not get confused and mix 'hats', it works rather
well.

ASM really ceased to be fun since they brought out the .486 which has
a RISC element favouring 'Noddy ASM'
- one can macro-ize it but ... it is not the same thing.

I really miss the old days when most 'programmers' did not have a clue
what they were doing, and someone who could code at any level, yet
understand the underlying business was invaluable.
Tom Esh
2005-09-08 15:45:06 UTC
Permalink
Post by J French
I really miss the old days when most 'programmers' did not have a clue
what they were doing, and someone who could code at any level, yet
understand the underlying business was invaluable.
LOL
Some would call that the very definition of "cowboy coder"
Yeeeha! <g>


-Tom
MVP - Visual Basic
(please post replies to the newsgroup)
Ralph
2005-09-08 20:51:55 UTC
Permalink
Post by Tom Esh
Post by J French
I really miss the old days when most 'programmers' did not have a clue
what they were doing, and someone who could code at any level, yet
understand the underlying business was invaluable.
LOL
Some would call that the very definition of "cowboy coder"
Yeeeha! <g>
-Tom
MVP - Visual Basic
(please post replies to the newsgroup)
"Cowboy Coders" are very much still alive and well. Although I believe they
have formed their own rodeo associations - they are now called Extreme
Programmers. The terminology has change, but maximum agility and minimum
thought is still the prime requirement.

XP! Yeeeha!
<g>
-ralph

Ralph
2005-09-08 20:41:19 UTC
Permalink
Post by J French
<snip>
Post by Ralph
I have always been amazed at people who could couple the terms "highly
productive" and "ASM" and mean it. Watching a good assembly programmer at
work is like having a front seat at the Magic Castle. <g>
I dabbled in ASM. Back then it was impossible to avoid it. Mostly with
printers and other devices. Plug 'n Play is so pervausive today, people
forget that once upon a time opening any new crate was just the beginning of
an adventure and launched another round of "How do I get that d**n thing to
talk to this d**n thing". And of course it was a time when processing speeds
were often measured in 'coffee breaks'. Anything to squeeze that last little
bit of performance.
So I did a lot of ASM, but was never particularly good at it. My creations
were more like ransom notes that anything 'crafted'. I turned thievery into
an avocation. I stole bits and pieces from everywhere. My "MASM" was more
"Macro" than "ASM". <g>
I just sort of cobbled things together. I remember one particular moment
when showing off one of my achievements. My boss looked over the code and
announced that I done an excellent job in improving the processing of a
particular loop to all within hearing. (Imagine my wide grin and pleasure.)
"But is it really necessary to call the loop three times?". <G>
I also often wrote C code, then dumped the assembly, tweaked it, then
recompiled. Ha. Talk about a maintenance nightmare. It was great when
contracting, because you were guaranteed to get called back. But then you
looked like an idiot while you sat there trying to figure out what you had
done. <g>
I no longer do much ASM, but the latter is still not an unfrequent event.
Somethings never change.
The thing is that a coder needs three hats
1) Application coder (system analyst who can code)
2) Library coder - writing re-useable utilities
(not frigging AX stuff)
3) Deep level coder writing heavily tested OBJ files for the above two
Provided one does not get confused and mix 'hats', it works rather
well.
ASM really ceased to be fun since they brought out the .486 which has
a RISC element favouring 'Noddy ASM'
- one can macro-ize it but ... it is not the same thing.
I really miss the old days when most 'programmers' did not have a clue
what they were doing, and someone who could code at any level, yet
understand the underlying business was invaluable.
Didn't we have a thread here once, where an OP inquired "Where and How did
Programmers get started?" and it universally came out the majority of us,
with ~20 years, just sort of backed into it.

In many cases, the true key of success laid not in what we knew or didn't
know, but in that we didn't know we didn't know it. <g>

-ralph
Michael D. Ober
2005-09-07 19:04:22 UTC
Permalink
If I remember correctly, the MS-DOS 1.25 manual that came with my Columbia
Data Systems IBM Clone stated that MS-DOS was completely written in
Assembler for performance. It took many of its concepts from CP/M, but had
been completely rewritten to take advantage of the 16-bit processing
available on the 8086 processor.

As for using the FAR PASCAL calling convention in an OS, it's far easier to
efficiently implement this than the FAR C convention. C supports variable
arguments - printf(<format string>, arglist); comes to mind. Pascal
doesn't. This makes compiler libraries far easier to write. An OS API is
nothing more than a very large compiler library.

Mike Ober.
Post by Ralph
Post by J French
<snip>
Post by Ralph
[Way, way, off topic.]
[My apologies to the rest of the group, but I find this difficult to
ignore.
Post by J French
Post by Ralph
Perhaps related to early Germanic elimination training. <g>]
Just for clarification :-
Directive Parameter order Clean-up Passes parameters in registers?
register Left-to-right Routine Yes
pascal Left-to-right Routine No
cdecl Right-to-left Caller No
stdcall Right-to-left Routine No
safecall Right-to-left Routine No
There is a rumour that parts of MSDOS 1.0 (AKA QDOS from Seattle
Systems) was written in Pascal
Also, it is interesting to point out to those that claim that using the
_pascal calling convention is a sign of a "Pascal language" influence, that
_pascal is not the default calling convention for most Pascal compilers.
Register is. <g>
-ralph
Loading...