summaryrefslogtreecommitdiff
path: root/boot/echo-boot.s
blob: b6e65f73629a86df3fe8ffc0b857cf7843569529 (plain)
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
.global _start, source_code

.section .rodata
.type SOURCE_BUFFER_SIZE, @object
.size SOURCE_BUFFER_SIZE, 4
SOURCE_BUFFER_SIZE: .long 4096

.section .bss
.type source_code, @object
.size source_code, 4096
source_code: .zero 4096

.section .text

_compile:
	ret

_start:
	# Read the source from the standard input.
	la a0, source_code
	la a1, SOURCE_BUFFER_SIZE # Buffer size.
	lw a1, (a1)
	call read_file
	mv s1, a0

	call _compile

	# Write the source to the standard output.
	la a0, source_code
	mv a1, s1
	call write_out

	# Call exit.
	li a0, 0   # Use 0 return code.
	call exit