Two Pass Assemblers Tutorial

Two Pass Assemblers Tutorial

Learn Learn Scratch Tutorials

4 года назад

19,340 Просмотров

Ссылки и html тэги не поддерживаются


Комментарии:

@smolus0512
@smolus0512 - 09.11.2023 19:42

Just for anyone wondering. This is absolutely not applicable to a real architecture like x86 (at least not in the way it was presented). First of all the idea of opcode table is impossible since opcodes depend on their arguments. For example, in x86, the assembly mnemonic "add" can refer to 12 different machine instructions, each with different encodings. Second of all, building symbol table on the first pass is also impossible since certain instructions can have variable length. For example "jz" (jump if zero) will be 2 bytes long for 8bit offset, 4 bytes long for 16bit offset and 5 bytes long for 32bit offset. We can't know what length this instruction will have until we know it's distance to the label, and we can't know addresses of labels until we resolve all of these variable length encodings. Chicken and egg kind of problem. Things can get even more complicated if we add external symbols to the mix. On top of that, encoding operands is fairly complicated and varies between different instructions and addressing modes. There are also 6 different prefixes that can be added before an instruction to affect its meaning. Assemblers do a ton of work to encode your assembly code in the most optimal way possible. A lot of people seem to think that assembly is a 1-1 translation to machine code and don't realize how much abstraction there is between assembly and machine code. Assemblers make a ton of choices for you and perform many different optimizations/instruction substitution. They are a lot more sophisticated than people realize.

Ответить
@samuraijosh1595
@samuraijosh1595 - 21.09.2023 16:59

simple and concise. nalla video machi

Ответить
@SequesterOfPonderance
@SequesterOfPonderance - 15.01.2023 02:00

you dont really need a linker, just headers.

Ответить
@ikran7869
@ikran7869 - 02.05.2022 15:27

excellent video!

Ответить
@tobbyx3306
@tobbyx3306 - 20.04.2022 04:23

There is a question from AS computer Science paper suggest that data items are converted into their binary equivalent is done by first pass

Ответить
@nyan272
@nyan272 - 03.04.2022 20:58

Clear and concise

Ответить
@barrydevine
@barrydevine - 12.01.2022 16:41

They aren't highlighted because they are variables (not labels)

Ответить
@colonelbarker
@colonelbarker - 05.12.2021 14:33

Thanks for making this. Really appreciated!

Ответить
@planetlumi4138
@planetlumi4138 - 08.11.2021 18:37

I love this man so much

Ответить
@petrosfore6854
@petrosfore6854 - 25.10.2021 11:24

My Class loved this. Thanks mate.

Ответить
@vaibhavmankar5275
@vaibhavmankar5275 - 24.02.2021 16:57

JUST AWESOME

Ответить
@ra7binet
@ra7binet - 05.09.2020 00:42

1: LocationCounter ← 0
2: Get first line of source code.
3: while more lines do
4: if line has a label then
5: SymbolTable.Symbol ← label
6: SymbolTable.Location ← LocationCounter
7: end if
8: Determine number of bytes required by the line when assembled.
9: LocationCounter ← LocationCounter + NumberOfBytes
10: Get next line of source code.
11: end while

Ответить
@tarcymatinhure1633
@tarcymatinhure1633 - 07.07.2020 18:32

your awesome

Ответить
@yelocalwierdo2440
@yelocalwierdo2440 - 31.03.2020 07:12

OMG I'M SUCH A BIG FAN PLEASE COME TO THAILAND

Ответить
@yelocalwierdo2440
@yelocalwierdo2440 - 31.03.2020 07:11

incredible video. 420/69

Ответить