diff options
| -rw-r--r-- | quine.asm | 32 |
1 files changed, 24 insertions, 8 deletions
diff --git a/quine.asm b/quine.asm index 3abbfc9..7211256 100644 --- a/quine.asm +++ b/quine.asm @@ -6352,9 +6352,7 @@ cold_start: ; (heap pointer, metadata pointer, string pointer, execution token) dq execute - dq litstring, "key", early_create, early_docol_codeword - dq litstring, "main-input-buffer", early_find, entry_to_execution_token - dq early_comma + dq litstring, "key-from", 0, early_create, early_docol_codeword dq litstring, "dup", early_find, entry_to_execution_token, early_comma dq litstring, "buffer-logical-length", early_find, entry_to_execution_token dq early_comma @@ -6518,6 +6516,15 @@ cold_start: dq early_here, fetch, lit, 8, packalign, early_here_store + dq litstring, "key", early_create, early_docol_codeword + dq litstring, "main-input-buffer", early_find, entry_to_execution_token + dq early_comma + dq litstring, "key-from", 0, early_find, entry_to_execution_token + dq early_comma + dq litstring, "exit", early_find, entry_to_execution_token, early_comma + dq early_here, fetch, lit, 8, packalign, early_here_store + + ;;; As a convenience for "word", we have some facilities for working with ;;; stack-allocated strings. Yeah, trippy concept. Also, it would be a ;;; buffer overrun hazard if we were worried about that, which is why this @@ -11363,21 +11370,22 @@ defword boot_source, 0x40 dq " { " ; If the logical end is greater than or equal to the physical end, find ; where it wraps to and start from there. - dq " - swap dup buffer-physical-start @ swap 3unroll + " + dq " swap - swap dup buffer-physical-start @ swap 3unroll + " ; (metadata pointer, destination start) ; In this scenario, the logical start is the end of the free space, so ; compute how far away it is. dq " dup 3roll " ; (destination start, destination start, metadata pointer) - dq " dup buffer-logical-start @ swap drop swap - } " + dq " buffer-logical-start @ swap - } " dq " { " + dq " 3roll drop " dq " dup 3roll swap - " ; If the logical end is less than the physical end, it is the destination; ; the physical end is also the end of the free space, so compute how far ; away it is. dq " } if-else " - ; (metadata pointer, destination start, destination length) + ; (destination start, destination length) dq " ; " @@ -11386,7 +11394,7 @@ defword boot_source, 0x40 ; pointer to buffer metadata dq ": refill-input-buffer-from-stdin " dq " dup normalize-buffer " - dq " compute-next-buffer-free-block " + dq " dup compute-next-buffer-free-block " ; Check whether the buffer is full. If not, do a read. If so, that's not ; an error, just clean up and take no action. dq " dup { swap sys-read " @@ -11530,8 +11538,16 @@ defword boot_source, 0x40 ;dq "68719607808 containing-entry stackhex " ;dq "list-dictionary " ;dq "describe-all " - dq ": doittoit 16 allocate-input-buffer " + dq ": doittoit 8 allocate-input-buffer " dq " dup stackhex refill-input-buffer-from-stdin " + dq " dup key-from drop " + dq " dup key-from drop " + dq " dup key-from drop " + dq " dup key-from drop " + dq " stackhex dup 256 hexdump-from " + dq " dup refill-input-buffer-from-stdin " + dq " stackhex dup 256 hexdump-from " + dq " dup refill-input-buffer-from-stdin " dq " stackhex dup 256 hexdump-from " dq " dup refill-input-buffer-from-stdin " dq " stackhex dup 256 hexdump-from " |