Author Topic: FileSyst  (Read 18823 times)

0 Members and 1 Guest are viewing this topic.

Offline Xeda112358

  • they/them
  • Moderator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 4704
  • Rating: +719/-6
  • Calc-u-lator, do doo doo do do do.
    • View Profile
Re: FileSyst
« Reply #60 on: January 11, 2014, 01:22:53 pm »
I am one step closer to making a calculator OS.

This isn't a FileSyst update, but rather an allusion to what will hopefully come in the future.

Today I worked on putting together the basics of YAI (Yet Another Interpreter), but with more goals in mind, specifically working with variables. I am trying to put together a multiply command as a proof of concept, and it is not done. The parser currently does all of the following:

- It uses a GDB var for RAM storage (instead of an Appvar)
- It parses the input string by checking if it is a number or letter to start. If it is a number, it converts the number either to an integer or to a float (the float conversion isn't working yet). If it is a letter, it searches the built in command list using a binary search, allowing alphanumeric values (uppercase, lowercase, and numbers). If no match is found, it searches user defined variables and functions.
- Integers are arbitrary precision, up to 2040 bits.
- The GDB variable holds a stack for intermediate calculation and for general purpose (similar to the OS floating point stack), followed by an index for the variables, which are stored alphabetically

Because memory management is going to be so dynamic, I made a custom InsertMem/DelMem routine to update all appropriate pointers and the size of the GDB var. I made a PushAnsStack and PopScratch routine which is used by the parser when parsing inputs an outputs to functions. These use the custom insertmem/delmem routine, of course.

I tried to make my current system easy for me to work with, I am trying to get the biggest hurdles out of the way first, but I still need to write the floating point conversion routines (string→float, float→string). After this, making the commands should be much easier.

As it currently is, I can get right in and start making integer routines. I also have code ready for lists, arrays, and string variable types. I have not yet added creating and storing to variables, but reading from them should work. I only just finished all of the memory management, so the rest will be for the next time I get a few days off from work :P

For an example, I have put together an integer multiplication routine. The interface isn't the best, but for testing, it works okay. It shows using the MUL() command for multiplying integers. I put the code in prgmTEST and then the app "Interpre" reads prgmTEST and executes whatever is inside. Once it is finished, it passes the last result into Ans as a string.

Offline Xeda112358

  • they/them
  • Moderator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 4704
  • Rating: +719/-6
  • Calc-u-lator, do doo doo do do do.
    • View Profile
Re: FileSyst
« Reply #61 on: January 16, 2014, 02:19:19 pm »
I haven't merged this with FileSyst yet, but I am making some more progress. Last night I finally added the Str->Float routine, so now floats can be used. The way I am handling floats is by satisfying the following two conditions by default:
-There must be at least 32 bits of precision for the fractional part of the number.
-There must be at least a total of 128 bits of precision.

So for example, if you have a number whose integer part is already 112 bits before the decimal point is encountered, it will allocate 32 bits more for the decimal part making 144 bits.

For math, I only have multiplication. I have int_times_int and float_times_float, but I still need int_times_string and int_times_float and once I add in arrays and lists, I will need to accommodate for those. The way I handle precision with multiplication is by using the size of the highest precision input. So if one float was 128 bits and the other was 144, it would output a 144-bit number. I plan to make a command to modify the accuracy and size of floats.

I actually still need to complete one other part of the floating point code, and that is to handle negative exponents. I am sure I will get to it some time. Aside from floats, I have some variable support. You can make a var from scratch, but I didn't add in the code for updating a var with new data. That should be done easily enough.

I have a few commands that I added for testing purposes. Those are XORSPRITE(), UPDATELCD() and WAIT(). They work :) The way I have coded this interpreter should make it easy to incorporate a file system. I was already rewriting FileSyst to incorporate features I am using here (like an indexed binary search for files and folders) so I will probably merge the two.

Offline Matrefeytontias

  • Axe roxxor (kinda)
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1982
  • Rating: +310/-12
  • Axe roxxor
    • View Profile
    • RMV Pixel Engineers
Re: FileSyst
« Reply #62 on: January 16, 2014, 02:23:29 pm »
Wow ... This is more and more awesome :D by the way, why are there G and H letters in the sprite ?

Offline Xeda112358

  • they/them
  • Moderator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 4704
  • Rating: +719/-6
  • Calc-u-lator, do doo doo do do do.
    • View Profile
Re: FileSyst
« Reply #63 on: January 16, 2014, 02:29:21 pm »
The sprite isn't hexadecimal. I was just using a simple sprite. I don't have a "hex2bin" command yet. Also, I don't have the sprite variable type defined yet, so I had to cheat by using a string. The two empty spaces are just padding where the sprite width or height would be.

Also, I should point out that the float->str command is not finished (as seen in the screenshots). It only converts the integer part. However, it is actually storing the decimal part.

Offline chickendude

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 817
  • Rating: +90/-1
  • Pro-Riot Squad
    • View Profile
Re: FileSyst
« Reply #64 on: January 16, 2014, 02:43:09 pm »
Wow, that's great! Will be seeing a full-fledged OS one of these days?

Offline Eiyeron

  • Urist McEiyolobster
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1430
  • Rating: +130/-10
  • (-_(//));
    • View Profile
    • Rétro-Actif : Rétro/Prog/Blog
Re: FileSyst
« Reply #65 on: January 16, 2014, 03:10:34 pm »
Are there any hooks can be reached with some Axe? I'd like to test it by doing a graphical wrapper.

Offline Xeda112358

  • they/them
  • Moderator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 4704
  • Rating: +719/-6
  • Calc-u-lator, do doo doo do do do.
    • View Profile
Re: FileSyst
« Reply #66 on: January 16, 2014, 03:21:21 pm »
I don't think I will ever finish writing an OS, but I am trying to get a lot of the key components done. Of the related things I have done that I would like to bring all together:
-EnG which was never finished, but provided a very simple file system spanning the extra RAM pages (detecting whether there were 1 or more RAM pages).
-Grammer as a simple interpreted language.
-FileSyst which exposes a file system and related housekeeping commands.

Offline Eiyeron

  • Urist McEiyolobster
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1430
  • Rating: +130/-10
  • (-_(//));
    • View Profile
    • Rétro-Actif : Rétro/Prog/Blog
Re: FileSyst
« Reply #67 on: January 16, 2014, 03:25:19 pm »
Xeda, are they viable for a full-fledged OS?

Offline Xeda112358

  • they/them
  • Moderator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 4704
  • Rating: +719/-6
  • Calc-u-lator, do doo doo do do do.
    • View Profile
Re: FileSyst
« Reply #68 on: January 16, 2014, 03:38:24 pm »
Are there any hooks can be reached with some Axe? I'd like to test it by doing a graphical wrapper.
Are you talking about the latest side project or FileSyst? FileSyst does have a jump table to handle a bunch of things. LangZ80 does not have one yet, but I can easily add in some jumps to the parser and a few of the routines. I have it so that it really can take HL as the location of the code, BC as the size of the code, and it does the interpreting from there. I also have a routine that converts the output to a 16-bit integer instead of a string, and I can make a call that reads from a 0-terminated string (like Axe uses) so you could do something like this in Axe:
Code: [Select]
LANG("VAR1")→A
And then it would either return a pointer to VAR1 if it is a string, or it would return int(VAR1) for Axe.
Xeda, are they viable for a full-fledged OS?
If I understand correctly, yes, these routines are currently adequate as a calculator. It defaults to a precision of 128 bits for floating point math (the TI-OS uses <48 bits) so it is much more accurate, and integers are arbitrary precision, up to 2040-bits (614 digits). I plan to add a few more variable types, including Sprite, Array, and List. As well, custom variable types so that types like Complex, Complex List, Complex Array, Matrix, can be made from these.