Page 31 of 44

Re: gtBASIC

Posted: 02 Feb 2023, 17:08
by wbushby
OK will do

Re: gtBASIC

Posted: 04 Feb 2023, 12:16
by wbushby
Is there a command in basic that will horizontally scroll a section of the screen ?

Re: gtBASIC

Posted: 04 Feb 2023, 14:04
by at67
There sure is, HSCROLL:

Code: Select all

HSCROLL <scroll -31 to 31>, <optional start>, <optional count>
Check out "gbas\demos\Stellar64k_ROMvX0.gbas" and "gbas\graphics\ParallaxSprites_ROMvX0.gbas"

Re: gtBASIC

Posted: 04 Feb 2023, 15:03
by wbushby
I will try that. My current code causes some issues with collision detection when in the black area on both side of the conveyor belt.
I am redrawing the tile group sliding 1 pixel at a time then covering the extra bits with the background.

Re: gtBASIC

Posted: 05 Feb 2023, 01:58
by wbushby
It seems hscroll scroll the entire horizontal line(s). Is it possible to scroll a 'window' such as start = 20,100 size = 30,50 ?

Re: gtBASIC

Posted: 05 Feb 2023, 06:08
by at67
Unfortunately not yet, screen to screen, screen to memory and tile based compressed blits are on my TODO list :/

Re: gtBASIC

Posted: 05 Feb 2023, 08:29
by wbushby
OK, I can work around the window scrolling bit. I have another issue.

I am using keyboard input to move my character and I use 'Q' (113) for left and 'P' (112)for right and I use 'Z' (122) to jump. If I am moving right GET("SERIAL_RAW") returns 112. While holding down the 'Q' key I tap the 'Z' key (while keeping the 'P' key pressed) and GET("SERIAL_RAW") returns 122 which properly causes my character to jump.

But now still holding down the 'P' GET("SERIAL_RAW") but NOT the 'Z' key returns 122 instead of 112 even though the 'Z' key is not pressed.

I must release all keys to clear the return of GET("SERIAL_RAW"). after which holding the 'P' key returns 112

Is there a way to flush the GET("SERIAL_RAW") register after I read it to make it return the proper key code ?

I tried POKE &h0F, 0 but still got same results

Re: gtBASIC

Posted: 05 Feb 2023, 11:45
by at67
Unfortunately this is a limitation of BabelFish and the Gigatron's serial input port. The serial input port was really only ever designed for a standard Nintendo controller and Marcel had to weave some magic in SW in the Gigatron's firmware and BabelFish to allow a Ps2 keyboard to work concurrently with the controller.

The keyboard input was never meant for anything other than simple N1 key rollover for basic typing and trivial games, if you want more advanced simultaneous button inputs, then you really need to use the controller and it's bit masked inputs.

Also, BabelFish sends the keys over for 3 frames, to simulate rapid human button presses, if you try and clear the input register it just gets over-written on the next VBlank up until frame 3.

P.S. The behaviour you're seeing will be just an artifact of PS2.ino and BabelFish.ino's implementation.

Re: gtBASIC

Posted: 05 Feb 2023, 13:26
by wbushby
Ok, thanks for the detailed information. I now understand. I will add a controller input option and accept the limitations of keyboard input. It is very playable from the keyboard as it is.

I have yet another question. Is there a collision test for sprites in basic ? I have written most the collision testing but the remaining items will entail some more extensive code so will slow down the main loop possibly

Re: gtBASIC

Posted: 05 Feb 2023, 13:46
by at67
Once again, on the TODO list, it will be fast and configurable, but is probably a while off.