6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Thu Nov 14, 2024 5:15 pm

All times are UTC




Post new topic Reply to topic  [ 6 posts ] 
Author Message
PostPosted: Thu Oct 31, 2024 2:05 am 
Offline

Joined: Tue Oct 29, 2024 6:04 am
Posts: 20
I want to create a small OS with bare metal CLI. What should I do?


Top
 Profile  
Reply with quote  
PostPosted: Thu Oct 31, 2024 3:27 am 
Offline
User avatar

Joined: Tue Mar 05, 2013 4:31 am
Posts: 1385
nora23169 wrote:
I want to create a small OS with bare metal CLI. What should I do?


That's a difficult question. First, have you searched around to see what's already been done in this area for the 6502? There are already several small OS type environments available. They include Dieter's CPM65, Rich Leary's DOS/65 and recently David Givens CP/M-65. Granted, all of these are based on CP/M and at least two of them use the CP/M filesystem layout. Another user here started porting Flex over to the 6502, which was a 6800 OS. You also have Fuzix, which is designed as a minimal Unix derived type of system. Yes, I'm glossing over these at a high level, just to let you know there are already options out there.

Perhaps you should define what you mean by a "small OS" and create a set of requirements for what that is. Beyond that, there needs to be some specific minimal hardware configuration that will be required to run it. Overall, a bit of a tall order, especially if you're not quite sure where to start.

_________________
Regards, KM
https://github.com/floobydust


Top
 Profile  
Reply with quote  
PostPosted: Thu Oct 31, 2024 3:59 am 
Offline
User avatar

Joined: Fri Aug 30, 2002 1:09 am
Posts: 8540
Location: Southern California
There's also this one linked on this site's source-code repository page at http://6502.org/source/, under the heading "Operating System Kernels":

  • Mini Multitasking Kernel by Joachim Deboy
            This mini-kernel uses IRQ interrupts from a free-running 6522 timer for task switching.  It supports four concurrent tasks, each receiving fixed time slices in a round-robin method.

(Note:  It's for the NMOS 6502, and could be made more efficient if you're using a CMOS 6502 (ie, 65C02) which has more instructions and addressing modes available.)

For multitasking ones that are not so small, check out our own André Fachat's index page on this site, http://6502.org/users/andre/, and page 18 of my 6502 stacks treatise, at http://wilsonminesco.com/stacks/potpourri.html

Operating systems are something I myself have not gotten into; but I have to agree with floobydust's advice above to search to see what's already been done in this area for the 6502, and then I would figure out a starting set of functions, always using an approach that allows for expansion and improvement without having to start over.

_________________
http://WilsonMinesCo.com/ lots of 6502 resources
The "second front page" is http://wilsonminesco.com/links.html .
What's an additional VIA among friends, anyhow?


Top
 Profile  
Reply with quote  
PostPosted: Thu Oct 31, 2024 11:31 am 
Offline
User avatar

Joined: Tue Mar 05, 2013 4:31 am
Posts: 1385
Just a quick follow-up, here's some links to find some of the code I referenced in my initial post:

Dietrich's CPM-65:
https://github.com/Dietrich-L/CPM-65

David Given's CPM65:
https://github.com/davidgiven/cpm65

Rich Leary's DOS/65:
http://retro.hansotten.nl/6502-sbc/dos-65/

Fuzix:
https://github.com/EtchedPixels/FUZIX

Note that DOS/65 has had several releases over the years before Rich made it open source. The main versions are a 2.x release and a later 3.x release that has more function. I've done a fair amount of work on the 3.x release and made my own version of it, currently at 3.20. My github page details both hardware and software for a running system here:
https://github.com/floobydust/CO2-Pocket-SBC-2.5

Last, here's a link to some info about FLEX:
viewtopic.php?f=2&t=6085&hilit=flex

Good luck and have fun!

_________________
Regards, KM
https://github.com/floobydust


Top
 Profile  
Reply with quote  
PostPosted: Thu Oct 31, 2024 8:41 pm 
Offline

Joined: Sun May 13, 2018 5:49 pm
Posts: 255
Hi nora23169,
Do you have a hardware platform you want to run this on (such as a Commodore 64 or Beeb or perhaps a single-board computer you built or purchased), or will you be running your small OS in a simulator? There are plenty of simulators for older machines, such as the C64, which would allow you to develop for "bare metal" on that machine even if you do not own one.

The reason I ask is that different hardware will have different ways to get input from the user and display the results of commands. You will want to start with very basic I/O, like getting a single letter from the user and printing it on the screen, so you will want to pick a platform to work with first. Once you get that working, you can start adding commands, one at a time.

If you are going to use a simulator, I recommend you play around with the simulator to get used to how it operates. You should be able to load a program and run it, and you will want to check out the features that let you look at memory locations and step through the code one instruction at a time.
-SamCoVT


Top
 Profile  
Reply with quote  
PostPosted: Fri Nov 01, 2024 2:17 am 
Offline
User avatar

Joined: Thu May 28, 2009 9:46 pm
Posts: 8484
Location: Midwestern USA
SamCoVT wrote:
If you are going to use a simulator, I recommend you play around with the simulator to get used to how it operates.

The Kowalski editor/assembler/simulator would be a good choice for this sort of thing, assuming one has a machine running Billy-ware on which to host the simulator.  During simulation, one can observer the MPU “registers” in real time, single-step through instructions, get cycle counts, etc.  That could be invaluable in developing the low-level grunt code of a kernel, and would be somewhat difficult to do running on a C-64 simulator.

_________________
x86?  We ain't got no x86.  We don't NEED no stinking x86!


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 8 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to: