#⌨coders-cave
1 messages · Page 79 of 1
it means you cannot run any code
you cant use std
in any projects
and all you can do is write code which you compile
oh and you cant use main
hold on
so you gotta make your own starting function
wait
basically yes
Its a very long process but Im gonna give you the basics of how you start a kernel
basically the first file to be booted on a pc is BIOS, everyone knows that
ye
Afterwords the bootloader is called
the thing that calls the kernel of the os
I can make bootloaders
They are pretty simple
if you know basic assembly
🤔
anyway, after the bootloader moves from 16 bit to 32 bit
it can call the kernel
which has to be a C function
BIOS starts in 8 bits, moves to 16 bits and stays there
interesting
the OS has to move to 32 bits and 64 bits
Im not sure about it having to be C but here is how you call the kernel
[bits 32]
[extern _start]
call start
jmp $
Yes but no
because it will be completely useless
fair :D
and will only be able to hold 1kb of memory which is itself
I actually have a 16 bit OS made
its only a bootloader
and has a shell
working shell
The thing is 16 bit assembly is easy because BIOS is like a library
huh
it does everything for you
like writing, reading etc.
16->32->64?
16 bits is the easiest
is 64 bit very hard
least ammount of registers to remember and has BIOS interupts enabled
32bit is easly the hardest
Its...cold
and empty
why 32 bit and not 64 bit
once you move into 32bits, the computer is like a corpse
nothing is initiated
nothing works
lmao
even the processor doesnt work
the windows xp experience
the os kernel has complete control over the pc
oh so
and basically has to bring life to it by initiating drivers
16bit is on autopilot?
kinda its basically you using BIOS to do everything much easier then usual
hmmm
Reading the disk would take hundreds of lines worth of drivers in 32bits and 64bits
while in 16 you use a BIOS interupt to do it in 20 lines
btw interupts - functions which are rarely used by the pc because they block all other processes from existing so that they can run
why isnt that a thing for 32 bit and up
o
ohh
i see
16 bit is so tiny
that it doesn't matter
they are usually used to handle kernel errors in 32 and 64 bits
UEFI can do that
🤔
but UEFI assembly is complex af
it uses multiboot and multiboot2 to boot instead of a bootloader
there are threads and stuff
its probably better though if it makes everything else easier, right?
hmm
and not all interupts are there
hello
hi
plus BIOS systems can run on UEFI computers because UEFI has legacy mode
which makes UEFI behave like BIOS
oo
hi
It is but the problem with building an os is you gotta rewrite the bootloader for every manufacturer
for x86 systems you gotta use x86
assembly
for ARM you gotta use ARM
And idk what for Mac hardware
For Mac you don't write for Mac

rule 1 of good person: be actively hostile towards Apple
ok so it uses ARM
dang
but a heavily modified version of it
Also you know whats fun about making an OS?
Going into a high level language like C and realising
Jesus Christ low level C is harder then assembly
like ima show you some basic low level C code from a kernel
you know you're insane enough for OS development when you start considering C high level
if it isnt assembly its high level
but that doesnt mean its easier
in fact it may be harder
in the start that is
oh and btw
danm
you gotta implement the entire standard library yourself
imagine writing a game entirely in assembly
from macros to functions
just copypaste it??
ye pls do
basically so to write to screen you the standard library provides a command
println!
which I have implemented in rust
But behind this command hides the vga_buffer driver
lemme show you some pics of it
This is a very minimalistic driver but it works
It relies on your code
but some macros require you to give it some info
like println! requiers you to give it a destination or an info struct to work
called a writer
hmm
kek
also the ASCII table exists which uhhh...\
search ASCII hexadecimal and look at the results
in the past you had to remember it
uhhhhhmmmhhh
actually this year
apple is being a good boy
impossible
eh-
vector is a linked list
meaning its mutable and dynamic
deleting, adding is fast if you know the index
linked list are good for dynamic data which you don't have a definite maximum elements
but its also takes more memories
because it has to carry additional data to each block
same
nice
i made my first calculator after a month
Vectors are same as dynamic arrays with the ability to resize itself automatically when an element is inserted or deleted, with their storage being handled
there's this
that sounds a bit weird
but i would like it if you call me onee sama
:intense_licking:
Rei
True

Stop bullying me 
im just asking
also
try gitbash
it has some unix command installed in it
i don't know if it has chroot though
I use cygwin but it, for some reason, cut off some unix commands which I need
like grub support
hi there
cool
what game engine
nice
Thats fine I didnt write anything in the start either
me neither
But look at me now I write trash code that barely works for projects that dont have a meaning
I understand that mine also isnt amazing
I can try to explain them to you if you want
Ah cpp my fav language below assembly and rust
ok uhh give me a moment
cuz im kinda in online class
well no
a vector is a list
the
list<int> i = { 1, 2, 3};
is a linked list
yes c++ isnt confusing at all
damn rust is cool
time to do stuff
vectors is when direction 
basically variables that hold three values usually ints or floats
not those vectors
cringe!
they are only useful in gfx APIS
and void is a function
that returns (), or nothing
thats different from returning absolutely nothing
but that doesnt matter
How is learning going]
alright now ima suggest you something
dont use the official cook book
its complex af
fair
and the examples are cringe
links to alternatives? 
like incredibly difficult to understand
start a small project, whenever you get stuck you look up the answer
when you get used to basics start implementing crates
👍
damn, its actually slower then my vulkan api project

Working hard haydot?
yep
Thank you! I hope you have a great day too!
Thx!
No there are many
The main ones are
int float bool string (only through a special header) char const char* (behaves as a string)
U_int8
And all other u_ints
its not a data type
ok but please dont say stuff like that
when you say
public void foo(){
}
this means that this function should return ()
meaning nothing
there are other functions
like
int main(){
return 0;
}
this one in contrast has to return something
or an int
in this case
legends say he never finished that sentence
you have so much more to learn
in cpp
it takes month, if not years to learn language especially low level like cpp
think of an idea on what you want to do
make a project
realise you cant code and search for the answers of your problems
what was it
Yes but you have to know how to fix it
when you see this, do you understand whats wrong?
[Linker error] c:/crossdev/src/mingw-w64-svn/mingw-w64-crt/crt/crt0_c.c:18: undefined reference to `WinMain@16'
this is an error I used to have
or not this exactly but still it was a linker error
I dont expect you to have seen it either linker errors are rare but really difficult to fix
they mainly acquire when you use an API or something that requires to be linked with cpp
i think the best way to like
learn and use that knowledge to another language
is to know fundemental
concepts
and similar stuff
since its about problem solving
its the way of thinking that doesnt change between languages
it might change a bit if you change the type of programming language you are using
haydot is like 16
okeh
im thinking about it but considering what im doing rn I dont know if I will get a job in a company
Not many companies want OS devs
only 2 companies actually
So in the future if I have to I will have to make my own
Literally
Big G
@orchid frigate Or just help on development of Linux
But you won't make money,But You get social status :chad:
||give him a couple of days he will get a new niche||

loooooool
Yeah language sorry
My social credits after learning chinese: i have the high ground
its C#
God... :Megachad:
sadly i can only pronounce words not understand characters
oh look at that
its time to migrate my data
Tbh there are some things that could be improved on the kernel
but idk group projects like that suck
I wanna make something brand new Linux like
there shouldnt be only 3 main OSs
Well who knows you can obviously help and Contribute👀
I could but I gotta learn how to make a full kernel first
which will most likely take another year
as gathering info on how a kernel and drivers work is insanely difficult
Thank you for your words of encouregment, a big contrast to Hamza's words of..
your mom
Thats the best way to describe how he speaks
AKA Db?
what
you could like
make a Unix based system
instead of forking from linux directly
and bam
original
that's macos

Nah
well okie
I know im setting my goals too high (even if I assemble a team in the future it's still alot of work) but I want the code to be written by me and my team from the bootloader to the...end of the kernel
But first I gotta figure out how tf keyboards work
Why the BIOS
Well like keyboards are somewhere in memory
eh?
You get where they are in memory and...use interupts?
Wait no interupts dont exist yet
Alright well here go another 200 hours of reading about keyboards
Ah I think I understand
So thats why the wiki said interupts should be made before keyboard driver
yes
So the keyboard sends an interupt and maybe through that interupt it also sends some info like keyboard status
In some register
Probably the 32bit version of al
And you can extract it
Seems...too simple
Like the vga buffer was way more difficult
i need sleep
its almost 2am
and time is getting disorted
everything is either faster or slower
Im guessing something went wrong while learning
What happened
nothing
i just figured it's gonna be very inefficient
to learn rust while doing a different thing
Ok fair enough
ye
I think I found the error to why the kernel OSs werent loading before and its the stupidest shit ever...
if this is the case im leaving programming for a week
I have had enough
you know what I will check tommorow im worried my tired heart wont be able to accept my stupidity
It makes sense...so the problem was most likely that I booted from the wrong disk
4 LETTERS!!! CAUSED MONTHS OF PAIN
i hate programming but I love it
lmao
my db running smoothly
but the freaking owner decided to made a bug because he deleted a channel
now my code can errors because the channel doesn't exist
NoneType has no attribute .mention
American Football - Stay Home
oops
you havent been doing it for a month
but ok
The one time I decide to ;look at your message and its trash]
you dont know for how long I have been reading about OSs
So I see the owner is a smart man
yes
does he atleast pay you
no
i think the right word is
"delay"
well there's like
unix and windows way
there's the
usleep
for unix
#ifdef _WIN32
#include <Windows.h>
#else
#include <time.h>
int nanosleep(const struct timespec *req, struct timespec *rem);
#endif
the execution
exactly
well there's this
don't ask me to step on you again

i have a great plan for my luau event loop
Lua xdddddd
nice my selector worked
now i can bind roblox things
to my event loop
its similar to running in a different thread
because its handled by roblox task scheduler
not my event loop
i can literally make this work
yay
I got good code ALT F4
i got a good code, here's the code
You monster
I wonder tho how do I compile modsys w/ python
hehe
YOU TURNED ME INTO A POTATO!
😎
Thats not really a piece of code but uhhh
I respect it no matter what
Bruh I got a admin
Mod*
I cant recommend anyone for helper
I mean I can but the recommendation has to be real
Plus I highly doubt you will be promoted if you are not a bear atleast
thats cool but like you cant help people for a couple of days only and expect to be promoted
it took me months of being active to get a chance of becoming a mod
i helped people for like 2 years
y que tiene
but you can recommend me 
not for helper
helpers r like


i didn't get paid enough to think too hard
about a feature im about to add
imagine wasting like 3 hours
on a feature
and then do a git restore .
because you think the feature sucks
Sounds like something that would happen to me
Joe mam door?
you are late >:(
it was for testing
i didnt want just a brown square
but that's okeh
still adding features
game is gonna take 5 years at this rate
i dont have a lot of free time these days
yeah
sometimes you just
invest too much time into smth bad
💀
OMG IT WORKED
it boots
I spent way too long for this but I finally got a working bootloader + kernel
ah
wohoo
im done
with the project
the rest will be extensions
the core is already good
A News Broadcast Bot for an Growtube
what
you mean like
read user keypress?
well its quite complex if its a cli app
well i mean
you can just
string input;
string start = "start";
cin >> &input;
if (input == start) {
}
or something similar
now i forgot if it was a pointer
or not
let me try actually
brb
oh it doesn't take in the pointer
but anyway
#include <iostream>
int main() {
char name[20];
std::cin >> name;
std::cout << name << std::endl;
}
u0_a615@localhost:~# g++ test.cpp -o test.out
u0_a615@localhost:~# ./test.out
hi
hi
u0_a615@localhost:~#
Yes
github vscode
there's also termux
run a distro in proot
install a vncserver
and install xfce4
install web browser
download vscode
install it with package manager
you can access your vncserver from VNC Viewer
from google play store
I MIGHT CONSIDER
using zsh instead of bash
due to its customizable behavior
but for now it looks shit
sus

key cow in filipino
i feel inclined to make a tiny programming language for a shitpost
call it suslang and make everything an among us reference
base it on python and keep it interpreted so the speed is horrendous
As...asse...assembly?

oh man
😔
thats gonna take like
10 seconds to compile
a hello world script
well no
depending on your parser actually
but usually parsing string in python isn't that slow
plus python already have your code cached
so it'll run a bit faster if unchanged
that's cool and all
but this is a cave that is mostly about codes
not arts
unless you're making a super readable code and it still works
that's art
Ah yes... The nerd cave (character devolopment never happend)
that's hamza
most of us experienced development
like haydot with his bootloader
hamza is probably still here making "your mama" joke
codes
you know what
fuck it
assembly kernel
because C kernel is impossible
The function wasnt running because I never called the function...
I need a fucking break lmao
ITS DONE
I LINKED IT
LES GOOOOO
THIS IS AMAZING
IT WORKS!!!!
I have never been so happy to see xone in my life
this was exactly me when I saw xone instead of "triple fault"
Helo me
hello you
alright this is now one of the biggest projects I have ever worked on
Actually I may have had some bigger projects in unity but still
All this barely works its all assembled and ran through a make file which is complex as shit
I dont understand most of it but still
Hello I would like to know how do I make a custom world
uhhh
wdym
also
I forgot how amazing programming in a high level language is
and how amazingly dead this chat is
Eh I used to make games
not anymore
Im making an os rn
But you can still help me with sprites
bro why tf did this code just print amogus
Is this like game dev<Work on OS?
Actually I have beenn thinking about doing a similar concept
But its too complicated
Otherwise it would be one fast game

my storage devices are neat
i have like 249G and 14G
also for some weird reason
/dev/sdb1 had weird 4 partition
i had to format it back to fat32
@orchid frigate guess what
i fucked up my mounts
i accidentally mounted devtmpfs to /mnt/sdcard/dev
so /dev is literally almost empty
you can't do shit in it
i had to restart my rpi to let it remount
heh
why are you coding on an rpi though lol
i use it to host my stuff

i don't code there
i mostly install packages and run stuff there
just get an aws server lol
or some kind of bare metal server
don’t rpis max out at like 8GB ram
id rather not have any liability
its supposed to be made for that kind of stuff
you have more liability with your own stuff
i live with my parent
nah it’s for 10 year olds to learn how to use computers
eh-
i mean not really its
an embeddable computer
small computer
i also have full access to my whole system
i can choose what os to use what package to add
ok how long does it take to install stuff though
edit my system to my liking
it can’t be that fast
depends
its not a definite answer
if something needs more work than just putting files
its bound to take some times
like compiling
so you have the intention to fight with me?

im literally just minding my own business
nah now I want to prove you wrong though
you sound like the type of person who would say "Oh, you use unity? LMAO, you use vulkan to render anything? Just make your own graphics API"
haydot...
that's you

i mean
you aint wrong but you also aint right
I respect people who do stuff in unity because they can actually make something
while im sitting here with my 20 files of assembly code to write X to the screen
Hmm sure
Nah I wont make my own graphics API
rpi good
Oh wait no I just realised
it uses OpenGL3.1 though

be like terry davis
but its slow and old
duh
My own BIOS
Its so hard tho
You have to do everything yourself
Atleast it searches for your gpu but I dont even know if the low level version does that
low level is like high level just lower
graphics is bad noone likes graphics
fact
terminal is better
low level can mean two things
Wait I just had an awful idea
what is it
prob
I make all the graphics with ASCII
i dont really need it though
all icons
eh
background
dwarf fortress os
desktop
it works tho
nah I already got Hexa
Before all that I need to actually build the basics of the kernel cuz Im struggling to write to screen
C is hard
is it hard or is it long and boring
Its unsafe
because you dont know if your code is bad
or your compiler is bad
or assembler
or linker
or emulator
The most you will get as an error is your emulator telling you there has been a triple fault or it flashing
meaning triple fault
🤔 what is a triple fault
and triple faults are....
something fails 3 times?
On the x86 computer architecture, a triple fault is a special kind of exception generated by the CPU when an exception occurs while the CPU is trying to invoke the double fault exception handler, which itself handles exceptions occurring while trying to invoke a regular exception handler.
lol based
or access 0xfffffffffffffffffffff
the exception handler usually handles that if there is one
i tried to call an exception, but it failed, so i called an exception caller that calls exceptions for exception callers, but that also failed so im dead now
if not an exception interupt handles that
if not
the cpu just kills itself
and resets
lel
idk why but windows must be bad at handling exceptions
y
because the blue screen of death has a lil expception at the bottom telling you what went wrong
🤔
i mean it cant fix the issue can it
just end the task thats wrong ffs
True
but im still salty
Also these handlers are very rarely used
because usually the OS never even allows them to exist and become tasks
imagine the amount of old code in windows
xdddd
theres probably stuff carried over from like
winxp
like the calculator telling you you cant divide by zero instead of trying
yeah
idk how to use windows to access undefined memory tho I wanna get a BSOD
you prob cant do smth like that
With the exception "Why are you trying to access 0xyomama?"
could be abused by malware creators
oh hell yea it can
You can access BIOS memory through that
virus can do memes during boot
kek
wait I made an error
nah the power plant exploded there
overwriting critical information on infected system drives, and in some cases destroying the system BIOS
I mean deleting stuff like that isnt that hard
what is hard is getting the virus to the pc and making the user run it with admin permissions
yeah thats what antiviruses are for
and not being detected my antivirus
And its also pretty useless
because, well you dont get anything
"Wow I destroyed this guy's pc im such a legend"
tbf
there could be uses
but it needs to be like specific
just a virus that goes around and breaks PCs isnt too useful
actually nvm
but load that onto some corp network?
its either impossible or insanely difficult
makes sense
gdt - global descriptor table
idt - interupt descriptor table
aka exception handler and interupt handler
haydot when r u gonna write virus
pretty sure they dont allow tasks that are in certain memory space
chernobyl 2 when
Uhhh I have been thinking about it but
I will nuke my pc
It is
and low level knowledge is very good
what isnt is
for it
trying to break and corrupt the descriptor tables
You have to know insanely well how they work and where they exist
basically here is the plan:
- Acess pc
- Corrupt gdt and idt
- Either divide by 0 or access some random memory space that doesnt exist like 0xdadadadadadaa
smh just mine crypto xdd
step 1 is probably like
as hard as step 2
if you want it to be efficient
and not just
"free money printing .exe"
now that I think about it the pc has so much security
Its kinda simple but also complex and very immoral
dont forget step 3
not much morality in malware itself either
its also hard
oh
compilers dont allow you
tru
assembly...idk about assembly
pretty sure assemblers dont allow you
stupid cpu manufacturers
calculator doesnt allow you
thats the assembler not allowing you
just wreak havoc until everything breaks?
I mean with the gdt and idt down
you dont need much to break everything
ANYTHING could cause a triple fault

Any click
sad
delete every file :DDD
is making this virus run on startup
so every time it resets
it triple faults
incredibly evil
trolling
The OS is completely corrupted
But the windows OS devs have been making gdts and idts for...
a very long time
so they know what they are doing
yeah but the entire thing about hacking and viruses is that you only need 1 hole
and they need to patch every single one
A virus like this could really be groundbreaking if it happened
and was possible
but naahh os dev better
you can break your pc without having to make malware
or atleast intending to make malware
sneak malware into a win10 update
you see when the OS boots its in 16 bit mode
then take out the entire windows userbase with 1 click
Meaning it has access to EVERYTHING
and thus can break anything
Worse? Malware BIOS
At this point just buy a new pc
Aight cya
you know whats fun
opening a text editor
and trying to click on every line as fast as you can
you have to click once per line
huh
fish shell be like
wat
zsh is
maybe ill marry all of them
you'll be surprised
sus
Different shells are... different
bash, zsh, fish, ash, dash, csh
Suprise suprise
there's alot more shell
Some of them have different commands
im looking for interactivity
Or easier commands
i should mod rimworld
for running shit i use bash
i tried once
probably
it was uhh
Rimword
The game that is too expensive
why does it start in 16 bit






