Works in QB4.5 but Not in Qbasic

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
User avatar
GarryRicketson
Veteran
Posts: 90
Joined: Fri Jul 16, 2010 10:02 am
Location: Cuencame,Durango,Mexico
Contact:

Works in QB4.5 but Not in Qbasic

Post by GarryRicketson »

This code worked ok in qb4.5, but if I just try to run it useing qbasic,..I get a lot of errors,..

Code: Select all

SCREEN 12
OPEN "Asmile.AXB" FOR BINARY AS #1
ArraySIZE& = (LOF(1) - 7) / 2
DIM AsmileARRAY(1 TO ArraySIZE&) AS INTEGER
CLOSE #1
DEF SEG = VARSEG(AsmileARRAY(1))
BLOAD "Asmile.AXB", VARPTR(AsmileARRAY(1))
DEF SEG
'Set palette
OUT &H3C4, 0
FOR n = 9 TO 56
    OUT &H3C9, AsmileARRAY(n)
NEXT n
'Display the frames in sequence
PRINT "HAVE A GOOD DAY!"
DO
    FOR i = 0 TO AsmileARRAY(57) - 1
        PUT (100, 100), AsmileARRAY(58 + i * 1635), PSET
        'PLAY "Mbg15a10<g8f15f10ea9gf15bc8d15e10a>a"
        ' a$ = INPUT$(0) 'pause between frames
        Interval! = .2
        t! = TIMER
        DO
            IF TIMER <t> t! + Interval!
    NEXT i
    'LOOP UNTIL a$ = INPUT$(1)
LOOP WHILE INKEY$ = ""
IF INKEY$ = "N" THEN GOTO 2
PRINT "Now lets see whats next"
'PLAY "Mbgaeg"
PRINT "This is next"
'-------2
SCREEN 12
OPEN "A6men.AXB" FOR BINARY AS #1
ArraySIZE& = (LOF(1) - 7) / 2
DIM A6menARRAY(1 TO ArraySIZE&) AS INTEGER
CLOSE #1
DEF SEG = VARSEG(A6menARRAY(1))
BLOAD "A6men.AXB", VARPTR(A6menARRAY(1))
DEF SEG
'Set palette
OUT &H3C4, 0
FOR n = 9 TO 56    OUT &H3C9, A6menARRAY(n)
NEXT n
'------
'Display the frames in sequence
PRINT "HAVE A GOOD DAY!"
DO
 FOR i = 0 TO A6menARRAY(57) - 1
        PUT (100, 100), A6menARRAY(58 + i * 1635), PSET
        'PLAY "Mbg15a10<g8f15f10ea9gf15bc8d15e10a>a"
 ' a$ = INPUT$(0) 'pause between frames
        Interval! = .2
        t! = TIMER
        DO
            IF TIMER <t> t! + Interval!
    NEXT i
    'LOOP UNTIL a$ = INPUT$(1)
LOOP WHILE INKEY$ = ""
I remarked out the PLAY lines, because it had started to "annoy" me, In the source, at drop box, Play is not remarked out.
I get a lot of illegal functions,..Could this code be modified to run in qbasic ? If anyone wants the entire, source and the images, you can get them at:
http://dl.dropbox.com/u/15387474/SMILEYFACE.zip
Ok I guess thats about it,... Also this is a new web site,..experiment:

http://creativeminds.webege.com/RETRO-0 ... pplet.html
I have a demo of qb4.5 that can be run,..online.
From Garry
Note, I got my first qbasic program, (a math multiplication tales excersise,) that runs, fine on the "retro applet",,...So I was trying to come up with some other simple qbasic prgrams that could run,..Any ideas ?
Thanks from Garry
TmEE
Veteran
Posts: 97
Joined: Mon Mar 17, 2008 11:14 am
Location: Estonia, Rapla
Contact:

Post by TmEE »

what kind of errors do you get ?

Only things I can think of right now are arrays being too big for QBASIC
Mida sa loed ? Nagunii aru ei saa :P
User avatar
burger2227
Veteran
Posts: 2466
Joined: Mon Aug 21, 2006 12:40 am
Location: Pittsburgh, PA

Post by burger2227 »

The array is about 26K and it runs fine in Qbasic. The code above is a MESS but the one I downloaded worked.
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
User avatar
GarryRicketson
Veteran
Posts: 90
Joined: Fri Jul 16, 2010 10:02 am
Location: Cuencame,Durango,Mexico
Contact:

Thank s

Post by GarryRicketson »

Both , Clippy and TmEE, Thanks for the replys,..
the errors I got were illegal functions, but I need to get the line numbers,..
I am worried, ...Ok Clippy ,says it ran fine,.. I have other qb4.5 and qbasic
programs, that used to run fine, for me,..and just recently ,lately, many are not running,..On my computer,... These are on a Dos partition, seperate from windows,..Mostly just now, I wanted to acknowledge the replys,...
The one you downloaded Clippy, is has been on drop box, for some time, I just now down loaded it too, what I had been working with is the original, that had been in my computer, for some time,..I am worried, maybe, for some reason, the files in my Dos partition are getting "corrupted".
I wonder , if by any chance Clippy, if you have time, you could show me, some "neater" or a better way to code the same program ? (for qb4.5 or qbasic) It was pretty much my own invention, B Bob had helped try to explain to me on opening the .axb 's ... It is not that important, but if you have a chance,..that would be nice,
thanks from Garry
Edit: Boy do I ever feel like the " idiot ", it turned out it was because I had the file in a different directory, not the same as where I have qbasic and qb4.5, I moved everything to the same dir, and it works fine !,...Sorry!
User avatar
burger2227
Veteran
Posts: 2466
Joined: Mon Aug 21, 2006 12:40 am
Location: Pittsburgh, PA

Post by burger2227 »

No problem. We have all done silly things at one time or another.
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
Post Reply