40 lines
770 B
ArmAsm
40 lines
770 B
ArmAsm
.code16
|
|
|
|
.global _start # the linker needs to find it
|
|
_start:
|
|
# enter mode 13h
|
|
mov $0x13, %ax
|
|
int $0x10
|
|
|
|
mov $0xA000, %ax # ES = vga memory
|
|
mov %ax, %es
|
|
|
|
mov $0x7c0, %ax # DS = the bootsector
|
|
mov %ax, %ds
|
|
|
|
# %eax - position in sector
|
|
# it has to take up all of eax because of as's lack of real support
|
|
# for 16bit
|
|
# %ebx - position in vga mem
|
|
mov $0, %eax
|
|
mov $0, %ebx
|
|
loop:
|
|
movb %ds:(%eax), %cl
|
|
movb %cl, %es:(%ebx)
|
|
|
|
inc %bx
|
|
mov $16, %cl # if we've crossed a 16 pixel boundary, skip to the next line
|
|
and %bx, %cx
|
|
jz not_eol
|
|
add $304, %bx
|
|
not_eol:
|
|
inc %ax # only iterate 512 times
|
|
cmp $512, %ax
|
|
jl loop
|
|
|
|
incb %es:319
|
|
hlt
|
|
|
|
.fill 510-(.-_start), 1, 0x90 # fill with 0x90 (NOPs)
|
|
.word 0xaa55 # boot sector magic
|