riscv-utils/flagtest.s

46 lines
552 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
.ascii "-bool"
.dword 0
.byte 2 # type=string
.byte 4
.ascii "-str"
.dword 0
.byte 3 # type=string
.byte 4
.ascii "-int"
# 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
snez a0, a0
#li a0, 0
ecall