Jump to content
Random Terrain

How can we display a RAM sprite?

Recommended Posts

I'd like to display a sprite in RAM using the standard kernel and let the user draw a pixel or erase a pixel when the fire button is pressed. The current pixel would slowly flash on and off, but the official off/on state of the pixel would be remembered when the user moves the joystick to select another pixel.

 

Holding down the fire button and moving left or right would change the NUSIZ width (normal/double/quad) like you can do here.

 

Could the score be adapted to show the 8 bits of the current row that the flashing pixel is on? If the score can't be used, can something else be used?

 

 

Update

 

Finished version is here:

 

atariage.com/forums/topic/289171-draw-sprites-on-your-atari-2600/

Share this post


Link to post
Share on other sites
Posted (edited)

Not sure if it's possible in bb alone might wanna try asm. Have thought about it myself

Edited by Trip2018

Share this post


Link to post
Share on other sites

I'd like to display a sprite in RAM using the standard kernel and let the user draw a pixel or erase a pixel when the fire button is pressed. The current pixel would slowly flash on and off, but the official off/on state of the pixel would be remembered when the user moves the joystick to select another pixel.

 

Holding down the fire button and moving left or right would change the NUSIZ width (normal/double/quad) like you can do here.

 

Could the score be adapted to show the 8 bits of the current row that the flashing pixel is on? If the score can't be used, can something else be used?

 

This is a cool concept RT and an awesome question because it is imo a limitation where you would need a kernel designed to read RAM sprites and not RAM pointers to ROM.

 

Flashback BASIC and SuperCharger BASIC allow what you described and the kernels are portable if anyone would like to implement them for bB.

 

You can manipulate each row of the sprites as RAM array variables or print binary strings on them using the print command:

 

print %11111111(player0,0):rem print binary on top row of player 1 sprite.

player0(0)=%11111111:player0(1)=255: rem or control the rows of the sprite via array assignment

 

The background playfield camera view is 20x10 and could be used to mirror what is going on in the sprite.

 

You can control the sprite rows RAM based colors the same way

 

player0colors(0)=$ff:player0colors(1)=100: color the first two rows of sprite 0

rowcolors(0)=$ff:rem color the top row of the playfield CAM

 

If you like these features and want to try these BASIC's you could enter the 10 line programming contest with a small BASIC game, maybe one that utilizes that kind of sprite manipulation:

 

http://atariage.com/forums/topic/288999-ideas-for-10-line-basic-games-for-the-atari-2600/

Share this post


Link to post
Share on other sites

If you like these features and want to try these BASIC's you could enter the 10 line programming contest with a small BASIC game, maybe one that utilizes that kind of sprite manipulation:

Thanks, but it doesn't work on my Windows 8 computer without a bunch of hassles. I tried a few years ago and gave up. I need something that I can simply download and run after a few easy setup options.

Share this post


Link to post
Share on other sites

This is easiest using SC RAM. Here's a program that displays a RAM sprite in the standard kernel, and updates the score from a value.

 

SC_RAM_player_and_value_to_score.bas

 

I used an assembly subroutine for the latter, because it was more cycle efficient and compact than the equivalent bB code would be.

 

I didn't do any of that cursor stuff, or NUSIZ changes. With the sample code as a start, you can probably figure that out. I think I'd punt on the cursor and use a missile instead, but it's your cake to bake.

  • Like 1

Share this post


Link to post
Share on other sites

Thanks. I think I should have explained better. Say I draw an image in the RAM sprite that looks like this:

 

post-13-0-54204200-1552159296.png

 

If I move my flashing "cursor" or missile or ball to the top row, the score (or something else) would display this:

 

00111100

 

If I move down one row, this would be displayed:

 

01111110

 

Down again:

 

11011011

 

And so on.

 

 

If I move to the top row and draw a pixel in the top left, the number would change from 00111100 to 10111100.

Share this post


Link to post
Share on other sites

Thanks, but it doesn't work on my Windows 8 computer without a bunch of hassles. I tried a few years ago and gave up. I need something that I can simply download and run after a few easy setup options.

 

The BASIC should work fine on any Windows Machine with nothing to install as long as the PowerShell ISE is present, that's what it uses as the IDE.

 

The quickstart guide should help you setup, there's only a single step to enable the compiler.

Share this post


Link to post
Share on other sites

Ah, in my case I'm outputting the Sprite line contents in decimal.

 

The score is only 6 digits, so binary representation is more complicated. For starters you'd need custom score graphics.

 

Any reason why you couldn't use playfield instead? The on off pattern would correspond to 1s and 0s.

Share this post


Link to post
Share on other sites

 

The BASIC should work fine on any Windows Machine with nothing to install as long as the PowerShell ISE is present, that's what it uses as the IDE.

 

The quickstart guide should help you setup, there's only a single step to enable the compiler.

 

Nope:

 

atariage.com/forums/topic/251729-try-a-fun-programming-language-tiny-basic/?p=3496817

Share this post


Link to post
Share on other sites

Ah, in my case I'm outputting the Sprite line contents in decimal.

 

The score is only 6 digits, so binary representation is more complicated. For starters you'd need custom score graphics.

 

Any reason why you couldn't use playfield instead? The on off pattern would correspond to 1s and 0s.

I could also use pfscore bars, but it would be hard to tell many zeros in a row or many ones in a row.

 

There soon might be, but at this time, there is no sprite editor that lets you draw a sprite in the three different widths that also shows you exactly what it will look like on the Atari.

 

I'd like to draw directly on the Atari 2600 screen in any of the 3 widths and get the 8 ones and zeroes to type into my batari Basic program.

 

 

Looks like the screen is wide enough to make eight readable zeroes and ones with the playfield:

 

post-13-0-92610000-1552161316.png

 

So I could basically "print" the 8 numbers on the screen whenever I move to a new row or change a pixel.

Share this post


Link to post
Share on other sites

The most important thing is happening so far. I'm drawing inside of the sprite. It's pretty fun. I think people will like playing around with this when I get done adapting your program.

  • Like 1

Share this post


Link to post
Share on other sites

Here's a goofy question. I'm working on that single sprite program, but it might also be good to make a version that has two sprites next to each other. If the sprites aren't as tall, is it possible to have two sprites in RAM? I'm not sure how to change the pointers.

Share this post


Link to post
Share on other sites

This would give player0 the first half of the SC ram, and player1 the second half...

 

 rem ** get lo and hi address of the last read address of the SC RAM...
 const rpoint0lo = <r000
 const rpoint0hi = >r000
 const rpoint1lo = <r064
 const rpoint1hi = >r064

 rem ** set player0 pointer to the last read address of the SC RAM...
 player0pointerlo=rpoint0lo
 player0pointerhi=rpoint0hi
 player1pointerlo=rpoint1lo
 player1pointerhi=rpoint1hi

You'd need to modify the Y position of the sprites higher up the screen, and set the player#height's to 64.

  • Like 1

Share this post


Link to post
Share on other sites
Posted (edited)

here's one

 

I flickered the pixel

if you hold the fire button for couple seconds you cycle NUSIZE when the fire button is released

(unless you hold it too long then the timer will roll over :P )

other wise you flip the pixel

sprite_in_RAM.bas

sprite_in_RAM.bas.bin

Edited by bogax
  • Like 3

Share this post


Link to post
Share on other sites

 

Took a look at that thread and you're really close - you actually compiled the program to a binary that would run on the 2600.

 

The red error message was because you hadn't copied Stella.exe to c:\vwbasic\Stella\Stella.exe

 

Thanks for pointing that out, I should modify the quickstart guide to make it clear you need to copy Stella or write a routine to find and map a path to Stella the 1st time around.

Share this post


Link to post
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.

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...