Giter Site home page Giter Site logo

Comments (3)

mgcaret avatar mgcaret commented on September 3, 2024

Works fine from normal definition

: test 3 0 do 3 0 do i . j . loop loop ;
test
0 0 1 0 2 0 0 1 1 1 2 1 0 2 1 2 2 2  OK

Also works inside quotations:

: test1 [: 3 0 do 3 0 do i . j . loop loop ;] execute ;
 OK
test1
0 0 1 0 2 0 0 1 1 1 2 1 0 2 1 2 2 2  OK

from of816.

mgcaret avatar mgcaret commented on September 3, 2024

For some reason, the first LOOP is eating way more than its fair share of entries from the stack.

showstack
{ 0 : } OK
3 0 do 
Starting temp def... { 5 : 3 0 81FD7B 81FD7B 81FD84 } [OK]
3 0 do
{ 6 : 3 0 81FD7B 81FD7B 81FD84 81FD98 } [OK]
loop
{ 3 : 3 0 81FD7B } [OK]
loop
Ending temp def... { 4 : 3 0 2 4 } Exception #-60 
clear
{ 0 : } OK
3 0 do
Starting temp def... { 5 : 3 0 81FD7B 81FD7B 81FD84 } [OK]
3 0 do
{ 6 : 3 0 81FD7B 81FD7B 81FD84 81FD98 } [OK]
loop
{ 3 : 3 0 81FD7B } [OK]
[ 81FD7B 81FD84 ]
{ 5 : 3 0 81FD7B 81FD7B 81FD84 } [OK]
loop
Ending temp def... { 6 : 3 0 81FD7B 81FD7B 4 4 }{ 0 : } OK

from of816.

mgcaret avatar mgcaret commented on September 3, 2024

Ohh lookie here..

dosemi:   .dword DEPTH            ; ( -- u1 )
          .dword dCSDEPTH         ; ( u1 -- u1 c-addr1 ) verify stack depth is what it should be
          .dword FETCH            ; ( u1 c-addr1 -- u1 u2 )
          .dword ULTE             ; ( u1 u2 -- f ) is less than or equal to?
          .dword _IFFALSE         ; ( f -- )
          .dword tmpdone          ; true branch, finish up temp def
          .dword TWODROP    ; <<<<< WTF IS THIS DOING HERE? [comment not in source]
notmp:    EXIT

from of816.

Related Issues (10)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.