hos3.s
字号:
.code16.global _start_start: movw $0x1000, %ax # entry point of kernel movw %ax, %ds # set DS movw %ax, %es # set es call screen_setup # for 80 x 25 screen mode movw $greet, %si call print # print message # redirect keyboard interrupt mov $0, %ax mov %ax, %es lea kbdisr, %ax mov $36, %di cld stosw # addr of kbdisr stored to [36] mov %cs, %ax stoswlp: # infinite loop#hlt jmp lp# kbdisr is herekbdisr: in $0x60, %al movb $0x51, %al movb $0x0e, %ah int $0x10 movb $0x20, %al out %al, $0x20 iret #screen setup for 80 x 25 modescreen_setup: movw $0xb800, %ax movw %ax, %es xorw %di, %di movw $0x1f20, %ax movw $0x800, %cx cld rep stosw movb $0x02, %ah xorw %dx, %dx xorw %bx, %bx int $0x10 ret print: movb (%si), %al cmpb $0x00, %al je print_end movb $0x0e, %ah xorw %bx, %bx int $0x10 incw %si jmp printprint_end: movb $0x0e, %ah movb $0x0d, %al # CR xorw %bx, %bx int $0x10 movb $0x0a, %al # LF int $0x10 retgreet: .asciz "Hello from hos2"
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -