diff --git a/src/mbr_test.s b/src/mbr_test.s index a505820..4b1c00e 100644 --- a/src/mbr_test.s +++ b/src/mbr_test.s @@ -1,13 +1,31 @@ .section .text .code16 - mov $BOOTLOADER_SIZE, %ax - + # we're moving to 0050, 0x7C00 -> 0x0500 + # so, DS is 0x07C0 and ES is 0x0050 mov $0x07C0, %ax mov %ax, %ds + mov $0x0050, %ax + mov %ax, %es - mov msg, %si + # set both source and destination pointers to zero, since we using segments + xor %ax, %ax + mov %ax, %si + mov %ax, %di + + # set counter with determined size by linker + mov $BOOTLOADER_SIZE, %cx cld +.copy: + lodsb + stosb + loop .copy + + # far jump to new memory region + jmp $0x0050,$.bootloader +.bootloader: + + mov $msg, %si .putc_loop: lodsb or %al, %al