| 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 |
|
|---|
| 28 | stop:
|
|---|
| 29 | hlt
|
|---|
| 30 | jmp stop
|
|---|
| 31 |
|
|---|
| 32 | .org _start + 510
|
|---|
| 33 | .word 0xAA55
|
|---|
| 34 |
|
|---|
| 35 | .end
|
|---|