UCUXO2AHDGU43FPR2PKTEAIP76YF4Z4K6L4AXON4XTQNVOKCYREAC
S42BH3GKZDOFBQWMFM7V6KQWMXTHREQZZYRNAEQZWNSKXSDVTMXQC
CXBL5MVC4JXHZENYY2NKLNR4QEANSZ4CBZMTL7IGQ5MS54I5DT7AC
lui a0, %hi(datafile) addi a0, a0, %lo(datafile) li a1, 0 # O_RDONLY li a2, 0 li a7, 1024 # open
lui a0, %hi(datafile)
addi a0, a0, %lo(datafile)
li a1, 0 # O_RDONLY
li a2, 0
li a7, 1024 # open
li a0, -100 # AT_FDCWD lui a1, %hi(datafile) addi a1, a1, %lo(datafile) li a2, 0 # O_RDONLY li a3, 0 li a7, 56 # open
li a0, -100 # AT_FDCWD
lui a1, %hi(datafile)
addi a1, a1, %lo(datafile)
li a2, 0 # O_RDONLY
li a3, 0
li a7, 56 # open
readloop: # Read 1024 bytes from the file addi a0, s2, 0 lui a1, %hi(readbuf) addi a1, a1, %lo(readbuf) li a2, 1024 li a7, 63 # read ecall
readloop:
# Read 1024 bytes from the file
addi a0, s2, 0
lui a1, %hi(readbuf)
addi a1, a1, %lo(readbuf)
li a2, 1024
li a7, 63 # read
ecall
bge zero, a0, on_eof # TODO parse the buffer j readloop
bge zero, a0, on_eof
# TODO parse the buffer
j readloop
on_eof:
li a0, 0
dfmt: .string "%d\n".section .data .p2align 4, 0memroot: .zero 1024readbuf: .zero 1024
dfmt:
.string "%d\n"
.section .data
.p2align 4, 0
memroot:
.zero 1024
readbuf: