Omnimaga

Calculator Community => Major Community Projects => The Axe Parser Project => Topic started by: zero44 on May 09, 2011, 09:08:35 am

Title: Axe Library : AxeLib7
Post by: zero44 on May 09, 2011, 09:08:35 am
I made an Axe prgm which contains lots of Lbls, is it considered as a library ?
Most of functions are made to make DCS's style.

Spoiler For functions:
  • Get DCS7's cursor (need a ptr)
  • Open calc's variables (need name, returns ptr)
  • Close calc's variables (need name)
  • Draw a window like DCS7 (need title, Xtitle, icon's adress (0 for none))
  • Returns 1 if point(X,Y) is in rect (X,Y,W,H) (need X:r1, Y:r2, etc.)
    Info : if r3=99, returns 1 if X,Y is on the close icon
  • Draw a button like DCS7 (need XYWH, title, and 1 if title must be write)
  • Draw a small window like DCS7 (need title, 1 if close button, and XYWH)
  • Draw a b/w/transparent cursor (need adress of white)
Title: Re: "Library" in Axe
Post by: ZippyDee on May 09, 2011, 09:11:47 am
A "Library" refers to a set of routines that aren't made into a full program on their own, but rather they are intended to be used by other people to aid them in making their programs.
Title: Re: "Library" in Axe
Post by: zero44 on May 09, 2011, 09:15:52 am
How can I make a real Library ?
Title: Re: "Library" in Axe
Post by: ZippyDee on May 09, 2011, 09:17:52 am
Well, if your program is a collection of routines that are not specific to a particular program, then it could be called a library.

EDIT: This was post 333 :D
Title: Re: "Library" in Axe
Post by: aeTIos on May 09, 2011, 09:24:09 am
I think that you can call this program a library, since it can be used in any program.
Title: Re: "Library" in Axe
Post by: zero44 on May 09, 2011, 09:25:18 am
I don't exactly understand what ZippyDee said ...
I have prgmAXELIB7, and in my axe source code, I write at the top:
.PROGRAM SomeThing
#Icon(---)
[---]->GDB1
prgmAXELIB7
.code

In each program, I include it but axe parser includes all code of AXELIB7, so the compiled prgm has something like 1200 bytes more ... -_-
Title: Re: "Library" in Axe
Post by: ZippyDee on May 09, 2011, 09:26:37 am
I think that you can call this program a library, since it can be used in any program.
Well that's the key thing...CAN it be used in any program? If it's written for only a specific program, then it's not really a library (at least not a good one). The syntax and usage of commands should be fairly straightforward and logical for general use.
Title: Re: "Library" in Axe
Post by: zero44 on May 09, 2011, 09:28:19 am
I can use it in all programs I make.

It's very useful for me, but it takes lots of place .
Title: Re: "Library" in Axe
Post by: aeTIos on May 09, 2011, 09:28:55 am
zero: You should actually include a program at the end.... so, after the final return. I assume you know how to call subroutines?
Title: Re: "Library" in Axe
Post by: ZippyDee on May 09, 2011, 09:30:01 am
I can use it in all programs I make.

It's very useful for me, but it takes lots of place .
Well how else would you expect it to work? It has to take up space if you're going to include it in your program. There's no way for it to exist and take up no space...
Title: Re: "Library" in Axe
Post by: aeTIos on May 09, 2011, 09:30:59 am
It would be useful if axe only included the specific routines you use (the ones that are called)
Title: Re: "Library" in Axe
Post by: ZippyDee on May 09, 2011, 09:32:23 am
Yeah, that would be useful.../me thinks there's a very good place to bring that up SOMEWHERE on this forum...I wonder where that could be?
Title: Re: "Library" in Axe
Post by: zero44 on May 09, 2011, 09:32:57 am
It will be very great if Quigibo can write all my functions in Axe 1.0.0 ...
It will take less place, no ?

aeTIos : If I include it at the end, will it be better ?

PS: does someone know how many space will take AxeParser 1.0.0 ?
Title: Re: "Library" in Axe
Post by: aeTIos on May 09, 2011, 09:34:13 am
;D I'll add a post in the feature request thread. also, I think this is in the wrong subforum, I think it should be moved to 'Other calc-related projects and ideas'. I can't move threads, tho... maybe a mod can do?

Edit:
Zero, yeah, including at the end is way better, it reduces starting time for your program. Also, Axe 1.0.0 will be the same size as it is atm (imo) since most functions are added already.
I dont think Quigibo will include your program, since you wrote it already and it is a bit too specific.
Title: Re: Library in Axe
Post by: zero44 on May 09, 2011, 09:35:12 am
But it's for axe, no ?
Title: Re: "Library" in Axe
Post by: ZippyDee on May 09, 2011, 09:35:34 am
The compiled program runs completely separate from the Axe Parser. There is no way for you to really include all of your functions without it taking up so much space. The only way to possibly make them any smaller would be to write them in pure optimized assembly, not Axe.

EDIT: I think this is a fine subforum for this post...It is about Axe libraries.
Title: Re: Library in Axe
Post by: zero44 on May 09, 2011, 09:36:39 am
...
How to make an Axe/ASM library ? o_O
Title: Re: Library in Axe
Post by: ZippyDee on May 09, 2011, 09:37:22 am
What you have is a library. A library is just a collection of routines. Just because something is a library, it doesn't mean it will take up less space.
Title: Re: Library in Axe
Post by: zero44 on May 09, 2011, 10:47:37 am
I don't know if you really understand what I mean.
The code of library : +800bytes
Code of prgm : x+8bytes
compiled prgm : x+1200bytes !

If I make 3 prgm using AXELIB7, I'll lose 4kb of ram !!
It'll be better if I 'just' lose 1.2kb ...
Title: Re: Library in Axe
Post by: aeTIos on May 09, 2011, 10:50:49 am
You are forgetting something, i think. you forget that compiled code and source code are different. In Basic, it is the same, but in axe, a program of 100 bytes source can be 200 bytes when compiled.
Title: Re: Library in Axe
Post by: zero44 on May 09, 2011, 10:56:47 am
Yes, I know.
With including AXELIB7 in source code, compiled prgm has 1.2kb more. (It's the tall of compiled library - but compiled library is definitely not useful ^^ )
The source code is just 800 byte.
Title: Re: Library in Axe
Post by: aeTIos on May 09, 2011, 11:00:26 am
Thanks for explaining, makes things easier to understand :)
Anyway, I don't see the point of including this in every program you create... Only if you use its funcs it is useful.
Title: Re: Library in Axe
Post by: ZippyDee on May 09, 2011, 11:04:30 am
Yeah, and if you're only using maybe one routine from it, it's most likely a lot more worth it to just take the time to rewrite the whole thing from the library into your program instead of including. It'll save you (and everyone else) a lot of space.
Title: Re: Library in Axe
Post by: aeTIos on May 09, 2011, 11:05:49 am
^^ that. and, if you use something a lot, you should do it in an apart program.
Title: Re: Axe Library : AxeLib7
Post by: zero44 on May 09, 2011, 02:46:00 pm
aeTIos : of course I don't call it in all my programs ! If I don't need it, I don't include it.
It's a library for DCS's graphics, so when I use it, I generally use at least :

•Get/Display cursor
•Display Window

And often :
•Button
•Cursor on a Rect

I my last program usind it (Fritzing on calc), I use almost all functions !

But with a real library, Axe compiles only the code of funcs which are called, doesn't it ?
Title: Re: Axe Library : AxeLib7
Post by: aeTIos on May 09, 2011, 02:47:04 pm
If it was a real lib, yep. but this is more like a subprogram.
Title: Re: Axe Library : AxeLib7
Post by: zero44 on May 09, 2011, 02:58:20 pm
I know it's just a subprogram...
How to make a real lib ?
Title: Re: Axe Library : AxeLib7
Post by: Munchor on May 09, 2011, 03:28:18 pm
aeTIos: This is a library, lots of Labels that can be used by including or not the subprogram and then called is a library.
Title: Re: Axe Library : AxeLib7
Post by: AngelFish on May 09, 2011, 03:31:06 pm
Zero, What you're asking for is something called an Axiom. Unfortunately, Axioms have to be done in ASM. Here are some tutorials on Assembly.

Hot_Dog's z80 ASM beginner's tutorial (http://www.ticalc.org/archives/files/fileinfo/429/42937.html)
ASM in 28 days (http://www.ticalc.org/archives/files/fileinfo/268/26877.html)


Here's the Axiom SDK:
http://ourl.ca/6229 (http://ourl.ca/6229)


EDIT: Scout, a library isn't a collection of labels. It's a collection of routines/macros that are inserted into the code by the compiler. That's what an Axiom is. A subprogram is similar, but it's far more inefficient and the entire program is inserted, whereas libraries typically only have the routines that are used inserted.
Title: Re: Axe Library : AxeLib7
Post by: Quigibo on May 09, 2011, 06:17:20 pm
I think its better to include libraries at the top of the program.  It allows you to do some initialization and then when you're done with that (or don't have any) just add a jump to the end of the library.  Axe cannot auto-detect unused subroutines because it is a single pass parser.  The 2 passes Axe does are actually the same but fill in different parts of the of the code.
Title: Re: Axe Library : AxeLib7
Post by: ZippyDee on May 09, 2011, 06:33:23 pm
I figured that was the case. Too bad. That would be a very useful feature... Also, I hadn't thought about placing it at the top for initializations. Though most things I use don't have anything to initialize...
Title: Re: Axe Library : AxeLib7
Post by: zero44 on May 10, 2011, 07:11:15 am
OK.

Is there somewhere a utorial in frech for axioms ?
And if I do it, how to use it ?
Title: Re: Axe Library : AxeLib7
Post by: Munchor on May 10, 2011, 07:28:09 am
Zero, What you're asking for is something called an Axiom. Unfortunately, Axioms have to be done in ASM. Here are some tutorials on Assembly.

Hot_Dog's z80 ASM beginner's tutorial (http://www.ticalc.org/archives/files/fileinfo/429/42937.html)
ASM in 28 days (http://www.ticalc.org/archives/files/fileinfo/268/26877.html)


Here's the Axiom SDK:
http://ourl.ca/6229 (http://ourl.ca/6229)


EDIT: Scout, a library isn't a collection of labels. It's a collection of routines/macros that are inserted into the code by the compiler. That's what an Axiom is. A subprogram is similar, but it's far more inefficient and the entire program is inserted, whereas libraries typically only have the routines that are used inserted.

Quote
In computer science, a library is a collection of resources used to develop software. These may include subroutines, classes, values or type specifications.
Title: Re: Axe Library : AxeLib7
Post by: Quigibo on May 10, 2011, 01:22:32 pm
That link is outdated for the Axiom SDK.  The current revision can be found in the "Developers" folder that comes with Axe 0.5.1.  This will be a lot harder to write in Asm by the way than it would be in pure Axe and I wouldn't attempt something this complicated unless you have a good asm background.

I think your library is the fine the way it is though.  If you want to make it more memory efficient, you can split it into sub-libraries.  For instance, you can have "LIB7CORE" for the core routines, "LIB7BUT" for all routines pertaining to buttons, and "LIB7WIND" for window routines.  That way, you only need to include the ones you are going to use.
Title: Re: Axe Library : AxeLib7
Post by: aeTIos on May 10, 2011, 02:19:35 pm
Actually, could you give us a way to write libs with AXe?
Title: Re: Axe Library : AxeLib7
Post by: zero44 on May 13, 2011, 02:20:39 am
I saw Awioms SDK, I believe I must write code on a PC, no ?
So I'll give you Axe code of AXELIB7, cause I'll never have enough time on the same computer to do it.  :'(
Title: Re: Axe Library : AxeLib7
Post by: zero44 on May 16, 2011, 03:27:56 am
can someone help me to don't stop it ?
Title: Re: Axe Library : AxeLib7
Post by: DJ Omnimaga on May 16, 2011, 05:34:28 pm
This is the wrong topic to ask questions. You absolutely need to ask directly in a new topic in the Axe Parser help section, else most people will miss your question (since some people never check projects)