Jump to content

Photo

DPC+ question


13 replies to this topic

#1 Lillapojkenpćön OFFLINE  

Lillapojkenpćön

    Chopper Commander

  • 126 posts

Posted Tue Sep 18, 2018 11:10 PM

Is it possible to put all the animations of a sprite into one long sprite and change the pointer to which line to start reading from like I've seen done in the standard kernel? And would the sprite be limited to 255 lines tall then?

 

 Here's an example to copy and add to, let's say I added 5 to the variable f every frame and wanted that to be the offset, what would that look like?

  asm
LDX #<mytext1
STX player0pointerlo
LDA #((>mytext1) & $0f) | (((>mytext1) / 2) & $70)
STA player0pointerhi
end


#2 Lillapojkenpćön OFFLINE  

Lillapojkenpćön

    Chopper Commander

  • Topic Starter
  • 126 posts

Posted Sat Sep 22, 2018 9:33 PM

nevermind, this worked

 

   asm
   LDA #<mytext1
   STA temp5
end
 
 
    player0pointerlo  = temp5 + f 
 
 
  asm
   LDA #((>mytext1) & $0f) | (((>mytext1) / 2) & $70) 
   STA player0pointerhi 
end

Edited by Lillapojkenpćön, Sat Sep 22, 2018 9:34 PM.


#3 Muddyfunster OFFLINE  

Muddyfunster

    Chopper Commander

  • 173 posts

Posted Sun Sep 23, 2018 4:36 AM

What's the benefit in doing it this way?  (genuine question, I'm new to this).

 

It seems complicated for little benefit ?



#4 Lillapojkenpćön OFFLINE  

Lillapojkenpćön

    Chopper Commander

  • Topic Starter
  • 126 posts

Posted Sun Sep 23, 2018 7:07 AM

I can only speak for the DPC+ kernel, I have quite a bit of animation in my game and before I was using "on goto" to jump to the sprites and "goto" to jump back to the loop again,

and the regular way to load a sprite in bB like this.. (that I was jumping to and from..)

 

 player0:
 %11000000
 %11000000
 %11000000
 %11000000
end
 

 outputs something like this when assembled, except the automaticly generated name playerL02841_0 will be different

 

LDX #<playerL02841_0
STX player0pointerlo
LDA #((>playerL02841_0) & $0f) | (((>playerL02841_0) / 2) & $70)
STA player0pointerhi
LDA #5
STA player0height
 
and it puts the graphic in the graphics bank
 
playerL02841_0
.byte  %11000000
.byte  %11000000
.byte  %11000000
.byte  %11000000
.byte  %11000000

 

 That's alot of duplicate code when the animation frames start adding up, if you can just use the same code and a tall sprite and a counter that make it works more like a filmstrip.

 I saved cycles and 3000 bytes (not counting the graphics bank) so it was very beneficial. 

 

It looks complicated to me to  :) i have no Idea what #((>playerL02841_0) & $0f) | (((>playerL02841_0) / 2) & $70) does or even what pointers do exactly, the nice thing is that you don't have to to still get it to work. :)


Edited by Lillapojkenpćön, Sun Sep 23, 2018 7:09 AM.


#5 Random Terrain OFFLINE  

Random Terrain

    Visual batari Basic User

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

Posted Sun Sep 23, 2018 11:44 AM

 

nevermind, this worked

 

   asm
   LDA #<mytext1
   STA temp5
end
 
 
    player0pointerlo  = temp5 + f 
 
 
  asm
   LDA #((>mytext1) & $0f) | (((>mytext1) / 2) & $70) 
   STA player0pointerhi 
end

 

 

Where did the magical math come from? I should probably put a version of this on the bB page and link to the source of the information. Also, can "mytext1" be called anything the programmer wants?



#6 Lillapojkenpćön OFFLINE  

Lillapojkenpćön

    Chopper Commander

  • Topic Starter
  • 126 posts

Posted Mon Sep 24, 2018 7:20 AM

Yes it can be called anything, I made an example you can play around with, it uses playerheight instead of deathbits

 

Attached File  example.bas   9.53KB   11 downloads

 

press up down left or right to blow the robots up, and fire to reset them


Edited by Lillapojkenpćön, Mon Sep 24, 2018 7:30 AM.


#7 Random Terrain OFFLINE  

Random Terrain

    Visual batari Basic User

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

Posted Wed Sep 26, 2018 7:52 AM

Yes it can be called anything, I made an example you can play around with, it uses playerheight instead of deathbits

 

attachicon.gifexample.bas

 

press up down left or right to blow the robots up, and fire to reset them

 

It compiles, but Stella doesn't come up when I try to run it. I'm guessing that I need to upgrade Stella.



#8 Karl G OFFLINE  

Karl G

    Dragonstomper

  • 603 posts

Posted Wed Sep 26, 2018 8:51 AM

It works for me with Stella 5.1.



#9 Random Terrain OFFLINE  

Random Terrain

    Visual batari Basic User

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

Posted Wed Sep 26, 2018 10:23 AM

It works for me with Stella 5.1.

 

I'm using 4.6, so maybe that's the problem.



#10 Random Terrain OFFLINE  

Random Terrain

    Visual batari Basic User

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

Posted Wed Sep 26, 2018 10:40 AM

I'm using 4.6, so maybe that's the problem.

 
This is annoying. I downloaded Visual C++ Redistributable for Visual Studio 2017 (vc_redist.x64.exe) and Stella-5.1.3-x64.exe and now Stella won't even run. I get this pop up message:

 

stella_error.png



#11 Karl G OFFLINE  

Karl G

    Dragonstomper

  • 603 posts

Posted Wed Sep 26, 2018 10:56 AM

Did you get the x64 version of the runtime?  If you got the x86 version, then that might explain why it can't find it (32-bit version).



#12 Random Terrain OFFLINE  

Random Terrain

    Visual batari Basic User

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

Posted Wed Sep 26, 2018 10:58 AM

Did you get the x64 version of the runtime?  If you got the x86 version, then that might explain why it can't find it (32-bit version).

 

Yep, the x64 version.



#13 Karl G OFFLINE  

Karl G

    Dragonstomper

  • 603 posts

Posted Wed Sep 26, 2018 11:03 AM

Uhh...maybe try rebooting?   :P   Or ask in the Emulation forum to see if anyone has any better ideas.



#14 Lillapojkenpćön OFFLINE  

Lillapojkenpćön

    Chopper Commander

  • Topic Starter
  • 126 posts

Posted Wed Sep 26, 2018 6:56 PM

 

It compiles, but Stella doesn't come up when I try to run it. I'm guessing that I need to upgrade Stella.

That happens to me all the time, didn't know it was contagious, sorry  :)






0 user(s) are browsing this forum

0 members, 0 guests, 0 anonymous users