diff --git a/hmml_to_html/hmml_to_html.c b/hmml_to_html/hmml_to_html.c index f61e758..6abc505 100644 --- a/hmml_to_html/hmml_to_html.c +++ b/hmml_to_html/hmml_to_html.c @@ -116,7 +116,7 @@ main(int ArgC, char **Args) if(HMML.well_formed) { Working.Location = MemoryArena + ClaimedMemory; - Working.Size = 351; + Working.Size = 1024 * 2; ClaimedMemory += Working.Size; sprintf(Working.Location, @@ -140,23 +140,16 @@ main(int ArgC, char **Args) *Out.Ptr++ = *Working.Ptr++; } - Working.Location = '\0'; - ClaimedMemory -= Working.Size; - - Working.Location = MemoryArena + ClaimedMemory; - Working.Size = 1024; - ClaimedMemory += Working.Size; - int AnnotationIndex = 0; while(AnnotationIndex < HMML.annotation_count) { if(HMML.annotations[AnnotationIndex].reference_count) { sprintf(Working.Location, -"
\n" -" References ▼\n" -"
\n" -"
\n"); +"
\n" +" References ▼\n" +"
\n" +"
\n"); Working.Ptr = Working.Location; while(*Working.Ptr) @@ -169,13 +162,14 @@ main(int ArgC, char **Args) for(int i = 0; i < HMML.annotations[AnnotationIndex].reference_count; ++i) { sprintf(Working.Location, -" \n" -" (%s)\n" -" \n" -"
%s
\n" -"
%s
\n" -"
\n" -"
\n", +" \n" +" (%s)\n" +" \n" +"
%s
\n" +"
%s
\n" +"
\n" +"
\n", +AnnotationIndex, HMML.annotations[AnnotationIndex].references[i].url, TimecodeToSeconds(HMML.annotations[AnnotationIndex].time), HMML.annotations[AnnotationIndex].time, @@ -194,28 +188,14 @@ HMML.annotations[AnnotationIndex].references[i].page ? HMML.annotations[Annotati ++AnnotationIndex; } - Working.Location = '\0'; - ClaimedMemory -= Working.Size; - - Working.Location = MemoryArena + ClaimedMemory; - Working.Size = 256; - ClaimedMemory += Working.Size; - - Working.Location = '\0'; - ClaimedMemory -= Working.Size; - - Working.Location = MemoryArena + ClaimedMemory; - Working.Size = 1024; - ClaimedMemory += Working.Size; - sprintf(Working.Location, +"
\n" "
\n" +" Annotator: %s\n" "
\n" -" Annotator: %s\n" -"
\n" -"
\n" -"
\n" -"
\n", HMML.metadata.annotator, HMML.metadata.id); +"
\n" +"
\n" +"
\n", HMML.metadata.annotator, HMML.metadata.id); Working.Ptr = Working.Location; @@ -224,25 +204,20 @@ HMML.annotations[AnnotationIndex].references[i].page ? HMML.annotations[Annotati *Out.Ptr++ = *Working.Ptr++; } - Working.Location = '\0'; - ClaimedMemory -= Working.Size; - int DataRef = 0; for(int AnnotationIndex = 0; AnnotationIndex < HMML.annotation_count; ++AnnotationIndex) { - Working.Location = MemoryArena + ClaimedMemory; - Working.Size = 1024; - ClaimedMemory += Working.Size; - - if(HMML.annotations[AnnotationIndex].reference_count || HMML.annotations[AnnotationIndex].is_quote) + if(HMML.annotations[AnnotationIndex].reference_count) // || HMML.annotations[AnnotationIndex].is_quote) { - sprintf(Working.Location, "
\n", TimecodeToSeconds(HMML.annotations[AnnotationIndex].time), DataRef); + sprintf(Working.Location, +"
\n", TimecodeToSeconds(HMML.annotations[AnnotationIndex].time), AnnotationIndex); ++DataRef; } else { - sprintf(Working.Location, "
\n", TimecodeToSeconds(HMML.annotations[AnnotationIndex].time)); + sprintf(Working.Location, +"
\n", TimecodeToSeconds(HMML.annotations[AnnotationIndex].time)); } Working.Ptr = Working.Location; @@ -251,14 +226,15 @@ HMML.annotations[AnnotationIndex].references[i].page ? HMML.annotations[Annotati *Out.Ptr++ = *Working.Ptr++; } - sprintf(Working.Location, "
%s%s
\n" - "
\n" - "
%s%s
\n" - "
\n" - "
\n" - "
%s%s
\n" - "
\n" - "
\n", + sprintf(Working.Location, +"
%s%s
\n" +"
\n" +"
%s%s
\n" +"
\n" +"
\n" +"
%s%s
\n" +"
\n" +"
\n", HMML.annotations[AnnotationIndex].time, HMML.annotations[AnnotationIndex].text, HMML.annotations[AnnotationIndex].time, @@ -271,40 +247,76 @@ HMML.annotations[AnnotationIndex].references[i].page ? HMML.annotations[Annotati { *Out.Ptr++ = *Working.Ptr++; } - - Working.Location = '\0'; - ClaimedMemory -= Working.Size; - - *Out.Ptr++ = '\n'; } - Working.Location = MemoryArena + ClaimedMemory; - Working.Size = 256; - ClaimedMemory += Working.Size; - - sprintf(Working.Location, "
\n" - "
\n" - "\n" - "\n" - "\n"); +"\n" +"var refTimecodes = document.querySelectorAll(\".refs .ref .timecode\");\n" +"for (var i = 0; i < refTimecodes.length; ++i) {\n" +" refTimecodes[i].addEventListener(\"click\", function(ev) {\n" +" if (player) {\n" +" var time = ev.currentTarget.getAttribute(\"data-timestamp\");\n" +" player.setTime(parseInt(time, 10));\n" +" player.play();\n" +" ev.preventDefault();\n" +" return false;\n" +" }\n" +" });\n" +"}\n" +"\n" +"var refSources = document.querySelectorAll(\".refs .ref\");\n" +"for (var i = 0; i < refSources.length; ++i) {\n" +" refSources[i].addEventListener(\"click\", function(ev) {\n" +" if (player) {\n" +" player.pause();\n" +" }\n" +" });\n" +"}\n" +"\n" +"function onRefChanged(ref) {\n" +" if (ref !== undefined && ref !== null) {\n" +" document.querySelector(\".refs_container\").classList.add(\"current\");\n" +" var refs = document.querySelectorAll(\".refs .ref\");\n" +" for (var i = 0; i < refs.length; ++i) {\n" +" var dataID = refs[i].getAttribute(\"data-id\");\n" +" if (ref == dataID) {\n" +" refs[i].classList.add(\"current\");\n" +" } else {\n" +" refs[i].classList.remove(\"current\");\n" +" }\n" +" }\n" +" } else {\n" +" document.querySelector(\".refs_container\").classList.remove(\"current\");\n" +" var refs = document.querySelectorAll(\".refs .ref\");\n" +" for (var i = 0; i < refs.length; ++i) {\n" +" refs[i].classList.remove(\"current\");\n" +" }\n" +" }\n" +"}\n" +"\n" +" \n" +" \n" +"\n"); Working.Ptr = Working.Location; while(*Working.Ptr) diff --git a/hmml_to_html/out.html b/hmml_to_html/out.html index c972ff3..06a8605 100644 --- a/hmml_to_html/out.html +++ b/hmml_to_html/out.html @@ -8,280 +8,277 @@
- Ripple Carry Adders & Two's Complement - -
-
-
-
-
0:07Set the stage for the day, looking at two's complement and sign extension
-
-
0:07Set the stage for the day, looking at two's complement and sign extension
-
-
-
0:07Set the stage for the day, looking at two's complement and sign extension
-
-
+
+
+
+
+
0:06Recap and set the stage for the day
+
+
0:06Recap and set the stage for the day
+
+
+
0:06Recap and set the stage for the day
+
+
+
+
0:51Intuition on two's complement
+
+
0:51Intuition on two's complement
+
+
+
0:51Intuition on two's complement
+
+
+
+
4:10We are counting with zeroes
+
+
4:10We are counting with zeroes
+
+
+
4:10We are counting with zeroes
+
+
+
+
9:03Revisit instructions.scala and research register-transfer level
+
+
9:03Revisit instructions.scala and research register-transfer level
+
+
+
9:03Revisit instructions.scala and research register-transfer level
+
+
+
+
15:55Come to understand how to specify that rs1 represents an immediate or a register, thanks to the reply to the "Confusion Regarding Freedom E SDK inline asm" forum thread
+
+
15:55Come to understand how to specify that rs1 represents an immediate or a register, thanks to the reply to the "Confusion Regarding Freedom E SDK inline asm" forum thread
+
+
+
15:55Come to understand how to specify that rs1 represents an immediate or a register, thanks to the reply to the "Confusion Regarding Freedom E SDK inline asm" forum thread
+
+
+
+
18:25Read clear_csr() to put csrrc into perspective with our new understanding of pseudo-instructions and the i vs r hints
+
+
18:25Read clear_csr() to put csrrc into perspective with our new understanding of pseudo-instructions and the i vs r hints
+
+
+
18:25Read clear_csr() to put csrrc into perspective with our new understanding of pseudo-instructions and the i vs r hints
+
+
+
+
22:24Read about CSRRCI in the CSR Instructions section of the User-Level ISA Specification
+
+
22:24Read about CSRRCI in the CSR Instructions section of the User-Level ISA Specification
+
+
+
22:24Read about CSRRCI in the CSR Instructions section of the User-Level ISA Specification
+
+
+
+
23:05Walk through clear_csr() again
+
+
23:05Walk through clear_csr() again
+
+
+
23:05Walk through clear_csr() again
+
+
+
+
28:53GNU Assembly Syntax: Constraints and Syntax
+
+
28:53GNU Assembly Syntax: Constraints and Syntax
+
+
+
28:53GNU Assembly Syntax: Constraints and Syntax
+
+
+
+
35:15Continue reading clear_csr()
+
+
35:15Continue reading clear_csr()
+
+
+
35:15Continue reading clear_csr()
+
+
+
+
40:21Pop back up to the top of the stack, to reset_demo(), and read about the currently allocated RISC-V machine-level CSR addresses
+
+
40:21Pop back up to the top of the stack, to reset_demo(), and read about the currently allocated RISC-V machine-level CSR addresses
+
+
+
40:21Pop back up to the top of the stack, to reset_demo(), and read about the currently allocated RISC-V machine-level CSR addresses
+
+
+
+
44:11Read about Machine Interrupt Registers, including the mie (machine interrupt-enable) register
+
+
44:11Read about Machine Interrupt Registers, including the mie (machine interrupt-enable) register
+
+
+
44:11Read about Machine Interrupt Registers, including the mie (machine interrupt-enable) register
+
+
+
+
49:26Note how common it is in plic_driver.c for us to compute an address of a memory mapped register in order to mess with interrupts
+
+
49:26Note how common it is in plic_driver.c for us to compute an address of a memory mapped register in order to mess with interrupts
+
+
+
49:26Note how common it is in plic_driver.c for us to compute an address of a memory mapped register in order to mess with interrupts
+
+
+
+
51:45A few words on the sponge mode that we're in
+
+
51:45A few words on the sponge mode that we're in
+
+
+
51:45A few words on the sponge mode that we're in
+
+
+
+
52:50Continue reading about the Machine Interrupt Registers
+
+
52:50Continue reading about the Machine Interrupt Registers
+
+
+
52:50Continue reading about the Machine Interrupt Registers
+
+
+
+
58:33Return to demo_gpio.c and come to understand the clear_csr() calls in relation to the documentation
+
+
58:33Return to demo_gpio.c and come to understand the clear_csr() calls in relation to the documentation
+
+
+
58:33Return to demo_gpio.c and come to understand the clear_csr() calls in relation to the documentation
+
+
+
+
1:06:48We're out of time for today
+
+
1:06:48We're out of time for today
+
+
+
1:06:48We're out of time for today
+
+
+
+
+ - + +var refTimecodes = document.querySelectorAll(".refs .ref .timecode"); +for (var i = 0; i < refTimecodes.length; ++i) { + refTimecodes[i].addEventListener("click", function(ev) { + if (player) { + var time = ev.currentTarget.getAttribute("data-timestamp"); + player.setTime(parseInt(time, 10)); + player.play(); + ev.preventDefault(); + return false; + } + }); +} + +var refSources = document.querySelectorAll(".refs .ref"); +for (var i = 0; i < refSources.length; ++i) { + refSources[i].addEventListener("click", function(ev) { + if (player) { + player.pause(); + } + }); +} + +function onRefChanged(ref) { + if (ref !== undefined && ref !== null) { + document.querySelector(".refs_container").classList.add("current"); + var refs = document.querySelectorAll(".refs .ref"); + for (var i = 0; i < refs.length; ++i) { + var dataID = refs[i].getAttribute("data-id"); + if (ref == dataID) { + refs[i].classList.add("current"); + } else { + refs[i].classList.remove("current"); + } + } + } else { + document.querySelector(".refs_container").classList.remove("current"); + var refs = document.querySelectorAll(".refs .ref"); + for (var i = 0; i < refs.length; ++i) { + refs[i].classList.remove("current"); + } + } +} + + + diff --git a/hmml_to_html/player.js b/hmml_to_html/player.js index a5475ae..2eb8c97 100644 --- a/hmml_to_html/player.js +++ b/hmml_to_html/player.js @@ -39,6 +39,8 @@ function Player(htmlContainer, refsCallback) { this.youtubePlayerReady = false; this.playing = false; this.shouldPlay = false; + this.buffering = false; + this.pauseAfterBuffer = false; this.speed = 1; this.currentTime = 0; this.lastFrameTime = 0; @@ -75,6 +77,8 @@ Player.prototype.pause = function() { if (this.youtubePlayerReady) { if (this.playing) { this.youtubePlayer.pauseVideo(); + } else if (this.buffering) { + this.pauseAfterBuffer = true; } } else { this.shouldPlay = false; @@ -365,6 +369,12 @@ Player.prototype.onYoutubePlayerStateChange = function(ev) { } else { this.playing = false; } + + this.buffering = ev.data == YT.PlayerState.BUFFERING; + if (this.playing && this.pauseAfterBuffer) { + this.pauseAfterBuffering = false; + this.pause(); + } }; Player.prototype.onYoutubePlayerPlaybackRateChange = function(ev) {