X-Git-Url: https://git.kengrimes.com/?p=watForth.git;a=blobdiff_plain;f=forth.js;h=57aac39ba44d4e295354fd2c869c1a0fc9a7c65c;hp=eb25ced1078d8578b6ea9467c4b344d360727961;hb=63e17ddc993a5a04cc6ae55bad8420b61c37d1bf;hpb=1b642df6dc1da4bdbe2c389899bb4be072bc0b1e diff --git a/forth.js b/forth.js index eb25ced..57aac39 100644 --- a/forth.js +++ b/forth.js @@ -118,53 +118,9 @@ window.onload = () => { )) }] const dictionary = { - ';': 1, - 'LIT': 2, - RINIT: 3, - WORD: 16500, - KEY: 5, - DUP: 6, - '+': 7, - 'NOOP2': 8, - '.': 9, - '@': 10, - '!': 11, - EXECUTE: 12, - NOOP: 13, - 'JZ:': 14, - 'JNZ:': 15, - DROP: 16, - 'WS?': 17, - 'JMP:': 18, - 'WPUTC': 19, - 'WB0': 20, - 'FIND': 21, - 'NUMBER': 22, - 'W!LEN': 23, - 'J-1:': 24, - 'BYE': 25, - 'SWAP': 26, - 'WORDS': 27, - 'HERE': 28, - 'DEFINE': 29, - '2DUP': 30, - 'ROT': 31, - '2DROP': 32, - ',': 33, - '-': 34, - 'CHANNEL!': 35, - 'HERE!': 36, - '=?': 37, - '.S': 38, - 'STRING-START': 39, - 'STRING-PUT': 40, - 'STRING-END': 41, - ':': 16800, - 'MODE': 14336, - 'EXECUTE-MODE': 16680, - 'QUIT': 16384, - 'INTERPRET': 16400 + EXECUTE: 12 } + const doesDictionary = {} const wasmImport = { env: { pop: () => simstack.pop(), @@ -213,6 +169,8 @@ window.onload = () => { dictionary[word.toUpperCase()] = num return 0 }, + does_get: (u) => doesDictionary[u] || 0, + does_set: (u, v) => doesDictionary[u] = v, is_whitespace: (key) => /\s/.test(String.fromCharCode(key)), sys_stack: () => console.log(`[${simstack}]`), sys_parsenum: (addr, u, base) => {