On Fri, Apr 14, 2017 at 6:33 PM, George Rimakis <grima...@gmail.com> wrote:

>
> I'm still trying to figure out where the program is when the cursor
> disappears. If anyone knows how to troubleshoot that, let me know.
>
> ~George
>

I think I figured it out!

It looks like it's because of garbage collection of the string data
structures.

It's interesting... BASIC is completely "locked up" when it happens... you
can't even CTRL-C out of the program. Seems BASIC is just "busy" cleaning
up string memory during this time, not polling keyboard or letting BASIC
run.

Something to do with A$=INKEY$, and maybe the A$="Q".

Anyway, CLEAR some larger amount of string space. I did a CLEAR 640 at the
beginning of the program, and it locks up less often.

Otherwise... maybe someone knows a "PEEK" address or CALL that would let
you figure out what character is down as a numeric code instead of using
INKEY$. That would avoid dealing with strings in your keyboard polling loop.

Or maybe you could avoid the assignment in some way. Like search for your
key in INSTR(1,"ABCD",INKEY$), then do an ON GOTO or ON GOSUB to dispatch.


Try something like this... It does no string assigments or manipulation
inside of the loop. It might even be faster since the key code is "looked
up" inside the interpreter in machine code instead of your program by using
INSTR.

100 S$="Q"+CHR$(28)+CHR$(29)+CHR$(31)+CHR$(30)+CHR$(70)+CHR$(102)+CHR$(32)
110 ON INSTR(1,S$,INKEY$) GOSUB1000,1100,1200,1300,1400,1500,1600,1700
120 PRINT CHR$(13);:GOTO 110
1000 RETURN
1100 PRINT"B";:RETURN
1200 PRINT"C";:RETURN
1300 PRINT"D";:RETURN
1400 PRINT"E";:RETURN
1500 PRINT"F";:RETURN
1600 PRINT"G";:RETURN
1700 PRINT"H";:RETURN



-- John.

Reply via email to