diff options
| author | Irene Knapp <ireneista@irenes.space> | 2026-05-04 20:40:13 -0700 |
|---|---|---|
| committer | Irene Knapp <ireneista@irenes.space> | 2026-05-04 20:40:13 -0700 |
| commit | 0adcab31ac9a3597c1e27806151c3858fb501b24 (patch) | |
| tree | d8988bc69f02dfd98959627a283bf9c893710c85 | |
| parent | da8799b45b281bc34d2c04a2e117b9b395e3f490 (diff) | |
implement create-in which is used for independent dictionaries
also some important TODOs have been discovered Force-Push: yes Change-Id: I8efe7d0074700d6f5c78d4a591e5b590f57f47a9
| -rw-r--r-- | make-hello.e | 23 | ||||
| -rw-r--r-- | quine.asm | 24 |
2 files changed, 39 insertions, 8 deletions
diff --git a/make-hello.e b/make-hello.e index 55f62d6..797c228 100644 --- a/make-hello.e +++ b/make-hello.e @@ -4,18 +4,25 @@ : origin 0x08000000 ; -heap hexdump latest @ .hex space here @ .hex newline -latest @ @ word-heading latest @ @ hexdump -latest @ word-heading latest @ hexdump -: foo - latest @ word-heading latest @ hexdump +: init-labels + heap hexdump + latest @ dup word-heading hexdump ~ s" labels" create 8 allocate s" labels" variable + 0 s" labels" find entry-to-execution-token execute ! ; -foo -latest @ word-heading latest @ hexdump +init-labels +latest @ dup word-heading hexdump +labels @ .hex newline -s" labels" find .hex bye +: new-label + s" frobboz" labels create-in + ; +here @ +new-label +latest @ dup word-heading hexdump +labels @ .hex newline +hexdump ~ ~~ ~ ~~ ELF header diff --git a/quine.asm b/quine.asm index 45d9bda..5f13e13 100644 --- a/quine.asm +++ b/quine.asm @@ -11807,6 +11807,26 @@ defword boot_source, 0x40 dq " ; " + ; Notionally, it might make sense to define "create" in terms of + ; "create-in". Any change like that is being postponed to after the removal + ; of flatassembler, when refactorings will be easier. + ; + ; In: + ; name string pointer + ; dictionary handle (points to a pointer to the first item) + dq ": create-in " + dq " dup @ here @ swap pack64 " + ; (name string pointer, dictionary handle, output point) + dq " 0 pack8 0 pack8 " + dq " 3roll packstring " + dq " 8 packalign " + ; (dictionary handle, output point) + dq " swap here @ swap ! " + ; (output point) + dq " here ! " + dq " ; " + + ; The word named "docol" has the job of returning the value that gets used ; as the actual codeword. We make the assumption that the codeword will ; point somewhere near the entry header; we allow for the possibility that @@ -11931,6 +11951,10 @@ defword boot_source, 0x40 ;dq " bye ; doittoit " dq " " + ; TODO running "variable" interactively doesn't work because the string and + ; the "create" invocation step on each other. this is a big deal and really + ; needs to be fixed. + ; TODO find_in/find-in is backwards compared to create-in. ; TODO define ( ... ) comments ; TODO define constant (double-check variable) ; TODO consider defining is-hidden and is-immediate |