summaryrefslogtreecommitdiff
path: root/boot/asm-boot.s
blob: 594c624437ae44d9894dad1a46370c1fe7ae15e3 (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
# s1 - Contains the current position in the source text.

.data

.equ SYS_EXIT, 93
.equ SOURCE_BUFFER_SIZE, 2048

.bss
.global source_code
.type source_code, @object
.size source_code, SOURCE_BUFFER_SIZE
source_code: .zero SOURCE_BUFFER_SIZE

.text
.global _start # Program entry point.

_start:
	# Read the source from the standard input.
	la a0, source_code
	li a1, SOURCE_BUFFER_SIZE # Buffer size.
	call read_file

	la s1, source_code # s1 = Source code position.
	call compile

	# Call exit.
	addi a0, zero, 0   # Use 0 return code.
	addi a7, zero, SYS_EXIT
	ecall