All pastes #150415 Raw Edit

Mine

public text v1 · immutable
#150415 ·published 2006-08-26 21:54 UTC
rendered paste body
[BITS 16]
[ORG 0x7C00]

; Hello, World! Operating System (HWOS)
os:
	; Setup the data segment. Limitations on the CPU will not allow mov ds, 0x0000.
	mov	ax, 0x0000
	mov	ds, ax
	
	; Load the string into the correct place.
	mov	si, HelloWorld
	call	PrintString
	
	; Loop forever.
	jmp $

; Print a string to the screen.
PrintString:
	; Set up the registers for the interrupt call
	mov	ah,0x0E	; The function to display a chacter (teletype)
	mov	bh,0x00	; Page number
	mov	bl,0x07	; Normal text attribute
	
	.nextchar
		; Load [SI] into AL and increases SI by one.
		lodsb
		
		; Check for end of string. If it is the end, jump to .return.
		or	al, al
		jz	.return
		
		; Print the character
		int	0x10
	jmp .nextchar
	
	.return
		ret

; Data
HelloWorld	db	'Hello World', 13, 10, 0
KeyString	db	0

; Boot Segments
times 510-($-$$) db 0
dw 0xAA55