YouTube2Text

vas-y, viens, on recode Windows de zéro — Transcript

by V2F · 4,821 words · 502 segments · language en · Watch on YouTube

Full transcript

  1. 0:00The most complicated code project.
  2. 0:02This is what is said.
  3. 0:03Every time I look for info on how to code an operating system,
  4. 0:07there's a whole paragraph telling me
  5. 0:09"You're gonna bleed!"
  6. 0:12And that makes sense.
  7. 0:13Your screen, your mouse, your keyboard, your hard drive, it's up to you to manage them.
  8. 0:17You have nothing, nothing at your disposal.
  9. 0:19The most basic and innocuous functions no longer exist.
  10. 0:21And it takes you hours of research and hundreds of lines of code to recreate how they work.
  11. 0:26Python went away, looking for milk.
  12. 0:28He will never come back.
  13. 0:29And your adoptive parents are C and Assembly.
  14. 0:31A scenario worthy of the Baudelaire Orphans.
  15. 0:34But no, no, don't cry.
  16. 0:36The situation could be much worse.
  17. 0:38And it juste became worse.
  18. 0:40Victor, you have one week to get as close to Windows 11 as you can.
  19. 0:45No more.
  20. 0:46Deal with it.
  21. 0:52Why am I doing this to myself?
  22. 0:54All this for likes.
  23. 0:55Maybe it's time to stop YouTube.
  24. 0:57Go to the countryside and...
  25. 0:58Shut up.
  26. 0:58The clock has already started.
  27. 1:01Why do you keep looking at my phone?
  28. 1:03Yeah, I'm on public Wi-Fi.
  29. 1:05So what?
  30. 1:06Eh, dangerous?
  31. 1:07What do you mean it’s dangerous?
  32. 1:08There's nothing to fear.
  33. 1:09All sites use HTTPS.
  34. 1:11My data is encrypted.
  35. 1:12There's no way a hacker can see them.
  36. 1:14Yeah, except the free Burger King Wi-Fi hotspot was created by a hacker.
  37. 1:19It can see all the sites you visit, how long you spent there.
  38. 1:22And even worse, it can carry out an SSL stripping attack to force you to use HTTP.
  39. 1:27When you communicate.
  40. 1:28With websites.
  41. 1:29So no more encryption and all your sensitive data is actually visible.
  42. 1:33To avoid this, simply use CyberGhost VPN, the sponsor of the video.
  43. 1:38This VPN will hide all your info and keep your data encrypted at all times.
  44. 1:42No more worries.
  45. 1:43Thanks to their 11,000 servers in 100 countries, you can say goodbye to geo-blocked content
  46. 1:46and hello to the international catalog of 40 different streaming services,
  47. 1:51including for example Netflix, Prime Video and Disney+.
  48. 1:54CyberGhost VPN is reliable and easy to use on Windows,
  49. 1:58MacOS, iOS, Android and even on Smart TVs or consoles.
  50. 2:02You can use it with this device simultaneously, which is perfect for the whole family.
  51. 2:06And yeah, it's not for nothing that 38 million users trust them
  52. 2:10and their rating on Trustpilot is excellent.
  53. 2:12Use the link in description now to get 83% off your subscription.
  54. 2:16Or 2.03 euros per month with 4 months free, 45-day money-back guarantee
  55. 2:22with support available 24 hours a day if you have a problem.
  56. 2:26So what are you waiting for?
  57. 2:26Ok, now we code.
  58. 2:28The first step is obviously a Hello World.
  59. 2:31When you learn a new programming language, this is what you start with.
  60. 2:34Showing Hello World on your screen.
  61. 2:37Well, we're going to do the same.
  62. 2:38An OS or "Système d'exploitation", but saying OS is faster.
  63. 2:42Sorry academics.
  64. 2:43An OS that just displays Hello World.
  65. 2:46And that's it.
  66. 2:46Well yeah, that's it, so hurry up we haven't...
  67. 2:48Hehehe haven't you listened to the video or what?
  68. 2:50That's already a lot.
  69. 2:51Usually, doing a Hello World is literally one line of code.
  70. 2:55Here it is 27 lines of code.
  71. 2:57And you'll have to
  72. 2:58read several pages of docs to understand exactly what happens when your computer turns on.
  73. 3:02But luckily for you, I'll sum it all up for you.
  74. 3:05When you turn on your computer, the first program that launches is the BIOS or UEFI on the most modern machines.
  75. 3:10But I'm going to focus on the BIOS.
  76. 3:12This little software is located on a chip on your motherboard.
  77. 3:15Everything is already coded by its manufacturer, there's nothing to do.
  78. 3:17The BIOS will take care of identifying and configuring your computer's hardware.
  79. 3:21Once this is done, it launches the POST test which consists of checking that everything is working properly and displaying the results on the screen.
  80. 3:27If everything is OK, it will then want to give commands to our OS.
  81. 3:31But how does it know where our OS is?
  82. 3:35How big is he? Which function to call?
  83. 3:37Well he doesn't know anything about it.
  84. 3:38You see the BIOS, it's a little stupid, a little archaic.
  85. 3:41Well sorry but it's the truth my guy.
  86. 3:43We will have to help it by coding a small intermediate program between it and our OS, called the bootloader.
  87. 3:49The advantage of the bootloader is that it can be created following very strict specifications defined by the BIOS,
  88. 3:54which will allow it to be easily found by the latter.
  89. 3:57Because yes, exploring the 4 Terabytes of my SSD in search of a piece of code is not viable.
  90. 4:03To avoid this, we will place the code of our bootloader in the boot sector,
  91. 4:07a single address that the BIOS will look at to see if our bootloader is there or not.
  92. 4:11Much simpler, heh?
  93. 4:12But how do we know that the bootloader code is there and that it's not just random data?
  94. 4:17Well thanks to two properties.
  95. 4:19The bootloader code must be exactly 512 bytes long and will always end with this very specific binary signature.
  96. 4:27So our BIOS analyzes the boot sector of each storage device that the computer has,
  97. 4:32and it looks to see if there is a 512 byte segment that ends with our signature.
  98. 4:36If so, it knows it's the bootloader.
  99. 4:38So it loads its code into memory, more precisely at address 0X7C00, and executes it from the very first bit.
  100. 4:46Ok, let's code this.
  101. 4:47But in what language?
  102. 4:48Well, you guessed it...
  103. 4:52Yeah, I know.
  104. 4:53But it is the language that translates most directly into binary for our machine.
  105. 4:57And it is the only one to meet all the required characteristics.
  106. 5:00There's no choice.
  107. 5:00Let's start at the end, with the binary signature.
  108. 5:04For that, you just have to define it.
  109. 5:06And yes, this number is indeed our signature, but we just wrote it in hexadecimal.
  110. 5:10Now let's make sure the file is exactly 512 bytes.
  111. 5:14This last instruction takes two bytes.
  112. 5:16We have 510 left to fill.
  113. 5:18We will therefore calculate the size of our code from the current position to the first line,
  114. 5:23and see how many bytes we are missing.
  115. 5:25And for this missing number,
  116. 5:26we will repeat adding zero.
  117. 5:28So if we look at the binary file created from our Assembly,
  118. 5:31we have our signature, our code which will be at the beginning,
  119. 5:34and between the two, we added lots of zeros to reach 512 bytes.
  120. 5:38Now all that remains is to write something on the screen.
  121. 5:41How ?
  122. 5:42Do you remember BIOS?
  123. 5:43The quickest way to do this is with his help.
  124. 5:45Yeah, maybe we shouldn't have insulted him after all.
  125. 5:48I told you that the BIOS displayed the results of the POST test on the screen.
  126. 5:51So that means it has a function that displays a character on the screen.
  127. 5:56We can ask him to use it for us.
  128. 5:58This request is made via an interrupt.
  129. 6:01An interrupt consists of asking our CPU to stop what it is doing,
  130. 6:05execute a priority request, then return to what it was doing before.
  131. 6:09The 0X10 interrupt is the one that allows you to ask the CPU
  132. 6:13to use the BIOS video display service.
  133. 6:16And to communicate our exact desire to the BIOS,
  134. 6:19we will transmit values ​​to it via the CPU registers.
  135. 6:22A register is just a small place where you can store data.
  136. 6:25More precisely,
  137. 6:26by storing the value 0E in the AH register,
  138. 6:29we ask to display a character on the screen.
  139. 6:32We could also have asked to display a pixel
  140. 6:34or change the position of the cursor, for example.
  141. 6:37And in the AL register, we store the character that we want to display on the screen.
  142. 6:41So we file our variables by modifying the values ​​of the CPU registers,
  143. 6:45then we call the interrupt.
  144. 6:47The CPU takes control, looks at what the interrupt corresponds to
  145. 6:50and gives control to the BIOS which then takes care of looking at
  146. 6:53which functions we want to use,
  147. 6:56by recovering the value of the AH register.
  148. 6:58He now knows that we want to display character.
  149. 7:00It looks for the value of the AL register to find out which one and it does so.
  150. 7:03And that's it, it's done.
  151. 7:05We are going to display a character.
  152. 7:06One last thing, we're going to add an infinite loop,
  153. 7:09a piece of code that the CPU will execute continuously without stopping.
  154. 7:14For what ?
  155. 7:14Because the CPU has the grind mindset, my guy.
  156. 7:17He never stops working.
  157. 7:18It wants to execute instructions non-stop.
  158. 7:21And if it gets to the end of our bootloader code,
  159. 7:23then it's going to execute the code that's right after.
  160. 7:26in memory.
  161. 7:27Except that these are random values ​​which mean nothing.
  162. 7:30So he executes non sense and it will crash, this moron.
  163. 7:34But if we block it in our infinite loop, it won't crash.
  164. 7:37And there we are.
  165. 7:38H was displayed on the screen.
  166. 7:41That's good, but we're missing 10 letters.
  167. 7:44We could just copy and paste and then that's it.
  168. 7:47But doing that is disgusting.
  169. 7:480 out of 10.
  170. 7:49But there is potential.
  171. 7:50And to achieve it, we just need to create a function
  172. 7:52that we execute for each character in our sentence.
  173. 7:55Hello world.
  174. 7:568 minutes.
  175. 7:57We took 8 minutes of video to explain hello world.
  176. 8:01I think you understand now what a mess we find ourselves in.
  177. 8:04So, now it's time?
  178. 8:06We will finally boot our OS?
  179. 8:07No, we need to go into protected mode first.
  180. 8:11CPU manufacturers are obsessed with backwards accounting.
  181. 8:15They want that if you take an old, very prehistoric iOS
  182. 8:18and run it on your state-of-the-art CPU, it works flawlessly.
  183. 8:21And to do that, you have to emulate a prehistoric CPU.
  184. 8:25Wait, I think I just
  185. 8:26insulted part of my audience there.
  186. 8:28Yeah, no, no, no, but not you.
  187. 8:29Time passes faster in technology, it's a known fact, it's good.
  188. 8:32No, no, no, no, no, no, no.
  189. 8:34OK, so when we boot, our CPU behaves as if it was from 1978.
  190. 8:39This is what we call real mode in which we have, for example,
  191. 8:42less than 1 megabyte of RAM available.
  192. 8:441 megabyte.
  193. 8:46We can't stay like this.
  194. 8:47It's up to us to turn the clock forward and ask our CPU to stop cosplaying.
  195. 8:52We will do this by switching to protected mode, which will be more than sufficient for us.
  196. 8:56And we will now have, hold on, up to 4 gigabytes of RAM.
  197. 9:01And this protected mode will also allow us, as its name suggests, to protect our OS.
  198. 9:05Because in real mode, there is zero protection.
  199. 9:08You install an app, it can do whatever it wants.
  200. 9:10Access all memory, all resources, use every instruction imaginable.
  201. 9:14In short, with protected mode, we will be able to restrict external applications.
  202. 9:18There are different levels of privileges called Rings.
  203. 9:21Ring 0 is the one that our OS will use and which will have the most freedom.
  204. 9:26No restrictions.
  205. 9:27An average application will be in Ring 3.
  206. 9:30With very little access and if the app ever needs a protected resource for example,
  207. 9:34it will be forced to request authorization from our OS which will decide what it needs. is.
  208. 9:39We must therefore put in place rules.
  209. 9:41And it helps us to define these rules and give them to the CPU.
  210. 9:45We do this with the Global Descriptor Table or GDT.
  211. 9:48As its name suggests, it is a table that will allow us to define different segments within our memory.
  212. 9:55Each entry in the table defines one of these segments.
  213. 9:58We give the address of the start of the segment, its size, then certain properties that we will give it such as for example
  214. 10:03can this section be read, modified, executed, what level of privilege?
  215. 10:07And like that, everything is secure.
  216. 10:10It's interesting, huh?
  217. 10:11Well, we don’t give a damn!
  218. 10:12Oh yeah, this segmentation thing is more used these days.
  219. 10:16Now we are doing Paging, which will need to be setup again later.
  220. 10:19Well, if we have time.
  221. 10:20But despite everything, we must define a GDT.
  222. 10:23It's mandatory.
  223. 10:24Once again, a matter of regulation.
  224. 10:25A story of retro-accounting.
  225. 10:27We will therefore create a GDT with in fact...
  226. 10:29no segmentation.
  227. 10:30This is called the Basic Flat Model,
  228. 10:33which is also described in the Intel user manual.
  229. 10:36This consists of integrating three entries into our GDT table.
  230. 10:39The three entries that are actually...
  231. 10:41obligatory.
  232. 10:41We start with the null descriptor,
  233. 10:43with all its bits at zero.
  234. 10:45We then define a segment which can contain code,
  235. 10:48and a segment for the data.
  236. 10:50The only difference is that code can be read, executed, but not modified,
  237. 10:53whereas data can be read,
  238. 10:55modified, but not executed.
  239. 10:57In both cases, we give them a maximum of privileges with ring 0.
  240. 11:00And we then ensure that they take up all the available space in the memory.
  241. 11:04So actually, they overlap, they're superimposed.
  242. 11:07As said earlier, we don't want segmentation.
  243. 11:09That's why.
  244. 11:09And there we have our table.
  245. 11:11All we have to do is note where it starts, as well as its size,
  246. 11:13and give this information to our CPU so that it knows where to find it.
  247. 11:17Now that we have our GDT defined, we will be able to switch to protected mode.
  248. 11:21To do this, simply disable interruptions.
  249. 11:24This is because currently
  250. 11:25interrupts are handled by the BIOS.
  251. 11:26Except that the BIOS only works in real mode.
  252. 11:28We can't use it anymore.
  253. 11:30We'll have to take care of the interruptions by ourselves later.
  254. 11:33Then, we just have to change the value of register CR0 of our CPU.
  255. 11:37As soon as this value is modified, our CPU knows that it is in protected mode
  256. 11:40and that it should no longer operate in real mode.
  257. 11:43And finally, we have one last little problem to resolve.
  258. 11:46The CPUs are super fast.
  259. 11:49And to be so efficient, they use something called pipelining.
  260. 11:52Basically, when the CPU executes a code timeline,
  261. 11:55it does so in several steps.
  262. 11:57First it loads the instruction.
  263. 11:59Then it decodes to know exactly how to process it
  264. 12:01with its different components and then it executes it.
  265. 12:05To go as quickly as possible,
  266. 12:07it can do these steps in parallel on several instructions in your code.
  267. 12:10Let's take an example.
  268. 12:11The CPU starts by loading the first line of your code.
  269. 12:15When it's finished, it starts decoding it and in parallel,
  270. 12:18it loads the next line.
  271. 12:19Once the first line is decoded, the CPU executes it
  272. 12:23and at the same time, it decodes line 2,
  273. 12:24which it had just loaded, and it takes the opportunity to load line 3.
  274. 12:28The problem we have is is that if we switch to protected mode,
  275. 12:31it is possible that the following instructions,
  276. 12:33which are supposed to be executed in protected mode,
  277. 12:36are in fact executed in real mode, since it has taken a head start with pipelining.
  278. 12:40And that causes an issue.
  279. 12:42This pipelining must be prevented.
  280. 12:44And to do that, we're going to do a long jump.
  281. 12:47We're going to take a long jump in our code.
  282. 12:50The CPU will therefore not know what the next instruction is
  283. 12:52until it has made this jump.
  284. 12:54He won't be able to charge it.
  285. 12:56He won't be able to do pipelining.
  286. 12:57He will have to wait.
  287. 12:59And we will be sure that it will be in protected mode.
  288. 13:01Now that we are in protected mode, we will finally be able to load our OS.
  289. 13:05And this OS, we will be able to code it in C.
  290. 13:10If someone had told me one day that I would celebrate the fact of coding in C...
  291. 13:12Well, to test our code, we are going to make an ultra simple OS
  292. 13:15with just a loop infinite.
  293. 13:17A bit like what we did for our OS
  294. 13:18Hello World in real mode at the start of the video.
  295. 13:20This is our C code that allows us to do this.
  296. 13:22We want to compile it to transform it
  297. 13:24into binary code to be able to execute it.
  298. 13:27But there is a small problem.
  299. 13:28Yeah, there's always a little problem when you code at low level.
  300. 13:30It's crazy...
  301. 13:31Our C compiler is designed to create binary code for Windows 11
  302. 13:35on my 64-bit machine with all the system functions and all the crap.
  303. 13:39Except that we are not going to run this code on Windows, but on this.
  304. 13:43Our rotten architecture.
  305. 13:46There is a 32 bit which has no functions from the C standard library
  306. 13:49which has nothing defined.
  307. 13:50If we compile with my current compiler, it will crash.
  308. 13:53We must therefore create
  309. 13:54a cross compiler.
  310. 13:56We will create a compiler which will produce binary code
  311. 13:59adapted to our OS that we are coding.
  312. 14:01It looks complicated, but it's not.
  313. 14:03You just need to download the C compiler code which can be found online.
  314. 14:06You give it as parameters the architecture that we want to use
  315. 14:09and which is adapted to what we are coding.
  316. 14:11Then we run that and bam, it creates a special compiler
  317. 14:15for our system with which we compile our code.
  318. 14:18OK, good, that's great, but we also need to be able to call
  319. 14:20the code of our OS from our bootloader.
  320. 14:23The problem is...
  321. 14:24We don't know where the code of our OS is.
  322. 14:26Let's solve this by linking the code of our OS with that of the bootloader
  323. 14:30and creating a disk image bootable by a computer which combines the two codes.
  324. 14:34Which means that our OS will be right after the code of our bootloader.
  325. 14:38Bootloader which is located in the boot sector, as said at the start of the video.
  326. 14:42We can now, in our bootloader,
  327. 14:44load the code of our OS from our storage device.
  328. 14:48And we do this using an already defined BIOS function,
  329. 14:50as we did for our Hello World.
  330. 14:52This time it will be with interrupt 13.
  331. 14:54Once it has executed, we loaded the code at this address
  332. 14:58into the RAM which we chose simply because we are sure that it will be a free zone.
  333. 15:02Once in protected mode, all you have to do is call this code and that's it.
  334. 15:06We have a black screen as expected in which we can see our reflection
  335. 15:09and slowly realize that we spent hours of research
  336. 15:12and hours of coding just to have a damn black screen.
  337. 15:17Let's add features to our OS now.
  338. 15:19It's a bit light like that.
  339. 15:20First of all, it would be nice to be able to display text on the screen.
  340. 15:23Ah well, it's easy.
  341. 15:24We just have to use the BIOS function as we did at the beginning.
  342. 15:27Well no, the BIOS, I told you, it only works in real mode and we are in protected mode.
  343. 15:32We'll have to make do without it.
  344. 15:33Well, don't worry, it's not complicated.
  345. 15:35The screen is managed by our graphics card and when we boot, it is in VGA mode.
  346. 15:39An old graphics mode with disgusting resolution.
  347. 15:42Again, for backwards compatibility reasons.
  348. 15:45But this VGA mode, it has a text mode which will save us a lot of time.
  349. 15:49And since we're in a hurry, that's good.
  350. 15:51Text mode already has a font.
  351. 15:53Everything you need.
  352. 15:54All we have to do is tell our graphics card which character to display and where to put it.
  353. 15:59More specifically, VGA text mode works with a grid of 80 x 25 characters.
  354. 16:04Each character in the grid is defined by two bytes.
  355. 16:07The first is its ASCII code and the second the properties with which it should be displayed on the screen.
  356. 16:12This grid is stored at the address OXB8000.
  357. 16:15So if I point to this address and then set the first byte as the letter E
  358. 16:21and the second byte as the value OX0F,
  359. 16:24I will get some code that will give us a list of the address.
  360. 16:24So I'm going to display a white E at the very beginning of my screen.
  361. 16:27And from there, displaying a character anywhere is easy.
  362. 16:30This is twice the line on which we want to display the character,
  363. 16:34times the number of columns per line, plus the column at which you want to display the character.
  364. 16:39And if we know how to print a character, we know how to print a sentence.
  365. 16:42Hello World version 2.
  366. 16:44Boy, we did it, but we're not done with screen management.
  367. 16:47Having a little cursor that tells you where you are currently is still useful.
  368. 16:51Especially when we want the user to be able to type commands.
  369. 16:54There, you probably imagine that we are just going to display a small character in our grid and that's it.
  370. 16:59Well no, each time, it’s counter-intuitive.
  371. 17:00For our character grid, we communicated with the graphics card via RAM memory.
  372. 17:05For the cursor, we will communicate directly via the input output port
  373. 17:09which links the CPU to our graphics card.
  374. 17:11More precisely, we want to communicate the position of the cursor.
  375. 17:15But there is a small problem.
  376. 17:16Yet another small problem.
  377. 17:18Always small problems.
  378. 17:19The position is 16 bits.
  379. 17:21Except that the input output port can only transmit
  380. 17:248 bits.
  381. 17:24Both 16 bits is too much.
  382. 17:27It doesn't fit.
  383. 17:27To solve this problem, we will actually use two ports.
  384. 17:30With the 3D4 port, we tell the graphics card that we send it the first 8 bits of the cursor position.
  385. 17:37Then, via port 3D5, we send these first 8 bits.
  386. 17:41We then indicate via the other port that we send the last 8 bits and presto, we then send them.
  387. 17:46And now we have a cursor that we can easily update as soon as we write on the screen.
  388. 17:50Last important point, we would like to be able to scroll when we reach the end
  389. 17:54of the screen.
  390. 17:54Well yes, you have to do everything yourself.
  391. 17:56To do this, when we reach the last line, we will just shift all the characters in our grid by one line.
  392. 18:01Screen management is done.
  393. 18:03We can even display the logo of our OS during boot.
  394. 18:06And I chose SOS as the name.
  395. 18:09I thought it perfectly described the current state of the creator of this atrocity.
  396. 18:13Now let's make sure we can interact with our OS via the keyboard.
  397. 18:18So the keyboard, it all depends on whether it's USB, Bluetooth or PS2.
  398. 18:22An old, very prehistoric cable.
  399. 18:24In the first two cases, we manage the keyboard by polling,
  400. 18:27which consists of constantly asking it, has a key been pressed?
  401. 18:30No, for sure.
  402. 18:31And there? And now? Did he press? Still not?
  403. 18:33Whereas in the case of the PS2 keyboard, it is quieter because it is the keyboard
  404. 18:37which will give us the information that a key has been pressed via a CPU interrupt.
  405. 18:41But that, the fact that it could vary, I didn't know.
  406. 18:43I thought it was the same for all keyboards.
  407. 18:45Because when you look for information on the internet, you always come across
  408. 18:49the method used for the PS2 keyboard.
  409. 18:51So, it's the one that I implemented even though I have a
  410. 18:54USB keyboard, but luckily, it doesn't matter because Kemu, Kemu, Kemu, Kemu,
  411. 19:00which is the program that allows me to test my OS by simulating it,
  412. 19:02makes my USB keyboard also behave like a PS2 keyboard.
  413. 19:07So it works perfectly even though it shouldn't. The pussy.
  414. 19:09What happens when we press a key in the PS2 version
  415. 19:12is that the keyboard triggers an interrupt and the CPU looks at
  416. 19:16how our OS wants to handle it.
  417. 19:18Except that for the moment, we are managing nothing at all.
  418. 19:20Let's change that by creating something called an ID.
  419. 19:23Phone. This is a table that will describe all possible interrupts, indicating
  420. 19:27for each one whether it is well supported, what type of interrupt it is,
  421. 19:30what level of privilege is required to call it.
  422. 19:33But above all, we indicate which function of our OS is called when this interruption takes place.
  423. 19:37Once the table is created, we send it to our CPU and that's it.
  424. 19:40In our case, it is only the keyboard interrupt that interests us.
  425. 19:43The rest, we will redirect them to a bogus function that does nothing.
  426. 19:47But when it's a keyboard interrupt, our CPU will know to redirect the code
  427. 19:50to this function of our OS which will be responsible for recovering
  428. 19:53the key that was pressed by communicating with the keyboard controller via the input output port 0X60.
  429. 20:00The port gives us what's called a scan code,
  430. 20:02which is just a number that represents a key on the keyboard.
  431. 20:05If it is a normal key, it is displayed on the screen to allow you to type something.
  432. 20:08If it is the deleted key, we delete the letter previously typed.
  433. 20:11If it is the enter key, we execute the command corresponding to what has been typed so far.
  434. 20:16But for the moment, we have no orders.
  435. 20:19I think the first one we should create is a command to create a text file and
  436. 20:23load it. And to do that, we will have to manage our computer's memory.
  437. 20:27So, you will have understood, it's always a bit the same thing.
  438. 20:29The OS takes care of managing the logic,
  439. 20:31then communicates with our computer's hardware to execute specific actions.
  440. 20:35Until now, using
  441. 20:37I/O ports or a defined space in RAM.
  442. 20:40For storage, there are several ways to manage the logic,
  443. 20:43but the one we are going to use is one of the simplest.
  444. 20:45The FAT, which, funny story, was invented by Mark McDonald.
  445. 20:52Yeah, that makes me laugh.
  446. 20:53Okay.
  447. 20:53This is our hard drive.
  448. 20:55It's divided into a whole bunch of 512 byte sectors.
  449. 20:58Remember the Boot Sector and the 512 byte Bootloader?
  450. 21:01This size comes from there.
  451. 21:02These sectors are the smallest storage unit that our hardware can read or write.
  452. 21:07So even if you ask it to write a single byte to your hard drive,
  453. 21:11it will actually write an entire sector with your byte at the beginning.
  454. 21:14Because if we manipulated one byte by one, your hard drive would be much too slow.
  455. 21:19But the fact remains that the sectors are still too small.
  456. 21:22On a terabyte,
  457. 21:23there are 2 billion sectors to manage.
  458. 21:26It's way too much.
  459. 21:27We need to expand.
  460. 21:27And this is what the FAT does, which will group these sectors into what we call clusters.
  461. 21:32In a cluster, for example, it can be 8 sectors put together.
  462. 21:35Now, we can easily note all the existing clusters in the File Allocation Table or FAT.
  463. 21:42When our OS wants to create a new file,
  464. 21:44it will browse this table until it finds enough free clusters
  465. 21:48to be able to store the file data.
  466. 21:50And when it does, it will link these clusters together
  467. 21:52so that we know that they all represent a single file.
  468. 21:55It will then put the data from our file into these clusters.
  469. 21:59And finally, in another table, the Directory Table,
  470. 22:01it will note the name of the file, its size and the location of the first cluster which contains the data.
  471. 22:06This way, when we want to load this file,
  472. 22:08the OS will be able to browse this Directory Table to find its file inside
  473. 22:12and will look at where the first cluster which has the data is located.
  474. 22:15It will fetch it and all other clusters linked to it and retrieve their data.
  475. 22:20And there you have it, it's not very complicated.
  476. 22:22You will note that the clusters are linked to all the clusters linked to it and will retrieve their data.
  477. 22:22And there you have it, it's not very complicated. You will note that the clusters in the file do not have to be side by side.
  478. 22:24They can be anywhere.
  479. 22:25And that's practical because if you have a file that you want to modify and enlarge,
  480. 22:29but it is adjacent to another, if the clusters were necessarily adjacent,
  481. 22:33we would have to write over our other file.
  482. 22:35And then it breaks everything.
  483. 22:37Whereas in our case it can just create a new cluster further in the disk with the additional data.
  484. 22:42Come on, just set up the deletion and modification...
  485. 22:46Ok, well no, we don't have time anymore.
  486. 22:48And I find it mind-blowing.
  487. 22:49A week of hard coding.
  488. 22:51I did like 1% of him.
  489. 22:52Windows 11.
  490. 22:53I really realized what a huge project this is.
  491. 22:56But you know what?
  492. 22:57I still managed to sell you my OS.
  493. 22:59Admire.
  494. 23:01In an ultra-connected world,
  495. 23:07it can be hard to focus on what's really important.
  496. 23:11But that was before.
  497. 23:13SOS, a simple, refined design that does not demand your attention.
  498. 23:18Fewer features, fewer distractions and more grass touched.
  499. 23:21Thanks to
  500. 23:22S.OS.
  501. 23:23The OS that heard your cry for help.
  502. 23:26I'm special!

About this transcript

This page contains the full transcript of vas-y, viens, on recode Windows de zéro by V2F, generated from the public captions YouTube serves with the video. The transcript has 4,821 words across 502 segments, with the original timestamps preserved so you can click any line to jump to that moment in the embedded player.

What you can do with it

Use the transcript to take notes, quote the speaker, build a study guide, generate a summary with ChatGPT or Claude via the YouTube Summary tool, or export it as a timed subtitle file with YouTube to SRT. You can also re-open it in the transcriber to translate the transcript into 100+ languages.

Free YouTube transcript tool

YouTube2Text is a free YouTube transcript generator — no signup, no daily limit. Paste any YouTube link and get the full transcript instantly, with timestamps, click-to-jump, translation to 100+ languages, AI prompts for ChatGPT, Claude, and Gemini, and exports to TXT, SRT, VTT, or Markdown.