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

Pages: 1 ... 54 55 [56] 57 58 ... 82
826
TI-BASIC / Re: Run-Length Encoding for Strings
« on: August 25, 2010, 06:24:11 pm »
looks nice (:

just thought i'd comment that the Equ>String() command is entirely useless.
Code: [Select]
Equâ–ºString(Y1,Str4
is one byte larger than
Code: [Select]
Y1->Str1

and they're the exact same speed. they actually use the same routines. equ>string is completely useless.

827
Miscellaneous / Re: internet quotes
« on: August 21, 2010, 11:50:06 pm »

Possibly offensive - read with caution

[Thread about the existence of God]
Person 1: Someone prove to me that God exists.
Person 2: [Post quoting the bible]
Person 1: You know, I looked that up, and all I found was a book written 3,000 years ago by a bunch of sheepherders.  Can you get a better source?


828
Hold on, I hate to be the one saying this, but it's a calculator.  What real good would an SD card have for math?  I don't even think that it would be that useful outside of math, either.  It's an unnecessary expense for both us and the consumer.

I agree completely

829
i agree with ztrumpet. when sorting the files, maybe have both a function to sort by genre and also an option to sort by language? it may be helpful for someone who wants to learn basic/axe/asm and is looking for quality source code to learn from.

830
The Axe Parser Project / Re: Axe Parser
« on: August 18, 2010, 12:19:26 pm »
minor question.

which is faster, pxl-Test(X,Y) or this:
Code: [Select]
.eulers 'e'
{Y*12+(X/8)+L6} e X^8

831
Axe / Re: hexadecimal conversion
« on: August 18, 2010, 12:14:59 pm »
That sounds exactly like my sprite editor. :P But thanks for reminding me about it, I should work on it a bit more.

cause i like real-time hex display (:

By the way, would a >Hex command be useful?  I already have a >Dec, >Char, and >Tok so in a similar way I can add a >Hex.  There is even a really cool optimization for it that uses the daa instruction which is something I've never used but always wanted to.


yesssss. do it.

qwerty: here's a very commented version of the code.
Code: [Select]
GetCalc("Str1",16)->I       
.GetCalc() is used to write to external variables. it reads "Str1" and locates the OS variable Str1
.It then makes Str1 16 bytes (which is equivalent to 16 characters) long.
.Storing this to pointer "I" will allow us to read and write to the data currently in OS var Str1.
For(P,0,15      .
.Loop through 16 times, as an 8x8 sprite has 16 hex characters
0->C   
.A holder variable, to get each value of the hex string. a better explanation below.
For(T,0,3       
.there are 4 pixels needed to test to determine. why 4 pixels?
.because a hex character can hold values 0-F, or 0-15.
.if you take 4 pixels as a binary string of 0's and 1's, the highest value
.possible is 16, or 2^4.
e^(3-T)*pxl-Test(P^2*4+T,P/2)+C->C
.This is tricky. first, the correct power of two is calculated. e^(3-T)
.which returns either a 8, 4, 2, or 1 depending on the value of T.
.pxl-Test() returns a 1 or a 0. if there's no pixel, the value won't be added.
.If there's a pixel, e^(3-T) will be multiplied by 1, added to C giving the value of the half-byte.
.P^2*4+T,P/2 is some arithmetic explained below.
End
{"0123456789ABCDEF"+C}->{I+P} 
.the part in quotation marks is 16 characters long. this means it's 16 bytes long.
.the curly {} brackets get the byte (in this case, a character) at a pointer.
."0123456789ABCDEF" is a pointer, and so is the variable C.
.Since C contains the value of the halfbyte, when you add the part in quotations to C,
.you get the corresponding character in the string to the value of the half-byte.
.Remember how I points to our OS var Str1? now it's storing our hex character
.into the string. P shifts the characters along the string.
End

alright. a little spiel about hex, binary and hex characters:

0111. this is a binary string. each value is either 1 or 0. to get the value in decimal, you start at the very rightmost bit (a bit is a 1 or a 0). the rightmost bit is 1. add 1 to your running total. then go left, to the next bit. the bit is also 1. however, binary and the powers of two are very related. this bit is worth 2. add two to the running total, you get 3. the next bit is also a one. this bit is worth 4. add it to your total, and you get 7. the next bit is 0 and therefore doesn't contribute. 0111binary = 7 decimal. 1111 = 15 decimal, because the last bit is worth 8 in decimal.

binary's pretty simple. you start at the rightmost bit, and count that as "1", multiply it by two and that's the value of the next bit, etc.

so try to decipher 01100101.
start from the right. you get 1+0+4+0+0+32+64+0 = 101.
some terms: 1 bit is either a 1 or a 0. a byte is 8 bits long. therefore, a half-byte is 4 bits long. a half-byte is also called a "nibble".
a hex character is 0-F, and therefore can hold 16 values. a half-byte can also hold 16 different values. general rule: 2^(# of bits) = numbers of possible values that can be held.

whew. alright... last thing. the arithmetic. (P^2*4+T,P/2).
the first expression is P^2*4+T.  P^2 is P modulus two, or the remainder after division. therefore, P^2 can either return a 1 or a 0. this is to determine which half-byte we're testing, the first or second? if it's the first, P^2 returns a 0, and multiplied by 4 does nothing and the pxl-Test() is determined by the value of T. otherwise, it adds four, and tests the second half-byte.
P/2 is rather simple, but it's a little neat that axe drops decimal points.
since P holds values 0-15 in the for loop, P/2 will return the following:
0 0 1 1 2 2 3 3 4 4 5 5 6 6 7 7.
this way, the Y coordinating of the Pxl-Test is the same for two iterations of the For() loop, so we can get both Half-bytes in the row of the sprite.

hope that makes some sense.. i kinda got carried away, maybe, probably

832
The Axe Parser Project / Re: Features Wishlist
« on: August 18, 2010, 12:55:11 am »
Cagliano, what sort of input are you looking for? there's a topic under the axe parser subforum i made that has some code that accepts numbers 0-65535, unless you need string and list support.

also, i'm still begging for a pxl-swap() command. i know it can be implemented easily, but i think some pretty neat effects could be achieved with it.

833
Axe / Re: hexadecimal conversion
« on: August 18, 2010, 12:50:07 am »
qwerty, may i suggest real-time hex display? the hex routine i wrote in this thread would take a few seconds to execute under TI-Basic, but with Axe it's not even humanly noticeable. maybe you could get hex to display every time you change a pixel on the screen? if you do this, you'll find flipping/rotating much easier, since you can then use the built-in functions for it.

834
Axe / Re: hexadecimal conversion
« on: August 18, 2010, 12:33:01 am »
yeah, you can do that same thing with any data, aka map data, sprite data, etc. in axe, they're all just numbers.

go for it. by the way, what features are you looking to implement?

835
Axe / Re: hexadecimal conversion
« on: August 18, 2010, 12:26:46 am »
got you there, meishe (:

by the way, the BASIC version i linked to probably shouldn't be used if speed is important. it's slow. i think i timed it at 3 seconds, and it's about 92 bytes. then i clocked one that was about 120 bytes but it was twice as fast.

836
Axe / Re: hexadecimal conversion
« on: August 18, 2010, 12:16:14 am »
axe has loads of support for strings. you can load strings. you can manipulate their data directly. you can even export them to OS variable strings! what other support were you looking for?

lastly, here's some code. assume the x and y position of the sprite is 0.
Code: [Select]
GetCalc("Str1",16)->I       .I points to the start of the data at Str1
For(P,0,15      .16 half-bytes
0->C   .Counter
For(T,0,3       .4 pixels per half byte.
e^(3-T)*pxl-Test(P^2*4+T,P/2)+C->C
End
{"0123456789ABCDEF"+C}->{I+P}  .store corresponding hex character into
End

i think this is the most optimized way, though i'm not sure. your sprite data is in str1.

an extremely optimized version in BASIC by yours truly can be found in this thread.

837
Computer Programming / Brainfuck Programs
« on: August 16, 2010, 12:40:17 am »
Brainfuck has become my new hobby. my average number of migraines per minute has skyrocketed. anyway, i decided i'd share some of my programs if anyone's interested. i'll edit in more as i go. if you program in brainfuck and want to add in a few, i'd gladly post them and give credit.

Addition
Code: [Select]
adds the first memory slot to the second
,>,<[>+<-]

Addition
Code: [Select]
adds the first memory slot to the second outputs the answer
,>,<[>+<-]>>++++++[<-------->-]<.

Subtraction
Code: [Select]
subtracts the second memory slot from the first
,>,[<->-]<.


i'll definitely add more later as i become familiar with the language

838
The Axe Parser Project / Re: Axe Compiler troubles
« on: August 15, 2010, 10:46:04 pm »
has anyone made an input routine though?

Yes

839
Axe / Re: Project Snake X - help
« on: August 15, 2010, 09:19:44 pm »
whenever i make a repeat, while, if, or for statement, i enter in a few lines and add the corresponding End statement. that way i never get an Err:Block.

840
Axe / Re: Project Snake X - help
« on: August 15, 2010, 09:14:56 pm »
sorry for straightening your code.. i hate indented code. even in computer languages it bothers me when it's indented with brackets.

Pages: 1 ... 54 55 [56] 57 58 ... 82