diff --git a/hbasm/assets/add.hbasm b/hbasm/assets/add.hbasm new file mode 100644 index 00000000..b21dc5a0 --- /dev/null +++ b/hbasm/assets/add.hbasm @@ -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 \ No newline at end of file diff --git a/hbasm/assets/celsius_converter.hbasm b/hbasm/assets/celsius_converter.hbasm new file mode 100644 index 00000000..46c6c48b --- /dev/null +++ b/hbasm/assets/celsius_converter.hbasm @@ -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 \ No newline at end of file diff --git a/hbasm/assets/ecall.hbasm b/hbasm/assets/ecall.hbasm index 7743b53a..565655d9 100644 --- a/hbasm/assets/ecall.hbasm +++ b/hbasm/assets/ecall.hbasm @@ -1,11 +1,14 @@ -addi r1, r0, 1024 -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 +li r255, 0 +ecall -ecall \ No newline at end of file +li r255, 1 +li r254, 1 +li r253, 100 +ecall + +li r255, 2 +li r254, 0 +li r253, 0 +ecall + +tx \ No newline at end of file diff --git a/hbasm/assets/memory.hbasm b/hbasm/assets/memory.hbasm index 133def5f..0a311455 100644 --- a/hbasm/assets/memory.hbasm +++ b/hbasm/assets/memory.hbasm @@ -1,3 +1,4 @@ li r20, 1010 st r20, r24, 0, 1 -addi r24, r0, 10 \ No newline at end of file +addi r24, r0, 10 +tx \ No newline at end of file diff --git a/hbvm/assets/add.hb b/hbvm/assets/add.hb new file mode 100644 index 00000000..321efa58 Binary files /dev/null and b/hbvm/assets/add.hb differ diff --git a/hbvm/assets/celsius_converter.hb b/hbvm/assets/celsius_converter.hb new file mode 100644 index 00000000..77f97e9c Binary files /dev/null and b/hbvm/assets/celsius_converter.hb differ diff --git a/hbvm/assets/ecall.hb b/hbvm/assets/ecall.hb index 3ecd89a8..91832712 100644 Binary files a/hbvm/assets/ecall.hb and b/hbvm/assets/ecall.hb differ