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 ... 45 46 [47] 48 49 ... 317
691
TI Z80 / Projects Update, Zeda
« on: November 07, 2013, 06:53:47 pm »
I haven't had much time to be active lately, but I thought I would update on my long term programming goals.

I am rewriting FileSyst at the moment to have what I see as a more intelligent design. I decided that it would be beneficial to store files and folders in alphabetical order. This would be more aesthetically pleasing and no more difficult than the current method. Currently, I append new files to the end of the folder data, and then since the working directory is stored as an array of addresses, those values must be updated to reflect the changes of addresses, and each folder's size bytes in the path need to be updated. By storing alphabetically, this would still be the case, but I am also going to use an index.

Using the index, I can search for files more quickly. Instead of comparing the name of the files, reading through the header to get to the size bytes, and skipping the file to move to the next (which is already quick enough and similar to how TI searches the VAT), I can be more elegant using a binary search. This means I start halfway in the index, compare the names and then I jump another halved distance either up in the array or down until the halved distance becomes 0. To put this into perspective, if a folder had 128 files, instead of checking through an average of 64 files to locate one, I could instead check at most 7 files before locating the correct one.

I have already written this search routine and it is functional :P

If the file doesn't exist, I create the file by inserting a two-byte address into the index, then inserting the necessary RAM, then adjusting all of the appropriate index values in every folder in the path, and adjusting the size bytes of the folders. (This is only marginally better than the old method, speed wise).

As well, folder paths can be stored by index number, so the addition or deletion of a file will only require 1 byte incremented or decremented in the working directory path.

I have been continuing my work on writing Z80 Floating Point Routines to add to my collection of integer math routines. Currently, the 24-bit floats are the most complete, including addition, subtraction, multiplication, division, square roots, logarithms, and arctangent. The 80-bit floats which are on par with the TI-OS floating point numbers (except with about 5 digits of extended accuracy) have only the basic 4 functions (+-*/).

I am also aware that Grammer 3 should be a powerful programming language and that Grammer 4 should provide a replacement Operating System. FileSyst already contains a pseudo-language for command line functions such as CD(), OPEN(), et cetera. However, it currently does not allow nested functions or the like. I am in the process of rewriting this parser to allow complicated nesting of functions and I redesigned the file system layout with the intent to add variable support. I want to take advantage of the file system to store local variables and global variables, but I want to make it fast and that is why the binary search method sounded like the best option to me. So now imagine that you have a program running called Test.fs and you create a variable. Test.fs will be treated like a folder, too, and the variable will be stored inside it. Now say you wanted to call a subroutine called Func(). Internally, Func will be treated as another program/folder inside Test.fs where it can have its own variables. If it tries to access a variable that doesn't exist in its folder, it will go up a level in the folder system to see if the var exists there, and so on.

My hope is that this proves to be at least on par with the speed of TI-BASIC, if not faster. I imagine this could turn into Grammer 3 or Grammer 4, too.

692
TI-BASIC / Re: How to protect your lists?
« on: November 04, 2013, 03:35:01 pm »
There is basically no protection against knowledgeable TI-BASIC programmers. However, if you think they will be too lazy to check the source code, you could use some kind of checksum method. For example, if the list is always 25 elements of the data, the 26th element could work as the checksum:
Code: [Select]
0→L1(26
sum(L1
Ans-247iPart(Ans/247→L1(26
Then to see if the data has been tampered with:
Code: [Select]
L1(26→A
sum(L1)-A
If A≠(Ans-247iPart(Ans/247
Return

However, that won't prevent a user from incrementing one list element and then decrementing the next. For that, you could do something more complicated like squaring each element, adding 1, then multiplying all of the elements together, modulo 247 and use that to check if the data has been tampered with.

693
TI Z80 / Re: Terminal 4.4.1
« on: November 04, 2013, 03:25:12 pm »
Quote
If there are certain programs that require a shell to be run, an easy way to do this is check if DoorsCS7 is on the calc and have it open the file. It felt kind of like cheating to me when I did that, but it saves a lot of work. of course, you would still have to handle the case of DCS7 not being on the calc
That's a really good idea... IDK though, I want my shell to work as a replacement for DoorsCS and Mirage. Do you think learning ASM is worth it?
If you want to replace those shells, you will end up learning at least a little assembly. MirageOS, ION, DoorsCS7, and others like them not only work as a shell, but they also provide subroutines for assembly programs to use. For example, any MOS programs relying on the ionFastCopy routine (or whatever it is called) will need to have the appropriate jump table at the appropriate address so that the program can function.


694
TI Z80 / Re: Terminal 4.4.1
« on: November 04, 2013, 08:30:18 am »
I think this is actually very cool and I have been checking Omni waiting for updates to this :thumbsup:


If there are certain programs that require a shell to be run, an easy way to do this is check if DoorsCS7 is on the calc and have it open the file. It felt kind of like cheating to me when I did that, but it saves a lot of work. of course, you would still have to handle the case of DCS7 not being on the calc :P

695
Axe / Re: Bullet trig questions
« on: November 03, 2013, 02:31:38 pm »
If you want completely accurate precision that is very fast (at the cost of requiring more RAM), it might actually be more beneficial to store the following information about each bullet:
Code: [Select]
x coord
y coord
width
height
remainder
Each frame, you would do something like the following:
Code: [Select]
for(a=0,#ofbullets-1)
  call AdjustCoords
  pxl-change(x,y)
  x?buf(5*a)
  y?buf(5*a+1)
  w?buf(5*a+2)
  h?buf(5*a+3)
  r?buf(5*a+4)


AdjustCoords:
buf(5*a)?x
buf(5*a+1)?y
buf(5*a+2)?w
buf(5*a+3)?h
buf(5*a+4)?r

pxl-change(x,y)
if remainder >0
  x+1?x
  r-h?r
  return
If remainder=<0
  y+1?y
  r-w?r
  return
Essentially, it makes sure that the bullet stays as close to being on track as it can. If it moves too far in the x direction, it corrects by moving in the y direction. All the while, it adjusts the remainder (if remainder dips below 0, then we know it has moved too far off track and we need to adjust by moving in the y direction.

The pseudocode isn't perfect-- it only accounts for being able to move right or up. You will want to store the x and y directions of the bullets as well. The rest of the data is derived from:


initial (x,y) depends on where the bullet originates
initial (w,h) will remain constant and comes from subtracting the enemy objects coordinates from the bullet origin coordinates. If these are positive, then direction will be 1 for the given direction. If either is negative, direction needs to be set as -1 and then you need to make it positive with abs().
initial remainder should be set as w
Finally, (w,h) needs to be readjusted by multiplying them by 2.

(in non-integer arithmetic, we would just set initial remainder as w/2, but we would lose accuracy in integers if w was odd, so we just use w and then double width and height)


An increment, add/subtract and compare is much faster than computing arctangent, multiplying/dividing and using sin() or cos(). It also does not require inflated pixels, but it can work just fine with them, too. I have vague memories of doing something like this over the summer that got hundreds of bullets on screen at 6MHz. I'll try to find it and edit this post.


EDIT: Oh, it was actually an old topic that you posted in, but for a refresher: http://ourl.ca/19321/356834

696
TI Z80 / Re: Tunnel - by ClrDraw
« on: November 03, 2013, 01:18:32 pm »
Internally, the calculator stores the screen buffer as a 768 byte array. Each byte corresponds to 8 pixels (8 bits per byte) and the screen is horizontally aligned, meaning the first 12 bytes (96 pixels) correspond to the top row and it works down the screen from there.

To scroll the screen down or up, we only need to shift 12 bytes which is pretty easy to do-- there is an instruction that lets us copy a number of bytes from one location to another, removing a lot of overhead code.

To scroll the screen left or right, we need to shift by 1 pixel and there is no easy instruction to do that. In fact rotating or shifting bits requires an extension of the instruction set, which makes it even slower to rotate by bits. (shifting by 8 pixels left or right is much easier as that becomes once again, shifting the buffer by a byte, which is easy)


697
TI Z80 / Re: Tunnel - by ClrDraw
« on: November 03, 2013, 01:04:56 pm »
It is indeed :) Here, check this out and click the little button thing at the bottom to show speed/size for various outputs.

It turns out my estimates were off, though, and it is actually even faster than I predicted :P

698
TI Z80 / Re: Tunnel - by ClrDraw
« on: November 03, 2013, 09:48:15 am »
Scrolling up/down might actually be about 60% faster than left/right, too. (about 16000 clock cycles versus about 26000).

699
Math and Science / Re: Estimating ArcTangent
« on: October 31, 2013, 01:10:42 pm »
Between yesterday and this morning, I have formulated a more sound process for coming up with these formulas. For more information, I made a document here. (I am still modifying it and checking it for accuracy, otherwise, I would upload it, too).

As a result of yesterday's ventures, I managed to avoid the guess 'n check method and derive a formula for 13-bits of accuracy. It only requires one more multiplication, too:

(240x+115x3)/(240+195x2+17x4)

However, this is less suitable when using 8.8 fixed point math than the previous (then again, if you are using 8.8 fixed point, you probably won't need 13-bits of accuracy).

700
Miscellaneous / Re: FOR THE LAST <snip> TIME, I AM NOT ADMIN ANYMORE!
« on: October 30, 2013, 12:11:03 am »
Oh, I meant, "more than the other three combined."
But yeah, you and Eeems have the most, followed by Deep at 14, Angelfish at 7, and Netham at 2.

701
Other Calculators / Re: irrational rationals
« on: October 30, 2013, 12:09:33 am »
It didn't do anything adverse for me ... What apps do you have installed?

702
TI Z80 / Re: Terminal 4.4.1
« on: October 29, 2013, 10:47:24 pm »
Free archive is a bit more difficult to assess. I've never actually written a decent routine but it would require looping through archive, noting variables marked for deletion, and then writing a routine to display 23-bit numbers

703
Miscellaneous / Re: FOR THE LAST <snip> TIME, I AM NOT ADMIN ANYMORE!
« on: October 29, 2013, 10:41:25 pm »
Now that I have had more time to think, I would like to point out that of the 5 admins, they have made 147 posts in the past 2 months and two of them made more than twice the posts of the other two combined.
DJ_Omnimaga made 822 posts.

On other forums that I have been a part of, there are usually at least to or three very active admins and admins are among the most active users. Currently two of the admins are pretty active on the forums (and so would be more noticeable to users that cannot access IRC), so that is good, but DJ_Omnimaga is by far the most active/experienced member on the site.

704
Miscellaneous / Re: FOR THE LAST <snip> TIME, I AM NOT ADMIN ANYMORE!
« on: October 29, 2013, 12:49:40 pm »
Hmm, good point DJ_O. Sometimes it bugs me when I am on break and I am looking for somthing to snack on and a somebody comes up to me with questions. A way to switch to 'plain clothes mode' would be useful on the internet. Maybe a little sprite could be used specifically for this ?

705
Other Calc-Related Projects and Ideas / Re: Open Sprite Library
« on: October 29, 2013, 11:59:34 am »
PixelScape Does some of that, so maybe you could propose something like this to Deep Thought who I believe worked on Omnimaga's new image uploader, too. Maybe he could allow users to upload images that included tags to the repository, then have PixelScape be able to search the repository (as well as anybody on Omnimaga looking for images in the uploader), then the user could click the one they want and options for copy/pasting it to the editor, or directly reading it in some format for source code.

Pages: 1 ... 45 46 [47] 48 49 ... 317