summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--quine.asm54
1 files changed, 46 insertions, 8 deletions
diff --git a/quine.asm b/quine.asm
index 753d206..be301f5 100644
--- a/quine.asm
+++ b/quine.asm
@@ -11252,7 +11252,7 @@ defword boot_source, 0x40
   dq "  here @ key { dup dup 34 != && } { pack8 key } while           "
   dq "  drop dup 0 pack8                                              "
   dq "  interpreter-flags @ 1 &                                       "
-  dq "    { 8 packalign here ! }                                      "
+  dq "    { 8 packalign here ! drop }                                 "
   dq "    { drop here @ } if-else                                     "
   dq "  ; make-immediate                                              "
 
@@ -11288,9 +11288,42 @@ defword boot_source, 0x40
   dq "      exit } unless                                             "
   dq "  swap drop ;                                                   "
 
+  dq ": containing-entry                                              "
+  dq "  dup is-in-heap { drop 0 exit } unless                         "
+  dq "  latest @ { dup { 2dup > } { 0 } if-else }                     "
+  dq "    { @ } while swap drop ;                                     "
+
+  dq ": is-assembly-word                                              "
+  dq "  entry-to-execution-token dup 8 + swap @ = ;                   "
+
+  dq ": is-docol-itself                                               "
+  dq "  entry-to-name s"" docol"" stringcmp 0 = ;                       "
+
+  dq ": is-docol-codeword                                             "
+  dq "  dup is-in-heap { drop 0 exit } unless                         "
+  dq "  containing-entry dup                                          "
+  dq "    { dup is-docol-itself                                       "
+  dq "      { drop 1 }                                                "
+  dq "      { next-newer-entry dup { is-docol-itself } if } if-else   "
+  dq "    } if ;                                                      "
+
+  dq ": is-docol-word                                                 "
+  dq "  dup is-assembly-word { drop 0 exit } if                       "
+  dq "  entry-to-execution-token @ is-docol-codeword ;                "
+
   dq ": word-heading                                                  "
   dq "  dup entry-to-name dup emitstring space                        "
-  dq "  stringlen 1+ 70 swap - 0 max indent .hex64 newline ;          "
+  dq "  stringlen 1+ 70 swap - 0 max indent dup .hex64                "
+  dq "  dup entry-flags@ dup                                          "
+  dq "    { space                                                     "
+  dq "      dup 128 & { s"" H"" emitstring } if                         "
+  dq "      dup 64 & { s"" M"" emitstring } if                          "
+  dq "      dup 1 & { s"" I"" emitstring } if                           "
+  dq "    } if drop                                                   "
+  dq "  dup is-assembly-word { s""  asm"" emitstring }                  "
+  dq "    { dup is-docol-word { s""  raw"" emitstring } unless          "
+  dq "    } if-else drop                                              "
+  dq "  newline ;                                                     "
 
   dq ": list-dictionary                                               "
   dq "  oldest-entry { dup }                                          "
@@ -11312,11 +11345,14 @@ defword boot_source, 0x40
   dq "  { dup 3 pick > }                                              "
   dq "  { 3dup show-hex-row 16 + } while 3 ndrop ;                    "
 
-  dq ": describe                                                      "
+  dq ": describe-hex                                                  "
   dq "  dup word-heading                                              "
   dq "  dup guess-entry-end swap entry-to-execution-token             "
   dq "  show-hex-between ;                                            "
 
+  dq ": describe                                                      "
+  dq "  describe-hex ;                                                "
+
   dq ": describe-all                                                  "
   dq "  oldest-entry { dup }                                          "
   dq "  { dup describe next-newer-entry } while drop ;                "
@@ -11331,24 +11367,26 @@ defword boot_source, 0x40
 
   ;dq "s"" foo"" value@ emitstring dropstring                            "
   ;dq ": foo s"" zotzotza"" emitstring ; ' foo describe                  "
+  ;dq ": foo 1 { s"" zotzotza"" emitstring } if ; ' foo describe         "
   ;dq "s"" zotzotza"" emitstring stack                                   "
-  ;dq "list-dictionary                                                 "
+  ;dq "68719476736     containing-entry stackhex                       "
+  ;dq "68719587456     containing-entry stackhex                       "
+  ;dq "587456     containing-entry stackhex                            "
+  ;dq "68719607808 containing-entry stackhex                           "
+  dq "list-dictionary                                                 "
   ;dq "describe-all                                                    "
   dq "                                                                "
 
   ; TODO define ( ... ) comments
-  ; TODO define negate, true, false, not
   ; TODO define constant (double-check variable)
   ; TODO consider defining "value" and "to"
   ; TODO consider defining "id"
   ; TODO consider defining is-hidden and is-immediate
-  ; TODO consider defining 'word and "words"
   ; TODO define ?
   ; TODO define allot and cells
   ; TODO consider what text stuff to define
   ; TODO figure out a comment syntax
-  ; TODO fix the "describe" words
-  ; TODO stack trace
+  ; TODO control stack trace
   ; TODO make an interactive debugger
   ; TODO argc argv envp etc
   ; TODO consider "bye" and "unused"