fixed stupid bug - mov msg, %si actually translated to move r/m16 to %si instead of immediate move like mov $msg, %si. also implemented bootloader migration to 0050:0000 address just to be stable
This commit is contained in:
parent
9643f450ac
commit
d8ab00c7cd
1 changed files with 21 additions and 3 deletions
|
|
@ -1,13 +1,31 @@
|
||||||
.section .text
|
.section .text
|
||||||
.code16
|
.code16
|
||||||
|
|
||||||
mov $BOOTLOADER_SIZE, %ax
|
# we're moving to 0050, 0x7C00 -> 0x0500
|
||||||
|
# so, DS is 0x07C0 and ES is 0x0050
|
||||||
mov $0x07C0, %ax
|
mov $0x07C0, %ax
|
||||||
mov %ax, %ds
|
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
|
cld
|
||||||
|
.copy:
|
||||||
|
lodsb
|
||||||
|
stosb
|
||||||
|
loop .copy
|
||||||
|
|
||||||
|
# far jump to new memory region
|
||||||
|
jmp $0x0050,$.bootloader
|
||||||
|
.bootloader:
|
||||||
|
|
||||||
|
mov $msg, %si
|
||||||
.putc_loop:
|
.putc_loop:
|
||||||
lodsb
|
lodsb
|
||||||
or %al, %al
|
or %al, %al
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue