FYI: I posted BASM Version 1 Build 1 to the Bitbucket repository. Testing and feedback welcome. If there is more than a casual interest, please join the BASM Forum.
Here is an example of using BASM
C:\BASM\Examples\Manifest>compile Manifest.bas
C:\BASM\Examples\Manifest>C:\BASM\Bin\BASM.exe "Manifest.bas" C:\BASM\Inc\
BASM - Version 1.0 Build 1
Currently compiling "Manifest.bas":
- Compile time -> 0.070000 seconds
- Assemble time -> 0.130000 seconds
- Linking time -> 0.140000 seconds
-------------------------------
- Total time -> 0.340000 seconds
C:\BASM\Examples\Manifest>dir
Volume in drive C has no label.
Volume Serial Number is 1415-F200
Directory of C:\BASM\Examples\Manifest
11/23/2014 02:43 PM <DIR> .
11/23/2014 02:43 PM <DIR> ..
11/23/2014 02:43 PM 32,405 Manifest.asm
07/27/2006 11:36 PM 818 Manifest.bas
07/27/2006 11:36 PM 876 Manifest.dlg
11/23/2014 02:43 PM 9,728 Manifest.exe
11/23/2014 02:43 PM 562 Manifest.manifest
11/23/2014 02:43 PM 32,744 Manifest.obj
11/23/2014 02:43 PM 925 Manifest.rc
11/23/2014 02:43 PM 1,362 Manifest.res
11/23/2014 02:43 PM 0 results.txt
9 File(s) 79,420 bytes
2 Dir(s) 68,190,101,504 bytes free
C:\BASM\Examples\Manifest>
'****************
'* Manifest.bas *
'****************
' Manifest.bas does absolutely nothing.
' It does however demonstrate the use of $XPStyle.
' Worth pointing out, is that when using $Resource
' and dialogs, the varible "StupidDialog" is never
' used. Refer to the name in the "dlg" file when
' working with them (in this case 102).
$AppType GUI
$XPStyle
$Include "Windows.inc"
$Resource StupidDialog As "Manifest.dlg"
Function DialogProc(hWndDlg As Integer, uMsg As Integer, _
wParam As Integer, lParam As Integer) As Integer
If uMsg = WM_CLOSE then
EndDialog(hwndDlg, 0)
Result = 0
Else
Result = 0
End If
End Function
DialogBoxParam(GetModuleHandle(0), MakeIntResource(102), _
HWND_DESKTOP, CodePtr(DialogProc), 0)
Manifest.dlg
102 DIALOGEX 0,0,210,134
LANGUAGE 9,1
CAPTION "Manifest Dialog"
FONT 8,"MS Sans Serif",0,0
STYLE 0x00C80800
BEGIN
CONTROL "OK",1,"Button",0x50010001,76,108,50,15
CONTROL "Cancel",2,"Button",0x50010000,132,108,50,15
CONTROL "Check1",1001,"Button",0x50010003,8,24,50,11
CONTROL "Radio1",1002,"Button",0x50000009,8,42,50,11
CONTROL "",1003,"ComboBox",0x50210102,8,60,50,30
CONTROL "",1004,"ListBox",0x50A10103,8,84,50,41
CONTROL "",1005,"ScrollBar",0x50000000,78,88,104,11
CONTROL "",1006,"ScrollBar",0x50000001,192,40,10,41
CONTROL "Spin1",1007,"msctls_updown32",0x50000020,192,7,11,15
CONTROL "Progress1",1008,"msctls_progress32",0x50800000,78,5,104,13
CONTROL "Static",-1,"Button",0x50000007,78,27,104,32
CONTROL "Slider1",1009,"msctls_trackbar32",0x50010018,78,66,104,13
CONTROL "",103,"Edit",0x50010000,8,5,50,14,0x00000200
END
Here is a Windows graphics example. (screen shot attached)
'**************
'* Spiral.bas *
'**************
' Based on a Petzold example.
$AppType GUI
$Optimize Off
$Compress Off
$Include "Windows.inc"
$Include "Math.inc"
$Const iNumRevs = 20
$Const crAppleGreen = 0x0044AA00
$Const PI = 3.14159
Dim message As MSG
Dim wc As WNDCLASS
Dim ps As PAINTSTRUCT
Dim strClassName As String
Dim strAppTitle As String
Dim hWindow As Integer
Dim cxClient As Integer
Dim cyClient As Integer
Function OnSize(hWnd As Integer, uMsg As Integer, _
wParam As Integer, lParam As Integer) As Integer
cxClient = LoWord(lparam)
cyClient = HiWord(lparam)
Result = 0
End Function
Function OnPaint(hWnd As Integer, uMsg As Integer, _
wParam As Integer, lParam As Integer) As Integer
Dim hdc As Integer
Dim iNumPoints As Integer
Dim ptX As Integer
Dim ptY As Integer
Dim i As Integer
Dim fAngle As Double
Dim fScale As Double
hdc = BeginPaint(hWnd, ps)
iNumPoints = iNumRevs * 2 * (cxClient + cyClient)
i = 0
While i < iNumPoints
fAngle = i * 2.0 * PI / (iNumPoints / iNumRevs)
fScale = 1.0 - i / iNumPoints
ptX = cxClient / 2.0 * (1.0 + fScale * Cos(fAngle))
ptY = cyClient / 2.0 * (1.0 + fScale * Sin(fAngle))
SetPixel(hdc, ptX, ptY, crAppleGreen)
i = i +1
Wend
EndPaint(hWnd, ps)
Result = 0
End Function
Function WindowProc(hWnd As Integer, uMsg As Integer, _
wParam As Integer, lParam As Integer) As Integer
If uMsg = WM_SIZE Then
Result = OnSize(hWnd, uMsg, wParam, lParam)
ElseIf uMsg = WM_PAINT Then
Result = OnPaint(hWnd, uMsg, wParam, lParam)
ElseIf uMsg = WM_DESTROY Then
PostQuitMessage(0)
Result = 0
Else
Result = DefWindowProc(hWnd, uMsg, wParam, lParam)
End If
End Function
'***
strAppTitle = "Spiral"
strClassName = "SpiralClass"
wc.style = CS_HREDRAW + CS_VREDRAW
wc.lpfnWndProc = CodePtr(WindowProc)
wc.cbClsExtra = 0
wc.hInstance = GetModuleHandle(0)
wc.hIcon = LoadIcon(0, MakeIntResource(IDI_APPLICATION))
wc.hCursor = LoadCursor(0, MakeIntResource(IDC_ARROW))
wc.hbrBackground = GetStockObject(WHITE_BRUSH)
wc.lpszMenuName = ""
wc.lpszClassName = strClassName
If (RegisterClass(wc)) = 0 Then
MessageBox(0, "RegisterClass failed.", strAppTitle, MB_OK)
ExitProcess(0)
End If
hWindow = CreateWindowEx(0, strClassName, strAppTitle, _
WS_OVERLAPPEDWINDOW, _
165, 50, 380, 435, _
0, 0, wc.hInstance, 0)
If hWindow = 0 Then
MessageBox(0, "CreateWindowEx failed.", strAppTitle, MB_OK)
ExitProcess(0)
End If
ShowWindow(hWindow, SW_SHOWNORMAL)
UpdateWindow(hWindow)
While GetMessage(message, 0, 0, 0) > 0
TranslateMessage(message)
DispatchMessage(message)
Wend
Bookmarks