lesson6.asm

来自「自己动手写的操作系统文档」· 汇编 代码 · 共 44 行

ASM
44
字号
;----------------------------------------------------------------------; Hello World Operating System;; Joel Gompert 2001;; Disclaimer: I am not responsible for any results of the use of the contents;   of this file;----------------------------------------------------------------------; --------------------------------------------;  Here is the operating system entry point; --------------------------------------------begin:	mov	ax, cs		; Get the current segment	mov	ds, ax		; The data is in this segment	cli			; disable interrupts while changing stack	mov	ss, ax		; We'll use this segment for the stack too	mov	sp, 0xfffe	; Start the stack at the top of the segment	sti			; Reenable interrupts	mov	si, msg		; load address of our message	call	putstr		; print the messagehang:	jmp	hang		; just loop forever.; --------------------------------------------; data for our programmsg	db	'Hello, World!', 0; ---------------------------------------------; Print a null-terminated string on the screen; ---------------------------------------------putstr:	lodsb		; AL = [DS:SI]	or al, al	; Set zero flag if al=0	jz putstrd	; jump to putstrd if zero flag is set	mov ah, 0x0e	; video function 0Eh (print char)	mov bx, 0x0007	; color	int 0x10	jmp putstrputstrd:	retn

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?