* WalrusIRC

You need to have 5 posts and not be part of restricted usergroups in order to use the WalrusIRC embedded shoutbox. However, you can also access our IRC channel called #CodeWalrus via EFnet.

Author Topic: Oops (an Axe library)  (Read 636 times)

0 Members and 1 Guest are viewing this topic.

Offline E37

  • Full User
  • Join Date: Jul 2016
  • Location: Lihilzard Empire
  • Posts: 216
  • Post Rating Ratio: +9/-0
  • I own 2 game consoles, a ti-83 and a ti-84!
    • E37
    • View Profile
Oops (an Axe library)
« on: September 27, 2016, 09:07:51 pm »
I suppose I need to go on a general overview of what the heck Oops is.
I call it Oops for "Object Oriented Program(s)" - It is the closest (I think) to an OOP you are going to get in Axe.
Oops is really good at managing large amounts of "objects" - like the 20 fighters you need in your game that each need a different amount of ram and need to be run, added and deleted.
Maybe explaining the functions will make it a little clearer.
1. SSet( PointerToListOfLabels, PointerToListOfSizes)
This creates a stack and initializes the pointers.
Example of use:
Code: [Select]
:Data(lPlayer^r,lShip1^r,lShip2^r)->labelPointer
:Data(15^r,5^r,40^r)-> sizePointer
:SSet(labelPointer,sizePointer)
In this example, the player would get 15 bytes of memory, ship1 would get 5 and ship2 would get 40. There can be up to 256 different types declared here. (Why would anyone need that many?)
Returns 0 if failed. Returns some other number if succeed.

2. SAdd(Type,Position)
Adds an object. It will be type specified. 0 is the first object, 1 is the second ect. It is in the order declared in SSet(). It will be added in the index specified. 0 is first ect. A negative number here will be the end of the stack.
... And an example:
Code: [Select]
:SAdd(0,0)
:SAdd(2,-1)
Using the declarations from above, this will add a player at slot 0 (the beginning) and a Ship2 at the end of the stack.
It returns a pointer to the start of the object's data. (use this to initialize it's variables if needed) The object's data will be filled with zeros. Returns 0 if failed.

3. SDelete(Position)
It deletes the object at the specified position. A negative number is the last object on the stack.
Example:
Code: [Select]
:SDelete(0)
Would delete the first object on the stack.
Returns 0 if failed (if there aren't any objects on the stack)

4. SRun()
There is no arguments for this command. It runs all the objects on the stack. Each object is passed a pointer to its memory in r1.
Example (on how the object should be structured)
Code: [Select]
:Lbl Player
:r1->A
:Output(0,0,{A}>Dec
:Return
Player would simply display the value of its first byte. {r1-1} is the object's type.
Note that StkNum is the current number. SDelete(StkNum) would delete the current object.
Returns: none

That's all! The library (when compiled) is less than 500 bytes!
It can be added anywhere inside the program.
The program automatically deletes stack upon exiting. (no need to clean up)
If you need to read the stack yourself, the variable Stack holds the pointer to the start of the stack.


  • Consoles, mobile devices and vintage computers owned: Ti83,Ti84!
I've never finished a project, there is always a way to improve!
What's my calc's name? Convert $37 to decimal. Look up that element in the periodic table. Then take the abbreviation of that element and you have it!
Look! A slime!    <(^.^)>

Offline DJ Omnimaga

  • Omni founder & CW co-founder
  • CodeWalrus Staff
  • Super User
  • Forum Maintenance
  • Original 5
  • CodeWalrus Supporter
  • *
  • Topic Management
  • Join Date: Nov 2014
  • Location: Quebec, Canada
  • Posts: 18243
  • Post Rating Ratio: +91/-4
    • dj_omnimaga
    • DJOmnimaga.music
    • @DJOmnimaga
    • dj_omnimaga
    • @DJOmnimaga
    • /u/DJ_Omnimaga
    • DJOmnimaga
    • 112/11286
    • @djomnimaga
    • @DJOmnimaga
    • View Profile
    • DJ Omnimaga music store
  • Gender: Male
Re: Oops (an Axe library)
« Reply #1 on: October 06, 2016, 07:08:10 pm »
Something I am curious about is the speed at which this runs at. This might broaden the audience of Axe programmers since some people prefer OOP, but if the speed/size cost is too severe then it might be a good idea to fix that (unless that was taken care of already).
  • Calculators owned: TI-57, 73, TI-80 (broken), TI-81, TI-82, TI-83, TI-83+ (broken), TI-83+ (broken), TI-83+SE (broken), TI-84+, TI-84+CSE, TI-84+CE, TI-85, TI-86, TI-89T, TI-92, TI-Nspire, TI-Nspire CX (semi-broken), HP 39gII, HP Prime, Casio fx-7000G, fx-7400G+, fx-7700GE, fx-9750G+, fx-9750GII, fx-9860G, cfx-9850G, FX-1.0+, fx-CG10, fx-CP400
  • Consoles, mobile devices and vintage computers owned: Samsung i5510, Nexus 5, Atari 2600, Lynx, SMS, Game Gear, Genesis, Dreamcast, NES, SNES, N64, GCN, Wii, Wii U, GBA, DS, 3DS, PS2, PS3, PS4, PSP, PSVita, XBox 360, XBOne

Bandcamp|Reverbnation|Facebook|Youtube|Twitter
Retired Omnimaga admin (2001-11) and editor (2012-14)
??? ??? ??? ???

Offline E37

  • Full User
  • Join Date: Jul 2016
  • Location: Lihilzard Empire
  • Posts: 216
  • Post Rating Ratio: +9/-0
  • I own 2 game consoles, a ti-83 and a ti-84!
    • E37
    • View Profile
Re: Oops (an Axe library)
« Reply #2 on: October 08, 2016, 02:15:28 pm »
Something I am curious about is the speed at which this runs at. This might broaden the audience of Axe programmers since some people prefer OOP, but if the speed/size cost is too severe then it might be a good idea to fix that (unless that was taken care of already).
There is almost no overhead. (I ran 2 objects in a loop and there was no noticeable difference than putting those objects in a loop)
Like I mentioned, It isn't a true oop. It is modified to control large amounts of "enemies" allowing the programmer to add, delete and run them easily. (Since it is designed to control 50+ "objects" at once I reduced overhead to a minimum)

The short answer is no. There is almost no slowdown due to the structure.
  • Consoles, mobile devices and vintage computers owned: Ti83,Ti84!
I've never finished a project, there is always a way to improve!
What's my calc's name? Convert $37 to decimal. Look up that element in the periodic table. Then take the abbreviation of that element and you have it!
Look! A slime!    <(^.^)>

Offline DJ Omnimaga

  • Omni founder & CW co-founder
  • CodeWalrus Staff
  • Super User
  • Forum Maintenance
  • Original 5
  • CodeWalrus Supporter
  • *
  • Topic Management
  • Join Date: Nov 2014
  • Location: Quebec, Canada
  • Posts: 18243
  • Post Rating Ratio: +91/-4
    • dj_omnimaga
    • DJOmnimaga.music
    • @DJOmnimaga
    • dj_omnimaga
    • @DJOmnimaga
    • /u/DJ_Omnimaga
    • DJOmnimaga
    • 112/11286
    • @djomnimaga
    • @DJOmnimaga
    • View Profile
    • DJ Omnimaga music store
  • Gender: Male
Re: Oops (an Axe library)
« Reply #3 on: October 19, 2016, 02:50:03 am »
Ah ok. It's good to see the speed is fast enough then :) and I like that it can handle 50+ objects at once O.O
  • Calculators owned: TI-57, 73, TI-80 (broken), TI-81, TI-82, TI-83, TI-83+ (broken), TI-83+ (broken), TI-83+SE (broken), TI-84+, TI-84+CSE, TI-84+CE, TI-85, TI-86, TI-89T, TI-92, TI-Nspire, TI-Nspire CX (semi-broken), HP 39gII, HP Prime, Casio fx-7000G, fx-7400G+, fx-7700GE, fx-9750G+, fx-9750GII, fx-9860G, cfx-9850G, FX-1.0+, fx-CG10, fx-CP400
  • Consoles, mobile devices and vintage computers owned: Samsung i5510, Nexus 5, Atari 2600, Lynx, SMS, Game Gear, Genesis, Dreamcast, NES, SNES, N64, GCN, Wii, Wii U, GBA, DS, 3DS, PS2, PS3, PS4, PSP, PSVita, XBox 360, XBOne

Bandcamp|Reverbnation|Facebook|Youtube|Twitter
Retired Omnimaga admin (2001-11) and editor (2012-14)
??? ??? ??? ???

Offline c4ooo

  • ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
  • Super User
  • CW Contest II Winner
  • *
  • Join Date: Aug 2015
  • Location: 127.0.0.1
  • Posts: 915
  • Post Rating Ratio: +9/-2
  • ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
    • View Profile
  • Gender: Male
Re: Oops (an Axe library)
« Reply #4 on: October 19, 2016, 08:01:14 pm »
Well, asm is likely to be faster than the best axe code, so unless there is some major flaw in this library, it should be faster than any similar system you write in axe ;)

Offline E37

  • Full User
  • Join Date: Jul 2016
  • Location: Lihilzard Empire
  • Posts: 216
  • Post Rating Ratio: +9/-0
  • I own 2 game consoles, a ti-83 and a ti-84!
    • E37
    • View Profile
Re: Oops (an Axe library)
« Reply #5 on: October 19, 2016, 08:30:40 pm »
Well, asm is likely to be faster than the best axe code, so unless there is some major flaw in this library, it should be faster than any similar system you write in axe ;)
What do you mean? It is a library. Libraries are written in Axe. I included some asm opcodes, but only to add/remove memory.
  • Consoles, mobile devices and vintage computers owned: Ti83,Ti84!
I've never finished a project, there is always a way to improve!
What's my calc's name? Convert $37 to decimal. Look up that element in the periodic table. Then take the abbreviation of that element and you have it!
Look! A slime!    <(^.^)>

Offline c4ooo

  • ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
  • Super User
  • CW Contest II Winner
  • *
  • Join Date: Aug 2015
  • Location: 127.0.0.1
  • Posts: 915
  • Post Rating Ratio: +9/-2
  • ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
    • View Profile
  • Gender: Male
Re: Oops (an Axe library)
« Reply #6 on: October 19, 2016, 08:51:10 pm »
Ohh right  :-X
My point still applies though :P

 


You can also use the following HTML or bulletin board code to share it on your page or forum signature!


Also do not forget to check our affiliates below.
Planet Casio TI-Planet Calc.news BroniesQC BosaikNet Velocity Games