What if I write a code to boot the PC? Here is a tiny "OS":-d

Source: Internet
Author: User

Hello World -- OS


I found the relevant code of Dr. huake shaozhiyuan and found that he made slight modifications based on the Jos boot. s of MIT and then stripped them separately, which is very interesting ~


MATERIALS:

Http://download.csdn.net/detail/u011368821/8006465


In principle, we only need two files (boot. s MMU. h), but here we also need some included virtual tools and makefile for experimentation.


Note that the address 0xb800 is the starting address of the video memory :)

Movsb (move string byte) refers to the string transmission command, which transfers data in bytes. The source address and target address of the string are controlled through the Si and DI registers. For example, the n Bytes of the DS: Si address are copied to the address pointed to by ES: Di. After the replication, the DS: the content of Si remains unchanged.

In the following code, set % es to 0xb800, indicating that the output of the di register is directed to the memory!


The rep command is the command followed by Rep repeated execution until the value of the % CX register is 0 (the value of the % CX register is decreased once each execution)


This is the case under the real model.

At the end of the protected model, the expression of the address will change a bit.

It is no longer in the form of segment: Offset

For example, 0xb800 (real model) => 0xb8000 (protected Model)

Memory is like a very interesting large buffer Haha ~



Here, I added the EOF myself. I added a short piece of code:


The first half is the original one, and the latter part # print my name is a feature I added myself

Here I accurately calculated the number of bytes (62 bytes) That helloworld occupies in the first half)

So 0xb8d22 + 0x3d (60) = 0xb8d60:) Don't panic!


The last $24 is actually not very good. I forgot to change it... it is best to change it to the number of bytes you want to print.















Ethiopia's lover turned to the rock Pierre France 1763 325x329 fabric oil-colored Paris Louvre
In this mythical painting frame, the painter depicts the characters and environmental ornaments in the painting with extremely delicate strokes and gorgeous colors, and uses the ancient Rome column as the central landscape building to add a solemn sense in the painting. Pierre created an artistic realm in a sense by combining illusion and reality, and in a romantic sense. It can be said that this is an artistic manifestation of the transition from classical to romantic. Although this painting is based on Greek mythology, the painter does not seem to pay attention to the portrayal of the story and the performance of the characters, but focuses on the female characters, especially the reflection of clothes in the light. The characters are cool-like and delicate, but the eyes of the people cannot be unified, resulting in an unrelated sense of separation and indifferent styling effect. In the picture, esserx sat on the sofa and saw that the lover turned into a rock. The Painter handled the matter as rational and calm, and the dramatic and dramatic changes were dispelled by the calm, however, we can still see the noble style and calm air of the neo-classical painting.



What if I write a code to boot the PC? Here is a tiny "OS":-d

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.