I was wondering if it was possible to create a new stand-alone operating system with PureBasic?
New Operating System with PureBasic? [SOLVED]
New Operating System with PureBasic? [SOLVED]
Hi all;
I was wondering if it was possible to create a new stand-alone operating system with PureBasic?
I was wondering if it was possible to create a new stand-alone operating system with PureBasic?
Last edited by BigJack on Thu May 01, 2008 11:35 pm, edited 1 time in total.
Greetings to all the folks back home in the States...
PB4.2 Windows XP SP3
PB4.2 Windows XP SP3
PureBasic requires a OS for running his executable, so it's not possible to create a OS 
PureBasic 5.73 | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.

Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.

- Fluid Byte
- Addict

- Posts: 2336
- Joined: Fri Jul 21, 2006 4:41 am
- Location: Berlin, Germany
If you would really have the needed knowledge you wouldn't ask this question. 

Windows 10 Pro, 64-Bit / Whose Hoff is it anyway?
- Rook Zimbabwe
- Addict

- Posts: 4322
- Joined: Tue Jan 02, 2007 8:16 pm
- Location: Cypress TX
- Contact:
There was a book titled Developing Your Own 32bit Operating System Which had extensive chapters on the ASM necessary... An example CD as well...
Now I doubt it could fully work in PB, but it would be interesting to try.
http://www.amazon.com/Developing-32-Bit ... 125&sr=8-1
Hey inline ASM must be good for other things too!
Now I doubt it could fully work in PB, but it would be interesting to try.
http://www.amazon.com/Developing-32-Bit ... 125&sr=8-1
Hey inline ASM must be good for other things too!
I remember asking this question too, but it is almost impossible. PB uses API calls to accomplish tasks that are only found in DLLs that ship with Windows. The base of an OS must be made in ASM and then you can switch to something more high-level. But an OS is the hardest thing you can try to do.
None are more hopelessly enslaved than those who falsely believe they are free. (Goethe)
- Rook Zimbabwe
- Addict

- Posts: 4322
- Joined: Tue Jan 02, 2007 8:16 pm
- Location: Cypress TX
- Contact:
There was a program called bootloader.exe that would copy boot.bin to the bootsector. You could rename boot.exe to boot.bin. or look for another program called exe2bin...
Code is not mine... scrummed off the web... but that is the basics of boot.bin in ASM. I used it one summer in IT classes at Rice University... Got a B+ in the course because I did things my own way and the Prof. Had a large corncob up his rear!
:roll:
Code posted as an example ONLY!!!
Code was "borrowed" from here:
http://www.groovyweb.uklinux.net/index. ... 20own%20os
Let us know what happens... I wouldn't do this to your own computer!
OR
You could just figure out how to use the DARWIN core of OsX and build a MacLike OS that can run Crapintosh programs!
Code: Select all
; This is a comment
[ORG 0x7C00] ;This just tells the program where it is in the memory. Not important
[BITS 16] ;Not important too.
jmp start ; Jump over BIOS parameter block
start: ;The label for the start of the actual program
push cs ;Put cs onto the stack
pop ds ;Take it out and put it into ds
mov si,Print_loading ;Print loading message
call printstring ;Call is like jump, but it goes back. Like a function
;The complicated bit: Loads the next program
mov ah,02h ;When ah=, int13 reads a disk sector
mov al,4 ;Al is how many sectors to read
mov ch,0 ;The track to read from
mov cl,2 ;Sector Id
mov dh,0 ;Head
mov dl,0 ;Drive (0 is floppy)
mov bx,0x1000 ;Es and Bx put together are where to load the program too (see jmp 0x1000:0x00)
mov es,bx
mov bx,0x00
int 13h ;Int 13 is all functions for disks
mov si,putdot ;Print a ".".
call printstring
jmp 0x1000:0x00 ;Run Bootinit from stack.
printstring: ;Print string routine.
mov ah,0eh ;Mov ah into 0, so int 10 prints
stringloop: ;The following code loads each seperate charcter so it can be printed
lodsb
cmp al,00 ;If al =0, then the string has all been loaded
je endstring
int 10h ;When int 10 is called, and ah=, it prints
jmp stringloop
endstring:
ret ;Ret returns
putdot db '.',0
Print_loading db 13,10,'Loading Pure OS v0.01a...',0
times 425 db 0 ;wastes 425 bytes on purpose, so the sector is full (The program must be 512 bytes long)
:roll:
Code posted as an example ONLY!!!
Code was "borrowed" from here:
http://www.groovyweb.uklinux.net/index. ... 20own%20os
Let us know what happens... I wouldn't do this to your own computer!
OR
You could just figure out how to use the DARWIN core of OsX and build a MacLike OS that can run Crapintosh programs!
Thanks for your replies...
Well, I almost thought so myself that developing an 32 bit/64bit OS won't be feasable using PB itself.
A friend of mine asked me to post this request in our forum to make sure.
the idea itself quite interesting, nevertheless.
But just imagine what would happen to PureBasic if someone was able to
find a way to accomplish this...
Well, I almost thought so myself that developing an 32 bit/64bit OS won't be feasable using PB itself.
A friend of mine asked me to post this request in our forum to make sure.
I personally don't possess the knowledge nor the capabilities to get a project like this started in the first place, but I foundIf you would really have the needed knowledge you wouldn't ask this question.
the idea itself quite interesting, nevertheless.
But just imagine what would happen to PureBasic if someone was able to
find a way to accomplish this...
Greetings to all the folks back home in the States...
PB4.2 Windows XP SP3
PB4.2 Windows XP SP3
- Fluid Byte
- Addict

- Posts: 2336
- Joined: Fri Jul 21, 2006 4:41 am
- Location: Berlin, Germany
Well, of course you can do anything but it's always a question of the effort you want to invest.
There are probaly better alternatives to write an OS than an indie BASIC dialect.
There are probaly better alternatives to write an OS than an indie BASIC dialect.
Windows 10 Pro, 64-Bit / Whose Hoff is it anyway?
The short answer is yes, you can create an OS with PB. The long answer is ..
1. You need to create a boot loader in pure ASM, and some of th kernel.
2. You need to port over FASM.
3. You need to write your own PB libraries and front end compiler to run against FASM.
Once all of that is completed, then you can use PB to create the test of the OS.
1. You need to create a boot loader in pure ASM, and some of th kernel.
2. You need to port over FASM.
3. You need to write your own PB libraries and front end compiler to run against FASM.
Once all of that is completed, then you can use PB to create the test of the OS.
Considering how much purebasic functions rely on your OS, I don't think it would have much of a point as most of your code will have to be written in ASM anyhow. The main purpose of PB is to act as a layer between you and your OS to simplify otherwise complicated tasks. If you don't use any of those functions, it would be kinda pointless using PB, since that's really what makes PB what it is.
I love Purebasic.
Well, I guess that's true.
It was a hypothetical question anyways - and it has been answered...
I had never thought this topic would yield that much response.
Thanks to all of you for stating your opinion about this.
It was a hypothetical question anyways - and it has been answered...
I had never thought this topic would yield that much response.
Thanks to all of you for stating your opinion about this.
Last edited by BigJack on Tue May 06, 2008 7:15 am, edited 1 time in total.
Greetings to all the folks back home in the States...
PB4.2 Windows XP SP3
PB4.2 Windows XP SP3
This is not quite true (I don't think - but I could be wrong)X wrote:The short answer is yes, you can create an OS with PB. The long answer is ..
1. You need to create a boot loader in pure ASM, and some of th kernel.
2. You need to port over FASM.
3. You need to write your own PB libraries and front end compiler to run against FASM.
Once all of that is completed, then you can use PB to create the test of the OS.
The boot loader doesn't have to be written in ASM, it just has to be machine code and obviously not have dependancies on an existing OS infrastructure. How it got from a source code base to binary is largely irrelevent.
After this loader is running, you might be able to use PB to make some progress, it would be hard to tell (for me) how crippled PB would be without an underlying OS though. If the basic file IO uses the OS for file operations (which I would guess is the case) then PB isn't going to get far.
the first Unix was apparently written in ansi C. A step away from using ASM
Paul Dwyer
“In nature, it’s not the strongest nor the most intelligent who survives. It’s the most adaptable to change” - Charles Darwin
“If you can't explain it to a six-year old you really don't understand it yourself.” - Albert Einstein
“In nature, it’s not the strongest nor the most intelligent who survives. It’s the most adaptable to change” - Charles Darwin
“If you can't explain it to a six-year old you really don't understand it yourself.” - Albert Einstein
- Rook Zimbabwe
- Addict

- Posts: 4322
- Joined: Tue Jan 02, 2007 8:16 pm
- Location: Cypress TX
- Contact:
But VC is a valid tool for writing an OS.
PB is written in VC;
therefore PB is a valid tool for writing an OS.
(Any language that compiles to machine code can write an OS if you know where to POKE and PEEK things!)
I remember that at least two of the ATARI OS was written in ATARI BASIC and ASM... BatOS was one.
That pundited... I would not like to undertake such a herculean task. Once you get past the boot and the loader, you have the wall of programming the file system. Then it is probably time for pure ASM or VC! Or you could simply rebuild an OS by plugging in to an existing kernel.

PB is written in VC;
therefore PB is a valid tool for writing an OS.
(Any language that compiles to machine code can write an OS if you know where to POKE and PEEK things!)
I remember that at least two of the ATARI OS was written in ATARI BASIC and ASM... BatOS was one.
That pundited... I would not like to undertake such a herculean task. Once you get past the boot and the loader, you have the wall of programming the file system. Then it is probably time for pure ASM or VC! Or you could simply rebuild an OS by plugging in to an existing kernel.



