riscv-utils/flagtest.s

36 lines
478 B
ArmAsm

.global _start
.extern init_flags
.extern parse_flags
.data
flags:
.dword 0 # value / default
.byte 1 # type: <end>, bool, string, int
.byte 5 # flag length
#.short 16 # help length
.ascii "-help"
#.ascii "prints help text"
# last flag
.dword 0
.dword 0
.text
_start:
.option push
.option norelax
la gp, __global_pointer$
.option pop
mv a0, sp
call init_flags
la a0, flags
call parse_flags
li a7, 93 # sys_exit
li a0, 0
ecall