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 - Runer112

Pages: 1 ... 104 105 [106] 107 108 ... 153
1576
The Axe Parser Project / Re: Features Wishlist
« on: December 22, 2010, 10:21:48 pm »
Awesome! While you're at it, any chance for white/inverted lines? I wouldn't mind if it requires a whole new routine for each, it would be worth it.

1577
The Axe Parser Project / Re: Features Wishlist
« on: December 22, 2010, 07:14:22 pm »
Feature Request:  Double buffer.
Code: DisplayGraphrrr
description.  It will display both buffers but as black not as black and gray.

What kind of uses would this feature have? I can picture what it would do, but I can't seem to picture how it would be used in a program. Can someone give me some examples?

1578
The Axe Parser Project / Re: Features Wishlist
« on: December 21, 2010, 10:38:55 pm »
Most programs are decreasing in size by about 1% which is actually pretty significant for not having to do anything at all to your existing programs.  The new optimizations are mostly with comparisons (both signed and unsigned) and equalities.

;D

1579
TI Z80 / Re: Pokemon RPG: the forgotten quest
« on: December 21, 2010, 05:09:05 pm »
aeTIos, did you ever see the last post I made in your 24*24 sprites thread? If you're content with copying the sprite without clipping to byte boundaries on the buffer, then that's the most optimized code I could get. One code section is optimized for size, the other for speed.

1580
The Axe Parser Project / Re: Assembly Programmers - Help Axe Optimize!
« on: December 20, 2010, 08:03:06 pm »
There's really no reason to make an alternate version. Users would most likely learn about these new commands from the updates thread or by looking in the commands list, and Quigibo can add warnings to both of those.

1581
The Axe Parser Project / Re: Assembly Programmers - Help Axe Optimize!
« on: December 20, 2010, 06:45:47 pm »
I realize that the stack can be very dangerous, as one push without a pop and you can say goodbye to the contents of your RAM. But the stack is also one of the most powerful programming tools present on the calculator. As long as you added warnings not to use the stack commands unless users know how the stack functions, I think it would be a very nice addition. And I would be happy to write an addition to the documentation about stack usage so users who aren't familiar with stacks could learn their power. ;)

1582
The Axe Parser Project / Re: Assembly Programmers - Help Axe Optimize!
« on: December 20, 2010, 06:34:04 pm »
The more assembly instructions available, the more you could optimize programs. But I don't want Axe to just turn into an assembly compiler with a 16-bit math engine and some other pre-built structures on the side. If you want that, you probably know assembly anyways and could just write your program in assembly and grab some of Axe's routines.

However, three instructions that I believe would complement Axe very well without defeating the purpose of its hl-based system are the ex de,hl, push hl, and pop hl instructions.

Quigibo had toyed with the idea of implementing the ex de,hl instruction before, allowing it to be called with either →π or π. They would do the same thing, but it would be a more familiar syntax for programmers used to a variable system in which storing and recalling values are different instructions. And/or he could implement the instruction as the Exch() command with no arguments.

Although there would definitely need to be a warning to only use push and pop if you know how stacks work and know what you're doing, those would be pretty helpful I think. Maybe push hl could be StoreGDB and pop hl could be RecallGDB .


In case Quigibo is reading this, any chance of these happening?

1583
The Axe Parser Project / Re: Assembly Programmers - Help Axe Optimize!
« on: December 20, 2010, 05:57:40 pm »
These will decrease size, but also slightly decrease speed. I believe that Quigibo prefers smaller sizes over slightly slower code.

1584
The Axe Parser Project / Re: Assembly Programmers - Help Axe Optimize!
« on: December 20, 2010, 05:42:17 pm »
A few more equality checking optimizations. Not sure why I didn't see these before.

Code: (Current code) [Select]
p_NEN3:
.db 10
inc hl
inc hl
inc hl
ld a,l
or h
jr z,$+5
ld hl,1
p_NEN2:
.db 9
inc hl
inc hl
ld a,l
or h
jr z,$+5
ld hl,1
p_NEN1:
.db 8
inc hl
ld a,l
or h
jr z,$+5
ld hl,1

       
Code: (Optimized code) [Select]
p_NEN3:
.db 9
inc l
inc l
ld a,l
and h
add a,1
sbc hl,hl
inc hl
p_NEN2:
.db 8
inc l
ld a,l
and h
add a,1
sbc hl,hl
inc hl
p_NEN1:
.db 7
ld a,l
and h
add a,1
sbc hl,hl
inc hl


1585
Axe / Re: Routines
« on: December 20, 2010, 12:53:09 am »
That would definitely be possible for the addition and subtraction routines, but I don't know how that would work with the decimal display routine. It works by having all the multiples of 10 that can fit in the data size you're using hardcoded into the routine. I could hardcode the multiples of 10 up to a very high amount and just hope the user doesn't exceed it, although that would probably be a bit wasteful, as I doubt most people would require most of the excess data.

But it's possible. Want me to try it?


Note: That question was pretty much rhetorical, because now I want to try this anyway. ;)

1586
Axe / Re: Routines
« on: December 19, 2010, 10:56:20 pm »
Yes and yes. The arguments should be pointers to where you store the values, not the actual values, because the actual values wouldn't fit in Axe's 2-byte value system. For instance, if you had a 4-byte number spanning variables A-B in memory and a 4-byte number spanning variables C-D, you could add the two values and store the result in A-B like so:
Code: [Select]
sub(ADD,°C,°A,)(Note the trick employed here. You can do this if you are adding two values and storing the result back into one of the values. Enter the pointer to the value that should serve as both an argument and the answer as the second argument and then leave the third argument blank.)

The display routines can display any number that you can fit in the 3 or 4 bytes of data: 0-16777215 for the 3-byte library and 0-4294967295 for the 4-byte library.



EDIT: Here's a little program I whipped up using the 4-byte library, showing its capabilities. It pases 65536 with ease, but unfortunately it can only go up to about 4 billion. ;) You might recognize the pattern...
(Note that the actual routines run a lot faster than this, I manually set it to iterate only twice per second)

You can look at the source for an example of how to use the commands.

1587
Axe / Re: Routines
« on: December 19, 2010, 10:43:15 pm »
FinaleTI was wondering how he could do some basic operations on 3-byte numbers, namely addition, subtraction, and decimal display. It took me a while to get it all working, but I wrote an Axe library to do all of the above. And while I was at it, because it would only require minor modifications to this code, I wrote a similar library to perform those three operations on 4-byte numbers. No longer shall Axe be limited to 2 bytes! (At least regarding addition, subtraction, and decimal display)

Anyways, the two libraries are very similar. They accept inputs in the form of pointers to the 3- or 4-byte numbers you want to operate on and have the same three functions:
  • Addition: sub(ADD,Pointer to first argument, Pointer to second argument, Pointer to store answer to)
  • Subtraction: sub(SUB, Pointer to first argument, Pointer to second argument, Pointer to store answer to)
  • Decimal display: Disp Pointer to number to display sub(DEC) - Note that this does not return a string of a fixed length padded on the left with spaces like the usual Disp ►Dec. The string returned has any leading zeros clipped and consists only of the number itself.


To include the library in your program, have the library you want present on your calculator and insert a line reading ":prgmLIB3BYTE" or ":prgmLIB4BYTE" in the subroutine section of your code. The syntax for the commands is also included as comments under each function in the library source files, so you can look there if you need a refresher.


NOTE: The decimal display routine uses OP4-OP5 for scratch memory and OP6 to store the resulting string, so if you're wondering why any data you store there is mysteriously being corrupted, that's why.


EDIT: I just realized there was a slight flaw with my code. But I fixed it and reuploaded the two libraries before anyone could download them (I think). That's why the "by Runer112" is on the end of the filenames, I wasn't sure what else to add.

1588
Axe / Re: 3 byte vars?
« on: December 19, 2010, 08:22:36 pm »
I'm guessing you would want the values displayed in their base-10 representations, but how would you want the resulting strings to be formatted? Would you want them:
  • Right-aligned in a block of 8 characters, padded with spaces? Like: "   12345"
  • Or would you want the string to have variable length with the leading zeros/spaces cut away? Like: "12345"




EDIT:

I went ahead under the assumption that you would want the second option. So I wrote up an Axe library that has everything you need: 3-byte addition, 3-byte subtraction, and 3-byte decimal display. The whole thing is somewhat large (371 bytes), but I optimized it as much as I could.

And since it isn't that much more of an extension, I also made an Axe library that has routines for 4-byte addition, subtraction, and decimal display (407 bytes). I figure even if you don't end up wanting it, I'm sure it could be very handy for other Axe programmers. I know at least a few others have actually made threads asking about using 4-byte numbers before.

Because this turned out to be a pretty nice tool for Axe programmers in general, I posted it in the Routines thread. You can find the post and download the library/libraries you want here.

1589
Axe / Re: 3 byte vars?
« on: December 19, 2010, 06:54:46 pm »
An earlier thread asked how to do this too, so I have a bit of knowledge regarding this already. The following routines all accept inputs in the form of:
sub(___, Pointer to first argument, Pointer to second argument, Pointer to store answer to)

This routine adds 2 4-byte numbers and stores the result to another 4-byte number:
Code: (4-byte addition) [Select]
:Lbl ADD
:{r₁}ʳ→r₅+{r₂}ʳ→r₄
:<r₅+{r₁+2}ʳ+{r₂+2}ʳ
:→{r₄→{r₃}ʳ+1}ʳ
:Return

Here is a slightly modified version to work with 3-byte numbers instead:
Code: (3-byte addition) [Select]
:Lbl ADD
:{r₁}ʳ→r₅+{r₂}ʳ→r₄
:<r₅+{r₁+2}+{r₂+2}
:→{r₄→{r₃}ʳ+1}
:Return


And here are their subtraction counterparts:
Code: (4-byte subtraction) [Select]
:Lbl SUB
:{r₁}ʳ→r₄≥({r₂}ʳ→r₅)
:-1+{r₁+2}ʳ+{r₂+2}ʳ
:→{r₄-r₅→{r₃}ʳ+1}ʳ
:Return

Code: (3-byte subtraction) [Select]
:Lbl SUB
:{r₁}ʳ→r₄≥({r₂}ʳ→r₅)
:-1+{r₁+2}-{r₂+2}
:→{r₄-r₅→{r₃}ʳ+1}
:Return

1590
Axe / Re: Full Normal Slow?
« on: December 18, 2010, 04:26:56 pm »
You can use Stop to halt execution until the next interrupt occurs. This is how the OS always operates when waiting for the user to direct input, as it saves power.

Pages: 1 ... 104 105 [106] 107 108 ... 153