blob: 10ab1f6195944c53d20388397b532d90d2ef5165 [file] [log] [blame]
swissChili7c626b92022-01-01 23:35:39 -08001\ Core words for DOS FORTH
2
swissChilie4d2e282022-01-04 22:22:27 -08003: NIP SWAP DROP ;
swissChili94f1e762022-01-29 21:55:45 -08004: / /MOD NIP ;
5: MOD /MOD DROP ;
6
swissChilib921e822022-04-20 19:47:33 -07007: LITERAL IMMEDIATE ' LIT , , ;
8: [COMPILE] IMMEDIATE WORD FIND >CFA , ;
9: RECURSE IMMEDIATE LATEST , >CFA , ;
swissChili94f1e762022-01-29 21:55:45 -080010
11\ Control structures
12
13\ cond IF <*b0> true ELSE false THEN rest
swissChilib921e822022-04-20 19:47:33 -070014: IF ( -- *then ) IMMEDIATE ' 0BRANCH , HERE @ 0 , ;
swissChili94f1e762022-01-29 21:55:45 -080015
swissChilib921e822022-04-20 19:47:33 -070016: THEN ( *then -- *then ) IMMEDIATE
swissChili94f1e762022-01-29 21:55:45 -080017 DUP HERE @ SWAP ( *then *then *here )
18 SWAP - ( *then *here-*then )
19 SWAP ! ;
20
swissChilib921e822022-04-20 19:47:33 -070021: ELSE ( *then -- *here ) IMMEDIATE
swissChili94f1e762022-01-29 21:55:45 -080022 ' BRANCH ,
23 HERE @ ( *then *ph )
24 0 ,
25 SWAP ( *ph *then )
26 DUP ( *ph *then *then )
27 HERE @ ( *ph *then *then *here )
28 SWAP - ( *ph *then diff )
29 SWAP ! ( *ph ) ;
swissChili7c626b92022-01-01 23:35:39 -080030
swissChilib921e822022-04-20 19:47:33 -070031IMG-DUMPED
32
swissChilie4d2e282022-01-04 22:22:27 -080033DUMP-IMAGE FORTH.COM
swissChilib921e822022-04-20 19:47:33 -070034
swissChilie4d2e282022-01-04 22:22:27 -080035BYE