This commit is contained in:
able 2023-09-12 01:38:32 -05:00
parent 42be580425
commit e7aa306e5d
7 changed files with 43 additions and 11 deletions

12
hbasm/assets/add.hbasm Normal file
View file

@ -0,0 +1,12 @@
-- Add two numbers
-- A + B = C
-- r1 A
li r1, 2
-- r2 Result
li r2, 0
-- B = 4
addi r2, r1, 4
-- terminate execution
tx

View file

@ -0,0 +1,16 @@
-- r1 will be the temp in fahrenheit
-- r2 temp in celsius
-- r3/r4/r5 will be used by constants
-- (f - 32) * 5 / 9
li r1, 100
li r3, 32
li r4, 5
li r5, 9
sub r2, r1, r3
mul r2, r2, r4
dir r2, r0, r2, r5
tx

View file

@ -1,11 +1,14 @@
addi r1, r0, 1024 li r255, 0
addi r2, r1, 1024
addi r3, r2, 1024
addi r4, r3, 1024
addi r5, r4, 1024
addi r6, r5, 1024
addi r7, r6, 1024
addi r8, r7, 1024
addi r9, r8, 1024
ecall ecall
li r255, 1
li r254, 1
li r253, 100
ecall
li r255, 2
li r254, 0
li r253, 0
ecall
tx

View file

@ -1,3 +1,4 @@
li r20, 1010 li r20, 1010
st r20, r24, 0, 1 st r20, r24, 0, 1
addi r24, r0, 10 addi r24, r0, 10
tx

BIN
hbvm/assets/add.hb Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.