diff options
Diffstat (limited to 'quine.asm')
| -rw-r--r-- | quine.asm | 89 |
1 files changed, 46 insertions, 43 deletions
diff --git a/quine.asm b/quine.asm index a2cb18f..0d9e38d 100644 --- a/quine.asm +++ b/quine.asm @@ -2299,14 +2299,14 @@ cold_start: dq rax, push_reg64 dq pack_next, lit, 8, packalign, early_here_store - dq litstring, "and", early_create, early_self_codeword, early_here, fetch + dq litstring, "&", early_create, early_self_codeword, early_here, fetch dq rbx, pop_reg64 dq rax, pop_reg64 dq rbx, rax, and_reg64_reg64 dq rax, push_reg64 dq pack_next, lit, 8, packalign, early_here_store - dq litstring, "or", early_create, early_self_codeword, early_here, fetch + dq litstring, "|", early_create, early_self_codeword, early_here, fetch dq rbx, pop_reg64 dq rax, pop_reg64 dq rbx, rax, or_reg64_reg64 @@ -3837,13 +3837,13 @@ cold_start: dq early_here, fetch, lit, 8, packalign, early_here_store dq litstring, "opcodereg", early_create, early_docol_codeword - dq litstring, "or", early_find, entry_to_execution_token, early_comma + dq litstring, "|", early_find, entry_to_execution_token, early_comma dq litstring, "pack8", early_find, entry_to_execution_token, early_comma dq litstring, "exit", early_find, entry_to_execution_token, early_comma dq early_here, fetch, lit, 8, packalign, early_here_store dq litstring, "opcodecc", 0, early_create, early_docol_codeword - dq litstring, "or", early_find, entry_to_execution_token, early_comma + dq litstring, "|", early_find, entry_to_execution_token, early_comma dq litstring, "pack8", early_find, entry_to_execution_token, early_comma dq litstring, "exit", early_find, entry_to_execution_token, early_comma dq early_here, fetch, lit, 8, packalign, early_here_store @@ -3853,12 +3853,12 @@ cold_start: dq litstring, "lit", early_find, entry_to_execution_token, early_comma dq lit, 8, early_comma dq litstring, "*", early_find, entry_to_execution_token, early_comma - dq litstring, "or", early_find, entry_to_execution_token, early_comma + dq litstring, "|", early_find, entry_to_execution_token, early_comma dq litstring, "swap", early_find, entry_to_execution_token, early_comma dq litstring, "lit", early_find, entry_to_execution_token, early_comma dq lit, 64, early_comma dq litstring, "*", early_find, entry_to_execution_token, early_comma - dq litstring, "or", early_find, entry_to_execution_token, early_comma + dq litstring, "|", early_find, entry_to_execution_token, early_comma dq litstring, "pack8", early_find, entry_to_execution_token, early_comma dq litstring, "exit", early_find, entry_to_execution_token, early_comma dq early_here, fetch, lit, 8, packalign, early_here_store @@ -3868,12 +3868,12 @@ cold_start: dq litstring, "lit", early_find, entry_to_execution_token, early_comma dq lit, 8, early_comma dq litstring, "*", early_find, entry_to_execution_token, early_comma - dq litstring, "or", early_find, entry_to_execution_token, early_comma + dq litstring, "|", early_find, entry_to_execution_token, early_comma dq litstring, "swap", early_find, entry_to_execution_token, early_comma dq litstring, "lit", early_find, entry_to_execution_token, early_comma dq lit, 64, early_comma dq litstring, "*", early_find, entry_to_execution_token, early_comma - dq litstring, "or", early_find, entry_to_execution_token, early_comma + dq litstring, "|", early_find, entry_to_execution_token, early_comma dq litstring, "pack8", early_find, entry_to_execution_token, early_comma dq litstring, "exit", early_find, entry_to_execution_token, early_comma dq early_here, fetch, lit, 8, packalign, early_here_store @@ -5599,7 +5599,7 @@ cold_start: dq litstring, "lit", early_find, entry_to_execution_token, early_comma dq lit, 7, early_comma dq litstring, "invert", early_find, entry_to_execution_token, early_comma - dq litstring, "and", early_find, entry_to_execution_token, early_comma + dq litstring, "&", early_find, entry_to_execution_token, early_comma dq litstring, "exit", early_find, entry_to_execution_token, early_comma dq early_here, fetch, lit, 8, packalign, early_here_store @@ -5631,7 +5631,7 @@ cold_start: dq litstring, "@", early_find, entry_to_execution_token, early_comma dq litstring, "lit", early_find, entry_to_execution_token, early_comma dq lit, 0xFF, early_comma - dq litstring, "and", early_find, entry_to_execution_token, early_comma + dq litstring, "&", early_find, entry_to_execution_token, early_comma dq litstring, "exit", early_find, entry_to_execution_token, early_comma dq early_here, fetch, lit, 8, packalign, early_here_store @@ -5647,12 +5647,12 @@ cold_start: dq litstring, "3roll", early_find, entry_to_execution_token, early_comma dq litstring, "lit", early_find, entry_to_execution_token, early_comma dq lit, 0xFF, early_comma - dq litstring, "and", early_find, entry_to_execution_token, early_comma + dq litstring, "&", early_find, entry_to_execution_token, early_comma dq litstring, "swap", early_find, entry_to_execution_token, early_comma dq litstring, "lit", early_find, entry_to_execution_token, early_comma dq lit, 0xFFFFFFFFFFFFFF00, early_comma - dq litstring, "and", early_find, entry_to_execution_token, early_comma - dq litstring, "or", 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 dq litstring, "swap", early_find, entry_to_execution_token, early_comma dq litstring, "!", early_find, entry_to_execution_token, early_comma dq litstring, "exit", early_find, entry_to_execution_token, early_comma @@ -5683,7 +5683,7 @@ cold_start: dq early_comma dq litstring, "lit", early_find, entry_to_execution_token, early_comma dq lit, 0x80, early_comma - dq litstring, "and", early_find, entry_to_execution_token, 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, 0x80, early_comma dq litstring, "!=", early_find, entry_to_execution_token, early_comma @@ -5736,7 +5736,7 @@ cold_start: dq 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, "&", 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, "=", early_find, entry_to_execution_token, early_comma @@ -6663,7 +6663,7 @@ cold_start: dq litstring, "dup", early_find, entry_to_execution_token, early_comma dq litstring, "lit", early_find, entry_to_execution_token, early_comma dq lit, 0x00000000000000FF, early_comma - dq litstring, "and", early_find, entry_to_execution_token, 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, 0, early_comma dq litstring, "=", early_find, entry_to_execution_token, early_comma @@ -6671,7 +6671,7 @@ cold_start: dq lit, 6*8, early_comma ; (string so far, new character byte, address of final word, old value) dq litstring, "3roll", early_find, entry_to_execution_token, early_comma - dq litstring, "or", early_find, entry_to_execution_token, early_comma + dq litstring, "|", early_find, entry_to_execution_token, early_comma dq litstring, "swap", early_find, entry_to_execution_token, early_comma dq litstring, "!", early_find, entry_to_execution_token, early_comma dq litstring, "exit", early_find, entry_to_execution_token, early_comma @@ -6683,7 +6683,7 @@ cold_start: dq litstring, "dup", early_find, entry_to_execution_token, early_comma dq litstring, "lit", early_find, entry_to_execution_token, early_comma dq lit, 0x000000000000FF00, early_comma - dq litstring, "and", early_find, entry_to_execution_token, 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, 0, early_comma dq litstring, "=", early_find, entry_to_execution_token, early_comma @@ -6694,7 +6694,7 @@ cold_start: dq litstring, "lit", early_find, entry_to_execution_token, early_comma dq lit, 0x0000000000000100, early_comma dq litstring, "*", early_find, entry_to_execution_token, early_comma - dq litstring, "or", early_find, entry_to_execution_token, early_comma + dq litstring, "|", early_find, entry_to_execution_token, early_comma dq litstring, "swap", early_find, entry_to_execution_token, early_comma dq litstring, "!", early_find, entry_to_execution_token, early_comma dq litstring, "exit", early_find, entry_to_execution_token, early_comma @@ -6704,7 +6704,7 @@ cold_start: dq litstring, "dup", early_find, entry_to_execution_token, early_comma dq litstring, "lit", early_find, entry_to_execution_token, early_comma dq lit, 0x0000000000FF0000, early_comma - dq litstring, "and", early_find, entry_to_execution_token, 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, 0, early_comma dq litstring, "=", early_find, entry_to_execution_token, early_comma @@ -6715,7 +6715,7 @@ cold_start: dq litstring, "lit", early_find, entry_to_execution_token, early_comma dq lit, 0x0000000000010000, early_comma dq litstring, "*", early_find, entry_to_execution_token, early_comma - dq litstring, "or", early_find, entry_to_execution_token, early_comma + dq litstring, "|", early_find, entry_to_execution_token, early_comma dq litstring, "swap", early_find, entry_to_execution_token, early_comma dq litstring, "!", early_find, entry_to_execution_token, early_comma dq litstring, "exit", early_find, entry_to_execution_token, early_comma @@ -6725,7 +6725,7 @@ cold_start: dq litstring, "dup", early_find, entry_to_execution_token, early_comma dq litstring, "lit", early_find, entry_to_execution_token, early_comma dq lit, 0x00000000FF000000, early_comma - dq litstring, "and", early_find, entry_to_execution_token, 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, 0, early_comma dq litstring, "=", early_find, entry_to_execution_token, early_comma @@ -6736,7 +6736,7 @@ cold_start: dq litstring, "lit", early_find, entry_to_execution_token, early_comma dq lit, 0x0000000001000000, early_comma dq litstring, "*", early_find, entry_to_execution_token, early_comma - dq litstring, "or", early_find, entry_to_execution_token, early_comma + dq litstring, "|", early_find, entry_to_execution_token, early_comma dq litstring, "swap", early_find, entry_to_execution_token, early_comma dq litstring, "!", early_find, entry_to_execution_token, early_comma dq litstring, "exit", early_find, entry_to_execution_token, early_comma @@ -6746,7 +6746,7 @@ cold_start: dq litstring, "dup", early_find, entry_to_execution_token, early_comma dq litstring, "lit", early_find, entry_to_execution_token, early_comma dq lit, 0x000000FF00000000, early_comma - dq litstring, "and", early_find, entry_to_execution_token, 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, 0, early_comma dq litstring, "=", early_find, entry_to_execution_token, early_comma @@ -6757,7 +6757,7 @@ cold_start: dq litstring, "lit", early_find, entry_to_execution_token, early_comma dq lit, 0x0000000100000000, early_comma dq litstring, "*", early_find, entry_to_execution_token, early_comma - dq litstring, "or", early_find, entry_to_execution_token, early_comma + dq litstring, "|", early_find, entry_to_execution_token, early_comma dq litstring, "swap", early_find, entry_to_execution_token, early_comma dq litstring, "!", early_find, entry_to_execution_token, early_comma dq litstring, "exit", early_find, entry_to_execution_token, early_comma @@ -6767,7 +6767,7 @@ cold_start: dq litstring, "dup", early_find, entry_to_execution_token, early_comma dq litstring, "lit", early_find, entry_to_execution_token, early_comma dq lit, 0x0000FF0000000000, early_comma - dq litstring, "and", early_find, entry_to_execution_token, 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, 0, early_comma dq litstring, "=", early_find, entry_to_execution_token, early_comma @@ -6778,7 +6778,7 @@ cold_start: dq litstring, "lit", early_find, entry_to_execution_token, early_comma dq lit, 0x0000010000000000, early_comma dq litstring, "*", early_find, entry_to_execution_token, early_comma - dq litstring, "or", early_find, entry_to_execution_token, early_comma + dq litstring, "|", early_find, entry_to_execution_token, early_comma dq litstring, "swap", early_find, entry_to_execution_token, early_comma dq litstring, "!", early_find, entry_to_execution_token, early_comma dq litstring, "exit", early_find, entry_to_execution_token, early_comma @@ -6788,7 +6788,7 @@ cold_start: dq litstring, "dup", early_find, entry_to_execution_token, early_comma dq litstring, "lit", early_find, entry_to_execution_token, early_comma dq lit, 0x00FF000000000000, early_comma - dq litstring, "and", early_find, entry_to_execution_token, 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, 0, early_comma dq litstring, "=", early_find, entry_to_execution_token, early_comma @@ -6799,7 +6799,7 @@ cold_start: dq litstring, "lit", early_find, entry_to_execution_token, early_comma dq lit, 0x0001000000000000, early_comma dq litstring, "*", early_find, entry_to_execution_token, early_comma - dq litstring, "or", early_find, entry_to_execution_token, early_comma + dq litstring, "|", early_find, entry_to_execution_token, early_comma dq litstring, "swap", early_find, entry_to_execution_token, early_comma dq litstring, "!", early_find, entry_to_execution_token, early_comma dq litstring, "exit", early_find, entry_to_execution_token, early_comma @@ -6823,7 +6823,7 @@ cold_start: dq litstring, "lit", early_find, entry_to_execution_token, early_comma dq lit, 0x0100000000000000, early_comma dq litstring, "*", early_find, entry_to_execution_token, early_comma - dq litstring, "or", early_find, entry_to_execution_token, early_comma + dq litstring, "|", early_find, entry_to_execution_token, early_comma dq litstring, "swap", early_find, entry_to_execution_token, early_comma ; (string so far, new value, address of final word) dq litstring, "lit", early_find, entry_to_execution_token, early_comma @@ -7091,7 +7091,7 @@ cold_start: dq early_comma dq litstring, "lit", early_find, entry_to_execution_token, early_comma dq lit, 0x80, early_comma - dq litstring, "or", early_find, entry_to_execution_token, early_comma + dq litstring, "|", early_find, entry_to_execution_token, early_comma dq litstring, "entry-flags!", early_find, entry_to_execution_token dq early_comma dq litstring, "exit", early_find, entry_to_execution_token, early_comma @@ -7105,7 +7105,7 @@ cold_start: dq litstring, "lit", early_find, entry_to_execution_token, early_comma dq lit, 0x80, early_comma dq litstring, "invert", early_find, entry_to_execution_token, early_comma - dq litstring, "and", early_find, entry_to_execution_token, early_comma + dq litstring, "&", early_find, entry_to_execution_token, early_comma dq litstring, "entry-flags!", early_find, entry_to_execution_token dq early_comma dq litstring, "exit", early_find, entry_to_execution_token, early_comma @@ -7118,7 +7118,7 @@ cold_start: dq early_comma dq litstring, "lit", early_find, entry_to_execution_token, early_comma dq lit, 0x01, early_comma - dq litstring, "or", early_find, entry_to_execution_token, early_comma + dq litstring, "|", early_find, entry_to_execution_token, early_comma dq litstring, "entry-flags!", early_find, entry_to_execution_token dq early_comma dq litstring, "exit", early_find, entry_to_execution_token, early_comma @@ -7132,7 +7132,7 @@ cold_start: dq litstring, "lit", early_find, entry_to_execution_token, early_comma dq lit, 0x01, early_comma dq litstring, "invert", early_find, entry_to_execution_token, early_comma - dq litstring, "and", early_find, entry_to_execution_token, early_comma + dq litstring, "&", early_find, entry_to_execution_token, early_comma dq litstring, "interpreter-flags", early_find dq entry_to_execution_token, early_comma dq litstring, "!", early_find, entry_to_execution_token, early_comma @@ -7150,7 +7150,7 @@ cold_start: 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, "or", early_find, entry_to_execution_token, early_comma + dq litstring, "|", early_find, entry_to_execution_token, early_comma dq litstring, "interpreter-flags", early_find dq entry_to_execution_token, early_comma dq litstring, "!", early_find, entry_to_execution_token, early_comma @@ -7249,7 +7249,7 @@ cold_start: 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, "&", early_find, entry_to_execution_token, early_comma dq litstring, "0branch", early_find, entry_to_execution_token, early_comma dq lit, 14*8, early_comma @@ -7259,7 +7259,7 @@ cold_start: dq litstring, "entry-flags@", early_find, entry_to_execution_token, early_comma dq litstring, "lit", early_find, entry_to_execution_token, early_comma dq lit, 1, early_comma - dq litstring, "and", early_find, entry_to_execution_token, 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, 0, early_comma dq litstring, "=", early_find, entry_to_execution_token, early_comma @@ -7296,7 +7296,7 @@ cold_start: 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, "&", 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 @@ -11090,7 +11090,7 @@ defword boot_source, 0x40 ; implementation of "if" below relies on "'" several times, whereas "'" only ; branches once. So we bootstrap "'" first. dq ": ' word value@ find dropstring-with-result " - dq " interpreter-flags @ 1 and 0branch [ 2 8 * , ] literal " + dq " interpreter-flags @ 1 & 0branch [ 2 8 * , ] literal " dq " ; make-immediate " ; Sooner or later we'll want to define recursive words; this one lets us @@ -11205,8 +11205,9 @@ defword boot_source, 0x40 dq " 6 8 * + swap drop + swap drop -1 * , " dq " ; make-immediate " - ; This use of bitwise and is valid because the inputs are 0 or 1. - dq ": is-in-heap dup heap @ <= swap here @ > and ; " + ; This use of bitwise and is okay because they're both either 0 or 1. + ; We'll have logical and real soon now, be patient... :) + dq ": is-in-heap dup heap @ <= swap here @ > & ; " dq ": unlink-pre-heap-words " dq " latest @ " @@ -11215,7 +11216,7 @@ defword boot_source, 0x40 dq " { dup @ is-in-heap } { @ } while " dq " 0 swap ! ; " ; Do it immediately, so that we don't accidentally rely on any of that. - ;dq "unlink-pre-heap-words " + dq "unlink-pre-heap-words " ; Now some fancier stack combinators. ; @@ -11227,6 +11228,8 @@ defword boot_source, 0x40 dq ": max 2dup >= { swap drop } { drop } if-else ; " dq ": min 2dup <= { swap drop } { drop } if-else ; " + dq ": && * 0 != ; " + dq ": || | 0 != ; " dq ": not 0 = ; " dq ": negate -1 * ; " @@ -11257,7 +11260,7 @@ defword boot_source, 0x40 dq " { @ } while swap drop ; " dq ": guess-entry-end " - dq " dup entry-flags@ 64 and 64 = { exit } if " + dq " dup entry-flags@ 64 & 64 = { exit } if " dq " dup next-newer-entry dup { drop exit } unless " dq " swap drop ; " |