Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to run an exe...

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
Hi!

I am really QuickBasic programmer, but since I started writting my own os I mess up with C++ a little.
I do everything in QuickBasic, but I need C++ help to write a kernel...

I would like to know how to write an easy (dos-like) program that would load for example "files.exe" and then return to itself (or run othe exe)...

tree of progranms:

FORMATTED (bootable) FLOPPY:

Msdos.sys
Io.sys
Config sys ( shell = a:\start.exe)
|
|<------------------------------ start.exe (command prompt) |
1 input A$ 'wait for command to be entered |
/-if a$ = &quot;view files&quot; then run &quot;files1.exe&quot; |
| goto 1' if differend command entered it |
| |
Files1.exe is C++ application that |
run &quot;files.exe&quot; and then run &quot;start.exe&quot; |
| |
| |
files.exe display directory content (Qbasic exe)|
| |
| |
\____________________________________________/

index of files:(note that there is not COMMAND.COM around!)
Msdos.sys
Io.sys
config.sys
files1.exe
files.exe


PS.
If you HAVE ANY IDEA about booting system without THE 3 dos files erite it down!!!


T H A N K Y O U!
 
lol, basic as basic?! :)
(not really for me to say, but heck.. do it anyways[pipe]) My codes look like something a kid wrote
I have absolutely no idea what I am talking about
Somehow I still manage to make it work
 
Its quite easy. You must simple load the executable into memory using BIOS calls as follows.

mov ah, 02h
mov al, 01h
mov ch, 0h
mov cl, 2h
mov dh, 0h
mov dl, 1h
mov bx, 1000h
int 13h

This will load the second sector from the disk and place it at memory possition 1000h. There is no error checking on this so check it over. Once your binary file is loaded into memory you can jump to where it is held, I sudgest you make a address in memory which contains the address to jump to when the program is finnish, this will allow expandability. At first write some simple programs, once you have enough to make the OS usable then you need to create a FAT12 access program, Here is a link to the MS platform specification page, this will tell you how to access it in C++, since you understand C++ this should be easy for you.

thread206-308238 you get this far modify your fat access program to create a partition in memory, this will greatly speed up things for development. After you get all that done create a simple assembler, this isnt very hard to do since opcode hex value lists are easy to find on the internet. You will also need a text editor for this. At this point you can start refining your OS and make some standards, once it is sorted out start making some additional utilities. A UNIX style file hierarchy would be good so you can create a proffesional system but if you want an easier way then DOS style would work, however DOS style is very badly planned and just plain silly! Once you get this far you could start porting some programs, the easier way to get a DOS executable to run is following the POSIX standard and eventualy getting WINE to run, this is of course after you get the GNU C compiler to work wich would be extreamly time consuming since you would need to write your own standard header libraries.

Good luck with your OS
 
Opps i forgot some thing, Since you said you are using Qbasic you will need an interpretor, i have the Qbasic4.5 source on my computer but it wont help you very much since you will need to make your OS specific calls.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top