diff options
Diffstat (limited to 'quine.asm')
| -rw-r--r-- | quine.asm | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/quine.asm b/quine.asm index 41d2ea6..d11ba48 100644 --- a/quine.asm +++ b/quine.asm @@ -11190,6 +11190,20 @@ 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 ; " + + dq ": unlink-pre-heap-words " + dq " latest @ " + dq " dup { dup is-in-heap 0 = { drop exit } if } " + dq " { drop exit } if-else " + 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 " + + ; Now some fancier stack combinators. + ; ; While it might be nice, for performance reasons, to do these in ; assembler, for now it's more important to have them at all. dq ": over swap dup 3unroll ; " @@ -11201,13 +11215,12 @@ defword boot_source, 0x40 dq ": not 0 = ; " dq ": negate -1 * ; " - ; This use of bitwise and is valid because the inputs are 0 or 1. - dq ": is-in-heap dup heap @ <= swap here @ > and ; " - + ; Some output formatting tools. dq ": space 32 value@ emitstring drop ; " dq ": newline 10 value@ emitstring drop ; " dq ": indent { dup } { space 1 - } while drop ; " + ; Some debugging tools. dq ": stack " dq " s0 @ 8 - { dup value@ 8 + != } " dq " { dup s0 @ 8 - != { space } if dup @ . 8 - } " @@ -11240,6 +11253,7 @@ defword boot_source, 0x40 ;dq ": foo { 5 . } forever ; foo ' foo forget " ;dq ": foo 0 { dup 5 > } { dup . 1 + } while drop ; foo ' foo forget " + dq "unlink-pre-heap-words list-dictionary " dq " " ; TODO define ( ... ) comments |