Recovering old QBasic files

If you have questions about any aspect of QBasic programming, or would like to help fellow programmers solve their problems, check out this board!

Moderators: Pete, Mods

Post Reply
aery
Newbie
Posts: 3
Joined: Mon Mar 23, 2009 3:00 am

Recovering old QBasic files

Post by aery » Mon Mar 23, 2009 3:27 am

Hello,
I'm new to these forums, but an old QBasic user. I used to make some games and programs with QBasic v1.1 back around 1996, and haven't touched any of those files in these years since then. I only moved them from old PCs to floppy disks to newer PCs to CDs to even newer PCs to USB drives, so they are still with me.

The problem is, now that I was trying to run them again, I see that the files have been corrupted, or at least changed to a format not compatible with new filesystems. Out of about 15 BAS files I had, only one of them seems to be intact (I can run it with QBasic, and read the code normally). The rest is full of strange symbols, not ascii characters, and of course QBasic doesn't understand them. I wonder if anyone of you has had the same problem, or can help me recover them. It looks like the string literals I had in the code are intact, and also the music notation for the tunes of the game are still in good shape, but the rest is rubbish if seen with any text editor. The first thing I thought was that I was looking at compiled binary code instead of source code, but as I understand QBasic does not compile anything, and the files have a .bas extension anyways.

Together with my files I had 2 examples that QBasic itself brought: "Nibbles.bas" and "Mortgage.bas". Nibbles is intact, and can be run perfectly. Morgage, on the other hand, seems to have the same corruption as my other files. I paste here part of this Mortgage.bas as I see it in a text editor, let's see if anyone can detect the problem. I'd be extremely grateful if someone could help me recover my files.


???? The IBM Personal Computer Mortgage ?? Version 1.00 (C)Copyright IBM Corp 1981, 1982 J?? Licensed Material - Program Property of IBM n?? Author - Glenn Stuart Dardick ??? Modified by Ayodele Isaac Anise; September, 1986. ??? SEG ??SAMPLES$?"NO" ??? ? ??SAMPLES$?"YES" ?? ?:? ,:? ,,:? (:?:? ,:? "IBM" /?? ,,:? "Personal Computer" \?
,:?
,,:? ??(?)??(,?)???(?) ?? ,,:? ??(?)?" MORTGAGE "???(?) ?? ,,:? ??(?)??(, )???(?) ?$?
,,:? ??(?)?" Version 1.10 "???(?) .? ,,:? ??(?)??(,?)???(?) L8? ,:? ,,:? "(C) Copyright IBM Corp 1981, 1982" ?B? ,:? ,,:? "Press space bar to continue" ?L? ? ?? "" ? ? L ?VCMD$ ? ? ?`? CMD$ ? " " ? ? ~ ?j? CMD$ ???() ? ? ? ?t? V ~? ,:?:? P:? AMORT(?,):? ?? SEG? =?? (??() ? 0 )??0 ? COLS ? :? ? M?? P:COLS? W?? SEG a?? ? w?? ??(I$)? ? ? ??? ??(I$,,)?"2" ? ? ? ??? ??(I$,,)?"1" ? ? ? ??? ? ??? SAMPLES$ ?? "YES" ? ? ? ???? "SAMPLES",? ??? ? ?? ?? - MAIN OPTION MENU D?? ,:?:? ,:? " MORTGAGE ANALYSIS " d?? ,:? ,:? "OPTIONS - " ??? "1 - MORTGAGE PAYMENT $$$ "
(... continues like this for quite a bit more)

User avatar
burger2227
Veteran
Posts: 2378
Joined: Mon Aug 21, 2006 12:40 am
Location: Pittsburgh, PA

Post by burger2227 » Mon Mar 23, 2009 11:38 am

Change the BAS files to TEXT READABLE!

Open each one and goto File, Save As and check the Text readable option box. You can keep the same filename. That should allow you to read the code in Notepad.

Ted
Please acknowledge and thank members who answer your questions!
QB64 is a FREE QBasic compiler for WIN, MAC(OSX) and LINUX : https://www.qb64.org/forum/index.php
Get my Q-Basics demonstrator: https://www.dropbox.com/s/fdmgp91d6h8ps ... s.zip?dl=0

aery
Newbie
Posts: 3
Joined: Mon Mar 23, 2009 3:00 am

Post by aery » Mon Mar 23, 2009 12:41 pm

I can't see in Save as any option to save as "text readable" or similar. I'm using QBasic v1.1.

Also, the problem is not that I can't see the code in Notepad, I can't even see it correctly in QBasic.

User avatar
burger2227
Veteran
Posts: 2378
Joined: Mon Aug 21, 2006 12:40 am
Location: Pittsburgh, PA

Post by burger2227 » Mon Mar 23, 2009 1:34 pm

Then your files are corrupted somehow or QB1 is corrupt. Try a new install of it. Wonder how they got corrupted?

QB4.5 is available at QbasicStation.com in Member Files. It has the Text readable option.

There also are plenty of other downloadable programs there to test it on.

Link to Mortgage.bas code: http://www.rkeene.org/viewer/devel/arch ... ge.bas.htm

Ted
Please acknowledge and thank members who answer your questions!
QB64 is a FREE QBasic compiler for WIN, MAC(OSX) and LINUX : https://www.qb64.org/forum/index.php
Get my Q-Basics demonstrator: https://www.dropbox.com/s/fdmgp91d6h8ps ... s.zip?dl=0

aery
Newbie
Posts: 3
Joined: Mon Mar 23, 2009 3:00 am

Post by aery » Tue Mar 24, 2009 11:09 am

I finally found out what the problem was. My QBasic was not corrupted, it was fine, but QBasic doesn't have an option to save compressed source code as QuickBasic does.
What I did not know was that my files had been saved with QuickBasic v4.5, and not with QBasic, in the compressed way, so now I couldn't open them with QBasic. I also had the QuickBasic executable on that folder, but it didn't work if executed directly from the explorer, only from command line, and as its name was just QB.exe I thought it was the same as QBasic (named QBasic.exe), so I didn't bother much executing it.

So after finding out that I also had QuickBasic 4.5, I could open them fine and save them as ASCII as you said in your first post, and now I can open them in QBasic 1.1 also. I even had some old old Microsoft BASICA files which not even QuickBasic could open because their compressed format seems to be different, but fortunately the utility RB58 (explained in the FAQ of this site) could translate them to pure ASCII files.

In summary, it seems that I played around more than I thought 15 years ago, and I had .bas files of 3 different formats (compressed BASICA, compressed QuickBasic 4.5, and ASCII QBasic) in the same folder. I could finally recover them all though. And thanks for the help, the Mortgage source was helpful in finding out what was going on :)

User avatar
burger2227
Veteran
Posts: 2378
Joined: Mon Aug 21, 2006 12:40 am
Location: Pittsburgh, PA

Post by burger2227 » Tue Mar 24, 2009 12:55 pm

Glad you found the problem. The code did appear to be QB4.5 compressed code.

Lesson: Always save QB4.5 code as text readable. You don't save much space anyhow!

1) It will run in Qbasic.exe
2) You can read, edit, copy and post your BAS code using Notepad.

Ted
Please acknowledge and thank members who answer your questions!
QB64 is a FREE QBasic compiler for WIN, MAC(OSX) and LINUX : https://www.qb64.org/forum/index.php
Get my Q-Basics demonstrator: https://www.dropbox.com/s/fdmgp91d6h8ps ... s.zip?dl=0

Ralph
Veteran
Posts: 148
Joined: Fri Feb 09, 2007 3:10 pm
Location: Katy, Texas

Post by Ralph » Tue Mar 24, 2009 10:33 pm

Ted, is there a way to make "Save as text, readable etc." the default? It seems one should be able to, but, how?
Ralph, with QuickBASIC 4.5, operating under Windows XP, wiht anHP LaserJet 4L Printer. Bilingual in English/Spanish

User avatar
burger2227
Veteran
Posts: 2378
Joined: Mon Aug 21, 2006 12:40 am
Location: Pittsburgh, PA

Post by burger2227 » Wed Mar 25, 2009 12:56 am

Not that I know of. You have to save them all in QB4.5 when you are saving the module. I wish it was that easy, but we ARE talking about a M$ product, lol.

Ted
Please acknowledge and thank members who answer your questions!
QB64 is a FREE QBasic compiler for WIN, MAC(OSX) and LINUX : https://www.qb64.org/forum/index.php
Get my Q-Basics demonstrator: https://www.dropbox.com/s/fdmgp91d6h8ps ... s.zip?dl=0

Ralph
Veteran
Posts: 148
Joined: Fri Feb 09, 2007 3:10 pm
Location: Katy, Texas

Post by Ralph » Wed Mar 25, 2009 9:30 am

Ted, Thank you for your reply to my question.

As to being an MS product, well, if you do your $$$ with the assumption that MS never existed, I really don't know where we would be today. It's alway easy to see the "defects" and the things we would like to have and don't, but, it's not possible to be a leader and to please everybody! At least, that's my opinion. Look at the gigantic efforts that FB and QB64 have been making for years now, and, I still read that they are far from being finalized. My old dean of engineering used to chide me, saying, "Ralph, Ralph, remember the old saying, that 'Perfect is the enemy of Good'". Ut tiikk ne most of my life to finally accept that.
Ralph, with QuickBASIC 4.5, operating under Windows XP, wiht anHP LaserJet 4L Printer. Bilingual in English/Spanish

Post Reply