Eightyone emulator not recognizing cursor keys as joystick
Eightyone emulator not recognizing cursor keys as joystick
This is my code:
10 LET X=0: LET Y=0
15 LET J=0: LET K=10
20 LET K$=INKEY$
25 PRINT AT J,K; "*"
30 IF K$="" THEN GOTO 30
40 IF K$="8" (CURSOR RIGHT) THEN LET X=X+1 (for some reason X and Y are flipped)
41 if K$="5" (CURSOR LEFT) THEN LET X=X+1
72 GOTO 20
it just sits there and I can't move it at all. Is this a bug in the emulator or a problem with my code?
10 LET X=0: LET Y=0
15 LET J=0: LET K=10
20 LET K$=INKEY$
25 PRINT AT J,K; "*"
30 IF K$="" THEN GOTO 30
40 IF K$="8" (CURSOR RIGHT) THEN LET X=X+1 (for some reason X and Y are flipped)
41 if K$="5" (CURSOR LEFT) THEN LET X=X+1
72 GOTO 20
it just sits there and I can't move it at all. Is this a bug in the emulator or a problem with my code?
In Heck, there are two options for perpetual torment:
Eat the Puckerberry and suffer for eternity:
drink nothing but a cocktail of The Last Dab and Mexican Cake blended and served with
habanero slices
![Twisted Evil :twisted:](./images/smilies/icon_twisted.gif)
Eat the Puckerberry and suffer for eternity:
drink nothing but a cocktail of The Last Dab and Mexican Cake blended and served with
habanero slices
![Twisted Evil :twisted:](./images/smilies/icon_twisted.gif)
Re: Eightyone emulator not recognizing cursor keys as joystick
At the moment I think it will not read the joystick again if it is not initially pressed?
Do you need to change line 30 to:
30 IF K$="" THEN GOTO 20
Also I presume one of line 40 or 41 should be X=X-1
Currently both are X=X+1
Do you need to change line 30 to:
30 IF K$="" THEN GOTO 20
Also I presume one of line 40 or 41 should be X=X-1
Currently both are X=X+1
Re: Eightyone emulator not recognizing cursor keys as joystick
It does not work with arrow keys. Tried twice. maybe someone can fix that in an update?
also, the spectrum maps the X coordinate and the Y coordinate as X=down, Y=across instead of Y down, X across which plays merry hell with any programs using these coordinates.
In other words, moving UP causes me to move down and left becomes right.
It's...irritating
also, the spectrum maps the X coordinate and the Y coordinate as X=down, Y=across instead of Y down, X across which plays merry hell with any programs using these coordinates.
In other words, moving UP causes me to move down and left becomes right.
It's...irritating
In Heck, there are two options for perpetual torment:
Eat the Puckerberry and suffer for eternity:
drink nothing but a cocktail of The Last Dab and Mexican Cake blended and served with
habanero slices
![Twisted Evil :twisted:](./images/smilies/icon_twisted.gif)
Eat the Puckerberry and suffer for eternity:
drink nothing but a cocktail of The Last Dab and Mexican Cake blended and served with
habanero slices
![Twisted Evil :twisted:](./images/smilies/icon_twisted.gif)
Re: Eightyone emulator not recognizing cursor keys as joystick
Here is some Basic code that uses the cursors keys to move a character around the screen. The code has been tested and works on both the ZX81 (sz81, picozx81 & EightyOne) and Spectrum (EightyOne and FUSE). There are checks to ensure that the character stays within the screen bounds. I used zmakebas to convert the code into a .p (ZX81) and .tap (Spectrum) file for testing.
Code: Select all
10 LET X=15
20 LET Y=10
30 PRINT AT Y,X;"O"
40 LET A$ = INKEY$
50 IF A$="" THEN GOTO 40
60 PRINT AT Y,X;" "
70 IF (A$="5") * (X>0) THEN LET X=X-1
80 IF (A$="6") * (Y<20) THEN LET Y=Y+1
90 IF (A$="7") * (Y>0) THEN LET Y=Y-1
100 IF (A$="8") * (X<30) THEN LET X=X+1
110 GOTO 30
- 1024MAK
- Posts: 5120
- Joined: Mon Sep 26, 2011 10:56 am
- Location: Looking forward to summer in Somerset, UK...
Re: Eightyone emulator not recognizing cursor keys as joystick
@Crayon21, in your original program, you are not actually using X to set the print position. You are using J and K. That's why the program appears to ignore the cursor keys.
Mark
Mark
ZX81 Variations
ZX81 Chip Pin-outs
ZX81 Video Transistor Buffer Amp
Standby alert ![Exclamation :!:](./images/smilies/icon_exclaim.gif)
There are four lights!
Step up to red alert. Sir, are you absolutely sure? It does mean changing the bulb
Looking forward to summer later in the year.
ZX81 Chip Pin-outs
ZX81 Video Transistor Buffer Amp
![Exclamation :!:](./images/smilies/icon_exclaim.gif)
![Exclamation :!:](./images/smilies/icon_exclaim.gif)
There are four lights!
Step up to red alert. Sir, are you absolutely sure? It does mean changing the bulb
![Exclamation :!:](./images/smilies/icon_exclaim.gif)
Looking forward to summer later in the year.
Re: Eightyone emulator not recognizing cursor keys as joystick
I'll give this a go, thanks
I can get left but it goes right when I hit the edge of the screen.
is there a corrected rom?
In Heck, there are two options for perpetual torment:
Eat the Puckerberry and suffer for eternity:
drink nothing but a cocktail of The Last Dab and Mexican Cake blended and served with
habanero slices
![Twisted Evil :twisted:](./images/smilies/icon_twisted.gif)
Eat the Puckerberry and suffer for eternity:
drink nothing but a cocktail of The Last Dab and Mexican Cake blended and served with
habanero slices
![Twisted Evil :twisted:](./images/smilies/icon_twisted.gif)
Re: Eightyone emulator not recognizing cursor keys as joystick
Exile wrote: ↑Mon Mar 04, 2024 12:36 pm Here is some Basic code that uses the cursors keys to move a character around the screen. The code has been tested and works on both the ZX81 (sz81, picozx81 & EightyOne) and Spectrum (EightyOne and FUSE). There are checks to ensure that the character stays within the screen bounds. I used zmakebas to convert the code into a .p (ZX81) and .tap (Spectrum) file for testing.
Code: Select all
10 LET X=15 20 LET Y=10 30 PRINT AT Y,X;"O" 40 LET A$ = INKEY$ 50 IF A$="" THEN GOTO 40 60 PRINT AT Y,X;" " 70 IF (A$="5") * (X>0) THEN LET X=X-1 80 IF (A$="6") * (Y<20) THEN LET Y=Y+1 90 IF (A$="7") * (Y>0) THEN LET Y=Y-1 100 IF (A$="8") * (X<30) THEN LET X=X+1 110 GOTO 30
what are those secondary bracket checks for (x<30) and so on?
thank you for the help BTW
How do I check for collision? I've tried printing at the area and no luck. Screen$ and Attr likewise return no results
Last edited by Crayon21 on Tue Mar 05, 2024 8:18 pm, edited 1 time in total.
In Heck, there are two options for perpetual torment:
Eat the Puckerberry and suffer for eternity:
drink nothing but a cocktail of The Last Dab and Mexican Cake blended and served with
habanero slices
![Twisted Evil :twisted:](./images/smilies/icon_twisted.gif)
Eat the Puckerberry and suffer for eternity:
drink nothing but a cocktail of The Last Dab and Mexican Cake blended and served with
habanero slices
![Twisted Evil :twisted:](./images/smilies/icon_twisted.gif)
- 1024MAK
- Posts: 5120
- Joined: Mon Sep 26, 2011 10:56 am
- Location: Looking forward to summer in Somerset, UK...
Re: Eightyone emulator not recognizing cursor keys as joystick
You also need to take into account what Exile wrote.
If there are no limits set to the value of the variable, then after zero (0) it will go negative. Hence the strange effect.
Mark
ZX81 Variations
ZX81 Chip Pin-outs
ZX81 Video Transistor Buffer Amp
Standby alert ![Exclamation :!:](./images/smilies/icon_exclaim.gif)
There are four lights!
Step up to red alert. Sir, are you absolutely sure? It does mean changing the bulb
Looking forward to summer later in the year.
ZX81 Chip Pin-outs
ZX81 Video Transistor Buffer Amp
![Exclamation :!:](./images/smilies/icon_exclaim.gif)
![Exclamation :!:](./images/smilies/icon_exclaim.gif)
There are four lights!
Step up to red alert. Sir, are you absolutely sure? It does mean changing the bulb
![Exclamation :!:](./images/smilies/icon_exclaim.gif)
Looking forward to summer later in the year.
Re: Eightyone emulator not recognizing cursor keys as joystick
These checks ensure that x does not not go negative, or become larger than 30, and that y does not become negative, or larger than 20. That keeps the "O" within the boundary of the screen.what are those secondary bracket checks for (x<30) and so on?
As an example,
70 IF (A$="5") * (X>0) THEN LET X=X-1 can be read as:
If left arrow pressed AND x is larger than 0 THEN x = x-1
Re: Eightyone emulator not recognizing cursor keys as joystick
what about collision with another object?
In Heck, there are two options for perpetual torment:
Eat the Puckerberry and suffer for eternity:
drink nothing but a cocktail of The Last Dab and Mexican Cake blended and served with
habanero slices
![Twisted Evil :twisted:](./images/smilies/icon_twisted.gif)
Eat the Puckerberry and suffer for eternity:
drink nothing but a cocktail of The Last Dab and Mexican Cake blended and served with
habanero slices
![Twisted Evil :twisted:](./images/smilies/icon_twisted.gif)