gtBASIC
Forum rules
Be nice. No drama.
Be nice. No drama.
Re: gtBASIC
OK, thanks for that info. I can then develop and test the code. I was starting to get frustrated waiting for my new man cave to be finished. It is running about 4 months behind schedule.
Re: gtBASIC
@axelb
You have this line for getting controller buttons.
button.lo = get("SERIAL_RAW") XOR 255
I thought controller buttons were obtained using "BUTTON_STATE" ?
You have this line for getting controller buttons.
button.lo = get("SERIAL_RAW") XOR 255
I thought controller buttons were obtained using "BUTTON_STATE" ?
Re: gtBASIC
I think what he's suggesting is to first read all 8 bits of the raw famicom serial data one time into a variable that you can use with follow-up conditionals to parse, which would enable you to theoretically handle all 256 possible combinations of simultaneous key presses.
- Attachments
-
- input.JPG (14.66 KiB) Viewed 823 times
-
- SERIAL_RAW.JPG (11.68 KiB) Viewed 824 times
Re: gtBASIC
I understand now. I hadn't tied SERIALRAW and BUTTONSTATE together when I read that before.
I have found that BUTTONSTATE provides the information showing direction key and A key being simultaneously pressed so either can be used it seems.
I have found that BUTTONSTATE provides the information showing direction key and A key being simultaneously pressed so either can be used it seems.
Re: gtBASIC
There's a good explanation of the difference between the two registers here, by Marcel: https://forum.gigatron.io/viewtopic.php?t=138
1) serialRaw is the raw bits read from the shift register every 60Hz.
2) buttonState is an edge triggered representation of serialRaw that the native ROM creates for one shot events.
3) Axel's first line of code uses XOR 255 to invert the result read as both serialRaw and buttonState are active low logic
1) serialRaw is the raw bits read from the shift register every 60Hz.
2) buttonState is an edge triggered representation of serialRaw that the native ROM creates for one shot events.
3) Axel's first line of code uses XOR 255 to invert the result read as both serialRaw and buttonState are active low logic
Re: gtBASIC
Here is an upgrade to Manic Miner that allows you to walk and jump at the same time when using a controller. 'A' button for jump.
- Attachments
-
- manicminer64k41v1.3.gt1
- (58.54 KiB) Downloaded 81 times
Re: gtBASIC
Your new version is now working great with my controller. Thank you!
Re: gtBASIC vX0
I have discovered a problem with division on vX0 of gtBasic
I have been experimenting with minimal code:
This code produces:
sceneType = Scene / 1 PRODUCES 2050 X
sceneType = Scene / 2 PRODUCES 98 Correct
sceneType = Scene / 4 PRODUCES 1536 X
sceneType = Scene / 8 PRODUCES 1025 X
sceneType = Scene / 16 PRODUCES 12 Correct
The full code:
_runtimePath_ "../runtime"
_runtimeStart_ &h7FFF
_arraysStart_ &h7FFF
_codeRomType_ ROMvX0
' initial value for the random number generator:
CONST RAND_SEED = 196 ' defines the start scene of the game
' 11 000 100
' next scene to the right
' 10 110 001
' next scene to the left
' 00 000 001
Scene% = RAND_SEED ' Start Scene Code
sceneType% = 0 ' Type of the scene (0..7)
' Initialise system
START:
CLS
AT 0,0
SET FG_COLOUR, 63
PRINT "Scene = ";Scene
sceneType = Scene / 1
PRINT "SceneType1 = ";sceneType
sceneType = Scene / 2
PRINT "SceneType2 = ";sceneType
sceneType = Scene / 4
PRINT "SceneType4 = ";sceneType
sceneType = Scene / 8
PRINT "SceneType8 = ";sceneType
sceneType = Scene / 16
PRINT "SceneType16 = ";sceneType
MAINLOOP:
WAIT 10
GOTO MAINLOOP
END
I have been experimenting with minimal code:
This code produces:
sceneType = Scene / 1 PRODUCES 2050 X
sceneType = Scene / 2 PRODUCES 98 Correct
sceneType = Scene / 4 PRODUCES 1536 X
sceneType = Scene / 8 PRODUCES 1025 X
sceneType = Scene / 16 PRODUCES 12 Correct
The full code:
_runtimePath_ "../runtime"
_runtimeStart_ &h7FFF
_arraysStart_ &h7FFF
_codeRomType_ ROMvX0
' initial value for the random number generator:
CONST RAND_SEED = 196 ' defines the start scene of the game
' 11 000 100
' next scene to the right
' 10 110 001
' next scene to the left
' 00 000 001
Scene% = RAND_SEED ' Start Scene Code
sceneType% = 0 ' Type of the scene (0..7)
' Initialise system
START:
CLS
AT 0,0
SET FG_COLOUR, 63
PRINT "Scene = ";Scene
sceneType = Scene / 1
PRINT "SceneType1 = ";sceneType
sceneType = Scene / 2
PRINT "SceneType2 = ";sceneType
sceneType = Scene / 4
PRINT "SceneType4 = ";sceneType
sceneType = Scene / 8
PRINT "SceneType8 = ";sceneType
sceneType = Scene / 16
PRINT "SceneType16 = ";sceneType
MAINLOOP:
WAIT 10
GOTO MAINLOOP
END
Re: gtBASIC
Interesting result when I compiled to ROMv5A with the vX0 gtBasic and run with vX0 emulator
sceneType = Scene / 1 PRODUCES 196 correct
sceneType = Scene / 2 PRODUCES 2 X
sceneType = Scene / 4 PRODUCES 49 X
sceneType = Scene / 8 PRODUCES 24 Correct
sceneType = Scene / 16 PRODUCES 12 Correct
sceneType = Scene / 1 PRODUCES 196 correct
sceneType = Scene / 2 PRODUCES 2 X
sceneType = Scene / 4 PRODUCES 49 X
sceneType = Scene / 8 PRODUCES 24 Correct
sceneType = Scene / 16 PRODUCES 12 Correct