ILLEGAL FUNCTION,error,My2nd program
Posted: Mon Aug 02, 2010 9:19 pm
Hello All,
I am baffled, this is going to be my final edition of this, but I want
to include a small game in it or "sortof a joke"...if and when I have a
real game, and know how to add it probely I will. The problem: every thing
loads and runs ok ,except when the user selects "J" for the game (it is not
really much of a game), the "game" runs ok, up to a point, I get a error:
LINE 171: illegal instruction, continue (yes), or (no)if I select continue it dose,
but step by step and of course no,exits..I cannot figure out why the illegal
function, the code that is in GAME: ran fine by itself,but when I added it
the problem started,....
Also or if anyone has a game they would like to give me, that I could put
in, that would be great!...I wanted to put in the LeapFrog, by Bob in the
samples folder,that came with QB64....but could not figure out how,and also
was concerned about permission....this program is for me,personal and anyone
who can use it....it will always be available free,at least on my website,
or from me,I cannot be responsible for what someone else might do, if anyone
should copy it and try to sell it, it is without my permision,but I kinda
doupt I need to worry about that, it is not that great,...
ok Thanks for any help,...and I am finding some great friends on this site!
Also note: In the introduction, I will be adding that I got the "Calculator",
of the samples,in QB64/samples/pete/calc...,and another friend ,anonymos(IOPNN), gave me the code for the multiplication tables,
and any other credit where its due,before I make the stand alone exe,
and put it on my site, or any other
From Garry
Code Below the error is al the way at the botton :LINE 171
'----------------------------------------------------------------------
SCREEN 0
WIDTH 80
PRINT "Program BY:Garry Ricketson."
PRINT "E-mail:GarryRicketson@yahoo.com, http://www.garryspages.webs.com"
PRINT "Note: this is not a game nor intended to be real fun,if you don't"
PRINT "get the right answer, you cannot move on,Alfonso dose not like to,"
PRINT "study his X tabels,but he loves to play the computer games(san"
PRINT "Andreas auto theft) is his favorite. So, the idea is the faster"
PRINT "he learns the tabels, the sooner he can play his game, when he"
PRINT " completes the whole program, I then let him play with the computer"
PRINT "I hope anyone else can also use it."
SLEEP 5
SCREEN 0
WIDTH 40
COLOR 10, 1
PRINT "?VAMOS a HACER TABLAS"; ""
PLAY "aaaa4bbb8<ggg4a2e8gggg>a4f8e2ccca4a4a4"
PRINT "tecla q para salir, intro para continuar"
PRINT "press q to exit tecla q para salir"
PRINT "Cualquire tecla para continuar"
INPUT "q", Q$
IF Q$ = "q" THEN END
SLEEP 5
PRINT "!Bienvenido!,WELCOME!... "
PRINT "Nada para decir ahora "
PRINT "ES una ejercisio de tablas, lo gue hizo para Alfonso,These are "
PRINT "multiplication tabels I made for Alfonso"
INPUT "ENTER YOUR NAME,escribe tu nombre:", name$
PRINT "?HOLA!,"; name$; ".?como estas,hoy?"
CLS
COLOR 17, 10, 2
PRINT "??????????????????????????????????"
PRINT "------------------------------------"
PRINT "???????????????????????????????????"
PRINT "? ?"
PRINT "? ? ? ?"
PRINT "? ? ?? ?"
PRINT "? ? ? OLA! ?"
PRINT "? Alfonso....... ?"
PRINT "? ?"
PRINT "? ?"
PRINT "???????????????????????????????????"
SLEEP 5
CLS
COLOR 10, 1, 2
PRINT "?HOLA!,Alfonso, vamos a hacer tablas"
PRINT "Ahora vamos acer Multiplicaciones(tablas)"
COLOR 14: PRINT "Buenos Dias"
FOR d = 600 TO 640
SOUND d, 1
NEXT
SLEEP 2
CLS
COLOR 14: PRINT "Buenos Dias"
FOR d = 600 TO 640
SOUND d, 1
NEXT
SLEEP 2
CLS
TOP:
COLOR 2: PRINT "puede ser este cosas "
PRINT
PRINT "(T)tablas"
PRINT "(C)alculator"
PRINT "(J)juego"
PRINT "(S)alir de programa"
ReHit: F$ = INPUT$(1) 'INPUT$ will wait for a keypress.
1 IF LCASE$(F$) = "t" THEN GOTO TABLAS
IF LCASE$(F$) = "c" THEN GOTO Calculater
IF LCASE$(F$) = "j" THEN GOTO GAME
IF LCASE$(F$) = "s" THEN END
GOTO ReHit
TABLAS: PRINT "Esos son los tablas"
RANDOMIZE TIMER
CLS
FOR i = 0 TO 100
x = INT(RND * 10) + 1 'if you want say only 9s or only 7s, change
'this to x=9 or x=7 ...
y = INT(RND * 10) + 1
PRINT x; "X"; y; "=";
INPUT "", n
IF x * y <> n THEN
PRINT "NOT CORRECT"
INPUT "Entra el primero numero: ", a
INPUT "Entra el segundo numero: ", b
PRINT "Respuesta corecto es: "; a * b 'now I am closer, on the
'previous that I sent 'you I had forgotten the b on this line.
ELSE
PRINT "CORRECT"
PRINT
END IF
NEXT
GOTO TOP:
Calculater:
PRINT "Eso es Calculador"
5 CLS
PRINT "1) ADD"
PRINT "2) MULTIPLY"
PRINT "3) DIVIDE"
PRINT "4) SQUARE ROOT"
PRINT "5) EXIT"
INPUT i
IF i = 1 GOTO 10
IF i = 2 GOTO 20
IF i = 3 GOTO 30
IF i = 4 GOTO 40
IF i = 5 GOTO TOP:
10 CLS: PRINT "INPUT NUMBER"
INPUT a
CLS
PRINT "INPUT NEXT NUMBER"
INPUT b
CLS
PRINT a + b
PRINT "PRESS SPACE TO RUN"
SLEEP 0
GOTO 5
20 CLS: PRINT "INPUT NUMBER"
INPUT C
CLS
PRINT "INPUT NEXT NUMBER"
INPUT d
CLS
PRINT C * d
PRINT "PRESS SPACE TO RUN"
SLEEP 0
GOTO 5
30 CLS: PRINT "INPUT NUMBER"
INPUT E
CLS
PRINT "INPUT NEXT NUMBER"
INPUT F
CLS
PRINT E / F
PRINT "PRESS SPACE TO RUN"
SLEEP 0
GOTO 5
40 CLS: PRINT "INPUT NUMBER"
INPUT G
CLS
PRINT SQR(G)
PRINT "PRESS SPACE TO RUN"
SLEEP 0
GOTO 5
GOTO TOP:
'----------------------------------insert calculator
GAME:
SCREEN 0
WIDTH 80
DEFINT A-Z 'By its self this worked ok, but when I added it...no
DECLARE SUB Align (Tclr, Trow, txt$)
Align 14, 5, "MIRA ,LO QUE HIZO"
Align 14, 8, " AQUI ES TU JUEGO"
Align 15, 10, "TECLA INTRO PARA SALIR " + Prt$ + "NO, PARA JUEGAR" + Qt$
DO: LOOP UNTIL INKEY$ <> ""
CLS
TOPB:
FOR i% = 2 TO 28
Align 13, i%, "El Cielo es Caiendo!"
Align 13, i% - 1, SPACE$(19)
SOUND 2000 / i%, 1
NEXT i%
Align 14, 5, "Alfonso, siempre quiere jugar"
Align 18, 15, "Dice Blinky blinky blinky, estoy abburido"
Align 15, 10, "Tecla el Q para salir"
IF INKEY$ = "Q" THEN END
GOTO TOPB:
SUB Align (Tclr, r0w, txt$)
c0l = 41 - (LEN(txt$) \ 2)
COLOR Tclr: LOCATE r0w, c0l: PRINT txt$; 'This is line 171 or where it says
'illegal instruction
END SUB
'________________________End of program___________
And thanks,
From Garry
p.s. I hope this is not too long
I am baffled, this is going to be my final edition of this, but I want
to include a small game in it or "sortof a joke"...if and when I have a
real game, and know how to add it probely I will. The problem: every thing
loads and runs ok ,except when the user selects "J" for the game (it is not
really much of a game), the "game" runs ok, up to a point, I get a error:
LINE 171: illegal instruction, continue (yes), or (no)if I select continue it dose,
but step by step and of course no,exits..I cannot figure out why the illegal
function, the code that is in GAME: ran fine by itself,but when I added it
the problem started,....
Also or if anyone has a game they would like to give me, that I could put
in, that would be great!...I wanted to put in the LeapFrog, by Bob in the
samples folder,that came with QB64....but could not figure out how,and also
was concerned about permission....this program is for me,personal and anyone
who can use it....it will always be available free,at least on my website,
or from me,I cannot be responsible for what someone else might do, if anyone
should copy it and try to sell it, it is without my permision,but I kinda
doupt I need to worry about that, it is not that great,...
ok Thanks for any help,...and I am finding some great friends on this site!
Also note: In the introduction, I will be adding that I got the "Calculator",
of the samples,in QB64/samples/pete/calc...,and another friend ,anonymos(IOPNN), gave me the code for the multiplication tables,
and any other credit where its due,before I make the stand alone exe,
and put it on my site, or any other
From Garry
Code Below the error is al the way at the botton :LINE 171
'----------------------------------------------------------------------
SCREEN 0
WIDTH 80
PRINT "Program BY:Garry Ricketson."
PRINT "E-mail:GarryRicketson@yahoo.com, http://www.garryspages.webs.com"
PRINT "Note: this is not a game nor intended to be real fun,if you don't"
PRINT "get the right answer, you cannot move on,Alfonso dose not like to,"
PRINT "study his X tabels,but he loves to play the computer games(san"
PRINT "Andreas auto theft) is his favorite. So, the idea is the faster"
PRINT "he learns the tabels, the sooner he can play his game, when he"
PRINT " completes the whole program, I then let him play with the computer"
PRINT "I hope anyone else can also use it."
SLEEP 5
SCREEN 0
WIDTH 40
COLOR 10, 1
PRINT "?VAMOS a HACER TABLAS"; ""
PLAY "aaaa4bbb8<ggg4a2e8gggg>a4f8e2ccca4a4a4"
PRINT "tecla q para salir, intro para continuar"
PRINT "press q to exit tecla q para salir"
PRINT "Cualquire tecla para continuar"
INPUT "q", Q$
IF Q$ = "q" THEN END
SLEEP 5
PRINT "!Bienvenido!,WELCOME!... "
PRINT "Nada para decir ahora "
PRINT "ES una ejercisio de tablas, lo gue hizo para Alfonso,These are "
PRINT "multiplication tabels I made for Alfonso"
INPUT "ENTER YOUR NAME,escribe tu nombre:", name$
PRINT "?HOLA!,"; name$; ".?como estas,hoy?"
CLS
COLOR 17, 10, 2
PRINT "??????????????????????????????????"
PRINT "------------------------------------"
PRINT "???????????????????????????????????"
PRINT "? ?"
PRINT "? ? ? ?"
PRINT "? ? ?? ?"
PRINT "? ? ? OLA! ?"
PRINT "? Alfonso....... ?"
PRINT "? ?"
PRINT "? ?"
PRINT "???????????????????????????????????"
SLEEP 5
CLS
COLOR 10, 1, 2
PRINT "?HOLA!,Alfonso, vamos a hacer tablas"
PRINT "Ahora vamos acer Multiplicaciones(tablas)"
COLOR 14: PRINT "Buenos Dias"
FOR d = 600 TO 640
SOUND d, 1
NEXT
SLEEP 2
CLS
COLOR 14: PRINT "Buenos Dias"
FOR d = 600 TO 640
SOUND d, 1
NEXT
SLEEP 2
CLS
TOP:
COLOR 2: PRINT "puede ser este cosas "
PRINT "(T)tablas"
PRINT "(C)alculator"
PRINT "(J)juego"
PRINT "(S)alir de programa"
ReHit: F$ = INPUT$(1) 'INPUT$ will wait for a keypress.
1 IF LCASE$(F$) = "t" THEN GOTO TABLAS
IF LCASE$(F$) = "c" THEN GOTO Calculater
IF LCASE$(F$) = "j" THEN GOTO GAME
IF LCASE$(F$) = "s" THEN END
GOTO ReHit
TABLAS: PRINT "Esos son los tablas"
RANDOMIZE TIMER
CLS
FOR i = 0 TO 100
x = INT(RND * 10) + 1 'if you want say only 9s or only 7s, change
'this to x=9 or x=7 ...
y = INT(RND * 10) + 1
PRINT x; "X"; y; "=";
INPUT "", n
IF x * y <> n THEN
PRINT "NOT CORRECT"
INPUT "Entra el primero numero: ", a
INPUT "Entra el segundo numero: ", b
PRINT "Respuesta corecto es: "; a * b 'now I am closer, on the
'previous that I sent 'you I had forgotten the b on this line.
ELSE
PRINT "CORRECT"
END IF
NEXT
GOTO TOP:
Calculater:
PRINT "Eso es Calculador"
5 CLS
PRINT "1) ADD"
PRINT "2) MULTIPLY"
PRINT "3) DIVIDE"
PRINT "4) SQUARE ROOT"
PRINT "5) EXIT"
INPUT i
IF i = 1 GOTO 10
IF i = 2 GOTO 20
IF i = 3 GOTO 30
IF i = 4 GOTO 40
IF i = 5 GOTO TOP:
10 CLS: PRINT "INPUT NUMBER"
INPUT a
CLS
PRINT "INPUT NEXT NUMBER"
INPUT b
CLS
PRINT a + b
PRINT "PRESS SPACE TO RUN"
SLEEP 0
GOTO 5
20 CLS: PRINT "INPUT NUMBER"
INPUT C
CLS
PRINT "INPUT NEXT NUMBER"
INPUT d
CLS
PRINT C * d
PRINT "PRESS SPACE TO RUN"
SLEEP 0
GOTO 5
30 CLS: PRINT "INPUT NUMBER"
INPUT E
CLS
PRINT "INPUT NEXT NUMBER"
INPUT F
CLS
PRINT E / F
PRINT "PRESS SPACE TO RUN"
SLEEP 0
GOTO 5
40 CLS: PRINT "INPUT NUMBER"
INPUT G
CLS
PRINT SQR(G)
PRINT "PRESS SPACE TO RUN"
SLEEP 0
GOTO 5
GOTO TOP:
'----------------------------------insert calculator
GAME:
SCREEN 0
WIDTH 80
DEFINT A-Z 'By its self this worked ok, but when I added it...no
DECLARE SUB Align (Tclr, Trow, txt$)
Align 14, 5, "MIRA ,LO QUE HIZO"
Align 14, 8, " AQUI ES TU JUEGO"
Align 15, 10, "TECLA INTRO PARA SALIR " + Prt$ + "NO, PARA JUEGAR" + Qt$
DO: LOOP UNTIL INKEY$ <> ""
CLS
TOPB:
FOR i% = 2 TO 28
Align 13, i%, "El Cielo es Caiendo!"
Align 13, i% - 1, SPACE$(19)
SOUND 2000 / i%, 1
NEXT i%
Align 14, 5, "Alfonso, siempre quiere jugar"
Align 18, 15, "Dice Blinky blinky blinky, estoy abburido"
Align 15, 10, "Tecla el Q para salir"
IF INKEY$ = "Q" THEN END
GOTO TOPB:
SUB Align (Tclr, r0w, txt$)
c0l = 41 - (LEN(txt$) \ 2)
COLOR Tclr: LOCATE r0w, c0l: PRINT txt$; 'This is line 171 or where it says
'illegal instruction
END SUB
'________________________End of program___________
And thanks,
From Garry
p.s. I hope this is not too long