Jump to content

Photo

How can we display a RAM sprite?


17 replies to this topic

#1 Random Terrain OFFLINE  

Random Terrain

    Visual batari Basic User

  • 28,956 posts
  • Controlled Randomness
    Replay Value
    Nonlinear
  • Location:North Carolina (USA)

Posted Fri Mar 8, 2019 9:23 AM

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/



#2 Trip2018 OFFLINE  

Trip2018

    Star Raider

  • 92 posts
  • Fuzzy boi
  • Location:nebraska

Posted Sat Mar 9, 2019 1:38 AM

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


Edited by Trip2018, Sat Mar 9, 2019 12:06 PM.


#3 Mr SQL OFFLINE  

Mr SQL

    River Patroller

  • 2,094 posts

Posted Sat Mar 9, 2019 10:38 AM

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/...the-atari-2600/



#4 Random Terrain OFFLINE  

Random Terrain

    Visual batari Basic User

  • Topic Starter
  • 28,956 posts
  • Controlled Randomness
    Replay Value
    Nonlinear
  • Location:North Carolina (USA)

Posted Sat Mar 9, 2019 11:00 AM

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.



#5 RevEng OFFLINE  

RevEng

    Bit Player

  • 5,173 posts
  • Location:bottom of the stack

Posted Sat Mar 9, 2019 12:51 PM

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.

Attached File  SC_RAM_player_and_value_to_score.bas   1.62KB   7 downloads

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.

#6 Random Terrain OFFLINE  

Random Terrain

    Visual batari Basic User

  • Topic Starter
  • 28,956 posts
  • Controlled Randomness
    Replay Value
    Nonlinear
  • Location:North Carolina (USA)

Posted Sat Mar 9, 2019 1:27 PM

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

 

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



#7 Mr SQL OFFLINE  

Mr SQL

    River Patroller

  • 2,094 posts

Posted Sat Mar 9, 2019 1:32 PM

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.



#8 RevEng OFFLINE  

RevEng

    Bit Player

  • 5,173 posts
  • Location:bottom of the stack

Posted Sat Mar 9, 2019 1:35 PM

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.

#9 Random Terrain OFFLINE  

Random Terrain

    Visual batari Basic User

  • Topic Starter
  • 28,956 posts
  • Controlled Randomness
    Replay Value
    Nonlinear
  • Location:North Carolina (USA)

Posted Sat Mar 9, 2019 1:38 PM

 

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



#10 Random Terrain OFFLINE  

Random Terrain

    Visual batari Basic User

  • Topic Starter
  • 28,956 posts
  • Controlled Randomness
    Replay Value
    Nonlinear
  • Location:North Carolina (USA)

Posted Sat Mar 9, 2019 1:49 PM

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:

 

pfnumbers.png

 

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



#11 Random Terrain OFFLINE  

Random Terrain

    Visual batari Basic User

  • Topic Starter
  • 28,956 posts
  • Controlled Randomness
    Replay Value
    Nonlinear
  • Location:North Carolina (USA)

Posted Sat Mar 9, 2019 3:04 PM

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.



#12 Random Terrain OFFLINE  

Random Terrain

    Visual batari Basic User

  • Topic Starter
  • 28,956 posts
  • Controlled Randomness
    Replay Value
    Nonlinear
  • Location:North Carolina (USA)

Posted Sat Mar 9, 2019 4:47 PM

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.



#13 RevEng OFFLINE  

RevEng

    Bit Player

  • 5,173 posts
  • Location:bottom of the stack

Posted Sat Mar 9, 2019 5:00 PM

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.

#14 bogax OFFLINE  

bogax

    Dragonstomper

  • 791 posts

Posted Sat Mar 9, 2019 5:10 PM

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

Attached Files


Edited by bogax, Sat Mar 9, 2019 5:12 PM.


#15 Mr SQL OFFLINE  

Mr SQL

    River Patroller

  • 2,094 posts

Posted Sun Mar 10, 2019 11:48 AM

 

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.



#16 Random Terrain OFFLINE  

Random Terrain

    Visual batari Basic User

  • Topic Starter
  • 28,956 posts
  • Controlled Randomness
    Replay Value
    Nonlinear
  • Location:North Carolina (USA)

Posted Sun Mar 10, 2019 1:36 PM

Finished version is here:

 

http://atariage.com/...our-atari-2600/



#17 Random Terrain OFFLINE  

Random Terrain

    Visual batari Basic User

  • Topic Starter
  • 28,956 posts
  • Controlled Randomness
    Replay Value
    Nonlinear
  • Location:North Carolina (USA)

Posted Sun Mar 10, 2019 7:32 PM

Finished version is here:

 

http://atariage.com/...our-atari-2600/



#18 Random Terrain OFFLINE  

Random Terrain

    Visual batari Basic User

  • Topic Starter
  • 28,956 posts
  • Controlled Randomness
    Replay Value
    Nonlinear
  • Location:North Carolina (USA)

Posted Mon Mar 11, 2019 9:56 AM

Finished version is here:

 

http://atariage.com/...our-atari-2600/






0 user(s) are browsing this forum

0 members, 0 guests, 0 anonymous users