Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Quigibo

Pages: 1 ... 5 6 [7] 8 9 ... 135
91
The Axe Parser Project / Re: Axe Parser
« on: January 05, 2012, 07:02:46 am »
Announcement!

I spent several hours today thinking about the logistics, difficulty, and maintainability of creating an "Axe Shell" and then started to code my ideas.  I am pleased to announce that it appears this may become a reality in the next version.  I currently have about half the commands working with more to come.  I will explain some of the logistic problems I faced later.  This will be a beta feature to give me a chance to stabilize potential errors I might have made.  It is not recommended to distribute the executable until it stabilizes.

So first of all, what am I talking about exactly?  Ion, Mirage, and Doors all have a GUI application to act as a shell but Axe does not and I'm not going to add one either.  What I'm referring to, is that instead of copying all the gigantic Axe routines into each program (such as DispGraph, Sprite drawing, Sound, Archive reading, and literally everything non-trivial) the program will use the Axe app itself to find and call the big routines.  This of course loses platform independence in a sense, but so do all the other shells.  This really isn't a shell though, its more of a framework.  Which is why I'm call this the Axe Framework or AXF.  With the bulk gone, this can reduce programs by up to 3000 bytes!  In general, I'm seeing 10-20% reductions in my testing suite. :)

Now for some logistics.  The way it works is that the program gets the standard ion header plus some extra code to locate the Axe app, show the message "Axe Required" if its not found, and do all the necessarily paging.  Its comparable in size to the DCS or App header.  This is both so that I don't have to actually create a shell and its small enough for a header anyway.  But the looming problem is to map the Axe calls to physical addresses in the app.  As I improve and optimize the Axe routines, the addresses will change, causing old executable to need to be recompiled to work.  Normally to fix this, the other shells provide a fixed jump table that then jumps from there to whatever moving code it eventually needs to reach.  But the problem with Axe is that many routines "hijack" other routines to skip parts of code rendering a fixed jump table unusable.  What's worse, the axiom system of replacing absolute and native jumps and calls makes it impossible to execute over it.

To solve both of these, I have a table of subroutine "segments" that have all the code that can be skipped over and then hijack the original routine.  Some routines I do have to make complete or partial copies of, but that's alright.  In those cases, I leave a bit of buffer for future optimizations and changes.  The only other issue I'm worried about is how Axioms will interact with the framework.  Most Axioms should work, but a few really complicated ones could fail if they jump into routines past the entry points.  But that is super hackish anyway.

Some other things on my mind:  I could speed up some routines since the size of the routines no longer matters.  Routines like multiplication are easy to unroll, but others like DispGraph are still limited by the screen driver.  Also, this framework is just as useful to assembly programmers!  I have doubts about how many would actually want to use it though, but nonetheless it is now possible to do that.

Thoughts and suggestions?

92
The Axe Parser Project / Re: Axe Parser
« on: January 04, 2012, 08:46:50 pm »
But Axe would also have to parse the original file to find all the axioms each program uses.  And I mean an actual parse due to the newly added conditional comments.  I could instead require axioms to be at the top of the source but then you would again not be able to use conditional comments on them...

93
The Axe Parser Project / Re: Features Wishlist
« on: January 03, 2012, 02:00:17 am »
I see, so its mostly default options that this affects.  While I disagree that those settings are intuitive defaults in the example tilemapper, I can definitely see situations where it could be useful to provide default settings for options that rarely need changing.  There are several ways to do this:

  • A specific ifdef command
  • A isDefined() command
  • A "Define if undefined" command

I'm guessing the last one would be most convenient for programmers since it's targeted at default values.  One idea for the syntax could be a double store arrow such as 8→→oVar to mean "If Var is not already defined make it 8.  But if it was defined, keep it as it was".

94
The Axe Parser Project / Re: Features Wishlist
« on: January 03, 2012, 12:09:08 am »
I'm not so sure if I want an "IfDef" type command.  What's wrong with just defining a constant as 0 or -1 if its going to be unused?  Other than typing slightly less in some cases, it really doesn't offer an advantage over regular if statements.

The main purpose I can think of is, as I suggested in my original post, Axe libraries. Say you want to write a killer tilemapping library. You may need a bunch of different options to make it really versatile: tile width, tile height, black and white or grayscale, bits per tile, compression scheme, tileset pointer location, map pointer location, read from archive ability, smooth or rough scrolling, custom/variable buffer pointer, animated tile support... the list could go on. Being a true library, it's not proper to edit the library file itself. The user should specify customization settings in their own program.

Without something like an #ifdef, you would have to force the programmer to define a dozen different constants for features they don't need, or don't even know exist. If a new feature was added to the library down the road, their program would instantly be broken because it would need a new constant defined. And including all of these constants in their source would cause unnecessary headaches and source bloat that could be a hundred bytes or more.

But these can still be done without ifdef.  You could have a constant defined as 0 for monochrome, 1 for 3-scale and 2 for 4-scale.  If you are using monochrome you need not define the other constants required for 4-scale such as external buffer locations.  Defines can be inserted into conditional comments as well which can be used to chain them and perform the logic you might need.

Another feature coming next version will be to preprocess more operations on constants than just +-*/^.  These will include all signed/unsigned equality and comparisons, bit operations, and bit checking.  This should make it easier for library writers.

95
The Axe Parser Project / Re: Features Wishlist
« on: January 02, 2012, 07:50:36 pm »
I'm not so sure if I want an "IfDef" type command.  What's wrong with just defining a constant as 0 or -1 if its going to be unused?  Other than typing slightly less in some cases, it really doesn't offer an advantage over regular if statements.

96
TI Z80 / Re: Axe GUI Library
« on: January 02, 2012, 04:27:38 pm »
Has this taken advantage of callbacks yet, given that Axe now has variable function calls?  All modern GUI designs these days are callback-based because it makes the programming simple and minimal.  For those that don't know what I'm talking about.  Suppose you want to create a dialog box with a yes and no option.  You could do something like:

Dilog("Are you sure?",LMYes,LMNo)

This would create a dialog with the text "Are you sure?" and when the "Yes" button is clicked, calls the label MYes and when "No" or cancel is clicked, calls the label MNo.  This is just an example implementation, but I wonder if its similar?

97
Computer Programming / Re: Regex question
« on: January 02, 2012, 06:13:25 am »
Is "\\mystring/" the literal you typed in?  That will search for "\mystring/".  If you are specifically trying to regex out websites, you can try something like "www(\..+)*" for instance.

98
ASM / Re: Constructive and Creative uses of RLD and RRD
« on: January 02, 2012, 06:07:01 am »
Axe uses RRD and RLD for nibble storing.  I've never used them anywhere else, they are definitely very uncommon.  :ninja:

Code: [Select]
;hl = Nth nibble after address $8000
;e = Nibble to store there
NibSto:
scf
rr h
rr l
jr nc,__NibStoHigh
rrd
ld a,e
rld
ret
__NibStoHigh:
rld
ld a,e
rrd
ret
__NibStoEnd:

99
TI Z80 / Re: The Quest RPG: Programming progress
« on: December 21, 2011, 06:15:53 am »
This looks great!

The reason your original code didn't work is because you compiled it to an app.  This means that all data in your program is read-only since the program is put in flash rom.  Now that said, you can still keep your program as an app, but you have to manipulate your levels in ram.

You were on the right track before when you did "Copy(K,L1,714)" to put the level data in ram then make changes like "5->{L1+20}" for instance.  The last statement where you copy it back to rom is not going to work though.  Instead, use "L1" as the pointer when you render the graphics instead of K since L1 holds the correct data with the correct modifications.  If you need L1 for other things though or you need more space than L1 can possibly provide, you can create an appvar in ram any size you want and use that pointer instead.

What Hayleia is talking about is that its generally a good idea to store data to static pointers instead of variables because the code optimizes better and uses less memory.

Also I saw on your Cemetech post that you had Dispgraphr in a loop with getkey.  If you want a better quality grayscale, you should not use the super slow "getkey" command.  Also you should turn interrupts off.  Using the direct getkey(#) is recommended instead.  This gives you consistant timing between frames.  You might even need to add some more pause back in.  I know on hardware the 4 level grayscale is almost completely out of sync if constantly updating unless a small pause is added.

100
TI Z80 / Re: Axe Interpreter
« on: December 20, 2011, 03:36:03 pm »
Wow cool!  If you need any help about how I implement any complicated commands feel free to ask and I can explain :)

101
The Axe Parser Project / Re: Features Wishlist
« on: December 18, 2011, 09:19:17 pm »
That's basically A<<0 which is a highly optimized command to return 1 if its negative and 0 if its positive or zero.  That separates out the negative case.  Then !If A can extract the zero from the remaining case.

But if you need the exact number output, I think this is fairly uncommon so I don't think that a command for it is needed.  But here it is in optimized Axe code: A>=>=0?A?1,,-1

EDIT: The white rectangle thing I guess I can see useful, but each rectangle routine is over 100 bytes, which is much larger than making your own subroutine to do the same thing with the existing commands.  The only time it would be useful from a optimization perspective is if you only use 2 out of the 3 rectangle routines in your entire program at any point, or you are super super pressed for speed because you're drawing hundreds of white rectangles every second.  I will consider adding it though, just be warned it can easily bloat your code more than using the existing commands.

102
TI Z80 / Re: Axe reader..sorta
« on: December 18, 2011, 01:27:21 am »
I think the main thing this would need to be feasible is some awesome compression/decompression.  Otherwise, you won't be able to fit any meaningful amount of words.  I would expect somewhere around 2-3x should be doable with huffman and auto-casing.  Maybe even 4-5x if you map common words to individual bytes.

103
The Axe Parser Project / Re: Assembly Programmers - Help Axe Optimize!
« on: December 17, 2011, 11:39:31 pm »
Wow thanks!  I was considering that, but I assumed the overhead would be large, not smaller!  Thanks!

Also, I could move the labels to the data section of the code to make it even faster!

Code: [Select]
 ld de,-range
  add hl,de
  jr c,default
  add hl,hl
  ld de,jumptable_end
  add hl,de
  ld e,(hl)
  inc hl
  ld d,(hl)
  ex de,hl
  jp (hl)
default:

104
The Axe Parser Project / Re: Axe Parser
« on: December 17, 2011, 11:30:41 pm »
I don't know what you mean by that...  but its just a command that takes label names for its arguments.  The interrupt command also does this: fnInt(LBL,0) for instance.

105
The Axe Parser Project / Re: Axe Parser
« on: December 17, 2011, 11:26:26 pm »
Exactly :)

Pages: 1 ... 5 6 [7] 8 9 ... 135