Author Topic: Routines  (Read 313247 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 #60 on: March 06, 2010, 02:15:49 pm »
:rand^96->X (returns 0-95)
:rand^64->Y (returns 0-63)

Modulus "^" is the remainder after a division.
___Axe_Parser___
Today the calculator, tomorrow the world!

Offline trevmeister66

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1009
  • Rating: +14/-5
    • View Profile
Re: Routines
« Reply #61 on: March 06, 2010, 02:16:56 pm »
Alright thanks. I thought I should use modulus, but I wasn't exactly sure (its been a few years since I've done any programming with modulus, BASIC or java or whatever).
Projects:    nameless RPG: 1.0%  |  Reverse Snake v1.5: 100%  |  Secret Project: 5%  |  DUNGEON: 70%

My MW2 Blog <-- Please visit :)

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: Routines
« Reply #62 on: March 06, 2010, 02:34:36 pm »
If your pics are in order, you can do "C*8+Pic0" and it will be the same as "PicC"
what would be the 8 for?

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 #63 on: March 06, 2010, 03:37:50 pm »
There are 8 bytes in every picture.  Lets say the first picture is stored at the end of your program at address 9000.  That means the second byte of the picture is at 9001, the third at 9002, etc. until the 8th byte is at 9007.  The first byte of the NEXT picture then starts at 9008.  You can try Disp Pic1>Dec if you want to see it visually, it will be over 9000!!!  You'll see each picture is 8 bytes apart, assuming that they were all created one after another.  If you have a string defined in between them or something, that would offset the data a little.

<Entire program><8 bytes of first pic><8 bytes of second pic>...
___Axe_Parser___
Today the calculator, tomorrow the world!

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: Routines
« Reply #64 on: March 06, 2010, 03:44:41 pm »
aaah ok but why not having it so you just need to do C+Pic0 for example, and Axe, when compiling, adds the *8 for you?

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 #65 on: March 06, 2010, 04:09:06 pm »
Because there are conceivably situations where you may want to draw fractions of a sprite.  Consider this sprite, I'll draw it in ascii so you can see it.


........
........
........
........
...00...
..0000..
..0000..
...00...
........
........
........
........


Its not 8x8, but by drawing portions of this sprite with offsets from 0-3, you can have a bouncing ball animation without needing 4 separate sprites for each frame.  In fact, any scrolling, looping sprite like a barbershop spiral or checker pattern reversal can use this optimization.
« Last Edit: March 06, 2010, 04:13:58 pm by Quigibo »
___Axe_Parser___
Today the calculator, tomorrow the world!

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: Routines
« Reply #66 on: March 06, 2010, 04:13:16 pm »
mhmm I still don,t understand x.x

Oh well, I guess what matter is that now I know how to choose which sprite to display dynamically, reducing code repetitiveness

Offline trevmeister66

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1009
  • Rating: +14/-5
    • View Profile
Re: Routines
« Reply #67 on: March 06, 2010, 04:45:36 pm »
I have another question: Is it possible to display the contents of a variable as a string? For example, I have 100 stored in L (for lives or something), and I want to display "LIVES: 100". Is it possible yet to do this with Axe? Because I tried using Output(X,Y,L) and it didn't work.
Projects:    nameless RPG: 1.0%  |  Reverse Snake v1.5: 100%  |  Secret Project: 5%  |  DUNGEON: 70%

My MW2 Blog <-- Please visit :)

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 #68 on: March 06, 2010, 05:37:58 pm »
100 Lives?  That's a lot!

You're clearly thinking about how basic uses Output() which is not how Axe uses it.  In Axe, the last argument is the address of a string you want to display, not the value of the number.  If you want to instead display the number in base 10, you use >Dec at the end.

I think everyone would benefit by reading the documentation all the way through, maybe more than once, and then ask questions if you are unclear about a description.  A lot of these questions can be answered there.  But also, I think its the general unfamiliarity of pointers, arrays, and unsigned arithmetic that are throwing people off.  A new tutorial should address these issues.  Would anyone like to help me write one if you have a clear understanding already?  I think it would really clear up a lot of the confusion.
___Axe_Parser___
Today the calculator, tomorrow the world!

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 #69 on: March 06, 2010, 05:38:56 pm »
Interesting.  I like that it will draw sprites like that.  Cool! ;D

I have another question: Is it possible to display the contents of a variable as a string? For example, I have 100 stored in L (for lives or something), and I want to display "LIVES: 100". Is it possible yet to do this with Axe? Because I tried using Output(X,Y,L) and it didn't work.
Use Output(X,Y,L>Dec)  //The >Dec is [Math] [2]

Good luck!

*Ztrumpet got ninja'ed!  O0
« Last Edit: March 06, 2010, 05:45:28 pm by ztrumpet »

Offline trevmeister66

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1009
  • Rating: +14/-5
    • View Profile
Re: Routines
« Reply #70 on: March 06, 2010, 05:43:08 pm »
100 Lives?  That's a lot!

You're clearly thinking about how basic uses Output() which is not how Axe uses it.  In Axe, the last argument is the address of a string you want to display, not the value of the number.  If you want to instead display the number in base 10, you use >Dec at the end.

I think everyone would benefit by reading the documentation all the way through, maybe more than once, and then ask questions if you are unclear about a description.  A lot of these questions can be answered there.  But also, I think its the general unfamiliarity of pointers, arrays, and unsigned arithmetic that are throwing people off.  A new tutorial should address these issues.  Would anyone like to help me write one if you have a clear understanding already?  I think it would really clear up a lot of the confusion.
Heh heh.. :D my bad. Thanks!
Interesting.  I like that it will draw sprites like that.  Cool! ;D

I have another question: Is it possible to display the contents of a variable as a string? For example, I have 100 stored in L (for lives or something), and I want to display "LIVES: 100". Is it possible yet to do this with Axe? Because I tried using Output(X,Y,L) and it didn't work.
Use Output(X,Y,L>Dec)  //The >Dec is [Math] [2]

Good luck!
And thanks to you too!
Projects:    nameless RPG: 1.0%  |  Reverse Snake v1.5: 100%  |  Secret Project: 5%  |  DUNGEON: 70%

My MW2 Blog <-- Please visit :)

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: Routines
« Reply #71 on: March 06, 2010, 05:59:54 pm »
I like the doc so far, btw. I had trouble with some stuff, but I try to gradually improve so my code is still unoptimized I think. Eventually I will probably get better, though. But there are some asm-specifc stuff i might not understand such as this post x.x

Btw: It takes like 30 sprites on the screen moving around before I notice major slow downs. I tried Axe Parser demo program STARSHIP modified with 60 of them and got like 10 fps still XD. With 1, 2 or 3 rows of sprites it was fast like Galaxian in ASM

Nice job so far Quigibo

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 #72 on: March 06, 2010, 06:13:41 pm »
STARSHIP is hardly even playable with 60 sprites because its too fast with 16mhz mode XD

In regards to that other post, maybe this will help:

........ <- Normal sprite that will be drawn (lets call Pic1)
........
........
........
...00...
..0000..
..0000..
...00...

........
........
........
........


........
........ <- One byte after Pic1 (Pic1+1)
........
........
...00...
..0000..
..0000..
...00...
........

........
........
........


........
........
........ <- (Pic1+2)
........
...00...
..0000..
..0000..
...00...
........
........

........
........


........
........
........
........ <- (Pic1+3)
...00...
..0000..
..0000..
...00...
........
........
........

........


........
........
........
........
...00... <- (Pic1+4)
..0000..
..0000..
...00...
........
........
........
........


Notice how the sprite appears to animate a ball moving upwards. Reversing this would make it appear moving downwards.  Sorry for the really tall post.
___Axe_Parser___
Today the calculator, tomorrow the world!

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: Routines
« Reply #73 on: March 06, 2010, 06:27:40 pm »
oooh thanks a lot. I am more a visual person so I tend to understand more with images like this. Thanks, and no problem with the large post :)

Btw is 15 Mhz mode gonna be implemented in next version? Will it be possible for 15 MHz programs to automatically run at 6 on 83+?

Offline calc84maniac

  • eZ80 Guru
  • Coder Of Tomorrow
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2912
  • Rating: +471/-17
    • View Profile
    • TI-Boy CE
Re: Routines
« Reply #74 on: March 06, 2010, 08:46:58 pm »
I think in one of the topics he said there would be commands to switch to 15MHz and back (which will do nothing on the TI-83+) -- Full and Normal iirc
"Most people ask, 'What does a thing do?' Hackers ask, 'What can I make it do?'" - Pablos Holman