[video member=pervognsen stream_platform=twitch project=bitwise title="Forth Implementation, Part 5" vod_platform=youtube id=4Uy1Mq8p72w annotator=Miblo]
[0:08][Recap and set the stage for the day focusing on bootstrapping][:speech]
[1:39][Review the in-progress bootstrapping of the immediate / compilation modality interpretation][:asm :research]
[8:16][Make "immediate" itself be immediate][:asm]
[9:50][Review the new immediate words "else", "begin", "again", "until", "variable" and "constant"][:asm :research]
[14:59][Demo the idea behind counter and if-else][:asm :run]
[16:12][Determine to work on "immediate?" with a mention of a "hiding" word][:asm :speech]
[18:15][Create "immediate?" in FORTH][:asm]
[19:50][:Run it to find that it works, and remove the hard coded definition][:asm]
[20:57][Consider kicking out the ladder from under us once we're bootstrapped][:asm :speech]
[25:02][Define defop2 macro to quickly define binary operators, using it on an "+" operator][:asm]
[26:54][:Run it to find that it works][:asm]
[27:02][Define "-", "and", "or" and "xor" operators][:asm]
[27:46][:Run it to find that it works][:asm]
[27:56][Define defop1 macro to quickly define unary operators, using it to define "0=" and "<>0"][:asm]
[29:53][:Run it to find that it works][:asm]
[30:05][Alias "not" as "0="]
[31:24][:Run it to find that it works, but that we may want to bootstrap error checking][:asm :"error handling"]
[31:53][Create ">flags"][:asm]
[32:55][:Run it to find that it broke everything][:asm]
[33:28][Make ">flags" just exit for now][:asm]
[33:42][Consider creating ">cfa" and integers][:asm :speech]
[35:57][Rewrite ">flags"][:asm]
[36:17][:Run it to find that it now works][:asm]
[36:23][Revert ">flags" to just exit, and create ">namelen", ">name" and ">cfa"][:asm]
[41:33][:Run it to find that the live ">cfa" doesn't work][:asm]
[41:52][Test ">namelen" and ">name"][:asm]
[42:05][:Run it to find that it's okay][:asm]
[42:26][Remove IMMEDIATE and HIDDEN initialisations][:asm]
[42:40][:Run it to make sure that doesn't break it][:asm]
[42:52][Scrutinise ">cfa" and start our investigations by putting the location of the "drop" word on the stack][:asm]
[44:56][:Run it to see that "drop" is at 1224][:asm]
[45:20][Try to dup our ">cfa" after finding the "drop" word][:asm]
[45:50][:Run it to find that the cfa is at 1852402392][:asm]
[46:01][Try dereferencing the ">namelen"][:asm]
[46:14][:Run it to determine that it's already total garbage][:asm]
[46:22][Try to dup ">namelen" itself][:asm]
[46:26][:Run it to see that this is as expected][:asm]
[46:51][Make ">cfa" correctly dereference ">namelen" using a byte fetch][:asm]
[47:04][:Run it to see that it works][:asm]
[48:17][Determine to create a general number parser, initially redefining "interpret" and "quit"][:asm :parsing]
[51:46][:Run it to find that it didn't work][:asm]
[52:12][Investigate the problem in our new "interpret" and "quit"][:asm :programming :run]
[57:45][Using "break" within \[ and \]][:asm :speech]
[58:36][Continue to investigate "interpret"][:asm :programming :run]
[59:42][Try increasing the stack size][:asm :memory]
[1:00:16][:Run it to find that it works][:asm]
[1:00:37][Try using our new "quit"][:asm]
[1:00:56][:Run it to find that it all works, with a few words on recreating more sophisticated definitions][:asm]
[1:02:07][Consider building better :"error handling"][:asm :speech]
[1:03:22][Define register-manipulation built-ins "sp\@", "sp!", "pc\@", "pc!", "rp\@" and "rp!"][:asm]
[1:08:04][:Run it to see that it works][:asm]
[1:08:08][Define "sp0" and "rp0", and introduce an abort function][:asm]
[1:13:28][:Run it to see that "abort" has put 1234 on the stack, but it ends by crashing in bus_load_word()][:asm]
[1:14:08][Investigate the crash in "abort"][:asm :research]
[1:21:33][Initialise sp0 and rp0 for the docol routine and "rp0" word to use][:asm]
[1:23:11][:Run it to see that it is more reasonable][:asm]
[1:24:31][Prevent "abort" from putting 1234 on the stack, and try to enable it to push the code pointer for "quit" onto the return stack, rather than calling it directly][:asm]
[1:25:08][:Run it to find that it didn't work][:asm]
[1:25:49][Revert "abort" to just quit][:asm]
[1:26:41][Cut off the main stream][:speech]
[/video]
