struggling with sprites on Stos

STOS-related stuff in here please

Moderators: simonsunnyboy, Mug UK, Zorro 2, Moderator Team

Post Reply
User avatar
nitrofurano
Atariator
Atariator
Posts: 24
Joined: Sat May 12, 2012 1:49 pm
Contact:

struggling with sprites on Stos

Post by nitrofurano »

hi again,
i'm trying to start some simple code on Stos, and i'm struggling on it - maybe it's really a simple thing

Code: Select all

1000 mode 0: key off: flash off: cls
1010 load "sprites1.pi1"
1100 for y=0 to 3:for x=0 to 3
1110 get sprite x,y,y*4+x,1
1120 next:next
2000 for c=0 to 15
2010 for x=0 to 319
2020 sprite x,100,c,1
2030 next:next
3000 waitkey
the picture i used is this: http://img84.imageshack.us/img84/2939/sprites1.png

and the file sprites1.pi1 i used were obtained by this command line:

Code: Select all

convert sprites1.png _.ppm && ppmtopi1 _.ppm > sprites1.pi1 && rm _.ppm
and the screenshot of the result is this:
http://img138.imageshack.us/img138/2710/stossprites.png

i got that "illegal function call in line 1110", and the flash off seems to have no effect

what is the reason causing this?
thanks! :)
User avatar
MrMaddog
Captain Atari
Captain Atari
Posts: 174
Joined: Fri Oct 06, 2006 3:03 am
Contact:

Re: struggling with sprites on Stos

Post by MrMaddog »

You probably should run the STOS sprite editor and load your PI1 picture into it, and then cut 16x16 blocks to use for sprites...
User avatar
StickHead
Atari Super Hero
Atari Super Hero
Posts: 686
Joined: Mon Jun 11, 2007 4:00 pm
Location: UK
Contact:

Re: struggling with sprites on Stos

Post by StickHead »

Do you have the manual? If not, this might help:

GET SPRITE pages from the manual:

http://i303.photobucket.com/albums/nn15 ... RITE_1.jpg
http://i303.photobucket.com/albums/nn15 ... TE_2-1.jpg

Sounds like you need to do some work with the sprite editor first.
The Joy of STicks - YouTube - Blog - Twitter - Facebook
New Developments and old inspirations in Atari ST gaming.
User avatar
nitrofurano
Atariator
Atariator
Posts: 24
Joined: Sat May 12, 2012 1:49 pm
Contact:

Re: struggling with sprites on Stos

Post by nitrofurano »

i really wanted to avoid the sprite editor, like i always avoided on Amos - i feel incomparably much more comfortable on drawing sprites on spritesheet pictures, done on Gimp, GrafX2, Python-Pygame/sdlBasic scripts, etc.

maybe the only or simplest way is reserving banks and poking into them?
User avatar
nitrofurano
Atariator
Atariator
Posts: 24
Joined: Sat May 12, 2012 1:49 pm
Contact:

Re: struggling with sprites on Stos

Post by nitrofurano »

btw, the sprite editor is coded in Stos basic anyway, and if it seems to grab sprites so simply, it seems we can do the same on our code as well:
what i found there: (the lines related to ADBLOC variable used from this editor)

Code: Select all

140 ADBLOC=4+leek(start(1)+4)+(BLOCSP-1)*8

Code: Select all

4280 poke start(1)+ADBLOC+6,0 : poke start(1)+ADBLOC+7,0 : get sprite 160,100,13 : logic=physic : back=default back

Code: Select all

4940 poke start(1)+ADBLOC+6,X : poke start(1)+ADBLOC+7,Y : BLOCHX=X-BLOCX1 : BLOCHY=Y-BLOCY1 : return 
but i really don't know how to do an effective use of this
User avatar
sgm
Atariator
Atariator
Posts: 19
Joined: Wed Apr 16, 2008 10:21 am

Re: struggling with sprites on Stos

Post by sgm »

The problem may be your use of two For and two Next statements on the same line. I have neved tried doing that and do not recall seeing any code or manual reference that says you can do so therfore it may be something STOS is not set up for and thus not trapping as an error, consquently STOS may be flagging the error on the next line as it had no set value for either X or y.

Alternatively it may be a problem with y*4+x as STOS cannot tell if the value you are trying to arrive it is derived by y * (4+X) or (y*4)+x. While other (espically more modern) languages may be able to accecpt that and sort it out STOS is much older, you cannot necessarly use the same systax you may be used to in another language with STOS.
elliot
Atari freak
Atari freak
Posts: 59
Joined: Tue Mar 17, 2009 2:00 pm

Re: struggling with sprites on Stos

Post by elliot »

Could it be that the Sprite command uses 1-320 and not 0-319?

I used STOS A LOT 20 years ago but not sure I can remember much now.

If you have an STE you can push values to the Blitter registers in just a dozen POKEs for quick sprites, or if you are brave it can be done in just a few LOKEs (very quick).

E
Post Reply

Return to “STOS”