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 3
?
?

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 continuing with our FORTH implementation
🗩
0:08Recap and set the stage for the day continuing with our FORTH implementation
🗩
0:08Recap and set the stage for the day continuing with our FORTH implementation
🗩
1:04Review the dictionary entry data format
📖
1:04Review the dictionary entry data format
📖
1:04Review the dictionary entry data format
📖
3:09Review the find routine, with a mention of its composition begun in higher level C code
📖
3:09Review the find routine, with a mention of its composition begun in higher level C code
📖
3:09Review the find routine, with a mention of its composition begun in higher level C code
📖
9:00Review the current program, noting that find could have been written in FORTH
📖
9:00Review the current program, noting that find could have been written in FORTH
📖
9:00Review the current program, noting that find could have been written in FORTH
📖
11:04Dive into buffered input, beginning in C before adapting it to assembly
11:04Dive into buffered input, beginning in C before adapting it to assembly
11:04Dive into buffered input, beginning in C before adapting it to assembly
22:03Reflect on the intention of this code to be easily translatable from C to assembly
🗩
22:03Reflect on the intention of this code to be easily translatable from C to assembly
🗩
22:03Reflect on the intention of this code to be easily translatable from C to assembly
🗩
22:36Translate our buffered input implementation from C to assembly
22:36Translate our buffered input implementation from C to assembly
22:36Translate our buffered input implementation from C to assembly
33:19twitchplaysp0ng Which registers are callee saved?
🗪
33:19twitchplaysp0ng Which registers are callee saved?
🗪
33:19twitchplaysp0ng Which registers are callee saved?
🗪
33:53davechat I think you need to increment input pointer after char *c = *input; otherwise you have an infinite loop?
🗪
33:53davechat I think you need to increment input pointer after char *c = *input; otherwise you have an infinite loop?
🗪
33:53davechat I think you need to increment input pointer after char *c = *input; otherwise you have an infinite loop?
🗪
34:29Correctly increment input and continue adapting it from C to assembly
34:29Correctly increment input and continue adapting it from C to assembly
34:29Correctly increment input and continue adapting it from C to assembly
37:55Paste our buffered input implementation into forth.asm
37:55Paste our buffered input implementation into forth.asm
37:55Paste our buffered input implementation into forth.asm
39:29Run it to see that it assembles
🏃
39:29Run it to see that it assembles
🏃
39:29Run it to see that it assembles
🏃
39:36twitchplaysp0ng Last comment is wrong. The comment should be sp[-1]
🗪
39:36twitchplaysp0ng Last comment is wrong. The comment should be sp[-1]
🗪
39:36twitchplaysp0ng Last comment is wrong. The comment should be sp[-1]
🗪
39:45Fill our input_buf with the string "foo bar" and try it out
39:45Fill our input_buf with the string "foo bar" and try it out
39:45Fill our input_buf with the string "foo bar" and try it out
43:09Run it to see what it does
🏃
43:09Run it to see what it does
🏃
43:09Run it to see what it does
🏃
43:33Make our program _drop after doing _putdigit and _getdigit
43:33Make our program _drop after doing _putdigit and _getdigit
43:33Make our program _drop after doing _putdigit and _getdigit
44:23Print out the address of word_
44:23Print out the address of word_
44:23Print out the address of word_
44:35Step through the simulation to see what it does
🏃
44:35Step through the simulation to see what it does
🏃
44:35Step through the simulation to see what it does
🏃
45:50Renumber the registers
45:50Renumber the registers
45:50Renumber the registers
47:26Fix print_hart_state() to display 31 registers (down from 32)
47:26Fix print_hart_state() to display 31 registers (down from 32)
47:26Fix print_hart_state() to display 31 registers (down from 32)
49:29Step through it to see what it does
🏃
49:29Step through it to see what it does
🏃
49:29Step through it to see what it does
🏃
51:14Fix word_ to store back the updated input value
51:14Fix word_ to store back the updated input value
51:14Fix word_ to store back the updated input value
52:43Step through it to see what it does
🏃
52:43Step through it to see what it does
🏃
52:43Step through it to see what it does
🏃
53:29Fix word_ to load the input as a byte (lbu) rather than a word (lw)
53:29Fix word_ to load the input as a byte (lbu) rather than a word (lw)
53:29Fix word_ to load the input as a byte (lbu) rather than a word (lw)
54:00Run it to see that it works as expected
🏃
54:00Run it to see that it works as expected
🏃
54:00Run it to see that it works as expected
🏃
55:08Fix word_ to correctly initialise t5 to t4 (char *ptr = start)
55:08Fix word_ to correctly initialise t5 to t4 (char *ptr = start)
55:08Fix word_ to correctly initialise t5 to t4 (char *ptr = start)
55:46Run it to see that we're good
🏃
55:46Run it to see that we're good
🏃
55:46Run it to see that we're good
🏃
56:06Further test our word_ using "per vognsen"
🏃
🖮
56:06Further test our word_ using "per vognsen"
🏃
🖮
56:06Further test our word_ using "per vognsen"
🏃
🖮
57:08twitchplaysp0ng What's it printing?
🗪
57:08twitchplaysp0ng What's it printing?
🗪
57:08twitchplaysp0ng What's it printing?
🗪
58:18Review our bugs in the assembly code
📖
58:18Review our bugs in the assembly code
📖
58:18Review our bugs in the assembly code
📖
1:00:25Introduce _nez word in FORTH, and cmd_seqz() and cmd_snez() instructions in the assembler1
1:00:25Introduce _nez word in FORTH, and cmd_seqz() and cmd_snez() instructions in the assembler1
1:00:25Introduce _nez word in FORTH, and cmd_seqz() and cmd_snez() instructions in the assembler1
1:08:30Make our FORTH program call _nez after _word and _find
1:08:30Make our FORTH program call _nez after _word and _find
1:08:30Make our FORTH program call _nez after _word and _find
1:08:53Run it to see all 0s, because neither "per" nor "vognsen" are words in our dictionary
🏃
1:08:53Run it to see all 0s, because neither "per" nor "vognsen" are words in our dictionary
🏃
1:08:53Run it to see all 0s, because neither "per" nor "vognsen" are words in our dictionary
🏃
1:09:06Edit our input buffer to test dictionary matching
1:09:06Edit our input buffer to test dictionary matching
1:09:06Edit our input buffer to test dictionary matching
1:09:57Run it to see that it all works
🏃
1:09:57Run it to see that it all works
🏃
1:09:57Run it to see that it all works
🏃
1:10:05Introduce _execute word
1:10:05Introduce _execute word
1:10:05Introduce _execute word
1:14:08Run it to see that it prints 9
🏃
1:14:08Run it to see that it prints 9
🏃
1:14:08Run it to see that it prints 9
🏃
1:14:18Introduce _xt to push an execution token onto the stack
1:14:18Introduce _xt to push an execution token onto the stack
1:14:18Introduce _xt to push an execution token onto the stack
1:17:36Set up our program to test _xt and _execute
1:17:36Set up our program to test _xt and _execute
1:17:36Set up our program to test _xt and _execute
1:18:36Define _0 and _1 to get things going without having an integer parser
1:18:36Define _0 and _1 to get things going without having an integer parser
1:18:36Define _0 and _1 to get things going without having an integer parser
1:20:14Run it to see that it does jack shit
🏃
1:20:14Run it to see that it does jack shit
🏃
1:20:14Run it to see that it does jack shit
🏃
1:20:31Print out matching of our test string with the dictionary
1:20:31Print out matching of our test string with the dictionary
1:20:31Print out matching of our test string with the dictionary
1:20:48Run it to see that "1" matches, but "putdigit" doesn't
🏃
1:20:48Run it to see that "1" matches, but "putdigit" doesn't
🏃
1:20:48Run it to see that "1" matches, but "putdigit" doesn't
🏃
1:21:47Change our test string to "1 1 +"
1:21:47Change our test string to "1 1 +"
1:21:47Change our test string to "1 1 +"
1:21:54Run it to see that the last thing never matches
🏃
1:21:54Run it to see that the last thing never matches
🏃
1:21:54Run it to see that the last thing never matches
🏃
1:22:03Change our test string to "1 1 + putdigit _"
1:22:03Change our test string to "1 1 + putdigit _"
1:22:03Change our test string to "1 1 + putdigit _"
1:22:22Run it to see that "putdigit" never matches
🏃
1:22:22Run it to see that "putdigit" never matches
🏃
1:22:22Run it to see that "putdigit" never matches
🏃
1:22:55Rename the _add word as "+"
1:22:55Rename the _add word as "+"
1:22:55Rename the _add word as "+"
1:23:09Run it to see that everything except "putdigit" matches
🏃
1:23:09Run it to see that everything except "putdigit" matches
🏃
1:23:09Run it to see that everything except "putdigit" matches
🏃
1:24:05Define everyone, including _putdigit, before latest_const
1:24:05Define everyone, including _putdigit, before latest_const
1:24:05Define everyone, including _putdigit, before latest_const
1:25:03Run it to see that it works
🏃
1:25:03Run it to see that it works
🏃
1:25:03Run it to see that it works
🏃
1:25:16Enable our FORTH program to execute the words in our string
1:25:16Enable our FORTH program to execute the words in our string
1:25:16Enable our FORTH program to execute the words in our string
1:25:44Run it to see what happens
🏃
1:25:44Run it to see what happens
🏃
1:25:44Run it to see what happens
🏃
1:26:51Try testing _xt with known data
1:26:51Try testing _xt with known data
1:26:51Try testing _xt with known data
1:27:49Run it to see that it prints 9
🏃
1:27:49Run it to see that it prints 9
🏃
1:27:49Run it to see that it prints 9
🏃
1:27:52Label _putdigit putdigit_entry
1:27:52Label _putdigit putdigit_entry
1:27:52Label _putdigit putdigit_entry
1:28:20Run it to see that it does not work
🏃
1:28:20Run it to see that it does not work
🏃
1:28:20Run it to see that it does not work
🏃
1:28:27Investigate the problem, presumably in _xt
📖
1:28:27Investigate the problem, presumably in _xt
📖
1:28:27Investigate the problem, presumably in _xt
📖
1:29:39Step through it to see what it's doing
🏃
1:29:39Step through it to see what it's doing
🏃
1:29:39Step through it to see what it's doing
🏃
1:30:57Fix _xt to correctly increment t1
1:30:57Fix _xt to correctly increment t1
1:30:57Fix _xt to correctly increment t1
1:32:27Run it to see that it works
🏃
1:32:27Run it to see that it works
🏃
1:32:27Run it to see that it works
🏃
1:33:05Reorganise the program
1:33:05Reorganise the program
1:33:05Reorganise the program
1:33:58Consider our next steps: reading from the keyboard, and appending definitions for future execution
🗩
1:33:58Consider our next steps: reading from the keyboard, and appending definitions for future execution
🗩
1:33:58Consider our next steps: reading from the keyboard, and appending definitions for future execution
🗩
1:36:43That's it for today
🗩
1:36:43That's it for today
🗩
1:36:43That's it for today
🗩