ASM examples updated

This commit is contained in:
mariusmonton 2018-09-19 23:52:48 +02:00
parent 17ac1ae411
commit ea116f90e9
12 changed files with 64 additions and 35 deletions

View File

@ -1,3 +1,6 @@
.section .text
.globl _start
_start:
# Basic loop
ADDI t1, zero, 10 # t1 to 10
ADDI t2, zero, 1 #t2 to 1

View File

@ -1,2 +0,0 @@
:100000001303A0009303100033037340E31E03FEA9
:00000001FF

View File

@ -1,3 +1,7 @@
.section .text
.globl _start
_start:
li t1, 150
li t2, 300
li t3, -250

View File

@ -1,3 +1,7 @@
.section .text
.globl _start
_start:
li t1, 150
li t2, 300
li t3, -250

View File

@ -1,3 +1,5 @@
:020000021000EC
:10000000130360099303C012130E60F0B30E730064
:0C001000338FC301B38F63406FF05FFFBC
:0400000310000000E9
:00000001FF

View File

@ -1,3 +0,0 @@
:10000000130360099303C012130E60F0B30E730064
:0C001000338FC301B38F63406FF05FFFBC
:00000001FF

View File

@ -3,4 +3,4 @@ li t2, 300
li t3, -250
sw t1, -4(t2)
li t1, 500
lw t1, -4(t2)
#lw t1, -4(t2)

View File

@ -1,18 +0,0 @@
# Simple example
# JAL +2048
#0010006F
# JAL +256
#1000006F
# JAL +4
0040006F
# ADD rd = R1, rs1 = R1, rs2 = R2
002080B3
# SUB rd = R3, rs1 = R1, rs2 = R2
402081B3
# ADD rd = R1, rs1 = R1, rs2 = R2
002080B3
# JAL -8
# FF9FF06F
# JAL -12
FF1FF06F
# END

View File

@ -1,3 +0,0 @@
:10000000130360099303C012130E60F0B30E730064
:0C001000338FC301B38F63406FF05FFFBC
:00000001FF

View File

@ -1,8 +0,0 @@
# test1.asm
JAL +4
ADD t1, t1, t2
SUB t3, t1, t2
ADD t1, t1, t2
# JAL -12
J 10
LUI t2, 250

34
asm/trace.asm Normal file
View File

@ -0,0 +1,34 @@
.equ TRACE_BASE, 0x40000000
#msg:
# .string "Hello World\n"
.section .text
.globl _start
_start:
li a2, TRACE_BASE
li t0, 'H'
sb t0, 0(a2)
li t0, 'e'
sb t0, 0(a2)
li t0, 'l'
sb t0, 0(a2)
li t0, 'l'
sb t0, 0(a2)
li t0, 'o'
sb t0, 0(a2)
li t0, ' '
sb t0, 0(a2)
li t0, 'w'
sb t0, 0(a2)
li t0, 'o'
sb t0, 0(a2)
li t0, 'r'
sb t0, 0(a2)
li t0, 'l'
sb t0, 0(a2)
li t0, 'd'
sb t0, 0(a2)
li t0, '\n'
sb t0, 0(a2)

16
asm/trace2.asm Normal file
View File

@ -0,0 +1,16 @@
.equ TRACE_BASE, 0x40000000
.section .text
.globl _start
_start:
la a0, msg
1: li a2, TRACE_BASE
# addi a0, a0, 1
# j 1b
#.section .rodata
msg:
.string "Hello World\n"