Blame view

second_binary.asm 798 Bytes
Imanol-Mikel Barba Sabariego authored
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
[BITS 16]
[org 0x8000]

JMP	short Start

print_string:   ; Expects null terminated message in si
	for_print_string_0:
		MOV 	al,[si]
		OR 		al,al
		JZ  	end_for_print_string_0
		INC 	si
		CALL 	print_char
		JMP 	for_print_string_0
	end_for_print_string_0:
	RETN

print_char:
	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
	RETN

Start:
XOR 	ax, ax
MOV 	ds, ax
MOV		ax, 0x1000
MOV 	es, ax
XOR		bx, bx
for_start_0:
	MOV 	si, str
	CALL 	print_string
	;JMP 	for_start_0
	JMP	$

str: 	db 'Hi! I',0x27,'m the second binary!',0x0A,0x0D,0x00

TIMES 	510 - ($ - $$) db 0