DEV Community

Charles Anthony
Charles Anthony

Posted on

2024-01-24 Debugging ZIP

Added

*
*+LOOP
*/
*/MOD
*C+LOOP
*CDO
*CLEAVE
*CLOOP
*DO
*END
*LEAVE
*LOOP
*[
+LOOP
+SP
-SP
.R
/
/MOD
0<
0SET
1+
1-
1SET
2*
2+
2-
2/
2DUP
2OVER
2SWAP
:
;
<BUILDS
<R
C1SET
CONSTANT
CR>
END,
Enter fullscreen mode Exit fullscreen mode
  : FOO 2 * 1 + . ;         OK
  10 FOO                    OK
Enter fullscreen mode Exit fullscreen mode

Hmm. should have printed 21.

Dump memory; looking at the compiled word FOO:

000f3e 03       db      3,"FOO"
000f40 4f
000f41 4f
000f42 2c       dw      vocab link
000f43 0f
000f44 49       dw      p_colon
000f45 00
000f46 d4       dw      cliteral
000f47 07
000f48 02       db      2
000f49 6c       dw      splat
000f4a 07
000f4b e6       dw      two
000f4c 09
000f4d bf       dw      plus
000f4e 08
000f4f 3d       dw      dot
000f50 09
000f51 d4       dw      07d4  cliteral  ???
000f52 07
000f53 10       db      10   
000f54 44
000f55 0f
000f56 01
000f57 80
Enter fullscreen mode Exit fullscreen mode

Hmm. Didn’t go out of compile mode?

Reworked vocabularies

000f4d 03    db 3, “FOO”
000f4e 46
000f4f 4f
000f50 4f
000f51 3b    dw link
000f52 0f
000f53 49    dw p_colon
000f54 00
000f55 d4    dw cliteral
000f56 07
000f57 02    db 2
000f58 6c    dw splat
000f59 07
000f5a e6    dw one
000f5b 09
000f5c bf    dw plus
000f5d 08
000f5e 3d    dw dot
000f5f 09
000f60 01    dw 3b01  ; wrong again
000f61 3b
000f62 00
000f63 00
000f64 00
Enter fullscreen mode Exit fullscreen mode

Did some more vocab rework. TIL is annoying at times

: foo 2 * 1 + . ;  OK
10 foo   OK
Enter fullscreen mode Exit fullscreen mode

So now finding”;” correctly.

000f41 03  db 3,”FOO”
000f42 46
000f43 4f
000f44 4f
000f45 2f  dw link
000f46 0f
000f47 49  dw p_colon
000f48 00
000f49 d4  dw  cliteral
000f4a 07
000f4b 02  db 2
000f4c 6c  dw spalt
000f4d 07
000f4e e6  dw one
000f4f 09
000f50 bf  dw plus
000f51 08
000f52 3d  dw dot
000f53 09
000f54 d4  dw cliteral  ; what? again?
000f55 07
000f56 10
000f57 47
000f58 0f
000f59 01
000f5a 80
000f5b 00
Enter fullscreen mode Exit fullscreen mode

Top comments (0)