parent
81c788fd4b
commit
279941646f
|
@ -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
|
||||
;; Updates member_size in RDI and returns struct type* I in RAX
|
||||
;; Uses RCX for struct type* member_type and RDX for struct type* I
|
||||
build_member:
|
||||
|
@ -4081,7 +4081,7 @@ build_member_string_0: db "Struct only supports [num] form", 10, 0
|
|||
|
||||
|
||||
;; build_union 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
|
||||
;; Updates member_size in RDI and returns struct type* LAST in RAX
|
||||
;; Uses RCX for struct type* last, RDX for int offset, RSI for int size and RDI for int member_size
|
||||
build_union:
|
||||
|
@ -4147,7 +4147,7 @@ build_union_string_1: db "ERROR in build_union", 10, "Missing ;", 10, 0
|
|||
|
||||
|
||||
;; sym_declare function
|
||||
;; Recieves char *s in RAX, struct type* t in RBX, and struct token_list* list in RCX
|
||||
;; Receives char *s in RAX, struct type* t in RBX, and struct token_list* list in RCX
|
||||
;; Returns struct token_list* in RAX
|
||||
;; Uses RAX for A
|
||||
sym_declare:
|
||||
|
@ -4163,7 +4163,7 @@ sym_declare:
|
|||
|
||||
|
||||
;; 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
|
||||
|
@ -4195,7 +4195,7 @@ match_Done:
|
|||
|
||||
|
||||
;; numerate_number function
|
||||
;; Recieves an INT A in RAX
|
||||
;; Receives an INT A in RAX
|
||||
;; Returns char* result in RAX
|
||||
;; Allocates 16 bytes of memory
|
||||
;; Behaves badly when given a negative number too large
|
||||
|
@ -4275,7 +4275,7 @@ numerate_number_ZERO:
|
|||
|
||||
|
||||
;; 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:
|
||||
|
@ -4358,7 +4358,7 @@ numerate_string_done:
|
|||
|
||||
|
||||
;; Exit_Failure function
|
||||
;; Recieves nothing
|
||||
;; Receives nothing
|
||||
;; And aborts hard
|
||||
;; Does NOT return
|
||||
Exit_Failure:
|
||||
|
@ -4504,7 +4504,7 @@ type_unsigned_name: db "unsigned", 0
|
|||
|
||||
|
||||
;; debug_list function
|
||||
;; Recieves struct token_list* in RAX
|
||||
;; Receives struct token_list* in RAX
|
||||
;; Prints contents of list and exits
|
||||
;; Does NOT return
|
||||
debug_list:
|
||||
|
|
|
@ -449,7 +449,7 @@ DEFINE ZERO_EXTEND_BL 480FB6DB
|
|||
POP_R11 ; Restore HEAD
|
||||
RET
|
||||
|
||||
;; Recieves pointer in RBX
|
||||
;; Receives pointer in RBX
|
||||
;; Writes out char and updates RBX
|
||||
:consume_token
|
||||
CALLI32 %Read_byte ; Consume_token
|
||||
|
|
|
@ -373,7 +373,7 @@ print_chars:
|
|||
pop r11 ; Restore HEAD
|
||||
ret
|
||||
|
||||
;; Recieves pointer in RBX
|
||||
;; Receives pointer in RBX
|
||||
;; Writes out char and updates RBX
|
||||
consume_token:
|
||||
call Read_byte ; Consume_token
|
||||
|
|
|
@ -420,7 +420,7 @@ CF 05 00 00 00 00 00 00 ## p_memsz
|
|||
415B ; POP_R11 ; Restore HEAD
|
||||
C3 ; RET
|
||||
|
||||
;; Recieves pointer in RBX
|
||||
;; Receives pointer in RBX
|
||||
;; Writes out char and updates RBX
|
||||
:A # :consume_token
|
||||
E8 %x ; CALLI32 %Read_byte ; Consume_token
|
||||
|
|
|
@ -374,7 +374,7 @@
|
|||
415B ; POP_R11 ; Restore HEAD
|
||||
C3 ; RET
|
||||
|
||||
;; Recieves pointer in RBX
|
||||
;; Receives pointer in RBX
|
||||
;; Writes out char and updates RBX
|
||||
:consume_token
|
||||
E8 %Read_byte ; CALLI32 %Read_byte ; Consume_token
|
||||
|
|
|
@ -235,7 +235,7 @@ DEFINE XCHG_EAX_EBX 93
|
|||
|
||||
|
||||
;; fgetc function
|
||||
;; Recieves FILE* in [Input]
|
||||
;; Receives FILE* in [Input]
|
||||
;; Returns -4 (EOF) or char in EAX
|
||||
:fgetc
|
||||
PUSH_EDX ; Protect EDX
|
||||
|
@ -287,7 +287,7 @@ DEFINE XCHG_EAX_EBX 93
|
|||
|
||||
|
||||
;; Store_String Function
|
||||
;; Recieves C in ECX, HEAD in EDX and Input file in [Output]
|
||||
;; Receives C in ECX, HEAD in EDX and Input file in [Output]
|
||||
;; Uses EBX for terminator, ECX for C and EDX for string
|
||||
:Store_String
|
||||
PUSH_EBX ; Protect EBX
|
||||
|
@ -318,7 +318,7 @@ DEFINE XCHG_EAX_EBX 93
|
|||
|
||||
|
||||
;; Store_Atom Function
|
||||
;; Recieves C in ECX, HEAD in EDX and Input file in [Input]
|
||||
;; Receives C in ECX, HEAD in EDX and Input file in [Input]
|
||||
;; Uses EBX for in_set strings, ECX for C and EDX for string
|
||||
:Store_Atom
|
||||
PUSH_EBX ; Protect EBX
|
||||
|
@ -348,7 +348,7 @@ DEFINE XCHG_EAX_EBX 93
|
|||
|
||||
|
||||
;; In_Set function
|
||||
;; Recieves Char C in EAX and CHAR* in EBX
|
||||
;; Receives Char C in EAX and CHAR* in EBX
|
||||
;; Returns 1 if true, zero if false in EAX
|
||||
:In_Set
|
||||
PUSH_EBX ; Protect EBX
|
||||
|
@ -391,7 +391,7 @@ DEFINE XCHG_EAX_EBX 93
|
|||
|
||||
|
||||
;; Reverse_List function
|
||||
;; Recieves List in EAX
|
||||
;; Receives List in EAX
|
||||
;; Returns the list reversed in EAX
|
||||
:Reverse_List
|
||||
PUSH_EBX ; Protect EBX
|
||||
|
@ -415,7 +415,7 @@ DEFINE XCHG_EAX_EBX 93
|
|||
|
||||
|
||||
;; Identify_Macros function
|
||||
;; Recieves List in EAX
|
||||
;; Receives List in EAX
|
||||
;; Updates the list in place; does not modify registers
|
||||
;; Uses EBX for DEFINE, ECX for I
|
||||
:Identify_Macros
|
||||
|
@ -465,7 +465,7 @@ DEFINE XCHG_EAX_EBX 93
|
|||
|
||||
|
||||
;; match function
|
||||
;; Recieves CHAR* in EAX and CHAR* in EBX
|
||||
;; Receives CHAR* in EAX and CHAR* in EBX
|
||||
;; Returns 0 (TRUE) or 1 (FALSE) in EAX
|
||||
:match
|
||||
PUSH_EBX ; Protect EBX
|
||||
|
@ -497,7 +497,7 @@ DEFINE XCHG_EAX_EBX 93
|
|||
|
||||
|
||||
;; Line_Macro function
|
||||
;; Recieves List in EAX
|
||||
;; Receives List in EAX
|
||||
;; Updates the list in place; does not modify registers
|
||||
;; Uses EAX for I, EBX for I->TEXT, ECX for I->EXPRESSION
|
||||
:Line_Macro
|
||||
|
@ -530,7 +530,7 @@ DEFINE XCHG_EAX_EBX 93
|
|||
|
||||
|
||||
;; Set_Expression function
|
||||
;; Recieves List in EAX, CHAR* in EBX and CHAR* in ECX
|
||||
;; Receives List in EAX, CHAR* in EBX and CHAR* in ECX
|
||||
;; Updates the list in place; does not modify registers
|
||||
;; Uses EBX for C, ECX for EXP and EDX for I
|
||||
:Set_Expression
|
||||
|
@ -565,7 +565,7 @@ DEFINE XCHG_EAX_EBX 93
|
|||
|
||||
|
||||
;; Process_String function
|
||||
;; Recieves List in EAX
|
||||
;; Receives List in EAX
|
||||
;; Update the list in place; does not modify registers
|
||||
;; Uses EBX for I->TEXT, ECX for I and EDX for S
|
||||
:Process_String
|
||||
|
@ -625,7 +625,7 @@ DEFINE XCHG_EAX_EBX 93
|
|||
|
||||
|
||||
;; string_length function
|
||||
;; Recieves CHAR* in EAX
|
||||
;; Receives CHAR* in EAX
|
||||
;; Returns INT in EAX
|
||||
;; Uses EAX for CH, EBX for S and ECX for INDEX
|
||||
:string_length
|
||||
|
@ -650,7 +650,7 @@ DEFINE XCHG_EAX_EBX 93
|
|||
|
||||
|
||||
;; Eval_Immediates function
|
||||
;; Recieves List in EAX
|
||||
;; Receives List in EAX
|
||||
;; Updates the list in place; does not modify registers
|
||||
;; Uses EBX for I->TEXT[0], ECX for I->TEXT[1] and EDX for I
|
||||
:Eval_Immediates
|
||||
|
@ -702,7 +702,7 @@ DEFINE XCHG_EAX_EBX 93
|
|||
|
||||
|
||||
;; numerate_string function
|
||||
;; Recieves CHAR* in EAX
|
||||
;; Receives CHAR* in EAX
|
||||
;; Returns value of CHAR* in EAX
|
||||
;; Uses EAX for VALUE, EBX for S, ECX for CH and EDI for NEGATIVE?
|
||||
:numerate_string
|
||||
|
@ -785,7 +785,7 @@ DEFINE XCHG_EAX_EBX 93
|
|||
|
||||
|
||||
;; express_number function
|
||||
;; Recieves INT in EAX and CHAR in EBX
|
||||
;; Receives INT in EAX and CHAR in EBX
|
||||
;; Allocates a string and expresses the value in hex
|
||||
;; Returns string in EAX
|
||||
;; Uses EAX for VALUE, EBX for S and ECX for CH
|
||||
|
@ -832,7 +832,7 @@ DEFINE XCHG_EAX_EBX 93
|
|||
|
||||
|
||||
;; HEX to ascii routine
|
||||
;; Recieves INT in EAX and CHAR* in EBX
|
||||
;; Receives INT in EAX and CHAR* in EBX
|
||||
;; Stores ascii of INT in CHAR*
|
||||
;; Returns only modifying EAX
|
||||
:hex64l
|
||||
|
@ -868,7 +868,7 @@ DEFINE XCHG_EAX_EBX 93
|
|||
|
||||
|
||||
;; Preserve_Other function
|
||||
;; Recieves List in EAX
|
||||
;; Receives List in EAX
|
||||
;; Updates the list in place; does not modify registers
|
||||
;; Uses EAX for I, EBX for I->TEXT
|
||||
:Preserve_Other
|
||||
|
@ -898,7 +898,7 @@ DEFINE XCHG_EAX_EBX 93
|
|||
|
||||
|
||||
;; Print_Hex function
|
||||
;; Recieves list in EAX
|
||||
;; Receives list in EAX
|
||||
;; walks the list and prints the I->EXPRESSION for all nodes followed by newline
|
||||
;; Uses EBX for I
|
||||
:Print_Hex
|
||||
|
@ -926,7 +926,7 @@ DEFINE XCHG_EAX_EBX 93
|
|||
|
||||
|
||||
;; File_Print function
|
||||
;; Recieves CHAR* in EAX
|
||||
;; Receives CHAR* in EAX
|
||||
;; calls fputc for every non-null char
|
||||
:File_Print
|
||||
PUSH_EBX ; Protect EBX
|
||||
|
@ -951,7 +951,7 @@ DEFINE XCHG_EAX_EBX 93
|
|||
|
||||
|
||||
;; fputc function
|
||||
;; recieves CHAR in EAX and FILE* in [Output]
|
||||
;; receives CHAR in EAX and FILE* in [Output]
|
||||
;; writes char and returns
|
||||
:fputc
|
||||
PUSH_EDX ; Protect EDX
|
||||
|
|
|
@ -132,7 +132,7 @@ done:
|
|||
|
||||
|
||||
;; fgetc function
|
||||
;; Recieves FILE* in [Input]
|
||||
;; Receives FILE* in [Input]
|
||||
;; Returns -4 (EOF) or char in EAX
|
||||
fgetc:
|
||||
push edx ; Protect EDX
|
||||
|
@ -184,7 +184,7 @@ Purge_LineComment:
|
|||
|
||||
|
||||
;; Store_String Function
|
||||
;; Recieves C in ECX, HEAD in EDX and Input file in [Output]
|
||||
;; Receives C in ECX, HEAD in EDX and Input file in [Output]
|
||||
;; Uses EBX for terminator, ECX for C and EDX for string
|
||||
Store_String:
|
||||
push ebx ; Protect EBX
|
||||
|
@ -215,7 +215,7 @@ Store_String_Loop:
|
|||
|
||||
|
||||
;; Store_Atom Function
|
||||
;; Recieves C in ECX, HEAD in EDX and Input file in [Input]
|
||||
;; Receives C in ECX, HEAD in EDX and Input file in [Input]
|
||||
;; Uses EBX for in_set strings, ECX for C and EDX for string
|
||||
Store_Atom:
|
||||
push ebx ; Protect EBX
|
||||
|
@ -245,7 +245,7 @@ Store_Atom_loop:
|
|||
|
||||
|
||||
;; In_Set function
|
||||
;; Recieves Char C in EAX and CHAR* in EBX
|
||||
;; Receives Char C in EAX and CHAR* in EBX
|
||||
;; Returns 1 if true, zero if false in EAX
|
||||
In_Set:
|
||||
push ebx ; Protect EBX
|
||||
|
@ -287,7 +287,7 @@ string_char:
|
|||
|
||||
|
||||
;; Reverse_List function
|
||||
;; Recieves List in EAX
|
||||
;; Receives List in EAX
|
||||
;; Returns the list reversed in EAX
|
||||
Reverse_List:
|
||||
push ebx ; Protect EBX
|
||||
|
@ -311,7 +311,7 @@ Reverse_List_Done:
|
|||
|
||||
|
||||
;; Identify_Macros function
|
||||
;; Recieves List in EAX
|
||||
;; Receives List in EAX
|
||||
;; Updates the list in place; does not modify registers
|
||||
;; Uses EBX for DEFINE, ECX for I
|
||||
Identify_Macros:
|
||||
|
@ -361,7 +361,7 @@ DEFINE_str:
|
|||
|
||||
|
||||
;; match function
|
||||
;; Recieves CHAR* in EAX and CHAR* in EBX
|
||||
;; Receives CHAR* in EAX and CHAR* in EBX
|
||||
;; Returns 0 (TRUE) or 1 (FALSE) in EAX
|
||||
match:
|
||||
push ebx ; Protect EBX
|
||||
|
@ -393,7 +393,7 @@ match_Done:
|
|||
|
||||
|
||||
;; Line_Macro function
|
||||
;; Recieves List in EAX
|
||||
;; Receives List in EAX
|
||||
;; Updates the list in place; does not modify registers
|
||||
;; Uses EAX for I, EBX for I->TEXT, ECX for I->EXPRESSION
|
||||
Line_Macro:
|
||||
|
@ -426,7 +426,7 @@ Line_Macro_Next:
|
|||
|
||||
|
||||
;; Set_Expression function
|
||||
;; Recieves List in EAX, CHAR* in EBX and CHAR* in ECX
|
||||
;; Receives List in EAX, CHAR* in EBX and CHAR* in ECX
|
||||
;; Updates the list in place; does not modify registers
|
||||
;; Uses EBX for C, ECX for EXP and EDX for I
|
||||
Set_Expression:
|
||||
|
@ -461,7 +461,7 @@ Set_Expression_Next:
|
|||
|
||||
|
||||
;; Process_String function
|
||||
;; Recieves List in EAX
|
||||
;; Receives List in EAX
|
||||
;; Update the list in place; does not modify registers
|
||||
;; Uses EBX for I->TEXT, ECX for I and EDX for S
|
||||
Process_String:
|
||||
|
@ -521,7 +521,7 @@ Process_String_Next:
|
|||
|
||||
|
||||
;; string_length function
|
||||
;; Recieves CHAR* in EAX
|
||||
;; Receives CHAR* in EAX
|
||||
;; Returns INT in EAX
|
||||
;; Uses EAX for CH, EBX for S and ECX for INDEX
|
||||
string_length:
|
||||
|
@ -546,7 +546,7 @@ string_length_done:
|
|||
|
||||
|
||||
;; Eval_Immediates function
|
||||
;; Recieves List in EAX
|
||||
;; Receives List in EAX
|
||||
;; Updates the list in place; does not modify registers
|
||||
;; Uses EBX for I->TEXT[0], ECX for I->TEXT[1] and EDX for I
|
||||
Eval_Immediates:
|
||||
|
@ -598,7 +598,7 @@ Eval_Immediates_Next:
|
|||
|
||||
|
||||
;; numerate_string function
|
||||
;; Recieves CHAR* in EAX
|
||||
;; Receives CHAR* in EAX
|
||||
;; Returns value of CHAR* in EAX
|
||||
;; Uses EAX for VALUE, EBX for S, ECX for CH and EDI for NEGATIVE?
|
||||
numerate_string:
|
||||
|
@ -681,7 +681,7 @@ numerate_string_done:
|
|||
|
||||
|
||||
;; express_number function
|
||||
;; Recieves INT in EAX and CHAR in EBX
|
||||
;; Receives INT in EAX and CHAR in EBX
|
||||
;; Allocates a string and expresses the value in hex
|
||||
;; Returns string in EAX
|
||||
;; Uses EAX for VALUE, EBX for S and ECX for CH
|
||||
|
@ -728,7 +728,7 @@ express_number_done:
|
|||
|
||||
|
||||
;; HEX to ascii routine
|
||||
;; Recieves INT in EAX and CHAR* in EBX
|
||||
;; Receives INT in EAX and CHAR* in EBX
|
||||
;; Stores ascii of INT in CHAR*
|
||||
;; Returns only modifying EAX
|
||||
hex64l:
|
||||
|
@ -764,7 +764,7 @@ hex1:
|
|||
|
||||
|
||||
;; Preserve_Other function
|
||||
;; Recieves List in EAX
|
||||
;; Receives List in EAX
|
||||
;; Updates the list in place; does not modify registers
|
||||
;; Uses EAX for I, EBX for I->TEXT
|
||||
Preserve_Other:
|
||||
|
@ -794,7 +794,7 @@ Preserve_Other_Next:
|
|||
|
||||
|
||||
;; Print_Hex function
|
||||
;; Recieves list in EAX
|
||||
;; Receives list in EAX
|
||||
;; walks the list and prints the I->EXPRESSION for all nodes followed by newline
|
||||
;; Uses EBX for I
|
||||
Print_Hex:
|
||||
|
@ -822,7 +822,7 @@ Print_Hex_Next:
|
|||
|
||||
|
||||
;; File_Print function
|
||||
;; Recieves CHAR* in EAX
|
||||
;; Receives CHAR* in EAX
|
||||
;; calls fputc for every non-null char
|
||||
File_Print:
|
||||
push ebx ; Protect EBX
|
||||
|
@ -847,7 +847,7 @@ File_Print_Done:
|
|||
|
||||
|
||||
;; fputc function
|
||||
;; recieves CHAR in EAX and FILE* in [Output]
|
||||
;; receives CHAR in EAX and FILE* in [Output]
|
||||
;; writes char and returns
|
||||
fputc:
|
||||
push edx ; Protect EDX
|
||||
|
|
|
@ -129,7 +129,7 @@
|
|||
|
||||
|
||||
;; fgetc function
|
||||
;; Recieves FILE* in [Input]
|
||||
;; Receives FILE* in [Input]
|
||||
;; Returns -4 (EOF) or char in EAX
|
||||
:fgetc
|
||||
52 ; PUSH_EDX ; Protect EDX
|
||||
|
@ -181,7 +181,7 @@
|
|||
|
||||
|
||||
;; Store_String Function
|
||||
;; Recieves C in ECX, HEAD in EDX and Input file in [Output]
|
||||
;; Receives C in ECX, HEAD in EDX and Input file in [Output]
|
||||
;; Uses EBX for terminator, ECX for C and EDX for string
|
||||
:Store_String
|
||||
53 ; PUSH_EBX ; Protect EBX
|
||||
|
@ -212,7 +212,7 @@
|
|||
|
||||
|
||||
;; Store_Atom Function
|
||||
;; Recieves C in ECX, HEAD in EDX and Input file in [Input]
|
||||
;; Receives C in ECX, HEAD in EDX and Input file in [Input]
|
||||
;; Uses EBX for in_set strings, ECX for C and EDX for string
|
||||
:Store_Atom
|
||||
53 ; PUSH_EBX ; Protect EBX
|
||||
|
@ -242,7 +242,7 @@
|
|||
|
||||
|
||||
;; In_Set function
|
||||
;; Recieves Char C in EAX and CHAR* in EBX
|
||||
;; Receives Char C in EAX and CHAR* in EBX
|
||||
;; Returns 1 if true, zero if false in EAX
|
||||
:In_Set
|
||||
53 ; PUSH_EBX ; Protect EBX
|
||||
|
@ -284,7 +284,7 @@
|
|||
|
||||
|
||||
;; Reverse_List function
|
||||
;; Recieves List in EAX
|
||||
;; Receives List in EAX
|
||||
;; Returns the list reversed in EAX
|
||||
:Reverse_List
|
||||
53 ; PUSH_EBX ; Protect EBX
|
||||
|
@ -308,7 +308,7 @@
|
|||
|
||||
|
||||
;; Identify_Macros function
|
||||
;; Recieves List in EAX
|
||||
;; Receives List in EAX
|
||||
;; Updates the list in place; does not modify registers
|
||||
;; Uses EBX for DEFINE, ECX for I
|
||||
:Identify_Macros
|
||||
|
@ -358,7 +358,7 @@
|
|||
|
||||
|
||||
;; match function
|
||||
;; Recieves CHAR* in EAX and CHAR* in EBX
|
||||
;; Receives CHAR* in EAX and CHAR* in EBX
|
||||
;; Returns 0 (TRUE) or 1 (FALSE) in EAX
|
||||
:match
|
||||
53 ; PUSH_EBX ; Protect EBX
|
||||
|
@ -390,7 +390,7 @@
|
|||
|
||||
|
||||
;; Line_Macro function
|
||||
;; Recieves List in EAX
|
||||
;; Receives List in EAX
|
||||
;; Updates the list in place; does not modify registers
|
||||
;; Uses EAX for I, EBX for I->TEXT, ECX for I->EXPRESSION
|
||||
:Line_Macro
|
||||
|
@ -423,7 +423,7 @@
|
|||
|
||||
|
||||
;; Set_Expression function
|
||||
;; Recieves List in EAX, CHAR* in EBX and CHAR* in ECX
|
||||
;; Receives List in EAX, CHAR* in EBX and CHAR* in ECX
|
||||
;; Updates the list in place; does not modify registers
|
||||
;; Uses EBX for C, ECX for EXP and EDX for I
|
||||
:Set_Expression
|
||||
|
@ -458,7 +458,7 @@
|
|||
|
||||
|
||||
;; Process_String function
|
||||
;; Recieves List in EAX
|
||||
;; Receives List in EAX
|
||||
;; Update the list in place; does not modify registers
|
||||
;; Uses EBX for I->TEXT, ECX for I and EDX for S
|
||||
:Process_String
|
||||
|
@ -518,7 +518,7 @@
|
|||
|
||||
|
||||
;; string_length function
|
||||
;; Recieves CHAR* in EAX
|
||||
;; Receives CHAR* in EAX
|
||||
;; Returns INT in EAX
|
||||
;; Uses EAX for CH, EBX for S and ECX for INDEX
|
||||
:string_length
|
||||
|
@ -543,7 +543,7 @@
|
|||
|
||||
|
||||
;; Eval_Immediates function
|
||||
;; Recieves List in EAX
|
||||
;; Receives List in EAX
|
||||
;; Updates the list in place; does not modify registers
|
||||
;; Uses EBX for I->TEXT[0], ECX for I->TEXT[1] and EDX for I
|
||||
:Eval_Immediates
|
||||
|
@ -595,7 +595,7 @@
|
|||
|
||||
|
||||
;; numerate_string function
|
||||
;; Recieves CHAR* in EAX
|
||||
;; Receives CHAR* in EAX
|
||||
;; Returns value of CHAR* in EAX
|
||||
;; Uses EAX for VALUE, EBX for S, ECX for CH and EDI for NEGATIVE?
|
||||
:numerate_string
|
||||
|
@ -678,7 +678,7 @@
|
|||
|
||||
|
||||
;; express_number function
|
||||
;; Recieves INT in EAX and CHAR in EBX
|
||||
;; Receives INT in EAX and CHAR in EBX
|
||||
;; Allocates a string and expresses the value in hex
|
||||
;; Returns string in EAX
|
||||
;; Uses EAX for VALUE, EBX for S and ECX for CH
|
||||
|
@ -725,7 +725,7 @@
|
|||
|
||||
|
||||
;; HEX to ascii routine
|
||||
;; Recieves INT in EAX and CHAR* in EBX
|
||||
;; Receives INT in EAX and CHAR* in EBX
|
||||
;; Stores ascii of INT in CHAR*
|
||||
;; Returns only modifying EAX
|
||||
:hex64l
|
||||
|
@ -761,7 +761,7 @@
|
|||
|
||||
|
||||
;; Preserve_Other function
|
||||
;; Recieves List in EAX
|
||||
;; Receives List in EAX
|
||||
;; Updates the list in place; does not modify registers
|
||||
;; Uses EAX for I, EBX for I->TEXT
|
||||
:Preserve_Other
|
||||
|
@ -791,7 +791,7 @@
|
|||
|
||||
|
||||
;; Print_Hex function
|
||||
;; Recieves list in EAX
|
||||
;; Receives list in EAX
|
||||
;; walks the list and prints the I->EXPRESSION for all nodes followed by newline
|
||||
;; Uses EBX for I
|
||||
:Print_Hex
|
||||
|
@ -819,7 +819,7 @@
|
|||
|
||||
|
||||
;; File_Print function
|
||||
;; Recieves CHAR* in EAX
|
||||
;; Receives CHAR* in EAX
|
||||
;; calls fputc for every non-null char
|
||||
:File_Print
|
||||
53 ; PUSH_EBX ; Protect EBX
|
||||
|
@ -844,7 +844,7 @@
|
|||
|
||||
|
||||
;; fputc function
|
||||
;; recieves CHAR in EAX and FILE* in [Output]
|
||||
;; receives CHAR in EAX and FILE* in [Output]
|
||||
;; writes char and returns
|
||||
:fputc
|
||||
52 ; PUSH_EDX ; Protect EDX
|
||||
|
|
|
@ -253,7 +253,7 @@ DEFINE SWAP_EAX_EBX 93
|
|||
|
||||
|
||||
;; read_all_tokens function
|
||||
;; Recieves Token_List* in EAX
|
||||
;; Receives Token_List* in EAX
|
||||
;; Tokenizes all input and returns updated list in EAX
|
||||
;; Returns TOKEN in EAX
|
||||
;; Uses EAX for C
|
||||
|
@ -271,7 +271,7 @@ DEFINE SWAP_EAX_EBX 93
|
|||
|
||||
|
||||
;; get_token function
|
||||
;; Recieves INT in EAX
|
||||
;; Receives INT in EAX
|
||||
;; Makes a list of TOKEN_LIST
|
||||
;; C and STRING_INDEX are stored in memory, ECX is used for S and EDX is used for current
|
||||
;; Returns C in EAX
|
||||
|
@ -434,7 +434,7 @@ DEFINE SWAP_EAX_EBX 93
|
|||
|
||||
|
||||
;; clear_white_space function
|
||||
;; Recieves INT C in EAX
|
||||
;; Receives INT C in EAX
|
||||
;; Returns first non-whitespace char in EAX
|
||||
:clear_white_space
|
||||
CMPI8_EAX !32 ; Check for ' '
|
||||
|
@ -457,7 +457,7 @@ DEFINE SWAP_EAX_EBX 93
|
|||
|
||||
|
||||
;; In_Set function
|
||||
;; Recieves Char C in EAX and CHAR* in EBX
|
||||
;; Receives Char C in EAX and CHAR* in EBX
|
||||
;; Returns 1 if true, zero if false in EAX
|
||||
:In_Set
|
||||
PUSH_EBX ; Protect EBX
|
||||
|
@ -493,7 +493,7 @@ DEFINE SWAP_EAX_EBX 93
|
|||
|
||||
|
||||
;; purge_macro function
|
||||
;; Recieves CH in EAX
|
||||
;; Receives CH in EAX
|
||||
;; Reads chars until Line feed is read
|
||||
;; returns line feed
|
||||
:purge_macro
|
||||
|
@ -504,7 +504,7 @@ DEFINE SWAP_EAX_EBX 93
|
|||
|
||||
|
||||
;; preserve_keyword function
|
||||
;; Recieves INT C in EAX
|
||||
;; Receives INT C in EAX
|
||||
;; collects all chars in keyword
|
||||
;; Returns C in EAX
|
||||
;; Uses ECX for INT C
|
||||
|
@ -539,7 +539,7 @@ DEFINE SWAP_EAX_EBX 93
|
|||
|
||||
|
||||
;; preserve_symbol function
|
||||
;; Recieves INT C in EAX
|
||||
;; Receives INT C in EAX
|
||||
;; collects all chars in symbol
|
||||
;; Returns C in EAX
|
||||
;; Uses ECX for INT C
|
||||
|
@ -566,7 +566,7 @@ DEFINE SWAP_EAX_EBX 93
|
|||
|
||||
|
||||
;; consume_word function
|
||||
;; recieves INT C in EAX
|
||||
;; receives INT C in EAX
|
||||
;; returns INT C in EAX
|
||||
;; Uses EAX for C, EBX for FREQ and ECX for ESCAPE
|
||||
:consume_word
|
||||
|
@ -603,7 +603,7 @@ DEFINE SWAP_EAX_EBX 93
|
|||
|
||||
|
||||
;; consume_byte function
|
||||
;; Recieves INT C in EAX
|
||||
;; Receives INT C in EAX
|
||||
;; Inserts C into string S, updates String S
|
||||
;; Returns Next char in EAX
|
||||
:consume_byte
|
||||
|
@ -618,7 +618,7 @@ DEFINE SWAP_EAX_EBX 93
|
|||
|
||||
|
||||
;; fixup_label function
|
||||
;; Recieves S in ECX
|
||||
;; Receives S in ECX
|
||||
;; prepends ':' to string and returns registers un changed
|
||||
;; Uses EAX for HOLD, EBX for PREV and ECX for S[0]
|
||||
:fixup_label
|
||||
|
@ -668,7 +668,7 @@ DEFINE SWAP_EAX_EBX 93
|
|||
|
||||
|
||||
;; Reverse_List function
|
||||
;; Recieves List in EAX
|
||||
;; Receives List in EAX
|
||||
;; Returns the list reversed in EAX
|
||||
:Reverse_List
|
||||
PUSH_EBX ; Protect EBX
|
||||
|
@ -692,7 +692,7 @@ DEFINE SWAP_EAX_EBX 93
|
|||
|
||||
|
||||
;; recursive_output function
|
||||
;; Recieves list in EAX
|
||||
;; Receives list in EAX
|
||||
;; walks the list and prints the I->S for all nodes backwards
|
||||
;; Uses EBX for I
|
||||
:recursive_output
|
||||
|
@ -715,7 +715,7 @@ DEFINE SWAP_EAX_EBX 93
|
|||
|
||||
|
||||
;; File_Print function
|
||||
;; Recieves CHAR* in EAX
|
||||
;; Receives CHAR* in EAX
|
||||
;; calls fputc for every non-null char
|
||||
:File_Print
|
||||
PUSH_EBX ; Protect EBX
|
||||
|
@ -740,7 +740,7 @@ DEFINE SWAP_EAX_EBX 93
|
|||
|
||||
|
||||
;; fputc function
|
||||
;; recieves CHAR in EAX and load FILE* from [OUTPUT_FILE]
|
||||
;; receives CHAR in EAX and load FILE* from [OUTPUT_FILE]
|
||||
;; writes char and returns
|
||||
:fputc
|
||||
PUSH_EBX ; Protect EBX
|
||||
|
@ -760,7 +760,7 @@ DEFINE SWAP_EAX_EBX 93
|
|||
|
||||
|
||||
;; program function
|
||||
;; recieves nothing, returns nothing
|
||||
;; receives nothing, returns nothing
|
||||
;; Uses EAX for type_size
|
||||
:program
|
||||
;; The binary initialized the globals to null, so we can skip those steps
|
||||
|
@ -870,7 +870,7 @@ NOP
|
|||
|
||||
|
||||
;; 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_EBX ; Protect EBX
|
||||
|
@ -949,7 +949,7 @@ NOP
|
|||
|
||||
|
||||
;; collect_arguments function
|
||||
;; Recieves nothing
|
||||
;; Receives nothing
|
||||
;; Returns Nothing
|
||||
;; Adds arguments to the function definition
|
||||
;; holds struct type* type_size in ECX, then replace with struct token_list* a in ECX when type_size is used
|
||||
|
@ -1045,7 +1045,7 @@ NOP
|
|||
|
||||
|
||||
;; statement function
|
||||
;; Recieves nothing
|
||||
;; Receives nothing
|
||||
;; Returns nothing
|
||||
;; Walks down global_token recursively to collect the contents of the function
|
||||
:statement
|
||||
|
@ -1242,7 +1242,7 @@ Missing ;
|
|||
|
||||
|
||||
;; 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 ECX
|
||||
|
@ -1309,7 +1309,7 @@ Missing ;
|
|||
|
||||
|
||||
;; return_result function
|
||||
;; Recieves nothing
|
||||
;; Receives nothing
|
||||
;; Returns nothing
|
||||
;; Cleans up function and generates return
|
||||
;; Also handles returing expressions
|
||||
|
@ -1361,7 +1361,7 @@ MISSING ;
|
|||
|
||||
|
||||
;; collect_local function
|
||||
;; Recieves nothing
|
||||
;; Receives nothing
|
||||
;; Returns nothing
|
||||
;; Walks global_token list to create function locals
|
||||
;; Uses ECX for struct token_list* A
|
||||
|
@ -1496,7 +1496,7 @@ Missing ;
|
|||
|
||||
|
||||
;; process_asm function
|
||||
;; Recieves nothing
|
||||
;; Receives nothing
|
||||
;; Returns nothing
|
||||
;; Simply inlines the asm statements
|
||||
;; Uses EBX for global_token temp storage
|
||||
|
@ -1555,7 +1555,7 @@ MISSING ;
|
|||
|
||||
|
||||
;; process_if function
|
||||
;; Recieves nothing
|
||||
;; Receives nothing
|
||||
;; Returns Nothing
|
||||
;; Increments current_count recurses into expression + statement
|
||||
;; Uses ECX for char* NUMBER_STRING
|
||||
|
@ -1694,7 +1694,7 @@ MISSING )
|
|||
|
||||
|
||||
;; set_break_frame microfunction
|
||||
;; Recieves char* head in EAX and char* num in EBX
|
||||
;; Receives char* head in EAX and char* num in EBX
|
||||
;; Overwrites EAX and EBX
|
||||
;; Returns to calling function
|
||||
:set_break_frame
|
||||
|
@ -1709,7 +1709,7 @@ MISSING )
|
|||
|
||||
|
||||
;; process_do function
|
||||
;; Recieves Nothing
|
||||
;; Receives Nothing
|
||||
;; Returns Nothing
|
||||
;; Increments current_count and leverages save/restore_break_frame pieces
|
||||
;; Uses ECX for char* NUMBER_STRING
|
||||
|
@ -1802,7 +1802,7 @@ JUMP_NE %DO_"
|
|||
|
||||
|
||||
;; process_while function
|
||||
;; Recieves nothing
|
||||
;; Receives nothing
|
||||
;; Returns nothing
|
||||
;; Increments current_count and leverages save/restore_break_frame pieces
|
||||
;; Uses ECX for char* NUMBER_STRING
|
||||
|
@ -1898,7 +1898,7 @@ MISSING )
|
|||
|
||||
|
||||
;; process_for function
|
||||
;; Recieves Nothing
|
||||
;; Receives Nothing
|
||||
;; Returns Nothing
|
||||
;; Increments current_count and leverages save/restore_break_frame pieces
|
||||
;; Uses ECX for char* NUMBER_STRING
|
||||
|
@ -2055,7 +2055,7 @@ MISSING )
|
|||
|
||||
|
||||
;; process_break function
|
||||
;; Recieves nothing
|
||||
;; Receives nothing
|
||||
;; Returns nothing
|
||||
;; Handles the break out of loops case
|
||||
;; Uses EBX for struct token_list* break_frame and ECX for struct token_list* I
|
||||
|
@ -2137,7 +2137,7 @@ Missing ;
|
|||
|
||||
|
||||
;; expression function
|
||||
;; Recieves Nothing
|
||||
;; Receives Nothing
|
||||
;; Returns Nothing
|
||||
;; Walks global_token and updates output_list
|
||||
;; Uses EAX and EBX for match and ECX for char* store
|
||||
|
@ -2195,7 +2195,7 @@ Missing ;
|
|||
|
||||
|
||||
;; bitwise_expr function
|
||||
;; Recieves nothing
|
||||
;; Receives nothing
|
||||
;; Returns nothing
|
||||
;; Walks global_token list and updates output list
|
||||
;; Just calls other functions
|
||||
|
@ -2206,7 +2206,7 @@ Missing ;
|
|||
|
||||
|
||||
;; bitwise_expr_stub function
|
||||
;; Recieves nothing
|
||||
;; Receives nothing
|
||||
;; Returns Nothing
|
||||
;; Just calls general_recursion a bunch
|
||||
;; Uses EAX, EBX, ECX and EDX for passing constants to general recursion
|
||||
|
@ -2259,7 +2259,7 @@ Missing ;
|
|||
|
||||
|
||||
;; relational_expr function
|
||||
;; Recieves nothing
|
||||
;; Receives nothing
|
||||
;; Returns Nothing
|
||||
;; Walks global_token list and updates output list
|
||||
;; just calls other function
|
||||
|
@ -2270,7 +2270,7 @@ Missing ;
|
|||
|
||||
|
||||
;; relational_expr_stub function
|
||||
;; Recieves nothing
|
||||
;; Receives nothing
|
||||
;; Returns Nothing
|
||||
;; Just calls general_recursion a bunch
|
||||
;; Uses EAX, EBX, ECX and EDX for passing constants to general recursion
|
||||
|
@ -2347,7 +2347,7 @@ MOVEZBL
|
|||
|
||||
|
||||
;; additive_expr function
|
||||
;; Recieves nothing
|
||||
;; Receives nothing
|
||||
;; Returns Nothing
|
||||
;; Walks global_token list and updates output list
|
||||
;; just calls other function
|
||||
|
@ -2358,7 +2358,7 @@ MOVEZBL
|
|||
|
||||
|
||||
;; additive_expr_stub function
|
||||
;; Recieves nothing
|
||||
;; Receives nothing
|
||||
;; Returns Nothing
|
||||
;; Just calls general_recursion a bunch
|
||||
;; Uses EAX, EBX, ECX and EDX for passing constants to general recursion
|
||||
|
@ -2441,7 +2441,7 @@ SAR_eax_cl
|
|||
|
||||
|
||||
;; postfix_expr function
|
||||
;; Recieves nothing
|
||||
;; Receives nothing
|
||||
;; Returns Nothing
|
||||
;; Walks global_token list and updates output list
|
||||
;; just calls other function
|
||||
|
@ -2452,7 +2452,7 @@ SAR_eax_cl
|
|||
|
||||
|
||||
;; postfix_expr_stub function
|
||||
;; Recieves nothing
|
||||
;; Receives nothing
|
||||
;; Returns Nothing
|
||||
;; Checks for "[" and "->" and deals with them otherwise does nothing
|
||||
;; Uses EAX, EBX, ECX and EDX for passing constants to general recursion
|
||||
|
@ -2485,7 +2485,7 @@ SAR_eax_cl
|
|||
|
||||
|
||||
;; unary_expr_sizeof function
|
||||
;; Recieves nothing
|
||||
;; Receives nothing
|
||||
;; Returns nothing
|
||||
;; Uses ECX for A->SIZE
|
||||
:unary_expr_sizeof
|
||||
|
@ -2532,7 +2532,7 @@ Missing )
|
|||
|
||||
|
||||
;; postfix_expr_array function
|
||||
;; Recieves Nothing
|
||||
;; Receives Nothing
|
||||
;; Returns Nothing
|
||||
;; Uses EBX for struct type* ARRAY and ECX for char* ASSIGN
|
||||
:postfix_expr_array
|
||||
|
@ -2616,7 +2616,7 @@ Missing ]
|
|||
|
||||
|
||||
;; ceil_log2 function
|
||||
;; Recieves int a in EAX
|
||||
;; Receives int a in EAX
|
||||
;; Performs log2 on A and
|
||||
;; Returns result in EAX
|
||||
;; Uses EBX for INT A and ECX for INT RESULT
|
||||
|
@ -2649,7 +2649,7 @@ Missing ]
|
|||
|
||||
|
||||
;; postfix_expr_arrow function
|
||||
;; Recieves nothing
|
||||
;; Receives nothing
|
||||
;; Returns nothing
|
||||
;; Emits a bunch and updates current_target
|
||||
;; Uses EBX for struct type* I
|
||||
|
@ -2722,7 +2722,7 @@ ADD_ebx_to_eax
|
|||
|
||||
|
||||
;; primary_expr function
|
||||
;; Recieves nothing
|
||||
;; Receives nothing
|
||||
;; Returns nothing
|
||||
:primary_expr
|
||||
PUSH_EBX ; Protect EBX
|
||||
|
@ -2888,7 +2888,7 @@ Didn't get )
|
|||
|
||||
|
||||
;; primary_expr_variable function
|
||||
;; Recieves nothing
|
||||
;; Receives nothing
|
||||
;; Returns nothing
|
||||
;; Walks global and updates output
|
||||
;; Uses EAX for struct token_list* a and ECX for char* S
|
||||
|
@ -2988,7 +2988,7 @@ Didn't get )
|
|||
|
||||
|
||||
;; function_call function
|
||||
;; Recieves char* S in EAX and int BOOL in EBX
|
||||
;; Receives char* S in EAX and int BOOL in EBX
|
||||
;; Builds stack frames before and tears them down after function calls
|
||||
;; Uses ECX for char* S, EDX for int BOOL, ESI for PASSED
|
||||
:function_call
|
||||
|
@ -3149,7 +3149,7 @@ LOAD_INTEGER
|
|||
|
||||
|
||||
;; variable_load function
|
||||
;; Recieves struct token_list* A in EAX
|
||||
;; Receives struct token_list* A in EAX
|
||||
;; Returns nothing
|
||||
;; Updates output and current_target
|
||||
;; Uses ECX for A
|
||||
|
@ -3218,7 +3218,7 @@ LOAD_INTEGER
|
|||
|
||||
|
||||
;; function_load function
|
||||
;; Recieves struct token_list* a in EAX
|
||||
;; Receives struct token_list* a in EAX
|
||||
;; Returns nothing
|
||||
;; Uses ECX to hold A->S
|
||||
:function_load
|
||||
|
@ -3260,7 +3260,7 @@ LOAD_INTEGER
|
|||
|
||||
|
||||
;; global_load function
|
||||
;; Recieves struct token_list* A in EAX
|
||||
;; Receives struct token_list* A in EAX
|
||||
;; Returns nothing
|
||||
;; Uses EBX to hold A->S
|
||||
:global_load
|
||||
|
@ -3303,7 +3303,7 @@ LOAD_INTEGER
|
|||
|
||||
|
||||
;; sym_lookup function
|
||||
;; Recieves char* S in EAX and struct token_list* symbol_list in EBX
|
||||
;; Receives char* S in EAX and struct token_list* symbol_list in EBX
|
||||
;; Uses I->S in EAX, S in EBX and I in ECX
|
||||
;; Returns match or NULL
|
||||
:sym_lookup
|
||||
|
@ -3331,7 +3331,7 @@ LOAD_INTEGER
|
|||
|
||||
|
||||
;; 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
|
||||
|
@ -3356,7 +3356,7 @@ LOAD_INTEGER
|
|||
|
||||
|
||||
;; primary_expr_string function
|
||||
;; recieves nothing
|
||||
;; receives nothing
|
||||
;; Returns nothing
|
||||
;; creates entries for string and calls to generate string output
|
||||
;; uses ECX for char* number_string
|
||||
|
@ -3410,7 +3410,7 @@ LOAD_INTEGER
|
|||
|
||||
|
||||
;; primary_expr_char function
|
||||
;; Recieves nothing
|
||||
;; Receives nothing
|
||||
;; Returns nothing
|
||||
;; Updates output_list using global_token
|
||||
:primary_expr_char
|
||||
|
@ -3442,14 +3442,14 @@ LOAD_INTEGER
|
|||
|
||||
|
||||
;; primary_expr_failure function
|
||||
;; Recieves nothing
|
||||
;; Receives nothing
|
||||
;; Does not return but aborts hard
|
||||
;; Complains about the bad input
|
||||
:primary_expr_failure
|
||||
; CALL32 %line_error ; Get line of issue
|
||||
LOADI32_EAX %2 ; Using Standard error
|
||||
STORE32_Absolute32_eax &Output_file ; write to standard error
|
||||
LOADI32_EAX &primary_expr_failure_string_0 ; Using "Recieved "
|
||||
LOADI32_EAX &primary_expr_failure_string_0 ; Using "Received "
|
||||
CALL32 %File_Print ; Print it
|
||||
|
||||
LOAD32_Absolute32_eax &global_token ; Using global_token
|
||||
|
@ -3460,13 +3460,13 @@ LOAD_INTEGER
|
|||
CALL32 %File_Print ; Print it
|
||||
JMP32 %Exit_Failure ; Abort Hard
|
||||
|
||||
:primary_expr_failure_string_0 "Recieved "
|
||||
:primary_expr_failure_string_0 "Received "
|
||||
:primary_expr_failure_string_1 " in primary_expr
|
||||
"
|
||||
|
||||
|
||||
;; general_recursion function
|
||||
;; Recieves FUNCTION F in EAX, char* S in EBX, char* name in ECX and FUNCTION iterate in EDX
|
||||
;; Receives FUNCTION F in EAX, char* S in EBX, char* name in ECX and FUNCTION iterate in EDX
|
||||
;; Returns nothing
|
||||
;; Uses ECX for char* S, EDX for FUNCTION iterate and EBP for FUNCTION F
|
||||
;; But generally recurses a shitload
|
||||
|
@ -3504,7 +3504,7 @@ LOAD_INTEGER
|
|||
|
||||
|
||||
;; promote_type function
|
||||
;; Recieves struct type* a in EAX and struct type* b in EBX
|
||||
;; Receives struct type* a in EAX and struct type* b in EBX
|
||||
;; Returns the most recent type in EAX
|
||||
;; Uses EAX for struct type* I, ECX for struct type* A and EDX for struct type* B
|
||||
:promote_type
|
||||
|
@ -3555,7 +3555,7 @@ LOAD_INTEGER
|
|||
|
||||
|
||||
;; common_recursion function
|
||||
;; Recieves FUNCTION F in EAX
|
||||
;; Receives FUNCTION F in EAX
|
||||
;; Returns Nothing
|
||||
;; Walks global_token list and update output_list
|
||||
;; Updates current_target
|
||||
|
@ -3589,7 +3589,7 @@ LOAD_INTEGER
|
|||
|
||||
|
||||
;; require_match function
|
||||
;; Recieves char* message in EAX and char* required in EBX
|
||||
;; Receives char* message in EAX and char* required in EBX
|
||||
;; Returns nothing
|
||||
;; Uses ECX to hold message and updates global_token
|
||||
:require_match
|
||||
|
@ -3620,7 +3620,7 @@ LOAD_INTEGER
|
|||
|
||||
|
||||
;; uniqueID Function
|
||||
;; Recieves char*S in EAX, struct token_list* l in EBX snd char* num in ECX
|
||||
;; Receives char*S in EAX, struct token_list* l in EBX snd char* num in ECX
|
||||
;; Returns updated struct token_list* L in EAX
|
||||
:uniqueID
|
||||
PUSH_EBX ; Protect EBX
|
||||
|
@ -3644,7 +3644,7 @@ LOAD_INTEGER
|
|||
|
||||
|
||||
;; uniqueID_out function
|
||||
;; Recieves char* S in EAX and char* num in EBX
|
||||
;; Receives char* S in EAX and char* num in EBX
|
||||
;; Returns nothing
|
||||
:uniqueID_out
|
||||
PUSH_EAX ; Protect EAX
|
||||
|
@ -3661,7 +3661,7 @@ LOAD_INTEGER
|
|||
|
||||
|
||||
;; emit_out function
|
||||
;; Recieves char* S in EAX
|
||||
;; Receives char* S in EAX
|
||||
;; Returns nothing
|
||||
;; Updates output_list
|
||||
;; MUST NOT ALTER REGISTERS
|
||||
|
@ -3677,7 +3677,7 @@ LOAD_INTEGER
|
|||
|
||||
|
||||
;; emit function
|
||||
;; Recieves char *s in EAX and struct token_list* head in EBX
|
||||
;; Receives char *s in EAX and struct token_list* head in EBX
|
||||
;; Returns struct token_list* T in EAX
|
||||
:emit
|
||||
PUSH_ECX ; Protect ECX
|
||||
|
@ -3691,9 +3691,9 @@ LOAD_INTEGER
|
|||
|
||||
|
||||
;; escape_lookup function
|
||||
;; Recieves char* c in EAX
|
||||
;; Receives char* c in EAX
|
||||
;; Returns integer value of char in EAX
|
||||
;; Aborts hard if unknown escape is recieved
|
||||
;; Aborts hard if unknown escape is received
|
||||
;; Uses ECX to hold char* C
|
||||
:escape_lookup
|
||||
PUSH_EBX ; Protect EBX
|
||||
|
@ -3737,7 +3737,7 @@ LOAD_INTEGER
|
|||
;; Aborting hard
|
||||
LOADI32_EAX %2 ; Using Standard error
|
||||
STORE32_Absolute32_eax &Output_file ; write to standard error
|
||||
LOADI32_EAX &escape_lookup_string_0 ; Using "Unknown escape recieved: "
|
||||
LOADI32_EAX &escape_lookup_string_0 ; Using "Unknown escape received: "
|
||||
CALL32 %File_Print ; Print it
|
||||
COPY_ECX_to_EAX ; Using C
|
||||
CALL32 %File_Print ; Print it
|
||||
|
@ -3765,13 +3765,13 @@ LOAD_INTEGER
|
|||
ADD_ebx_into_eax ; hex(c[2]) << 4 + hex(c[3])
|
||||
JMP32 %escape_lookup_done ; Be done
|
||||
|
||||
:escape_lookup_string_0 "Unknown escape recieved: "
|
||||
:escape_lookup_string_0 "Unknown escape received: "
|
||||
:escape_lookup_string_1 " Unable to process
|
||||
"
|
||||
|
||||
|
||||
;; char2hex function
|
||||
;; Recieves char in EAX
|
||||
;; Receives char in EAX
|
||||
;; Returns hex or aborts hard
|
||||
:char2hex
|
||||
SUBI8_EAX !48 ; Try 0-9
|
||||
|
@ -3802,7 +3802,7 @@ LOAD_INTEGER
|
|||
|
||||
|
||||
;; parse_string function
|
||||
;; Recieves char* string in EAX
|
||||
;; Receives char* string in EAX
|
||||
;; Returns cleaned up string
|
||||
;; Protects char* string in EBX
|
||||
:parse_string
|
||||
|
@ -3827,7 +3827,7 @@ LOAD_INTEGER
|
|||
|
||||
|
||||
;; weird function
|
||||
;; Recieves char* string in EAX
|
||||
;; Receives char* string in EAX
|
||||
;; Returns true(0) or false(1) in EAX
|
||||
;; Uses ECX to hold char* string
|
||||
:weird
|
||||
|
@ -3898,7 +3898,7 @@ LOAD_INTEGER
|
|||
|
||||
|
||||
;; collect_regular_string function
|
||||
;; Recieves char* string in EAX
|
||||
;; Receives char* string in EAX
|
||||
;; Malloc and creates new string to return in EAX
|
||||
;; Uses ECX for return string and EDX for passed string
|
||||
:collect_regular_string
|
||||
|
@ -3954,7 +3954,7 @@ LOAD_INTEGER
|
|||
|
||||
|
||||
;; collect_weird_string function
|
||||
;; Recieves char* string in EAX
|
||||
;; Receives char* string in EAX
|
||||
;; Mallocs and returns char* hold in EAX
|
||||
;; Uses ECX for char* hold and EDX for char* string
|
||||
:collect_weird_string
|
||||
|
@ -4022,7 +4022,7 @@ LOAD_INTEGER
|
|||
|
||||
|
||||
;; HEX to ascii routine
|
||||
;; Recieves INT in EAX and CHAR* in ECX
|
||||
;; Receives INT in EAX and CHAR* in ECX
|
||||
;; Stores ascii of INT in CHAR*
|
||||
;; Returns only modifying EAX and ECX
|
||||
:hex8
|
||||
|
@ -4043,7 +4043,7 @@ LOAD_INTEGER
|
|||
|
||||
|
||||
;; type_name function
|
||||
;; Recieves nothing
|
||||
;; Receives nothing
|
||||
;; Returns type_size in EAX
|
||||
;; Uses ECX for STRUCT TYPE* RET
|
||||
:type_name
|
||||
|
@ -4131,7 +4131,7 @@ LOAD_INTEGER
|
|||
|
||||
|
||||
;; lookup_type function
|
||||
;; Recieves char* s in EAX and struct type* start in EBX
|
||||
;; Receives char* s in EAX and struct type* start in EBX
|
||||
;; Returns struct type* in EAX
|
||||
;; Uses EBX for S and ECX for I
|
||||
:lookup_type
|
||||
|
@ -4159,7 +4159,7 @@ LOAD_INTEGER
|
|||
|
||||
|
||||
;; create_struct function
|
||||
;; Recieves nothing
|
||||
;; Receives nothing
|
||||
;; Returns nothing
|
||||
;; Uses global_token to malloc a struct's definition
|
||||
;; Uses ECX for int OFFSET, EDX for struct type* head, EBP for struct type* I,
|
||||
|
@ -4280,7 +4280,7 @@ LOAD_INTEGER
|
|||
|
||||
|
||||
;; lookup_member function
|
||||
;; Recieves struct type* parent in EAX and char* name in EBX
|
||||
;; Receives struct type* parent in EAX and char* name in EBX
|
||||
;; Returns struct type* I in EAX
|
||||
;; Uses char* NAME in EBX, ECX for struct type* I and EDX to hold parent for errors
|
||||
;; Aborts hard if not found
|
||||
|
@ -4340,7 +4340,7 @@ LOAD_INTEGER
|
|||
|
||||
|
||||
;; build_member function
|
||||
;; Recieves struct type* last in EAX, int offset in EBX and global member_size in EDI
|
||||
;; Receives struct type* last in EAX, int offset in EBX and global member_size in EDI
|
||||
;; Updates member_size in EDI and returns struct type* I in EAX
|
||||
;; Uses ECX for struct type* member_type and EDX for struct type* I
|
||||
:build_member
|
||||
|
@ -4410,7 +4410,7 @@ LOAD_INTEGER
|
|||
|
||||
|
||||
;; build_union function
|
||||
;; Recieves struct type* last in EAX, int offset in EBX and global member_size in EDI
|
||||
;; Receives struct type* last in EAX, int offset in EBX and global member_size in EDI
|
||||
;; Updates member_size in EDI and returns struct type* LAST in EAX
|
||||
;; Uses ECX for struct type* last, EDX for int offset, ESI for int size and EDI for int member_size
|
||||
:build_union
|
||||
|
@ -4480,7 +4480,7 @@ Missing ;
|
|||
|
||||
|
||||
;; sym_declare function
|
||||
;; Recieves char *s in EAX, struct type* t in EBX, and struct token_list* list in ECX
|
||||
;; Receives char *s in EAX, struct type* t in EBX, and struct token_list* list in ECX
|
||||
;; Returns struct token_list* in EAX
|
||||
;; Uses EAX for A
|
||||
:sym_declare
|
||||
|
@ -4496,7 +4496,7 @@ Missing ;
|
|||
|
||||
|
||||
;; match function
|
||||
;; Recieves CHAR* in EAX and CHAR* in EBX
|
||||
;; Receives CHAR* in EAX and CHAR* in EBX
|
||||
;; Returns 0 (TRUE) or 1 (FALSE) in EAX
|
||||
:match
|
||||
PUSH_EBX ; Protect EBX
|
||||
|
@ -4528,7 +4528,7 @@ Missing ;
|
|||
|
||||
|
||||
;; numerate_number function
|
||||
;; Recieves an INT A in EAX
|
||||
;; Receives an INT A in EAX
|
||||
;; Returns char* result in EAX
|
||||
;; Allocates 16 bytes of memory
|
||||
;; Behaves badly when given a negative number too large
|
||||
|
@ -4608,7 +4608,7 @@ Missing ;
|
|||
|
||||
|
||||
;; numerate_string function
|
||||
;; Recieves CHAR* in EAX
|
||||
;; Receives CHAR* in EAX
|
||||
;; Returns value of CHAR* in EAX
|
||||
;; Uses EAX for VALUE, EBX for S, ECX for CH and ESI for NEGATIVE?
|
||||
:numerate_string
|
||||
|
@ -4691,7 +4691,7 @@ Missing ;
|
|||
|
||||
|
||||
;; Exit_Failure function
|
||||
;; Recieves nothing
|
||||
;; Receives nothing
|
||||
;; And aborts hard
|
||||
;; Does NOT return
|
||||
:Exit_Failure
|
||||
|
@ -4837,7 +4837,7 @@ Missing ;
|
|||
|
||||
|
||||
;; debug_list function
|
||||
;; Recieves struct token_list* in EAX
|
||||
;; Receives struct token_list* in EAX
|
||||
;; Prints contents of list and exits
|
||||
;; Does NOT return
|
||||
:debug_list
|
||||
|
|
|
@ -94,7 +94,7 @@ header_string2: db 10, ":ELF_data", 10, 10, "# Program global variables", 10, 0
|
|||
header_string3: db 10, "# Program strings", 10, 0
|
||||
|
||||
;; read_all_tokens function
|
||||
;; Recieves Token_List* in EAX
|
||||
;; Receives Token_List* in EAX
|
||||
;; Tokenizes all input and returns updated list in EAX
|
||||
;; Returns TOKEN in EAX
|
||||
;; Uses EAX for C
|
||||
|
@ -112,7 +112,7 @@ read_all_tokens_done:
|
|||
|
||||
|
||||
;; get_token function
|
||||
;; Recieves INT in EAX
|
||||
;; Receives INT in EAX
|
||||
;; Makes a list of TOKEN_LIST
|
||||
;; C and STRING_INDEX are stored in memory, ECX is used for S and EDX is used for current
|
||||
;; Returns C in EAX
|
||||
|
@ -275,7 +275,7 @@ malloc:
|
|||
|
||||
|
||||
;; clear_white_space function
|
||||
;; Recieves INT C in EAX
|
||||
;; Receives INT C in EAX
|
||||
;; Returns first non-whitespace char in EAX
|
||||
clear_white_space:
|
||||
cmp eax, 32 ; Check for ' '
|
||||
|
@ -298,7 +298,7 @@ clear_white_space_done:
|
|||
|
||||
|
||||
;; In_Set function
|
||||
;; Recieves Char C in EAX and CHAR* in EBX
|
||||
;; Receives Char C in EAX and CHAR* in EBX
|
||||
;; Returns 1 if true, zero if false in EAX
|
||||
In_Set:
|
||||
push ebx ; Protect EBX
|
||||
|
@ -334,7 +334,7 @@ strings: db 34, 39, 0
|
|||
|
||||
|
||||
;; purge_macro function
|
||||
;; Recieves CH in EAX
|
||||
;; Receives CH in EAX
|
||||
;; Reads chars until Line feed is read
|
||||
;; returns line feed
|
||||
purge_macro:
|
||||
|
@ -345,7 +345,7 @@ purge_macro:
|
|||
|
||||
|
||||
;; preserve_keyword function
|
||||
;; Recieves INT C in EAX
|
||||
;; Receives INT C in EAX
|
||||
;; collects all chars in keyword
|
||||
;; Returns C in EAX
|
||||
;; Uses ECX for INT C
|
||||
|
@ -380,7 +380,7 @@ preserve_keyword_done:
|
|||
|
||||
|
||||
;; preserve_symbol function
|
||||
;; Recieves INT C in EAX
|
||||
;; Receives INT C in EAX
|
||||
;; collects all chars in symbol
|
||||
;; Returns C in EAX
|
||||
;; Uses ECX for INT C
|
||||
|
@ -407,7 +407,7 @@ preserve_symbol_done:
|
|||
|
||||
|
||||
;; consume_word function
|
||||
;; recieves INT C in EAX
|
||||
;; receives INT C in EAX
|
||||
;; returns INT C in EAX
|
||||
;; Uses EAX for C, EBX for FREQ and ECX for ESCAPE
|
||||
consume_word:
|
||||
|
@ -444,7 +444,7 @@ consume_word_iter:
|
|||
|
||||
|
||||
;; consume_byte function
|
||||
;; Recieves INT C in EAX
|
||||
;; Receives INT C in EAX
|
||||
;; Inserts C into string S, updates String S
|
||||
;; Returns Next char in EAX
|
||||
consume_byte:
|
||||
|
@ -459,7 +459,7 @@ consume_byte:
|
|||
|
||||
|
||||
;; fixup_label function
|
||||
;; Recieves S in ECX
|
||||
;; Receives S in ECX
|
||||
;; prepends ':' to string and returns registers un changed
|
||||
;; Uses EAX for HOLD, EBX for PREV and ECX for S[0]
|
||||
fixup_label:
|
||||
|
@ -509,7 +509,7 @@ fgetc_done:
|
|||
|
||||
|
||||
;; Reverse_List function
|
||||
;; Recieves List in EAX
|
||||
;; Receives List in EAX
|
||||
;; Returns the list reversed in EAX
|
||||
Reverse_List:
|
||||
push ebx ; Protect EBX
|
||||
|
@ -533,7 +533,7 @@ Reverse_List_Done:
|
|||
|
||||
|
||||
;; recursive_output function
|
||||
;; Recieves list in EAX
|
||||
;; Receives list in EAX
|
||||
;; walks the list and prints the I->S for all nodes backwards
|
||||
;; Uses EBX for I
|
||||
recursive_output:
|
||||
|
@ -556,7 +556,7 @@ recursive_output_done:
|
|||
|
||||
|
||||
;; File_Print function
|
||||
;; Recieves CHAR* in EAX
|
||||
;; Receives CHAR* in EAX
|
||||
;; calls fputc for every non-null char
|
||||
File_Print:
|
||||
push ebx ; Protect EBX
|
||||
|
@ -581,7 +581,7 @@ File_Print_Done:
|
|||
|
||||
|
||||
;; fputc function
|
||||
;; recieves CHAR in EAX and load FILE* from [OUTPUT_FILE]
|
||||
;; receives CHAR in EAX and load FILE* from [OUTPUT_FILE]
|
||||
;; writes char and returns
|
||||
fputc:
|
||||
push ebx ; Protect EBX
|
||||
|
@ -601,7 +601,7 @@ fputc:
|
|||
|
||||
|
||||
;; program function
|
||||
;; recieves nothing, returns nothing
|
||||
;; receives nothing, returns nothing
|
||||
;; Uses EAX for type_size
|
||||
program:
|
||||
;; The binary initialized the globals to null, so we can skip those steps
|
||||
|
@ -708,7 +708,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 ebx ; Protect EBX
|
||||
|
@ -784,7 +784,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 ECX, then replace with struct token_list* a in ECX when type_size is used
|
||||
|
@ -880,7 +880,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:
|
||||
|
@ -1071,7 +1071,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 ECX
|
||||
|
@ -1136,7 +1136,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
|
||||
|
@ -1184,7 +1184,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 ECX for struct token_list* A
|
||||
|
@ -1316,7 +1316,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 EBX for global_token temp storage
|
||||
|
@ -1368,7 +1368,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 ECX for char* NUMBER_STRING
|
||||
|
@ -1502,7 +1502,7 @@ restore_break_frame:
|
|||
|
||||
|
||||
;; set_break_frame microfunction
|
||||
;; Recieves char* head in EAX and char* num in EBX
|
||||
;; Receives char* head in EAX and char* num in EBX
|
||||
;; Overwrites EAX and EBX
|
||||
;; Returns to calling function
|
||||
set_break_frame:
|
||||
|
@ -1517,7 +1517,7 @@ set_break_frame:
|
|||
|
||||
|
||||
;; process_do function
|
||||
;; Recieves Nothing
|
||||
;; Receives Nothing
|
||||
;; Returns Nothing
|
||||
;; Increments current_count and leverages save/restore_break_frame pieces
|
||||
;; Uses ECX for char* NUMBER_STRING
|
||||
|
@ -1601,7 +1601,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 ECX for char* NUMBER_STRING
|
||||
|
@ -1692,7 +1692,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 ECX for char* NUMBER_STRING
|
||||
|
@ -1840,7 +1840,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 EBX for struct token_list* break_frame and ECX for struct token_list* I
|
||||
|
@ -1918,7 +1918,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 EAX and EBX for match and ECX for char* store
|
||||
|
@ -1974,7 +1974,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
|
||||
|
@ -1985,7 +1985,7 @@ bitwise_expr:
|
|||
|
||||
|
||||
;; bitwise_expr_stub function
|
||||
;; Recieves nothing
|
||||
;; Receives nothing
|
||||
;; Returns Nothing
|
||||
;; Just calls general_recursion a bunch
|
||||
;; Uses EAX, EBX, ECX and EDX for passing constants to general recursion
|
||||
|
@ -2035,7 +2035,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
|
||||
|
@ -2046,7 +2046,7 @@ relational_expr:
|
|||
|
||||
|
||||
;; relational_expr_stub function
|
||||
;; Recieves nothing
|
||||
;; Receives nothing
|
||||
;; Returns Nothing
|
||||
;; Just calls general_recursion a bunch
|
||||
;; Uses EAX, EBX, ECX and EDX for passing constants to general recursion
|
||||
|
@ -2105,7 +2105,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
|
||||
|
@ -2116,7 +2116,7 @@ additive_expr:
|
|||
|
||||
|
||||
;; additive_expr_stub function
|
||||
;; Recieves nothing
|
||||
;; Receives nothing
|
||||
;; Returns Nothing
|
||||
;; Just calls general_recursion a bunch
|
||||
;; Uses EAX, EBX, ECX and EDX for passing constants to general recursion
|
||||
|
@ -2182,7 +2182,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
|
||||
|
@ -2193,7 +2193,7 @@ postfix_expr:
|
|||
|
||||
|
||||
;; postfix_expr_stub function
|
||||
;; Recieves nothing
|
||||
;; Receives nothing
|
||||
;; Returns Nothing
|
||||
;; Checks for "[" and "->" and deals with them otherwise does nothing
|
||||
;; Uses EAX, EBX, ECX and EDX for passing constants to general recursion
|
||||
|
@ -2226,7 +2226,7 @@ postfix_expr_stub_done:
|
|||
|
||||
|
||||
;; unary_expr_sizeof function
|
||||
;; Recieves nothing
|
||||
;; Receives nothing
|
||||
;; Returns nothing
|
||||
;; Uses ECX for A->SIZE
|
||||
unary_expr_sizeof:
|
||||
|
@ -2268,7 +2268,7 @@ unary_expr_sizeof_string_3: db 10, 0
|
|||
|
||||
|
||||
;; postfix_expr_array function
|
||||
;; Recieves Nothing
|
||||
;; Receives Nothing
|
||||
;; Returns Nothing
|
||||
;; Uses EBX for struct type* ARRAY and ECX for char* ASSIGN
|
||||
postfix_expr_array:
|
||||
|
@ -2346,7 +2346,7 @@ postfix_expr_array_string_6: db 0
|
|||
|
||||
|
||||
;; ceil_log2 function
|
||||
;; Recieves int a in EAX
|
||||
;; Receives int a in EAX
|
||||
;; Performs log2 on A and
|
||||
;; Returns result in EAX
|
||||
;; Uses EBX for INT A and ECX for INT RESULT
|
||||
|
@ -2379,7 +2379,7 @@ ceil_log2_done:
|
|||
|
||||
|
||||
;; postfix_expr_arrow function
|
||||
;; Recieves nothing
|
||||
;; Receives nothing
|
||||
;; Returns nothing
|
||||
;; Emits a bunch and updates current_target
|
||||
;; Uses EBX for struct type* I
|
||||
|
@ -2447,7 +2447,7 @@ postfix_expr_arrow_string_3: db "LOAD_INTEGER", 10, 0
|
|||
|
||||
|
||||
;; primary_expr function
|
||||
;; Recieves nothing
|
||||
;; Receives nothing
|
||||
;; Returns nothing
|
||||
primary_expr:
|
||||
push ebx ; Protect EBX
|
||||
|
@ -2605,7 +2605,7 @@ primary_expr_string_7:db "0123456789", 0
|
|||
|
||||
|
||||
;; primary_expr_variable function
|
||||
;; Recieves nothing
|
||||
;; Receives nothing
|
||||
;; Returns nothing
|
||||
;; Walks global and updates output
|
||||
;; Uses EAX for struct token_list* a and ECX for char* S
|
||||
|
@ -2703,7 +2703,7 @@ primary_expr_variable_string_2: db "LOAD_IMMEDIATE_eax %", 0
|
|||
|
||||
|
||||
;; function_call function
|
||||
;; Recieves char* S in EAX and int BOOL in EBX
|
||||
;; Receives char* S in EAX and int BOOL in EBX
|
||||
;; Builds stack frames before and tears them down after function calls
|
||||
;; Uses ECX for char* S, EDX for int BOOL, ESI for PASSED
|
||||
function_call:
|
||||
|
@ -2847,7 +2847,7 @@ function_call_string_15: db "POP_edi", 9, "# Prevent overwrite", 10, 0
|
|||
|
||||
|
||||
;; variable_load function
|
||||
;; Recieves struct token_list* A in EAX
|
||||
;; Receives struct token_list* A in EAX
|
||||
;; Returns nothing
|
||||
;; Updates output and current_target
|
||||
;; Uses ECX for A
|
||||
|
@ -2914,7 +2914,7 @@ variable_load_string_2: db "LOAD_INTEGER", 10, 0
|
|||
|
||||
|
||||
;; function_load function
|
||||
;; Recieves struct token_list* a in EAX
|
||||
;; Receives struct token_list* a in EAX
|
||||
;; Returns nothing
|
||||
;; Uses ECX to hold A->S
|
||||
function_load:
|
||||
|
@ -2955,7 +2955,7 @@ function_load_string_1: db 10, 0
|
|||
|
||||
|
||||
;; global_load function
|
||||
;; Recieves struct token_list* A in EAX
|
||||
;; Receives struct token_list* A in EAX
|
||||
;; Returns nothing
|
||||
;; Uses EBX to hold A->S
|
||||
global_load:
|
||||
|
@ -2996,7 +2996,7 @@ global_load_string_2: db "LOAD_INTEGER", 10, 0
|
|||
|
||||
|
||||
;; sym_lookup function
|
||||
;; Recieves char* S in EAX and struct token_list* symbol_list in EBX
|
||||
;; Receives char* S in EAX and struct token_list* symbol_list in EBX
|
||||
;; Uses I->S in EAX, S in EBX and I in ECX
|
||||
;; Returns match or NULL
|
||||
sym_lookup:
|
||||
|
@ -3024,7 +3024,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:
|
||||
|
@ -3048,7 +3048,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 ECX for char* number_string
|
||||
|
@ -3102,7 +3102,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:
|
||||
|
@ -3133,14 +3133,14 @@ 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 eax, 2 ; Using Standard error
|
||||
mov [Output_file], eax ; write to standard error
|
||||
mov eax, primary_expr_failure_string_0 ; Using "Recieved "
|
||||
mov eax, primary_expr_failure_string_0 ; Using "Received "
|
||||
call File_Print ; Print it
|
||||
|
||||
mov eax, [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 EAX, char* S in EBX, char* name in ECX and FUNCTION iterate in EDX
|
||||
;; Receives FUNCTION F in EAX, char* S in EBX, char* name in ECX and FUNCTION iterate in EDX
|
||||
;; Returns nothing
|
||||
;; Uses ECX for char* S, EDX for FUNCTION iterate and EBP for FUNCTION F
|
||||
;; But generally recurses a shitload
|
||||
|
@ -3194,7 +3194,7 @@ general_recursion_done:
|
|||
|
||||
|
||||
;; promote_type function
|
||||
;; Recieves struct type* a in EAX and struct type* b in EBX
|
||||
;; Receives struct type* a in EAX and struct type* b in EBX
|
||||
;; Returns the most recent type in EAX
|
||||
;; Uses EAX for struct type* I, ECX for struct type* A and EDX for struct type* B
|
||||
promote_type:
|
||||
|
@ -3245,7 +3245,7 @@ promote_type_done:
|
|||
|
||||
|
||||
;; common_recursion function
|
||||
;; Recieves FUNCTION F in EAX
|
||||
;; Receives FUNCTION F in EAX
|
||||
;; 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 EAX and char* required in EBX
|
||||
;; Receives char* message in EAX and char* required in EBX
|
||||
;; Returns nothing
|
||||
;; Uses ECX to hold message and updates global_token
|
||||
require_match:
|
||||
|
@ -3308,7 +3308,7 @@ require_match_good:
|
|||
|
||||
|
||||
;; uniqueID Function
|
||||
;; Recieves char*S in EAX, struct token_list* l in EBX snd char* num in ECX
|
||||
;; Receives char*S in EAX, struct token_list* l in EBX snd char* num in ECX
|
||||
;; Returns updated struct token_list* L in EAX
|
||||
uniqueID:
|
||||
push ebx ; Protect EBX
|
||||
|
@ -3331,7 +3331,7 @@ uniqueID_string_0: db 10, 0
|
|||
|
||||
|
||||
;; uniqueID_out function
|
||||
;; Recieves char* S in EAX and char* num in EBX
|
||||
;; Receives char* S in EAX and char* num in EBX
|
||||
;; Returns nothing
|
||||
uniqueID_out:
|
||||
push eax ; Protect EAX
|
||||
|
@ -3348,7 +3348,7 @@ uniqueID_out:
|
|||
|
||||
|
||||
;; emit_out function
|
||||
;; Recieves char* S in EAX
|
||||
;; Receives char* S in EAX
|
||||
;; Returns nothing
|
||||
;; Updates output_list
|
||||
;; MUST NOT ALTER REGISTERS
|
||||
|
@ -3364,7 +3364,7 @@ emit_out:
|
|||
|
||||
|
||||
;; emit function
|
||||
;; Recieves char *s in EAX and struct token_list* head in EBX
|
||||
;; Receives char *s in EAX and struct token_list* head in EBX
|
||||
;; Returns struct token_list* T in EAX
|
||||
emit:
|
||||
push ecx ; Protect ECX
|
||||
|
@ -3378,9 +3378,9 @@ emit:
|
|||
|
||||
|
||||
;; escape_lookup function
|
||||
;; Recieves char* c in EAX
|
||||
;; Receives char* c in EAX
|
||||
;; Returns integer value of char in EAX
|
||||
;; Aborts hard if unknown escape is recieved
|
||||
;; Aborts hard if unknown escape is received
|
||||
;; Uses ECX to hold char* C
|
||||
escape_lookup:
|
||||
push ebx ; Protect EBX
|
||||
|
@ -3424,7 +3424,7 @@ escape_lookup:
|
|||
;; Aborting hard
|
||||
mov eax, 2 ; Using Standard error
|
||||
mov [Output_file], eax ; write to standard error
|
||||
mov eax, escape_lookup_string_0 ; Using "Unknown escape recieved: "
|
||||
mov eax, escape_lookup_string_0 ; Using "Unknown escape received: "
|
||||
call File_Print ; Print it
|
||||
mov eax, ecx ; Using C
|
||||
call File_Print ; Print it
|
||||
|
@ -3452,12 +3452,12 @@ escape_lookup_hex:
|
|||
add eax, ebx ; 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 EAX
|
||||
;; Receives char in EAX
|
||||
;; Returns hex or aborts hard
|
||||
char2hex:
|
||||
sub eax, 48 ; Try 0-9
|
||||
|
@ -3487,7 +3487,7 @@ char2hex_string_0: db "Tried to print non-hex number", 10, 0
|
|||
|
||||
|
||||
;; parse_string function
|
||||
;; Recieves char* string in EAX
|
||||
;; Receives char* string in EAX
|
||||
;; Returns cleaned up string
|
||||
;; Protects char* string in EBX
|
||||
parse_string:
|
||||
|
@ -3512,7 +3512,7 @@ parse_string_done:
|
|||
|
||||
|
||||
;; weird function
|
||||
;; Recieves char* string in EAX
|
||||
;; Receives char* string in EAX
|
||||
;; Returns true(0) or false(1) in EAX
|
||||
;; Uses ECX to hold char* string
|
||||
weird:
|
||||
|
@ -3582,7 +3582,7 @@ weird_string_1: db 9, 10, 13, 32, 0
|
|||
|
||||
|
||||
;; collect_regular_string function
|
||||
;; Recieves char* string in EAX
|
||||
;; Receives char* string in EAX
|
||||
;; Malloc and creates new string to return in EAX
|
||||
;; Uses ECX for return string and EDX for passed string
|
||||
collect_regular_string:
|
||||
|
@ -3638,7 +3638,7 @@ collect_regular_string_done:
|
|||
|
||||
|
||||
;; collect_weird_string function
|
||||
;; Recieves char* string in EAX
|
||||
;; Receives char* string in EAX
|
||||
;; Mallocs and returns char* hold in EAX
|
||||
;; Uses ECX for char* hold and EDX for char* string
|
||||
collect_weird_string:
|
||||
|
@ -3706,7 +3706,7 @@ collect_weird_string_done:
|
|||
|
||||
|
||||
;; HEX to ascii routine
|
||||
;; Recieves INT in EAX and CHAR* in ECX
|
||||
;; Receives INT in EAX and CHAR* in ECX
|
||||
;; Stores ascii of INT in CHAR*
|
||||
;; Returns only modifying EAX and ECX
|
||||
hex8:
|
||||
|
@ -3727,7 +3727,7 @@ hex1:
|
|||
|
||||
|
||||
;; type_name function
|
||||
;; Recieves nothing
|
||||
;; Receives nothing
|
||||
;; Returns type_size in EAX
|
||||
;; Uses ECX for STRUCT TYPE* RET
|
||||
type_name:
|
||||
|
@ -3814,7 +3814,7 @@ type_name_string_1: db 10, 0
|
|||
|
||||
|
||||
;; lookup_type function
|
||||
;; Recieves char* s in EAX and struct type* start in EBX
|
||||
;; Receives char* s in EAX and struct type* start in EBX
|
||||
;; Returns struct type* in EAX
|
||||
;; Uses EBX for S and ECX for I
|
||||
lookup_type:
|
||||
|
@ -3842,7 +3842,7 @@ lookup_type_done:
|
|||
|
||||
|
||||
;; create_struct function
|
||||
;; Recieves nothing
|
||||
;; Receives nothing
|
||||
;; Returns nothing
|
||||
;; Uses global_token to malloc a struct's definition
|
||||
;; Uses ECX for int OFFSET, EDX for struct type* head, EBP for struct type* I,
|
||||
|
@ -3959,7 +3959,7 @@ create_struct_string_1: db "ERROR in create_struct", 10, " Missing ;", 10, 0
|
|||
|
||||
|
||||
;; lookup_member function
|
||||
;; Recieves struct type* parent in EAX and char* name in EBX
|
||||
;; Receives struct type* parent in EAX and char* name in EBX
|
||||
;; Returns struct type* I in EAX
|
||||
;; Uses char* NAME in EBX, ECX for struct type* I and EDX to hold parent for errors
|
||||
;; Aborts hard if not found
|
||||
|
@ -4017,7 +4017,7 @@ lookup_member_string_2: db 10, 0
|
|||
|
||||
|
||||
;; build_member function
|
||||
;; Recieves struct type* last in EAX, int offset in EBX and global member_size in EDI
|
||||
;; Receives struct type* last in EAX, int offset in EBX and global member_size in EDI
|
||||
;; Updates member_size in EDI and returns struct type* I in EAX
|
||||
;; Uses ECX for struct type* member_type and EDX for struct type* I
|
||||
build_member:
|
||||
|
@ -4086,7 +4086,7 @@ build_member_string_0: db "Struct only supports [num] form", 10, 0
|
|||
|
||||
|
||||
;; build_union function
|
||||
;; Recieves struct type* last in EAX, int offset in EBX and global member_size in EDI
|
||||
;; Receives struct type* last in EAX, int offset in EBX and global member_size in EDI
|
||||
;; Updates member_size in EDI and returns struct type* LAST in EAX
|
||||
;; Uses ECX for struct type* last, EDX for int offset, ESI for int size and EDI for int member_size
|
||||
build_union:
|
||||
|
@ -4152,7 +4152,7 @@ build_union_string_1: db "ERROR in build_union", 10, "Missing ;", 10, 0
|
|||
|
||||
|
||||
;; sym_declare function
|
||||
;; Recieves char *s in EAX, struct type* t in EBX, and struct token_list* list in ECX
|
||||
;; Receives char *s in EAX, struct type* t in EBX, and struct token_list* list in ECX
|
||||
;; Returns struct token_list* in EAX
|
||||
;; Uses EAX for A
|
||||
sym_declare:
|
||||
|
@ -4168,7 +4168,7 @@ sym_declare:
|
|||
|
||||
|
||||
;; match function
|
||||
;; Recieves CHAR* in EAX and CHAR* in EBX
|
||||
;; Receives CHAR* in EAX and CHAR* in EBX
|
||||
;; Returns 0 (TRUE) or 1 (FALSE) in EAX
|
||||
match:
|
||||
push ebx ; Protect EBX
|
||||
|
@ -4200,7 +4200,7 @@ match_Done:
|
|||
|
||||
|
||||
;; numerate_number function
|
||||
;; Recieves an INT A in EAX
|
||||
;; Receives an INT A in EAX
|
||||
;; Returns char* result in EAX
|
||||
;; Allocates 16 bytes of memory
|
||||
;; Behaves badly when given a negative number too large
|
||||
|
@ -4280,7 +4280,7 @@ numerate_number_ZERO:
|
|||
|
||||
|
||||
;; numerate_string function
|
||||
;; Recieves CHAR* in EAX
|
||||
;; Receives CHAR* in EAX
|
||||
;; Returns value of CHAR* in EAX
|
||||
;; Uses EAX for VALUE, EBX for S, ECX for CH and ESI for NEGATIVE?
|
||||
numerate_string:
|
||||
|
@ -4363,7 +4363,7 @@ numerate_string_done:
|
|||
|
||||
|
||||
;; Exit_Failure function
|
||||
;; Recieves nothing
|
||||
;; Receives nothing
|
||||
;; And aborts hard
|
||||
;; Does NOT return
|
||||
Exit_Failure:
|
||||
|
@ -4510,7 +4510,7 @@ type_unsigned_name: db "unsigned", 0
|
|||
|
||||
|
||||
;; debug_list function
|
||||
;; Recieves struct token_list* in EAX
|
||||
;; Receives struct token_list* in EAX
|
||||
;; Prints contents of list and exits
|
||||
;; Does NOT return
|
||||
debug_list:
|
||||
|
|
|
@ -471,7 +471,7 @@ DEFINE TEST 85C0
|
|||
POP_ESI ; Restore esi
|
||||
RET
|
||||
|
||||
;; Recieves pointer in EBX
|
||||
;; Receives pointer in EBX
|
||||
;; Writes out char and updates EBX
|
||||
:consume_token
|
||||
CALL32 %Read_byte ; Consume_token
|
||||
|
|
|
@ -400,7 +400,7 @@ print_chars:
|
|||
pop esi ; Restore esi
|
||||
ret
|
||||
|
||||
;; Recieves pointer in EBX
|
||||
;; Receives pointer in EBX
|
||||
;; Writes out char and updates EBX
|
||||
consume_token:
|
||||
call Read_byte ; Consume_token
|
||||
|
|
|
@ -443,7 +443,7 @@
|
|||
5E ; POP_ESI ; Restore esi
|
||||
C3 ; RET
|
||||
|
||||
;; Recieves pointer in EBX
|
||||
;; Receives pointer in EBX
|
||||
;; Writes out char and updates EBX
|
||||
:B #:consume_token
|
||||
E8 %y ; CALL32 %Read_byte ; Consume_token
|
||||
|
|
|
@ -398,7 +398,7 @@
|
|||
5E ; POP_ESI ; Restore esi
|
||||
C3 ; RET
|
||||
|
||||
;; Recieves pointer in EBX
|
||||
;; Receives pointer in EBX
|
||||
;; Writes out char and updates EBX
|
||||
:consume_token
|
||||
E8 %Read_byte ; CALL32 %Read_byte ; Consume_token
|
||||
|
|
|
@ -152,7 +152,7 @@ Then we use our M0 Line macro assembler to convert our assembly into hex2 format
|
|||
Then we need to assemble that hex into our desired program:
|
||||
./bin/vm --rom roms/stage1_assembler-2 --tape_01 temp2 --tape_02 roms/lisp --memory 48K
|
||||
|
||||
roms/lisp should have the sha256sum of 2b80849180d5fb3757bcca2471b6337808e5b5ca80b18d93fa82ddef0435b84b
|
||||
roms/lisp should have the sha256sum of 96ade767f30e3d9037a6c597cefb103942c8ec104264a3551017f091b10646e1
|
||||
|
||||
Our lisp will first attempt to evaluate any code in tape_01 and then evaluate any code that the user types in.
|
||||
It is recommended to run with no less than 4MB of Memory
|
||||
|
@ -194,7 +194,7 @@ Then we use our M0 Line macro assembler to convert our assembly into hex2 format
|
|||
Then we need to assemble that hex into our desired program:
|
||||
./bin/vm --rom roms/stage1_assembler-2 --tape_01 cc_TEMP2 --tape_02 roms/cc_x86 --memory 48K
|
||||
|
||||
roms/cc_x86 should with the sha256sum of 12bb96de936fff18b27c2382ddcee2db6afb6a94b9f4c6e9e9b3d1d0d0d3b0ed
|
||||
roms/cc_x86 should with the sha256sum of d04462af441ec9c2d23080b654b4cc30f34cc27b09669146db02be7652ffdf81
|
||||
|
||||
Our C compiler will read any code in tape_01 and output the compiled output to tape_02.
|
||||
The compiled output is macro assembly (allowing for easy inspection) which then must go through the appropriate macro assembler and hex2 steps to become a working binary.
|
||||
|
|
|
@ -124,7 +124,7 @@ E10020100000 # STORE R1 R0 0 ; head->next = root
|
|||
|
||||
|
||||
# ;; Purge_Line_Comment Function
|
||||
# ;; Recieves char in R0 and desired input in R1
|
||||
# ;; Receives char in R0 and desired input in R1
|
||||
# ;; Modifies R0
|
||||
# ;; Returns to Tokenize_Line as if the entire line
|
||||
# ;; Comment never existed
|
||||
|
@ -136,7 +136,7 @@ E000A020000a # CMPSKIPI.E R0 10 ; Stop When LF is reached
|
|||
|
||||
|
||||
# ;; Store_String function
|
||||
# ;; Recieves Char in R0, desired input in R1
|
||||
# ;; Receives Char in R0, desired input in R1
|
||||
# ;; And node pointer in R2
|
||||
# ;; Modifies node Text to point to string and sets
|
||||
# ;; Type to string.
|
||||
|
@ -158,7 +158,7 @@ E10023020004 # STORE32 R0 R2 4 ; Set node type
|
|||
|
||||
|
||||
# ;; Store_Atom function
|
||||
# ;; Recieves Char in R0, desired input in R1
|
||||
# ;; Receives Char in R0, desired input in R1
|
||||
# ;; And node pointer in R2
|
||||
# ;; Modifies node Text to point to string
|
||||
:Store_Atom
|
||||
|
@ -185,7 +185,7 @@ E1000FEE0001 # ADDUI R14 R14 1 ; Correct Malloc
|
|||
|
||||
|
||||
# ;; strcmp function
|
||||
# ;; Recieves pointers to null terminated strings
|
||||
# ;; Receives pointers to null terminated strings
|
||||
# ;; In R0 and R1
|
||||
# ;; Returns if they are equal in R0
|
||||
# ;; Returns to whatever called it
|
||||
|
@ -266,7 +266,7 @@ E0002CA2 @Identify_Macros_0 # JUMP.NZ R2 @Identify_Macros_0 ; Loop if i not NULL
|
|||
|
||||
|
||||
# ;; Line_Macro Function
|
||||
# ;; Recieves a node pointer in R0
|
||||
# ;; Receives a node pointer in R0
|
||||
# ;; Causes macros to be applied
|
||||
# ;; Returns to whatever called it
|
||||
:Line_Macro
|
||||
|
@ -286,7 +286,7 @@ E0002CA0 @Line_Macro_0 # JUMP.NZ R0 @Line_Macro_0 ; If Next is Null Don't loop
|
|||
|
||||
|
||||
# ;; setExpression Function
|
||||
# ;; Recieves a node pointer in R0
|
||||
# ;; Receives a node pointer in R0
|
||||
# ;; A string pointer to compare against in R1
|
||||
# ;; A string pointer for replacement in R2
|
||||
# ;; Doesn't modify any registers
|
||||
|
@ -318,7 +318,7 @@ E0002CA4 @setExpression_0 # JUMP.NZ R4 @setExpression_0 ; Loop if next isn't NUL
|
|||
|
||||
|
||||
# ;; Process_String Function
|
||||
# ;; Recieves a Node in R0
|
||||
# ;; Receives a Node in R0
|
||||
# ;; Doesn't modify registers
|
||||
# ;; Returns back to whatever called it
|
||||
:Process_String
|
||||
|
@ -355,7 +355,7 @@ E0002CA0 @Process_String_0 # JUMP.NZ R0 @Process_String_0 ; If Next isn't NULL R
|
|||
|
||||
|
||||
# ;; Hexify_String Function
|
||||
# ;; Recieves a node pointer in R0
|
||||
# ;; Receives a node pointer in R0
|
||||
# ;; Converts Quoted text to Hex values
|
||||
# ;; Pads values up to multiple of 4 bytes
|
||||
# ;; Doesn't modify registers
|
||||
|
@ -415,7 +415,7 @@ E1000FEE0001 # ADDUI R14 R14 1 ; Increment address pointer
|
|||
|
||||
|
||||
# ;; Eval_Immediates function
|
||||
# ;; Recieves a node in R0
|
||||
# ;; Receives a node in R0
|
||||
# ;; Converts number into Hex
|
||||
# ;; And write into Memory and fix pointer
|
||||
:Eval_Immediates
|
||||
|
@ -446,7 +446,7 @@ E0002CA3 @Eval_Immediates_0 # JUMP.NZ R3 @Eval_Immediates_0 ; And loop
|
|||
|
||||
|
||||
# ;; numerate_string function
|
||||
# ;; Recieves pointer To string in R0
|
||||
# ;; Receives pointer To string in R0
|
||||
# ;; Returns number in R0 equal to value of string
|
||||
# ;; Or Zero in the event of invalid string
|
||||
:numerate_string
|
||||
|
|
|
@ -124,7 +124,7 @@
|
|||
|
||||
|
||||
;; Purge_Line_Comment Function
|
||||
;; Recieves char in R0 and desired input in R1
|
||||
;; Receives char in R0 and desired input in R1
|
||||
;; Modifies R0
|
||||
;; Returns to Tokenize_Line as if the entire line
|
||||
;; Comment never existed
|
||||
|
@ -136,7 +136,7 @@
|
|||
|
||||
|
||||
;; Store_String function
|
||||
;; Recieves Char in R0, desired input in R1
|
||||
;; Receives Char in R0, desired input in R1
|
||||
;; And node pointer in R2
|
||||
;; Modifies node Text to point to string and sets
|
||||
;; Type to string.
|
||||
|
@ -158,7 +158,7 @@
|
|||
|
||||
|
||||
;; Store_Atom function
|
||||
;; Recieves Char in R0, desired input in R1
|
||||
;; Receives Char in R0, desired input in R1
|
||||
;; And node pointer in R2
|
||||
;; Modifies node Text to point to string
|
||||
:Store_Atom
|
||||
|
@ -185,7 +185,7 @@
|
|||
|
||||
|
||||
;; strcmp function
|
||||
;; Recieves pointers to null terminated strings
|
||||
;; Receives pointers to null terminated strings
|
||||
;; In R0 and R1
|
||||
;; Returns if they are equal in R0
|
||||
;; Returns to whatever called it
|
||||
|
@ -266,7 +266,7 @@
|
|||
|
||||
|
||||
;; Line_Macro Function
|
||||
;; Recieves a node pointer in R0
|
||||
;; Receives a node pointer in R0
|
||||
;; Causes macros to be applied
|
||||
;; Returns to whatever called it
|
||||
:Line_Macro
|
||||
|
@ -286,7 +286,7 @@
|
|||
|
||||
|
||||
;; setExpression Function
|
||||
;; Recieves a node pointer in R0
|
||||
;; Receives a node pointer in R0
|
||||
;; A string pointer to compare against in R1
|
||||
;; A string pointer for replacement in R2
|
||||
;; Doesn't modify any registers
|
||||
|
@ -318,7 +318,7 @@
|
|||
|
||||
|
||||
;; Process_String Function
|
||||
;; Recieves a Node in R0
|
||||
;; Receives a Node in R0
|
||||
;; Doesn't modify registers
|
||||
;; Returns back to whatever called it
|
||||
:Process_String
|
||||
|
@ -355,7 +355,7 @@
|
|||
|
||||
|
||||
;; Hexify_String Function
|
||||
;; Recieves a node pointer in R0
|
||||
;; Receives a node pointer in R0
|
||||
;; Converts Quoted text to Hex values
|
||||
;; Pads values up to multiple of 4 bytes
|
||||
;; Doesn't modify registers
|
||||
|
@ -415,7 +415,7 @@
|
|||
|
||||
|
||||
;; Eval_Immediates function
|
||||
;; Recieves a node in R0
|
||||
;; Receives a node in R0
|
||||
;; Converts number into Hex
|
||||
;; And write into Memory and fix pointer
|
||||
:Eval_Immediates
|
||||
|
@ -446,7 +446,7 @@
|
|||
|
||||
|
||||
;; numerate_string function
|
||||
;; Recieves pointer To string in R0
|
||||
;; Receives pointer To string in R0
|
||||
;; Returns number in R0 equal to value of string
|
||||
;; Or Zero in the event of invalid string
|
||||
:numerate_string
|
||||
|
|
|
@ -42,7 +42,7 @@ FFFFFFFF # HALT
|
|||
|
||||
|
||||
# ;; Readfile function
|
||||
# ;; Recieves pointer to head in R1
|
||||
# ;; Receives pointer to head in R1
|
||||
# ;; Creates Nodes and imports text until EOF
|
||||
# ;; Alters R0 R1 R14
|
||||
# ;; Returns to whatever called it
|
||||
|
@ -64,7 +64,7 @@ E0002C9E @ReadFile # JUMP.Z R14 @ReadFile
|
|||
|
||||
|
||||
# ;; 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
|
||||
|
@ -132,7 +132,7 @@ E10023240008 # STORE32 R2 R4 8
|
|||
|
||||
|
||||
# ;; addline Function
|
||||
# ;; Recieves pointers in R0 R1
|
||||
# ;; Receives pointers in R0 R1
|
||||
# ;; Alters R0 if NULL
|
||||
# ;; Appends nodes together
|
||||
# ;; Returns to whatever called it
|
||||
|
@ -257,7 +257,7 @@ E0002D0F @RemoveLine # CALLI R15 @RemoveLine
|
|||
|
||||
# ;; GetRoot function
|
||||
# ;; Walks backwards through nodes until beginning
|
||||
# ;; Recieves node pointer in R0 and Returns result in R0
|
||||
# ;; Receives node pointer in R0 and Returns result in R0
|
||||
# ;; Returns to whatever called it
|
||||
:GetRoot
|
||||
# ;; Preserve registers
|
||||
|
@ -302,7 +302,7 @@ E000A0320000 # CMPSKIPI.NE R2 0 ; If Head->Next is NULL
|
|||
|
||||
|
||||
# ;; Printline function
|
||||
# ;; Recieves a string pointer in R0
|
||||
# ;; Receives a string pointer in R0
|
||||
# ;; Prints string interface specified in R1
|
||||
# ;; Does not alter registers
|
||||
# ;; Returns to whatever called it
|
||||
|
@ -337,7 +337,7 @@ E1000F330001 # ADDUI R3 R3 1 ; Prep for next loop
|
|||
|
||||
|
||||
# ;; AppendLine Function
|
||||
# ;; Recieves a Node in R0
|
||||
# ;; Receives a Node in R0
|
||||
# ;; Creates a new Node and appends it
|
||||
# ;; Does not alter registers
|
||||
# ;; Returns to whatever calls it
|
||||
|
@ -367,7 +367,7 @@ E10023010000 # STORE32 R0 R1 0 ; head->next = p
|
|||
|
||||
|
||||
# ;; InsertLine Function
|
||||
# ;; Recieves a Node in R0
|
||||
# ;; Receives a Node in R0
|
||||
# ;; Creates a new Node and prepends it
|
||||
# ;; Does not alter registers
|
||||
# ;; Returns to whatever called it
|
||||
|
@ -397,7 +397,7 @@ E10023010004 # STORE32 R0 R1 4 ; head->prev = p
|
|||
|
||||
|
||||
# ;; RemoveLine Function
|
||||
# ;; Recieves Node in R0
|
||||
# ;; Receives Node in R0
|
||||
# ;; Returns replacement node in R0
|
||||
# ;; Returns to whatever called it
|
||||
:RemoveLine
|
||||
|
|
16
stage1/SET.s
16
stage1/SET.s
|
@ -47,7 +47,7 @@
|
|||
|
||||
|
||||
;; Readfile function
|
||||
;; Recieves pointer to head in R1
|
||||
;; Receives pointer to head in R1
|
||||
;; Creates Nodes and imports text until EOF
|
||||
;; Alters R0 R1 R14
|
||||
;; Returns to whatever called it
|
||||
|
@ -69,7 +69,7 @@
|
|||
|
||||
|
||||
;; 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
|
||||
|
@ -143,7 +143,7 @@
|
|||
|
||||
|
||||
;; addline Function
|
||||
;; Recieves pointers in R0 R1
|
||||
;; Receives pointers in R0 R1
|
||||
;; Alters R0 if NULL
|
||||
;; Appends nodes together
|
||||
;; Returns to whatever called it
|
||||
|
@ -290,7 +290,7 @@
|
|||
|
||||
;; GetRoot function
|
||||
;; Walks backwards through nodes until beginning
|
||||
;; Recieves node pointer in R0 and Returns result in R0
|
||||
;; Receives node pointer in R0 and Returns result in R0
|
||||
;; Returns to whatever called it
|
||||
:GetRoot
|
||||
;; Preserve registers
|
||||
|
@ -338,7 +338,7 @@
|
|||
|
||||
|
||||
;; Printline function
|
||||
;; Recieves a string pointer in R0
|
||||
;; Receives a string pointer in R0
|
||||
;; Prints string interface specified in R1
|
||||
;; Does not alter registers
|
||||
;; Returns to whatever called it
|
||||
|
@ -374,7 +374,7 @@
|
|||
|
||||
|
||||
;; AppendLine Function
|
||||
;; Recieves a Node in R0
|
||||
;; Receives a Node in R0
|
||||
;; Creates a new Node and appends it
|
||||
;; Does not alter registers
|
||||
;; Returns to whatever calls it
|
||||
|
@ -407,7 +407,7 @@
|
|||
|
||||
|
||||
;; InsertLine Function
|
||||
;; Recieves a Node in R0
|
||||
;; Receives a Node in R0
|
||||
;; Creates a new Node and prepends it
|
||||
;; Does not alter registers
|
||||
;; Returns to whatever called it
|
||||
|
@ -440,7 +440,7 @@
|
|||
|
||||
|
||||
;; RemoveLine Function
|
||||
;; Recieves Node in R0
|
||||
;; Receives Node in R0
|
||||
;; Returns replacement node in R0
|
||||
;; Returns to whatever called it
|
||||
:RemoveLine
|
||||
|
|
|
@ -76,7 +76,7 @@ E0002D20003a # LOADUI R0 58 ; Prep
|
|||
E0002D200009 # LOADUI R0 9 ; Prep
|
||||
42100200 # FPUTC ; Write it
|
||||
# :dehex_0 a0
|
||||
0902800F # POPR R0 R15 ; Restore byte recieved
|
||||
0902800F # POPR R0 R15 ; Restore byte received
|
||||
E0002D0F003a # CALLI R15 @hex8 ; Use a subset
|
||||
E0002D200020 # LOADUI R0 32 ; Prep for writing space
|
||||
42100200 # FPUTC ; Write it
|
||||
|
|
|
@ -87,7 +87,7 @@
|
|||
LOADUI R0 9 ; Prep
|
||||
FPUTC ; Write it
|
||||
:dehex_0
|
||||
POPR R0 R15 ; Restore byte recieved
|
||||
POPR R0 R15 ; Restore byte received
|
||||
CALLI R15 @hex8 ; Use a subset
|
||||
|
||||
LOADUI R0 32 ; Prep for writing space
|
||||
|
|
|
@ -340,7 +340,7 @@ E000A022ffff # CMPSKIPI.E R2 -1 ; Otherwise get the value
|
|||
|
||||
|
||||
# ;; Our simple string compare function
|
||||
# ;; Recieves two pointers in R0 and R1
|
||||
# ;; Receives two pointers in R0 and R1
|
||||
# ;; Returns the difference between the strings in R0
|
||||
# ;; Returns to whatever called it
|
||||
# :strcmp 290
|
||||
|
@ -377,7 +377,7 @@ E0002C51 @i # JUMP.E R1 @cmpbyte ; Loop if bytes are equal
|
|||
|
||||
|
||||
# ;; Processimmediate Function
|
||||
# ;; Recieves an integer value in R0
|
||||
# ;; Receives an integer value in R0
|
||||
# ;; Writes out the values to Tape_02
|
||||
# ;; Doesn't modify registers
|
||||
# ;; Returns to whatever called it
|
||||
|
|
|
@ -323,7 +323,7 @@
|
|||
|
||||
|
||||
;; Our simple string compare function
|
||||
;; Recieves two pointers in R0 and R1
|
||||
;; Receives two pointers in R0 and R1
|
||||
;; Returns the difference between the strings in R0
|
||||
;; Returns to whatever called it
|
||||
:strcmp
|
||||
|
@ -354,7 +354,7 @@
|
|||
|
||||
|
||||
;; Processimmediate Function
|
||||
;; Recieves an integer value in R0
|
||||
;; Receives an integer value in R0
|
||||
;; Writes out the values to Tape_02
|
||||
;; Doesn't modify registers
|
||||
;; Returns to whatever called it
|
||||
|
|
150
stage2/cc_x86.s
150
stage2/cc_x86.s
|
@ -95,7 +95,7 @@
|
|||
|
||||
|
||||
;; clearWhiteSpace function
|
||||
;; Recieves a character in R0 and FILE* in R1 and line_num in R11
|
||||
;; Receives a character in R0 and FILE* in R1 and line_num in R11
|
||||
;; Returns first non-whitespace character in R0
|
||||
:clearWhiteSpace
|
||||
CMPSKIPI.NE R0 32 ; Check for a Space
|
||||
|
@ -116,7 +116,7 @@
|
|||
|
||||
|
||||
;; consume_byte function
|
||||
;; Recieves a char in R0, FILE* in R1 and index in R13
|
||||
;; Receives a char in R0, FILE* in R1 and index in R13
|
||||
;; Returns next char in R0
|
||||
:consume_byte
|
||||
STOREX8 R0 R14 R13 ; Put char onto HEAP
|
||||
|
@ -126,7 +126,7 @@
|
|||
|
||||
|
||||
;; consume_word function
|
||||
;; Recieves a char in R0, FILE* in R1, FREQUENT in R2 and index in R13
|
||||
;; Receives a char in R0, FILE* in R1, FREQUENT in R2 and index in R13
|
||||
;; Returns next char in R0
|
||||
:consume_word
|
||||
PUSHR R3 R15 ; Protect R3
|
||||
|
@ -148,7 +148,7 @@
|
|||
|
||||
|
||||
;; fixup_label function
|
||||
;; Recieves nothing (But uses R14 as HEAP pointer)
|
||||
;; Receives nothing (But uses R14 as HEAP pointer)
|
||||
;; Returns 32 in R0 and no other registers altered
|
||||
:fixup_label
|
||||
PUSHR R1 R15 ; Protect R1 from change
|
||||
|
@ -171,7 +171,7 @@
|
|||
|
||||
|
||||
;; in_set2 function
|
||||
;; Recieves a Char in R0, FILE* in R1, char* in R2 and index in R13
|
||||
;; Receives a Char in R0, FILE* in R1, char* in R2 and index in R13
|
||||
;; Return result in R2
|
||||
:in_set2
|
||||
PUSHR R3 R15 ; Protect R3 from changes
|
||||
|
@ -194,7 +194,7 @@
|
|||
|
||||
|
||||
;; in_set function
|
||||
;; Recieves a Char in R0, char* in R1
|
||||
;; Receives a Char in R0, char* in R1
|
||||
;; Return result in R0
|
||||
:in_set
|
||||
PUSHR R2 R15 ; Protect R3 from changes
|
||||
|
@ -236,7 +236,7 @@
|
|||
"
|
||||
|
||||
;; preserve_keyword function
|
||||
;; Recieves a Char in R0, FILE* in R1 and index in R13
|
||||
;; Receives a Char in R0, FILE* in R1 and index in R13
|
||||
;; Overwrites R2
|
||||
;; Returns next CHAR
|
||||
:preserve_keyword
|
||||
|
@ -255,7 +255,7 @@
|
|||
|
||||
|
||||
;; preserve_symbol function
|
||||
;; Recieves a Char in R0, FILE* in R1 and index in R13
|
||||
;; Receives a Char in R0, FILE* in R1 and index in R13
|
||||
;; Overwrites R2
|
||||
;; Returns next CHAR
|
||||
:preserve_symbol
|
||||
|
@ -272,7 +272,7 @@
|
|||
|
||||
|
||||
;; purge_macro function
|
||||
;; Recieves a Char in R0, FILE* in R1 and index in R13
|
||||
;; Receives a Char in R0, FILE* in R1 and index in R13
|
||||
;; Returns next CHAR via jumping to get_token_reset
|
||||
:purge_macro
|
||||
CMPSKIPI.NE R0 10 ; Check for Line Feed
|
||||
|
@ -283,7 +283,7 @@
|
|||
|
||||
|
||||
;; get_token function
|
||||
;; Recieves a Char in R0, FILE* in R1, line_num in R11 and TOKEN in R10
|
||||
;; Receives a Char in R0, FILE* in R1, line_num in R11 and TOKEN in R10
|
||||
;; sets index in R13 and current in R12
|
||||
;; Overwrites R2
|
||||
;; Returns next CHAR
|
||||
|
@ -398,7 +398,7 @@
|
|||
|
||||
|
||||
;; reverse_list function
|
||||
;; Recieves a Token_list in R0
|
||||
;; Receives a Token_list in R0
|
||||
;; Returns List in Reverse order in R0
|
||||
:reverse_list
|
||||
PUSHR R1 R15 ; Protect R1
|
||||
|
@ -420,7 +420,7 @@
|
|||
|
||||
|
||||
;; read_all_tokens function
|
||||
;; Recieves a FILE* in R0
|
||||
;; Receives a FILE* in R0
|
||||
;; sets line_num in R11 and TOKEN in R10
|
||||
;; Overwrites R2
|
||||
;; Returns struct token_list* in R0
|
||||
|
@ -447,7 +447,7 @@
|
|||
|
||||
|
||||
;; parse_string function
|
||||
;; Recieves char* string in R0
|
||||
;; Receives char* string in R0
|
||||
;; R14 is HEAP Pointer
|
||||
;; Returns char* in R0
|
||||
:parse_string
|
||||
|
@ -469,7 +469,7 @@
|
|||
|
||||
;; weird function
|
||||
;; Analyze string to determine if it's output would be weird for mescc-tools
|
||||
;; Recieves char* in R0
|
||||
;; Receives char* in R0
|
||||
;; Returns BOOL in R0
|
||||
:weird
|
||||
PUSHR R1 R15 ; Protect R1
|
||||
|
@ -522,7 +522,7 @@
|
|||
|
||||
;; collect_weird_string function
|
||||
;; Converts weird string into a form mescc-tools can handle cleanly
|
||||
;; Recieves char* in R0
|
||||
;; Receives char* in R0
|
||||
;; R14 is HEAP Pointer and $hex_chars as the table
|
||||
;; Returns char* in R0
|
||||
:collect_weird_string
|
||||
|
@ -580,7 +580,7 @@
|
|||
|
||||
|
||||
;; hex function
|
||||
;; Recieves Char in R0
|
||||
;; Receives Char in R0
|
||||
;; Return Int in R0
|
||||
:hex
|
||||
SUBUI R0 R0 48 ; First shift
|
||||
|
@ -609,7 +609,7 @@
|
|||
|
||||
|
||||
;; escape_lookup function
|
||||
;; Recieves char* in R0
|
||||
;; Receives char* in R0
|
||||
;; Returns char in R0
|
||||
:escape_lookup
|
||||
PUSHR R1 R15 ; Protect R1
|
||||
|
@ -678,12 +678,12 @@
|
|||
HALT
|
||||
|
||||
:escape_lookup_string0
|
||||
"Recieved invalid escape \\"
|
||||
"Received invalid escape \\"
|
||||
|
||||
|
||||
;; collect_regular_string function
|
||||
;; Converts C string into a RAW string for mescc-tools
|
||||
;; Recieves char* in R0
|
||||
;; Receives char* in R0
|
||||
;; R14 is HEAP Pointer
|
||||
;; Returns char* in R0
|
||||
:collect_regular_string
|
||||
|
@ -728,7 +728,7 @@
|
|||
|
||||
|
||||
;; unary_expr_sizeof function
|
||||
;; Recieves nothing
|
||||
;; Receives nothing
|
||||
;; Returns nothing
|
||||
;; R13 Holds pointer to global_token, R14 is HEAP Pointer
|
||||
:unary_expr_sizeof
|
||||
|
@ -771,7 +771,7 @@ Missing )
|
|||
|
||||
|
||||
;; constant_load function
|
||||
;; Recieves struct token_list* a in R0
|
||||
;; Receives struct token_list* a in R0
|
||||
;; Returns nothing
|
||||
:constant_load
|
||||
PUSHR R0 R15 ; Protect R0
|
||||
|
@ -790,7 +790,7 @@ Missing )
|
|||
|
||||
|
||||
;; variable_load function
|
||||
;; Recieves struct token_list* a in R0
|
||||
;; Receives struct token_list* a in R0
|
||||
;; and struct token_list* current_target in R8
|
||||
;; Returns Nothing
|
||||
;; R13 Holds pointer to global_token, R14 is HEAP Pointer
|
||||
|
@ -853,7 +853,7 @@ Missing )
|
|||
|
||||
|
||||
;; function_load function
|
||||
;; Recieves struct token_list* a in R0
|
||||
;; Receives struct token_list* a in R0
|
||||
;; Returns nothing
|
||||
;; R13 Holds pointer to global_token, R14 is HEAP Pointer
|
||||
:function_load
|
||||
|
@ -888,7 +888,7 @@ Missing )
|
|||
|
||||
|
||||
;; global_load function
|
||||
;; Recieves struct token_list* a in R0
|
||||
;; Receives struct token_list* a in R0
|
||||
;; and struct token_list* current_target in R8
|
||||
;; Returns nothing
|
||||
;; R13 Holds pointer to global_token, R14 is HEAP Pointer
|
||||
|
@ -926,7 +926,7 @@ Missing )
|
|||
|
||||
;; primary_expr_failure function
|
||||
;; Fails hard and fast
|
||||
;; Recieves nothing
|
||||
;; Receives nothing
|
||||
;; HALTs and will trash registers
|
||||
;; R13 Holds pointer to global_token, R14 is HEAP Pointer
|
||||
:primary_expr_failure
|
||||
|
@ -944,14 +944,14 @@ Missing )
|
|||
HALT
|
||||
|
||||
:primary_expr_failure_string0
|
||||
"Recieved "
|
||||
"Received "
|
||||
:primary_expr_failure_string1
|
||||
" in primary_expr
|
||||
"
|
||||
|
||||
|
||||
;; primary_expr_string function
|
||||
;; Recieves struct token_list* global_token in R13,
|
||||
;; Receives struct token_list* global_token in R13,
|
||||
;; struct token_list* out in R12,
|
||||
;; struct token_list* string_list in R11
|
||||
;; struct token_list* global_list in R10
|
||||
|
@ -1003,7 +1003,7 @@ Missing )
|
|||
|
||||
|
||||
;; primary_expr_char function
|
||||
;; Recieves struct token_list* global_token in R13,
|
||||
;; Receives struct token_list* global_token in R13,
|
||||
;; struct token_list* out in R12,
|
||||
;; struct token_list* string_list in R11
|
||||
;; struct token_list* global_list in R10
|
||||
|
@ -1140,7 +1140,7 @@ Missing )
|
|||
|
||||
|
||||
;; promote_type function
|
||||
;; Recieves struct type* in R0 and struct type* in R1
|
||||
;; Receives struct type* in R0 and struct type* in R1
|
||||
;; Returns first match struct type* in R0
|
||||
:promote_type
|
||||
JUMP.Z R1 @promote_type_abort0 ; If B is NULL just abort
|
||||
|
@ -1187,7 +1187,7 @@ Missing )
|
|||
|
||||
|
||||
;; common_recursion function
|
||||
;; Recieves FUNCTION* in R0
|
||||
;; Receives FUNCTION* in R0
|
||||
;; struct token_list* out in R12,
|
||||
;; struct token_list* string_list in R11
|
||||
;; struct token_list* global_list in R10
|
||||
|
@ -1228,7 +1228,7 @@ Missing )
|
|||
|
||||
|
||||
;; general_recursion function
|
||||
;; Recieves FUNCTION F in R0, char* s in R1, char* name in R2
|
||||
;; Receives FUNCTION F in R0, char* s in R1, char* name in R2
|
||||
;; and FUNCTION ITERATE in R3
|
||||
;; struct token_list* out in R12,
|
||||
;; struct token_list* string_list in R11
|
||||
|
@ -1266,7 +1266,7 @@ Missing )
|
|||
|
||||
|
||||
;; ceil_log2 function
|
||||
;; Recieves INT A in R0
|
||||
;; Receives INT A in R0
|
||||
;; Returns LOG2(A) in R0
|
||||
:ceil_log2
|
||||
PUSHR R1 R15 ; Protect R1
|
||||
|
@ -1292,7 +1292,7 @@ Missing )
|
|||
|
||||
|
||||
;; postfix_expr_arrow function
|
||||
;; Recieves nothing
|
||||
;; Receives nothing
|
||||
;; struct token_list* out in R12,
|
||||
;; struct token_list* string_list in R11
|
||||
;; struct token_list* global_list in R10
|
||||
|
@ -1368,7 +1368,7 @@ ADD_ebx_to_eax
|
|||
|
||||
|
||||
;; postfix_expr_array function
|
||||
;; Recieves nothing
|
||||
;; Receives nothing
|
||||
;; struct token_list* out in R12,
|
||||
;; struct token_list* string_list in R11
|
||||
;; struct token_list* global_list in R10
|
||||
|
@ -1446,7 +1446,7 @@ Missing ]
|
|||
|
||||
|
||||
;; postfix_expr_stub function
|
||||
;; Recieves nothing
|
||||
;; Receives nothing
|
||||
;; struct token_list* out in R12,
|
||||
;; struct token_list* string_list in R11
|
||||
;; struct token_list* global_list in R10
|
||||
|
@ -1498,7 +1498,7 @@ Missing ]
|
|||
|
||||
|
||||
;; additive_expr_stub function
|
||||
;; recieves nothing
|
||||
;; receives nothing
|
||||
;; returns nothing
|
||||
;; Updates struct token_list*
|
||||
:additive_expr_stub
|
||||
|
@ -1585,7 +1585,7 @@ SAR_eax_cl
|
|||
|
||||
|
||||
;; additive_expr function
|
||||
;; Recieves struct token_list* global_token in R13,
|
||||
;; Receives struct token_list* global_token in R13,
|
||||
;; struct token_list* out in R12,
|
||||
;; struct token_list* string_list in R11
|
||||
;; struct token_list* global_list in R10
|
||||
|
@ -1600,7 +1600,7 @@ SAR_eax_cl
|
|||
|
||||
|
||||
;; relational_expr_stub function
|
||||
;; recieves nothing
|
||||
;; receives nothing
|
||||
;; returns nothing
|
||||
;; Updates struct token_list*
|
||||
:relational_expr_stub
|
||||
|
@ -1681,7 +1681,7 @@ MOVEZBL
|
|||
|
||||
|
||||
;; relational_expr function
|
||||
;; Recieves struct token_list* global_token in R13,
|
||||
;; Receives struct token_list* global_token in R13,
|
||||
;; struct token_list* out in R12,
|
||||
;; struct token_list* string_list in R11
|
||||
;; struct token_list* global_list in R10
|
||||
|
@ -1696,7 +1696,7 @@ MOVEZBL
|
|||
|
||||
|
||||
;; relational_expr_stub function
|
||||
;; recieves nothing
|
||||
;; receives nothing
|
||||
;; returns nothing
|
||||
;; Updates struct token_list*
|
||||
:bitwise_expr_stub
|
||||
|
@ -1751,7 +1751,7 @@ MOVEZBL
|
|||
|
||||
|
||||
;; bitwise_expr function
|
||||
;; Recieves struct token_list* global_token in R13,
|
||||
;; Receives struct token_list* global_token in R13,
|
||||
;; struct token_list* out in R12,
|
||||
;; struct token_list* string_list in R11
|
||||
;; struct token_list* global_list in R10
|
||||
|
@ -1766,7 +1766,7 @@ MOVEZBL
|
|||
|
||||
|
||||
;; primary_expr function
|
||||
;; Recieves struct token_list* global_token in R13,
|
||||
;; Receives struct token_list* global_token in R13,
|
||||
;; struct token_list* out in R12,
|
||||
;; struct token_list* string_list in R11
|
||||
;; struct token_list* global_list in R10
|
||||
|
@ -1889,7 +1889,7 @@ Didn't get )
|
|||
|
||||
|
||||
;; expression function
|
||||
;; Recieves struct token_list* global_token in R13,
|
||||
;; Receives struct token_list* global_token in R13,
|
||||
;; struct token_list* out in R12,
|
||||
;; struct token_list* string_list in R11
|
||||
;; struct token_list* global_list in R10
|
||||
|
@ -2080,7 +2080,7 @@ MISSING )
|
|||
|
||||
|
||||
;; set_break_frame microfunction
|
||||
;; Recieves char* num in R0, char* head in R1
|
||||
;; Receives char* num in R0, char* head in R1
|
||||
;; Overwrites R0
|
||||
;; Sets break frame using
|
||||
;; R9 holding FUNC
|
||||
|
@ -2414,7 +2414,7 @@ MISSING )
|
|||
|
||||
|
||||
;; return_result function
|
||||
;; Recieves nothing
|
||||
;; Receives nothing
|
||||
;; Returns nothing
|
||||
;; and struct token_list* FUNC in R9
|
||||
;; R13 Holds pointer to global_token, R14 is HEAP Pointer
|
||||
|
@ -2460,7 +2460,7 @@ MISSING ;
|
|||
|
||||
|
||||
;; process_break function
|
||||
;; Recieves nothing
|
||||
;; Receives nothing
|
||||
;; and struct token_list* FUNC in R9
|
||||
;; R13 Holds pointer to global_token, R14 is HEAP Pointer
|
||||
;; Returns the token_lists modified
|
||||
|
@ -2540,7 +2540,7 @@ Missing ;
|
|||
|
||||
|
||||
;; process_asm function
|
||||
;; Recieves struct token_list* global_token in R13,
|
||||
;; Receives struct token_list* global_token in R13,
|
||||
;; struct token_list* out in R12,
|
||||
;; struct token_list* string_list in R11
|
||||
;; struct token_list* global_list in R10
|
||||
|
@ -2602,7 +2602,7 @@ MISSING ;
|
|||
|
||||
|
||||
;; recursive_statement function
|
||||
;; Recieves struct token_list* global_token in R13,
|
||||
;; Receives struct token_list* global_token in R13,
|
||||
;; struct token_list* out in R12,
|
||||
;; struct token_list* string_list in R11
|
||||
;; struct token_list* global_list in R10
|
||||
|
@ -2659,7 +2659,7 @@ MISSING ;
|
|||
|
||||
|
||||
;; statement function
|
||||
;; Recieves struct token_list* global_token in R13,
|
||||
;; Receives struct token_list* global_token in R13,
|
||||
;; struct token_list* out in R12,
|
||||
;; struct token_list* string_list in R11
|
||||
;; struct token_list* global_list in R10
|
||||
|
@ -2837,7 +2837,7 @@ MISSING ;
|
|||
|
||||
|
||||
;; collect_local function
|
||||
;; Recieves struct token_list* global_token in R13,
|
||||
;; Receives struct token_list* global_token in R13,
|
||||
;; struct token_list* out in R12,
|
||||
;; struct token_list* string_list in R11
|
||||
;; struct token_list* global_list in R10
|
||||
|
@ -2949,7 +2949,7 @@ Missing ;
|
|||
|
||||
|
||||
;; collect_arguments function
|
||||
;; Recieves struct token_list* global_token in R13,
|
||||
;; Receives struct token_list* global_token in R13,
|
||||
;; struct token_list* out in R12,
|
||||
;; struct token_list* string_list in R11
|
||||
;; struct token_list* global_list in R10
|
||||
|
@ -3012,7 +3012,7 @@ Missing ;
|
|||
|
||||
|
||||
;; declare_function function
|
||||
;; Recieves struct token_list* global_token in R13,
|
||||
;; Receives struct token_list* global_token in R13,
|
||||
;; struct token_list* out in R12,
|
||||
;; struct token_list* string_list in R11
|
||||
;; and struct token_list* global_list in R10
|
||||
|
@ -3094,7 +3094,7 @@ Missing ;
|
|||
|
||||
|
||||
;; program function
|
||||
;; Recieves struct token_list* global_token in R13,
|
||||
;; Receives struct token_list* global_token in R13,
|
||||
;; struct token_list* out in R12,
|
||||
;; struct token_list* string_list in R11
|
||||
;; and struct token_list* global_list in R10
|
||||
|
@ -3248,7 +3248,7 @@ Missing ;
|
|||
NOP
|
||||
"
|
||||
:program_string2
|
||||
"Recieved "
|
||||
"Received "
|
||||
:program_string3
|
||||
" in program
|
||||
"
|
||||
|
@ -3259,7 +3259,7 @@ Missing ;
|
|||
|
||||
|
||||
;; sym_declare function
|
||||
;; Recieves char* in R0, struct type* in R1, struct token_list* in R2
|
||||
;; Receives char* in R0, struct type* in R1, struct token_list* in R2
|
||||
;; R13 Holds pointer to global_token, R14 is HEAP Pointer
|
||||
;; Returns struct token_list* in R0
|
||||
:sym_declare
|
||||
|
@ -3272,7 +3272,7 @@ Missing ;
|
|||
|
||||
|
||||
;; sym_lookup function
|
||||
;; Recieves char* in R0 and struct token_list in R1
|
||||
;; Receives char* in R0 and struct token_list in R1
|
||||
;; Returns struct token_list* or NULL in R0
|
||||
:sym_lookup
|
||||
PUSHR R2 R15 ; Protect R2
|
||||
|
@ -3293,7 +3293,7 @@ Missing ;
|
|||
|
||||
|
||||
;; function_call function
|
||||
;; Recieves CHAR* S in R0 and INT BOOL in R1
|
||||
;; Receives CHAR* S in R0 and INT BOOL in R1
|
||||
;; struct token_list* out in R12,
|
||||
;; struct token_list* string_list in R11
|
||||
;; and struct token_list* global_list in R10
|
||||
|
@ -3452,7 +3452,7 @@ LOAD_INTEGER
|
|||
|
||||
|
||||
;; emit function
|
||||
;; Recieves char* in R0, struct token_list* in R1
|
||||
;; Receives char* in R0, struct token_list* in R1
|
||||
;; R13 Holds pointer to global_token, R14 is HEAP Pointer
|
||||
;; Returns struct token_list* in R0
|
||||
:emit
|
||||
|
@ -3467,7 +3467,7 @@ LOAD_INTEGER
|
|||
|
||||
|
||||
;; emit_out function
|
||||
;; Recieves char* in R0
|
||||
;; Receives char* in R0
|
||||
;; struct token_list* out in R12,
|
||||
;; R13 Holds pointer to global_token, R14 is HEAP Pointer
|
||||
;; Returns struct token_list* in R0
|
||||
|
@ -3480,7 +3480,7 @@ LOAD_INTEGER
|
|||
|
||||
|
||||
;; uniqueID function
|
||||
;; Recieves char* in R0, struct token_list* in R1 and char* in R2
|
||||
;; Receives char* in R0, struct token_list* in R1 and char* in R2
|
||||
;; Calls emit repeatedly
|
||||
;; Returns struct token_list* in R0
|
||||
:uniqueID
|
||||
|
@ -3501,7 +3501,7 @@ LOAD_INTEGER
|
|||
|
||||
|
||||
;; uniqueID_out function
|
||||
;; Recieves char* in R0, char* in R1
|
||||
;; Receives char* in R0, char* in R1
|
||||
;; Calls emit_out repeatedly
|
||||
;; Returns nothing
|
||||
:uniqueID_out
|
||||
|
@ -3519,7 +3519,7 @@ LOAD_INTEGER
|
|||
|
||||
|
||||
;; file_print function
|
||||
;; Recieves pointer to string in R0 and FILE* in R1
|
||||
;; Receives pointer to string in R0 and FILE* in R1
|
||||
;; Returns nothing
|
||||
:file_print
|
||||
PUSHR R2 R15 ; Protect R2 from Overwrite
|
||||
|
@ -3536,7 +3536,7 @@ LOAD_INTEGER
|
|||
|
||||
|
||||
;; recursive_output function
|
||||
;; Recieves token_list in R0 and FILE* in R1
|
||||
;; Receives token_list in R0 and FILE* in R1
|
||||
;; Returns nothing and alters nothing
|
||||
:recursive_output
|
||||
JUMP.Z R0 @recursive_output_abort ; Abort if NULL
|
||||
|
@ -3553,7 +3553,7 @@ LOAD_INTEGER
|
|||
|
||||
|
||||
;; match function
|
||||
;; Recieves a CHAR* in R0, CHAR* in R1
|
||||
;; Receives a CHAR* in R0, CHAR* in R1
|
||||
;; Returns Bool in R0 indicating if strings match
|
||||
:match
|
||||
PUSHR R1 R15 ; Protect R1
|
||||
|
@ -3582,7 +3582,7 @@ LOAD_INTEGER
|
|||
|
||||
|
||||
;; lookup_type function
|
||||
;; Recieves a CHAR* in R0 and struct type* in R1
|
||||
;; Receives a CHAR* in R0 and struct type* in R1
|
||||
;; Returns struct type* in R0 or NULL if no match
|
||||
:lookup_type
|
||||
PUSHR R1 R15 ; Protect R1
|
||||
|
@ -3603,7 +3603,7 @@ LOAD_INTEGER
|
|||
|
||||
|
||||
;; lookup_member function
|
||||
;; Recieves struct type* parent in R0 and char* name in R1
|
||||
;; Receives struct type* parent in R0 and char* name in R1
|
||||
;; R13 Holds pointer to global_token, R14 is HEAP Pointer
|
||||
;; Returns struct type* of member in R0 or aborts with error
|
||||
:lookup_member
|
||||
|
@ -3651,7 +3651,7 @@ LOAD_INTEGER
|
|||
|
||||
|
||||
;; build_member function
|
||||
;; Recieves a struct type* in R0, int in R1 and int in R2
|
||||
;; Receives a struct type* in R0, int in R1 and int in R2
|
||||
;; R13 Holds pointer to global_token, R14 is HEAP Pointer
|
||||
;; Modifies R2 to current member_size
|
||||
;; Returns struct type* in R0
|
||||
|
@ -3713,7 +3713,7 @@ LOAD_INTEGER
|
|||
|
||||
|
||||
;; build_union function
|
||||
;; Recieves a struct type* in R0, int in R1 and int in R2
|
||||
;; Receives a struct type* in R0, int in R1 and int in R2
|
||||
;; R13 Holds pointer to global_token, R14 is HEAP Pointer
|
||||
;; Modifies R2 to current member_size
|
||||
;; Returns struct type* in R0
|
||||
|
@ -3765,7 +3765,7 @@ Missing ;
|
|||
|
||||
|
||||
;; create_struct function
|
||||
;; Recieves Nothing
|
||||
;; Receives Nothing
|
||||
;; R13 Holds pointer to global_token, R14 is HEAP Pointer
|
||||
;; Returns Nothing
|
||||
:create_struct
|
||||
|
@ -3852,7 +3852,7 @@ Missing ;
|
|||
|
||||
|
||||
;; type_name function
|
||||
;; Recieves Nothing
|
||||
;; Receives Nothing
|
||||
;; R13 Holds pointer to global_token, R14 is HEAP Pointer
|
||||
;; Returns struct type* in R0
|
||||
:type_name
|
||||
|
@ -3906,7 +3906,7 @@ Missing ;
|
|||
|
||||
|
||||
;; line_error function
|
||||
;; Recieves Nothing
|
||||
;; Receives Nothing
|
||||
;; R13 Holds pointer to global_token, R14 is HEAP Pointer
|
||||
;; Returns nothing
|
||||
:line_error
|
||||
|
@ -3927,7 +3927,7 @@ Missing ;
|
|||
|
||||
|
||||
;; require_match function
|
||||
;; Recieves char* in R0 and char* in R1
|
||||
;; Receives char* in R0 and char* in R1
|
||||
;; R13 Holds pointer to global_token, R14 is HEAP Pointer
|
||||
;; Returns Nothing
|
||||
:require_match
|
||||
|
@ -3953,7 +3953,7 @@ Missing ;
|
|||
|
||||
|
||||
;; numerate_number function
|
||||
;; Recieves int in R0
|
||||
;; Receives int in R0
|
||||
;; R13 Holds pointer to global_token, R14 is HEAP Pointer
|
||||
;; Returns pointer to string generated
|
||||
:numerate_number
|
||||
|
@ -4020,7 +4020,7 @@ Missing ;
|
|||
|
||||
|
||||
;; numerate_string function
|
||||
;; Recieves pointer To string in R0
|
||||
;; Receives pointer To string in R0
|
||||
;; Returns number in R0 equal to value of string
|
||||
;; Or Zero in the event of invalid string
|
||||
:numerate_string
|
||||
|
@ -4293,7 +4293,7 @@ Missing ;
|
|||
|
||||
|
||||
;; debug_list function
|
||||
;; Recieves struct token_list* in R0
|
||||
;; Receives struct token_list* in R0
|
||||
;; Prints contents of list and HALTS
|
||||
;; Does not return
|
||||
:debug_list
|
||||
|
|
|
@ -1482,7 +1482,7 @@
|
|||
;; Reads Tape_01 until EOF
|
||||
;; Then switches into TTY Mode
|
||||
:cold_done
|
||||
;; IF TTY Recieves EOF call it quits
|
||||
;; IF TTY Receives EOF call it quits
|
||||
CMPSKIPI.NE R7 0 ; Check if TTY
|
||||
JUMP @final_Cleanup ; Clean up and call it a day
|
||||
|
||||
|
|
174
stage2/lisp.s
174
stage2/lisp.s
|
@ -97,7 +97,7 @@
|
|||
|
||||
;; Append_Cell
|
||||
;; Adds a cell to the end of a CDR chain
|
||||
;; Recieves HEAD in R0 and Tail in R1
|
||||
;; Receives HEAD in R0 and Tail in R1
|
||||
;; Returns HEAD if not NULL
|
||||
:append_Cell
|
||||
CMPSKIPI.NE R0 0 ; If HEAD is NULL
|
||||
|
@ -123,7 +123,7 @@
|
|||
|
||||
;; Tokenize
|
||||
;; Converts a string into a list of tokens
|
||||
;; Recieves HEAD in R0, Pointer to String in R1 and Size of string in R2
|
||||
;; Receives HEAD in R0, Pointer to String in R1 and Size of string in R2
|
||||
;; Returns HEAD of list in R0
|
||||
:tokenize
|
||||
;; Deal with Edge case
|
||||
|
@ -186,7 +186,7 @@
|
|||
|
||||
|
||||
;; is_integer
|
||||
;; Recieves pointer to string in R0
|
||||
;; Receives pointer to string in R0
|
||||
;; Returns TRUE or FALSE in R0
|
||||
:is_integer
|
||||
PUSHR R1 R15 ; Protect R1
|
||||
|
@ -209,7 +209,7 @@
|
|||
|
||||
|
||||
;; numerate_string function
|
||||
;; Recieves pointer To string in R0
|
||||
;; Receives pointer To string in R0
|
||||
;; Returns number in R0 equal to value of string
|
||||
;; Or Zero in the event of invalid string
|
||||
:numerate_string
|
||||
|
@ -290,7 +290,7 @@
|
|||
;; atom
|
||||
;; Converts tokens into native forms
|
||||
;; Aka numbers become numbers and everything else is a symbol
|
||||
;; Recieves a pointer to Token in R0
|
||||
;; Receives a pointer to Token in R0
|
||||
;; Returns a pointer to a Cell in R0
|
||||
:atom
|
||||
PUSHR R1 R15 ; Protect R1
|
||||
|
@ -374,7 +374,7 @@
|
|||
|
||||
;; readobj
|
||||
;; Breaks up tokens on the token_stack until its empty
|
||||
;; Recieves Nothing
|
||||
;; Receives Nothing
|
||||
;; Returns a Cell in R0
|
||||
:readobj
|
||||
PUSHR R1 R15 ; Protect R1
|
||||
|
@ -407,7 +407,7 @@
|
|||
|
||||
;; readlist
|
||||
;; CONS up Rest of elements until ) is found
|
||||
;; Recieves nothing
|
||||
;; Receives nothing
|
||||
;; Returns A Cell in R0
|
||||
:readlist
|
||||
PUSHR R1 R15 ; Protect R1
|
||||
|
@ -436,7 +436,7 @@
|
|||
|
||||
;; parse
|
||||
;; Starts the recursive tokenizing and atomizing of input
|
||||
;; Recieves a string in R0 and its length in R1
|
||||
;; Receives a string in R0 and its length in R1
|
||||
;; Returns a list of Cells in R0
|
||||
:parse
|
||||
PUSHR R2 R15 ; Protect R2
|
||||
|
@ -459,7 +459,7 @@
|
|||
|
||||
|
||||
;; Our simple malloc function
|
||||
;; Recieves A number of bytes to allocate in R0
|
||||
;; Receives A number of bytes to allocate in R0
|
||||
;; Returns a pointer to Segment in R0
|
||||
:malloc
|
||||
PUSHR R1 R15 ; Protect R1
|
||||
|
@ -610,7 +610,7 @@
|
|||
|
||||
;; Write_Int
|
||||
;; Writes desired integer to desired IO
|
||||
;; Recieves Integer in R0 and IO in R1
|
||||
;; Receives Integer in R0 and IO in R1
|
||||
;; Returns Nothing
|
||||
:Max_Decimal
|
||||
'3B9ACA00'
|
||||
|
@ -669,7 +669,7 @@
|
|||
|
||||
;; Print_String
|
||||
;; Prints the string pointed in R0 to IO in R1
|
||||
;; Recieves string pointer in R0 and IO in R1
|
||||
;; Receives string pointer in R0 and IO in R1
|
||||
;; Returns nothing
|
||||
:Print_String
|
||||
PUSHR R0 R15 ; Protect R0
|
||||
|
@ -692,7 +692,7 @@
|
|||
|
||||
;; writeobj
|
||||
;; Outputs to the IO in R12
|
||||
;; Recieves a Cell list in R0
|
||||
;; Receives a Cell list in R0
|
||||
;; Returns nothing
|
||||
:writeobj
|
||||
PUSHR R0 R15 ; Protect R0
|
||||
|
@ -811,7 +811,7 @@
|
|||
|
||||
;; strcmp
|
||||
;; A simple string compare function
|
||||
;; Recieves string pointers in R0 and R1
|
||||
;; Receives string pointers in R0 and R1
|
||||
;; Returns result of comparision in R0
|
||||
:strcmp
|
||||
;; Preserve registers
|
||||
|
@ -840,7 +840,7 @@
|
|||
|
||||
;; findsym
|
||||
;; Attempts to find a symbol in a CONS list
|
||||
;; Recieves a string in R0
|
||||
;; Receives a string in R0
|
||||
;; Returns Cell or NIL in R0
|
||||
:findsym
|
||||
PUSHR R1 R15 ; Protect R1
|
||||
|
@ -875,7 +875,7 @@
|
|||
|
||||
;; intern
|
||||
;; Either find symbol or make it
|
||||
;; Recieves string pointer in R0
|
||||
;; Receives string pointer in R0
|
||||
;; Returns a Cell pointer in R0
|
||||
:intern
|
||||
PUSHR R1 R15 ; Protect R1
|
||||
|
@ -908,7 +908,7 @@
|
|||
|
||||
;; extend
|
||||
;; CONS up symbols with an environment
|
||||
;; Recieves an environment in R0, symbol in R1 and Value in R2
|
||||
;; Receives an environment in R0, symbol in R1 and Value in R2
|
||||
;; Returns a CONS of CONS in R0
|
||||
:extend
|
||||
PUSHR R1 R15 ; Protect R1
|
||||
|
@ -928,7 +928,7 @@
|
|||
|
||||
|
||||
;; multiple_extend
|
||||
;; Recieves an environment in R0, symbol in R1 and Values in R2
|
||||
;; Receives an environment in R0, symbol in R1 and Values in R2
|
||||
;; Returns an extended environment in R0
|
||||
:multiple_extend
|
||||
PUSHR R1 R15 ; Protect R1
|
||||
|
@ -959,7 +959,7 @@
|
|||
|
||||
|
||||
;; extend_env
|
||||
;; Recieves a Symbol in R0, a Value in R1 and an environment pointer in R2
|
||||
;; Receives a Symbol in R0, a Value in R1 and an environment pointer in R2
|
||||
;; Returns Value in R0 after extending top
|
||||
:extend_env
|
||||
PUSHR R1 R15 ; Protect Val
|
||||
|
@ -982,7 +982,7 @@
|
|||
|
||||
|
||||
;; assoc
|
||||
;; Recieves a Key in R0 and an alist in R1
|
||||
;; Receives a Key in R0 and an alist in R1
|
||||
;; Returns Value if Found or NIL in R0
|
||||
:assoc
|
||||
PUSHR R1 R15 ; Protect R1
|
||||
|
@ -1014,7 +1014,7 @@
|
|||
|
||||
|
||||
;; evlis
|
||||
;; Recieves Expressions in R0 and an Environment in R1
|
||||
;; Receives Expressions in R0 and an Environment in R1
|
||||
;; Returns the result of Evaluation of those Expressions
|
||||
;; in respect to the given Environment in R0
|
||||
:evlis
|
||||
|
@ -1041,7 +1041,7 @@
|
|||
|
||||
|
||||
;; progn
|
||||
;; Recieves Expressions in R0 and an Environment in R1
|
||||
;; Receives Expressions in R0 and an Environment in R1
|
||||
;; Returns the result of Evaluation of those Expressions
|
||||
;; in respect to the given Environment in R0
|
||||
:progn
|
||||
|
@ -1069,7 +1069,7 @@
|
|||
|
||||
|
||||
;; Apply
|
||||
;; Recieves a Procedure in R0 and Values in R1
|
||||
;; Receives a Procedure in R0 and Values in R1
|
||||
;; Applies the procedure to the values and returns the result in R0
|
||||
:apply
|
||||
PUSHR R1 R15 ; Protect R1
|
||||
|
@ -1124,7 +1124,7 @@
|
|||
|
||||
|
||||
;; evcond
|
||||
;; Recieves an Expression in R0 and an Environment in R1
|
||||
;; Receives an Expression in R0 and an Environment in R1
|
||||
;; Walks down conditions until true one is found and return
|
||||
;; Desired expression's result in R0
|
||||
;; if none of the conditions are true, and the result of
|
||||
|
@ -1166,7 +1166,7 @@
|
|||
|
||||
|
||||
;; eval
|
||||
;; Recieves an Expression in R0 and an Environment in R1
|
||||
;; Receives an Expression in R0 and an Environment in R1
|
||||
;; Evaluates the expression in the given environment and returns
|
||||
;; The result in R0
|
||||
:eval
|
||||
|
@ -1224,7 +1224,7 @@
|
|||
HALT
|
||||
|
||||
:eval_error_Message
|
||||
"EVAL Recieved unknown Object"
|
||||
"EVAL Received unknown Object"
|
||||
|
||||
;; Result must be in R0 by this point
|
||||
;; Simply Clean up and return result in R0
|
||||
|
@ -1237,7 +1237,7 @@
|
|||
|
||||
|
||||
;; process_sym
|
||||
;; Recieves Expression in R0 and an Environment in R1
|
||||
;; Receives Expression in R0 and an Environment in R1
|
||||
;; Returns symbol in R0
|
||||
:process_sym
|
||||
CALLI R15 @assoc ; ASSOC to get tmp
|
||||
|
@ -1258,7 +1258,7 @@
|
|||
|
||||
|
||||
;; process_if
|
||||
;; Recieves Expression in R0 and an Environment in R1
|
||||
;; Receives Expression in R0 and an Environment in R1
|
||||
;; Returns the evaluation of the expression if true in R0
|
||||
;; Or the evaluation of the CDR of the expression
|
||||
:process_if
|
||||
|
@ -1278,7 +1278,7 @@
|
|||
|
||||
|
||||
;; process_setb
|
||||
;; Recieves Expression in R0 and an Environment in R1
|
||||
;; Receives Expression in R0 and an Environment in R1
|
||||
;; Sets the desired variable to desired value/type
|
||||
;; Returns the value/type in R0
|
||||
:process_setb
|
||||
|
@ -1297,7 +1297,7 @@
|
|||
|
||||
|
||||
;; process_let
|
||||
;; Recieves Expression in R0 and an Environment in R1
|
||||
;; Receives Expression in R0 and an Environment in R1
|
||||
;; Creates lexical closure and evaluates inside of it
|
||||
;; Returns the value/type in R0
|
||||
:process_let
|
||||
|
@ -1347,7 +1347,7 @@
|
|||
RET R15
|
||||
|
||||
;; process_cons
|
||||
;; Recieves Expression in R0 and an Environment in R1
|
||||
;; Receives Expression in R0 and an Environment in R1
|
||||
;; Returns the evaluation of whatever special used or
|
||||
;; The application of the evaluation in R0
|
||||
:process_cons
|
||||
|
@ -1448,7 +1448,7 @@
|
|||
|
||||
|
||||
;; prim_apply
|
||||
;; Recieves arglist in R0
|
||||
;; Receives arglist in R0
|
||||
;; Returns result of applying ARGS->CAR to ARGS->CDR->CAR
|
||||
:prim_apply_String
|
||||
"apply"
|
||||
|
@ -1468,7 +1468,7 @@
|
|||
|
||||
|
||||
;; nullp
|
||||
;; Recieves a CELL in R0
|
||||
;; Receives a CELL in R0
|
||||
;; Returns NIL if not NIL or TEE if NIL
|
||||
:nullp_String
|
||||
"null?"
|
||||
|
@ -1484,7 +1484,7 @@
|
|||
|
||||
|
||||
;; prim_sum
|
||||
;; Recieves a list in R0
|
||||
;; Receives a list in R0
|
||||
;; Adds all values and returns a Cell with result in R0
|
||||
:prim_sum_String
|
||||
"+"
|
||||
|
@ -1515,7 +1515,7 @@
|
|||
|
||||
|
||||
;; prim_sub
|
||||
;; Recieves a list in R0
|
||||
;; Receives a list in R0
|
||||
;; Subtracts all of the values and returns a Cell with the result in R0
|
||||
:prim_sub_String
|
||||
"-"
|
||||
|
@ -1548,7 +1548,7 @@
|
|||
|
||||
|
||||
;; prim_prod
|
||||
;; Recieves a list in R0
|
||||
;; Receives a list in R0
|
||||
;; Multiplies all of the values and returns a Cell with the result in R0
|
||||
:prim_prod_String
|
||||
"*"
|
||||
|
@ -1579,7 +1579,7 @@
|
|||
|
||||
|
||||
;; prim_div
|
||||
;; Recieves a list in R0
|
||||
;; Receives a list in R0
|
||||
;; Divides all of the values and returns a Cell with the result in R0
|
||||
:prim_div_String
|
||||
"/"
|
||||
|
@ -1612,7 +1612,7 @@
|
|||
|
||||
|
||||
;; prim_mod
|
||||
;; Recieves a list in R0
|
||||
;; Receives a list in R0
|
||||
;; Remainders all of the values and returns a Cell with the result in R0
|
||||
:prim_mod_String
|
||||
"mod"
|
||||
|
@ -1645,7 +1645,7 @@
|
|||
|
||||
|
||||
;; prim_and
|
||||
;; Recieves a list in R0
|
||||
;; Receives a list in R0
|
||||
;; ANDs all of the values and returns a Cell with the result in R0
|
||||
:prim_and_String
|
||||
"and"
|
||||
|
@ -1679,7 +1679,7 @@
|
|||
|
||||
|
||||
;; prim_or
|
||||
;; Recieves a list in R0
|
||||
;; Receives a list in R0
|
||||
;; ORs all of the values and returns a Cell with the result in R0
|
||||
:prim_or_String
|
||||
"or"
|
||||
|
@ -1713,7 +1713,7 @@
|
|||
|
||||
|
||||
;; prim_not
|
||||
;; Recieves a list in R0
|
||||
;; Receives a list in R0
|
||||
;; NOTs first of the values and returns a Cell with the result in R0
|
||||
:prim_not_String
|
||||
"not"
|
||||
|
@ -1736,7 +1736,7 @@
|
|||
|
||||
|
||||
;; prim_numgt
|
||||
;; Recieves a list in R0
|
||||
;; Receives a list in R0
|
||||
;; Compares values and returns a Cell with the result in R0
|
||||
:prim_numgt_String
|
||||
">"
|
||||
|
@ -1775,7 +1775,7 @@
|
|||
|
||||
|
||||
;; prim_numge
|
||||
;; Recieves a list in R0
|
||||
;; Receives a list in R0
|
||||
;; Compares values and returns a Cell with the result in R0
|
||||
:prim_numge_String
|
||||
">="
|
||||
|
@ -1814,7 +1814,7 @@
|
|||
|
||||
|
||||
;; prim_numeq
|
||||
;; Recieves a list in R0
|
||||
;; Receives a list in R0
|
||||
;; Compares values and returns a Cell with the result in R0
|
||||
:prim_numeq_String
|
||||
"="
|
||||
|
@ -1853,7 +1853,7 @@
|
|||
|
||||
|
||||
;; prim_numle
|
||||
;; Recieves a list in R0
|
||||
;; Receives a list in R0
|
||||
;; Compares values and returns a Cell with the result in R0
|
||||
:prim_numle_String
|
||||
"<="
|
||||
|
@ -1892,7 +1892,7 @@
|
|||
|
||||
|
||||
;; prim_numlt
|
||||
;; Recieves a list in R0
|
||||
;; Receives a list in R0
|
||||
;; Compares values and returns a Cell with the result in R0
|
||||
:prim_numlt_String
|
||||
"<"
|
||||
|
@ -1931,7 +1931,7 @@
|
|||
|
||||
|
||||
;; prim_listp
|
||||
;; Recieves a list in R0
|
||||
;; Receives a list in R0
|
||||
;; Compares values and returns a Cell with the result in R0
|
||||
:prim_listp_String
|
||||
"list?"
|
||||
|
@ -1955,7 +1955,7 @@
|
|||
|
||||
|
||||
;; prim_charp
|
||||
;; Recieves argslist in R0
|
||||
;; Receives argslist in R0
|
||||
;; Returns #t if CHAR else NIL
|
||||
:prim_charp_String
|
||||
"char?"
|
||||
|
@ -1979,7 +1979,7 @@
|
|||
|
||||
|
||||
;; prim_numberp
|
||||
;; Recieves argslist in R0
|
||||
;; Receives argslist in R0
|
||||
;; Returns #t if NUMBER else NIL
|
||||
:prim_numberp_String
|
||||
"number?"
|
||||
|
@ -2003,7 +2003,7 @@
|
|||
|
||||
|
||||
;; prim_symbolp
|
||||
;; Recieves argslist in R0
|
||||
;; Receives argslist in R0
|
||||
;; Returns #t if SYMBOL else NIL
|
||||
:prim_symbolp_String
|
||||
"symbol?"
|
||||
|
@ -2027,7 +2027,7 @@
|
|||
|
||||
|
||||
;; prim_stringp
|
||||
;; Recieves argslist in R0
|
||||
;; Receives argslist in R0
|
||||
;; Returns #t if CHAR else NIL
|
||||
:prim_stringp_String
|
||||
"string?"
|
||||
|
@ -2051,7 +2051,7 @@
|
|||
|
||||
|
||||
;; prim_output
|
||||
;; Recieves argslist in R0
|
||||
;; Receives argslist in R0
|
||||
;; Outputs to whatever is specified in R12 and returns TEE
|
||||
:prim_output
|
||||
PUSHR R1 R15 ; Protect R1
|
||||
|
@ -2092,7 +2092,7 @@
|
|||
|
||||
|
||||
;; prim_output_INT
|
||||
;; Recieves an INT CELL in R0 and desired Output in R1
|
||||
;; Receives an INT CELL in R0 and desired Output in R1
|
||||
;; Outputs value and returns
|
||||
:prim_output_INT
|
||||
PUSHR R0 R15 ; Protect R0
|
||||
|
@ -2105,7 +2105,7 @@
|
|||
|
||||
|
||||
;; prim_output_SYM
|
||||
;; Recieves a SYM CELL in R0 and desired Output in R1
|
||||
;; Receives a SYM CELL in R0 and desired Output in R1
|
||||
;; Outputs string and returns
|
||||
:prim_output_SYM
|
||||
PUSHR R0 R15 ; Protect R0
|
||||
|
@ -2118,7 +2118,7 @@
|
|||
|
||||
|
||||
;; prim_output_CHAR
|
||||
;; Recieves an CHAR CELL in R0 and desired Output in R1
|
||||
;; Receives an CHAR CELL in R0 and desired Output in R1
|
||||
;; Outputs Last CHAR and returns
|
||||
:prim_output_CHAR
|
||||
PUSHR R0 R15 ; Protect R0
|
||||
|
@ -2131,7 +2131,7 @@
|
|||
|
||||
|
||||
;; prim_stringeq
|
||||
;; Recieves a list in R0
|
||||
;; Receives a list in R0
|
||||
;; Compares strings and returns a Cell with the result in R0
|
||||
:prim_stringeq_String
|
||||
"string=?"
|
||||
|
@ -2173,7 +2173,7 @@
|
|||
|
||||
|
||||
;; prim_display
|
||||
;; Recieves argslist in R0
|
||||
;; Receives argslist in R0
|
||||
;; Outputs to TTY R12 and returns TEE
|
||||
:prim_display_String
|
||||
"display"
|
||||
|
@ -2183,7 +2183,7 @@
|
|||
|
||||
|
||||
;; prim_write
|
||||
;; Recieves argslist in R0
|
||||
;; Receives argslist in R0
|
||||
;; Write to Tape_02 and returns TEE
|
||||
:prim_write_String
|
||||
"write"
|
||||
|
@ -2195,7 +2195,7 @@
|
|||
|
||||
|
||||
;; prim_freecell
|
||||
;; Recieves either NIL or a list in R0
|
||||
;; Receives either NIL or a list in R0
|
||||
;; If NIL displays header, otherwise just returns number of free cells in R0
|
||||
:prim_freecell_String
|
||||
"free_mem"
|
||||
|
@ -2221,7 +2221,7 @@
|
|||
|
||||
|
||||
;; prim_integer_to_char
|
||||
;; Recieves a list in R0
|
||||
;; Receives a list in R0
|
||||
;; Converts INT to CHAR
|
||||
:prim_integer_to_char_String
|
||||
"integer->char"
|
||||
|
@ -2243,7 +2243,7 @@
|
|||
|
||||
|
||||
;; prim_char_to_integer
|
||||
;; Recieves a list in R0
|
||||
;; Receives a list in R0
|
||||
;; Converts CHAR to INT
|
||||
:prim_char_to_integer_String
|
||||
"char->integer"
|
||||
|
@ -2265,7 +2265,7 @@
|
|||
|
||||
|
||||
;; string_to_list
|
||||
;; Recieves a pointer to string in R0
|
||||
;; Receives a pointer to string in R0
|
||||
;; Returns a list of chars
|
||||
:string_to_list
|
||||
CMPSKIPI.NE R0 $NIL ; If NIL Expression
|
||||
|
@ -2294,7 +2294,7 @@
|
|||
|
||||
|
||||
;; prim_string_to_list
|
||||
;; Recieves a pointer to a CONS whose CAR should be a STRING
|
||||
;; Receives a pointer to a CONS whose CAR should be a STRING
|
||||
;; Returns a list of CHARs in R0
|
||||
:prim_string_to_list_String
|
||||
"string->list"
|
||||
|
@ -2322,7 +2322,7 @@
|
|||
|
||||
|
||||
;; list_to_string
|
||||
;; Recieves an index in R0, a String pointer in R1
|
||||
;; Receives an index in R0, a String pointer in R1
|
||||
;; And a list of arguments in R2
|
||||
;; Alters only R0
|
||||
:list_to_string
|
||||
|
@ -2368,7 +2368,7 @@
|
|||
|
||||
|
||||
;; prim_list_to_string
|
||||
;; Recieves a list in R0
|
||||
;; Receives a list in R0
|
||||
;; Returns a String CELL in R0
|
||||
:prim_list_to_string_String
|
||||
"list->string"
|
||||
|
@ -2411,7 +2411,7 @@
|
|||
|
||||
|
||||
;; prim_cons
|
||||
;; Recieves an arglist in R0 and returns a CONS in R0
|
||||
;; Receives an arglist in R0 and returns a CONS in R0
|
||||
:prim_cons_String
|
||||
"cons"
|
||||
:prim_cons
|
||||
|
@ -2425,7 +2425,7 @@
|
|||
|
||||
|
||||
;; prim_car
|
||||
;; Recieves an arglist in R0 and returns the CAR in R0
|
||||
;; Receives an arglist in R0 and returns the CAR in R0
|
||||
:prim_car_String
|
||||
"car"
|
||||
:prim_car
|
||||
|
@ -2437,7 +2437,7 @@
|
|||
|
||||
|
||||
;; prim_cdr
|
||||
;; Recieves an arglist in R0 and returns the CDR in R0
|
||||
;; Receives an arglist in R0 and returns the CDR in R0
|
||||
:prim_cdr_String
|
||||
"cdr"
|
||||
:prim_cdr
|
||||
|
@ -2449,7 +2449,7 @@
|
|||
|
||||
|
||||
;; spinup
|
||||
;; Recieves a symbol in R0 and a primitive in R1
|
||||
;; Receives a symbol in R0 and a primitive in R1
|
||||
;; Returns nothing but CONS both to all_symbols and top_env
|
||||
:spinup
|
||||
PUSHR R0 R15 ; Protect R0
|
||||
|
@ -2615,7 +2615,7 @@
|
|||
|
||||
|
||||
;; Global init function
|
||||
;; Recieves nothing
|
||||
;; Receives nothing
|
||||
;; Returns nothing
|
||||
;; sets up all_symbols and top_env
|
||||
:init_sl3
|
||||
|
@ -2903,14 +2903,14 @@
|
|||
NOP
|
||||
|
||||
;; cells_remaining
|
||||
;; Recieves nothing and returns number of remaining cells in R0
|
||||
;; Receives nothing and returns number of remaining cells in R0
|
||||
:cells_remaining
|
||||
LOADR R0 @left_to_take ; Get number of cells left
|
||||
RET R15
|
||||
|
||||
|
||||
;; update_remaining
|
||||
;; Recieves nothing
|
||||
;; Receives nothing
|
||||
;; Returns nothing
|
||||
;; Updates left_to_take via counting
|
||||
:update_remaining
|
||||
|
@ -2943,7 +2943,7 @@
|
|||
|
||||
|
||||
;; insert_ordered
|
||||
;; Recieves a cell and a list of cells in R0 and R1
|
||||
;; Receives a cell and a list of cells in R0 and R1
|
||||
;; Inserts cell into the list from lowest to highest
|
||||
;; Returns resulting list in R0
|
||||
:insert_ordered
|
||||
|
@ -2964,7 +2964,7 @@
|
|||
|
||||
|
||||
;; reclaim_marked
|
||||
;; Recieves nothing
|
||||
;; Receives nothing
|
||||
;; Returns nothing
|
||||
;; Reclaims and updates free_cells
|
||||
:reclaim_marked
|
||||
|
@ -3006,7 +3006,7 @@
|
|||
|
||||
|
||||
;; mark_all_cells
|
||||
;; Recieves nothing
|
||||
;; Receives nothing
|
||||
;; Returns nothing
|
||||
;; Marks all unfree cells
|
||||
:mark_all_cells
|
||||
|
@ -3040,7 +3040,7 @@
|
|||
|
||||
|
||||
;; unmark_cells
|
||||
;; Recieves a List in R0 and R1 and a Count in R2
|
||||
;; Receives a List in R0 and R1 and a Count in R2
|
||||
;; Returns nothing
|
||||
;; Unmarks all connected Cells
|
||||
:unmark_cells
|
||||
|
@ -3101,7 +3101,7 @@
|
|||
|
||||
|
||||
;; relocate_cell
|
||||
;; Recieves a current, target and List in R0, R1 and R2
|
||||
;; Receives a current, target and List in R0, R1 and R2
|
||||
;; Returns nothing
|
||||
;; Relocate all references to a cell and walks down list
|
||||
:relocate_cell
|
||||
|
@ -3154,7 +3154,7 @@
|
|||
|
||||
|
||||
;; compact
|
||||
;; Recieves a List in R0
|
||||
;; Receives a List in R0
|
||||
;; Returns nothing
|
||||
;; Finds cells to relocate and has all references updated
|
||||
:compact
|
||||
|
@ -3225,7 +3225,7 @@
|
|||
|
||||
|
||||
;; garbage_collect
|
||||
;; Recieves nothing
|
||||
;; Receives nothing
|
||||
;; Returns nothing
|
||||
;; The Core of Garbage Collection
|
||||
:garbage_collect
|
||||
|
@ -3256,7 +3256,7 @@
|
|||
|
||||
|
||||
;; garbage_init
|
||||
;; Recieves nothing
|
||||
;; Receives nothing
|
||||
;; Returns nothing
|
||||
;; Initializes Garbage Heap
|
||||
:garbage_init
|
||||
|
@ -3279,7 +3279,7 @@
|
|||
|
||||
|
||||
;; pop_cons
|
||||
;; Recieves nothing
|
||||
;; Receives nothing
|
||||
;; Returns a Free CONS in R0
|
||||
;; Updates left_to_take
|
||||
:pop_cons
|
||||
|
@ -3310,7 +3310,7 @@
|
|||
|
||||
|
||||
;; make_int
|
||||
;; Recieves an Integer in R0
|
||||
;; Receives an Integer in R0
|
||||
;; Returns a CELL in R0
|
||||
:make_int
|
||||
PUSHR R1 R15 ; Protect R1
|
||||
|
@ -3324,7 +3324,7 @@
|
|||
|
||||
|
||||
;; make_char
|
||||
;; Recieves a CHAR in R0
|
||||
;; Receives a CHAR in R0
|
||||
;; Returns a CELL in R0
|
||||
:make_char
|
||||
PUSHR R1 R15 ; Protect R1
|
||||
|
@ -3338,7 +3338,7 @@
|
|||
|
||||
|
||||
;; make_string
|
||||
;; Recieves a string pointer in R0
|
||||
;; Receives a string pointer in R0
|
||||
;; Returns a CELL in R0
|
||||
:make_string
|
||||
PUSHR R1 R15 ; Protect R1
|
||||
|
@ -3352,7 +3352,7 @@
|
|||
|
||||
|
||||
;; make_sym
|
||||
;; Recieves a string pointer in R0
|
||||
;; Receives a string pointer in R0
|
||||
;; Returns a Cell in R0
|
||||
:make_sym
|
||||
PUSHR R1 R15 ; Protect R1
|
||||
|
@ -3366,7 +3366,7 @@
|
|||
|
||||
|
||||
;; make_cons
|
||||
;; Recieves a Cell in R0 and R1
|
||||
;; Receives a Cell in R0 and R1
|
||||
;; Returns a combined Cell in R0
|
||||
:make_cons
|
||||
PUSHR R2 R15 ; Protect R2
|
||||
|
@ -3381,7 +3381,7 @@
|
|||
|
||||
|
||||
;; make_proc
|
||||
;; Recieves Cells in R0, R1 and R2
|
||||
;; Receives Cells in R0, R1 and R2
|
||||
;; Returns a combined Cell in R0
|
||||
:make_proc
|
||||
PUSHR R3 R15 ; Protect R3
|
||||
|
@ -3397,7 +3397,7 @@
|
|||
|
||||
|
||||
;; make_prim
|
||||
;; Recieves pointer to function in R0
|
||||
;; Receives pointer to function in R0
|
||||
;; Returns a Cell in R0
|
||||
:make_prim
|
||||
PUSHR R1 R15 ; Protect R1
|
||||
|
|
|
@ -869,7 +869,7 @@ int escape_lookup(char* c)
|
|||
else if(c[1] == '\'') return 39;
|
||||
else if(c[1] == '\\') return 92;
|
||||
|
||||
file_print("Unknown escape recieved: ", stderr);
|
||||
file_print("Unknown escape received: ", stderr);
|
||||
file_print(c, stderr);
|
||||
file_print(" Unable to process\n", stderr);
|
||||
exit(EXIT_FAILURE);
|
||||
|
@ -1428,7 +1428,7 @@ void global_load(struct token_list* a)
|
|||
void primary_expr_failure()
|
||||
{
|
||||
line_error();
|
||||
file_print("Recieved ", stderr);
|
||||
file_print("Received ", stderr);
|
||||
file_print(global_token->s, stderr);
|
||||
file_print(" in primary_expr\n", stderr);
|
||||
exit(EXIT_FAILURE);
|
||||
|
@ -2344,7 +2344,7 @@ new_type:
|
|||
else
|
||||
{
|
||||
line_error();
|
||||
file_print("Recieved ", stderr);
|
||||
file_print("Received ", stderr);
|
||||
file_print(global_token->s, stderr);
|
||||
file_print(" in program\n", stderr);
|
||||
exit(EXIT_FAILURE);
|
||||
|
@ -2356,7 +2356,7 @@ new_type:
|
|||
else
|
||||
{
|
||||
line_error();
|
||||
file_print("Recieved ", stderr);
|
||||
file_print("Received ", stderr);
|
||||
file_print(global_token->s, stderr);
|
||||
file_print(" in program\n", stderr);
|
||||
exit(EXIT_FAILURE);
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
695698ebc7ed1d3acbcded1bd832a6b49b9a7c2a37c216a9fccdc0e89e976e99 roms/CAT
|
||||
12bb96de936fff18b27c2382ddcee2db6afb6a94b9f4c6e9e9b3d1d0d0d3b0ed roms/cc_x86
|
||||
d04462af441ec9c2d23080b654b4cc30f34cc27b09669146db02be7652ffdf81 roms/cc_x86
|
||||
662b14485df5da61c3f5ad63151932985914b2fe074c21798e20ba2d83b45ecc roms/DEHEX
|
||||
f4bbf9e9c4828170d0c153ac265382dc705643f95efd2a029243326d426be5a4 roms/forth
|
||||
2b80849180d5fb3757bcca2471b6337808e5b5ca80b18d93fa82ddef0435b84b roms/lisp
|
||||
96ade767f30e3d9037a6c597cefb103942c8ec104264a3551017f091b10646e1 roms/lisp
|
||||
3020b194ead31ae19ba66fc35ed95465514373f6005896350d1608c9efabbdca roms/M0
|
||||
059d38e34275029f2de5f600f08fe01bd13cd173f7da58e3fbec7114074beff2 roms/SET
|
||||
a551568d72804a2de6f6f94fcb507452e9d672c7638beb170dde84a9bf7fb82a roms/stage0_monitor
|
||||
|
|
Loading…
Reference in New Issue