Is there a way to boot a made program from Visual Studio?
I would make then Console Application. Now I know, that you probably need programming Assembler for that.
Problem is, I don't know crack of Assembler. Instead I could've used very minimized version of Windows PE, then install requirements, put program within it and mount it to automatically start up the program.
But is there a shorter way?

Like, create program, put assembler file (or any bootable file programming language), then "modify" assemble to run certain C# files. Now I know there are compatibility issues as "How do I know how frame should look like?", "How do I read memory if there's no OS supporting it". This is actually just the problem in this case, is there something that could serve as thin, undisturbing layer for that program?

Now, I don't plan to create OS, I would get headaches or more. I just want to make program, be able to actually boot it, like outragously close to hardware, then be proud and play boss amongst my class mates.

You may now explode with laughter.

This time I actually sought on Google for it. But, uh, Google replaced ".exe" with ".iso" and instead it showed me How to make .iso bootable., I'm past that perimeter about 2/3 years ago.

Recommended Answers

All 3 Replies

Is there a way to boot a made program from Visual Studio?

That could be difficult. There are probably ways to do it, with a combination of its current C++ compiler and a few legacy DOS utilities.

But you have to realize that Visual Studio exclusively targets Windows. So, why would it provide the option to create executables not made exclusively to run under Windows? It used to provide that option a long time ago, and during the MS-DOS days, but these days are gone, my friend.

Also, Visual Studio doesn't have a C compiler, only a C++ compiler, which doesn't really help either.

Also, the default configuration of a VS project (even a "console application"... which really doesn't make much difference) has so many things enabled that you would have to spend significant time tearing all those configurations down to nothing (because nothing is all you are allowed to use for a boot program).

Now I know, that you probably need programming Assembler for that.

Not necessarily. I think you cannot completely avoid assembly, but you don't really have to know it either. What I mean is that some things, like hardware interrupts, will require assembly code, but you could probably get away with some off-the-shelf starter code for those parts and concentrate on the non-assembly code.

Instead I could've used very minimized version of Windows PE

That's really the core of the issue. Windows PE is the executable format for Windows programs (.exe and .dll files). This is a file format that Windows knows how to deal with, as in, loading it and start executing it. Before Windows is loaded, i.e., when you are booting, there is no OS that can load up those PE executables. That's why a "console application" makes no difference. Any program in PE format cannot be used when booting up.

The format you need was known as ".com" at some point. But having a name for it is kind of meaningless because it's essentially just a raw image that gets loaded into RAM memory and starts executing instructions starting at byte 0.

Like, create program, put assembler file (or any bootable file programming language), then "modify" assemble to run certain C# files.

Wow... that's... a plan... First of all, you assemble (or compile, if you want) the assembler file to create a program, not the other way around. You can also compile C code to create a bootable program. It's really not about the programming language that much, as long as the end result is native executable instructions (or binary code). Assembly, C, C++ and many other languages will produce such native code after being compiled (but not Java or C#).

And for the "run certain C# files"... that is something you have to forget completely. First of all, how are you gonna load that C# file? Remember, you don't have an OS running at that stage... i.e., the OS handles the file-system, so, no OS, no file-system, and no file-system, no files to load. And then, there is the obvious problem that in order to run a C# program, you need to start up .NET, and to start up .NET, you need Windows to be running.

That is really the core issue of writing such "bootable" code. What makes it hard is that you have nothing available to you, and I mean, nothing. You can read / write physical memory (RAM), you can read / write hardware registers, and tinker with a few things like that. But the bottom line is that anything you need, you must create from scratch, literally, from nothing. Which is what an operating system is, just a collection of things that were built up from scratch to allow applications to do useful stuff.

"How do I know how frame should look like?"

And even if you know how it should look like, how are you going to draw it on the screen? With no graphics driver running.

"How do I read memory if there's no OS supporting it"

That's the easy part. The hard part is making sure you don't mess up, because there is no OS protecting you by making sure you can't read / write physical addresses (only in virtual address space), and making sure you don't overwrite code with data, or vice versa.

Oh, and how do you allocate memory without the existence of functions like malloc or new?

I just want to make program, be able to actually boot it, like outragously close to hardware, then be proud and play boss amongst my class mates.

There's nothing wrong with having a little fun, and playing around with this stuff. But I would suggest that you start with something. Look at some of the programs that are self-starting, and play around with those. For instance, you could play around with the source code for Grub, which is a popular Linux boot-loader. It's a bootable program that show a menu, has a basic command-line interpreter, and can boot an operating system. You could have plenty of fun modifying that code to make it do whatever you want upon booting up, like printing "All your base are belong to us".

Assembly, C, C++ and many other languages will produce such native code after being compiled (but not Java or C#).

[...] and then Mike drove gigantic monster truck through Rik's hopes. Over and over again. The End
Here's the flaw, I'M LEARNING C# and you say that you can't...

like printing "All your base are belong to us".

Hehehehehe.

Okay, so I, look for a bootable program modify crap outta it and then, try to manage to get it to work.

COSMOS is apprantely such a thing.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.