PowerBasic - will it recover or is the Air out?

Started by Theo Gottwald, December 06, 2012, 09:40:33 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Carlo Pagani

Eric, it's about survival for a few of us who, unlike Patrice, have been riding one horse. It is also about fear of the unknown and hope diminishes for each time the web site is down. I don't believe it is about control of posts. PB is used across many time zones and the forums is a big repository of knowlege which I use daily for that purpose.

Today, more than ever it is about communicating and keeping your customers informed. Yes, the PB community is most loyal, and of course, the employees and Viv have our sympathies and all the more reason to communicate better and alay my fears.

Patrice Terrier

In the case of PowerBASIC, Bob was the "keyman", and when you loose the "keyman" very few company can survive, even those having contracted a special insurance for that typical situation, because money could never replace such an atypique brain.

Trying to imagine that a leading group of talented programmers could take up on Bob's work is an unrealistic expectation.

On the other way, when the member of the PB's permanent staff is not himself an assembly programmer, and when he needs to rely on external resources, sooner or later that would lead to other (ego) problems.


I am afraid, i could not see any reasonable forthcoming future for PB.

Patrice Terrier
GDImage (advanced graphic addon)

Theo Gottwald

I see the problem that the money "that is in there" may not be intersting to seriouse bussiness people unless the whoile thing could be modernized and attract more then just a handfull of long year fans.
But my impression on that this could happen is not very high.
Like Jose said "I think that they never have liked suggestions about using third party tools."

Therefore i assume that it will go on for a while. But no bussiness that is not earning enough money can last long, unless idealistic people are behind.
Thats what i do not see. So i am checking NOW if somebody ha s a plan B.

The point is that writing a compiler need soiphisticated ASM knowledge, and i do not have that.
Otherwise I'd been starting today. Aside from that COM stuff I'd just do it. If I'd have Hutch or Paul Dixons ASM Knowlegde.
The algorhytms for a compiler-language are not secret bussiness, its normal IT and anybody with enough ASM knowledge can do it.

I have no expectation that any compiler in the future will ever beat Bobs compiler in terms of compilation speed.
Besides that i believe that it was possibly the last compiler that was made in pure ASM.
Hardware is doubling speed every year therefore this would not be not my main concern.

As said, my point here is, that i would like to see PB Syntax to be kept alive and also to see an x64 version of it.
I have Purebasic and  Modula and other  Alternatives, but i like PB ... its so easy.

Having said that ... we are UP again :-). (16-12-12 14:37)

Stan Duraham

Looks like they made some changes and took time off ... might be the right thing to do under the circumstances.

QuoteThe point is that writing a compiler need soiphisticated ASM knowledge...

Not anymore.
You'd probably use LLVM.
You parse your code into IF (intermediate form).
LLVM then spits out binary machine code for; X86, X86-64, PowerPC, PowerPC-64, ARM, Thumb, SPARC, Alpha, CellSPU, MIPS, MSP430, SystemZ, and XCore.
It can also spit out C.

This is used and backed by Apple for Objective-C, it's industrial strength.

LLVM currently supports compiling of C, C++, Objective-C, Fortran, Ada, Haskell, Java bytecode, Python, Ruby, ActionScript, GLSL, D, and Rust, using various front ends.


Chris Holbrook

Stan beat me to it. See http://llvm.org/

So, LLVM back end, maybe a front end from adapting Eros's interpreter?

I'll take one, thanks, Android target of course.

Nothing wrong with thinking big!

Frederick J. Harris

I'm with Eric on this.  Time to wait and see.  For those that wish to be pro-active, learning other languages can't hurt, in any event.

However, I can't help but feel that Bob would have hired folks with backgrounds similiar to his, i.e., knowledge of intel processor architecture, asm skills, maybe some compiler skills.  Put yourself in his shoes for a moment and think.  In hiring, he would probably value those candidates most who had skills similiar to his, with perhaps some additional backgrounds that complemented his skills in some way.  In the past I've seen processor specific questions answered by PowerBASIC staff other than Bob Z. 

Frederick J. Harris

You know, at times I've wondered (I'm sure we all have) of what avail Bob made of other compiler toolchain technologies out there, such as the LLVM just discussed by Stan and Chris.   While I know little to nothing of these issues and am only peripherally interested in them, I have always noted that the PowerBASIC compiler is several orders of magnitude faster than the GCC or Microsoft compilers.   This has led me to suspect that the PowerBASIC compiler design is wholly a creation of Bob's.  I doubt if LLVM was available when Bob was honing his compiler writting skills back in the early 80s. 

Frederick J. Harris

And an examination of the \bin subdirectory of the installation reveals the compiler itself to be an 840 KB executable which doesn't have many other dependencies.  Before PowerBASIC for Windows 7 the whole purchase of a PowerBASIC compiler was received on 1 or 2 3.5" floppies.  And the v6 win compiler was rather advanced - only lacking COM and unicode support.  When one reflects on this it becomes obvious that Bob Zale really meant it with 'smaller - faster'. 

James C. Fuller


Chris Holbrook

PB is "smaller-faster" but also appeals because it is easy -> lower cost of production.

However, it is a dedicated Intel/Windows language compiler and that restricts its appeal these days. 

For this old hack coder** it has been very, very useful, not to mention a lot of fun, but it isn't the only tool in the box.

In retrospect, Bob Zale has kept a plate-spinning act going for an amazingly long time.  I sincerely doubt if a suitable clone will be found and I believe that a very different future awaits for PowerBASIC devotees. Of course, one of Bob's skills was to keep development just abreast of one's sense of exasperation, and in these days of wonder, that will be hard for his successor to follow, as different constituencies in the user base will want to move in different directions, and loyalty cannot always be counted upon.

OTOH a diverse user base means that there will always be some sort of uptake of variants of the product ... but why speculate when you can just sit back and watch the show? Perhaps sparing a thought for those who convinced conservative managements to eschew M$ in favour of PowerBASIC, for their enemies are even now massing at the gates.

Interesting times, etc.

** nowadays one should say "dedicated and vastly experienced IT professional with a passion for his work"

Frederick J. Harris

Of course, Microsoft, being a legal entity rather than a singular person such as Bob Zale, can't die (I guess bankrupt is the operative word there).  However, if one uses their products one can count on having to throw one's code base away every few years for their latest must have programming tool.  Been there and done that.

Chris Holbrook

Quote from: Theo Gottwald on December 16, 2012, 02:36:53 PM
As said, my point here is, that i would like to see PB Syntax to be kept alive and also to see an x64 version of it.
Doesn't Eros Olmi have something very like the PB syntax? Maybe with an open phone line to Eros and a copy of Niklaus Wirth's book on compilers, the Christmas Holidays could be used to good effect?

Charles Pegge

Hi Theo

This must be one of yours.

I am not touting for business but a few days ago, Aurel asked for help translating it from PowerBasic to OxygenBasic. So I did a rough translation, using our own headers and a few other bits with minimal alterations from your original:

'Program Name Form2.bas
'#Compile Exe
'#Include "Win32api.inc"  'Equates, declares, types translated from Windows.h

include "..\..\inc\minwin.inc"

'BOOL TextOut(
'  _In_  HDC hdc,
'  _In_  int nXStart,
'  _In_  int nYStart,
'  _In_  LPCTSTR lpString,
'  _In_  int cchString


macro trim(s)
end macro

macro lowrd(a)
(a and 0xffff)
end macro

macro hiwrd(a)
(a >> 16)
end macro

macro codeptr(c)
end macro

macro varptr(v)
end macro

type tagMSG
  sys   hwnd
  int   message
  sys   wParam
  sys   lParam
  dword time
  POINT pt
end type

  LONG  tmHeight;
  LONG  tmAscent;
  LONG  tmDescent;
  LONG  tmInternalLeading;
  LONG  tmExternalLeading;
  LONG  tmAveCharWidth;
  LONG  tmMaxCharWidth;
  LONG  tmWeight;
  LONG  tmOverhang;
  LONG  tmDigitizedAspectX;
  LONG  tmDigitizedAspectY;
  TCHAR tmFirstChar;
  TCHAR tmLastChar;
  TCHAR tmDefaultChar;
  TCHAR tmBreakChar;
  BYTE  tmItalic;
  BYTE  tmUnderlined;
  BYTE  tmStruckOut;
  BYTE  tmPitchAndFamily;
  BYTE  tmCharSet;
end type

'#recordof textmetric

Type WndEventArgs
  wParam  As Long
  lParam  As Long
  hWnd    As Dword
  hInst   As Dword
  wWidth  As Word
  wHeight As Word
  wX      As Word
  wY      As Word
  wCharHt As Word
  xPos    As Word
  yPos    As Word
  szText[128] as Asciiz '*128
  'szText[128]  As Asciiz '*128
End Type

Function fnWndProc_OnCreate(wea As WndEventArgs) As Long
  Local tm As TEXTMETRIC
  Local hDC As DWord

  Call GetTextMetrics(hDC,@tm)
  'MsgBox("wea.wCharHt=" & Trim$(Str$(tm.tmHeight))) 'If using Console Compiler remark this
  'Print "wea.wCharHt=" & trim$(str$(tm.tmHeight))  'line out and use Print instead!
  Call ReleaseDC(wea.hWnd,hDC)
  return 0
End Function

Function fnWndProc_OnMouseMove(wea As WndEventArgs) As Long
  wea.wX=LoWrd(wea.lParam) : wea.wY=HiWrd(wea.lParam)
  Call InvalidateRect(wea.hWnd,ByVal %NULL,%TRUE)
  return 0
End Function

Function fnWndProc_OnSize(wea As WndEventArgs) As Long
  wea.wWidth=LoWrd(wea.lParam) : wea.wHeight=HiWrd(wea.lParam)
  Call InvalidateRect(wea.hWnd,ByVal %NULL,%TRUE)
  return 0
End Function

Function fnWndProc_OnChar(wea As WndEventArgs) As Long
  Call InvalidateRect(wea.hWnd,ByVal %NULL,%TRUE)

  return 0
End Function

Function fnWndProc_OnLButtonDown(wea As WndEventArgs) As Long
  If wea.wParam=%MK_LBUTTON Then
     wea.xPos=LoWrd(wea.lParam) : wea.yPos=HiWrd(wea.lParam)
     Call InvalidateRect(wea.hWnd,ByVal 0,%TRUE)
  End If

  return 0
End Function

Function fnWndProc_OnPaint(wea As WndEventArgs) As Long
  Local szLine[48] As Asciiz '*48
  Local hDC As Long
  'szLine="MouseX="+Trim$(Str$(wea.wX)) & "  MouseY="+Trim$(Str$(wea.wY))
  szLine="MouseX="+Str$(wea.wX) & "  MouseY="+Str$(wea.wY)
  TextOut (hDC,0,0,strptr(szLine),Len(szLine))
  szLine="wea.wWidth="+Trim$(Str$(wea.wWidth)) & " wea.wHeight=" + Trim$(Str$(wea.wHeight))
  TextOut (hDC,0,16, strptr(szLine),Len(szLine))
  TextOut (hDC,0,32,strptr(wea.szText),Len(wea.szText))
  If wea.xPos<>0 And wea.yPos<>0 Then
     szLine="WM_LBUTTONDOWN At (" & Trim$(Str$(wea.xPos)) & "," & Trim$(Str$(wea.yPos)) & ")"
     TextOut (hDC,wea.xPos,wea.yPos,strptr(szLine),Len(szLine))
     wea.xPos=0 : wea.yPos=0
  End If

  return 0
End Function

Function WndProc(ByVal hWnd As Long,ByVal wMsg As Long,ByVal wParam As Long,ByVal lParam As Long) As Long, callback
  Static wea As WndEventArgs

  Select Case As Long wMsg
    Case %WM_CREATE
      wea.hWnd=hWnd : wea.lParam=lParam : wea.wParam=wParam
      return fnWndProc_OnCreate(wea)
      'Exit Function
      wea.hWnd=hWnd : wea.lParam=lParam : wea.wParam=wParam
      return fnWndProc_OnMouseMove(wea)
      'Exit Function
    Case %WM_SIZE
      wea.hWnd=hWnd : wea.lParam=lParam : wea.wParam=wParam
      return fnWndProc_OnSize(wea)
      'Exit Function
    Case %WM_CHAR
      wea.hWnd=hWnd : wea.lParam=lParam : wea.wParam=wParam
      return fnWndProc_OnChar(wea)
      'Exit Function
      wea.hWnd=hWnd : wea.lParam=lParam : wea.wParam=wParam
      return fnWndProc_OnLButtonDown(wea)
      'Exit Function
    Case %WM_PAINT
      wea.hWnd=hWnd : wea.lParam=lParam : wea.wParam=wParam
      return fnWndProc_OnPaint(wea)
      'Exit Function
    Case %WM_DESTROY
      Call PostQuitMessage(0)
      return 0
      'Exit Function
  End Select

  return DefWindowProc(hWnd,wMsg,wParam,lParam)
End Function

Function WinMain(ByVal hIns As Long, ByVal hPrevIns As Long, lpCmdLine as asciiz, ByVal iShow As Long) As Long
  Local szClassName[6] As Asciiz '*6
  Local wc As WndClassEx
  Local hMainWnd As Dword
  Local Msg As tagMsg

  wc.cbSize=SizeOf(wc)                               : wc.style=0
  wc.lpfnWndProc=CodePtr(WndProc)                    : wc.cbClsExtra=0
  wc.cbWndExtra=0                                    : wc.hInstance=hIns
  wc.hIcon=LoadIcon(%NULL,ByVal %IDI_APPLICATION)    : wc.hCursor=LoadCursor(%NULL,ByVal %IDC_ARROW)
  wc.hbrBackground=GetStockObject(%WHITE_BRUSH)      : wc.lpszMenuName=%NULL
  wc.lpszClassName=VarPtr(szClassName)               : wc.hIconSm=LoadIcon(%NULL,ByVal %IDI_APPLICATION)
  Call RegisterClassEx(@wc)
  %HWND_DESKTOP,0,hIns,ByVal 0)
  Call ShowWindow(hMainWnd,iShow)

  While GetMessage(@Msg,%NULL,0,0)
    Call TranslateMessage(@Msg)
    Call DispatchMessage(@Msg)
  return msg.wParam
End Function

char *c

' « Last Edit: September 12, 2007, 06:16:57 AM by Theo Gottwald »
'17:04 13/12/2012 cp

It will require a few more tweaks to get it going in 64 bit - mainly fixing long handles.

Would you like to see a 64bit version?


Eros Olmi

Quote from: Chris Holbrook on December 16, 2012, 07:53:27 PM
Quote from: Theo Gottwald on December 16, 2012, 02:36:53 PM
As said, my point here is, that i would like to see PB Syntax to be kept alive and also to see an x64 version of it.
Doesn't Eros Olmi have something very like the PB syntax? Maybe with an open phone line to Eros and a copy of Niklaus Wirth's book on compilers, the Christmas Holidays could be used to good effect?

:-[ The world is not ready to have a thinBasic Compiler  ;D
thinBasic Script Interpreter - www.thinbasic.com | www.thinbasic.com/community
Win7Pro 64bit - 8GB Ram - Intel i7 M620 2.67GHz - NVIDIA Quadro FX1800M 1GB

Theo Gottwald

Yes I have also been talking to Eros already.
He said that he currently does not think to make the step to a full compiler language.
Did you look at this llvm-thing already, Eros?
Such a thing sounds like an interesting possible Add on.

While an intermediate code has its strenghts, i do not really believe it will be as effective as its PB.
@Charles i sent you an message. You have been the next on my list. :-)