diff options
Diffstat (limited to 'quine.asm')
| -rw-r--r-- | quine.asm | 58 |
1 files changed, 48 insertions, 10 deletions
diff --git a/quine.asm b/quine.asm index 0a5d96d..155bca5 100644 --- a/quine.asm +++ b/quine.asm @@ -7094,17 +7094,33 @@ cold_start: dq lit, 0, early_comma dq litstring, "!=", early_find, entry_to_execution_token, early_comma dq litstring, "0branch", early_find, entry_to_execution_token, early_comma - dq lit, 6*8, early_comma + dq lit, 16*8, early_comma - ; If the word is in the dictionary, run it. + ; If the word is in the dictionary, get the execution token, then... dq litstring, "dropstring-with-result", early_find, entry_to_execution_token dq early_comma dq litstring, "entry-to-execution-token", 0, early_find dq entry_to_execution_token, early_comma - dq litstring, "execute", early_find, entry_to_execution_token, early_comma + dq litstring, "interpreter-flags", early_find, entry_to_execution_token + dq early_comma + dq litstring, "@", early_find, entry_to_execution_token, early_comma + dq litstring, "lit", early_find, entry_to_execution_token, early_comma + dq lit, 0x01, early_comma + dq litstring, "and", early_find, entry_to_execution_token, early_comma + dq litstring, "0branch", early_find, entry_to_execution_token, early_comma + dq lit, 4*8, early_comma + + ; ... if we're in compile mode, append it to the heap. + dq litstring, ",", early_find, entry_to_execution_token, early_comma + ; o/~ Like a whirlpool and it never ends. o/~ dq litstring, "branch", early_find, entry_to_execution_token, early_comma + dq lit, -28*8, early_comma + + ; ... if we're in interpret mode, run it. + dq litstring, "execute", early_find, entry_to_execution_token, early_comma ; o/~ Like a whirlpool and it never ends. o/~ - dq lit, -21*8, early_comma + dq litstring, "branch", early_find, entry_to_execution_token, early_comma + dq lit, -31*8, early_comma ; ... ; If it's not in the dictionary, check whether it's a decimal number. dq litstring, "drop", early_find, entry_to_execution_token, early_comma @@ -7117,16 +7133,38 @@ cold_start: dq lit, 0, early_comma dq litstring, "=", early_find, entry_to_execution_token, early_comma dq litstring, "0branch", early_find, entry_to_execution_token, early_comma - dq lit, 4*8, early_comma + dq lit, 17*8, early_comma - ; It's a number; push it to the stack. Or at least, that's what the code - ; we're interpreting will see. Really it's already on the stack, just clean - ; everything else up and leave it there. - dq litstring, "dropstring-with-result", early_find, entry_to_execution_token + ; It's a number. + dq litstring, "interpreter-flags", early_find, entry_to_execution_token dq early_comma + dq litstring, "@", early_find, entry_to_execution_token, early_comma + dq litstring, "lit", early_find, entry_to_execution_token, early_comma + dq lit, 0x01, early_comma + dq litstring, "and", early_find, entry_to_execution_token, early_comma + dq litstring, "0branch", early_find, entry_to_execution_token, early_comma + dq lit, 7*8, early_comma + + ; We're in compile mode; append first "lit", then the number, to the heap. + ; The version of "lit" we use is the one that's current when we ourselves + ; are compiled, hardcoded; doing a dynamic lookup would require dealing with + ; what happens if it's not found. + dq litstring, "lit", early_find, entry_to_execution_token, early_comma + dq litstring, "lit", early_find, entry_to_execution_token, early_comma + dq litstring, ",", early_find, entry_to_execution_token, early_comma + dq litstring, ",", early_find, entry_to_execution_token, early_comma + ; o/~ Like a whirlpool and it never ends. o/~ dq litstring, "branch", early_find, entry_to_execution_token, early_comma + dq lit, -52*8, early_comma + + ; We're in interpret mode; push the number to the stack. Or at least, that's + ; what the code we're interpreting will see. Really it's already on the + ; stack, just clean everything else up and leave it there. + dq litstring, "dropstring-with-result", early_find, entry_to_execution_token + dq early_comma ; o/~ Like a whirlpool and it never ends. o/~ - dq lit, -32*8, early_comma + dq litstring, "branch", early_find, entry_to_execution_token, early_comma + dq lit, -55*8, early_comma ; If it's neither in the dictionary nor a number, exit. dq litstring, "dropstring", early_find, entry_to_execution_token |