gobo Posted February 13, 2018 Share Posted February 13, 2018 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 Quote Link to comment Share on other sites More sharing options...
pirx Posted February 14, 2018 Share Posted February 14, 2018 (edited) 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 February 14, 2018 by pirx Quote Link to comment Share on other sites More sharing options...
_The Doctor__ Posted February 14, 2018 Share Posted February 14, 2018 your topic tag says baic instead of basic or turbo basic, to get help, some code snippets would be needed. Can't fix what you can't see or have described to you. Quote Link to comment Share on other sites More sharing options...
gobo Posted February 16, 2018 Author Share Posted February 16, 2018 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! Quote Link to comment Share on other sites More sharing options...
pirx Posted February 16, 2018 Share Posted February 16, 2018 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 Quote Link to comment Share on other sites More sharing options...
gobo Posted February 18, 2018 Author Share Posted February 18, 2018 pirx, Thank you!!!! It works great! I've been looking for this for a long time. Looks so simple. I'm kind of embarrassed to have asked. I guess it's time I learned assembly language! I'll post the game once I update it. Quote Link to comment Share on other sites More sharing options...
gobo Posted February 18, 2018 Author Share Posted February 18, 2018 PS Does this also work in regular Atari BASIC? Thanks Again Quote Link to comment Share on other sites More sharing options...
+CharlieChaplin Posted February 19, 2018 Share Posted February 19, 2018 (edited) 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 February 19, 2018 by CharlieChaplin Quote Link to comment Share on other sites More sharing options...
pirx Posted February 19, 2018 Share Posted February 19, 2018 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. Quote Link to comment Share on other sites More sharing options...
pirx Posted February 19, 2018 Share Posted February 19, 2018 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. Quote Link to comment Share on other sites More sharing options...
gobo Posted February 19, 2018 Author Share Posted February 19, 2018 (edited) It works perfectly in Atari BASIC! Here is the Atari BASIC code to load and run it.) Thanks so much again! MLPADDLE.BAS Edited February 19, 2018 by gobo Quote Link to comment Share on other sites More sharing options...
pirx Posted February 20, 2018 Share Posted February 20, 2018 nice, happy to have helped! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.