Building a Basic Operating System - IO from Scratch - Part 11

  Рет қаралды 9,773

James Sharman

James Sharman

Күн бұрын

Пікірлер: 111
@weirdboyjim
@weirdboyjim Ай бұрын
Join us on Discord: discord.gg/jmf6M3z7XS Follow me on Twitter: twitter.com/WeirdBoyJim Support the channel on Patreon: www.patreon.com/JamesSharman
@OscarSommerbo
@OscarSommerbo 4 күн бұрын
Twas the night before Christmas and Mr Sharman dropped a new video!
@weirdboyjim
@weirdboyjim 3 күн бұрын
Hope it didn’t disappoint!
@miege90
@miege90 3 күн бұрын
Absolutely amazing. Feels like the only thing left now is to build/connect an EEPROM programmer, so you can start building a homebrew CPU, using the JAM-1 to program it 😂
@AiOinc1
@AiOinc1 Ай бұрын
Glad you were able to use my video here, I had intended to go dig up my 486 and make it do the directory on an 800MB Conner drive, but I wasn't able to actually physically find it before you needed the clip.
@weirdboyjim
@weirdboyjim Ай бұрын
Thanks for helping out!
@thisnthat3530
@thisnthat3530 3 күн бұрын
For an EXE format I think the Atari 8 bit method is quite simple and elegent. The exe file is made of 1 or more segments, each segment starts with a 2 byte magic number (0xffff) then has a 2 byte start address and a 2 byte end address followed by the data itself. after loading all segments, the address 0x02e0 is checked by the OS to determine if it has been populated during the load, and if it has then a jump to the address stored there is executed. It allows for such things as loading a splash screen directly into video memory, loading values into harware registers to bank switch RAM, etc, etc, all before the program is executed from an arbitrary address.
@m1geo
@m1geo 14 күн бұрын
3:07 - you say "dir" is a command, yet I'm the muppet who types "ls" into DOS.
@weirdboyjim
@weirdboyjim 4 күн бұрын
It always take me a few minutes to re-adapt when switching between a unix shell and dos!
@PleegWat
@PleegWat 4 күн бұрын
I used to have that problem too, and then I started using powershell where `dir` and `ls` are both aliases to `List-ChildItem`.
@BrainSlugs83
@BrainSlugs83 4 күн бұрын
​@@PleegWatthis!
@sparthir
@sparthir 3 күн бұрын
I end up making a ls.bat file so I don't need to think about it. 😁
@jerril42
@jerril42 Ай бұрын
Thanks James. Fabulous. So cool to see JAM-1 with an OS. It has come together very nicely. Take care.
@weirdboyjim
@weirdboyjim Ай бұрын
Glad you enjoyed it! Getting some pressure to add a keyboard to make it stand alone now.
@edgeeffect
@edgeeffect Ай бұрын
Yeah... it really really is like a "proper computer" now. I love how you new command line BOTH deals with files AND still has all the disassembly and dump stuff in the same interface. Exactly what I really really wanted back in the 8-bit days.
@weirdboyjim
@weirdboyjim Ай бұрын
Thanks! Need to write a few more utilities, be nice to have a text editor!
@edgeeffect
@edgeeffect Ай бұрын
@@weirdboyjim Oh yes... very nice!
@JanBruunAndersen
@JanBruunAndersen 3 күн бұрын
Joe is a nice little editor.
@Otakutaru
@Otakutaru 3 күн бұрын
YES YES YES! I'm always blown away by the amount of work taht has gone into the project int order to be able to do this kind of things
@weirdboyjim
@weirdboyjim 3 күн бұрын
Glad you are enjoying the project!
@iamdarkyoshi
@iamdarkyoshi 3 күн бұрын
Dude this project is so cool, you deserve soooo many more views
@your_utube
@your_utube 2 күн бұрын
Always fascinating to watch. Now all that is needed is a compiler, or am I jumping the gun here? In any case, I want to wish you a very blessed Christmas James, and thanks for making Christmas day so much more interesting with your video and may the project blaze on into 2025. Now, If you can excuse me, I am going to the kitchen to see about helping the wife with prep for our Christmas feast!!!
@Dustycircuit
@Dustycircuit 4 күн бұрын
This is such a great educational project. I love it!
@weirdboyjim
@weirdboyjim 3 күн бұрын
Glad you like it!
@helmutzollner5496
@helmutzollner5496 3 күн бұрын
James, it is truely amazing how for you have taken this project now. Well done. I am wondering how much futher you will drive the hardware in the future. Really stunning how responsive the system is running, even without interrupts. ❤
@weirdboyjim
@weirdboyjim 3 күн бұрын
Glad you are finding it interesting, just finished a new graphical demo I know you’ll like when it releases!
@helmutzollner5496
@helmutzollner5496 3 күн бұрын
@weirdboyjim 😆
@skmgeek
@skmgeek 3 күн бұрын
This is an amazing birthday present! Thank you so so much for making these videos, they always make my day!
@olavl8827
@olavl8827 3 күн бұрын
Fantastic work as usual! Clever to tame the monitor's memory usage by putting its functionality in external programs. I know everyone wants to see a C compiler and/or a BASIC interpreter for this computer. But how about CHIP-8 as well? Your computer seems well capable of running a CHIP-8 virtual machine and there are many programs and games already written that you could then run.
@bkuker
@bkuker 4 күн бұрын
You could have saved a couple bytes using the right names like "ls" and "cat" ;) The rom vs disk monitor at the end reminds me of the Apple days, where you might boot into ROM basic instead of ProDOS by mistake, spend hours writing a program, and then realize you can not save it because you have no operating system.
@weirdboyjim
@weirdboyjim 3 күн бұрын
The bytes might be handy one day! But they are file names so I wouldn’t actually be saving anything.
@bkuker
@bkuker 3 күн бұрын
@@weirdboyjim I realized that, but figured I'd leave my dos v unix swipe up anyway. I do think the spirit of this machine is more early pc than early unix, so you chose right. Awesome progress as always!
@frognik79
@frognik79 3 күн бұрын
DOS shell + mouse would be nice. Give those gfx a work out.
@KitsuneAlex
@KitsuneAlex 3 күн бұрын
The only gift i need for christmas! Great video as always
@wallyhall
@wallyhall Ай бұрын
This is so brilliant. (!). As you say, it feels like a “real computer” more and more - and I think that is demonstrated by the fact you’re “progressing faster” (if that makes sense). Do you intend to implement anything analogous to software interrupts?
@weirdboyjim
@weirdboyjim Ай бұрын
Glad you liked it! Do you mean interrupts like the "int xx" instruction that x86 machines use to communicate with system routines? No plans for that (although I could create a "int" macro for accessing the jump table) I do want a cleaner route to this for Jam-2 though.
@wallyhall
@wallyhall Ай бұрын
@ yeah, something analogous to the int instruction. I’ll look forward to seeing what Jam-2 brings!
@twobob
@twobob 3 күн бұрын
Best project, got even better. Merry holimass James.
@pipsqueak2009
@pipsqueak2009 Күн бұрын
That’s fantastic progress!
@KludgesFromKevinsCave
@KludgesFromKevinsCave 4 күн бұрын
Lovely! You really capture the flavour of the period. I'm mildly surprised that you didn't add some sort of bank switching, so you could put a lot of the kernel/OS functions into shadow memory and leave more for apps. I once built a Frankenstein monster of a CP/M system that had half a megabyte of memory, with the bottom 32k (except for page 0) swappable. I had a text editor (based on Mince - Mince Is Not Complete Emacs) and a compile-link-go system (based on BDS C) that both had their code partitioned into overlays. They'd have their bank switcher up in the space occupied by the CP/M CCP. 256k of the memory could be configured as a RAM drive or a disk cache. That system got me through my MSEE!
@weirdboyjim
@weirdboyjim 3 күн бұрын
It wouldn’t be that tough to make a bank switcher, but that is usually just a retrofit so I’md rather build a new system with a larger native address bus in the future!
@DaedalusRaistlin
@DaedalusRaistlin 4 күн бұрын
That's an awesome milestone! Your custom PC has fascinated me for ages, it's great to see it's software capabilities take a nice big stride. I wonder if I could port the C4 compiler/interpreter/thingy to your architecture, then you'd have a C compiler (I've written a whole toolset for that already, including a multitasking kernel. Just have to update the compiler to output the native assembly.) How hard would it be to make a multitasking kernel I wonder...do you have an interrupt for the RTC, or something else that could be used for pre-emptive multitasking? It may not be too difficult... Still, a lot of the fun is doing all that yourself.
@weirdboyjim
@weirdboyjim 3 күн бұрын
Someone on discord already has a C compiler up and running, I don’t know much about the C4 toolchain
@YadraVoat
@YadraVoat 2 күн бұрын
You have so precisely the same accent as Thunderf00t, such that I was very confused what happened to his face, and hair color! 😁
@porklaser
@porklaser 3 күн бұрын
I think this is my favorite video so far. It very well illustrates how powerful and useful an operating system can be. All of those building blocks , code, tools, utilities all brought together under one interface. No longer any need to modify the entire source to change or add one function, simply compile and update the modular executable and drop it on the SD card. Love how the old demos/code came along too!
@weirdboyjim
@weirdboyjim 3 күн бұрын
Hopefully I’ll be able to get all the old demos up and running as executable files.
@m1geo
@m1geo 14 күн бұрын
Really enjoyed this one James! One of my favourite episodes!
@weirdboyjim
@weirdboyjim 4 күн бұрын
Good to hear George!
@alabamacajun7791
@alabamacajun7791 4 күн бұрын
Having an OS is a major jump, congrats. Maybe Electric Rabbit and Snak Jams games will hit store shelves soon 😜 Just looking at the overall system footprint is amazing for how small it is. Impressed!
@weirdboyjim
@weirdboyjim 3 күн бұрын
Thanks! Glad you are enjoying it!
@damianvila
@damianvila 4 күн бұрын
Fantastic James! Congrats. Somebody mentioned BASIC, and I was thinking that MS BASIC source code is actually available on Github, so probably no need to create an implementation from zero, if you wanted that (though I understand not wanting to have BASIC, it’s so impractical nowadays. Just something us old timers like 😆)
@weirdboyjim
@weirdboyjim 3 күн бұрын
I might take a look at that some time, no idea how plausible a port would be.
@DavidLatham-productiondave
@DavidLatham-productiondave 3 күн бұрын
Excellent! It's such a relief to be free of the ROM.
@weirdboyjim
@weirdboyjim 3 күн бұрын
It’s been on a continuous trajectory of needing fewer rom contents changes for a while!
@DavidLatham-productiondave
@DavidLatham-productiondave 3 күн бұрын
@weirdboyjim does boot.bin completely replace the ROM monitor? In other words do you swap the ROM for ram? If so you can eek out more speed with ram generally being faster than ROM.
@weirdboyjim
@weirdboyjim 3 күн бұрын
@ the rom already gets shadowed, so the whole of memory is ram by the time code is running.
@johnwilson3918
@johnwilson3918 3 күн бұрын
James! I've been 'away' for some time... I come back and you have an OS! I'd love to see a C Compiler. I'm about to start one for my (more humble) microprocessor - using the text from Frazer and Hanson. Have a good Christmas!
@adamclark1928
@adamclark1928 4 күн бұрын
James, this is impressive and it looks to be fast approaching the finish line. How much is really left with this project? I am interest to see your next project will be.
@weirdboyjim
@weirdboyjim 3 күн бұрын
Circuitry is just some extra modules on the vga circuit. Should be getting to them soon. Writing games and demos will take some time but that will overlap with some groundwork on new stuff.
@talideon
@talideon 3 күн бұрын
Nice work! While the commands might not be quite complex enough to justify it yet, do you have any plans to introduce an autoexec.bat equivalent and/or aliases? I can see things like aliases being useful for commands like "write" so you can hide addresses behind a friendly name, and it shouldn't cost too much memory if the alias names are encoded in a trie.
@weirdboyjim
@weirdboyjim 3 күн бұрын
Something like a batch file may not be that tough, I’d need a text editor on the system first or it wouldn’t be very useful.
@kepanoid
@kepanoid 3 күн бұрын
Thank you for this Christmas present, including all the colourful lights! What happens when you run a program that doesn't end naturally? How would you go about stopping it without a total reset? As in: ctrl-c, how?
@weirdboyjim
@weirdboyjim 3 күн бұрын
I have a bit of common code that exits on a keystroke, but if I make a mistake I have reach for the reset button!
@ruevs
@ruevs 2 күн бұрын
"Jam 1" would soon be ready enough for "Tiny Tapeout". I wonder how many tiles it would fit in.
@glennallan7561
@glennallan7561 3 күн бұрын
Wow! Than you. You are an inspiration!
@weirdboyjim
@weirdboyjim 3 күн бұрын
Glad to hear you are enjoying it!
@khatharrmalkavian3306
@khatharrmalkavian3306 22 күн бұрын
Will the GUI be called WindowJAM?
@weirdboyjim
@weirdboyjim 18 күн бұрын
I think GUI may have to wait for a future system. 😅
@roostertechchan
@roostertechchan 3 күн бұрын
It's a quite funny coincidence but in Turkish the word for window is 'cam', which is pronounces as 'Jam' 😁
@ruevs
@ruevs 2 күн бұрын
@@roostertechchan and in Bulgarian window is "прозорец" (prozoretz), but "Jam" is slang for window borrowed from Turkish. The correct transliteration of the word - as we use it in Bulgarian would be "dzham". " WindowDzham" wold be a rather obscure name, with a reference understandable to few, for the hypothetical future windowing system of the hypothetical future computer :-)
@roostertechchan
@roostertechchan 2 күн бұрын
I know, but I thought the reference is too far fetched 🤷‍♂️
@SieIaQ
@SieIaQ 4 күн бұрын
Very impressive work. You should make a book about all your beautiful work, that could survive doomsday. So one day humans could start from scratch based on "Von Sharman" architecture ;) Btw. Did you consider more Unix like OS or μClinux ? or this is next step ? Merry X-mas !
@weirdboyjim
@weirdboyjim 3 күн бұрын
The “OS” will not get very advanced on this hardware, future builds where I have some more ram will have need of more.
@bradywb98
@bradywb98 Ай бұрын
Hm, I noticed that when your BIOS routine was called by `hellorld`, it did so via a jump, not a call. The jump table also just jumps instead of calling. I might be missing something really obvious, but how is execution returned to the resident program? Also, I think it’s extremely impressive how quick something like `cd` or `dir` executes given that they’re being loaded from disk each time. I suppose they’re not very big, but there’s a fair bit of file system code to retrieve the executable.
@weirdboyjim
@weirdboyjim Ай бұрын
I wondered if someone would ask about. This is called a “Tail call”, when a function call is the last thing you want to do in a function you use jump rather than call, then the child functions ret instruction return to the parent functions caller. Saves a few bytes and cycles.
@bradywb98
@bradywb98 Ай бұрын
Ah of course! I don’t think I’ve ever seen an assembly example of a tail call, so that’s pretty neat.
@bobfish7699
@bobfish7699 4 күн бұрын
Awsome James. Working on BASIC yet?
@weirdboyjim
@weirdboyjim 3 күн бұрын
Not done anything yet, would be nice to have something higher level.
@sim82
@sim82 3 күн бұрын
Seems to be a common theme... in my own 6502 'OS-ish monitor thingie' the 'help' and 'ls' commands currently just print out 'sorry, you're on your own...' 😬
@weirdboyjim
@weirdboyjim 3 күн бұрын
So I was above the curve having actual help all this time?
@sim82
@sim82 Күн бұрын
@@weirdboyjim definitely! Your CPU build was the main reason for me to start into my current 6502 adventure.
@bzuidgeest
@bzuidgeest 3 күн бұрын
If I understood correctly you put the os in ROM. Why not put it in ram? Or is that too small? I cannot remember how much ram your computer has to play with. You could have a very small monitor load the os from SD, basically you would almost never have to update the monitor eeprom again.
@Schwuuuuup
@Schwuuuuup Ай бұрын
For the folks following in your steps or that are otherwise inspired by it, are there things that looking back you would have done in a different way? Is it maybe a short talk (for the second channel)?
@weirdboyjim
@weirdboyjim Ай бұрын
I did a video a while back called "Design retrospective" kzbin.info/www/bejne/h4uwlHV7icmsmqM which covered some stuff. I may do a similar video when it's fully done that covers the whole system.
@peter.stimpel
@peter.stimpel Ай бұрын
Nice. Things are coming together. Do you have any plans to open this can of worms called Codepages and Regional Settings? Not that I find it useful, but the engineers of that time were facing such challenges, and so I ask myself if James want to face them as well.
@weirdboyjim
@weirdboyjim Ай бұрын
Not something I’ve thought about. When I’m outputting to a terminal that works with utf8 I get natural support for basic Unicode anyway.
@peter.stimpel
@peter.stimpel Ай бұрын
That is the "boring" way - LOL. I was hoping for some broken encoding one day, you know. As it was in the old days ... Sorry for such forbidden thoughts
@KludgesFromKevinsCave
@KludgesFromKevinsCave 4 күн бұрын
@@weirdboyjim Wise decision. Mojibake were the plague of my existence for quite a while.
@djsmeguk
@djsmeguk 4 күн бұрын
Very nice indeed. Next up, BASIC interpreter? 😂
@weirdboyjim
@weirdboyjim 3 күн бұрын
It would indeed be interesting to get something high level going.
@ffsireallydontcare
@ffsireallydontcare 4 күн бұрын
It would be great if you could provide access to your public resources outside of Discord. Some of us *cannot* use Discord.
@weirdboyjim
@weirdboyjim 3 күн бұрын
What restrictions are you under? I’m trying to avoid multiplying up the number of things I have to keep track of.
@ffsireallydontcare
@ffsireallydontcare 3 күн бұрын
@@weirdboyjim Feel like moving off KZbin too? The KZbin censorship bot's bottom lip started quivering ... Let's try again... Discord banned my account before I even finished the signup process. Seriously. The home screen hadn't even finished loading. Official Discord client, no funny business. Trust and Safety eventually unlocked it with an "oops our bad", only to ban it again 2 weeks later for no reason. 32 days after filing the appeal T&S finally responded with a "we can't find your account", because locked accounts are automatically deleted after 30 days. Now my mobile number cannot be used for another signup, and a mobile is *required*. It saddens me that so many interesting and open source projects are locking their communities away behind such a rubbish proprietary system that can't be archived for future reference by open systems.
@luz_reyes_676
@luz_reyes_676 3 күн бұрын
@@weirdboyjim maybe you could put your stuff on ben eater's website. if discord isnt enough. not saying its a good idea. just the first idea i thought of.
@TomStorey96
@TomStorey96 Ай бұрын
Very impressive! This would surely make this feel much more like a standalone computer and less of an embedded platform. I have a long term goal on my list to make my own OS of sorts using the FreeRTOS kernel, so it would end up being a (probably pre-emptive) multitasking OS, with executables compiled as ELF binaries, and have capabilities like TSRs and loadable device drivers (I guess they are very much the same thing in a way). I still have a few things to learn and figure out before then though, like how to make a binary that can be loaded anywhere in memory and still run, but this serves as great inspiration towards such a thing! Thanks 🙂
@weirdboyjim
@weirdboyjim Ай бұрын
Sounds like a good project. Relocatable code always used to be accomplished by have an executable file section that lists all the pointers for load time relocation.
@TomStorey96
@TomStorey96 Ай бұрын
@weirdboyjim yep. I've been playing around with .exe's recently, writing C in Turbo C, compiling it, and extracting the executable code to make a ROM image to run on my 286 board. That just has a table of segments and offsets that you need to add a value to. I assume ELF would be similar to a degree, but I haven't looked too much into it yet.
@kingnick6260
@kingnick6260 3 күн бұрын
The KZbin algo sent me here after searching for Nvidia Infiniband switches. It knows me too well!
@younessamr6802
@younessamr6802 2 күн бұрын
the most important part of an OS is syscalls
@JyrkiKoivisto
@JyrkiKoivisto 4 күн бұрын
Kind of Amiga OS like library jumptable
@talideon
@talideon 3 күн бұрын
What popped into my head, given the naming scheme, was RISC OS's SWI interface.
@weirdboyjim
@weirdboyjim 3 күн бұрын
Jump tables like this are pretty common if the cpu doesn’t have something handy like software interupts.
@AJB2K3
@AJB2K3 3 күн бұрын
Nice!
@matthewpeterson5159
@matthewpeterson5159 4 күн бұрын
relocatable files when? :P
@weirdboyjim
@weirdboyjim 3 күн бұрын
The way my Isa handles pointers that could be tricky!
@JanBruunAndersen
@JanBruunAndersen 3 күн бұрын
Next up: A port of Tiny C.
@weirdboyjim
@weirdboyjim 3 күн бұрын
Someone on discord already has a ‘c’ compiler up and running!
@-lolus-
@-lolus- 4 күн бұрын
the best thing is that it is better than windows, maybe i cant watch YT, but at least it does not spy on me XD
@benhetland576
@benhetland576 3 күн бұрын
Making that thing able to display YT videos would actually be an interesting future project! It's amazing what this thing can do already.
@-lolus-
@-lolus- 3 күн бұрын
@@benhetland576 i mean, 144p @1 FPM maybe, but it also has to litle memory for things like that. but man can dream
@weirdboyjim
@weirdboyjim 3 күн бұрын
No spyware in the wild for Jam-1 yet!
Une nouvelle voiture pour Noël 🥹
00:28
Nicocapone
Рет қаралды 9 МЛН
The Dark Matter of AI [Mechanistic Interpretability]
24:09
Welch Labs
Рет қаралды 67 М.
Playing Music on the Oldest Running Computer in America!
27:06
Usagi Electric
Рет қаралды 171 М.
Introduction to CPU Pipelining
10:29
Merlin Wellington
Рет қаралды 49 М.
Intro to Data Oriented Design for Games
52:35
Nic Barker
Рет қаралды 33 М.
The Dome Paradox: A Loophole in Newton's Laws
22:59
Up and Atom
Рет қаралды 759 М.
This open problem taught me what topology is
27:26
3Blue1Brown
Рет қаралды 592 М.
I built a 1,000,000,000 fps video camera to watch light move
29:08
AlphaPhoenix
Рет қаралды 665 М.
C++ Weekly - Ep 460 - Why is GCC Better Than Clang?
17:31
C++ Weekly With Jason Turner
Рет қаралды 18 М.