diff options
| author | Irene Knapp <ireneista@irenes.space> | 2026-04-13 15:47:05 -0700 |
|---|---|---|
| committer | Irene Knapp <ireneista@irenes.space> | 2026-04-13 15:47:05 -0700 |
| commit | acc9c36a19e34fec1a9b92801319e434e3b61ed2 (patch) | |
| tree | 982588c084cdc07adc26ee6ba01cbd0212c29fbe | |
| parent | d38fee2a57637a69ef2380c141578d340c47b09f (diff) | |
fix some disagreements with the heap words implemented in Forth
there's still pending disagreements with words implemented in assembly, which will be dealt with in another CL "forthcoming" :D Force-Push: yes Change-Id: I5420f79365bb1de4ff8e30d79212788251f871cf
| -rw-r--r-- | quine.asm | 97 |
1 files changed, 48 insertions, 49 deletions
diff --git a/quine.asm b/quine.asm index 11f8683..3136a11 100644 --- a/quine.asm +++ b/quine.asm @@ -2629,7 +2629,6 @@ cold_start: dq lit, 6*8, early_comma dq litstring, "drop", early_find, entry_to_execution_token, early_comma dq litstring, "drop", early_find, entry_to_execution_token, early_comma - dq litstring, "drop", early_find, entry_to_execution_token, early_comma dq litstring, "swap", early_find, entry_to_execution_token, early_comma dq litstring, "drop", early_find, entry_to_execution_token, early_comma dq litstring, "exit", early_find, entry_to_execution_token, early_comma @@ -2721,7 +2720,7 @@ cold_start: dq litstring, "drop", early_find, entry_to_execution_token, early_comma dq litstring, "drop", early_find, entry_to_execution_token, early_comma dq litstring, "exit", early_find, entry_to_execution_token, early_comma - dq litstring, "0branch", early_find, entry_to_execution_token, early_comma + dq litstring, "branch", early_find, entry_to_execution_token, early_comma dq lit, -45*8, early_comma dq early_here, fetch, lit, 8, packalign, early_here_store @@ -4092,7 +4091,7 @@ cold_start: dq early_here, fetch, lit, 8, packalign, early_here_store ; This was "mov_reg64_disp8_reg64". - dq litstring, "mov-reg64-imm64", early_create, early_docol_codeword + dq litstring, "mov-reg64-disp8-reg64", early_create, early_docol_codeword dq litstring, "lit", early_find, entry_to_execution_token, early_comma dq lit, 4, early_comma dq litstring, "roll", early_find, entry_to_execution_token, early_comma @@ -4355,21 +4354,6 @@ cold_start: dq litstring, "exit", early_find, entry_to_execution_token, early_comma dq early_here, fetch, lit, 8, packalign, early_here_store - ; This was "mov_reg8_indirect_reg64". - dq litstring, "mov-reg8-reg8", early_create, early_docol_codeword - dq litstring, "3roll", early_find, entry_to_execution_token, early_comma - dq litstring, "lit", early_find, entry_to_execution_token, early_comma - dq lit, 0x88, early_comma - dq litstring, "pack8", early_find, entry_to_execution_token, early_comma - dq litstring, "3unroll", early_find, entry_to_execution_token, early_comma - dq litstring, "swap", early_find, entry_to_execution_token, early_comma - dq litstring, "reg8", early_find, entry_to_execution_token, early_comma - dq litstring, "swap", early_find, entry_to_execution_token, early_comma - dq litstring, "addressing-reg8", 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 - ; This was "mov_reg8_disp8_reg64". dq litstring, "mov-reg8-disp8-reg64", early_create, early_docol_codeword dq litstring, "lit", early_find, entry_to_execution_token, early_comma @@ -4389,6 +4373,21 @@ cold_start: dq litstring, "exit", early_find, entry_to_execution_token, early_comma dq early_here, fetch, lit, 8, packalign, early_here_store + ; This was "mov_reg8_reg8". + dq litstring, "mov-reg8-reg8", early_create, early_docol_codeword + dq litstring, "3roll", early_find, entry_to_execution_token, early_comma + dq litstring, "lit", early_find, entry_to_execution_token, early_comma + dq lit, 0x88, early_comma + dq litstring, "pack8", early_find, entry_to_execution_token, early_comma + dq litstring, "3unroll", early_find, entry_to_execution_token, early_comma + dq litstring, "swap", early_find, entry_to_execution_token, early_comma + dq litstring, "reg8", early_find, entry_to_execution_token, early_comma + dq litstring, "swap", early_find, entry_to_execution_token, early_comma + dq litstring, "addressing-reg8", 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 + ; This was "lea_reg64_disp8_reg64". dq litstring, "lea-reg64-disp8-reg64", early_create, early_docol_codeword dq litstring, "lit", early_find, entry_to_execution_token, early_comma @@ -5028,7 +5027,6 @@ cold_start: dq lit, 0x03, early_comma dq litstring, "pack8", early_find, entry_to_execution_token, early_comma dq litstring, "3unroll", early_find, entry_to_execution_token, early_comma - dq litstring, "swap", early_find, entry_to_execution_token, early_comma dq litstring, "reg64", early_find, entry_to_execution_token, early_comma dq litstring, "swap", early_find, entry_to_execution_token, early_comma dq litstring, "addressing-indirect-reg64", early_find @@ -5510,8 +5508,9 @@ cold_start: ;;; addressing_reg8 ;;; basics plus earlier assembly stuff ;;; cld, std, - ;;; mov_reg64_imm32, mov_reg64_imm64, - ;;; mov_extrareg64_imm64, mov_reg64_reg64, + ;;; mov_reg64_imm32, + ;;; mov_reg64_imm64, mov_extrareg64_imm64, + ;;; mov_reg64_reg64, ;;; mov_indirect_reg64_reg64, mov_disp8_reg64_reg64, ;;; mov_reg64_indirect_reg64, mov_reg64_disp8_reg64, ;;; mov_reg64_indexed_reg64, mov_indexed_reg64_reg64, @@ -5521,7 +5520,7 @@ cold_start: ;;; mov_reg16_indirect_reg64, mov_reg16_disp8_reg64, ;;; mov_indirect_reg64_reg8, mov_disp8_reg64_reg8, ;;; mov_reg8_indirect_reg64, mov_reg8_disp8_reg64, - ;;; move_reg8_reg8, + ;;; mov_reg8_reg8, ;;; lea_reg64_disp8_reg64, lea_reg64_indexed_reg64, ;;; lea_reg64_disp8_indexed_reg64, ;;; push_reg64, pop_reg64, push_imm32_extended, @@ -6165,33 +6164,6 @@ defword fetch, 0 push.qreg rax next -; Before we get too deep into it, we also define a few reflection routines -; that retrieve, or set, the address of either of the two stacks. -; -; The result, or the new value, is on the top of the data stack. That's the -; same as how it works for any other word, but given the metacircular nature -; of these ones it's easy to get confused about that... -defword store_control_stack, 0 - dq $ + 8 - pop.qreg rbp - next -defword fetch_control_stack, 0 - dq $ + 8 - push.qreg rbp - next -defword store_value_stack, 0 - dq $ + 8 - ; Per Intel's description of POP this reads from the old location, and there - ; is no increment applied to the resulting value. See, the description says - ; it increments the register then overwrites it, in that order. - pop.qreg rsp - next -defword fetch_value_stack, 0 - dq $ + 8 - ; Per Intel's description of PUSH this pushes the old value. - push.qreg rsp - next - ; Address on top, value second ; I might have done it the other way, but this is what Jonesforth does and it ; seems reasonable enough. @@ -6251,6 +6223,33 @@ defword fetch32, 0 mov.dreg.indirect.qreg eax, rbx next +; Before we get too deep into it, we also define a few reflection routines +; that retrieve, or set, the address of either of the two stacks. +; +; The result, or the new value, is on the top of the data stack. That's the +; same as how it works for any other word, but given the metacircular nature +; of these ones it's easy to get confused about that... +defword store_control_stack, 0 + dq $ + 8 + pop.qreg rbp + next +defword fetch_control_stack, 0 + dq $ + 8 + push.qreg rbp + next +defword store_value_stack, 0 + dq $ + 8 + ; Per Intel's description of POP this reads from the old location, and there + ; is no increment applied to the resulting value. See, the description says + ; it increments the register then overwrites it, in that order. + pop.qreg rsp + next +defword fetch_value_stack, 0 + dq $ + 8 + ; Per Intel's description of PUSH this pushes the old value. + push.qreg rsp + next + ; Copy one non-overlapping block of memory over another. For the overlapping ; logic, see roll and unroll. This always copies at byte granularity, for ease ; of implementation. |