Programming & debugging series: Boot Sector program.
Loading...
15,141
Uploader Comments (youhakim)
see all
All Comments (34)
-
@Tutorializer100 11
-
is 01011 = 5 in machine code?
-
@Goalatio no problem XD
-
@TheComputaNerd Yep, I figured it out for myself not long after I wrote that comment. Thanks for the reply though.
-
-
I am curious, do ints 0x21, 0x16, and 0x29 work under these conditions?
-
Instead of an infinite loop you could do:
cli
hlt
That'd halt the CPU, too, but doesn't use up resources.
-
can this program copy itself to a floppy?
-
assembly language does not make sence, i know many high level languages for software programing, but this is crazy. But im just getting started with this stuff, so oh well ! =D
-
FINALLY A NASM TUTORIAL!!! THANKS!!!
Loading...
Hey youhakim, very good tutorial. One thing, I would like to know which version of the MASM assembler you are using because I only found masm32 and cannot get it to assemble the code you provided to a BIN image. Thanks in advance.
carlosalbuquerque89 3 years ago
It is NASM not MASM! and the NASM 16 bits and 32 bits compilers are available on sourceforge or just use google.
youhakim 3 years ago
If you add 512 null characters after the rest of your text, doesn't the program become larger than 512 bytes? I would think that your code that prints "Hello World", plus your 512 character loop, would extend past the 512 byte boundary. Is that correct, or am I missing something. Great video! Thanks!
jamie1974 3 years ago
I didn't add 512 null characters after the rest of my text!
If you are talking about "time 512 - (dollar - double dollars ) db 0" instruction then you should know that this particular instruction adds as many null characters as needed so the program will be exactly 512 characteres.
(the program that displays "Hello world!") + (time 512 - (dollar - double dollars ) db 0) = 512 bytes.
Thanks for your comment.
youhakim 3 years ago
Thanks for explaining that! It makes sense now. If you made your program 512 bytes, where would your partition table be stored? The master boot record contains the boot code and it is 512 bytes in size. But it also must contain the partition table for the drive which takes up 64 bytes of that master boot record, so if you made your boot code 512 bytes long, it would over-write your partition table, wouldn't it? The boot code should only be no more than 446 bytes in size.
jamie1974 3 years ago
Yes you are right, the structure of a real MBR program must hold the table of primary partitions, but again I wasn't programming a real MBR program as I wrote on one of the comments above.
A real MBR program total size is 512 = 446 + 64 + 2.
446 bytes for the program itself.
64 bytes for the partition table.
2 bytes for the signature.
Thank you again jamie1974 for your comment :)
youhakim 3 years ago