Using QB4.5 Quick Libraries
Re: Using QB4.5 Quick Libraries
Just for curiosity, did my second messagebox code (the shell one) run in your qb4.5 with Win 7?
Did it run in FreeBASIC?
If you go to the Quickbasic cafe website there are loads of QB library examples, some made by members and admins of this forum.
Some have 16 bit assembler code included.
Quickbasic cafe page for some qb libraries:
http://www.qbasic.net/en/qbasic-downloa ... aphics.htm
Did it run in FreeBASIC?
If you go to the Quickbasic cafe website there are loads of QB library examples, some made by members and admins of this forum.
Some have 16 bit assembler code included.
Quickbasic cafe page for some qb libraries:
http://www.qbasic.net/en/qbasic-downloa ... aphics.htm
Re: Using QB4.5 Quick Libraries
Don
The QBCafe Forum has been temporarily unavailable for the past week.
I downloaded just about everything from that forum, and even if "dated" it sure has some brilliant tips for present day programmers, but if someone wants to use a so-called end of line language it's is his business and not mine but if I can help I will.
So maybe I should say you should try QB64, but unfortunately you will end up with, when you include the dependencies, a +6 Meg or so program, but then again if it works it works.
Do you know where I can download the "MSG.BAS" program to see what is in it. (Looks like I have been searching in the wrong places) It probably contains mouse and graphics routines. The DECLARE statements will already be a pointer to routines in the PRO.QLB
My Cuz Theunis says you can send it to him as an attachment - theunis.jansen@gmail.com. He says if anyone tries to spam him or is nasty then bad luck he will just report it as spam and then gmail.com will block all messages from those senders.
We are not people who steal other peoples programs. When it comes to QB4.5 we just like to help where ever we can. Times are hard for far too many throughout the world, so if you can't sell your program as is then send that E-Mail and if possible we will help.
It is so that the *QLB libraries are specific to the QB Compiler and the format is, I assume, different from that of a DLL (even if QLB was the Microsoft forerunner for their DLL's. You could try to link them when compiling but the chances that it will work is, I would say, Zero.
QLB is the compiled (16bit) version of the routines written in BASIC or whatever...
The QBCafe Forum has been temporarily unavailable for the past week.
I downloaded just about everything from that forum, and even if "dated" it sure has some brilliant tips for present day programmers, but if someone wants to use a so-called end of line language it's is his business and not mine but if I can help I will.
So maybe I should say you should try QB64, but unfortunately you will end up with, when you include the dependencies, a +6 Meg or so program, but then again if it works it works.
Do you know where I can download the "MSG.BAS" program to see what is in it. (Looks like I have been searching in the wrong places) It probably contains mouse and graphics routines. The DECLARE statements will already be a pointer to routines in the PRO.QLB
My Cuz Theunis says you can send it to him as an attachment - theunis.jansen@gmail.com. He says if anyone tries to spam him or is nasty then bad luck he will just report it as spam and then gmail.com will block all messages from those senders.
We are not people who steal other peoples programs. When it comes to QB4.5 we just like to help where ever we can. Times are hard for far too many throughout the world, so if you can't sell your program as is then send that E-Mail and if possible we will help.
It is so that the *QLB libraries are specific to the QB Compiler and the format is, I assume, different from that of a DLL (even if QLB was the Microsoft forerunner for their DLL's. You could try to link them when compiling but the chances that it will work is, I would say, Zero.
QLB is the compiled (16bit) version of the routines written in BASIC or whatever...
Re: Using QB4.5 Quick Libraries
The Fb help file has the following to say :
"FreeBASIC is written for 32-bit operating systems and a 32 bit DOS extender, and cannot utilize code which depends on 16-bit DOS, 16 bit assembly or memory model (segment & offset, XMS/EMS, ...). "
This means QB quick libraries wont work with FB..
"FreeBASIC is written for 32-bit operating systems and a 32 bit DOS extender, and cannot utilize code which depends on 16-bit DOS, 16 bit assembly or memory model (segment & offset, XMS/EMS, ...). "
This means QB quick libraries wont work with FB..
Re: Using QB4.5 Quick Libraries
A 16-Bit library doesn't work out-of-the-box. But you can load it as a binary file and start the functions by assembler code (when the code is executable on modern CPUs).I Daniel wrote:This means QB quick libraries wont work with FB..
I haven't seen examples for that yet. Maybe because it's as much work as re-doing the program (and making it cross-platform with a modern GUI toolkit in one shot).
Re: Using QB4.5 Quick Libraries
16-bit code loaded and run that way afaik will mostly crash in less than the blink of an eye. The memory model is also different, and soon as the 16-bit code loads DS and accesses something it will come crashing down.TJF wrote:A 16-Bit library doesn't work out-of-the-box. But you can load it as a binary file and start the functions by assembler code (when the code is executable on modern CPUs).I Daniel wrote:This means QB quick libraries wont work with FB..
For anything non trivial, either go towards virtualization, port at the source level, or keep dedicated 32-bit machines in place.I haven't seen examples for that yet. Maybe because it's as much work as re-doing the program (and making it cross-platform with a modern GUI toolkit in one shot).
XP is running out, and I wouldn't advise vista, but There are 32-bit Windows 8 versions available, and those are likely to be supported into the 2020's, as is W7.
Note that porting at the source level of code that was never meant to be portable isn't trivial either. Moreover, the new product would inherit its arcane treats. Therefore, I would recommend one of the other methods (virtualization (dosbox?) or ordaining 32-bit machines) to keep the binary running to buy time while you reengineer from scratch based on software principles from the last 20 years.
Last edited by marcov on Feb 24, 2013 12:25, edited 1 time in total.
Re: Using QB4.5 Quick Libraries
I Daniel,
Today I received an email from Theunis offering to help me with the message box issue, so I sent him examples of how I use the QuickPak Pro "MsgBox.BAS" routine in my application. It in turn calls several assembler subroutines from PRO.LIB. I sure there's ways to emulate the same thing with pure BASIC code, and I think that Theunis wants to rise to the challange. Thanks for hooking me up with him.
Regards, Don
Today I received an email from Theunis offering to help me with the message box issue, so I sent him examples of how I use the QuickPak Pro "MsgBox.BAS" routine in my application. It in turn calls several assembler subroutines from PRO.LIB. I sure there's ways to emulate the same thing with pure BASIC code, and I think that Theunis wants to rise to the challange. Thanks for hooking me up with him.
Regards, Don
Re: Using QB4.5 Quick Libraries
Thanks for the suggestions. I tried both of your examples using FBIde, and both of them produce a "Windows" style message box in the console window. However, the latter example only worked with freebasic, not QB4.5.dodicat wrote:You can directly call kernel32.dll in freebasic for a message box.
But I can't get it to work in QB.But this works in QB with Win XP (without the #lang "qb" of course.Code: Select all
Declare Function msg lib "kernel32.dll" Alias "MessageBoxW"(n1 As Integer,s1 As Wstring,s2 As Wstring,n2 As Integer) As Integer:Sleep 1 msg(0,"hello","Box",0)
Code: Select all
#lang "qb" sub messagebox(msg$) shell ("msg * "+ msg$) end sub messagebox("hello")
My QB4.5 application uses totally text based screens, so the QuickPak Pro library routine produces nice text based message boxes. If I knew how to insert a screen print in my reply, It would help you to see what I'm doing in QB.
Don
-
- Posts: 248
- Joined: Jul 01, 2010 9:35
Re: Using QB4.5 Quick Libraries
I searched for BLOAD and the programs I found, including the conversion ones, did not work. Apparently the palette and Screen mode of the original BSV file must be known. So I tried every Screen Mode 0 to 21 but No Go. I jut cant load a BASIC BSAVE file. If I use -e in FBIDE it just bombs out, without it I get a blank screen.
The question is is there an equivalent or a work around for VARSEG in FB. The docs just say not available in FB.
What about DIM ANY as Ptr (don't know the exact format). Could this be used ?
If so a snippet will be appreciated.
Or has someone perhaps written a FB module/Lib to BLOAD BSV files.
My old brain is starting to smoke trying to find a solution.
I have searched far and wide but they evade my efforts. Surely this would have been something that was a necessity for compatibility with QB.
FB's BLOAD loads BMP files. To run a program and take screen shots of every BSV usually ends up as a jpg, and then to convert them to BMP is sometimes x10, or more, the size of the BSV.
The question is is there an equivalent or a work around for VARSEG in FB. The docs just say not available in FB.
What about DIM ANY as Ptr (don't know the exact format). Could this be used ?
If so a snippet will be appreciated.
Or has someone perhaps written a FB module/Lib to BLOAD BSV files.
My old brain is starting to smoke trying to find a solution.
I have searched far and wide but they evade my efforts. Surely this would have been something that was a necessity for compatibility with QB.
FB's BLOAD loads BMP files. To run a program and take screen shots of every BSV usually ends up as a jpg, and then to convert them to BMP is sometimes x10, or more, the size of the BSV.
-
- Posts: 252
- Joined: Mar 12, 2006 16:25
Re: Using QB4.5 Quick Libraries
VARSEG, DEF SEG, PEEK, POKE and CALL INTERRUPT are all used to read or write directly to memory or call directly 16-bit machine code from QB. Freebasic runs in 32 bit mode. There is no chance to use directly from FB (or any other 32 bit compiler) 16 bit specific code. At least if the application should also run directly in a 64 bit enviroment.is is there an equivalent or a work around for VARSEG in FB. The docs just say not available in FB.
The best thing you can do is to replace the specific function block. We could help you if would explain exactly what type of input box you want, but here is an example, It's simple with no input checks. It will be buggy!
EDIT:
I replaced the TextField function with a better Version.
Code: Select all
Function TextFieldBackground(row As Integer, col As Integer, size As Integer) As String
Dim text As String
Dim i As Integer
Dim j As Integer
For i = row To row+2
For j = col To col+size+2
text=text+chr(Screen(i,j))
Next
Next
Return text
End Function
Function TextField(row As Integer, col As Integer, size As Integer, maxsize As Integer=50) As String
Dim text As String
Dim changed As Integer
Dim background As String
Dim key As String
Dim askey As Integer
Dim oldrow As Integer
Dim oldcol As Integer
Dim curpos As Integer
curpos=1
'Save CusorState
oldrow = CsrLin()
oldcol = Pos()
background = TextFieldBackground(row, col, size)
'Draw Box
Locate row,col
Print Chr(201);String(size,205);Chr(187)
Locate row+1,col
Print Chr(186);Space(size);Chr(186)
Locate row+2,col
Print Chr(200);String(size,205);Chr(188)
'Set blinking cursor at right position
Locate row+1,col+1,1
Do
key = InKey()
askey = Asc(key)
Select Case askey
Case 32 To 127 'All readable chars
If Len(text)<maxsize Then
text=text+key
If curpos<=size Then curpos = curpos+1
changed = 1
EndIf
Case 13 'Return
Exit Do
Case 27 'Escape
text = ""
Exit Do
Case 8 'Backspace
If Len(text)>0 Then
text = Left(text,Len(text)-1)
curpos=curpos-1
If curpos<1 Then curpos=1
If Len(text)>=size Then curpos=size+1
changed = 1
End if
End Select
If changed Then
Locate row+1,col+1
Print Right(text,size)+Space(size-Len(Text));
Locate row+1,col+curpos
changed=0
EndIf
Loop
'Restore Background
Locate row,col
Print Left(background,size+2)
Locate row+1,col
Print Mid(background,size+4,size+2)
Locate row+2,col
Print Mid(background,size*2+7,size+2)
Locate oldrow,oldcol,0
Return text
End Function
'------------------------------
Dim i As Integer
Screen 0
Width 80,25
For i = 1 To 80*25
Print chr((i Mod 26)+65);
Next
Locate 20,1
Print "Hello World!"
Print TextField(2,10,20)
Sleep
Last edited by RockTheSchock on Feb 28, 2013 15:56, edited 1 time in total.
-
- Site Admin
- Posts: 6323
- Joined: Jul 05, 2005 17:32
- Location: Manchester, Lancs
Re: Using QB4.5 Quick Libraries
It should be at least easy to write a function that can take "cross-platform" screenshots in QB.Theunis Jansen wrote:Or has someone perhaps written a FB module/Lib to BLOAD BSV files.
My old brain is starting to smoke trying to find a solution.
I have searched far and wide but they evade my efforts. Surely this would have been something that was a necessity for compatibility with QB.
FB's BLOAD loads BMP files. To run a program and take screen shots of every BSV usually ends up as a jpg, and then to convert them to BMP is sometimes x10, or more, the size of the BSV.
e.g. loop over every x,y in the image and "Print #f, Point(x,y)". Then reading back is essentially the reverse process using Input # instead of Print #.
DOSBox is good at taking actual screenshots. I think Ctrl-F5 is the shortcut. It saves them as PNG; I think there would be outrage if it used JPG..
I remember looking at the old .bsv format once. I don't recall actually writing a function that could read them, but I don't think it would be too difficult. The main problem I think was that each scanline could be split into different planes, but that's not too difficult to unravel.
If it would be helpful I could probably write a reader function for them, given a little time..
-
- Posts: 252
- Joined: Mar 12, 2006 16:25
Re: Using QB4.5 Quick Libraries
The 16 bit memory addressing works segmented in 64KB blocks. So DOS have 10 Segments -> 640 KB for Programms and from 640KB to 1024KB for Drivers and other hardware related stuff.
I assume you are using Screen 0 as Display with 80 columns and 25 rows. So you can change the segment where you can peek and poke arround to the TextMode block with
Screen 0
DEF SEG=&HB800
If i remember right, if you want two read the first char on screen you can use
screen(row,col) or you can peek(1)
if you want the color you can use
color(row,col) or peek(0)
http://www.antonis.de/faq/qbmonfaq-date ... 26044.html
BSAVE actually saves from memory a block to a file
BLOAD writes to memory from a file
So in screen 0 width 80,25 you have 80*25*2 bytes of textmode memory.
the position where to read or write is set by def seg.
for "Screen 13" VGA mode the memory format is different
http://www.petesqbsite.com/sections/tut ... tutor1.htm
I assume you are using Screen 0 as Display with 80 columns and 25 rows. So you can change the segment where you can peek and poke arround to the TextMode block with
Screen 0
DEF SEG=&HB800
If i remember right, if you want two read the first char on screen you can use
screen(row,col) or you can peek(1)
if you want the color you can use
color(row,col) or peek(0)
http://www.antonis.de/faq/qbmonfaq-date ... 26044.html
BSAVE actually saves from memory a block to a file
BLOAD writes to memory from a file
So in screen 0 width 80,25 you have 80*25*2 bytes of textmode memory.
the position where to read or write is set by def seg.
for "Screen 13" VGA mode the memory format is different
http://www.petesqbsite.com/sections/tut ... tutor1.htm
Re: Using QB4.5 Quick Libraries
And don't forget the HMA, 64kb starting from 1MB-16 byte :-)RockTheSchock wrote:The 16 bit memory addressing works segmented in 64KB blocks. So DOS have 10 Segments -> 640 KB for Programms and from 640KB to 1024KB for Drivers and other hardware related stuff.
To be honest, some 32-bit dosextenders map the 16-bit memory space into the 32-bit memory space. It is just that go32v2 does not (but accesses via %fs iirc)
-
- Posts: 248
- Joined: Jul 01, 2010 9:35
Re: Using QB4.5 Quick Libraries
The DOSBOX screenshots work perfectly. The PNG file size is the same as that of the BSV. (4Kb for the fullscreen - 80x25). Is there any precompiled PNG Library for FB that I can use that has a BI to include. With simple command such as : LOAD_PNG "Picture.png - for use with #Lang "fblite"
That is something like Bload "Picture.BMP" which works fine. Converting the BSV of 4Kb to Bmp ends up with a 247Kb file.
If there is such a LIB would it be possible to add it to FB as an internal LIB and not a DLL? Yeah yeah I am a lazy old man.
That is after using the DOSBOX screenshot PNG and converting it to BMP (uncompressed is the only way FB reads it - I checked the Help file for this)
There are 48 BSV files to convert and then I must find the relevant BSV. I have read them all into a file Using = Dir /B > "filename" and I can check them one by one with a FOR....NEXT Loop.
That is something like Bload "Picture.BMP" which works fine. Converting the BSV of 4Kb to Bmp ends up with a 247Kb file.
If there is such a LIB would it be possible to add it to FB as an internal LIB and not a DLL? Yeah yeah I am a lazy old man.
That is after using the DOSBOX screenshot PNG and converting it to BMP (uncompressed is the only way FB reads it - I checked the Help file for this)
There are 48 BSV files to convert and then I must find the relevant BSV. I have read them all into a file Using = Dir /B > "filename" and I can check them one by one with a FOR....NEXT Loop.
Re: Using QB4.5 Quick Libraries
http://www.freebasic.net/forum/viewtopic.php?f=8&t=8024
Try fbpng or save them as bmp =)
Try fbpng or save them as bmp =)
-
- Posts: 248
- Joined: Jul 01, 2010 9:35
Re: Using QB4.5 Quick Libraries
Thanks Jonge.
I must have had something on my 4-eyes to miss that one. Or maybe i fell asleep in front of the computer. (It happens when I stay awake until 2 or 3 AM)
Reading from post one onwards will probably, between snoozes, take the whole day but I do have the time.
I must have had something on my 4-eyes to miss that one. Or maybe i fell asleep in front of the computer. (It happens when I stay awake until 2 or 3 AM)
Reading from post one onwards will probably, between snoozes, take the whole day but I do have the time.