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

Pages: 1 ... 40 41 [42] 43 44 ... 317
616
TI Z80 / AsmDraw
« on: January 09, 2014, 10:06:03 pm »
I actually made the first version if this program a long time ago, before I became active in the community. I remade it a few nights ago and uploaded it to TICalc, but it basically works like this:

-Give it a list of coordinates and types
-It generates a hex opcode that draws the rectangles with the given coordinates and methods.

It takes input in the form of {x,y,width,height,type} and you can give it multiple rectangles. It does 6 rectangle types, including the typical black/white/invert, using OS bcalls. This is also a BASIC program that generates the opcodes. As well, it tries to optimise the opcode a little, so if there are 8 or more rectangles, it uses a different method of drawing them (generating an array of coordinates/types and reading them, using 29 bytes extra overhead, 4 bytes less for each rectangle).

Anyways, it was useful for me when I was working on BASIC RPGs to make an assembly program that drew a map. The download is below. With so many other tools available now, this type of program is a bit outdated :P

617
TI Z80 / Re: Particle Engine (Buffer Based)
« on: January 09, 2014, 09:55:37 pm »
Thanks! I'm glad my experiment actually worked and looked decent :)

618
TI Z80 / Re: AudaciTI - 4 channel music player and editor (in the works)
« on: January 09, 2014, 09:54:35 pm »
To make sure, you are using x*2^(-1/12), right? I tested that against my code and it gives exactly int(x*2^(-1/12)) for all but the two values mentioned...

619
TI Z80 / Re: Particle Engine (Buffer Based)
« on: January 09, 2014, 09:45:00 pm »
One weird effect of storing all of the particles this way is that you can introduce biases based on the direction you loop through the field.  This probably isn't as much of a problem since you are using some bit tricks instead of simulation each pixel individually.  But I have noticed that for example if you want a lot of stacked particles to fall down, the behavior is very different depending if you loop up through the pixels or down.  If you loop down, each particle in the stack will "get in the way" except for the one at the bottom, and it will take a fair amount of time for them all to start falling, and they will also end up all spread out.  If you loop up however, this effect does not happen, since at each row, the one below it has already been simulated.  Something similar also happens if you have particles randomly moving left or right, they will tend to "drift" in one direction depending on how the looping happens.

Additionally, I would like to know how exactly the bit tricks you used to make the physics fast works?  It sounds quite tricky and awesome.
Yes, that was tricky and I have worked out a method to make it move up, too, as a last priority rule. I would also like to say that the rule set I used was slightly different from the following:
Move down if possible, else choose to move left or right, randomly, else try the other direction, else do nothing.

I did:
Move down if possible, else choose to move left or right randomly, else do nothing.

I could have made it include the other step, but I decided not to for speed and it looks okay ish. The logic I did was to scan from right to left, from bottom to top. First, I OR the byte below what I am interested in with the corresponding byte on the first layer (the graph screen, non-particles). Then I invert that so that 1 bits correspond to empty spaces available for the pixels above to fall into. I AND this mask with the byte above to figure out which pixels can move down. XOR this value onto that byte to erase the particles, OR the value to the row below to draw them a space below.

To move left/right I basically shift the whole row, copying the 12 bytes to OP1, perform the masking, and see which ones may move left/right. However, you can't just go around and try the other direction again because then the pixels you just move will move again. Instead, if you want to keep a copy mask of the newly moved pixels so that when you move the other direction, you can sieve those particles out of the masking process.

To move up, I thought that the fastest way would be to write a copy of all of the unmoved particles to a new buffer, then after doing the down,left/right movements, see if the so-far unmoved pixels can move up applying similar mask logic.

Also, particles on the bottom row are automatically erased at the beginning.


The checkerboard pattern that you see is caused because of moving whole rows at a time in the same direction. If I added the ability to move in the other direction, too, this would be eliminated. If I added the ability for particles to move up as a last option, this would lead to capillary action type effects when the particles get stuck in a tube.

620
TI Z80 / Re: Particle Engine (Buffer Based)
« on: January 09, 2014, 08:00:54 pm »
Hehe, thanks :) I was also thinking of a version that uses a lot more RAM (6144 more bytes) to assign each pixel a velocity for each of 8 directions. Then the particles would move based on the velocity of the air currents. It would be very slow on these calculators since I won't be able to do easy bit tricks, though :[ However this would make it easier for tools such as placing bombs, fans, and other effects. Just place the objects, and the physics do the rest. Maybe on a faster calculator I could do it.

621
Art / Re: Font Contest CSE
« on: January 09, 2014, 07:25:22 pm »
What if somebody makes like a bright yellow-on-white font o.o
I think it might not yield a good score:
  • By February (or when there are 10 entries, whichever comes first), I shall choose the winner based on legibility and stylishness. I will also upload a BASIC program simulating your font and upload it.

622
TI Z80 / Particle Engine (Buffer Based)
« on: January 09, 2014, 02:18:22 pm »
When I was working on the Grammer particle engine, I had an idea that I put to the side. I finally got around to testing it, and it was a bit of a success, so I will share it, even though it isn't a project.

If you have seen the Grammer particle engine, it is fast, but it gets slower as you add more particles. Eventually, after 2048 particles, it still gets almost 6FPS, but hope was that this alternative method would have speed independent of the number of particles on screen.

The trick? Instead of adding particles by pushing them on to a stack-like array of coordinates, I would use something like a graph buffer. In grayscale, we have a front buffer and back buffer. For this, we have a "fixed buffer" and a "particle buffer." When updating the LCD, these two get ORed together to show the particles superimposed on the fixed buffer.

Disadvantage:
You have to scan every pixel on the particle buffer to locate particles and move them accordingly.
Advantage:
-The particle buffer is a fixed 768 bytes and can hold up to 6144 particles (compared to 12288 bytes).
-Updating particles takes about teh same time no matter how many particles there are.
-Adding particles can be done with simple drawing commands since it is just a graphics buffer in disguise.
-Deleting particles is done with the same ease. Deleting individual particles with the other method is very slow, having to search through the buffer to locate the particle with the given coordinates.
-Performing large scale operations on a group of particles is very easy


My goal was to implement a simple rule to move down if possible, or move left/right. This is a standard rule. However, scanning each pixel individually would have been very slow. Instead, I scanned one row of pixels at a time, applying some bit logic to see which pixels can move in a given direction. This turns out to be really effective:

In fact, using a circle as the pen tool and updating the LCD cause the biggest speed bottlenecks. The number of particles on screen does not affect the speed at all since every pixel in the particle buffer is treated as a particle and has all of the transformations performed on it.

I decided to keep the pen tool as it is, but interleaving the particle updating with LCD updating gains some FPS.

Readme:
Run it with the Asm( token.
Use [ON] to exit.
Use arrows to move the cursor.
Use [2nd] to draw on the fixed buffer (makes impassable barriers).
Use [Mode] to draw particles.
Use [Del] to delete from the fixed buffer (deletes barriers).
Use [Y=]+[Up] to increase the radius of the circle.
Use [Y=]+[Down] to decrease the radius of the circle.
Multiple key presses are supported.
The F2-F5 keys shadow [up],[right],[left],[down]
15MHz is automatically set if it is supported by your calculator.
6MHz should still expect ~22FPS according to WabbitEmu.

623
TI Z80 / Re: Calc Coin: A Bitcoin Proof of Concept
« on: January 09, 2014, 11:02:08 am »
  • A finite, pre-calculated number of Bitcoins (and similar Coins) will be produced. The hope for this was to neutralize inflation. The issues here are not relevant to this post, so I won't delve into that.
  • The Bitcoin system keeps a copy of every transaction in its history on every device. Coins can be verified and errors can be corrected. This requires a central station for picking up and sending packets of information.
  • Bitcoins have a very specific, mathematically designed process for each aspect of mining and transferring. The "difficulty level" of obtaining coins is adjusted by changing parameters of an equation. Unlike a game of skill, the problem is designed such that the elegant approaches to the problem still require brute force. This "problem" increases in difficulty by making the signatures more and more secure.

This is going to be pretty difficult to do on the calculators, especially point 2 :P

624
TI Z80 / Re: AudaciTI - 4 channel music player and editor (in the works)
« on: January 09, 2014, 10:35:23 am »
EDIT: This is still buggy, see the next post for a working version, that also rounds.
oh, oops, I forgot to include "sub c" before the "neg", sorry:
Code: [Select]
Asm(444DAF57290929092929092929092917298A2917298A2917298A291791ED446F62)
At the end, before the ED44, there is now a 91. The asm code is:
Code: [Select]
ld b,h
ld c,l
xor a
ld d,a
add hl,hl ;2
add hl,bc ;3
add hl,hl ;6
add hl,bc ;7
add hl,hl ;14
add hl,hl ;28
add hl,hl ;56
add hl,bc ;57
add hl,hl ;114
add hl,hl ;228
add hl,bc ;229
add hl,hl \ rla ;458
add hl,bc \ adc a,d ;459
add hl,hl \ rla ;918
add hl,bc \ adc a,d ;919
add hl,hl \ rla ;1838
add hl,bc \ adc a,d ;1839
add hl,hl \ rla ;3678
sub c
neg
ld l,a
ld h,d
It rounds down, but because of rounding troubles, this is off on two values:
0 returns 255 (-1) instead of 0
196 returns 185, when it should round down to 184 (actual value is like 184.999365...)

196 isn't too much of a problem, but 0 is, so if that is an allowed value, you can fix it with an If statement, or for only four bytes:
Code: [Select]
Asm(7DB72821444DAF57290929092929092929092917298A2917298A2917298A291791ED446F62)

625
HP Calculators / Re: Graph 3D beta update
« on: January 09, 2014, 10:15:21 am »
Wow Han, that is impressive! Do you think complex graphing would be possible, too? Since this would map a complex number to a complex number (CC) it requires 4 dimensions, so typically 3D+color is used. That would be pretty cool for complex analysis:)

626
TI Z80 / Re: AudaciTI - 4 channel music player and editor (in the works)
« on: January 08, 2014, 05:03:42 pm »
I know in IRC you asked about dividing an 8-bit number by the 12th root of 2. I have to rush to work in 9 minutes, so I didn't have time to test or convert to hex, but I think this might work:
Code: [Select]
ld b,h
ld c,l
xor a
ld d,a
add hl,hl ;2
add hl,bc ;3
add hl,hl ;6
add hl,bc ;7
add hl,hl ;14
add hl,hl ;28
add hl,hl ;56
add hl,bc ;57
add hl,hl ;114
add hl,hl ;228
add hl,bc ;229
add hl,hl \ rla ;458
add hl,bc \ adc a,d ;459
add hl,hl \ rla ;918
add hl,bc \ adc a,d ;919
add hl,hl \ rla ;1838
add hl,bc \ adc a,d ;1839
add hl,hl \ rla ;3678
neg
ld l,a
ld h,d
It assumes HL is the input and HL<256 (and also positive).

EDIT: Hopefully no typos or anything missed:
Code: [Select]
Asm(444DAF57290929092929092929092917098A2917098A2917098A2917ED446F62)258 t-states, you can also make it round for a few extra t-states...
EDIT2: 2 days later, I found the typos in the hex code, sorry.

627
TI Z80 / Re: line counter ti83+/ti84
« on: January 05, 2014, 02:33:16 pm »
I know Celtic 3 has a function that can do it and since C3 is built into DoorsCS7, it can do it, too. I've also made programs, like CopyProg that does that among other things. However, these return the number in a variable instead of displaying the number of lines.

One thing that I have done with the tools I mentioned is to make a program viewer. From the code that you currently have, you could make it so that specific lines could be jumped to for viewing, as well as scrolling through the source line by line.

As well, Celtic 3 allows line reading, inserting, overwriting, and deleting. It would be neat if you could think of other functionalities!

628
General Calculator Help / Re: Linux Mountpoint (On Calculator, TI-Nspire)
« on: January 05, 2014, 10:22:26 am »
It is better to ask outside of the intro forum, though. Somebody would have probably suggested that you make another topic to ask :) I hope the answer resolved your problem, though!

629
TI Z80 / Re: CopyProg
« on: January 03, 2014, 09:29:00 am »
Hmm, I feel like I corrected this bug before (I had a typo in the program reading "jp p," instead of "jp pe,". It should work now (see attached)

Thanks for letting me know!

630
TI Z80 / Re: GLIB a graphics axe 3d librairy
« on: January 02, 2014, 10:56:51 am »
Wow, the progress here looks excellent since the last time I checked this out!
:thumbsup:
:thumbsup:

Pages: 1 ... 40 41 [42] 43 44 ... 317