diff --git a/pervognsen/bitwise/bitwise/bitwise035.hmml b/pervognsen/bitwise/bitwise/bitwise035.hmml index ff6fa9e..e74360d 100644 --- a/pervognsen/bitwise/bitwise/bitwise035.hmml +++ b/pervognsen/bitwise/bitwise/bitwise035.hmml @@ -1,2 +1,62 @@ -[video member=pervognsen stream_platform=twitch project=bitwise title="Implementing Forth" vod_platform=youtube id=rlayTh3sjiw annotator=] -[/video] \ No newline at end of file +[video member=pervognsen stream_platform=twitch project=bitwise title="Implementing Forth" vod_platform=youtube id=rlayTh3sjiw annotator=Miblo] +[0:09][Recap and set the stage for the day working on a FORTH system[ref + site="FORTH, Inc." + page="Starting FORTH" + url=https://www.forth.com/starting-forth/]][:language :speech] +[2:13][Point out [@nothings Sean]'s 1992 IOCCC entry 'FIRST & THIRD almost FORTH'[ref + site="The International Obfuscated C Code Contest" + page="FIRST & THIRD almost FORTH" + url=https://www.ioccc.org/1992/buzzard.2.design] and others][:language :research] +[10:17][Point out Lennart Augustsson's 1996 IOCCC entry 'august'[ref + site="The International Obfuscated C Code Contest" + page=august + url=https://www.ioccc.org/years.html#1996_august]][:language :research] +[12:55][Point out JONESFORTH[ref + site=GitHub + page="nornagon / jonesforth" + url=https://github.com/nornagon/jonesforth] with a little comparison with [@nothings Sean]'s 'FIRST & THIRD almost FORTH'[ref + site="The International Obfuscated C Code Contest" + page="FIRST & THIRD almost FORTH" + url=https://www.ioccc.org/1992/buzzard.2.design]][:language :research] +[18:24][Review the addition of if in the assembler][:asm :language :research] +[20:02][Set up to implement our FORTH system, creating forth.asm, forth_test() and assemble_file()][:"file io"] +[34:57][:Run it to see that it looks good][:"file io"] +[35:18][FORTH, as a stack-oriented :language][:asm :memory :speech] +[37:32][Introduce cmd_reg() to support register aliasing][:asm :language] +[39:54][Test our new .reg instruction][:asm :language :programming :run] +[40:34][Set up FORTH register roles: sp (stack pointer), pc (program counter) and rsp (return stack pointer)][:asm :language] +[43:28][Indirect threading-style FORTH, like JONESFORTH[ref + site=GitHub + page="nornagon / jonesforth" + url=https://github.com/nornagon/jonesforth]][:asm :language :speech :threading] +[47:16][Create an add routine, initially in direct :threading style][:asm :language] +[53:30][Set aside space for the stack][:asm :memory] +[56:57][Rename add to do_add and introduce do_push to push values onto the stack][:asm :memory] +[1:00:51][Enable cmd_uint32() to support variable initialisation from labels][:parsing] +[1:02:53][:Run it to find that it assembled, but unexpectedly subtracts 8 from t1][:asm :emulation :language] +[1:05:16][Consider what may be wrong with cmd_la()][:asm :language :research] +[1:07:19][:Run it and talk through the program execution][:asm :emulation :language] +[1:08:34][Step through cmd_la() and inspect the :asm][:run] +[1:12:07][Test loading into t1 from the program_start label][:asm :language] +[1:12:29][:Run it to find that this works, and it is loading correctly after all, only the disassembler doesn't account for the offset][:asm :emulation :language] +[1:14:02][:Run our entire FORTH system][:asm :emulation :language] +[1:16:06][Create a do_print routine][:asm :language] +[1:18:12][:Run it to see our printout][:asm :emulation :language] +[1:18:59][Rename do_print to do_emit and enable it to print a newline and subtract '0' from the ASCII value][:asm :language] +[1:20:34][:Run it to see ILLEGAL instructions][:asm :emulation :language] +[1:21:35][Call do_push after do_add instructions][:asm :language] +[1:22:19][:Run it to look for our printout][:asm :emulation :language] +[1:22:58][Fix our program to + '0'][:asm :language] +[1:23:04][:Run it to see our 3][:asm :emulation :language] +[1:23:38][Enable cmd_loop() to toggle "quiet" running on a key press][:"input handling"] +[1:24:49][Rename do_emit to do_putchar and create a do_getchar routine][:asm :language] +[1:25:39][:Run it to see our 3][:asm :emulation :language] +[1:25:47][Enable our program to add user-input values][:asm :"input handling" :language] +[1:26:53][:Run it to see that it doesn't work][:asm :emulation :"input handling" :language] +[1:27:05][Fix our :"input handling"][:asm :language] +[1:28:15][Step through our program to see how it handles our input][:asm :emulation :"input handling" :language :run] +[1:30:29][Fix our program to do_add the final '0'][:asm :language] +[1:30:49][:Run it to see that it's correct][:asm :emulation :"input handling" :language] +[1:31:09][Direct and indirect :threading][:asm :language :speech] +[1:34:05][That's all we have time for today][:speech] +[/video]