Hand Made Hero

Published on:


Main Link: Hand Made Hero
Video Guide: Episode Guide

(my day 00)

Rant:

Infact i will take this oppurtunity to create summaries, of every single video, and make a short comprehensive guide through these
day by articles, on how to navigate this course. I feel like this course is much much more than a university can ever offer, in
terms of value and quality.

My Journey into Handmade Hero

Jan-24-2025 (my day 01)

Intro to C on Windows - Day 1

Jan-25-2025 (my day 02)

Intro to C on Windows - Day 2

Jan-26-2025 (my day 03)

Intro to C on Windows - Day 3

Latency and Bandwidth

Relationship Between Latency and Bandwidth - Latency is about “how fast the first byte arrives.” - Bandwidth is about “how many bytes arrive in a given time.”

Imagine a water pipe analogy: - Latency: The time it takes for the first drop of water to come out after turning on the tap. - Bandwidth: The volume of water that can flow out of the pipe per second.

How Memory Uses Higher Bandwidth to Cope with Slower Latency ?

Intro to C on Windows - Day 4

Jan-27-2025 (my day 04)

Intro to C on Windows - Day 4

Jan-28-2025 (my day 05)

Intro to C on Windows - Day 4

- Understanding the memory view of the program
0x00000088D491E884   44  15   1   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0  ,..................

0x00000088D491E884
------------------
- this is the memory address. and it is represented in hexadecimal, and its decimanl representation is 587681884292.
- memory is a long line of bytes, and this is the address of some byte in that very long array of memory.
- its actually virtual memroy, not physical, which is why it shows the current number of the byte is ~587 billion byte,  
though we don't have that much phsyical memory.

44  15   1   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0
--------------------------------------------------------------------------
- starting with the 0x00000088D491E884'th byte in the virtual memory, Visual Studio will show the next bytes in each of its column.  
- so its like word wrap of this long memory.
- This is the actual contiguous memory starting from 0x00000088D491E884. and  0x00000088D491E884 is the address for '44'
and 0x00000088D491E884+1 would be the address of '15' and so on.  
- 

,..................
-------------------
- this portion is the ASCI representation of this memory (44  15   1   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0)
- 
- Understanding disasembly
00007FFA258635BB C7 45 94 2C 0F 01 00 mov         dword ptr [rbp-6Ch],10F2Ch

00007FFA258635BB
----------------
- this is the memory address

C7 45 94 2C 0F 01 00
- this is the showing the memory bytes starting from the address 00007FFA258635BB
- the memory (C7 45 94 2C 0F 01 00) is what the processor actually sees.(which is hexadecimal representation of the binary data)
- this set of memory is actually an instruction, that tells the CPU to do something
- the width of the instructions (in this case being 7 bytes) is not constant in x86 processors
- for example the below instruction is only 3 bytes
		00007FFA258635C7 48 63 C9             movsxd      rcx,ecx  

mov         dword ptr [rbp-6Ch],10F2Ch
--------------------------------------
- this is the assembly version of the instruction that is represented in the instruction (C7 45 94 2C 0F 01 00)

int x;
x = 69420;
memory of x: 0x00000088D491E884   44  15   1   0   0   0   0   0   0   0

        69420
        1 0000 1111 0010 1100
        - --------- ---------

        6  3 1 0 0 0 0 0 0  0 0 0 0 0 0 0 0
        5  2 6 8 4 2 1 0 0  0 0 0 0 0 0 0 0
        5  7 3 1 0 0 0 5 2  1 0 0 0 0 0 0 0

        3  6 8 9 9 4 2 1 5  2 6 3 1 0 0 0 0
        6  8 4 2 6 8 4 2 6  8 4 2 6 8 4 2 1

        -  ---------------  ---------------
        1  0 0 0 0 1 1 1 1  0 0 1 0 1 1 0 0
        1       15               44
        -  ---------------  ---------------

        65536 2048+1024+512+256 32+8+4
        65536 3840              44
        44 15 1
        2C 0F 01

        6  3 1 0 0 0 0 0 0  0 0 0 0 0 0 0 0
        5  2 6 8 4 2 1 0 0  0 0 0 0 0 0 0 0
        5  7 3 1 0 0 0 5 2  1 0 0 0 0 0 0 0
        3  6 8 9 9 4 2 1 5  2 6 3 1 0 0 0 0
        6  8 4 2 6 8 4 2 6  8 4 2 6 8 4 2 1

        -  ---------------  ---------------
        1  0 0 0 0 1 1 1 1  0 0 1 0 1 1 0 0
        1       15               44
        -  ---------------  ---------------

which is when i follow the memory of the integer that is holding the value 69420 is like the following in memory:

0x00000088D491E884   44  15   1   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0  ,..................

44  15   1   0
--------------
- these are the 4 bytes that represents the value '69420'
- as you can see its in reverse order. The direction of bytes could be left-to-right or right-to-left, it depends on the  
  CPU manufacturer.
- order of placing bytes is called 'endian' mode. 
Little Endian - places the low order byte first. this is what the above example uses, thats why highest order is on the right
 - example architectures are x86, arm, x64
Big Endian - places the high order bytes first
- these are older architectures

Jan-29-2025 (my day 06)

Intro to C on Windows - Day 5