Page 1 of 1

How do i open a .BAS file that is created in 1997

Posted: Thu Dec 03, 2009 10:13 am
by soyabean
I have tried Qbasic 4.5 / 1.1

and all i get is this.

I need to open it and change some of it formula. I probably code it all over again in another language, but I need the formula and I cant reverse engine it.

Thanks all help appreaciated

Image

Posted: Thu Dec 03, 2009 8:04 pm
by BurgerBytes
Try QB4.5 and Save AS Text Readable in the File menu.

QB1.1 should not be able to run it if it is not saved as text.

Ted

1997 .BAS program

Posted: Thu Aug 05, 2010 9:32 am
by I Daniel
I know this is 8 months too late. But for others with the same problem:-

Looking at your listing it would appear that the program was possibly saved in another BASIC FORMAT. I had the same problem with my 1980 progs.
Try loading it with GW-BASIC or the BASIC you used, List it* and if it reads correctly then save it as a text file:

SAVE"Program",A
"Program" must be replaced with your program's name. A=ASCII.

You should then be able to open it with QB4.5.

* If you cannot list it then it must have been saved as a protected file.
The only way that I know to unprotect it is to use Basuprot.com.

Re: How do i open a .BAS file that is created in 1997

Posted: Sun Jun 26, 2016 1:32 pm
by cseb95
Hi,

I think I've nearly the same problem. I need to re-open very old .BAS files (1990) made with QB4.5.

But I've installed QB4.5 into DOSBox and I can't open the source files : I get a "Bad file mode" error.

Here is one sample file :
https://drive.google.com/open?id=0BxHaA ... XRvNU9tLUE

It starts with :

Code: Select all

ü   ‚ Qÿÿ$ ÿÿRFk Œ v ¢ ã  Ë ‹ †à iïq _ ãÖ üc¸ V W’  ’ V&                  OR Û@AIDE1€ @remarqueQ3¬ qA nbfichö@Fenactv1ö Q2À  fichierè  j£ traducÊ@Fenactv2M gram  @LectdatÑ@NUMEROSï  NUMERO™@logon minV max< drapeauØ@affichedrap7 temps2 QP- Qp1t QCMš p[ a‹ B cÏ dN brep½ QCM2í tÇ QCM3i G1­ nonutil~ coltps¦ size; k iC encore  sc¬ br   mrê
PRESENTATION2 temps1ychoixjLitQCM( emp1ð Qpr Qaè QbA Qcd Qd QbrepüECRAN/ temps2 tailleR Ch2  resultat$ ch¸REMPLACE   xö Y_ emp2Ã z} u   v†FINREMPLACEpSCORE  finscoreb moyÊ Actionà Buffer*@windows   RETCODEO rem l6 gram1< traduc1´DEBlog   TEXTEh PI BOUCLE XX   YY   X0 Y00 x1   y2¢ LAš HA   BF   
Can someone help me with this ?

Thanks.

Re: How do i open a .BAS file that is created in 1997

Posted: Sun Jul 10, 2016 2:53 pm
by flukiluke
cseb95: I tried opening the file in QB4.5, PDS (QB7.1), and QB4.5 French edition, all to no avail. I then ran the file through a decoder, which (after some light editing for things like USING PRINT -> PRINT USING) I got this:

Code: Select all

DECLARE SUB Fenactv1 (Q2 AS ANY, fichier$, j!, traduc$, temps1!)
DECLARE SUB Fenactv2 (Q3 AS ANY, fichier$, j!, gram$, temps1!)
DECLARE SUB AIDE1 (n!)
DECLARE SUB remarque (Q3$, q() AS STRING)
DECLARE FUNCTION nbfich! ()
DECLARE SUB Lectdat (fichier$, gram$, traduc$)
DECLARE SUB NUMEROS (NUMERO!, compteur)
DECLARE SUB logo (fichier$, min%, max%, drapeau() AS INTEGER)
DECLARE SUB affichedrap (drapeau() AS INTEGER)
DECLARE FUNCTION temps! ()
DECLARE FUNCTION QP$ (Qp1$)
RANDOMIZE (TIMER)

TYPE QCM
    p AS STRING * 100
    a AS STRING * 30
    B AS STRING * 30
    c AS STRING * 30
    d AS STRING * 30
    brep AS STRING * 2
END TYPE

TYPE QCM2
    t AS STRING * 140 ' traduction
END TYPE

TYPE QCM3
    G1 AS STRING * 314 ' remarque grammaticale
END TYPE

DIM q AS QCM
DIM Q2 AS QCM2
DIM Q3 AS QCM3

DIM drapeau(1 TO 1430) AS INTEGER
DIM nonutil(70) AS INTEGER

KEY OFF
coltps = 15
colsc = 15
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
''''''''''''''''''''''''''''' Presentation 1 ''''''''''''''''''''''''''''''''''''
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
WIDTH 80, 25
CALL logo(fichier$, 1, 1430, drapeau()) 'pr‚sentation + choix fichier QCM
CALL Lectdat(fichier$, gram$, traduc$)

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'''''''''''''''''''''''''lecture de la taille du fichier''''''''''''''''''''''''''

OPEN fichier$ + ".txt" FOR RANDOM AS #1 LEN = LEN(q)
size = LOF(1) / LEN(q) + 1
CLOSE (1)
'size = 61
k = size - 1
FOR i = 1 TO k: nonutil(i) = i: NEXT
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

CLS
encore = 0
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
''''''''''''''''''  PRESENTATION(fichier$)  ''''''''''''''''''''''''''''''
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
PALETTE
max = 0: sc = 0: br = 0: mr = 0
COLOR 15, 1
PRINT "*******************************************************************************"; ""
PRINT
PRINT "                           L'ANGLAIS AU CONCOURS"
PRINT
PRINT "*******************************************************************************"
PRINT ': PRINT
PRINT "Programme d'entrainement … la langue anglaise destin‚ aux classes pr‚paratoires"
PRINT
PRINT "                            Edition de Juillet 1990"
PRINT : PRINT
PRINT "                 REGLE :"
PRINT "                 *******"
PRINT "                          Bonne r‚ponse    : +3 points"
PRINT "                          Mauvaise r‚ponse : -1 point"
PRINT "                          Pas de r‚ponse   :  0 point"
PRINT ': PRINT
PRINT SPACE$(22); "Ce questionnaire comporte"; k; "questions ."
PRINT SPACE$(24); "Le temps imparti est de 20 minutes"
PRINT
IF traduc$ = "1" THEN PRINT TAB(8); "La touche F1 permet d'obtenir la traduction de la question pos‚e."
IF gram$ = "1" THEN PRINT TAB(15); "La touche F2 permet d'obtenir une aide grammaticale."
CALL affichedrap(drapeau())
PRINT
PRINT SPACE$(33); "BON COURAGE !!";
DO
LOOP UNTIL INKEY$ <> ""


'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'''''''''''''''''''''''' PRESENTATION2(sc, max, br, mr) '''''''''''''''''''''''
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
PRESENTATION2:
SCREEN 0
COLOR 15, 1
CLS
PRINT "     SCORE           : "; : PRINT USING "###"; sc;
LOCATE 1, 43: PRINT USING "MAXIMUM            : ###"; max
PRINT USING "     Bonnes r‚ponses : ###"; br;
LOCATE 2, 43: PRINT USING "Mauvaises r‚ponses : ###"; mr
PRINT
PRINT "*******************************************************************************"

PRINT : PRINT "   Question Nø :                                       Temps : "
PRINT "   ÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷                                     ÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷"
LOCATE 18, 6: PRINT "Please enter your choice :";
COLOR colsc, 12
LOCATE 1, 24: PRINT USING "###"; sc
LOCATE 1, 64: PRINT USING "###"; max
LOCATE 2, 24: PRINT USING "###"; br
LOCATE 2, 64: PRINT USING "###"; mr
LOCATE 6, 15: PRINT USING "##"; size - k


'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
temps1 = temps
DO
    bool = 0
    '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
    '''''''''''''''''''''''''''''' choixj(j, k) '''''''''''''''''''''''''''''''''''
    '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
choixj:
    DO
        p = INT(k * RND(k) + 1)
        j = nonutil(p)
        FOR i = p TO (k - 1): nonutil(i) = nonutil(i + 1): NEXT
    LOOP UNTIL (j < size) AND j > 0

    '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
    ''''''''''''''''''''''''''''' LitQCM(j, Q) ''''''''''''''''''''''''''''''''''''
    '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
LitQCM:
    OPEN fichier$ + ".txt" FOR RANDOM AS #1 LEN = LEN(q)
    GET #1, j, q
    CLOSE 1

    '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
    '''''''''''''''''''''''''''' R‚duction des QCM'''''''''''''''''''''''''''''''''''
    '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
    emp1 = INSTR(q.p + "    ", "    ") - 1
    Qpr$ = LEFT$(q.p, emp1)
    emp1 = INSTR(q.a + "   ", "   ") - 1
    Qa$ = LEFT$(q.a, emp1)
    emp1 = INSTR(q.B + "   ", "   ") - 1
    Qb$ = LEFT$(q.B, emp1)
    emp1 = INSTR(q.c + "   ", "   ") - 1
    Qc$ = LEFT$(q.c, emp1)
    emp1 = INSTR(q.d + "   ", "   ") - 1
    Qd$ = LEFT$(q.d, emp1)
    Qbrep = CVI(q.brep)

    '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
    ''''''''''''''''''' ECRAN(sc, max, br, mr, size, k, Q) ''''''''''''''''''''''''
    '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
ECRAN:
    temps2 = INT((temps - temps1) / 60)
    COLOR coltps, 1
    LOCATE 6, 63: PRINT USING "###"; temps2; : PRINT " min ";
    PRINT USING "###"; ((temps - temps1) / 60 - temps2) * 60; : PRINT " sec   "
    COLOR 15, 1
    LOCATE 9, 1: PRINT SPACE$(80)
    LOCATE 10, 1: PRINT SPACE$(80)
    LOCATE 9, 1
    COLOR 14, 1
    Qp1$ = Qpr$
    taille = (40 - INT(LEN(Qp1$) / 2))
    IF taille < 0 THEN taille = 0
    PRINT SPACE$(taille); QP(Qp1$)
    COLOR 15, 1
    LOCATE 12, 1
    PRINT "     <1>- "; Qa$; SPACE$(30 - LEN(Qa$))
    PRINT "     <2>- "; Qb$; SPACE$(30 - LEN(Qb$))
    PRINT "     <3>- "; Qc$; SPACE$(30 - LEN(Qc$))
    PRINT "     <4>- "; Qd$; SPACE$(30 - LEN(Qd$))
    PRINT "     <5>- pas de r‚ponse"; SPACE$(25)

    LOCATE 18, 35: PRINT SPACE$(43)
    VIEW PRINT 20 TO 25
    FOR i = 1 TO 6: LOCATE (19 + i), 1: PRINT SPACE$(80); : NEXT
    SCREEN 0
    VIEW PRINT
    LOCATE 25, 13
    COLOR 15, 1
    PRINT "Tapez le num‚ro de la r‚ponse qui vous semble correcte .";
    DO
        Ch2$ = INKEY$
        IF Ch2$ = "" THEN Ch2$ = "9"
        temps2 = INT((temps - temps1) / 60)
        COLOR coltps, 1
        LOCATE 6, 63, 0: PRINT USING "###"; temps2; : PRINT " min ";
        PRINT USING "###"; ((temps - temps1) / 60 - temps2) * 60; : PRINT " sec   "
        IF temps2 >= 20 THEN
            coltps = 6
            colsc = 31
        END IF
        IF INSTR("Ss", Ch2$) <> 0 AND k < (size - 1) THEN GOTO resultat
        IF Ch2$ = (CHR$(0) + CHR$(59)) THEN CALL Fenactv1(Q2, fichier$, j, traduc$, temps1)
        IF Ch2$ = (CHR$(0) + CHR$(60)) THEN CALL Fenactv2(Q3, fichier$, j, gram$, temps1)
    LOOP UNTIL INSTR("12345", Ch2$) <> 0
    COLOR 15, 1
    LOCATE 18, 35

    ch = VAL(Ch2$)
    SELECT CASE Ch2$
        CASE "1": PRINT (Qa$)
        CASE "2": PRINT (Qb$)
        CASE "3": PRINT (Qc$)
        CASE "4": PRINT (Qd$)
        CASE "5": PRINT "Pas de r‚ponse "
    END SELECT

    'COLOR 15, 0
    LOCATE 9, 1

    '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
REMPLACE:
    emp1 = INSTR(Qpr$, "...")

    IF emp1 > 0 THEN
        x$ = MID$(Qp1$, 1, emp1 - 1)
        Y$ = MID$(Qp1$, emp1 + 3, LEN(Qp1$) - emp1)
        + seven +$ = Qp1$: Y$ = ""
    END IF

    emp2 = INSTR(Y$, "...")

    IF (emp2 > 0) AND Y$ <> "" THEN
        z$ = MID$(Y$, (emp2 + 3), (LEN(Y$) - emp2))
        Y$ = MID$(Y$, 1, emp2 - 1)
    END IF

    SELECT CASE Qbrep
        CASE 1: u$ = Qa$
        CASE 2: u$ = Qb$
        CASE 3: u$ = Qc$
        CASE 4: u$ = Qd$
    END SELECT

    u$ = "{ " + u$ + " }"

    emp2 = INSTR(u$, "...")
    IF emp2 = 0 THEN
        REMPLACE$ = QP(x$ + u$ + Y$)
    ELSE
        v$ = "{ " + MID$(u$, emp2 + 3, LEN(u$) - emp2)
        u$ = MID$(u$, 1, emp2 - 1) + " }"
        REMPLACE$ = QP(x$ + u$ + Y$ + v$ + z$)
    END IF

    IF emp1 = 0 THEN REMPLACE$ = QP(x$)

FINREMPLACE:
    '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
    taille = (40 - INT(LEN(REMPLACE$) / 2))
    IF taille < 0 THEN taille = 0

    PRINT SPACE$(taille); (REMPLACE$)
    'COLOR 15, 1
    '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
SCORE:
    max = max + 3
    IF ch <> Qbrep THEN
        SELECT CASE ch
            CASE 1: u$ = Qa$: LOCATE 12, 11
            CASE 2: u$ = Qb$: LOCATE 13, 11
            CASE 3: u$ = Qc$: LOCATE 14, 11
            CASE 4: u$ = Qd$: LOCATE 15, 11
            CASE 5: u$ = "Pas de r‚ponse, mauvaise r‚ponse !!!": LOCATE 16, 11
        END SELECT
        PALETTE 6, 44
        COLOR 6, 1
        PRINT u$
    END IF

    SELECT CASE Qbrep
        CASE 1: u$ = Qa$: LOCATE 12, 11
        CASE 2: u$ = Qb$: LOCATE 13, 11
        CASE 3: u$ = Qc$: LOCATE 14, 11
        CASE 4: u$ = Qd$: LOCATE 15, 11
        CASE 5: u$ = "Pas de r‚ponse  ": LOCATE 16, 11
    END SELECT

    COLOR 10, 1
    'IF ch = Qbrep THEN COLOR 10, 1 ELSE COLOR 10, 1
    PRINT u$;
    IF ch = Qbrep THEN COLOR 10, 1 ELSE COLOR 6, 1

    'COLOR 15, 1
    IF (ch = Qbrep) THEN
        sc = sc + 3: br = br + 1
        LOCATE 20, 1
        PRINT "                                           ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»  "
        PRINT "                                           º BONNE REPONSE !... º  "
        PRINT "                                           ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍŒ  "
        'COLOR 15, 1
    ELSE
        sc = sc - 1: mr = mr + 1
        LOCATE 20, 1
        PRINT SPACE$(31); : PRINT "MAUVAISE REPONSE ! "
        COLOR 15, 1
        taille$ = SPACE$(40 - ((23 + LEN(u$)) / 2))
        PRINT taille$; : FOR i = 1 TO (LEN(u$) + 24): PRINT "Í"; : NEXT: PRINT "Í"
        COLOR 10, 1
        PRINT taille$; : PRINT " La bonne r‚ponse est : "; u$
        COLOR 15, 1
        PRINT taille$; : FOR i = 1 TO (LEN(u$) + 24): PRINT "Í"; : NEXT: PRINT "Í"
    END IF

    IF (ch = 5) THEN sc = sc + 1
    COLOR 15, 1
finscore:
    '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
    LOCATE 25, 1
    PRINT SPACE$(14); "Please press 'S' to STOP or any other key to continue";

    Ch2$ = "l"

    DO
        Ch2$ = INKEY$
        IF Ch2$ = "" THEN Ch2$ = "l"
        temps2 = INT((temps - temps1) / 60)
        COLOR coltps, 1
        LOCATE 6, 63: PRINT USING "###"; temps2; : PRINT " min ";
        PRINT USING "###"; ((temps - temps1) / 60 - temps2) * 60; : PRINT " sec   "
        IF temps2 > 20 THEN
            coltps = 6
            colsc = 31
        END IF
        IF bool = 0 THEN
            COLOR colsc, 4
            LOCATE 1, 24: PRINT USING "###"; sc
            LOCATE 1, 64: PRINT USING "###"; max
            LOCATE 2, 24: PRINT USING "###"; br
            LOCATE 2, 64: PRINT USING "###"; mr
            LOCATE 6, 15: PRINT USING "##"; size - k
            bool = 1
        END IF
        IF INSTR("sS", Ch2$) <> 0 THEN encore = 1
        IF Ch2$ = (CHR$(0) + CHR$(59)) THEN
            CALL Fenactv1(Q2, fichier$, j, traduc$, temps1)
            Ch2$ = "l"
        END IF
        IF Ch2$ = (CHR$(0) + CHR$(60)) THEN
            CALL Fenactv2(Q3, fichier$, j, gram$, temps1)
            Ch2$ = "l"
        END IF
    LOOP UNTIL Ch2$ <> "l"

    COLOR 15, 1
    '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

    '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
    k = k - 1
LOOP UNTIL encore = 1 OR (k = 0)
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
''''''''''''''''''''''''' RESULTAT(sc, max, br, mr) '''''''''''''''''''''''''''
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
resultat:
CLS
PRINT : PRINT : PRINT
PRINT SPACE$(15); "     SCORE              : "; : PRINT USING "###"; sc
PRINT SPACE$(15); "     MAXIMUM            : "; : PRINT USING "###"; max
PRINT
PRINT SPACE$(15); "     Bonnes r‚ponses    : "; : PRINT USING "###"; br
PRINT TAB(16); "     Mauvaises r‚ponses : "; : PRINT USING "###"; mr
PRINT
IF (sc < 0) THEN
    sc = 0
    PRINT TAB(15); "    SCORE RECTIFIE      : "; : PRINT USING "###"; sc
    PRINT
END IF
moy = ((sc / max) * 20)
LOCATE 15, 20
PRINT USING "Votre moyenne est de : ###.##"; moy; : PRINT " sur 20"
PRINT TAB(20); "===================================="
PRINT : PRINT : COLOR 15, 1
LOCATE 24, 20
PRINT "Please press any key to continue";
DO
LOOP UNTIL INKEY$ <> ""

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
''''''''''''''''''''''''''''''''''' FINAL '''''''''''''''''''''''''''''''''''''
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
RUN

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

END

SUB affichedrap (drapeau() AS INTEGER)
SCREEN 9, 0, 0, 0
PUT (20, 9), drapeau, PSET
PUT (500, 9), drapeau, PSET

END SUB

SUB AIDE1 (n!)
VIEW PRINT 9 TO 20
'CLS 2
COLOR 12, 0
IF n! < 10 THEN
    n$ = "0" + MID$(STR$(n!), 2)
ELSE
    n$ = MID$(STR$(n!), 2)
END IF
BEEP
Y = 25
LOCATE 9, Y
PRINT "ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»";
LOCATE 10, Y
PRINT "º           AIDE              º";
LOCATE 11, Y
PRINT "º           ____              º";
LOCATE 12, Y
PRINT "º                             º";
LOCATE 13, Y
PRINT "º Il y a "; : PRINT USING "##"; n!; : PRINT "  fichiers de QCM. º";
LOCATE 14, Y
PRINT "º                             º";
LOCATE 15, Y
PRINT "º     Choisissez en un        º";
LOCATE 16, Y
PRINT "º     Tapez son numero        º";
LOCATE 17, Y
PRINT "º        de 01 … "; n$; "           º";
LOCATE 18, Y
PRINT "º                             º";
LOCATE 19, Y
PRINT "º     'S' pour Quitter        º";
LOCATE 20, Y
PRINT "ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍŒ";
DO
LOOP UNTIL INKEY$ <> ""
'CLS 2
VIEW PRINT
'LOCATE 14, 27
'PRINT "  C  1990 SEBASTIEN CRESPEL"

END SUB

SUB Fenactv1 (Q2 AS QCM2, fichier$, j, traduc$, temps1)
Action% = 1
Buffer% = 1
CALL windows(RETCODE%, Buffer%, Action%)
VIEW PRINT 17 TO 25
COLOR 13, 8
CLS 2
LOCATE 17, 1
PRINT STRING$(80, "Ä");
'COLOR 13, 8
PRINT
IF traduc$ = "1" THEN
    OPEN fichier$ + ".tra" FOR RANDOM AS #1 LEN = LEN(Q2)
    GET #1, j, Q2
    CLOSE 1
    COLOR 11, 8
    PRINT "Traduction :"
    COLOR 13, 8
    PRINT
    PRINT QP(Q2.t)
ELSE
    COLOR 5, 8
    LOCATE 21, 28
    PRINT "Il n'y a pas de traduction"
END IF
COLOR 17, 8
LOCATE 24, 35
PRINT "Press a key"
LOCATE 25, 1
COLOR 14, 8
PRINT STRING$(80, "Ä");
COLOR 15, 8
VIEW PRINT
COLOR 15, 1
DO
    temps2 = INT((temps - temps1) / 60)
    'COLOR coltps, 1
    LOCATE 6, 63: PRINT USING "###"; temps2; : PRINT " min ";
    PRINT USING "###"; ((temps - temps1) / 60 - temps2) * 60; : PRINT " sec   "

LOOP UNTIL INKEY$ <> ""
COLOR 15, 1
CLS
VIEW PRINT
Action% = 2
CALL windows(RETCODE%, Buffer%, Action%)

END SUB

SUB Fenactv2 (Q3 AS QCM3, fichier$, j, gram$, temps1)
DIM q(10) AS STRING

VIEW PRINT
Buffer% = 1
Action% = 1
        CALL windows(RETCODE%, Buffer%, Action%)
COLOR 14, 8
LOCATE 11, 41
PRINT "Ú"; STRING$(38, "Ä"); "¿";
IF gram$ = "1" THEN
    OPEN fichier$ + ".gra" FOR RANDOM AS #1 LEN = LEN(Q3)
    GET #1, j, Q3
    CLOSE 1
    rem$ = Q3.G1
    l = LEN(rem$)
    FOR i = 0 TO 7
        q(i) = MID$(rem$, 35 * i + 1, 35)
    NEXT
    q(8) = MID$(rem$, 35 * i + 1, 34) + " "

    LOCATE 12, 41
    PRINT "³"
    LOCATE 12, 42
    COLOR 11, 8
    PRINT "Remarque grammaticale :";
    COLOR 14, 8
    PRINT TAB(80); "³";
    LOCATE 13, 41
    PRINT "³"; TAB(80); "³";
    FOR i = 1 TO 9
        LOCATE 13 + i, 41
        PRINT "³"
        LOCATE 13 + i, 42
        COLOR 13, 8
        PRINT "  "; q(i - 1); " "
        LOCATE 13 + i, 80
        COLOR 14, 8
        PRINT "³";
    NEXT i
    LOCATE 23, 41
    PRINT "³"; TAB(80); "³";

ELSE
    COLOR 14, 8
    FOR i = 1 TO 12
        LOCATE 11 + i, 41
        IF i <> 6 THEN PRINT "³"; TAB(80); "³";
        IF i = 6 THEN PRINT "³"; TAB(48); "Il n'y a pas de Remarque"; TAB(80); "³";
    NEXT
END IF
LOCATE 24, 41
PRINT "³"; TAB(55);
COLOR 14, 8
PRINT "Press a key";
'COLOR 14, 8
PRINT TAB(80); "³";
LOCATE 25, 41
PRINT "À"; STRING$(38, "Ä"); "Ù";
COLOR 15, 1
DO
    temps2 = INT((temps - temps1) / 60)
    COLOR 15, 1
    LOCATE 6, 63: PRINT USING "###"; temps2; : PRINT " min ";
    PRINT USING "###"; ((temps - temps1) / 60 - temps2) * 60; : PRINT " sec   "

LOOP UNTIL INKEY$ <> ""
VIEW PRINT
Action% = 2
        CALL windows(RETCODE%, Buffer%, Action%)


END SUB

SUB Lectdat (fichier$, gram$, traduc$)
OPEN fichier$ + ".dat" FOR RANDOM AS #1 LEN = 2
FIELD #1, 1 AS gram1$, 1 AS traduc1$
GET #1, 1
gram$ = gram1$
traduc$ = traduc1$

CLOSE #1

END SUB

SUB logo (fichier$, min%, max%, drapeau() AS INTEGER)
SCREEN 9, 0, 0, 0
DEBlog:

COLOR 15, 1
CLS 1
PAINT (10, 10), 1



'----------- DRAPEAU ANGLAIS----------------------

X0 = 57: Y0 = 30: x1 = 4: y2 = 5
DRAW "s4"
LA = 35: HA = 50 'CARTE EGA (LA= HORIZONTAL,HA=AXE VERTICAL)

LINE (x1, y2)-STEP(3 * LA, HA), 7, B

PAINT (X0 + 5, Y0), 7
PSET (X0, Y0), 0


DRAW "BM-7,-25 C4 R13 D50 L12 U50"
PSET (X0, Y0), 1
PAINT (X0, Y0), 4

DRAW "BM-53,-5 C4 R105 D10 L105 U10"
PSET (X0 - 10, Y0), 7
PAINT (X0 - 10, Y0), 4
PSET (X0 + 10, Y0), 7
PAINT (X0 + 10, Y0), 4
PSET (X0, Y0), 7

DRAW "BM-54,-25 "
DRAW "C4 TA 150 L40"
DRAW "TA 0 L6 TA 150 R32 TA 0 U3"
PSET (X0 - 45, Y0 - 20), 7
PAINT (X0 - 45, Y0 - 20), 4
PSET (X0, Y0), 7

DRAW "BM+53,+25 C4 TA 150 R40 TA 0 R6 TA 150 L32 TA 0  D3 "
PSET (X0 + 45, Y0 + 20), 7
PAINT (X0 + 45, Y0 + 20), 4
PSET (X0, Y0), 7

DRAW "BM-53,25 C4 TA 210 L40 TA 0 R6 TA 210 R42 TA 0 L3 U3 "
PSET (X0 - 37, Y0 + 20), 7
PAINT (X0 - 37, Y0 + 20), 4
PSET (X0, Y0), 7

DRAW "BM+54,-25 C4 TA 210 R40 TA 0 L6 TA 210 L40 TA 0 R3 D2 "
PSET (X0 + 38, Y0 - 20), 7
PAINT (X0 + 38, Y0 - 20), 4
PSET (X0, Y0), 7

DRAW " BM-40,-25 C1 R30 D14 "
DRAW " TA 330 L37 TA 0"
PSET (X0 - 25, Y0 - 20), 7
PAINT (X0 - 25, Y0 - 20), 1
PSET (X0, Y0), 4

DRAW "BM-25,+8 C1 L28 D12"
DRAW " TA 210 L33 TA 0"
PSET (X0 - 45, Y0 + 13), 7
PAINT (X0 - 45, Y0 + 13), 1
PSET (X0, Y0), 7

DRAW "BM+41,+25 C1 L30 U13"
DRAW " TA 150 L36 TA 0"
PSET (X0 + 15, Y0 + 20), 7
PAINT (X0 + 15, Y0 + 20), 1
PSET (X0, Y0), 7

DRAW "BM-10,12 C1 D13 L29"
DRAW " TA 210 L32 TA 0"
PSET (X0 - 15, Y0 + 20), 7
PAINT (X0 - 15, Y0 + 20), 1
PSET (X0, Y0), 7

DRAW "BM-30,-8 C1 L23 U10"
DRAW " TA 150 L28 TA 0"
PSET (X0 - 47, Y0 - 10), 7
PAINT (X0 - 47, Y0 - 10), 1
PSET (X0, Y0), 7

DRAW "BM+38,-25 C1 L28 D12 "
DRAW " TA 210 L31 TA 0"
PSET (X0 + 15, Y0 - 20), 7
PAINT (X0 + 15, Y0 - 20), 1
PSET (X0, Y0), 7

DRAW "BM+52,+18 C1 U10 L24"
DRAW " TA 149 L28 TA 0"
PSET (X0 + 45, Y0 + 10), 7
PAINT (X0 + 45, Y0 + 10), 1
PSET (X0, Y0), 7

DRAW "BM+52,-21 C1 D13 L26"
DRAW " TA 211 L29 TA 0"
PSET (X0 + 45, Y0 - 10), 7
PAINT (X0 + 45, Y0 - 10), 1
PSET (X0, Y0), 4

LINE (x1, y2)-STEP(3 * LA, HA), 3, B

GET (x1, y2)-(3 * LA + 5, HA + 5), drapeau

FOR i = 0 TO 11
    IF i <= 3 THEN
        X0 = 57 + 175 * i
        Y0 = 30
    END IF
    IF i > 3 AND i <= 6 THEN
        X0 = 57 + 175 * 3
        Y0 = 30 + (i - 3) * 96
    END IF
    IF i > 6 AND i <= 8 THEN
        X0 = (57 + 175 * 3) - (i - 6) * 175
        Y0 = 318
    END IF
    IF i > 8 THEN
        X0 = 57
        Y0 = 318 - 96 * (i - 9)
    END IF
    x1 = X0 - 53: y2 = Y0 - 25:
    PUT (x1, y2), drapeau, PSET
NEXT i
DebLogo:
COLOR 15, 0
LOCATE 14, 27
PRINT "  C  1990 SEBASTIEN CRESPEL"

'COLOR 15, 1
'SCREEN 9
CIRCLE (228, 188), 9
PALETTE 11, 59
PALETTE 12, 62
PALETTE 13, 61
PALETTE 14, 63
PALETTE 10, 63
'----------------------------- TEXTE ------------------------------------

x = 200: Y = 170
PI = 3.1459
FOR BOUCLE = 1 TO 7

    '----- Q --------
    XX = x + 30
    YY = Y - 50
    CIRCLE (XX, YY), 35, 13
    LINE (x + 35, Y - 35)-(x + 50, Y - 25), 13


    '------ C -------
    CIRCLE (x + 130, Y - 50), 35, 12, PI / 2, 3 * PI / 2

    '------ M -------
    LINE (x + 160, Y - 25)-(x + 160, Y - 80), 11
    LINE (x + 160, Y - 80)-(x + 190, Y - 50), 11
    LINE (x + 190, Y - 50)-(x + 220, Y - 80), 11
    LINE (x + 220, Y - 80)-(x + 220, Y - 25), 11

    '------- Nø -----
    LINE (x + 35, 275)-(x + 35, 225), 14
    LINE (x + 35, 225)-(x + 95, 275), 14
    LINE (x + 95, 275)-(x + 95, 225), 14
    CIRCLE (x + 108, 223), 5, 11

    '------- - - -------
    LINE (130 + x, x + 68)-(180 + x, x + 68), 10
    LINE (200 + x, x + 68)-(250 + x, x + 68), 10

    x = x + 1

NEXT



logo2:
k = 11
compteur = 1
TPS = 250
n = nbfich
DO
    IF (compteur = 1) THEN
        FOR i = 1 TO INT(n / 10)
            ensemble$ = ensemble$ + MID$(STR$(i), 2)
        NEXT i
        ensemble$ = ensemble$ + "0Ss"
    ELSE
        IF n < 10 THEN
            nb = n
        ELSE
            nb = n - INT(n / 10) * 10
        END IF
        FOR i = 1 TO nb
            ensemble$ = ensemble$ + MID$(STR$(i), 2)
        NEXT i
        ensemble$ = ensemble$ + "0Ss"
        IF Numfichier$ = "0" THEN ensemble$ = "123456789Ss"
        compteur = compteur + 1
    END IF
    'PRINT ensemble$, nbfich, compteur
 
    DO
        Ch1$ = INKEY$
        PALETTE 4, 4
        PALETTE 7, 7
        PALETTE 10, 62
        PALETTE 11, 62
        PALETTE 13, 59
        PALETTE 12, 61
        FOR j = 1 TO TPS: NEXT j
        PALETTE 11, 61
        PALETTE 12, 59
        PALETTE 13, 62
        IF Ch1$ = (CHR$(0) + CHR$(59)) THEN
            CALL AIDE1(n!)
            LINE (110, 70)-(560, 290), 1, BF
            GOTO DebLogo
        END IF

        FOR j = 1 TO TPS: NEXT
        'IF k = 11 THEN k = 12 ELSE IF k = 12 THEN k = 13 ELSE k = 11
        PALETTE 11, 59
        PALETTE 12, 62
        PALETTE 13, 61

        FOR j = 1 TO TPS: NEXT
        PALETTE 4, 1
        PALETTE 7, 1
        PALETTE 11, 59
        PALETTE 12, 62
        PALETTE 13, 61
        PALETTE 10, 1
        FOR j = 1 TO TPS: NEXT j
        'IF k = 11 THEN k = 12 ELSE IF k = 12 THEN k = 13 ELSE k = 11
        IF Ch1$ = "" THEN Ch1$ = "z"

    LOOP UNTIL INSTR(ensemble$, Ch1$) <> 0
    IF INSTR("sS", Ch1$) <> 0 THEN END
    Numfichier$ = Numfichier$ + Ch1$
    ensemble$ = ""
    CALL NUMEROS(VAL(Ch1$), compteur)
    compteur = compteur + 1

LOOP UNTIL compteur > 3
IF VAL(Numfichier$) > nbfich THEN
                              
    GOTO logo2
END IF
fichier$ = "q" + MID$(STR$(VAL(Numfichier$)), 2)
PALETTE 10, 10
END SUB

FUNCTION nbfich
compteur = 1
DO
    fichier$ = "Q" + MID$(STR$(compteur), 2) + ".dat"
    OPEN fichier$ FOR RANDOM AS #1 LEN = 1
    FIELD #1, 1 AS gram$
    size = LOF(1)
    CLOSE 1
    compteur = compteur + 1
LOOP UNTIL size = 0
nbfich = compteur - 2

END FUNCTION

SUB NUMEROS (NUMERO, compteur)
IF compteur = 1 THEN Y = 0 ELSE Y = 70
FOR i = 1 TO 10
    x = 198 + i
    LINE (130 + x + Y, x + 68)-(180 + x + Y, x + 68), 1
NEXT i
IF NUMERO = 0 THEN
    '----- 0 ------
    FOR i = 1 TO 5
        PSET (355 + i + Y, 267 + i)
        DRAW "BL18BU8U32E8R16F8D32G8L16H8U32"
        PSET (355 + i + Y, 267 + i), 1
    NEXT i
END IF

ON NUMERO GOSUB UN, DEUX, TROIS, QUATRE, CINQ, SIX, SEPT, HUIT, NEUF
EXIT SUB

'----- 1 ------
UN:
FOR i = 1 TO 5
    PSET (355 + i + Y, 267 + i)
    DRAW "L25R50L25U50G22"
    PSET (355 + i + Y, 267 + i), 1
NEXT i
RETURN
'----- 2 ------
DEUX:
FOR i = 1 TO 5
    PSET (355 + i + Y, 257 + i)
    DRAW "BU30BL15E10R15F10D10G30R40"
    PSET (355 + i + Y, 267 + i), 1
NEXT
RETURN
'----- 3 ------
TROIS:
FOR i = 1 TO 5
    PSET (355 + i + Y, 267 + i)
    DRAW "BL20BU50R40G20 L10R10  R10F10D15G10L20H7"
    PSET (355 + i + Y, 267 + i), 1
NEXT
RETURN
'----- 4 ------
QUATRE:
FOR i = 1 TO 5
    PSET (355 + i + Y, 270 + i)
    DRAW "BR10U52G36R50"
    PSET (355 + i + Y, 270 + i), 1
NEXT

RETURN
'----- 5 ------
CINQ:
FOR i = 1 TO 5
    PSET (355 + i + Y, 270 + i)
    DRAW "BL21BU50BR28L28D14 R21F7D18G7L14H7"
    PSET (355 + i + Y, 270 + i), 1
NEXT i
RETURN
'----- 6 ------
SIX:
FOR i = 1 TO 5
    PSET (355 + i + Y, 270 + i)
    DRAW "BU48BL8L16G15D21F8 R16E9U9H8L17"
    PSET (355 + i + Y, 270 + i), 1
NEXT i

RETURN
'----- 7 ------
SEPT:
FOR i = 1 TO 5
    PSET (355 + i + Y, 270 + i)
    DRAW "BL24BU48R32D8G32D8"
    PSET (355 + i + Y, 270 + i), 1
NEXT i

RETURN
'----- 8 ------
HUIT:
FOR i = 1 TO 5
    PSET (355 + i + Y, 270 + i)
    DRAW "BL16BU26 R16E8U8H8L16 G8D8F8 BD24 R16E8U8H8L16 G8D8F8"
    PSET (355 + i + Y, 270 + i), 1
NEXT i

RETURN
'----- 9 ------


NEUF:
FOR i = 1 TO 5
    PSET (355 + i + Y, 270 + i)
    DRAW "BL16BU24 R16E8U8H10L16 G8D8F8 R24D16G8L16H8"
    PSET (355 + i + Y, 270 + i), 1
NEXT i

RETURN
'--- POINTE -----
POINTE:
PSET (330, 225), 15
RETURN

'--- EFF POINTE ----
EFFPOINTE:
PSET (330, 225), 0
RETURN

END SUB

FUNCTION QP$ (Qp1$)
blanc$ = ""
longueur = LEN(Qp1$)
instri = 80: test = 0
IF (longueur > 80) THEN
    DO
        x$ = MID$(Qp1$, instri, 1)
        IF x$ = " " THEN test = 1
        instri = instri - 1
    LOOP UNTIL test = 1
    qp2$ = MID$(Qp1$, instri + 1, longueur)
    blanc$ = SPACE$(80 - instri)
    qp2$ = MID$(Qp1$, 1, instri) + blanc$ + qp2$
    QP$ = qp2$
ELSE
    QP$ = Qp1$
END IF

END FUNCTION

FUNCTION temps
temps = VAL(LEFT$(TIME$, 2)) * 3600 + VAL(MID$(TIME$, 4, 2)) * 60 + VAL(RIGHT$(TIME$, 2))
END FUNCTION
Which is tantalisingly close to being correct, but if you try to compile it, you'll notice the windows() subroutine is missing. I am unsure if the translator was simply not good enough to extract it, or if it does not exist in the file to begin with.

Re: How do i open a .BAS file that is created in 1997

Posted: Wed Jul 27, 2016 11:22 pm
by cseb95
Hi !

Thanks a lot. Which translator did you use ? I have other files like this one that I need to translate.

I'm sure I was using QB4.5 when coding this, do you know why we can't open them with the same QB version ?

If I remember the window function was from an external library.

Re: How do i open a .BAS file that is created in 1997

Posted: Tue Aug 09, 2016 11:35 am
by flukiluke
http://www.qb64.net/wiki/index.php/Tokenized_Code

Link is at the top of the page; you can ignore all the technical details on the page if you want. I don't have any good explanation as to why it won't open properly, beyond the pathetic 'corrupted file' excuse.

If your other programs are anything like the one you posted, the decoder will also duplicate the program text. The code I posted was repeated in the file a good 7 or 8 times.

Re: How do i open a .BAS file that is created in 1997

Posted: Thu Jan 12, 2017 8:25 pm
by beatlesfan317
I found this topic to be really helpful too. It can be really frustrating to try to open and old game only to receive error codes.

------------------------------------------------------------------------------------------------
Panic Mansion http://philome.la/beatlesfan317/panic-mansion is a combination of a trivia game and an action-rpg. You must find your way through the Panic Mansion (like a panic room but a whole mansion) by completing quests, answering questions and defeating bosses at the end of each level.