OSDev.org

The Place to Start for Operating System Developers
It is currently Thu Mar 28, 2024 3:11 pm

All times are UTC - 6 hours




Post new topic Reply to topic  [ 7 posts ] 
Author Message
 Post subject: How to boot your C++ code
PostPosted: Fri Mar 24, 2017 8:20 am 
Offline

Joined: Fri Mar 24, 2017 8:10 am
Posts: 4
Hello.
I had read this publication: http://viralpatel.net/taj/tutorial/hell ... loader.php , but didn't find, how to boot another code (in second sector).
How does the loader know where it is? How can I make a jump from one sector to another?
Thanks in advance.


Top
 Profile  
 
 Post subject: Re: How to boot your C++ code
PostPosted: Fri Mar 24, 2017 8:30 am 
Offline

Joined: Sat Mar 18, 2017 4:52 am
Posts: 17
I don't suggest you use C++ when you are a beginner. Try out Wikipedia's INT 13h references. Look for stuff on Google.

This will help you with loading kernels in Assembly.

INT 13h AH=02h: Read Sectors From Drive

Parameters:

AH 02h
AL Sectors To Read Count
CH Cylinder
CL Sector
DH Head
DL Drive
ES:BX Buffer Address Pointer

Results:

CF Set On Error, Clear If No Error
AH Return Code
AL Actual Sectors Read Count

If you don't know Assembly, learn it.

_________________
AX BX CX DX BP SP SI DI. The registers that never die. 16-bit... will always sit... in a book where people look. My signature is terrible! I think we all know that.


Top
 Profile  
 
 Post subject: Re: How to boot your C++ code
PostPosted: Fri Mar 24, 2017 9:28 am 
Offline

Joined: Fri Mar 24, 2017 8:10 am
Posts: 4
I know masm, but I did not work with such a low level. You can write how to start C++ from Assembly.


Top
 Profile  
 
 Post subject: Re: How to boot your C++ code
PostPosted: Fri Mar 24, 2017 1:46 pm 
Offline

Joined: Sat Mar 18, 2017 4:52 am
Posts: 17
Microsoft Assembler (MASM) doesn't have the same syntax than what operating system development has.

For example, we have invoke box and things.
NASM and FASM (with os development) doesn't have .code or .data if you know what I mean.

_________________
AX BX CX DX BP SP SI DI. The registers that never die. 16-bit... will always sit... in a book where people look. My signature is terrible! I think we all know that.


Top
 Profile  
 
 Post subject: Re: How to boot your C++ code
PostPosted: Fri Mar 24, 2017 11:21 pm 
Offline

Joined: Fri Mar 24, 2017 8:10 am
Posts: 4
I know!!! Now I am using NASM. Please, answer the question.


Top
 Profile  
 
 Post subject: Re: How to boot your C++ code
PostPosted: Sat Mar 25, 2017 3:03 am 
Offline
Member
Member
User avatar

Joined: Sat Mar 31, 2012 3:07 am
Posts: 4591
Location: Chichester, UK
You are beginning to sound impatient and a little demanding. This is rarely a productive attitude.

Starmanz answered your question in his first reply to you. You use "int 0x13" to load the sector to wherever you choose in memory. Then you use the appropriate "jmp" instruction to transfer control to it.

You might find more productive to follow the "bare bones" tutorials in this Wiki rather than the one you quoted. Although, IMO, all these tutorials just lead people to think they are writing an operating system when they are doing nothing of the sort. You really need to study a lot of theory first to make sure you know what it is that you want to do and what is necessary to achieve that aim. Then you can start how to actually tackle the problem on your own rather than just cutting and pasting questionable code.


Top
 Profile  
 
 Post subject: Re: How to boot your C++ code
PostPosted: Sat Mar 25, 2017 3:33 am 
Offline

Joined: Sat Mar 18, 2017 4:52 am
Posts: 17
Also, copying and paste from tutorials is not recommended. Did Tim Patterson find a YouTube (made in 2004) video to make an operating system? No, he learnt Assembly.

Tim Patterson made x86 DOS.

You need to learn Assembly first. Just copying and pasting will get you nowhere and if you steal someone's code (depending on the license), you're probably breaking laws.

Also, you can't really boot C++ code. There always must be some Assembly.
I encourage you to learn. I am starting to learn Win32 (MASM) Assembly as well.
Check out DOS Assembly since that can be good to learn about interrupts and things.

I'm still in early stages with my Assembly but I know something.

_________________
AX BX CX DX BP SP SI DI. The registers that never die. 16-bit... will always sit... in a book where people look. My signature is terrible! I think we all know that.


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

All times are UTC - 6 hours


Who is online

Users browsing this forum: Bing [Bot], Google [Bot], Majestic-12 [Bot] and 74 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:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group