gtBASIC

Using, learning, programming and modding the Gigatron and anything related.
Forum rules
Be nice. No drama.
wbushby
Posts: 208
Joined: 16 Jul 2021, 10:59

Re: gtBASIC

Post by wbushby »

OK will do
wbushby
Posts: 208
Joined: 16 Jul 2021, 10:59

Re: gtBASIC

Post by wbushby »

Is there a command in basic that will horizontally scroll a section of the screen ?
at67
Site Admin
Posts: 647
Joined: 14 May 2018, 08:29

Re: gtBASIC

Post 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"
wbushby
Posts: 208
Joined: 16 Jul 2021, 10:59

Re: gtBASIC

Post 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.
wbushby
Posts: 208
Joined: 16 Jul 2021, 10:59

Re: gtBASIC

Post 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 ?
at67
Site Admin
Posts: 647
Joined: 14 May 2018, 08:29

Re: gtBASIC

Post by at67 »

Unfortunately not yet, screen to screen, screen to memory and tile based compressed blits are on my TODO list :/
wbushby
Posts: 208
Joined: 16 Jul 2021, 10:59

Re: gtBASIC

Post 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
at67
Site Admin
Posts: 647
Joined: 14 May 2018, 08:29

Re: gtBASIC

Post 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.
wbushby
Posts: 208
Joined: 16 Jul 2021, 10:59

Re: gtBASIC

Post 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
at67
Site Admin
Posts: 647
Joined: 14 May 2018, 08:29

Re: gtBASIC

Post by at67 »

Once again, on the TODO list, it will be fast and configurable, but is probably a while off.
Post Reply