Jump to content
IGNORED

Paddles VBI Basic


gobo

Recommended Posts

Hi

 

I'm trying to rework an old game I made way back in the day written in plain Atari Basic. It's kind of a sideways Pong game. To start I'm going to re-time it for the much faster TurboBASIC so it runs a bit more smoothly. It uses the paddles to move PM 1 and 2 horizontally across the top and bottom of the screen, but it's very jerky just reading the paddles directly in Basic. I know nothing of assembly language so I was wondering if someone knows of any ML routine that would move the players back and forth during the VBI. I've seen few that work with the joysticks but not with paddles.

 

Thanks :)

Link to comment
Share on other sites

hi! you need to define what do you mean by jerky - the issue might be in the loop, not the sprite moving or paddle reads. Basically changing the horizontal position of a sprite is just one poke, so it should be quite smooth. In TurboBasic XL you can use PAUSE 0 to synchronise to the screen - it smooths out lots of jerkyness.

 

If the issue is that you can not read paddles/write to HPOSPx often enought, the short VBI routine will help. Write you basic calcs for conversion between pots and hpospx and i can try to rewrite it i assy for you.

Edited by pirx
Link to comment
Share on other sites

hi! you need to define what do you mean by jerky - the issue might be in the loop, not the sprite moving or paddle reads. Basically changing the horizontal position of a sprite is just one poke, so it should be quite smooth. In TurboBasic XL you can use PAUSE 0 to synchronise to the screen - it smooths out lots of jerkyness.

 

If the issue is that you can not read paddles/write to HPOSPx often enought, the short VBI routine will help. Write you basic calcs for conversion between pots and hpospx and i can try to rewrite it i assy for you.

Thanks!! It's definitely that it can't read the paddles often enough. It's especially jarring when the paddles don't move at all when it branches off the main loop to draw something special on the screen. I actually found a ML routine that moves the players horizontally during the VBI even when the BASIC program isn't running using the joysticks but it's just not the same as playing with the paddles. The code I use to read the paddles and move the players is simply:

 

POKE K53248,228-PADDLE(K0):POKE K53249,228-PADDLE(K1)

 

With the player moving on the screen from x position 52 to 195. It would also be ok if it goes the whole length from 0 to 255 off screen if that's easier. I'm no big programmer even today but man looking at my teenage years code is embarrassing. It's such a mess. I remember trying to squeeze out every last free byte of memory I could use back then so no comments at all! It's nice to be able to look at it all in a windows editor now though! It makes a "huge" old program looks so much smaller. Still, it's fun! I'm currently copying all my old floppies to ATR as well!

Link to comment
Share on other sites

Below mads sources for quickly bashed up routine for you.

You should be able to load it with

bload "D:PADDL.OBJ"

and start with

x=usr($600)

 

It is not tested, but should give you the general idea. As you have VBLANK already, you could think about moving other stuff to it to make the game less dependent on loop speed.

    icl 'atari.hea'
    icl 'macro.hea'

	org $0600
	pla
	vmain VBLANK,7
	rts
;--------------------------------------------------
VBLANK .local ;vertical blank interrupt
;--------------------------------------------------
	sec
	lda #228
	sbc PADDL0
	sta HPOSP0
		
	sec
	lda #228
	sbc PADDL1
	sta HPOSP1
 	jmp XITVBV
.endl

paddles_vbi.zip

Link to comment
Share on other sites

 

Below mads sources for quickly bashed up routine for you.

You should be able to load it with

bload "D:PADDL.OBJ"

and start with

x=usr($600)

 

It is not tested, but should give you the general idea. As you have VBLANK already, you could think about moving other stuff to it to make the game less dependent on loop speed.

 

Hmmm, maybe this routine can somehow be used for "Asteraxis 2k" ?!? The game should be playable with paddles, but it does not work at all, no matter if paddles are connected to port 1 or 2. Fandal already confirmed that the authors most likely have never seen nor used paddle controllers. If the routine does not work there, maybe someone can fix this game so it works with paddles ?!?

 

http://a8.fandal.cz/detail.php?files_id=1251

Edited by CharlieChaplin
Link to comment
Share on other sites

PS Does this also work in regular Atari BASIC?

 

Hey,

It should, but you need to load the machine code to $600 (1536), because no BLOAD in basic.

 

You can do it this way in TBXL:

 

10 bload "D:PADDL.OBJ"

 

20 print "100 DATA ";

30 for i = $600 to $6ff

40 print peek(i);",";

50 next i

 

or something like this.

$6ff in line 30 is too large, just cut it where zeroes start to appear.

Link to comment
Share on other sites

 

Hmmm, maybe this routine can somehow be used for "Asteraxis 2k" ?!? The game should be playable with paddles, but it does not work at all, no matter if paddles are connected to port 1 or 2. Fandal already confirmed that the authors most likely have never seen nor used paddle controllers. If the routine does not work there, maybe someone can fix this game so it works with paddles ?!?

 

http://a8.fandal.cz/detail.php?files_id=1251

 

My little routine will most likely do not work, it is specific for OP's game. The game would require hack and fix.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...