boot.asm 1.56 KB
;BLACK			0x0
;BLUE			0x1
;GREEN			0x2
;CYAN			0x3
;RED			0x4
;MAGENTA		0x5
;BROWN			0x6
;GREY			0x7
;DARK_GREY		0x8
;LIGHT_BLUE		0x9
;LIGHT_GREEN		0xA
;LIGHT_CYAN		0xB
;LIGHT_RED		0xC
;LIGHT_MAGENTA   	0xD
;LIGHT_BROWN		0xE
;WHITE			0xF

[BITS 16]
[org 0x7C00]

JMP	 short Start

str: 	db 		'THE GAME ',0x00



Start:
	XOR	ax, ax
	MOV	ds, ax
	CALL	clear_screen
	PUSH	2 ; num
	PUSH	2 ; offset
	;CALL	print_sector ; (offset, num)
	;ADD	esp, 12
	for_start_0:
		MOV 	si,str
		CALL 	print_string
		;JMP 	for_start_0
		JMP	$

clear_screen:
	MOV     al, 02h ; Setting the graphical mode 80x25(text)
        MOV     ah, 00h ; Code of the function of changing video mode
        INT	10h	; Call interruption
	RETN

print_string:   ; Expects null terminated message in si
	;MOV	bl,0x00
	for_print_string_0:
		MOV 	al,[si]
		OR 	al,al
		JZ  	.end
		INC 	si
		CALL 	print_char
		;INCL	bl
		JMP 	for_print_string_0
	.end:
	RETN

print_sector:
	PUSH	ebp
	MOV	ebp, esp
	PUSH	ax
	PUSH	bx
	PUSH	cx
	PUSH	dx
	MOV 	al, [12 + ebp]
	MOV	cl, [8 + ebp]
	MOV     ah, 2
        MOV     ch, 0
        MOV     dh, 0
        INT     0x13
	POP	dx
	POP	cx
	POP	bx
	POP	ax
	MOV	esp, ebp
	POP	ebp
	RETN

print_char:
	PUSH 	ebp
	MOV 	ebp, esp
	PUSH	ax
	PUSH 	bx
	MOV 	ah,0x0E         ; Specifies that we want to write a character to the screen
	MOV 	bl,0x02         ; Specifies output text color.  Not required, but useful to know
	MOV 	bh,0x00         ; Page number.  Leave this alone.
	INT 	0x10            ; Signal video interrupt to BIOS
	POP	bx
	POP	ax
	MOV	esp,ebp
	POP	ebp
	RETN

TIMES 		510 - ($ - $$) db 0
DW 		0xAA55