dup simply duplicates the top of the stack. It's a code word.
To see how F-PC v3.6 defines DUP, perform below steps.
- Launch F-PC v3.6 (A famous DOS Forth)
- Type in: “see dup”. FPC replies:
DUP is Code, load DISASSEM to see it. ok
- So I type in: “load disassem”.
A file MUST be open to perform this operation.
- So I type: “open disassem”.
open disassem of 16329 bytes. ok
- Let's continue: “load disassem”.
Loading..ESCTOEXIT 6F6C 61 Stack Empty. OOPS! ←– oops! sounds like there's a problem but it can be ignored.
- Let's see how DUP is defined. Type: “see dup”
ESCTOEXIT 568 8B SP DI MOV, 8B FC .| ←— DUP 's definition start from here 56A FF 0 [DI] PUSH, FF 35 .5 56C 26 ES: 26 & ←— >NEXT 56D AD WORD LODS, AD -
56E FF AX #) JMP, FF E0 .` ←— end of DUP's definition 570 5A DX POP, 5A Z ←— start of the next word's definition 571 58 AX POP, 58 X