Pages: [1]
|
 |
|
Author
|
Topic: Learning PowerBASIC (Read 18698 times)
|
Richard van Petrov
Guest
|
What books can I pick up to learn PowerBASIC? The syntax and structure of the language.
|
|
|
Logged
|
|
|
|
hutch--
Administrator
Member
    
Posts: 12013
Mnemonic Driven API Grinder
|
Probably the best source is the vendor, they publish various bits and pieces but they also have a good support forum.
|
|
|
Logged
|
|
|
|
Richard van Petrov
Guest
|
I have tried a Visual Basic 2005 book, but the dialect is different from PowerBASIC's because PowerBASIC doesn't have OOP support or a CLR. Should I try a Visual Basic 6 book?
|
|
|
Logged
|
|
|
|
Richard van Petrov
Guest
|
|
|
|
Logged
|
|
|
|
frktons
|
I have tried a Visual Basic 2005 book, but the dialect is different from PowerBASIC's because PowerBASIC doesn't have OOP support or a CLR. Should I try a Visual Basic 6 book?
The two languages are not entirely compatible, you have to rearrange something. To know what, have a look at the on-line manuals of PowerBASIC. Frank
|
|
|
Logged
|
Mind is like a parachute. You know what to do in order to use it :-)
|
|
|
Bob Zale
Guest
|
Well, Richard, I guess you just can't trust those guys at Wikipedia... PowerBASIC has excellent object support built right in. Internal objects. Com objects. All sorts of good stuff. The best suggestion for learning is to skip Visual Basic. Read the PowerBASIC documentation. Front to back. It came with your compiler, and it's pretty comprehensive. You can also read the complete doc online at the PowerBASIC web site. Just GOTO www.powerbasic.com and click HELP DESK. Questions? Email support@powerbasic.com or post a question on the PowerBASIC forums or perhaps ask it here? PowerBASIC is one publisher that still offers 100% absolutely free tech support for life! Best regards, Bob Zale PowerBASIC Inc.
|
|
|
Logged
|
|
|
|
hutch--
Administrator
Member
    
Posts: 12013
Mnemonic Driven API Grinder
|
Hi Bob, Welcome on board. Always a pleasure to have another experienced assembler programmer floating around here and who has the expertise in PowerBASIC. 
|
|
|
Logged
|
|
|
|
dedndave
|
welcome to the forum, Bob 
|
|
|
Logged
|
|
|
|
Bob Zale
Guest
|
Well, thank you! Hope we can trade a little help and information.
|
|
|
Logged
|
|
|
|
José Roca
New Member

Posts: 24
|
A less advertised feature is that you can also work low-level, in a way not so much different than many of the code I'm seeing in this forum. For example, this Iczelion tutorial .386 .model flat,stdcall option casemap:none include \masm32\include\windows.inc include \masm32\include\user32.inc includelib \masm32\lib\user32.lib ; calls to functions in user32.lib and kernel32.lib include \masm32\include\kernel32.inc includelib \masm32\lib\kernel32.lib
WinMain proto :DWORD,:DWORD,:DWORD,:DWORD
.DATA ; initialized data ClassName db "SimpleWinClass",0 ; the name of our window class AppName db "Our First Window",0 ; the name of our window
.DATA? ; Uninitialized data hInstance HINSTANCE ? ; Instance handle of our program CommandLine LPSTR ? .CODE ; Here begins our code start: invoke GetModuleHandle, NULL ; get the instance handle of our program. ; Under Win32, hmodule==hinstance mov hInstance,eax mov hInstance,eax invoke GetCommandLine ; get the command line. You don't have to call this function IF ; your program doesn't process the command line. mov CommandLine,eax invoke WinMain, hInstance,NULL,CommandLine, SW_SHOWDEFAULT ; call the main function invoke ExitProcess, eax ; quit our program. The exit code is returned in eax from WinMain.
WinMain proc hInst:HINSTANCE,hPrevInst:HINSTANCE,CmdLine:LPSTR,CmdShow:DWORD LOCAL wc:WNDCLASSEX ; create local variables on stack LOCAL msg:MSG LOCAL hwnd:HWND
mov wc.cbSize,SIZEOF WNDCLASSEX ; fill values in members of wc mov wc.style, CS_HREDRAW or CS_VREDRAW mov wc.lpfnWndProc, OFFSET WndProc mov wc.cbClsExtra,NULL mov wc.cbWndExtra,NULL push hInstance pop wc.hInstance mov wc.hbrBackground,COLOR_WINDOW+1 mov wc.lpszMenuName,NULL mov wc.lpszClassName,OFFSET ClassName invoke LoadIcon,NULL,IDI_APPLICATION mov wc.hIcon,eax mov wc.hIconSm,eax invoke LoadCursor,NULL,IDC_ARROW mov wc.hCursor,eax invoke RegisterClassEx, addr wc ; register our window class invoke CreateWindowEx,NULL,\ ADDR ClassName,\ ADDR AppName,\ WS_OVERLAPPEDWINDOW,\ CW_USEDEFAULT,\ CW_USEDEFAULT,\ CW_USEDEFAULT,\ CW_USEDEFAULT,\ NULL,\ NULL,\ hInst,\ NULL mov hwnd,eax invoke ShowWindow, hwnd,CmdShow ; display our window on desktop invoke UpdateWindow, hwnd ; refresh the client area
.WHILE TRUE ; Enter message loop invoke GetMessage, ADDR msg,NULL,0,0 .BREAK .IF (!eax) invoke TranslateMessage, ADDR msg invoke DispatchMessage, ADDR msg .ENDW mov eax,msg.wParam ; return exit code in eax ret WinMain endp
WndProc proc hWnd:HWND, uMsg:UINT, wParam:WPARAM, lParam:LPARAM .IF uMsg==WM_DESTROY ; if the user closes our window invoke PostQuitMessage,NULL ; quit our application .ELSE invoke DefWindowProc,hWnd,uMsg,wParam,lParam ; Default message processing ret .ENDIF xor eax,eax ret WndProc endp
end start
roughly translates as: #COMPILE EXE #DIM ALL #INCLUDE "windows.inc"
FUNCTION WinMain (BYVAL hInstance AS DWORD, BYVAL hPrevInstance AS DWORD, BYVAL lpszCmdLine AS ASCIIZ PTR, BYVAL nCmdShow AS LONG) AS LONG
LOCAL hWndMain AS DWORD LOCAL wc AS WNDCLASSEX LOCAL szClassName AS ASCIIZ * 80 LOCAL szAppName AS ASCIIZ * 255
' Register the window class szClassName = "SimpleWinClass" wc.cbSize = SIZEOF(wc) wc.style = %CS_HREDRAW OR %CS_VREDRAW wc.lpfnWndProc = CODEPTR(WndProc) wc.cbClsExtra = %NULL wc.cbWndExtra = %NULL wc.hInstance = hInstance wc.hCursor = LoadCursor (%NULL, BYVAL %IDC_ARROW) wc.hbrBackground = %COLOR_WINDOW + 1 wc.lpszMenuName = %NULL wc.lpszClassName = VARPTR(szClassName) wc.hIcon = LoadIcon (%NULL, BYVAL %IDI_APPLICATION) wc.hIconSm = LoadIcon (%NULL, BYVAL %IDI_APPLICATION) RegisterClassEx wc
' Window caption szAppName = "Our First Window"
' Create a window using the registered class hWndMain = CreateWindowEx(%NULL, _ szClassName, _ szAppName, _ %WS_OVERLAPPEDWINDOW, _ %CW_USEDEFAULT, _ %CW_USEDEFAULT, _ %CW_USEDEFAULT, _ %CW_USEDEFAULT, _ %NULL, _ %NULL, _ hInstance, _ BYVAL %NULL)
' Display the window ShowWindow hWndMain, nCmdShow UpdateWindow hWndMain
' Message handler loop LOCAL uMsg AS tagMsg WHILE GetMessage(uMsg, %NULL, 0, 0) TranslateMessage uMsg DispatchMessage uMsg WEND
FUNCTION = uMsg.wParam
END FUNCTION
FUNCTION WndProc (BYVAL hWnd AS DWORD, BYVAL uMsg AS DWORD, BYVAL wParam AS DWORD, BYVAL lParam AS LONG) AS LONG
SELECT CASE uMsg
CASE %WM_DESTROY PostQuitMessage %NULL EXIT FUNCTION
END SELECT
FUNCTION = DefWindowProc(hWnd, uMsg, wParam, lParam)
END FUNCTION
|
|
|
Logged
|
|
|
|
hutch--
Administrator
Member
    
Posts: 12013
Mnemonic Driven API Grinder
|
Thanks Jose, nice example.
Attached is a bare template that I use from a tool that creates them. It has a toolbar and status bar with common dialog support.
|
demo.zip (36.52 KB - downloaded 652 times.)
|
|
Logged
|
|
|
|
masm_diehard
New Member

Posts: 1
|
Bob,
Great to see you on this forum! I have used PowerBASIC for years and have been curious if it is developed using C++?
I have a requirement to acquire relatively high speed serial data in real time through multiple USB ports and I'm having problems with PBCC 6.0 and PB9.0 keeping up. That's what has brought me here. PowerBASIC has a lot of great features that I really like and find very useful. The graphics capabilities are excellent for data logging and display. I can't afford to give time slices away by putting "SLEEP" statements in my code so that windows can execute all of the "priority"...might I say "bloat" code that supports all of the other functionalities that are not priorities to me.
Hutch, Good examples! Your examples make me feel at home. I live another parallel life writing Microchip microcontroller assembly code!
Thanks guys!
|
|
|
Logged
|
|
|
|
dedndave
|
Bob pops in once in a while - that post was 2010  you may have better luck finding him on the pb forum
|
|
|
Logged
|
|
|
|
hutch--
Administrator
Member
    
Posts: 12013
Mnemonic Driven API Grinder
|
Hi Chuck,
Welcome on board. If the data logging is a critical task it may be worth you putting it into a separate thread and limit how often it updates the display in the main thread. PB is a very useful dialect of Basic that has a decent assembler built into it, the later versions (10 & PBCC6) can come close to pure MASM code in places where you need it and if you are fussy it can be done without a stack frame if you know how to write that type of code.
Although MASM is my main programming language, PB is my preferred high level compiler as it is cleaner than many of the alternatives and can still do the low level grunt stuff where its needed.
|
|
|
Logged
|
|
|
|
|
Pages: [1]
|
|
|
 |