Fix a typo:

Recieved -> Received
master
Andrius Štikonas 3 years ago
parent 81c788fd4b
commit 279941646f
Signed by: andrius
GPG Key ID: E2E5CD054CB9CD3E
  1. 2
      Library function prototypes/add_node.s
  2. 2
      Library function prototypes/readline.s
  3. 38
      Linux Bootstrap/AMD64/M0_AMD64.M1
  4. 38
      Linux Bootstrap/AMD64/M0_AMD64.S
  5. 38
      Linux Bootstrap/AMD64/M0_AMD64.hex2
  6. 170
      Linux Bootstrap/AMD64/cc_x86.S
  7. 2
      Linux Bootstrap/AMD64/hex2_AMD64.M1
  8. 2
      Linux Bootstrap/AMD64/hex2_AMD64.S
  9. 2
      Linux Bootstrap/AMD64/hex2_AMD64.hex1
  10. 2
      Linux Bootstrap/AMD64/hex2_AMD64.hex2
  11. 38
      Linux Bootstrap/x86/M0_x86.M1
  12. 38
      Linux Bootstrap/x86/M0_x86.S
  13. 38
      Linux Bootstrap/x86/M0_x86.hex2
  14. 168
      Linux Bootstrap/x86/cc_x86.M1
  15. 168
      Linux Bootstrap/x86/cc_x86.S
  16. 2
      Linux Bootstrap/x86/hex2_x86.M1
  17. 2
      Linux Bootstrap/x86/hex2_x86.S
  18. 2
      Linux Bootstrap/x86/hex2_x86.hex1
  19. 2
      Linux Bootstrap/x86/hex2_x86.hex2
  20. 4
      bootstrapping Steps.org
  21. 20
      stage1/M0-macro.hex2
  22. 20
      stage1/M0-macro.s
  23. 16
      stage1/SET.hex2
  24. 16
      stage1/SET.s
  25. 2
      stage1/dehex.hex0
  26. 2
      stage1/dehex.s
  27. 4
      stage1/stage1_assembler-2.hex1
  28. 4
      stage1/stage1_assembler-2.s
  29. 150
      stage2/cc_x86.s
  30. 2
      stage2/forth.s
  31. 174
      stage2/lisp.s
  32. 8
      stage3/M2-Planet_x86.c
  33. 4
      test/SHA256SUMS

@ -16,7 +16,7 @@
;; add_node Function
;; Recieves pointers in R0 R1
;; Receives pointers in R0 R1
;; Alters R0 if NULL
;; Appends nodes together
;; Returns to whatever called it

@ -15,7 +15,7 @@
; along with stage0. If not, see <http://www.gnu.org/licenses/>.
;; Readline function
;; Recieves Pointer to node in R0
;; Receives Pointer to node in R0
;; And Input in R1
;; Allocates Text segment on Heap
;; Sets node's pointer to Text segment

@ -239,7 +239,7 @@ DEFINE ZERO_EXTEND_CL 480FB6C9
;; fgetc function
;; Recieves FILE* in R15
;; Receives FILE* in R15
;; Returns -4 (EOF) or char in RAX
:fgetc
LOADI32_RAX %-4 ; Put EOF in rax
@ -285,7 +285,7 @@ DEFINE ZERO_EXTEND_CL 480FB6C9
;; Store_String Function
;; Recieves C in RCX, HEAD in RDX and Input file in R14
;; Receives C in RCX, HEAD in RDX and Input file in R14
;; Uses RBX for terminator, RCX for C and RDX for string
:Store_String
PUSH_RBX ; Protect RBX
@ -316,7 +316,7 @@ DEFINE ZERO_EXTEND_CL 480FB6C9
;; Store_Atom Function
;; Recieves C in RCX, HEAD in RDX and Input file in R15
;; Receives C in RCX, HEAD in RDX and Input file in R15
;; Uses RBX for in_set strings, RCX for C and RDX for string
:Store_Atom
PUSH_RBX ; Protect RBX
@ -346,7 +346,7 @@ DEFINE ZERO_EXTEND_CL 480FB6C9
;; In_Set function
;; Recieves Char C in RAX and CHAR* in RBX
;; Receives Char C in RAX and CHAR* in RBX
;; Returns 1 if true, zero if false in RAX
:In_Set
PUSH_RBX ; Protect RBX
@ -389,7 +389,7 @@ DEFINE ZERO_EXTEND_CL 480FB6C9
;; Reverse_List function
;; Recieves List in RAX
;; Receives List in RAX
;; Returns the list reversed in RAX
:Reverse_List
PUSH_RBX ; Protect RBX
@ -413,7 +413,7 @@ DEFINE ZERO_EXTEND_CL 480FB6C9
;; Identify_Macros function
;; Recieves List in RAX
;; Receives List in RAX
;; Updates the list in place; does not modify registers
;; Uses RBX for DEFINE, RCX for I
:Identify_Macros
@ -463,7 +463,7 @@ DEFINE ZERO_EXTEND_CL 480FB6C9
;; match function
;; Recieves CHAR* in RAX and CHAR* in RBX
;; Receives CHAR* in RAX and CHAR* in RBX
;; Returns 0 (TRUE) or 1 (FALSE) in RAX
:match
PUSH_RBX ; Protect RBX
@ -495,7 +495,7 @@ DEFINE ZERO_EXTEND_CL 480FB6C9
;; Line_Macro function
;; Recieves List in RAX
;; Receives List in RAX
;; Updates the list in place; does not modify registers
;; Uses RAX for I, RBX for I->TEXT, RCX for I->EXPRESSION
:Line_Macro
@ -528,7 +528,7 @@ DEFINE ZERO_EXTEND_CL 480FB6C9
;; Set_Expression function
;; Recieves List in RAX, CHAR* in RBX and CHAR* in RCX
;; Receives List in RAX, CHAR* in RBX and CHAR* in RCX
;; Updates the list in place; does not modify registers
;; Uses RBX for C, RCX for EXP and RDX for I
:Set_Expression
@ -563,7 +563,7 @@ DEFINE ZERO_EXTEND_CL 480FB6C9
;; Process_String function
;; Recieves List in RAX
;; Receives List in RAX
;; Update the list in place; does not modify registers
;; Uses RBX for I->TEXT, RCX for I and RDX for S
:Process_String
@ -623,7 +623,7 @@ DEFINE ZERO_EXTEND_CL 480FB6C9
;; string_length function
;; Recieves CHAR* in RAX
;; Receives CHAR* in RAX
;; Returns INT in RAX
;; Uses RAX for CH, RBX for S and RCX for INDEX
:string_length
@ -648,7 +648,7 @@ DEFINE ZERO_EXTEND_CL 480FB6C9
;; Eval_Immediates function
;; Recieves List in RAX
;; Receives List in RAX
;; Updates the list in place; does not modify registers
;; Uses RBX for I->TEXT[0], RCX for I->TEXT[1] and RDX for I
:Eval_Immediates
@ -700,7 +700,7 @@ DEFINE ZERO_EXTEND_CL 480FB6C9
;; numerate_string function
;; Recieves CHAR* in RAX
;; Receives CHAR* in RAX
;; Returns value of CHAR* in RAX
;; Only supports negative decimals and Uppercase Hex (eg 5, -3 and 0xCC)
;; Uses RAX for VALUE, RBX for S, RCX for CH and RSI for NEGATIVE?
@ -784,7 +784,7 @@ DEFINE ZERO_EXTEND_CL 480FB6C9
;; express_number function
;; Recieves INT in RAX and CHAR in RBX
;; Receives INT in RAX and CHAR in RBX
;; Allocates a string and expresses the value in hex
;; Returns string in RAX
;; Uses RAX for VALUE, RBX for S and RCX for CH
@ -831,7 +831,7 @@ DEFINE ZERO_EXTEND_CL 480FB6C9
;; HEX to ascii routine
;; Recieves INT in RAX and CHAR* in RBX
;; Receives INT in RAX and CHAR* in RBX
;; Stores ascii of INT in CHAR*
;; Returns only modifying RAX
:hex64l
@ -867,7 +867,7 @@ RET
;; Preserve_Other function
;; Recieves List in RAX
;; Receives List in RAX
;; Updates the list in place; does not modify registers
;; Uses RAX for I, RBX for I->TEXT
:Preserve_Other
@ -897,7 +897,7 @@ RET
;; Print_Hex function
;; Recieves list in RAX
;; Receives list in RAX
;; walks the list and prints the I->EXPRESSION for all nodes followed by newline
;; Uses RBX for I
:Print_Hex
@ -925,7 +925,7 @@ RET
;; File_Print function
;; Recieves CHAR* in RAX
;; Receives CHAR* in RAX
;; calls fputc for every non-null char
:File_Print
PUSH_RBX ; Protect RBX
@ -950,7 +950,7 @@ RET
;; fputc function
;; recieves CHAR in RAX and FILE* in R14
;; receives CHAR in RAX and FILE* in R14
;; writes char and returns
:fputc
PUSH_RAX ; We are writing rax

@ -132,7 +132,7 @@ done:
;; fgetc function
;; Recieves FILE* in R15
;; Receives FILE* in R15
;; Returns -4 (EOF) or char in RAX
fgetc:
mov rax, -4 ; Put EOF in rax
@ -178,7 +178,7 @@ Purge_LineComment:
;; Store_String Function
;; Recieves C in RCX, HEAD in RDX and Input file in R14
;; Receives C in RCX, HEAD in RDX and Input file in R14
;; Uses RBX for terminator, RCX for C and RDX for string
Store_String:
push rbx ; Protect RBX
@ -209,7 +209,7 @@ Store_String_Loop:
;; Store_Atom Function
;; Recieves C in RCX, HEAD in RDX and Input file in R15
;; Receives C in RCX, HEAD in RDX and Input file in R15
;; Uses RBX for in_set strings, RCX for C and RDX for string
Store_Atom:
push rbx ; Protect RBX
@ -239,7 +239,7 @@ Store_Atom_loop:
;; In_Set function
;; Recieves Char C in RAX and CHAR* in RBX
;; Receives Char C in RAX and CHAR* in RBX
;; Returns 1 if true, zero if false in RAX
In_Set:
push rbx ; Protect RBX
@ -281,7 +281,7 @@ string_char:
;; Reverse_List function
;; Recieves List in RAX
;; Receives List in RAX
;; Returns the list reversed in RAX
Reverse_List:
push rbx ; Protect RBX
@ -305,7 +305,7 @@ Reverse_List_Done:
;; Identify_Macros function
;; Recieves List in RAX
;; Receives List in RAX
;; Updates the list in place; does not modify registers
;; Uses RBX for DEFINE, RCX for I
Identify_Macros:
@ -355,7 +355,7 @@ DEFINE_str:
;; match function
;; Recieves CHAR* in RAX and CHAR* in RBX
;; Receives CHAR* in RAX and CHAR* in RBX
;; Returns 0 (TRUE) or 1 (FALSE) in RAX
match:
push rbx ; Protect RBX
@ -387,7 +387,7 @@ match_Done:
;; Line_Macro function
;; Recieves List in RAX
;; Receives List in RAX
;; Updates the list in place; does not modify registers
;; Uses RAX for I, RBX for I->TEXT, RCX for I->EXPRESSION
Line_Macro:
@ -420,7 +420,7 @@ Line_Macro_Next:
;; Set_Expression function
;; Recieves List in RAX, CHAR* in RBX and CHAR* in RCX
;; Receives List in RAX, CHAR* in RBX and CHAR* in RCX
;; Updates the list in place; does not modify registers
;; Uses RBX for C, RCX for EXP and RDX for I
Set_Expression:
@ -455,7 +455,7 @@ Set_Expression_Next:
;; Process_String function
;; Recieves List in RAX
;; Receives List in RAX
;; Update the list in place; does not modify registers
;; Uses RBX for I->TEXT, RCX for I and RDX for S
Process_String:
@ -515,7 +515,7 @@ Process_String_Next:
;; string_length function
;; Recieves CHAR* in RAX
;; Receives CHAR* in RAX
;; Returns INT in RAX
;; Uses RAX for CH, RBX for S and RCX for INDEX
string_length:
@ -540,7 +540,7 @@ string_length_done:
;; Eval_Immediates function
;; Recieves List in RAX
;; Receives List in RAX
;; Updates the list in place; does not modify registers
;; Uses RBX for I->TEXT[0], RCX for I->TEXT[1] and RDX for I
Eval_Immediates:
@ -592,7 +592,7 @@ Eval_Immediates_Next:
;; numerate_string function
;; Recieves CHAR* in RAX
;; Receives CHAR* in RAX
;; Returns value of CHAR* in RAX
;; Uses RAX for VALUE, RBX for S, RCX for CH and RSI for NEGATIVE?
numerate_string:
@ -675,7 +675,7 @@ numerate_string_done:
;; express_number function
;; Recieves INT in RAX and CHAR in RBX
;; Receives INT in RAX and CHAR in RBX
;; Allocates a string and expresses the value in hex
;; Returns string in RAX
;; Uses RAX for VALUE, RBX for S and RCX for CH
@ -722,7 +722,7 @@ express_number_done:
;; HEX to ascii routine
;; Recieves INT in RAX and CHAR* in RBX
;; Receives INT in RAX and CHAR* in RBX
;; Stores ascii of INT in CHAR*
;; Returns only modifying RAX
hex64l:
@ -758,7 +758,7 @@ hex1:
;; Preserve_Other function
;; Recieves List in RAX
;; Receives List in RAX
;; Updates the list in place; does not modify registers
;; Uses RAX for I, RBX for I->TEXT
Preserve_Other:
@ -788,7 +788,7 @@ Preserve_Other_Next:
;; Print_Hex function
;; Recieves list in RAX
;; Receives list in RAX
;; walks the list and prints the I->EXPRESSION for all nodes followed by newline
;; Uses RBX for I
Print_Hex:
@ -816,7 +816,7 @@ Print_Hex_Next:
;; File_Print function
;; Recieves CHAR* in RAX
;; Receives CHAR* in RAX
;; calls fputc for every non-null char
File_Print:
push rbx ; Protect RBX
@ -841,7 +841,7 @@ File_Print_Done:
;; fputc function
;; recieves CHAR in RAX and FILE* in R14
;; receives CHAR in RAX and FILE* in R14
;; writes char and returns
fputc:
push rax ; We are writing rax

@ -129,7 +129,7 @@
;; fgetc function
;; Recieves FILE* in R15
;; Receives FILE* in R15
;; Returns -4 (EOF) or char in RAX
:fgetc
48C7C0 FCFFFFFF # LOADI32_RAX %-4 ; Put EOF in rax
@ -175,7 +175,7 @@
;; Store_String Function
;; Recieves C in RCX, HEAD in RDX and Input file in R14
;; Receives C in RCX, HEAD in RDX and Input file in R14
;; Uses RBX for terminator, RCX for C and RDX for string
:Store_String
53 # PUSH_RBX ; Protect RBX
@ -206,7 +206,7 @@
;; Store_Atom Function
;; Recieves C in RCX, HEAD in RDX and Input file in R15
;; Receives C in RCX, HEAD in RDX and Input file in R15
;; Uses RBX for in_set strings, RCX for C and RDX for string
:Store_Atom
53 # PUSH_RBX ; Protect RBX
@ -236,7 +236,7 @@
;; In_Set function
;; Recieves Char C in RAX and CHAR* in RBX
;; Receives Char C in RAX and CHAR* in RBX
;; Returns 1 if true, zero if false in RAX
:In_Set
53 # PUSH_RBX ; Protect RBX
@ -278,7 +278,7 @@
;; Reverse_List function
;; Recieves List in RAX
;; Receives List in RAX
;; Returns the list reversed in RAX
:Reverse_List
53 # PUSH_RBX ; Protect RBX
@ -302,7 +302,7 @@
;; Identify_Macros function
;; Recieves List in RAX
;; Receives List in RAX
;; Updates the list in place; does not modify registers
;; Uses RBX for DEFINE, RCX for I
:Identify_Macros
@ -352,7 +352,7 @@
;; match function
;; Recieves CHAR* in RAX and CHAR* in RBX
;; Receives CHAR* in RAX and CHAR* in RBX
;; Returns 0 (TRUE) or 1 (FALSE) in RAX
:match
53 # PUSH_RBX ; Protect RBX
@ -384,7 +384,7 @@
;; Line_Macro function
;; Recieves List in RAX
;; Receives List in RAX
;; Updates the list in place; does not modify registers
;; Uses RAX for I, RBX for I->TEXT, RCX for I->EXPRESSION
:Line_Macro
@ -417,7 +417,7 @@
;; Set_Expression function
;; Recieves List in RAX, CHAR* in RBX and CHAR* in RCX
;; Receives List in RAX, CHAR* in RBX and CHAR* in RCX
;; Updates the list in place; does not modify registers
;; Uses RBX for C, RCX for EXP and RDX for I
:Set_Expression
@ -452,7 +452,7 @@
;; Process_String function
;; Recieves List in RAX
;; Receives List in RAX
;; Update the list in place; does not modify registers
;; Uses RBX for I->TEXT, RCX for I and RDX for S
:Process_String
@ -512,7 +512,7 @@
;; string_length function
;; Recieves CHAR* in RAX
;; Receives CHAR* in RAX
;; Returns INT in RAX
;; Uses RAX for CH, RBX for S and RCX for INDEX
:string_length
@ -537,7 +537,7 @@
;; Eval_Immediates function
;; Recieves List in RAX
;; Receives List in RAX
;; Updates the list in place; does not modify registers
;; Uses RBX for I->TEXT[0], RCX for I->TEXT[1] and RDX for I
:Eval_Immediates
@ -589,7 +589,7 @@
;; numerate_string function
;; Recieves CHAR* in RAX
;; Receives CHAR* in RAX
;; Returns value of CHAR* in RAX
;; Only supports negative decimals and Uppercase Hex (eg 5, -3 and 0xCC)
;; Uses RAX for VALUE, RBX for S, RCX for CH and RSI for NEGATIVE?
@ -673,7 +673,7 @@
;; express_number function
;; Recieves INT in RAX and CHAR in RBX
;; Receives INT in RAX and CHAR in RBX
;; Allocates a string and expresses the value in hex
;; Returns string in RAX
;; Uses RAX for VALUE, RBX for S and RCX for CH
@ -720,7 +720,7 @@
;; HEX to ascii routine
;; Recieves INT in RAX and CHAR* in RBX
;; Receives INT in RAX and CHAR* in RBX
;; Stores ascii of INT in CHAR*
;; Returns only modifying RAX
:hex64l
@ -756,7 +756,7 @@
;; Preserve_Other function
;; Recieves List in RAX
;; Receives List in RAX
;; Updates the list in place; does not modify registers
;; Uses RAX for I, RBX for I->TEXT
:Preserve_Other
@ -786,7 +786,7 @@
;; Print_Hex function
;; Recieves list in RAX
;; Receives list in RAX
;; walks the list and prints the I->EXPRESSION for all nodes followed by newline
;; Uses RBX for I
:Print_Hex
@ -814,7 +814,7 @@
;; File_Print function
;; Recieves CHAR* in RAX
;; Receives CHAR* in RAX
;; calls fputc for every non-null char
:File_Print
53 # PUSH_RBX ; Protect RBX
@ -839,7 +839,7 @@
;; fputc function
;; recieves CHAR in RAX and FILE* in R14
;; receives CHAR in RAX and FILE* in R14
;; writes char and returns
:fputc
50 # PUSH_RAX ; We are writing rax

@ -98,7 +98,7 @@ header_string3: db 10, "# Program strings", 10, 0
;; read_all_tokens function
;; Recieves FILE* in R15 and Token_List* in RAX
;; Receives FILE* in R15 and Token_List* in RAX
;; Tokenizes all input and returns updated list in RAX
;; Returns TOKEN in RAX
;; Uses RAX for C
@ -116,7 +116,7 @@ read_all_tokens_done:
;; get_token function
;; Recieves INT in RAX and FILE* in R15
;; Receives INT in RAX and FILE* in R15
;; Makes a list of TOKEN_LIST
;; C and STRING_INDEX are stored in memory, RCX is used for S and RDX is used for current
;; Returns C in RAX
@ -277,7 +277,7 @@ malloc:
;; clear_white_space function
;; Recieves INT C in RAX and FILE* in R15
;; Receives INT C in RAX and FILE* in R15
;; Returns first non-whitespace char in RAX
clear_white_space:
cmp rax, 32 ; Check for ' '
@ -300,7 +300,7 @@ clear_white_space_done:
;; In_Set function
;; Recieves Char C in RAX and CHAR* in RBX
;; Receives Char C in RAX and CHAR* in RBX
;; Returns 1 if true, zero if false in RAX
In_Set:
push rbx ; Protect RBX
@ -336,7 +336,7 @@ strings: db 34, 39, 0
;; purge_macro function
;; Recieves CH in RAX
;; Receives CH in RAX
;; Reads chars until Line feed is read
;; returns line feed
purge_macro:
@ -347,7 +347,7 @@ purge_macro:
;; preserve_keyword function
;; Recieves INT C in RAX
;; Receives INT C in RAX
;; collects all chars in keyword
;; Returns C in RAX
;; Uses RCX for INT C
@ -382,7 +382,7 @@ preserve_keyword_done:
;; preserve_symbol function
;; Recieves INT C in RAX
;; Receives INT C in RAX
;; collects all chars in symbol
;; Returns C in RAX
;; Uses RCX for INT C
@ -409,7 +409,7 @@ preserve_symbol_done:
;; consume_word function
;; recieves INT C in RAX
;; receives INT C in RAX
;; returns INT C in RAX
;; Uses RAX for C, RBX for FREQ and RCX for ESCAPE
consume_word:
@ -446,7 +446,7 @@ consume_word_iter:
;; consume_byte function
;; Recieves INT C in RAX
;; Receives INT C in RAX
;; Inserts C into string S, updates String S
;; Returns Next char in RAX
consume_byte:
@ -461,7 +461,7 @@ consume_byte:
;; fixup_label function
;; Recieves S in RCX
;; Receives S in RCX
;; prepends ':' to string and returns registers un changed
;; Uses RAX for HOLD, RBX for PREV and RCX for S[0]
fixup_label:
@ -486,7 +486,7 @@ fixup_label_loop:
;; fgetc function
;; Recieves FILE* in R15
;; Receives FILE* in R15
;; Returns -4 (EOF) or char in RAX
fgetc:
mov rax, -4 ; Put EOF in rax
@ -511,7 +511,7 @@ fgetc_done:
;; Reverse_List function
;; Recieves List in RAX
;; Receives List in RAX
;; Returns the list reversed in RAX
Reverse_List:
push rbx ; Protect RBX
@ -535,7 +535,7 @@ Reverse_List_Done:
;; recursive_output function
;; Recieves list in RAX
;; Receives list in RAX
;; walks the list and prints the I->S for all nodes backwards
;; Uses RBX for I
recursive_output:
@ -558,7 +558,7 @@ recursive_output_done:
;; File_Print function
;; Recieves CHAR* in RAX
;; Receives CHAR* in RAX
;; calls fputc for every non-null char
File_Print:
push rbx ; Protect RBX
@ -583,7 +583,7 @@ File_Print_Done:
;; fputc function
;; recieves CHAR in RAX and FILE* in R14
;; receives CHAR in RAX and FILE* in R14
;; writes char and returns
fputc:
push rax ; We are writing rax
@ -603,7 +603,7 @@ fputc:
;; program function
;; recieves nothing, returns nothing
;; receives nothing, returns nothing
;; Uses RAX for type_size
program:
;; The binary initialized the globals to null, so we can skip those steps
@ -710,7 +710,7 @@ program_string_1: db 10, "NOP", 10, 0
;; declare_function function
;; Recieves nothing and returns nothing
;; Receives nothing and returns nothing
;; Sets current function and adds it to the global function list
declare_function:
push rbx ; Protect RBX
@ -786,7 +786,7 @@ declare_function_string_3: db 10, 0
;; collect_arguments function
;; Recieves nothing
;; Receives nothing
;; Returns Nothing
;; Adds arguments to the function definition
;; holds struct type* type_size in RCX, then replace with struct token_list* a in RCX when type_size is used
@ -882,7 +882,7 @@ collect_arguments_done:
;; statement function
;; Recieves nothing
;; Receives nothing
;; Returns nothing
;; Walks down global_token recursively to collect the contents of the function
statement:
@ -1073,7 +1073,7 @@ statement_string_4: db "ERROR in statement", 10, "Missing ;", 10, 0
;; recursive_statement function
;; Recieves nothing
;; Receives nothing
;; Returns nothing
;; Walks the global_token list to build the contents of statements
;; Uses struct token_list* frame in RCX
@ -1138,7 +1138,7 @@ recursive_statement_string_1: db "POP_ebx", 9, "# _recursive_statement_locals",
;; return_result function
;; Recieves nothing
;; Receives nothing
;; Returns nothing
;; Cleans up function and generates return
;; Also handles returing expressions
@ -1186,7 +1186,7 @@ return_result_string_2: db "RETURN", 10, 0
;; collect_local function
;; Recieves nothing
;; Receives nothing
;; Returns nothing
;; Walks global_token list to create function locals
;; Uses RCX for struct token_list* A
@ -1318,7 +1318,7 @@ collect_local_string_3: db "PUSH_eax", 9, "#", 0
;; process_asm function
;; Recieves nothing
;; Receives nothing
;; Returns nothing
;; Simply inlines the asm statements
;; Uses RBX for global_token temp storage
@ -1370,7 +1370,7 @@ process_asm_string_3: db "ERROR in process_asm", 10, "MISSING ;", 10, 0
;; process_if function
;; Recieves nothing
;; Receives nothing
;; Returns Nothing
;; Increments current_count recurses into expression + statement
;; Uses RCX for char* NUMBER_STRING
@ -1504,7 +1504,7 @@ restore_break_frame:
;; set_break_frame microfunction
;; Recieves char* head in RAX and char* num in RBX
;; Receives char* head in RAX and char* num in RBX
;; Overwrites RAX and RBX
;; Returns to calling function
set_break_frame:
@ -1519,7 +1519,7 @@ set_break_frame:
;; process_do function
;; Recieves Nothing
;; Receives Nothing
;; Returns Nothing
;; Increments current_count and leverages save/restore_break_frame pieces
;; Uses RCX for char* NUMBER_STRING
@ -1603,7 +1603,7 @@ process_do_string_7: db ":DO_END_", 0
;; process_while function
;; Recieves nothing
;; Receives nothing
;; Returns nothing
;; Increments current_count and leverages save/restore_break_frame pieces
;; Uses RCX for char* NUMBER_STRING
@ -1694,7 +1694,7 @@ process_while_string_7: db ":END_WHILE_", 0
;; process_for function
;; Recieves Nothing
;; Receives Nothing
;; Returns Nothing
;; Increments current_count and leverages save/restore_break_frame pieces
;; Uses RCX for char* NUMBER_STRING
@ -1842,7 +1842,7 @@ process_for_string_13: db ":FOR_END_", 0
;; process_break function
;; Recieves nothing
;; Receives nothing
;; Returns nothing
;; Handles the break out of loops case
;; Uses RBX for struct token_list* break_frame and RCX for struct token_list* I
@ -1920,7 +1920,7 @@ process_break_string_4: db "ERROR in break statement",10, "Missing ;", 10, 0
;; expression function
;; Recieves Nothing
;; Receives Nothing
;; Returns Nothing
;; Walks global_token and updates output_list
;; Uses RAX and RBX for match and RCX for char* store
@ -1976,7 +1976,7 @@ expression_string_1: db "STORE_CHAR", 10, 0
;; bitwise_expr function
;; Recieves nothing
;; Receives nothing
;; Returns nothing
;; Walks global_token list and updates output list
;; Just calls other functions
@ -1987,7 +1987,7 @@ bitwise_expr:
;; bitwise_expr_stub function
;; Recieves nothing
;; Receives nothing
;; Returns Nothing
;; Just calls general_recursion a bunch
;; Uses RAX, RBX, RCX and RDX for passing constants to general recursion
@ -2037,7 +2037,7 @@ bitwise_expr_stub_string_2: db "XOR_ebx_eax_into_eax", 10, 0
;; relational_expr function
;; Recieves nothing
;; Receives nothing
;; Returns Nothing
;; Walks global_token list and updates output list
;; just calls other function
@ -2048,7 +2048,7 @@ relational_expr:
;; relational_expr_stub function
;; Recieves nothing
;; Receives nothing
;; Returns Nothing
;; Just calls general_recursion a bunch
;; Uses RAX, RBX, RCX and RDX for passing constants to general recursion
@ -2107,7 +2107,7 @@ relational_expr_stub_string_5: db "CMP", 10, "SETNE", 10, "MOVEZBL", 10, 0
;; additive_expr function
;; Recieves nothing
;; Receives nothing
;; Returns Nothing
;; Walks global_token list and updates output list
;; just calls other function
@ -2118,7 +2118,7 @@ additive_expr:
;; additive_expr_stub function
;; Recieves nothing
;; Receives nothing
;; Returns Nothing
;; Just calls general_recursion a bunch
;; Uses RAX, RBX, RCX and RDX for passing constants to general recursion
@ -2184,7 +2184,7 @@ additive_expr_stub_string_6: db "COPY_eax_to_ecx", 10, "COPY_ebx_to_eax", 10, "S
;; postfix_expr function
;; Recieves nothing
;; Receives nothing
;; Returns Nothing
;; Walks global_token list and updates output list
;; just calls other function
@ -2195,7 +2195,7 @@ postfix_expr:
;; postfix_expr_stub function
;; Recieves nothing
;; Receives nothing
;; Returns Nothing
;; Checks for "[" and "->" and deals with them otherwise does nothing
;; Uses RAX, RBX, RCX and RDX for passing constants to general recursion
@ -2228,7 +2228,7 @@ postfix_expr_stub_done:
;; unary_expr_sizeof function
;; Recieves nothing
;; Receives nothing
;; Returns nothing
;; Uses RCX for A->SIZE
unary_expr_sizeof:
@ -2270,7 +2270,7 @@ unary_expr_sizeof_string_3: db 10, 0
;; postfix_expr_array function
;; Recieves Nothing
;; Receives Nothing
;; Returns Nothing
;; Uses RBX for struct type* ARRAY and RCX for char* ASSIGN
postfix_expr_array:
@ -2348,7 +2348,7 @@ postfix_expr_array_string_6: db 0
;; ceil_log2 function
;; Recieves int a in RAX
;; Receives int a in RAX
;; Performs log2 on A and
;; Returns result in RAX
;; Uses RBX for INT A and RCX for INT RESULT
@ -2381,7 +2381,7 @@ ceil_log2_done:
;; postfix_expr_arrow function
;; Recieves nothing
;; Receives nothing
;; Returns nothing
;; Emits a bunch and updates current_target
;; Uses RBX for struct type* I
@ -2449,7 +2449,7 @@ postfix_expr_arrow_string_3: db "LOAD_INTEGER", 10, 0
;; primary_expr function
;; Recieves nothing
;; Receives nothing
;; Returns nothing
primary_expr:
push rbx ; Protect RBX
@ -2607,7 +2607,7 @@ primary_expr_string_7:db "0123456789", 0
;; primary_expr_variable function
;; Recieves nothing
;; Receives nothing
;; Returns nothing
;; Walks global and updates output
;; Uses RAX for struct token_list* a and RCX for char* S
@ -2704,7 +2704,7 @@ primary_expr_variable_string_2: db "LOAD_IMMEDIATE_eax %", 0
;; function_call function
;; Recieves char* S in RAX and int BOOL in RBX
;; Receives char* S in RAX and int BOOL in RBX
;; Builds stack frames before and tears them down after function calls
;; Uses RCX for char* S, RDX for int BOOL, RSI for PASSED
function_call:
@ -2848,7 +2848,7 @@ function_call_string_15: db "POP_edi", 9, "# Prevent overwrite", 10, 0
;; variable_load function
;; Recieves struct token_list* A in RAX
;; Receives struct token_list* A in RAX
;; Returns nothing
;; Updates output and current_target
;; Uses RCX for A
@ -2915,7 +2915,7 @@ variable_load_string_2: db "LOAD_INTEGER", 10, 0
;; function_load function
;; Recieves struct token_list* a in RAX
;; Receives struct token_list* a in RAX
;; Returns nothing
;; Uses RCX to hold A->S
function_load:
@ -2956,7 +2956,7 @@ function_load_string_1: db 10, 0
;; global_load function
;; Recieves struct token_list* A in RAX
;; Receives struct token_list* A in RAX
;; Returns nothing
;; Uses RBX to hold A->S
global_load:
@ -2997,7 +2997,7 @@ global_load_string_2: db "LOAD_INTEGER", 10, 0
;; sym_lookup function
;; Recieves char* S in RAX and struct token_list* symbol_list in RBX
;; Receives char* S in RAX and struct token_list* symbol_list in RBX
;; Uses I->S in RAX, S in RBX and I in RCX
;; Returns match or NULL
sym_lookup:
@ -3025,7 +3025,7 @@ sym_lookup_done:
;; primary_expr_number function
;; Recieves nothing
;; Receives nothing
;; Returns nothing
;; Simply uses current global token to update output and then steps to next global_token
primary_expr_number:
@ -3049,7 +3049,7 @@ primary_expr_number_string_1: db 10, 0
;; primary_expr_string function
;; recieves nothing
;; receives nothing
;; Returns nothing
;; creates entries for string and calls to generate string output
;; uses RCX for char* number_string
@ -3103,7 +3103,7 @@ primary_expr_string_string_1: db ":STRING_", 0
;; primary_expr_char function
;; Recieves nothing
;; Receives nothing
;; Returns nothing
;; Updates output_list using global_token
primary_expr_char:
@ -3134,13 +3134,13 @@ primary_expr_char_string_1: db 10, 0
;; primary_expr_failure function
;; Recieves nothing
;; Receives nothing
;; Does not return but aborts hard
;; Complains about the bad input
primary_expr_failure:
; call line_error ; Get line of issue
mov r14, 2 ; write to standard error
mov rax, primary_expr_failure_string_0 ; Using "Recieved "
mov rax, primary_expr_failure_string_0 ; Using "Received "
call File_Print ; Print it
mov rax, [global_token] ; Using global_token
@ -3151,12 +3151,12 @@ primary_expr_failure:
call File_Print ; Print it
jmp Exit_Failure ; Abort Hard
primary_expr_failure_string_0: db "Recieved ", 0
primary_expr_failure_string_0: db "Received ", 0
primary_expr_failure_string_1: db " in primary_expr", 10, 0
;; general_recursion function
;; Recieves FUNCTION F in RAX, char* S in RBX, char* name in RCX and FUNCTION iterate in RDX
;; Receives FUNCTION F in RAX, char* S in RBX, char* name in RCX and FUNCTION iterate in RDX
;; Returns nothing
;; Uses RCX for char* S, RDX for FUNCTION iterate and RBP for FUNCTION F
;; But generally recurses a shitload
@ -3194,7 +3194,7 @@ general_recursion_done:
;; promote_type function
;; Recieves struct type* a in RAX and struct type* b in RBX
;; Receives struct type* a in RAX and struct type* b in RBX
;; Returns the most recent type in RAX
;; Uses RAX for struct type* I, RCX for struct type* A and RDX for struct type* B
promote_type:
@ -3245,7 +3245,7 @@ promote_type_done:
;; common_recursion function
;; Recieves FUNCTION F in RAX
;; Receives FUNCTION F in RAX
;; Returns Nothing
;; Walks global_token list and update output_list
;; Updates current_target
@ -3277,7 +3277,7 @@ common_recursion_string_1: db "POP_ebx", 9, "# _common_recursion", 10, 0
;; require_match function
;; Recieves char* message in RAX and char* required in RBX
;; Receives char* message in RAX and char* required in RBX
;; Returns nothing
;; Uses RCX to hold message and updates global_token
require_match:
@ -3307,7 +3307,7 @@ require_match_good:
;; uniqueID Function
;; Recieves char*S in RAX, struct token_list* l in RBX snd char* num in RCX
;; Receives char*S in RAX, struct token_list* l in RBX snd char* num in RCX
;; Returns updated struct token_list* L in RAX
uniqueID:
push rbx ; Protect RBX
@ -3330,7 +3330,7 @@ uniqueID_string_0: db 10, 0
;; uniqueID_out function
;; Recieves char* S in RAX and char* num in RBX
;; Receives char* S in RAX and char* num in RBX
;; Returns nothing
uniqueID_out:
push rax ; Protect RAX
@ -3347,7 +3347,7 @@ uniqueID_out:
;; emit_out function
;; Recieves char* S in RAX
;; Receives char* S in RAX
;; Returns nothing
;; Updates output_list
;; MUST NOT ALTER REGISTERS
@ -3363,7 +3363,7 @@ emit_out:
;; emit function
;; Recieves char *s in RAX and struct token_list* head in RBX
;; Receives char *s in RAX and struct token_list* head in RBX
;; Returns struct token_list* T in RAX
emit:
push rcx ; Protect RCX
@ -3377,9 +3377,9 @@ emit:
;; escape_lookup function
;; Recieves char* c in RAX
;; Receives char* c in RAX
;; Returns integer value of char in RAX
;; Aborts hard if unknown escape is recieved
;; Aborts hard if unknown escape is received
;; Uses RCX to hold char* C
escape_lookup:
push rbx ; Protect RBX
@ -3422,7 +3422,7 @@ escape_lookup:
;; Looks like we have no clue what we are doing
;; Aborting hard
mov r14, 2 ; write to standard error
mov rax, escape_lookup_string_0 ; Using "Unknown escape recieved: "
mov rax, escape_lookup_string_0 ; Using "Unknown escape received: "
call File_Print ; Print it
mov rax, rcx ; Using C
call File_Print ; Print it
@ -3450,12 +3450,12 @@ escape_lookup_hex:
add rax, rbx ; hex(c[2]) << 4 + hex(c[3])
jmp escape_lookup_done ; Be done
escape_lookup_string_0: db "Unknown escape recieved: ", 0
escape_lookup_string_0: db "Unknown escape received: ", 0
escape_lookup_string_1: db " Unable to process", 10, 0
;; char2hex function
;; Recieves char in RAX
;; Receives char in RAX
;; Returns hex or aborts hard
char2hex:
sub rax, 48 ; Try 0-9
@ -3484,7 +3484,7 @@ char2hex_string_0: db "Tried to print non-hex number", 10, 0
;; parse_string function
;; Recieves char* string in RAX
;; Receives char* string in RAX
;; Returns cleaned up string
;; Protects char* string in RBX
parse_string:
@ -3509,7 +3509,7 @@ parse_string_done:
;; weird function
;; Recieves char* string in RAX
;; Receives char* string in RAX
;; Returns true(0) or false(1) in RAX
;; Uses RCX to hold char* string
weird:
@ -3579,7 +3579,7 @@ weird_string_1: db 9, 10, 13, 32, 0
;; collect_regular_string function
;; Recieves char* string in RAX
;; Receives char* string in RAX
;; Malloc and creates new string to return in RAX
;; Uses RCX for return string and RDX for passed string
collect_regular_string:
@ -3635,7 +3635,7 @@ collect_regular_string_done:
;; collect_weird_string function
;; Recieves char* string in RAX
;; Receives char* string in RAX
;; Mallocs and returns char* hold in RAX
;; Uses RCX for char* hold and RDX for char* string
collect_weird_string:
@ -3703,7 +3703,7 @@ collect_weird_string_done:
;; HEX to ascii routine
;; Recieves INT in RAX and CHAR* in RCX
;; Receives INT in RAX and CHAR* in RCX
;; Stores ascii of INT in CHAR*
;; Returns only modifying RAX and RCX
hex8:
@ -3724,7 +3724,7 @@ hex1:
;; type_name function
;; Recieves nothing
;; Receives nothing
;; Returns type_size in RAX
;; Uses RCX for STRUCT TYPE* RET
type_name:
@ -3810,7 +3810,7 @@ type_name_string_1: db 10, 0
;; lookup_type function
;; Recieves char* s in RAX and struct type* start in RBX
;; Receives char* s in RAX and struct type* start in RBX
;; Returns struct type* in RAX
;; Uses RBX for S and RCX for I
lookup_type:
@ -3838,7 +3838,7 @@ lookup_type_done:
;; create_struct function
;; Recieves nothing
;; Receives nothing
;; Returns nothing
;; Uses global_token to malloc a struct's definition
;; Uses RCX for int OFFSET, RDX for struct type* head, RBP for struct type* I,
@ -3955,7 +3955,7 @@ create_struct_string_1: db "ERROR in create_struct", 10, " Missing ;", 10, 0
;; lookup_member function
;; Recieves struct type* parent in RAX and char* name in RBX
;; Receives struct type* parent in RAX and char* name in RBX
;; Returns struct type* I in RAX
;; Uses char* NAME in RBX, RCX for struct type* I and RDX to hold parent for errors
;; Aborts hard if not found
@ -4012,7 +4012,7 @@ lookup_member_string_2: db 10, 0
;; build_member function
;; Recieves struct type* last in RAX, int offset in RBX and global member_size in RDI
;; Receives struct type* last in RAX, int offset in RBX and global member_size in RDI