with the help of some tutorials, i wrote a little piece of code,
to display me a string, after booting from my floppy.
my problem is now, that dont understand some lines, were i hope u can help me,
or just tell me, if im right.
code:
mov ax, 07C0h
add ax, 288 ; (512 + 4096) / 16 = 288
mov ss, ax
mov sp, 4096
mov ax, 07C0h
mov ds, ax
- line: start the program @ the adress 07C0h
(could i change this?) - Add space for 288 paragraphs to ax
- ?
- Space of 4096 bytes for my program
(to store variables and stuff?) - Go to the start adress
- ?
thanks for your help.
This puts the start of the stack segment (ss) at segment number 07C0h + 288. The bootloader is loaded at the start of segment number 07C0h. The size of a bootloader is 512 bytes and each segment is 16 bytes. This means that the stack segments starts 4096 bytes after the end of the bootloader.
This sets the stack pointer to 4096. This means that the top of the stack is now 4096 bytes past the start of the stack segment. Effectively, this has allocated 4096 bytes for the stack.
This sets the data segment to 07C0h (the segment where your bootloader starts). When you refer to data labels later in the bootloader, they will use the data segment, so your boot loader has to be at the start of the data segment to be able to find the right location in memory.