We are currently in the process of converting the website to the new design. Some pages, like this one, are still broken. We appreciate your patience.
Bitwise»Episode Guide
Forth Implementation, Part 4
?
?

Keyboard Navigation

Global Keys

[, < / ], > Jump to previous / next episode
W, K, P / S, J, N Jump to previous / next marker
t / T Toggle theatre / SUPERtheatre mode
V Revert filter to original state Y Select link (requires manual Ctrl-c)

Menu toggling

q Quotes r References f Filter y Link c Credits

In-Menu Movement

a
w
s
d
h j k l


Quotes and References Menus

Enter Jump to timecode

Quotes, References and Credits Menus

o Open URL (in new tab)

Filter Menu

x, Space Toggle category and focus next
X, ShiftSpace Toggle category and focus previous
v Invert topics / media as per focus

Filter and Link Menus

z Toggle filter / linking mode

Credits Menu

Enter Open URL (in new tab)
0:08Recap and set the stage for the day
🗩
0:08Recap and set the stage for the day
🗩
0:08Recap and set the stage for the day
🗩
1:48Review the addition of "key" word and renaming of "xt" to ">cfa"
📖
1:48Review the addition of "key" word and renaming of "xt" to ">cfa"
📖
1:48Review the addition of "key" word and renaming of "xt" to ">cfa"
📖
5:42Run it to demo the FORTH program execution
🏃
5:42Run it to demo the FORTH program execution
🏃
5:42Run it to demo the FORTH program execution
🏃
6:39Modes in FORTH: immediate vs compilation
🗩
6:39Modes in FORTH: immediate vs compilation
🗩
6:39Modes in FORTH: immediate vs compilation
🗩
11:43Mode-agnostic immediate words
🗩
11:43Mode-agnostic immediate words
🗩
11:43Mode-agnostic immediate words
🗩
12:52Dive into implementing modes
12:52Dive into implementing modes
12:52Dive into implementing modes
13:36Introduce a _push_latest word that initialises variables
13:36Introduce a _push_latest word that initialises variables
13:36Introduce a _push_latest word that initialises variables
15:19Introduce mode and cp labels, and "cp" word, establishing the convention that all constants are upper case
15:19Introduce mode and cp labels, and "cp" word, establishing the convention that all constants are upper case
15:19Introduce mode and cp labels, and "cp" word, establishing the convention that all constants are upper case
20:01Dive into implementing the ability to dynamically define dictionary entries, introducing "here" and "allot" words, and "c@" and "c!" for byte-wise loads and stores
20:01Dive into implementing the ability to dynamically define dictionary entries, introducing "here" and "allot" words, and "c@" and "c!" for byte-wise loads and stores
20:01Dive into implementing the ability to dynamically define dictionary entries, introducing "here" and "allot" words, and "c@" and "c!" for byte-wise loads and stores
25:54Spec out our dynamic dictionary entry definition implementation
25:54Spec out our dynamic dictionary entry definition implementation
25:54Spec out our dynamic dictionary entry definition implementation
27:48The "," helper word
🗩
27:48The "," helper word
🗩
27:48The "," helper word
🗩
28:49Continue to spec out our dynamic dictionary entry definition implementation
28:49Continue to spec out our dynamic dictionary entry definition implementation
28:49Continue to spec out our dynamic dictionary entry definition implementation
35:15Introduce "swap" word
35:15Introduce "swap" word
35:15Introduce "swap" word
36:10Spec out a "cmove" word, as if we have all the facilities for it
36:10Spec out a "cmove" word, as if we have all the facilities for it
36:10Spec out a "cmove" word, as if we have all the facilities for it
43:11Introduce "rot" and "-rot" words
43:11Introduce "rot" and "-rot" words
43:11Introduce "rot" and "-rot" words
45:17Expand our cmove spec to FORTH
45:17Expand our cmove spec to FORTH
45:17Expand our cmove spec to FORTH
49:38Introduce branch
49:38Introduce branch
49:38Introduce branch
49:57sci4me Uh, that doesn't duplicate the top two elements, that duplicates the top element twice
🗪
49:57sci4me Uh, that doesn't duplicate the top two elements, that duplicates the top element twice
🗪
49:57sci4me Uh, that doesn't duplicate the top two elements, that duplicates the top element twice
🗪
50:01Introduce "over" word
50:01Introduce "over" word
50:01Introduce "over" word
51:12Expand "2dup"
51:12Expand "2dup"
51:12Expand "2dup"
51:50rygorous pervognsen I'm gonna go out on a limb here and say you should write a small bootstrapping tool that converts those basic definitions into assembly, because transcribing that is gonna get old fast
🗪
51:50rygorous pervognsen I'm gonna go out on a limb here and say you should write a small bootstrapping tool that converts those basic definitions into assembly, because transcribing that is gonna get old fast
🗪
51:50rygorous pervognsen I'm gonna go out on a limb here and say you should write a small bootstrapping tool that converts those basic definitions into assembly, because transcribing that is gonna get old fast
🗪
52:23Fix 2dup
52:23Fix 2dup
52:23Fix 2dup
52:57Expand "branch"
52:57Expand "branch"
52:57Expand "branch"
54:21Introduce "mux" for "branch" to use
54:21Introduce "mux" for "branch" to use
54:21Introduce "mux" for "branch" to use
59:11rygorous pervognsen x ^ ((y ^ x) & mask)
🗪
59:11rygorous pervognsen x ^ ((y ^ x) & mask)
🗪
59:11rygorous pervognsen x ^ ((y ^ x) & mask)
🗪
59:49Move our newly defined words into the FORTH implementation
59:49Move our newly defined words into the FORTH implementation
59:49Move our newly defined words into the FORTH implementation
1:04:35Test mux
1:04:35Test mux
1:04:35Test mux
1:05:45Run it to see that the mux test fails
🏃
1:05:45Run it to see that the mux test fails
🏃
1:05:45Run it to see that the mux test fails
🏃
1:06:04Remove the mux from our input_buf
1:06:04Remove the mux from our input_buf
1:06:04Remove the mux from our input_buf
1:06:08Run it to see 0 as expected
🏃
1:06:08Run it to see 0 as expected
🏃
1:06:08Run it to see 0 as expected
🏃
1:06:16Reinsert mux into our input_buf, and endeavour to fix its definition, introducing a "neg" word
1:06:16Reinsert mux into our input_buf, and endeavour to fix its definition, introducing a "neg" word
1:06:16Reinsert mux into our input_buf, and endeavour to fix its definition, introducing a "neg" word
1:07:44Run it to see that it never prints anything
🏃
1:07:44Run it to see that it never prints anything
🏃
1:07:44Run it to see that it never prints anything
🏃
1:09:18Fix the definitions of our new words as words, rather than codes
1:09:18Fix the definitions of our new words as words, rather than codes
1:09:18Fix the definitions of our new words as words, rather than codes
1:09:32Run it to see that it prints "0"
🏃
1:09:32Run it to see that it prints "0"
🏃
1:09:32Run it to see that it prints "0"
🏃
1:09:38Re-enable some of the "mux" definition
1:09:38Re-enable some of the "mux" definition
1:09:38Re-enable some of the "mux" definition
1:09:44Run it to see that it prints "0"
🏃
1:09:44Run it to see that it prints "0"
🏃
1:09:44Run it to see that it prints "0"
🏃
1:09:53Change our mux test to use 1
1:09:53Change our mux test to use 1
1:09:53Change our mux test to use 1
1:09:56Run it to see that it prints "/" in lieu of a -1
🏃
1:09:56Run it to see that it prints "/" in lieu of a -1
🏃
1:09:56Run it to see that it prints "/" in lieu of a -1
🏃
1:10:21Change our mux test to use 4
1:10:21Change our mux test to use 4
1:10:21Change our mux test to use 4
1:10:25Run it to see that it prints "/" in lieu of a 4
🏃
1:10:25Run it to see that it prints "/" in lieu of a 4
🏃
1:10:25Run it to see that it prints "/" in lieu of a 4
🏃
1:10:32Re-enable our entire "mux" definition
1:10:32Re-enable our entire "mux" definition
1:10:32Re-enable our entire "mux" definition
1:10:48Run it to see that it prints "0"
🏃
1:10:48Run it to see that it prints "0"
🏃
1:10:48Run it to see that it prints "0"
🏃
1:11:10Flesh out of "mux" word spec, introducing "xor" and "not" words
1:11:10Flesh out of "mux" word spec, introducing "xor" and "not" words
1:11:10Flesh out of "mux" word spec, introducing "xor" and "not" words
1:13:43Run it to see that it prints "."
🏃
1:13:43Run it to see that it prints "."
🏃
1:13:43Run it to see that it prints "."
🏃
1:13:52Scrutinise our "mux" definition, and consider the need for better debugging functionality
📖
1:13:52Scrutinise our "mux" definition, and consider the need for better debugging functionality
📖
1:13:52Scrutinise our "mux" definition, and consider the need for better debugging functionality
📖
1:16:25Fix "xor"
1:16:25Fix "xor"
1:16:25Fix "xor"
1:16:32Continue to scrutinise the words called by "mux"
1:16:32Continue to scrutinise the words called by "mux"
1:16:32Continue to scrutinise the words called by "mux"
1:17:33Break down our mux test
1:17:33Break down our mux test
1:17:33Break down our mux test
1:18:25Introduce "show" word, and enable cmd_loop() in the assembler to quit when "q" is pressed
1:18:25Introduce "show" word, and enable cmd_loop() in the assembler to quit when "q" is pressed
1:18:25Introduce "show" word, and enable cmd_loop() in the assembler to quit when "q" is pressed
1:21:57Run it, crash in step() and investigate why
🏃
1:21:57Run it, crash in step() and investigate why
🏃
1:21:57Run it, crash in step() and investigate why
🏃
1:27:28Fix the uintptr_t definition in Ion
1:27:28Fix the uintptr_t definition in Ion
1:27:28Fix the uintptr_t definition in Ion
1:28:01Run it, successfully hit our breakpoint and inspect the workings of "mux"
🏃
1:28:01Run it, successfully hit our breakpoint and inspect the workings of "mux"
🏃
1:28:01Run it, successfully hit our breakpoint and inspect the workings of "mux"
🏃
1:29:36Inline our mux definition
1:29:36Inline our mux definition
1:29:36Inline our mux definition
1:30:47Step through our FORTH program to find that the "<>0" didn't work
🏃
1:30:47Step through our FORTH program to find that the "<>0" didn't work
🏃
1:30:47Step through our FORTH program to find that the "<>0" didn't work
🏃
1:32:47Fix "<>0" to "0<>" in our input stream
1:32:47Fix "<>0" to "0<>" in our input stream
1:32:47Fix "<>0" to "0<>" in our input stream
1:32:57Step through our FORTH program to find that the rotation is incorrect
🏃
1:32:57Step through our FORTH program to find that the rotation is incorrect
🏃
1:32:57Step through our FORTH program to find that the rotation is incorrect
🏃
1:34:34Fix our "-rot" definition
1:34:34Fix our "-rot" definition
1:34:34Fix our "-rot" definition
1:34:39Step through our FORTH program to find that the entire routine works
🏃
1:34:39Step through our FORTH program to find that the entire routine works
🏃
1:34:39Step through our FORTH program to find that the entire routine works
🏃
1:36:30Implement "branch"
1:36:30Implement "branch"
1:36:30Implement "branch"
1:37:26Test "branch" out on a toggle program
1:37:26Test "branch" out on a toggle program
1:37:26Test "branch" out on a toggle program
1:41:18Run it to see how it works
🏃
1:41:18Run it to see how it works
🏃
1:41:18Run it to see how it works
🏃
1:41:39Make the program echo the input before doing the branch
1:41:39Make the program echo the input before doing the branch
1:41:39Make the program echo the input before doing the branch
1:41:54Run it to determine that the branching may be busted, and investigate why
🏃
1:41:54Run it to determine that the branching may be busted, and investigate why
🏃
1:41:54Run it to determine that the branching may be busted, and investigate why
🏃
1:42:30Test to find that the infinite loop is indeed working
🏃
🖮
1:42:30Test to find that the infinite loop is indeed working
🏃
🖮
1:42:30Test to find that the infinite loop is indeed working
🏃
🖮
1:42:50Scrutinise our "branch" definition
📖
1:42:50Scrutinise our "branch" definition
📖
1:42:50Scrutinise our "branch" definition
📖
1:45:32Make the program call "show" before and after branching
1:45:32Make the program call "show" before and after branching
1:45:32Make the program call "show" before and after branching
1:45:48Step in to our program and crash in bus_load_word()
🏃
1:45:48Step in to our program and crash in bus_load_word()
🏃
1:45:48Step in to our program and crash in bus_load_word()
🏃
1:46:39Try a variant of "branch" that should unconditionally fall through
1:46:39Try a variant of "branch" that should unconditionally fall through
1:46:39Try a variant of "branch" that should unconditionally fall through
1:47:04Run it to find that it is unconditionally falling through
🏃
1:47:04Run it to find that it is unconditionally falling through
🏃
1:47:04Run it to find that it is unconditionally falling through
🏃
1:47:23Try a variant of "branch" testing that the offset is correct
1:47:23Try a variant of "branch" testing that the offset is correct
1:47:23Try a variant of "branch" testing that the offset is correct
1:47:31Run it to confirm that the branch offset is correct
🏃
1:47:31Run it to confirm that the branch offset is correct
🏃
1:47:31Run it to confirm that the branch offset is correct
🏃
1:48:00Fix "branch" to swap between add and load
1:48:00Fix "branch" to swap between add and load
1:48:00Fix "branch" to swap between add and load
1:49:10Run it to find that it works now
🏃
1:49:10Run it to find that it works now
🏃
1:49:10Run it to find that it works now
🏃
1:50:07Implement "cmove" from our spec
1:50:07Implement "cmove" from our spec
1:50:07Implement "cmove" from our spec
1:55:16Determine to test our "cmove"
🗩
1:55:16Determine to test our "cmove"
🗩
1:55:16Determine to test our "cmove"
🗩
1:55:53sci4me That's not quite right. You're storing to the wrong location, I think
🗪
1:55:53sci4me That's not quite right. You're storing to the wrong location, I think
🗪
1:55:53sci4me That's not quite right. You're storing to the wrong location, I think
🗪
1:56:11Scrutinise our "cmove" spec
📖
1:56:11Scrutinise our "cmove" spec
📖
1:56:11Scrutinise our "cmove" spec
📖
1:57:24Loft out some of "cmove" into a "cmove1" word, introducing "1+" and "1-"
1:57:24Loft out some of "cmove" into a "cmove1" word, introducing "1+" and "1-"
1:57:24Loft out some of "cmove" into a "cmove1" word, introducing "1+" and "1-"
2:01:48Conjugation
🗩
2:01:48Conjugation
🗩
2:01:48Conjugation
🗩
2:04:19miotatsu My introduction to conjugation as well as commutators was Rubik's cubes, fun stuff
🗪
2:04:19miotatsu My introduction to conjugation as well as commutators was Rubik's cubes, fun stuff
🗪
2:04:19miotatsu My introduction to conjugation as well as commutators was Rubik's cubes, fun stuff
🗪
2:05:48Implement "create" from our spec
2:05:48Implement "create" from our spec
2:05:48Implement "create" from our spec
2:08:30Spec out "aligned" and "align"
2:08:30Spec out "aligned" and "align"
2:08:30Spec out "aligned" and "align"
2:09:59Implement "aligned" from our spec, and "2" and "3" literals
2:09:59Implement "aligned" from our spec, and "2" and "3" literals
2:09:59Implement "aligned" from our spec, and "2" and "3" literals
2:11:20Test "aligned" (also implementing "align" from our spec)
2:11:20Test "aligned" (also implementing "align" from our spec)
2:11:20Test "aligned" (also implementing "align" from our spec)
2:12:36Run it to see that it looks good
🏃
2:12:36Run it to see that it looks good
🏃
2:12:36Run it to see that it looks good
🏃
2:13:33Break
🗹
2:13:33Break
🗹
2:13:33Break
🗹
2:14:43Return and enable "create" to set the cfa field, introducing "docol"
2:14:43Return and enable "create" to set the cfa field, introducing "docol"
2:14:43Return and enable "create" to set the cfa field, introducing "docol"
2:16:53Introduce "'" word
2:16:53Introduce "'" word
2:16:53Introduce "'" word
2:18:44Test "create" on an "8" word, based on 4 × 2
2:18:44Test "create" on an "8" word, based on 4 × 2
2:18:44Test "create" on an "8" word, based on 4 × 2
2:22:34Step in to our program to see that the "create" has worked
🏃
2:22:34Step in to our program to see that the "create" has worked
🏃
2:22:34Step in to our program to see that the "create" has worked
🏃
2:25:41Test "create" on a "twice" word
2:25:41Test "create" on a "twice" word
2:25:41Test "create" on a "twice" word
2:26:54Run it to find that it's not working, and investigate why
🏃
2:26:54Run it to find that it's not working, and investigate why
🏃
2:26:54Run it to find that it's not working, and investigate why
🏃
2:29:57Assert that there is space on the stack for a new dictionary entry
2:29:57Assert that there is space on the stack for a new dictionary entry
2:29:57Assert that there is space on the stack for a new dictionary entry
2:33:14Investigate the stack effects of "create"
📖
2:33:14Investigate the stack effects of "create"
📖
2:33:14Investigate the stack effects of "create"
📖
2:35:23Make "cmove" drop its arguments, introducing "2drop" and "3drop"
2:35:23Make "cmove" drop its arguments, introducing "2drop" and "3drop"
2:35:23Make "cmove" drop its arguments, introducing "2drop" and "3drop"
2:36:39Step through it until we crash in bus_load_word()
🏃
2:36:39Step through it until we crash in bus_load_word()
🏃
2:36:39Step through it until we crash in bus_load_word()
🏃
2:37:25Verify that multi-character definitions do not work
🏃
🖮
2:37:25Verify that multi-character definitions do not work
🏃
🖮
2:37:25Verify that multi-character definitions do not work
🏃
🖮
2:37:53Try creating a 3-character dictionary entry
2:37:53Try creating a 3-character dictionary entry
2:37:53Try creating a 3-character dictionary entry
2:38:29Run it to determine that it could be an alignment or length issue
🏃
2:38:29Run it to determine that it could be an alignment or length issue
🏃
2:38:29Run it to determine that it could be an alignment or length issue
🏃
2:40:11Scrutinise "cmove1", "cmove" and "create"
📖
2:40:11Scrutinise "cmove1", "cmove" and "create"
📖
2:40:11Scrutinise "cmove1", "cmove" and "create"
📖
2:41:56Cut off the stream
🗩
2:41:56Cut off the stream
🗩
2:41:56Cut off the stream
🗩