+ Reply to Thread
Page 1 of 2 1 2 LastLast
Results 1 to 10 of 17

Thread: BulkOS > Oh gosh.

  1. #1
    E2 Zombine
    Filipe will become famous soon enough Filipe will become famous soon enough Filipe's Avatar
    Join Date
    Jun 2007
    Location
    Portugal - Lisbon
    Posts
    301
    Blog Entries
    1

    Default BulkOS > Oh gosh.

    BulkOS
    version 2


    I've been slowly venturing into OS design, now, before I proceed, I'd like to state very clearly that I don't really know anything on the subject, and I'm sure alot of people here will frown at the way I've made this, but it was a fun project, one that I'm going to build on, and I'll probably be back in a week or so with something just a little bit better.


    Features:
    BulkOS's core is at it's two memories, a table and an array, the memory can be looked as a sort of RAM, while the table is a filesystem. All operations involve manipulating this data to achieve a goal, but I'll detail this further down. Alongside the memories there is the debugging console, which handles (in a slim 5 or 6 lines) the visual output, allowing me to easily call it anywhere in the code, it's really pretty basic stuff. On top of that is the action stack...now, I did not implement this action stack right from the start, and if you look at the code you'll see that certain functions bypass it completely (I've already seen some effects of this on the OS, but nothing major), the action stack is not much more than a buffer that runs the commands through the interpreter in the order they arrive.


    For organization's sake (I'm already confusing myself by now), here's a neat feature list:
    • Number and String support for most functions where applicable.
    • Robust debugging console that takes care of most of the heavy lifting, including multi-line support.
    • Keyboard and chat input.
    • 4 OUT and 4 IN ports allow interface with other systems and contraptions.
    • 'Network' functions allow wireless communication through global variables.
    • File functions, load, read, write or append.
    • Persistant file-system.
    • Ability to save program-specific memory sets, with their own name (saved as slots in the filesystem table).
    • Simple math functions between memory cells, add, multiply, divide or subtract. Increment and Decrement are also supported.
    • Write your own programs using bulkcode, which supports almost all commands, and various functions and operators such as:
    1. All memory handling commands, move data between cells, math operations, call system operations, file functions, and even load other programs inside the current program.
    2. Primitive branching, call actions if specific conditions are met (a very basic form of IF statements)
    3. FOR loops, WAIT and DELAY allow you to control flow.
    4. Run programs directly from a file, with some thinkering you can even rewrite the program you're running it and saving it to the original file it was ran from. It's tricky, but possible.
    5. The ability to run programs to interface with external systems, such as controlling a simple bot.
    6. Much more, there's really alot that can be done with it's basic building blocks.

    Example:

    Here's an example program written in bulkcode (I'm not that good with names, really):

    Code:
    file testprogram
    setnum 2 1000,
    beep 1,
    inc 1,
    
    prt The pitch is currently:,
    prt 1
    
    wait 2,
    
    prt Here we go again :D,
    run testprogram,
    end
    
    This creates a file or function (this ambiguity is due to the fact you can use this to write plain text to the filesystem, if you need to) called 'testprogram', and what it does is the following:

    1. Set's memory cell 2 to 1000, we'll use this value further down the code.
    2. BEEP's using the beep function, the beep's pitch refers to the value in memory cell 1.
    3. Increments 1 to memory cell 1 (inc always increments 1, use add for other values). We never set memory cell 1's value, in this case it's not important.
    4. Print to the console a message, and the value of memory cell 1.
    5. WAITS for the period of time specified in cell 2, in this case, 1000 milliseconds. The wait function is performed on the action stack, halting any code from being interpreted until the time is up.
    6. Prints another message.
    7. Runs the program again, thus looping it.
    Pretty simple, right? In this manner you can write some pretty complex programs, and if I'm not mistaken, affect nearly all aspects of the system.


    The ugly:

    Now, I'm not going to lie, this system is a bit of a pain to use, and there's ALOT of things I did wrong, or did not take into consideration when I started working on it (yesterday).

    • I wasn't thorough in the way data is input in the memory, right now I either ONLY allow you to input values directly (i.e. this cell is equal to bacon), or ONLY allow you to get value from one place to the other (i.e. this cell is equal to the contents of this other cell). This makes writing simple programs harder than it should be, by forcing you to first declare a bunch of memory values manually, or through another function. This is one of the main things I'll fix in the next version.
    • The code isn't nearly as efficient as it could be, and I'm not quite sure why I used timers for system functions.
    • The Actions stack seems to lose operations every once in a while.
    • It's really really really really easy to force the system into an endless loop. I had to add a physical switch to it just to restart it on these ocasions.
    • While it handles it to an extent, if you run two programs or more at the same time, you'll more than likely cause all of them to terminate.

    Learn me how plz:
    First of all, you're a lunatic. Second, I'd really appreciate if you posted any programs you might do for any chance. EVEN if you don't test them, I'd really like to see how you use the code.

    I'll try to keep this as simple as possible, here goes nothing!


    Memory operations:
    Memory operations are simple. When I refer to SOURCE or DESTINATION, I'm talking about memory indexes, a number such as 1 2 or 27, this number marks your data's position in the memory.


    setnum DESTINATION VALUE
    Set's the destination's cell to the value specified, must be a number.
    setstr DESTINATION VALUE
    Same as above, must be a string value.


    putnum DESTINATION SOURCE
    Puts the contents of the source into the destination. The source's contents are not affected.


    putstr DESTINATION SOURCE
    Puts the contents of the source into the destination. The source's contents are not affected.


    putnumdb DESTINATION SOURCE
    Puts the source's contents into the filesystem (table) under the STRING name specified in the destination cell. Stores as number.

    putstrdb DESTINATION SOURCE
    Puts the source's contents into the filesystem (table) under the STRING name specified in the destination cell.
    Stores as string. You can actually use this to store programs written through other methods.

    getnumdb DESTINATION SOURCE
    Gets the data stored in the filesystem under the STRING name specified in the SOURCE cell, and puts
    them in the DESTINATION cell. Gets a number value.

    getstrdb DESTINATION SOURCE
    Gets the data stored in the filesystem under the STRING name specified in the SOURCE cell, and puts them in the DESTINATION cell. Gets a string value.


    Math functions:

    add DESTINATION SOURCE
    Adds the contents of SOURCE to the DESTINATION, the contents of SOURCE are not affected.


    mul DESTINATION SOURCE
    Multiplies the contents of SOURCE with the contents of DESTINATION, the contents of SOURCE are not affected.


    sub DESTINATION SOURCE
    Subtracts to the contents of SOURCE the contents of DESTINATION, the contents of SOURCE are not affected.


    div DESTINATION SOURCE
    Divides the contents of SOURCE with the contents of DESTINATION, the contents of SOURCE are not affected.


    File functions:

    load SOURCE
    Loads the file with the name specified as a STRING at cell SOURCE, no data is actually placed anywhere, for that you need...

    read DESTINATION SOURCE
    Reads the data from the file specified as a STRING
    at cell SOURCE and places them in cell DESTINATION.

    write DESTINATION SOURCE
    Write the data in cell SOURCE to the file specified as a STRING in cell DESTINATION.

    append DESTINATION SOURCE
    Append the data in cell SOURCE to contents of the file specified as a STRING in cell DESTINATION.

    remove DESTINATION
    Removes the file specified as STRING in cell DESTINATION from the server.


    Networking functions:

    connect NAME
    Connects to a global variable group with the specified name, persists unless the system is restarted or another connection is made.

    sendstr DESTINATION SOURCE
    Sets a global variable at DESTINATION with the contents of SOURCE. DESTINATION refers to a memory cell that must be set to a number value. Sends string data.

    sendnum DESTINATION SOURCE
    Sets a global variable at DESTINATION with the contents of SOURCE. DESTINATION refers to a memory cell that must be set to a number value. Sends number data.


    rcvstr DESTINATION SOURCE
    Reads and deletes the contents from SOURCE and places them in the memory at DESTINATION. String value.

    rcvnum DESTINATION SOURCE
    Reads and deletes the contents from SOURCE and places them in the memory at DESTINATION.
    Number value.

    Branching and loops:

    equal A B ACTION
    Compares cell A to B, if they are equal, do ACTION
    , usage example:
    equal 1 2 prt Printing some text to console yay!
    Only one action can be performed.

    notequal A B ACTION
    Compares cell A to B, if they are NOT equal, do ACTION
    .

    less A B ACTION
    If A is less than B, do ACTION.


    more A B ACTION
    If A is greater than B, do ACTION


    for VALUESTART VALUEEND ACTION
    (here's that ambiguity I mentioned earlier). Loops ACTION X times, a single action is allowed. VALUESTART and VALUEEND represent the interval, and are set directly (as in, do not point to a cell, use the actual values).


    break
    Clears the action stack, stops the current processes or program.


    Files/Programs:

    file FILENAME
    Opens the editor to create a file with the specified name, at this point you input commands in order.
    IMPORTANT -> You can use your ENTER key to input various lines of commands, but you MUST use a comma ( , ) at the end of each line!

    end
    Used to terminate the editor and save the file/function to the filesystem (table) under the previously specified filename, does not nest.

    run FILENAME
    Opens and runs the contents of FILENAME as a program.


    runfile FILENAME
    Shortcut. Reads and loads the contents of the specified file as a program.

    runfile script
    Shortcut, when called will run the contents of script.txt, assuming it was previously loaded.

    Output and input:
    I sort of screwed up a bit in this one, but it works well enough.

    out PORT SOURCE
    Puts the contents of SOURCE in output PORT (1-4).


    Reading inputs is slightly trickier, tho... Inputs are stored in cells 901 to 904, use the other available functions to read the
    data contained in them.

    System operations:
    System operations work in a slightly different way as everything else, they are called with the 'do' prefix, and then the name you will input will start a timer with that string name, thus clk'ing any timers already existant with that name, running it.

    do reset
    Resets the system, all unsaved data will be lost.


    do clear
    Clears the debug screen.

    do reload
    Reloads the last loaded file.

    do dumpmem
    Dumps the current memory to the filesystem and saves the file. Overwrites any other content stored with this command.

    do loadmem
    Loads the stored memory from the filesystem, all data in the memory prior to using this command is lost.


    Generic:

    prt WHAT
    If given a CELL ADDRESS, it will print it's contents to the debug console, if given a TABLE name, it will print it's contents, if
    it returns nil, it will print whatever you tell it to, so you can print random blabber with it aswell.

    prtmem START END
    Prints the contents of all the cells in the specified index interval.

    beep [optional SOURCE]
    Plays a short beeping noise, useful for debugging. If provided, it will play the beeping with the pitch specified in the contents of cell SOURCE. You can actually make a simple midi player of sorts with it.

    wait SOURCE
    Stops the Action stack's actions for the period of time specified in cell SOURCE.
    Can be used to control program operation speed. Does not persist

    delay SOURCE
    Similar to the above, but applies to ALL stack actions, and persists between use, this controls the whole system's speed.


    Controls:

    PGUP and PGDOWN
    While using the keyboard, these push the contents of the screen up or down, you might find a practical use for them.

    CHAT INPUT
    If you're in a laggier server and the wire keyboard just isn't cutting it, you can use chat input (Warning: not limited to owner, and no hideChat() enabled by default!) to run commands just as if you were using the keyboard. To do so, just input your messages with >
    Simple!

    Whew, that's it, I think!
    I'm most definetly forgetting something, I can feel it, but if you decide to take it for a ride, you'll certainly find all it's features very easily.

    This is all but perfect, but I've had alot of fun working on it, and I hope atleast some of you will have some fun with it aswell, even if only for a couple of minutes. Post your programs and accomplishments, and your comments, feedback and ideas, I'll definetly appreciate it!

    Last edited by Filipe; 01-11-2010 at 07:54 PM.

  2. #2
    E2 Zombine
    Filipe will become famous soon enough Filipe will become famous soon enough Filipe's Avatar
    Join Date
    Jun 2007
    Location
    Portugal - Lisbon
    Posts
    301
    Blog Entries
    1

    Default Re: BulkOS > Oh gosh.

    Adv Dupe and Code:
    BulkOS.rar - FileSmelt File and Image Hosting

    Code:
    Code:
    @name BulkOS
    @inputs CharIn S:wirelink Switch InA InB InC InD
    @outputs Out:string PortA PortB PortC PortD [TFG TBG]:vector
    # Keyboard:
    @persist CharBuffer:array [String Saved]:string FG BG 
    # Data:
    @persist DB:table [M Action]:array File:string
    # Console:
    @persist D:array Busy
    
    
    # By Filipe D, 11th of Jan to 12th of Jan 2010.
    # Enjoy!
    
    if(first() | duped()) { File = "bulkos.txt" runOnChat(1) }
    if(first() | duped() | clk("clear")) {
        if(first() | duped() ) { FG = 999 BG = 111 }
        S[2041] = 1 S[2042] = BG
        D:pushString("Welcome, "+owner():name())
        D:pushString("Today is "+time("day")+"/"+time("month")+"/"+time("year"))
        D:pushString("-":repeat(30))
        TFG = vec(0,0,0)    TBG = vec(80,80,80)
    }
    if(first() | clk("reload") | fileClk()) {
    
        if(!fileLoaded(File)) {
           fileLoad(File) runOnFile(1) 
        }
        else{
            D:pushString("File loaded!")
            if(File == "bulkos.txt") { DB = glonDecodeTable(fileRead(File)) 
            M[999,string] = DB["startup",string] timer("enter",10)    
            }
            runOnFile(0)
        }
    }
    # Keyboard input:
    if(changed(CharIn) & CharIn>0) {
        
        # Save key presses to the buffer:
        # The buffer allows the user to type faster, preventing (or atleast reducing)
        # any loss of keypresses in the process.
        CharBuffer:pushNumber(CharIn)
        
    }
    while(CharBuffer:count()>0) {
        
        # Do the actual key drawing on the screen:
        Char = CharBuffer[1,number]
        Key = toChar(CharBuffer[1,number])  CharBuffer:remove(1)
        # print(""+Char)
        
        # Keys:
        # Backspace:
        if(Char == 127 & String:length()>=0) {
                String = String:left(String:length()-1)   
        }
        # Shift key
        elseif(Char == 154) {
            # Do nothing.
        }
        elseif(Char == 151) {
            S[2038] = -1
        }
        elseif(Char == 152) {
            S[2038] = 1
        }
        # UP arrow
        elseif(Char == 17) {  
        String = Saved   
        }       
        # ENTER key
        elseif(Char == 13) {
            D:pushString(">"+ String) M[999,string] = String
            timer("enter",10)
            if(String !="") { Saved = String }
            String = ""
        }    
        else{
        # Everything else.
        # -------------- #
        String = String + Key
        } 
        Out = String    
    }
    if(chatClk() & lastSaid():index(1) == ">") {
        Chat = lastSaid():right(lastSaid():length()-1)
        D:pushString(">"+Chat)
        M[999,string] = Chat timer("enter",20)
        # hideChat(1)
    }
    if(clk("enter")) {
        Get = M[999,string] Raw = Get:explode(" ") 
        C = Raw[1,string] Raw:remove(1)
        A = Raw:concat(" "):trim()
        
        if(!Busy) {
        
        # GENERIC:
        
        if(C == "prt") {
            if(M[A:toNumber(),number]>0) {
            D:pushString("M("+A+"):"+M[A:toNumber(),number]:toString()) 
            }
            elseif(M[A:toNumber(),string]!="") {
            Line = M[A:toNumber(),string]
            if(Line:length()>30) {
            D:pushString("M("+A+")>>>>>>>")
            M[997,string] = Line timer("lines",10) }
            else{  D:pushString("M("+A+"):"+Line)  }
              
            }
            elseif(DB[A,string]!="") {
            Line = DB[A,string]
            if(Line:length()>30) {
            D:pushString("D("+A+")>>>>>>>")
            M[997,string] = Line timer("lines",10) }
            else{  D:pushString("D("+A+"):"+Line)  }
            } 
            else{
            D:pushString("|:"+A)    
            }  
        }
        elseif( C == "do") {
            timer(A,20)
        }
        elseif(C == "file") {
            M[1201,string] = A:replace(" ","")
            D:pushString("file/function: ("+M[1201,string]+"):")
            D:pushString("-":repeat(30))
            Busy = 1  
        }
        elseif(C == "run") {
            Raw = DB[A,string]:explode(",")
            for(I=1,Raw:count()) {
            Action:pushString(Raw[I,string])   
            } 
        }
        elseif(C == "for") {
            Raw = A:explode(" ")
            Start = Raw[1,string]:toNumber() End = Raw[2,string]:toNumber()
            Str = ""
            for(I=3,Raw:count()) {
                Str = Str +" "+ Raw[I,string]
            }
            for(I=Start,End) {
                Action:pushString(Str:trim())
            } 
        }
        elseif(C == "runfile") {
            if(A== "script") {
            File = "script.txt"
            }
            else{
            File = M[A:toNumber(),string]
            }
            Raw = fileRead(File):trim():explode(",")
            for(I=1,Raw:count()) {
            Action:pushString(Raw[I,string])   
            } 
        }
        elseif(C == "delay") {
            M[996,number] = M[A:toNumber(),number]
        }
        elseif(C == "wait") {
            M[995,number] = M[A:toNumber(),number]
        }
        elseif(C == "break") {
           while(Action:count()>0) { Action:remove(1) }
           stoptimer("enter")
        }
        elseif(C == "beep") {
           soundPlay(1,0.2,"synth/tri.wav")
           if(A!="") { soundPitch(1,M[A:toNumber(),number]) } else { soundPitch(1,100) }
        }
        
        # FNET Request:
        elseif(C == "fnetreq") {
           Raw = A:explode(" ")
           Table = table()
           Table["get",string] = M[Raw[2,string]:toNumber(),string]
           Table["steamid",string] = owner():steamID()
           Table["msg",string] = "SENT THROUGH BULKOS"
           Table["id",number] = M[Raw[3,string]:toNumber(),number]
           M[Raw[1,string]:toNumber(),string] = glonEncode(Table)
           D:pushString("Built FNET request.")
        }
        # MEMORY HANDLING:
        
        # Manual memory setting:
        elseif(C == "setnum") {
            Raw = A:explode(" ")
            M[Raw[1,string]:toNumber(),number] = Raw[2,string]:toNumber()   
        }
        elseif(C == "setstr") {
            Raw = A:explode(" ") Num = Raw[1,string]:toNumber() Raw:remove(1)
            M[Num,string] = Raw:concat(" ")
        }
        # PRINT MEM
        elseif(C == "prtmem") {
            Raw = A:explode(" ")
            From = Raw[1,string]:toNumber() To = Raw[2,string]:toNumber()
            for(I=From,To) {
                Action:pushString("prt "+I)   
            }
            
        }
        # Math:
        elseif(C == "add") {
            Raw = A:explode(" ")
            M[Raw[1,string]:toNumber(),number] = M[Raw[1,string]:toNumber(),number] + M[Raw[2,string]:toNumber(),number]    
        }
        elseif(C == "sub") {
            Raw = A:explode(" ")
            M[Raw[1,string]:toNumber(),number] = M[Raw[1,string]:toNumber(),number] - M[Raw[2,string]:toNumber(),number]    
        }
        elseif(C == "mul") {
            Raw = A:explode(" ")
            M[Raw[1,string]:toNumber(),number] = M[Raw[1,string]:toNumber(),number] * M[Raw[2,string]:toNumber(),number]    
        }
        elseif(C == "div") {
            Raw = A:explode(" ")
            M[Raw[1,string]:toNumber(),number] = M[Raw[1,string]:toNumber(),number] / M[Raw[2,string]:toNumber(),number]    
        }
        elseif(C == "inc") {
            Raw = A:explode(" ")
            M[Raw[1,string]:toNumber(),number] = M[Raw[1,string]:toNumber(),number] +1
        }
        elseif(C == "dec") {
            Raw = A:explode(" ")
            M[Raw[1,string]:toNumber(),number] = M[Raw[1,string]:toNumber(),number] -1
        }
        elseif(C == "inv") {
            Raw = A:explode(" ")
            M[Raw[1,string]:toNumber(),number] = !M[Raw[1,string]:toNumber(),number]
        }
        
        # Memory swap:
        elseif(C == "swap") {
            M = glonDecode(DB[M[Raw[1,string]:toNumber(),string],string])
        }
        # Memory swap:
        elseif(C == "store") {
            DB[M[Raw[1,string]:toNumber(),string],string] = glonEncode(M)
        }
        # Branching:
        elseif(C == "equal") {
            Raw = A:explode(" ")
            BA = M[Raw[1,string]:toNumber(),number] BB = M[Raw[2,string]:toNumber(),number]
            Equal = BA == BB
            if(Equal) {
            Str = ""
            for(I=3,Raw:count()) { Str = Str +" "+ Raw[I,string] }
            Action:pushString(Str:trim())
            }
        }
        elseif(C == "notequal") {
            Raw = A:explode(" ")
            BA = M[Raw[1,string]:toNumber(),number] BB = M[Raw[2,string]:toNumber(),number]
            Equal = BA != BB
            if(Equal) {
            Str = ""
            for(I=3,Raw:count()) { Str = Str +" "+ Raw[I,string] }
            Action:pushString(Str:trim())
            }
        }
        elseif(C == "more") {
            Raw = A:explode(" ")
            BA = M[Raw[1,string]:toNumber(),number] BB = M[Raw[2,string]:toNumber(),number]
            Equal = BA >= BB
            if(Equal) {
            Str = ""
            for(I=3,Raw:count()) { Str = Str +" "+ Raw[I,string] }
            Action:pushString(Str:trim())
            }
        }
        elseif(C == "less") {
            Raw = A:explode(" ")
            BA = M[Raw[1,string]:toNumber(),number] BB = M[Raw[2,string]:toNumber(),number]
            Equal = BA <= BB
            if(Equal) {
            Str = ""
            for(I=3,Raw:count()) { Str = Str +" "+ Raw[I,string] }
            Action:pushString(Str:trim())
            }
        }
        # File functions:
        elseif(C == "load") {
            File = M[A:toNumber(),string]
            timer("reload",30)
        }
        # File functions:
        elseif(C == "read") {
            Raw = A:explode(" ")
            M[Raw[1,string]:toNumber(),string] = fileRead(M[Raw[2,string]:toNumber(),string])
        }
        elseif(C == "write") {
            Raw = A:explode(" ")
            fileWrite(M[Raw[1,string]:toNumber(),string],M[Raw[2,string]:toNumber(),string])
        }
        elseif(C == "append") {
            Raw = A:explode(" ")
            fileAppend(M[Raw[1,string]:toNumber(),string],M[Raw[2,string]:toNumber(),string])
        }
        elseif(C == "remove") {
            fileRemove(M[A:toNumber(),string])
            D:pushString("Removed file!")
        }
        # Data copy:
        elseif(C == "putnum") {
            Raw = A:explode(" ")
            M[Raw[1,string]:toNumber(),number] = M[Raw[2,string]:toNumber(),number]
        }
        elseif(C == "putstr") {
            Raw = A:explode(" ")
            M[Raw[1,string]:toNumber(),string] = M[Raw[2,string]:toNumber(),string]
        }
        elseif(C == "putstrdb") {
            Raw = A:explode(" ")
            DB[M[Raw[1,string]:toNumber(),string],string] = M[Raw[2,string]:toNumber(),string]
        }
        elseif(C == "putnumdb") {
            Raw = A:explode(" ")
            DB[M[Raw[1,string]:toNumber(),string],number] = M[Raw[2,string]:toNumber(),number]
        }
        elseif(C == "getstrdb") {
            Raw = A:explode(" ")
            M[Raw[1,string]:toNumber(),string] = DB[M[Raw[2,string]:toNumber(),string],string]
        }
        elseif(C == "getnumdb") {
            Raw = A:explode(" ")
            M[Raw[1,string]:toNumber(),number] = DB[M[Raw[2,string]:toNumber(),string],number]
        }
        elseif(C == "out") {
            Raw = A:explode(" ") Num1 = M[Raw[1,string]:toNumber(),number]  Num2 = Raw[2,string]:toNumber()
            M[800+Num1,number] = M[Num2,number]
        }
        # Networking:
        elseif(C == "connect") {
            Raw = A:explode(" ")
            M[994,string] = A
            D:pushString("Connected to: "+A)
        }
        elseif(C == "sendstr") {
            Raw = A:explode(" ")
            gSetGroup(M[994,string]) gShare(1)
            gSetStr(M[Raw[1,string]:toNumber(),number],M[Raw[2,string]:toNumber(),string])
        }
        elseif(C == "sendnum") {
            Raw = A:explode(" ")
            gSetGroup(M[994,string]) gShare(1)
            gSetNum(M[Raw[1,string]:toNumber(),number],M[Raw[2,string]:toNumber(),number])
        }
        elseif(C == "recvstr") {
            Raw = A:explode(" ")
            gSetGroup(M[994,string]) gShare(1)
            M[Raw[1,string]:toNumber(),string] = gDeleteStr(M[Raw[2,string]:toNumber(),number])
        }
        elseif(C == "recvnum") {
            Raw = A:explode(" ")
            gSetGroup(M[994,string]) gShare(1)
            M[Raw[1,string]:toNumber(),number] = gDeleteNum(M[Raw[2,string]:toNumber(),number])
        }
        
        }
        else{
            
        if(Get == "end") { Busy = 0 
        DB[M[1201,string],string] = M[1200,string]:trim()
        M[1200,string] = ""
        D:pushString("-":repeat(30))
        D:pushString("File stored.")   
        } 
        else {
        M[1200,string] = M[1200,string] + Get
        }
    #    if(Get:length()>30) {
    #    M[997,string] = Get timer("lines",10) }
    #    D:pushString("-":repeat(30))    
        }
    }
    # CALL functions:
    elseif(clk("reset") | ~Switch & Switch) {
        reset()
    }
    elseif(clk("dumpmem")) {
        DB["mem",string] = glonEncode(M)
        timer("save",50)
    }
    elseif(clk("loadmem")) {
        M = glonDecode(DB["mem",string])
    }
    elseif(clk("lines")) {
        Str = M[997,string]
        T = Str:length()/30
        for(I=0,T) {
            D:pushString(Str:sub(31*I,Str:length()))
        }
        D:pushString("-":repeat(30))
    }
    elseif(clk("save")) {
        File = "bulkos.txt"
        fileWrite(File,glonEncode(DB))
        D:pushString("File saved!")
    }
    elseif(clk("prtops")) {
        D:pushString("ops:"+opcounter())
    }
    
    
    # Action buffer:
    if(Action:count()>0) {
       M[999,string] = Action[1,string]
       Action:remove(1)  
    
       if(M[996,number]>20 & !Action:count()) { Time = M[996,number] }
       else { Time = 20 }
       if(M[995,number]>20) {
       Time = M[995,number] M[995,number] = 0 
       }
       timer("enter",Time)
    }
    # Output buffer:
    while(D:count()>0) {
      S[2038] = 1
      S:writeString(D[1,string]:sub(0,30),0,17,FG,BG)
      D:remove(1)     
    }
    
    PortA = M[801,number] PortB = M[802,number]
    PortC = M[803,number] PortD = M[804,number]
    M[901,number] = InA M[902,number] = InB
    M[903,number] = InC M[904,number] = InD
    


    Ugly pictures:
    These were taken in a laptop, running low resolution, with no smartsnap or easy precision, and show a very poorly built version of the BulkOS computer...by all means, build your own case, I beg you! (I keep the slightly neater version in my desktop).








    Last edited by Filipe; 01-11-2010 at 07:53 PM.

  3. #3
    Wirererer Dskodk is an unknown quantity at this point Dskodk's Avatar
    Join Date
    Sep 2009
    Location
    NZ
    Posts
    117

    Default Re: BulkOS > Oh gosh.

    This is very interesting, i like it. im making my own OS, and im amazed at all of the functions. that gives me ideas on how to make file functions :P thanks!
    Working on:
    O-Serious (OS)
    O-Serious (GPU GUI Edition)

  4. #4
    Wire Amateur hoyo321 will become famous soon enough hoyo321 will become famous soon enough hoyo321's Avatar
    Join Date
    Jan 2009
    Location
    Korea,Republic of
    Posts
    69

    Default Re: BulkOS > Oh gosh.

    Quote Originally Posted by Dskodk View Post
    This is very interesting, i like it. im making my own OS, and im amazed at all of the functions. that gives me ideas on how to make file functions :P thanks!
    me either
    thanks!
    Sorry, I'm not good at English

  5. #5
    Expressionism 2.0

    Syranide has disabled reputation Syranide's Avatar
    Join Date
    Mar 2007
    Location
    Sweden
    Posts
    4,503

    Default Re: BulkOS > Oh gosh.

    Very nice!, surprisingly "small" amount of code as well.
    Anyway, I'd recommend moving [Raw = A:explode(" ")] somwhere else and just call it once, right now you use it in almost every single if-statement for no good reason.

  6. #6
    Banned nath2008uk is on a distinguished road nath2008uk's Avatar
    Join Date
    Feb 2009
    Location
    United Kingdom.
    Posts
    743

    Default Re: BulkOS > Oh gosh.

    Looks awesome.
    Also, extra cookies if the 'Input box' gets it's own AI and will sit there talking to you for luls

  7. #7
    E2 Zombine
    Filipe will become famous soon enough Filipe will become famous soon enough Filipe's Avatar
    Join Date
    Jun 2007
    Location
    Portugal - Lisbon
    Posts
    301
    Blog Entries
    1

    Default Re: BulkOS > Oh gosh.

    Quote Originally Posted by Syranide View Post
    Very nice!, surprisingly "small" amount of code as well.
    Anyway, I'd recommend moving [Raw = A:explode(" ")] somwhere else and just call it once, right now you use it in almost every single if-statement for no good reason.
    You're absolutely right. I just didn't consider it initially while I had only one or two functions, but I'll fix this

  8. #8
    Lurker Straterra is on a distinguished road Straterra's Avatar
    Join Date
    Jan 2010
    Posts
    8

    Default Re: BulkOS > Oh gosh.

    I'm looking to use your OS to do some simple controlling of other Wire devices. Do you have some kind of wiring diagram for your computer? Also, how does one save/load a program from the file system in your OS? Thanks!

  9. #9
    goluch
    Guest goluch's Avatar

    Default Re: BulkOS > Oh gosh.

    Any chance of graphical display?
    (tooo lazy to read whole post)
    GPU or EGP mabey.
    Anyway this is a very interesting and quite awesome project.
    Hope to see more added to this.

  10. #10
    E2 Zombine
    Filipe will become famous soon enough Filipe will become famous soon enough Filipe's Avatar
    Join Date
    Jun 2007
    Location
    Portugal - Lisbon
    Posts
    301
    Blog Entries
    1

    Default Re: BulkOS > Oh gosh.

    Quote Originally Posted by Straterra View Post
    I'm looking to use your OS to do some simple controlling of other Wire devices. Do you have some kind of wiring diagram for your computer? Also, how does one save/load a program from the file system in your OS? Thanks!
    Connecting external devices is easy, there are 4 inputs and 4 outputs, you simply pick one, wire your device to it, and off you go. INPUT data is stored in cells 901 to 904, OUTPUT data is stored in cells 801 to 804, just use regular functions to control your device.

    As for loading and saving, it's a bit trickier than it should be, I'll fix this in the new version, that i'm already working on. You can create a function with this code (remember the commas!)

    Code:
    setstr 600 FILENAME.txt,
    setnum 601 3000,
    load 600,
    wait 601,
    read 1 600,
    prt 1,
    end
    
    This first stores the filename in a cell, along with the number 3000. We call the 'load' function on the contents of cell 600 (the filename), and then a wait function for the contents of cell 601 (3000 milliseconds). When all is loaded, the contents of the file are read into cell 1 and printed to the screen.

    Let me know if you need help with anything else, and thanks for the interest


    Quote Originally Posted by goluch View Post
    Any chance of graphical display?
    (tooo lazy to read whole post)
    GPU or EGP mabey.
    Anyway this is a very interesting and quite awesome project.
    Hope to see more added to this.
    Not quite yet, I've made a few systems where I got completely sidetracked by the graphical display, and ended up neglecting the rest. So for this project, I won't add a graphical display unless I can effectively build it on top of the system, instead of building the system around the pretty graphics.

    But now that I think of it, I have some EGP stuff you might like to see, including a server-mail client
    Last edited by Filipe; 01-13-2010 at 02:41 PM.

+ Reply to Thread
Page 1 of 2 1 2 LastLast

Similar Threads

  1. BulkOS 3 - now with 10% more bulk!
    By Filipe in forum Finished contraptions
    Replies: 8
    Last Post: 01-31-2010, 02:23 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
proceed-collector
proceed-collector
proceed-collector
proceed-collector
linguistic-parrots
linguistic-parrots
linguistic-parrots
linguistic-parrots