Log In  


Cart #p8os_early-1 | 2021-03-13 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
4


This is a very early version of P8OS(v0.2 as of now), a very creatively named operating system built on the one Pico-8 already has. I'm trying to do what the original Windows did, which is piggybacking on an existing framework and building off of that.

It really isn't much just yet, but here's a few lists for those who like them.

Existing features:

  • Mouse and keyboard reading(really not much to brag about)
  • Removed v0.2: A system clock on the menu bar
  • A basic menu bar
  • A (yet nonfunctional) app menu you can toggle with Z(closest to the Windows button)
  • A very clever way of storing program names
  • v0.2: An (also nonfunctional) task menu you can toggle with X(next to the app button)
  • v0.2: Hover-enabled user and clock buttons

Planned Features:

  • Custom VM with bytecode transfered through sprites
  • A framework for said VM with access to writing files and stuff like that
  • A code editor for the VM in the OS. So... a VM inside a VM with an editor for that VM inside an operating system built in an editor on an operating system.

I want to make it so that you can paste in programs you made for the VM from the clipboard since that would be cool and I like cool.

Anyways, I hope you enjoy doing nothing interesting in this glorified button pressing simulator. Give ideas if you can!

P.S. Please do check out my very clever way of storing program names. I'm too proud of it for you not to notice ;_;
P.P.S. I'm planning on making the program icons/names even clever-er since every icon is essentially a 1-bit image, meaning I can pack four icon pixels into a single actual pixel. Haven't done that yet, but it's planned.

4


Wonderful! I'd love to see what happens with this OS next!


2

I'm very interested to see how this turns out!
(incidentally, I was inspired by this post to create my own version-- which at the moment is not much more than a glorified button presser)
At the moment, it doesn't do... well, anything, except for changing the color of the taskbar when you press start (there are also two options in the menu for changing some things; there are also a few options in the code that can be changed. Though it's a bit messy now, I'm trying to build a stable platform to make a much larger project in.)

Cart #pico_desktop-1 | 2021-05-07 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
2


@Einstein2 Cool! I notice that the clock doesn't pad the digits with zero. You can do that pretty easily by creating a function which converts the number to a string, checks the length of that, and if it's 1 it returns "0"..n.
I recommend you check out my code so you can see what sort of shenanigans I've put in there. Have fun, and don't get lost in the mess ._.


@wallgraffiti
Thanks for the tip!
I looked at your code, there are a lot of small optimizations I can think of, if you'd like to take a look:

function bn(b)
    return b and 1 or 0
end
function nb(b)
    return({[0]=false,1})[b%2]
end

the intable() function is completely unnecessary due to lua treating nil (and false) as false and everything else as true; simply use a[b] and lua will do the hard work for you. (however, this is assuming that none of the items in the table are false, which could be an issue)

    return(not n) and d or nb((d&2^n)>>n)
    if k then return p==k else return p end
function pad(s)
    return #(""..s)==1 and "0"..s or s 
end

I couldn't really figure out how the upn() function worked, but perhaps take a look at the peek function along with pico-8's memory layout, specifically the part that is mapped to the sprite sheet, which can do, with some math, the same thing in far fewer characters.

The last thing, wrap all the functions drawing to the screen in 'function _draw() end', which performs operations to the screen vastly faster; wrap the rest inside a 'function _update60() end', which raises the maximum framerate to 60fps, making it a lot less choppy.
Hope this helps!


Wow, that's a lot of things I wouldn't have thought of myself! About the _draw and _update60, I am aware of these functions. It's just that the OS started with me messing around with mouse and keyboard, so I used repeat .. until __ since it's quicker. I think I would prefer to stay with that, since the OS isn't meant to be quick per-se, but just a fun thing.
Still, thanks for doing all of this optimisation for me! I'll add it in ASAP.



[Please log in to post a comment]