Files
riscv-operating-system-mooc/code/asm/sub/test.s
2021-04-01 20:02:31 +08:00

20 lines
445 B
ArmAsm

# Substract
# Format:
# SUB RD, RS1, RS2
# Description:
# The contents of RS2 is subtracted from the contents of RS1 and the result
# is placed in RD.
.text # Define beginning of text section
.global _start # Define entry _start
_start: # Label, not really required
li x6, -1 # x6 = -1
li x7, -2 # x7 = -2
sub x5, x6, x7 # x5 = x6 - x7
stop:
j stop # Infinite loop to stop execution
.end # End of file