#💽Programming Chat v2

1 messages · Page 40 of 1

rustic vine
#
local function a(b)
  if b then
    print("b exists!")
  end
end
-- can also be written as
local function a(b)
  if not b then
    return
  end

  print("b exists!")
end
#

now for the specific example I provided, its not worth it to rewrite it that way

#

but say for

#
local function a(b, c, d, e)
  if b then
    print("b exists!")
    if c then
      print("c exists!")
      if d then
        print("d exists!")
      end
    end
  end
end
-- can also be written as
local function a(b)
  if not b then
    return
  end

  print("b exists!")
  if not c then
    return
  end
  
  print("c exists!")
  if not d then
    return
  end

  print("d exists!")
end```
#

writting it like the latter reduces nesting

#

and makes it easier to read

full berry
#

alright thanks

#

i'll keep that in mind

rustic vine
#

get rid of the warns and prints unless they are for debugging
this is a personal preference, but I see a lot of people new to code they like to put warns and prints saying "X code is starting", "Y code is finished", "Z code is running", and personally I just think it clutters the output

define the function in 1 of the 2 ways
defining it using function module.func() is just cleaner than putting it into the table directly
defining it as a local function func() opens you up to some optimizations in the same file (like function inlining), and I think it looks nicer personally

simple is good complex is bad
I think everyone who writes code should read https://grugbrain.dev/, it's awesome advice and kinda funny too

spare quartz
#

if only i could get my hands on it

spare quartz
#

subtraction CF pains me again ..

spare quartz
#
53 248 - LOAD RBA
0x0000F600 - WHAT IT WANTS US TO LAOD
0x0000F600 - 53 248 = 9728
9728/512 = 19
2 sides * 80 tracks * 18 sectors
load: cyl # 0, sector # 1, head # 1

(load rba * logical block size) + (head# * 18) + (sector# - 1)
#

this math SUCKS

#

but it should hopefully work

spare quartz
#

`CHOMPY FUCKING CLUTCHED THAT SHIT!!!

spare quartz
#

anyways

#

DOS progress is resumed

#

CHS is working

spare quartz
#

tomorrow is the day i actually implement interrupts... or, well, today

#

but im going to sleep now

full berry
#
local GunObject: Gun = nil

GunObject = {
                Name = PossibleTool.Name,
                Handle = PossibleTool.PrimaryPart,
                
                Ammo = config.Ammo.Value,
                MaxAmmo = config.MaxAmmo.Value,
                
                Reloading = false,
                IsAutomatic = config.IsAutomatic.Value,
            }

function module.Unequip(character: Model)
    print("Unequipping gun")
    local Player = Players:GetPlayerFromCharacter(character)
    if Player and Player.PlayerGui then
        local GUI = Player.PlayerGui:FindFirstChild("GunUI")
        
        if GUI then
            GUI.Container.WeaponName.Text = "No Weapon"
            GUI.Container.Ammo.Text = "0 / 0"
            GUI.Container.FireMode.Text = "N/A"
        end
    end
end

This is just a base idea of what I wanted to do, but how would I "reset" the GunObject

#

because when I try to do that,

rustic vine
#

The way you've got this setup is kinda weird

#

Typically what I'd expect is a function that "makes" or "constructs" a gun "object", then methods on that "object" for actions, stuff like equip, fire, reload, etc...

#

You seem to have a singleton atm and I'm not sure that's really what you want

#

I.e., this is what I'd expect to see

local function fire(self: Gun)
end

return function()
    return {
        fire = fire
    }
end
#

And usage would look like

local gun = require(path.to.gun)

local a_gun = gun()
a_gun:fire()```
spare quartz
#

okay its time to add interrupts

#

@lavish dove i rertact any statements ive made about bios

#

csm is pretty cool

rustic vine
#

LOL

#

I tried to unpause the video because I thought it paused itself

spare quartz
rustic vine
#

oh no

timid quartz
spare quartz
#

adding a real bios..

rustic vine
#

I haven't heard this before

#

definitely worth a read!

timid quartz
#

But me no wanna do it

spare quartz
#

do it...

#

or become me ..

timid quartz
#

ew

#

I don’t wanna become you

rustic vine
#

LOL

spare quartz
#

new karl jobst video out

spare quartz
#

why do the people here set the ac to 79 F!!!!!!

rustic vine
#

73-75 is the comfortable range

spare quartz
#

its not even that hot outside

#

whenever i set it to 72 F i get told off for "wasting energy"

#

my computer is on 24/7 my room will become 85 F if i dont turni t down 😭

rustic vine
#

3 mph wind? take cover

spare quartz
rustic vine
#

why do they call it percipitation

#

thats such a fancy name

#

Temp Rain Wind

spare quartz
#

cause

#

it could be snow

#

or acid rain

rustic vine
#

add a > to the right of those 3

#

expands to

#

Snow

#

Acid Rain

spare quartz
#

lgbt

#

lgdt... load global descriptor table...

timid quartz
#

or just like idk open ur windows

spare quartz
#

too hot

timid quartz
#

its 78f

#

its not that hot

spare quartz
#

that is very hot!!!

#

and that isnt a permanent solution since in a few months itll become 110 f

timid quartz
#

bro u live in texas it gets to like 100f+

spare quartz
#

okay and

#

i've lived in literally every other corner of the country, im not used to the heat anyways :Sob:

timid quartz
#

78f aint nothin

rustic vine
spare quartz
#

also send in 5 tons of rain

#

i will literally bring rain prayers back

rustic vine
#

how did that cripple your electricity grid

#

oh cause yall aren't connected to the rest of the nation

#

right

spare quartz
#

honestly i got no clue

#

we are

rustic vine
#

what

#

I was informed you weren't

spare quartz
#

ERCOT connects to other grids for import/export through certain DC lines

rustic vine
#

so how did they fumble

spare quartz
#

generally though we're mostly self sufficient

#

a grid failure somewhere probably just took the whole thing down as they do

rustic vine
#

as they do

spare quartz
#

yes

#

tbf

#

i live right next to a gas plant and my power didnt drop

#

neither did our water supplies

#

i cant speak for anyone else though

rustic vine
#

so it does have its benefits

spare quartz
#

yeah

#

afaik it also doesn't cause people to get cancer

#

since it's got the latest safety stuff built in and they shut down their coal gens years ago

#

we also live near some solar/wind farms

spare quartz
#

BIOS structure/IVT init

rustic vine
#

gonna stream working on some of that imgui debugger thing for hopefully a little bit

rustic vine
spare quartz
#

interrupt vector table

#

like if a clock on the motherboard makes a tick, or a keyboard is pressed, in real mode an interrupt vector is looked up and jumped to the reference in memory

rustic vine
#

oh hm

spare quartz
#

the BIOS at startup on PCs makes some of these vectors either do nothing or jump to it's own hook/routine

#

so you can load your os into memory; when you're in protected mode these hooks are disabled, and the IVT no longer exists, an* IDT (protected mode ver of the ivt) is loaded by your os

#

some oses of yesteryear like MS-DOS redefined parts of the IVT as a form of syscall

rustic vine
#

cool

rustic vine
spare quartz
#

anyways i need to add interrupt push/jmp after scp sl

spare quartz
lavish dove
#

😭

spare quartz
#

haha nice

pallid loom
#

quick q

#

i've got a project i'm working on

#

backend made in express & stuff

#

what would be the reccomended path to frontend to someone that doesn't do frontend

#

currently thinking react + material ui lib

#

i just need something that has a component lib i can work with

#

and yes it has to be web based

spare quartz
pallid loom
spare quartz
pallid loom
#

do i have too many folders

pallid loom
spare quartz
#

this stupid computer

#

it's doing anything BUT hitting the reset vector

pallid loom
spare quartz
#

it's fine

#

if your server uses directory based routing thats just how it goes

pallid loom
#

each .js apart from the ones in util

rustic vine
#

Javascript? In this channel??

spare quartz
#

hooray

#

got a github account banned

rustic vine
#

Oh I thought you got YOUR account banned

spare quartz
#

😭

rustic vine
#

Also, what does script.Parent[1] do? Does it coerce the 1 to a string then index a sibling of the script called 1??

spare quartz
#

it was some account that was creating a ton of bloat issues to advertise stuff/executables

rustic vine
spare quartz
rustic vine
#

Oh no. It does.

#

😭

spare quartz
#

cursed as hell

#

C magic is at work here

rustic vine
#

LOL

#

Doing that coerce probably makes it fallback to slow __index call

#

Instead of fast pathing it

timid quartz
spare quartz
#

ok me

rustic vine
#

NOOOO DONT DO FRONTEND

#

WORST CHOICE YOULL EVER MAKE

pallid loom
rustic vine
#

Win!

pallid loom
#

I do not want to become 45 until I center a div properly

spare quartz
rustic vine
#

Let them have their fantasies

spare quartz
#

i can't if they already exist though

#

web 1.0 still exists: it's called just writing an html file yourself and using http/1.1 😭

rustic vine
#

Nope

#

It don't

spare quartz
#

or hell http/0.9 since thats supported

rustic vine
#

I said so

spare quartz
#

go back to your luau cage

rustic vine
#

He wants rust

#

Frontend

spare quartz
#

🪦

#

WAIT

spare quartz
#

its you in disguise..

rustic vine
rustic vine
spare quartz
#

lua.. luau...

#

same thing!

rustic vine
spare quartz
#

okay isnt that server also full of rust users though

rustic vine
#

Yea..

spare quartz
#

well

#

im already an ada programmer

#

do i get megabanned or what

rustic vine
#

No you gotta start shilling it

spare quartz
#

cant shill to rust users

#

they're like the flat earthers of programming

rustic vine
#

😅

#

Look at these wait times!

spare quartz
#

TSA!!! GET HIM!!

#

TERRORIST

rustic vine
#

MMMMMMMM

#

NO

spare quartz
rustic vine
#

😨

#

hey random thought. if you're ever bored, start lowballing people on facebook marketplace

spare quartz
rustic vine
#

oh good

#

thats good

lavish dove
lavish dove
proud creek
umbral monolith
spare quartz
#

IT IS TIME...

#

to redo a large amount of my decoder logic

#

the entire left hand side of ModR/M has been misunderstood this entire time

spare quartz
#

making rev 5 of the instruction format

rustic vine
timid quartz
timid quartz
spare quartz
#

have to put my thinking cap on

spare quartz
#

rev 5 instrruction format is nice ... but i have to fix 800 errors caused by switching to it..

spare quartz
spare quartz
lavish dove
#

immediate eight!! NOW!!

spare quartz
#

wyh is there sql in my game..

full berry
#

firing logic is almost done

#

now i just have to add the local bullet stuff

spare quartz
spare quartz
lavish dove
#

HOYL SHIT

spare quartz
#

worst news release ever

timid quartz
spare quartz
timid quartz
#

Yes

spare quartz
#

thanks for agreeing :3

#

ada on top

timid quartz
#

nope

#

Ada is all the way at the bottom

spare quartz
#

which means its at the top cause of wraparound

#

💪

#

anyways my cpu still has 432 errors... is hould get back to fixing it

timid quartz
#

if you have a circular array of length 10, array[9] (ada) !== array[0] (rust)

spare quartz
#

okay, but why would you use a circular array for scoring

timid quartz
#

well u said wraparound

spare quartz
#

cause the score in my model would be attributed to the lang itself

#

and id use modular arithmetic..

timid quartz
#

well if the score is attributed to the lang itself

#

then there is no wraparound

spare quartz
#

there would be if you were sorting them in a list

timid quartz
#

you just get rust.score > ada.score

spare quartz
#

and happened to modify the score below 'Min

timid quartz
spare quartz
#

oh yeah... i also need to write my own bootloader :<

timid quartz
#

type Score is range (0 .. Integer'Max)

#

and Ada’s score == 0

spare quartz
#

drop the ()s

#

BUT...

#

i think you mean Score'Min 🤓

#

and no its 'Max..

#

wait no im an idiot its 'First and 'Last 😭

timid quartz
#

Nah it’s 0

timid quartz
#

0

spare quartz
#

LOOK

#

MY MEMORY IS A LITTLE BAD OK

#

does NOT mean its the langs fault

timid quartz
#

mmmmmaybe get a better lang idk

spare quartz
#

no

timid quartz
#

like rust :3

spare quartz
#

okay ill give you a question

#

how would i easily define a fixed point dec in rust with min/max functions

timid quartz
#

with a crate

spare quartz
#

whhhyyy would i need a crate to do that

timid quartz
#

cause f32 and f64 are floating

spare quartz
#

and you can't make your own numerical types, can you?

timid quartz
#

who needs custom numerical types

spare quartz
#

literally everyone

timid quartz
#

Nuh uh

spare quartz
#

i hope this is what happens to your "crates'

timid quartz
#

Tell me one time a u8/16/32/64/128 wouldn’t have done what you needed it to do

spare quartz
#

sure

#

what if i needed a u24

timid quartz
spare quartz
#

YEAHW ELL

#

OURS ARE BETTER

timid quartz
spare quartz
#

because many formats love using 3-byte sized ints

timid quartz
spare quartz
#

(so stuff like kotlin makes unsigned crap a bit woozy)

#

my x86 cpu gets around this by doing a lot of its math in longs and then truncating them when setting values

rustic vine
#

nothing will change because of this

#

maybe unfortunately

#

maybe fortunately for you atp

spare quartz
#

fym maybe foruntrately..

rustic vine
#

LOL cause if anything changed, it'd prob include replacing ada with rust

spare quartz
#

NO

rustic vine
#

thats why I said maybe fortunately

#

because nobody will bother replacing

spare quartz
#

or rather can't...

#

theres a reason ada is where it is already...

rustic vine
#

stuff in c will stay in c, stuff in cpp will stay in cpp, stuff in ada will... probably stay in ada

spare quartz
#

and thats cause the code itself is literally certified to not do x 😭

rustic vine
#

rust prob won't even be used for new projects 💀

#

give it a century or two

rustic vine
#

beware of bugs in the above code, I have only proven it correct, not tested it

spare quartz
#

yeah your c code should hopefully be written with c, not xcode

spare quartz
#

assuming the code was formally proved in some way to not do something

#

then no testing is required

#

you know it won't ever do that thing

rustic vine
#

my code was formally proved to be bug free but still had many bugs

#

how do you explain that

spare quartz
#

where was your code

rustic vine
#

it was

#

in places

#

it converted 30 rotations to degrees then passed that number into a field that expected radians

spare quartz
#

cause testing/formal proof means nothing if you do:

  • introspection
  • radiation
spare quartz
#

sounds like your code was just not written right

rustic vine
#

the actual conversion wanted was degrees to radians lol

rustic vine
spare quartz
#

you can prove anything

rustic vine
#

I gave it a ✅

spare quartz
#

remember

rustic vine
#

reviewer said LGTM

spare quartz
#

3.1415 = 3

rustic vine
#

true

#

I used that on a test

#

didn't have a calculator

spare quartz
#

i love pasting giant strings of pi into my code even though the type its held in doesnt have that precision

#

<3

rustic vine
#

I just like pie

#

oh you're talking about the math thing

#

ok

spare quartz
#

i hate the food pie

rustic vine
#

bruh

#

hater

spare quartz
#

tastes weird

#

all of them

rustic vine
#

oh they made a new channel #premium-cave-of-makers

#

boring

#

we already had that

#

its called #1264496483957346346

spare quartz
#

well

#

there already WAS a corporate creations channel, but

#

they deleted it??

rustic vine
#

goats

spare quartz
#

and never brought it back??

#

so good management

rustic vine
#

it doesn't matter

#

the other roles are irrelevant

spare quartz
rustic vine
#

"oh I can make music"
"how do you make music"
"I open fl studio"
"how did they make fl studio"
"they wrote code"

#

its all code

spare quartz
#

ujst got reminded the cisc/risc war still exists

rustic vine
#

cisc must be irrelevant too

#

never heard of it even

spare quartz
#

are you serious or j right nwo..

rustic vine
#

"oh I can make models"
"how do you make models"
"I open blender"
"how did they make blender"
"they wrote code"
its all code

rustic vine
spare quartz
#

okay so

#

isas (instruction set architectures) have two "variants" to how they're written

rustic vine
#

oh, risc is just newer

spare quartz
#

no

#

you got complex instruction set computers and reduced instruction set computers

rustic vine
#

what

#

it says risc is the successor to cisc

spare quartz
#

well thats not true

spare quartz
#

for example you can ADD from a memory location to another memory location

#

RISC ISAs make a bunch of little insturctions to do little things per instruction

spare quartz
#

so, GET from 2 memory locations

rustic vine
#

The simplest way to examine the advantages and disadvantages of RISC architecture is by contrasting it with it's predecessor: CISC

spare quartz
#

put them in two registers

#

add the two registers

#

PUT it somewhere

#

thats a tiny little risc

#

examples of RISC... ARM, RISC-V

#

examples of CISC... x86, whatever IBM is doing

#

these mattered when designing cpus a long while ago but

#

generally they're irrelevant today because CPUs don't really care about ISAs. it's all microcode now

#

but i still see people hate on x86 just cause its cisc

spare quartz
#

but they aren't a replacement to them in any way

rustic vine
#

but why does it matter

spare quartz
#

why does what matter

rustic vine
#

if you do a lot in an instruction, don't it end up being many small instruction anyway

spare quartz
#

well again it used to matter when designing the cpu

rustic vine
#

like, if cisc wants to do something, it ends up having to do what risc does in each instruction anyway right

spare quartz
#

but now the cpu just turns whatever you're doing, risc or cisc, into specialized microcode for the operation

rustic vine
#

so like, its doing the same stuff at the end fo the day?

#

oh

spare quartz
#

the term has become watered down, especially with what ARMs doing

#

another definition for what a risc isa might do is "all the instructions must be fixed length"

rustic vine
#

oh ok

spare quartz
#

in x86, a cisc, an instruction could be one byte long, two bytes for a modrm (register/memoy location), a displacement...

#

im gonna put a disclaimer here and say i'm not like, engineer-level experienced with each of the two

#

so i might've gotten things mixed up, but that's just what i've put together so far

rustic vine
#

im like novice level but thats cool

#

thx for the explanation

spare quartz
#

maroww

#

i kinda just wanna like

#

write raw machine code for a project one day 😭

#

it's honestly not that daunting when you've got a manual (or multiple for file formats)

timid quartz
spare quartz
#

i might just rig our ISO9660 reader to be able to write ISO files and work off that

spare quartz
#

but first

#

445 errors to correct...

#

bkleh my mouse is dying

#

MOVZX r32, r/m16

spare quartz
#
fun getMemRM(
        mod: UInt, rm: UInt, regRMType: RegisterType,
        operandLength: AddressingLength
    ): MemRM = when (mod) {
        0b00u, 0b01u, 0b10u -> {
            val memRm = when (this.processor.operandSize) {
                AddressingLength.R32 -> when (rm) {
                    0b000u -> this.processor.a.ex
                    0b001u -> this.processor.c.ex
                    0b010u -> this.processor.d.ex
                    0b011u -> this.processor.b.ex
                    0b100u -> this.decodeSIB()
                    0b101u -> this.readBinaryFetch(4).toULong()
                    0b110u -> this.processor.si.ex
                    0b111u -> this.processor.di.ex
                    else   -> throw IllegalArgumentException(hex(rm))
                } + when (mod) {
                    0b00u -> 0u
                    0b01u -> this.readFetch().toULong()
                    0b10u -> this.readBinaryFetch(4).toULong()
                    else  -> throw IllegalArgumentException(hex(mod))
                }
                AddressingLength.R16 -> when (rm) {
                    0b000u -> this.processor.b.x + this.processor.si.x
                    0b001u -> this.processor.b.x + this.processor.di.x
                    0b010u -> this.processor.bp.x + this.processor.si.x
                    0b011u -> this.processor.bp.x + this.processor.di.x
                    0b100u -> this.processor.si.x
                    0b101u -> this.processor.di.x
                    0b110u -> when (mod) {
                        0b00u -> this.readBinaryFetch(2).toULong()
                        else  -> this.processor.bp.x
                    }
                    0b111u -> this.processor.b.x
                    else   -> throw IllegalArgumentException(hex(rm))
                } + when (mod) {
                    0b00u -> 0u
                    0b01u -> this.readFetch().toULong()
                    0b10u -> this.readBinaryFetch(2).toULong()
                    else  -> throw IllegalArgumentException(hex(mod))
                }
                else                 -> throw UnsupportedOperationException()
            }
            MemRM(null, memRm)
        }
        0b11u               -> MemRM(this.getRegRM(rm, regRMType, operandLength), null)
        else                -> throw IllegalArgumentException("Bad mod: ${hex(mod)}")
    }
#

decoder v2

#

actually fits on one page now

lavish dove
#

huge

spare quartz
#

codev cooked

lavish dove
#

whys it going off the screen

#

mao

spare quartz
lavish dove
#

implement vga rahh

spare quartz
#

unfortunately we are forced to when we make the move for server compat

#

as replicating the entire contents of memory wont be feasible

#

only video ram

lavish dove
#

skibidi

#

imagine doom in minecraft

spare quartz
#

that is the goal

#

the thing writing the disk error message is MS-DOS 6.22's boot loader

lavish dove
#

damn

rustic vine
spare quartz
#

btw the screen in that video is totally messedu p

#

the actual screen is on the bottom of the box and teh cropping is one pixel off

#

but we fixed that ...

#

now i just gotta fix why my branch is breaking ...

#

making a cpu is hard

#

codeveloper is working (later today) on making our keyboard not sink all inputs from the player...

#

and to actually use our keyboard block that hasn't been touched in over a year...

#

but it'll also be his first time touching the processor/bios so that'll be fun

spare quartz
spare quartz
#

yall think we coudl run ada on this??

lavish dove
rustic vine
#

that can't be real

#

is that a real thing

spare quartz
#

looks like it

rustic vine
#

naw

#

stop them before its too late

spare quartz
#

neurons interfacing with electronics isnt a new thing

#

but

rustic vine
#

they're growing human brains in a computer

spare quartz
#

looks like this is the first "wetware as a service"

rustic vine
#

SERVICE?

#

do they charge per neuron or something

spare quartz
#

neat

spare quartz
lavish dove
#

lmfao its so long

lavish dove
#

look at how long it is lma

spare quartz
#

(the asm its running)

spare quartz
#

man i feel like crying

#

poor guy

spare quartz
#

you guys ever get carried away with helping someone?

timid quartz
#

that’s neat tho

spare quartz
#

but look at it 🥺 we have real vram ...

#

also the assembly its running

#

(the trash on screen is a directory from the CD)

timid quartz
#

Now add working TCP

spare quartz
#

yknow

#

you could probably already make ascii art on this thing

#

40x25

timid quartz
#

there’s plenty of working TCP everywhere

spare quartz
#

"add working tcp" means absolutely nothing when we're at the processor level

#

the cpu doesn't know or care about that stuff

timid quartz
#

oh right..

spare quartz
#

if ms-dos tried writing to an IO port or PCIe pertenient to TCP

timid quartz
#

add uh

spare quartz
#

then we would know where to start

timid quartz
#

working peripheral interface to a simulated NIC

spare quartz
#

that'll come after we can get a serious os booted

#

our bootloader isnt insanely complex so it's essentially just a test case rn

#

also btw

#

the computer shouldnt be running as well as it does honestly

#

it runs 40x25 drawText functions every frames

#

also no ada running on it yet frowning4 just c and asm ...

#

codev and i have been talking about bringing back the BASIC casette if an os isnt found like IBM used to do though

#

(except instead of BASIC its a lua shell)

spare quartz
#

YOOOOOO IT WORKS

#

i wrote a tiny bios for ascii art

#

lemme recrod

#

see if you can recognize it..

#

@timid quartz

#

I GOT ADA RUNNING ON IT

#

this is so fun

spare quartz
timid quartz
spare quartz
#

i could get "rust" on it...

#

just need a 40x25 ascii art

#

working on how to address this effectively in asm rn though

timid quartz
#

Oh you didn’t actually get Ada running on it

spare quartz
#

lol no

#

that was just off a kernel designed to render splash text

timid quartz
#

ic

#

you know anything about keyboard layouts?

spare quartz
#

barely why

timid quartz
#

eg dvorak colemak

#

idk I’m looking at switching

#

For funsies

#

But idk which

spare quartz
#

i've really only heard of dvorak

#

that sounds weird to type in though

#

ill stick with my typewriter..

timid quartz
#

Colemak-DH looks nice but my friend uses that

#

so maybe either programmer dvorak or workman

#

trying to pick stuff that’s easily available

spare quartz
#

i wish i could write more like this

timid quartz
#

If it was it would be named uh

spare quartz
#

yes, but

timid quartz
#

',.pyf

spare quartz
#

it still looks weird to type in

timid quartz
#

lol true

#

but supposedly all these layouts are better for your hands than qwerty

spare quartz
#

if you dont have carpal tunnel you're just not good enough

spare quartz
#

decisions decisions

#

REPNE CMPS looks promising

#

REPNE SCAS..?

timid quartz
#

this is from a sample of my bash history

umbral monolith
proud creek
lavish dove
#

That's just a new feature of the library they use for it

rustic vine
#

I remember being annoyed about that because luau syntax highlighting was pr'ed into that library a long while ago but discord hasn't bumped in ages

spare quartz
#

we love discord

spare quartz
#

awesome

rustic vine
#

I gotta drop that on a review for a pr sometime

spare quartz
#

yooooo

#

new bayachao game dropped

flint belfry
flint belfry
#

like could i run an os

spare quartz
#

cause the test samples we're running on it rn are isos

spare quartz
flint belfry
spare quartz
#

it gets quite far though

flint belfry
spare quartz
#

since id assume that iso uses like

#

actual VGA

#

and doesn't rely on the textmode at the start of launch

flint belfry
#

this looks like computercraft but if it actually did cool shit

#

or whatever its called

spare quartz
#

opencomputers/computercraft yeah

flint belfry
#

yeah

spare quartz
#

those two are lua interpreters (in another way roblox scripts)

flint belfry
#

not like the mod is bad its just

#

you kn

#

yeah

#

you need to know how to code in lua

#

and it kinda made me initally think it was like vm computers

#

but no its just lua stuff

spare quartz
#

opencomputers II had a risc cpu which could run linux, but it kinda died (and RISC-V isn't as capable as x86, at least compat wise)

flint belfry
#

but if you know how to code in lua you can make some pretty cool base shit

flint belfry
#

what mc version is breadmod

#

1.12 or

spare quartz
#

1.21

flint belfry
#

win

#

make fabric port

spare quartz
#

example of a test sample rn

spare quartz
#

it makes some processes we do a lot harder with little documentation

flint belfry
#

ah

spare quartz
#

maybe in the future we'll try again idk

rustic vine
spare quartz
#

we have plans for a BreadLib to allow us to porrt to minecraft versions easier, but that'll require mega work on how the loaders work

rustic vine
flint belfry
#

if only there was like

#

a wine equivlent for forge to fabric shit

#

i think there is one but its very

#

messy and unstable

spare quartz
#

well there was a fabric-based loader that tried iirc called Patchwork

#

they died

#

i think theres a fabric to forge compat mod though lemme try and find it

flint belfry
#

not suprising

#

shit like mekanism isnt on fabric sadly

spare quartz
flint belfry
#

and there arent any fabric ports from my knowledge

flint belfry
spare quartz
#

fabric to neo

flint belfry
#

is there one in reverse

spare quartz
#

dont think so

flint belfry
#

i dont like forge 😭

#

shet

spare quartz
flint belfry
#

it runs like garbage compared to fabric and i would generally rather use fabirc

rustic vine
spare quartz
#

okay minor decoding mishap fixed

#

now to rendering the splash text

spare quartz
#

SPLASH.TXT is read

#

using the iso directory records instead of a hardcoded LBA

proud creek
#

What does this have to do with bread

spare quartz
proud creek
#

Where bread

spare quartz
lavish dove
#

bro read the elf header

spare quartz
#

actually thats our kernel elf

lavish dove
#

woa

spare quartz
#

anyways now i gotta make it actually go into protected mode and make the gdt and stuff ..

lavish dove
#

lol

lavish dove
spare quartz
timid quartz
#

that's not good

#

xmpp on top ig

spare quartz
#

telnet/netcat on top..

timid quartz
#

not encrypted 👎

spare quartz
#

UGL!!

#

sslclient!!!

#

whatever!!

timid quartz
#

even your precious us government encouraged everyone to use encrypted apps

#

smh

spare quartz
#

yeah well

#

the current government is NOT us.

#

anyways

#

windows is such a good os

#
#

(bypassing protection using an exploit in kernel-managed scrollbar code)

proud creek
spare quartz
#

honestly thinking bout making our own Bread Mod Compiler

spare quartz
#

now in protected mode

#

orrr would be

#

i forgot to uncomment the cr0 code..

pastel tinsel
#

you haven't looked into it

proud creek
#

thats ruight

spare quartz
#

added some error checking (32bits/x86)

spare quartz
snow oak
spare quartz
spare quartz
#

specifically reading this off

spare quartz
#

ELF program headers being parsed and read into memory

#

pretty simple mechanism

timid quartz
#

colemak-dh

spare quartz
#

hm

timid quartz
#

@spare quartz you know you wanna sink time into learning another keyboard layout

spare quartz
#

no i wanna sink more time into learning japanese

spare quartz
# spare quartz hm

had a bad idea about moving my bootloader backwards in memory instead of loading more data

timid quartz
#

Think about it even if your computer is unlocked

#

nobody could type lol

spare quartz
#

okay BUT

#

if i set my password in japanese

#

then nobody could log in for eternity

#

easy

#

もにに

#

like who'd ever guess that

timid quartz
spare quartz
#

wdym

#

also gonna be running some tests on the sections (idk if they're really needed for kernel loading)

#

after this i think it's just jmping to the load address

timid quartz
#

Mapped in two spots

spare quartz
#

oh yeah i know about that

#

our cpu sidesteps the "fake real mode" x86 starts in

timid quartz
#

smh

spare quartz
#

it just goes to the bios hook at F000:FFF0

timid quartz
#

lame

spare quartz
#

no

timid quartz
#

not an accurate or complete simulation

spare quartz
#

thats what real x86 does

#

we just don't have to care about uefi for now

#

i still like our BIOS design though

timid quartz
spare quartz
#

no

timid quartz
#

ok confused

spare quartz
#

it's just for ease of BIOS hooking only the first 20 bits are considered like how the original PCs did it

#

upper 32 bits are not

#

F000:FFF0 is

#

when protected mode is entered the bios hooking apparatus is effectively disabled

#

(since the bios never existed there in our computer, it just turns into empty memory for the host)

lavish dove
spare quartz
#

well it is scary when you have to consider all parts of what it can do

#

but for kernel loading we just load in the segments where it tells us to and jump to it

#

(afaik)

#

my bootloader code currently uses 80% of the 512 byte limit

#

considering it can render splash text, has error messages, basic user input

#

i think thats pretty okay

timid quartz
spare quartz
#

wait yes

#

too bad

#

host doesn't need to know our bios isnt real

#

(until it gets to reading the (E)BDA though, we have to poison those addresses cause theres no data there...)

timid quartz
spare quartz
#

our bios hook is THERE

#

(even though again that memory address isnt real for us)

#

mmmm i think this is correct for rep movsd

#

si/di.x not .ex...

timid quartz
#

Just the data is garbage

spare quartz
#

well for us the memory just

#

isnt extant at all

#

its a bios hook

timid quartz
#

wait yeah cause you’re in real mode

#

and you have to enable protected mode to get the entire 32-bit address space

spare quartz
#

we're only feeding the computer 1.5 MiB rn,,,

timid quartz
#

smh

#

feed it all 4GB it can take it

spare quartz
#

any attempts to requestMemoryAt beyond 1.5 MiB will cause the computer to implode

timid quartz
#

how r u gonna write an OS in 1.5mb

spare quartz
#

hmm.. is this correct..?

spare quartz
#

i said 1.5 MiB

timid quartz
#

Sorry mb not kb

spare quartz
#

our kernel fits in that

timid quartz
#

MB MiB whatever

#

Who cares if you’re base 10 or base 2

spare quartz
#

microsoft

timid quartz
spare quartz
#

:<

#

i commented out like 99% of the real kernel code cause it checks ACPI and serial ports n stuff

timid quartz
#

ACPI doesn’t exist

spare quartz
#

that also means we have to write our own AML ☹️

timid quartz
#

aml?

#

yaml

spare quartz
#

ACPI machine language

timid quartz
#

naaah

spare quartz
#

edx is wrong

timid quartz
#

feed your computer like 1gb and let me load the OS I’m working on onto it

spare quartz
#

is your kernel 32-bit

timid quartz
#

yes of course

spare quartz
#

then our bootloader could probably run it

#

what bootloaoder do you use

timid quartz
#

this os has a custom bootloader

spare quartz
#

boring

#

ours is better

timid quartz
#

Nuh uh

spare quartz
#

does yours fit in 512 bytes and only has one stage

timid quartz
#

mmm it’s two stages

spare quartz
#

boooooring

#

funnily enough

timid quartz
#

there’s a tiny bit of assembly that enables protected mode and then calls a C function

spare quartz
#

i kinda sucked at x86 before this cpu project

#

i think its made me an intermediate level just by working with it

timid quartz
#

and you STILL kinda suck

spare quartz
#

NO?

#

this asm is beautiful and you know it

timid quartz
#

inferior Intel syntax

spare quartz
#

at&t syntax should've died when it was made

timid quartz
#

you’re just jealous of orb

spare quartz
#

what

#

intel syntax has orb too

timid quartz
#

wgat

#

no way

spare quartz
#

dumbass we're on the same ISA

#

NASM literally wont let me compile if i dont use the b/w/d/q suffix on some instructions

timid quartz
#

this is the OS

#

you can read it

spare quartz
#

MIT??????????????????????? 🤢

timid quartz
#

yeah they’re unbased for that

#

but the x86 code is still there

spare quartz
#

we're probably gonna make a risc-v sim (rev2) after we can run DOOM on ours

#

mainly for the purposes of beating OC II for dying

timid quartz
#

ngl this kind of project seems neat

#

but I’d have no clue where to begin

spare quartz
#

wdym

timid quartz
#

idk

spare quartz
#

if you want you can take a copy of the 1.21.1-neoforge branch on intellij, and test it out on some ISOs

#

it's got an integrated disassembler for debugging

spare quartz
#

☹️

spare quartz
#

its stupid simple yet effective

#

beats out GDB's crap one by a long shot too

#

(mainly cause it actually knows the operand length of instructions...)

timid quartz
#

I will not stand for gdb hate

spare quartz
#

GDB is so shit

timid quartz
#

gdb carries my ass through every os project

spare quartz
#

cause it's the only viable tool

#

for me it just LOVES segfaulting and forcing me to get my breakpoints back

timid quartz
#

skill issue

spare quartz
#

and the assembly view is ass, it can't read beyond one instruction in real mode

#

and it completely blows up on interrupts

timid quartz
#

and thinking of where everything should go

#

and just like idk

#

when it comes to writing code it's kinda laborious

spare quartz
#

idk it's kinda just like english for me

timid quartz
#

and then all this stuff you're doing is quite advanced

timid quartz
#

it's just large-scale organization and jazz

spare quartz
#

we kinda get around large scale org by

#

introspection everywhere we can

#

no instructions in the cpu are actually organized anywhere aside from just being inside an "impl" folder and annotated IA32Instruction(opcode)

timid quartz
#

cuh

spare quartz
timid quartz
#

also I feel like

spare quartz
timid quartz
#

it's different to write an x86 interpreter

#

than it is to do whatever you're doing

spare quartz
#

... well that is kinda what we are we doing, is it not?

#

stuff like QEMU does crap like "TCG" where it can compile stuff to the hosts architecture

#

or JIT

#

we just read off the instruction stream and do as we're told

#

writing instructions is simple even if you might think it'd be complex

#

oops, that has to be converted to a UShort first

spare quartz
#

if by interpreter you mean something that just runs these instruictions but w/o the computer/processor/io backing, it's not really a simulation of x86 at all

#

its more like a fucked up disassembler in that regard

spare quartz
#

conceptually it might appear to be, and as a whole it is

#

but you don't think about these things as a whole

#

the way the CPU rn is built is just taking a reference sample (QEMU), and adjusting it to line up with QEMUs results

#
  • we run into invalid instruction errors
    • we add the instructions
  • we run into subtle memory corruption errors
    • we revise the probemlatic instructions and consult intels manuals on the operation of that instruction
  • we run into an even more subtler quirk of x86's operation like GDTs
    • we step in QEMU and see what happens there, and compare it to the processor
#

i say we as if my codev is working on it, but he does peripheral work, not processor work...

spare quartz
#

i think i rambled

timid quartz
#

im in an os class rn

#

and it kinda is

#

idk if I could have written this entire thing from scratch

spare quartz
#

you probably could have with enough time

#

cause i've been working on this for a solid month as if it were my job

#

and it's ultimately the 3rd attempt at me trying to sim an ISA

lavish dove
lavish dove
#

woah I just found out

#

putting data in the unused bits of a pointer is officially supported

#

its called pointer tagging apparently

timid quartz
#

Huh neat

#

Lots of potential for that with 64-bit virtual addresses

#

Cause in a 64-bit virtual address only 48 bits actually matter

spare quartz
#

uuughhh :<<<<<

#

qemu is giving me a "dma error"

timid quartz
#

In a 32-bit virtual address you’d have to be clever because all the bits are technically used

#

But in an ideal world everything is 4-aligned meaning you have 2 bits in the offset to work with

timid quartz
spare quartz
#

everything looks fine so idk why its complaining

#

im reading 0x25 blocks at position 0x24

timid quartz
#

uh

#

that’s not aligned…

spare quartz
#

fixed

timid quartz
#

smh

#

idk then

spare quartz
timid quartz
#

Could it be you have a virtual-physical address mismatch?

spare quartz
#

there is no mmu set

timid quartz
#

I will come write your os’s mmu…

#

Thanks keyboard

spare quartz
#

this is in the bootloader 💀

#

no

timid quartz
#

…your bootloader will get paging…

spare quartz
#

also a friend of a friend of mine is writing a rust os ☹️

#

thats MONOLITHIC ☹️

timid quartz
#

based

spare quartz
#

everyone knows microkernels are the actual only good design

timid quartz
#

Your microkernel when a system process is still depended on by tons of user space processes and still crashes leaving your user space unusable (at least the kernel didn’t panic!!)

spare quartz
#

bad design

#

your user space servers aren't designed well

timid quartz
#

that’s literally a microkernel

#

smh

spare quartz
#

you need SERVERS

#

you cannot just let the applications do whatever they want

timid quartz
#

system process == server in my thing up there

spare quartz
#

timid quartz
#

wdym ❌

spare quartz
#

a server runs in user space

timid quartz
#

You can’t tell me what I meant to say

spare quartz
#

yes i can

timid quartz
#

I said “system process”

#

To refer to a server running in user space

spare quartz
#

"system process" "user space process"

#

"user space process" depended on by tons of "user space process"

timid quartz
#

You still haven’t solved the problem of your user space dying if one of your servers goes offline

spare quartz
#

that kinda just sounds like an ISOLATED problem

spare quartz
#

ez

#

try doing that with a kernel driver

timid quartz
#

Ok what if your file system server dies and you can’t reload it from disk :3

spare quartz
#

hmmmmm

#

simple

#

we dont let that happen

#

😁

#

(you have a fallback on the kernel for raw disk access)

timid quartz
#

besides I’ll be waiting on your microkernel to do 5 billion context switches + process preemptions as all the servers talk while my monolithic kernel takes care of everything