VirtualBox

Ticket #7285: boot16ex.s

File boot16ex.s, 654 bytes (added by Joao Trindade, 14 years ago)

2) Source code for the boot sector

Line 
1
2 .text
3 .code16
4
5 .global _start
6_start:
7 sti
8 xorw %ax, %ax
9 movw %ax, %ds # ds: 0x0000
10 movw $0xb800, %ax
11 movw %ax, %es # es: 0xb800 (screen segment)
12 movb $7, %ah # ah: light gray on black
13
14 # Show ">>>>...>>"
15 movb $'>', %al # al: '>'
16 movw $(80*24*2), %di # di: begin of 25th line
17 movw $40, %cx # cx: half line
18 cld
19 rep stosw
20
21 # Show "<<...<<<<"
22 movb $'<', %al # al: '<'
23 movw $(80*25*2-2), %di # di: end of 25th line
24 movw $40, %cx # cx: half line
25 std
26 rep stosw # FAILING INSTRUCTION
27
28stop:
29 hlt
30 jmp stop
31
32 .org _start + 510
33 .word 0xAA55
34
35 .end

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy