CS计算机代考程序代写 Roadmap

Roadmap

Binary and Hexadecimal
Binary is base 2
Symbols: 0, 1
Convention: 210 = 102 = 0b10
Example: What is 0b110 in base 10?
0b110 = 1102 = (1 22) + (1 21) + (0 20) = 610

Hexadecimal (hex, for short) is base 16
Symbols? 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, …?
Convention: 1610 = 1016 = 0x10
Example: What is 0xA5 in base 10?
0xA5 = A516 = (10 161) + (5 160) = 16510
1
9, A, B, C, D, E, F

CMPT 295
Week 1 – Summary
Base Comparison
Why does all of this matter?
Humans think about numbers in base 10, but computers “think” about numbers in base 2
Binary encoding is what allows computers to do all of the amazing things that they do!

You should have this table memorized by the end of the class
Might as well start now!
2
Base 10 Base 2 Base 16
0 0000 0
1 0001 1
2 0010 2
3 0011 3
4 0100 4
5 0101 5
6 0110 6
7 0111 7
8 1000 8
9 1001 9
10 1010 A
11 1011 B
12 1100 C
13 1101 D
14 1110 E
15 1111 F

CMPT 295
Week 1 – Summary
Hardware: 295 View (version 1)
3
Memory

CPU
take 300
registers

data
instructions
We will start by learning about Memory
How does a program find its data in memory?

CMPT 295
Week 1 – Summary
3

Addresses and Pointers
An address is a location in memory
A pointer is a data object that holds an address
Address can point to any data
Value 504 stored at
address 0x08
50410 = 1F816
= 0x 00 … 00 01 F8
Pointer stored at
0x38 points to
address 0x08
4

0x00
0x08
0x10
0x18
0x20
0x28
0x30
0x38
0x40
0x48

Address
00
00
00
00
00
00
01
F8
00
00
00
00
00
00
00
08
64-bit example
(pointers are 64-bits wide)

big-endian

CMPT 295
Week 1 – Summary
Note that everything is just padded with extra 0s

4

/docProps/thumbnail.jpeg