《操作系统》的实验代码。
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

30 lines
1.3 KiB

  1. .text
  2. .globl start /* start处开始运行 */
  3. .code16
  4. start:
  5. jmpl $0x0, $code
  6. msg:
  7. .string "Hello world!"
  8. code:
  9. mov %cs,%ax
  10. mov %ax,%ds
  11. mov %ax,%es
  12. mov %ax,%ss
  13. mov $0x400,%sp
  14. call dispstr /* call dispstr函数显示字符串 */
  15. loop0: /* */
  16. jmp loop0
  17. dispstr:
  18. mov $msg ,%ax
  19. mov %ax ,%bp /* es:bp = */
  20. mov $12 ,%cx /* cs = */
  21. mov $0x1301 ,%ax /* ah=0x13 ,al=0x1 */
  22. mov $0x000c ,%bx /* bh=0 0, bl=0xc */
  23. mov $0 ,%dl /* 00*/
  24. int $0x10 /* BIOS提供的int服务0x10的0x13功能 */
  25. ret
  26. .org 0x1fe, 0x90 /* 0x1fe=510ret后的位置开始510/0x90 */
  27. .word 0xaa55 /* */