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
RISC-V Static Assembler, 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:00Recap and set the stage for the day
🗩
0:00Recap and set the stage for the day
🗩
0:00Recap and set the stage for the day
🗩
0:40Determine that distinguishing symbols at the lexical level was a design fault, and to rectify this
🗩
0:40Determine that distinguishing symbols at the lexical level was a design fault, and to rectify this
🗩
0:40Determine that distinguishing symbols at the lexical level was a design fault, and to rectify this
🗩
3:20Replace str_range_to_sym() and the notion of multiple symbol kinds at the lexical level with str_intern_range()
3:20Replace str_range_to_sym() and the notion of multiple symbol kinds at the lexical level with str_intern_range()
3:20Replace str_range_to_sym() and the notion of multiple symbol kinds at the lexical level with str_intern_range()
6:06Simplify parse_line() to call parse_name() and semantically integrate the lexer and parser into the assembler
6:06Simplify parse_line() to call parse_name() and semantically integrate the lexer and parser into the assembler
6:06Simplify parse_line() to call parse_name() and semantically integrate the lexer and parser into the assembler
13:17Run it to see that it looks reasonable
🏃
13:17Run it to see that it looks reasonable
🏃
13:17Run it to see that it looks reasonable
🏃
13:37Review newline handling in next_token()
🗩
13:37Review newline handling in next_token()
🗩
13:37Review newline handling in next_token()
🗩
15:22Setup to create a symbol table
15:22Setup to create a symbol table
15:22Setup to create a symbol table
17:35Enable parse_line() to distinguish xregs and instructions1
17:35Enable parse_line() to distinguish xregs and instructions1
17:35Enable parse_line() to distinguish xregs and instructions1
25:17Introduce def_instr() and its accompanying instr_defs instruction table
25:17Introduce def_instr() and its accompanying instr_defs instruction table
25:17Introduce def_instr() and its accompanying instr_defs instruction table
32:54Step in to parse_line() to see what's going on
🏃
32:54Step in to parse_line() to see what's going on
🏃
32:54Step in to parse_line() to see what's going on
🏃
33:06Introduce def_instrs() for init_assembler() to call
33:06Introduce def_instrs() for init_assembler() to call
33:06Introduce def_instrs() for init_assembler() to call
34:33Run it to see that it found our "add" instruction
🏃
34:33Run it to see that it found our "add" instruction
🏃
34:33Run it to see that it found our "add" instruction
🏃
34:46Fill in the instr_defs table2
34:46Fill in the instr_defs table2
34:46Fill in the instr_defs table2
43:59Introduce parse_instr() to handle registers and immediates, lofting out the interning part of def_sym() to add_sym()
43:59Introduce parse_instr() to handle registers and immediates, lofting out the interning part of def_sym() to add_sym()
43:59Introduce parse_instr() to handle registers and immediates, lofting out the interning part of def_sym() to add_sym()
49:46Run it to see that the old stuff does still work
🏃
49:46Run it to see that the old stuff does still work
🏃
49:46Run it to see that the old stuff does still work
🏃
50:13Introduce def_regs()
50:13Introduce def_regs()
50:13Introduce def_regs()
52:55Step in to parse_line() to see what's going on
🏃
52:55Step in to parse_line() to see what's going on
🏃
52:55Step in to parse_line() to see what's going on
🏃
53:44Make init_assembler() call def_regs()
53:44Make init_assembler() call def_regs()
53:44Make init_assembler() call def_regs()
54:01Run it to see that it works
🏃
54:01Run it to see that it works
🏃
54:01Run it to see that it works
🏃
54:13Fix parse_xreg() to print the error-causing token, rather than the next token
54:13Fix parse_xreg() to print the error-causing token, rather than the next token
54:13Fix parse_xreg() to print the error-causing token, rather than the next token
54:39Test our error handling
🏃
54:39Test our error handling
🏃
54:39Test our error handling
🏃
55:07A few words on sections in executables
🗩
55:07A few words on sections in executables
🗩
55:07A few words on sections in executables
🗩
57:49Augment the Assembler struct with section-like data and introduce asm_bytes() to emit our code
57:49Augment the Assembler struct with section-like data and introduce asm_bytes() to emit our code
57:49Augment the Assembler struct with section-like data and introduce asm_bytes() to emit our code
1:07:09Introduce parse_lines() and add some emulation of our asm emission to asm_test()
1:07:09Introduce parse_lines() and add some emulation of our asm emission to asm_test()
1:07:09Introduce parse_lines() and add some emulation of our asm emission to asm_test()
1:08:48Introduce parse_imm() for parse_instr() to call, and emit immediates
1:08:48Introduce parse_imm() for parse_instr() to call, and emit immediates
1:08:48Introduce parse_imm() for parse_instr() to call, and emit immediates
1:11:54Test our assembler on an addi instruction
1:11:54Test our assembler on an addi instruction
1:11:54Test our assembler on an addi instruction
1:12:17Step through parse_instr() to see how it handles our immediate
🏃
1:12:17Step through parse_instr() to see how it handles our immediate
🏃
1:12:17Step through parse_instr() to see how it handles our immediate
🏃
1:14:05Fix asm_bytes() to update the buffer size
1:14:05Fix asm_bytes() to update the buffer size
1:14:05Fix asm_bytes() to update the buffer size
1:14:49Run it to see that it worked
🏃
1:14:49Run it to see that it worked
🏃
1:14:49Run it to see that it worked
🏃
1:15:09Handling labels in a multi-pass assembler
🗩
1:15:09Handling labels in a multi-pass assembler
🗩
1:15:09Handling labels in a multi-pass assembler
🗩
1:19:35Implement support for back-referenced load labels in parse_instr()
1:19:35Implement support for back-referenced load labels in parse_instr()
1:19:35Implement support for back-referenced load labels in parse_instr()
1:30:18Introduce init_cmds() and related functions and structs for defining data types
1:30:18Introduce init_cmds() and related functions and structs for defining data types
1:30:18Introduce init_cmds() and related functions and structs for defining data types
1:40:23Test the assembler on our "val" label
1:40:23Test the assembler on our "val" label
1:40:23Test the assembler on our "val" label
1:40:41Run it to see that it worked
🏃
1:40:41Run it to see that it worked
🏃
1:40:41Run it to see that it worked
🏃
1:41:53Make our assembler multi-pass, introducing init_pass()
1:41:53Make our assembler multi-pass, introducing init_pass()
1:41:53Make our assembler multi-pass, introducing init_pass()
1:47:14Run it to see that it worked
🏃
1:47:14Run it to see that it worked
🏃
1:47:14Run it to see that it worked
🏃
1:47:54Recap how the assembler's passes work
🗩
1:47:54Recap how the assembler's passes work
🗩
1:47:54Recap how the assembler's passes work
🗩
1:50:41Q&A
🗩
1:50:41Q&A
🗩
1:50:41Q&A
🗩
1:51:11xanatos387 I was curious about the sections earlier. The explanation makes sense. I guess we'll start out with a flat model, and at some point as the hardware / OS gets more advanced we'd need sections?
🗪
1:51:11xanatos387 I was curious about the sections earlier. The explanation makes sense. I guess we'll start out with a flat model, and at some point as the hardware / OS gets more advanced we'd need sections?
🗪
1:51:11xanatos387 I was curious about the sections earlier. The explanation makes sense. I guess we'll start out with a flat model, and at some point as the hardware / OS gets more advanced we'd need sections?
🗪
1:53:39navastyles pervognsen How many assemblers have you made?
🗪
1:53:39navastyles pervognsen How many assemblers have you made?
🗪
1:53:39navastyles pervognsen How many assemblers have you made?
🗪
1:54:23That's it for today
🗩
1:54:23That's it for today
🗩
1:54:23That's it for today
🗩