Intro to Programming

What is programming?

Types of Programming

Machine Code

Location

Instruction Code

Comments

100

0010 0001 0000 0100

Load first operand into AC

101

0001 0001 0000 0101

Add second operand to AC

102

0011 0001 0000 0110

Store sum in location 106

103

0111 0000 0000 0001

Halt computer

104

0000 0000 0101 0011

83 decimal

105

1111 1111 1111 1110

-2 decimal

106

0000 0000 0000 0000

Store sum here

Assembly Language

Location

Instruction Code

Comments

ORG 100

/Origin of program is location 100

 

LDA A

/Load operand from location A

 

ADD B

/Add operation form location B

 

STA C

/Store sum in location C

 

HLT

/Halt computer

A,

DEC 83

/Decimal operand

B,

DEC -2

/Decimal operand

C,

DEC 0

/Sum stored in location C

 

END

 

High-Level Language

Java:
int a, b, c;
a = 83;
b = -2;
c = a + b;

Compiled vs. Interpreted



XKCD: "Compiling!"