]> git.mdlowis.com Git - proto/alvm.git/commitdiff
fixed tabs/spaces
authorMichael D. Lowis <mike.lowis@gentex.com>
Fri, 26 Feb 2021 17:20:58 +0000 (12:20 -0500)
committerMichael D. Lowis <mike.lowis@gentex.com>
Fri, 26 Feb 2021 17:20:58 +0000 (12:20 -0500)
main.s

diff --git a/main.s b/main.s
index 6be8a68828bb5e642de8d93c76d69e9960174fdc..f93ae8a9dbdfe111cf39caf1ff782020bd448d2c 100644 (file)
--- a/main.s
+++ b/main.s
@@ -2,8 +2,8 @@
 // Register Usage
 //---------------------------------------------------------------------
 //  %rsi    Program Counter
-//  %rsp    Argument Stack Pointer
-//  %rbp    Stack Frame Pointer
+//  %rsp    Stack Pointer
+//  %rbp    Frame Pointer
 //  %rax    Accumulator Register
 //  %rbx    Temporary Register
 
@@ -14,7 +14,7 @@
 // Execute next instruction
 .macro NEXT
     lodsq
-       jmpq    *(%rax)
+    jmpq       *(%rax)
 .endm
 
 // Macro to define a primitive
@@ -25,8 +25,8 @@
 \name :
     .quad code_\name
     .text
-       .globl code_\name
-       .p2align 4, 0x90
+    .globl code_\name
+    .p2align 4, 0x90
 code_\name :
     // ...the code goes here...
 .endm
@@ -43,8 +43,8 @@ code_\name :
 
 // Main Interpreter Definition
     .text
-       .globl EXEC_FUN
-       .p2align 4, 0x90
+    .globl EXEC_FUN
+    .p2align 4, 0x90
 EXEC_FUN:
     pushq   %rsi
     pushq   %rbp
@@ -97,10 +97,18 @@ defcode OP_localsn
 
 // Push the Nth argument onto the stack
 defcode OP_ldargn
+    lodsq
+    addq    $16, %rax
+    neg     %rax
+    movq    (%rbp, %rax, 8), %rax
+    pushq   %rax
     NEXT
 
 // Push the Nth local onto the stack
 defcode OP_ldlocn
+    lodsq
+    movq    (%rbp, %rax, 8), %rax
+    pushq   %rax
     NEXT
 
 // Pop top of stack and store to the Nth argument slot
@@ -115,15 +123,15 @@ defcode OP_stlocn
 // Main Routine
 //---------------------------------------------------------------------
     .text
-       .global _main
-       .global main
-       .p2align 4, 0x90
+    .global _main
+    .global main
+    .p2align 4, 0x90
 _main:
 main:
     pushq   %rax
     movq    %rsp, %rbp
-       leaq    cold_start(%rip), %rsi
-       NEXT
+    leaq    cold_start(%rip), %rsi
+    NEXT
 
 // First instructions to execute by the interpreter
     .data