Page 38 of 44

Re: gtBASIC

Posted: 18 Mar 2023, 10:04
by wbushby
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

Posted: 18 Mar 2023, 10:25
by wbushby
@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" ?

Re: gtBASIC

Posted: 18 Mar 2023, 10:53
by bmwtcu
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.

Re: gtBASIC

Posted: 18 Mar 2023, 11:17
by wbushby
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.

Re: gtBASIC

Posted: 18 Mar 2023, 12:37
by at67
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

Re: gtBASIC

Posted: 18 Mar 2023, 12:50
by wbushby
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.

Re: gtBASIC

Posted: 18 Mar 2023, 22:26
by bmwtcu
Works much better!

Re: gtBASIC

Posted: 19 Mar 2023, 21:54
by axelb
Your new version is now working great with my controller. Thank you!

Re: gtBASIC vX0

Posted: 21 Mar 2023, 17:00
by wbushby
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

Re: gtBASIC

Posted: 21 Mar 2023, 21:18
by wbushby
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