Author Topic: Routines  (Read 294045 times)

0 Members and 2 Guests are viewing this topic.

Offline Quigibo

  • The Executioner
  • CoT Emeritus
  • LV11 Super Veteran (Next: 3000)
  • *
  • Posts: 2031
  • Rating: +1075/-24
  • I wish real life had a "Save" and "Load" button...
    • View Profile
Re: Routines
« Reply #45 on: March 05, 2010, 11:14:54 am »
@trevmeister66
Eeems was correct about the string sizes.  When you define data, like the data in your strings, that data is added to the end of the program, not to the RAM.  Your compiled code will look like this:

<Hex code for all of program>06646464640664646464

While you CAN use this area to modify data, it is limited by the room it has in the program.  A 1000 byte program can not use 2000 bytes of its own ram!  If you want to use the free ram, then at the start of your program, you have to copy your data to the RAM using a for loop or something.

@omnimaga
If you want to speed up the pixilation, you can draw 8x8 and 4x4 sprites instead of blocks of pixels using Pt-Off().  Its probobly even faster for the 2x2 case but I'm not quite sure about that.  Also, in the next version, you will be able to use 15MHz mode so yeah, that can be 3 times faster.
« Last Edit: March 05, 2010, 11:18:21 am by Quigibo »
___Axe_Parser___
Today the calculator, tomorrow the world!

Offline Galandros

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1140
  • Rating: +42/-10
    • View Profile
Re: Routines
« Reply #46 on: March 05, 2010, 02:03:26 pm »
Very cool effect DJ. ;) The current speed is good. And there is space for optimization. ;)
Good work to Quigibo, too, he did the language after all. :P
« Last Edit: March 05, 2010, 02:20:43 pm by Galandros »
Hobbing in calculator projects.

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55942
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: Routines
« Reply #47 on: March 05, 2010, 02:27:37 pm »
Thanks quigibo, I guess I need to learn about sprites now ^^

As for Eeems, unfortunately I don't understand what you mean. Could you show code as example?
Now active at https://discord.gg/cuZcfcF (CodeWalrus server)

Offline trevmeister66

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1009
  • Rating: +14/-5
    • View Profile
Re: Routines
« Reply #48 on: March 05, 2010, 03:02:35 pm »
@trevmeister66
Eeems was correct about the string sizes.  When you define data, like the data in your strings, that data is added to the end of the program, not to the RAM.  Your compiled code will look like this:

<Hex code for all of program>06646464640664646464

While you CAN use this area to modify data, it is limited by the room it has in the program.  A 1000 byte program can not use 2000 bytes of its own ram!  If you want to use the free ram, then at the start of your program, you have to copy your data to the RAM using a for loop or something.

Wow, that made everything clear. I get why it doesn't work. Thanks!

EDIT: Heh, your's and Eem's suggestions worked. Thanks guys!
« Last Edit: March 05, 2010, 03:16:44 pm by trevmeister66 »
Projects:    nameless RPG: 1.0%  |  Reverse Snake v1.5: 100%  |  Secret Project: 5%  |  DUNGEON: 70%

My MW2 Blog <-- Please visit :)

Offline ztrumpet

  • The Rarely Active One
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5712
  • Rating: +364/-4
  • If you see this, send me a PM. Just for fun.
    • View Profile
Re: Routines
« Reply #49 on: March 05, 2010, 03:45:07 pm »
Looks nice DJ!

Eeems, the for loop code's really cool too.  I think I'll use that. :)

Offline Eeems

  • Mr. Dictator
  • Administrator
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 6265
  • Rating: +318/-36
  • little oof
    • View Profile
    • Eeems
Re: Routines
« Reply #50 on: March 05, 2010, 04:42:02 pm »
thanks ztrumpet!
@trevmeister66: Yay! I'm glad it did :D
@DJ: instead of:
Code: [Select]
for(A,1,10)
for(B,1,10)
A*2->X
B*2->Y
-code-
End:End
you would do:
Code: [Select]
for(A,1,10)
A*2->X
for(B,1,10)
B*2->Y
-code-
End:End
« Last Edit: March 05, 2010, 04:42:42 pm by Eeems »
/e

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55942
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: Routines
« Reply #51 on: March 05, 2010, 05:15:10 pm »
oh ok, yeah you're right. Now I use your other method, though, of doing

for(B,1,9
for(A,1,9
-code-
A+1->A
End
B+1->B
End
Now active at https://discord.gg/cuZcfcF (CodeWalrus server)

Offline Eeems

  • Mr. Dictator
  • Administrator
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 6265
  • Rating: +318/-36
  • little oof
    • View Profile
    • Eeems
Re: Routines
« Reply #52 on: March 05, 2010, 06:02:33 pm »
Yeah :)
how much faster is that btw?
/e

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55942
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: Routines
« Reply #53 on: March 05, 2010, 06:22:09 pm »
i got a major speed gain in the 2x2 pixels part of my code, but no difference for the rest. I will probably try Quigibo 4x4 and 8x8 sprites method, though.
Now active at https://discord.gg/cuZcfcF (CodeWalrus server)

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55942
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: Routines
« Reply #54 on: March 06, 2010, 02:19:14 am »
Ok now I tried with sprites. Here's the result:

2x2: way too slow. Stuck with pxl-on's
4x4: at least 2x faster than it was with pxl-ons
8x8: so incredibly fast it wouldn't let me see the 4x4 part. I had to put a For(Z,0,9000:End  before it so it goes at the same speed as the 4x4 rendering XD

Now that it is done, I think it might be good that I try again but this time instead of doubling every frame, I go like 2x2, 3x3, 4x4, 5x5, 6x6, 7x7 to end with 8x8

First, I need to re-backup Illusiat 2004-R files, though, in case that thing would get finished within the next 774 years

EDIT: The code

Quote from: BASIC Code
:[FFFFFFFFFFFFFFFF→Pic7
:[F0F0F0F000000000→Pic8
:For(A,0,94
:For(B,0,62
:If pxl-Test(A,B
:Pxl-On(A+1,B
:Pxl-On(A,B+1
:Pxl-On(A+1,B+1
:Else
:Pxl-Off(A+1,B
:Pxl-Off(A,B+1
:Pxl-Off(A+1,B+1
:End
:B+1→B
:End
:A+1→A
:End
:DispGraph
:For(A,0,92
:For(B,0,60
:If pxl-Test(A,B
:Pt-On(A,B,Pic8
:Else
:Pt-On(A,B,Pic8
:Pt-Change(A,B,Pic8
:End
:B+3→B
:End
:A+3→A
:End
:DispGraph
:For(A,0,9000
:End
:For(A,0,88
:For(B,0,56
:If pxl-Test(A,B
:Pt-On(A,B,Pic7
:Else
:Pt-On(A,B,Pic7
:Pt-Change(A,B,Pic7
:End
:B+7→B
:End
:A+7→A
:End
:DispGraph
Generated by SourceCoder, © 2005 Cemetech

EDIT: I attached a 2nd screenshot of a different pixelating routine, going through 2x, 3x,4x,5x,6x,7x and 8x. However for some reasons it seems a bit glitchy so I will have to look into that. Also the code is pretty large x.x, I'll prbly post later.
« Last Edit: March 06, 2010, 05:12:15 am by DJ Omnimaga »
Now active at https://discord.gg/cuZcfcF (CodeWalrus server)

Offline trevmeister66

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1009
  • Rating: +14/-5
    • View Profile
Re: Routines
« Reply #55 on: March 06, 2010, 10:15:05 am »
Very nice DJ. One thing though: You don't have to do "For(X,0,####):End" to slow it down. All you have to do is "Pause ####" and it will pause for that many milliseconds. Other than that, great work.
Projects:    nameless RPG: 1.0%  |  Reverse Snake v1.5: 100%  |  Secret Project: 5%  |  DUNGEON: 70%

My MW2 Blog <-- Please visit :)

Offline ztrumpet

  • The Rarely Active One
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5712
  • Rating: +364/-4
  • If you see this, send me a PM. Just for fun.
    • View Profile
Re: Routines
« Reply #56 on: March 06, 2010, 10:38:52 am »
For(Z,0,9000:End
But that's over 9000 iterations!
*ztrumpet hides

First, I need to re-backup Illusiat 2004-R files, though, in case that thing would get finished within the next 774 years
I can't wait for this to be done. Illusiat 2004-R will be awesome! ;D

Looks nice DJ.  Good luck with the odd numbers code. :)
« Last Edit: March 06, 2010, 10:39:22 am by ztrumpet »

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55942
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: Routines
« Reply #57 on: March 06, 2010, 12:59:20 pm »
Woww strange, I totally missed the Pause command from the doc. I checked 3 times and never saw it x.x

I should have did a CTRL+F to search through the page for keyword "Pause"

Btw I kinda wish it was possible to do Pt-Change(A,B,8 instead of Pt-Change(A,B,Pic8 so I could just run a 3rd for( loop with C from 3 to 8 so my code is almost 5x smaller. I wonder if it would be much slower, though...
Now active at https://discord.gg/cuZcfcF (CodeWalrus server)

Offline Quigibo

  • The Executioner
  • CoT Emeritus
  • LV11 Super Veteran (Next: 3000)
  • *
  • Posts: 2031
  • Rating: +1075/-24
  • I wish real life had a "Save" and "Load" button...
    • View Profile
Re: Routines
« Reply #58 on: March 06, 2010, 01:57:59 pm »
If your pics are in order, you can do "C*8+Pic0" and it will be the same as "PicC"
« Last Edit: March 06, 2010, 01:59:13 pm by Quigibo »
___Axe_Parser___
Today the calculator, tomorrow the world!

Offline trevmeister66

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1009
  • Rating: +14/-5
    • View Profile
Re: Routines
« Reply #59 on: March 06, 2010, 02:11:56 pm »
How would I get a random point on the screen? I get that "rand" returns a random 16-bit integer, but how would I get the results to be numbers that will fit within the screen limits? (96x65) or whatever.
Projects:    nameless RPG: 1.0%  |  Reverse Snake v1.5: 100%  |  Secret Project: 5%  |  DUNGEON: 70%

My MW2 Blog <-- Please visit :)