Post on 01-Feb-2016
description
Business Programming I
Fall – 2000By
Jim Payne
Lecture 02 Jim Payne - University of Tulsa 2
Babbage to Billy-O
Between 1833 and the mid-1940’s, there were very few new developments in the field of programming languages. We did see a major contribution to the future of computing with the development of the keypunch machine and punch cards by Herman Hollerith in the 1880’s.
Lecture 02 Jim Payne - University of Tulsa 3
Tabulating Machine
Link to biography of Herman Hollerith
Lecture 02 Jim Payne - University of Tulsa 4
Links: Early History of Computers
Virginia Tech – History of ComputingVirtual Museum of the United KingdomSmithsonian Museum - ComputersCheck out these sites to learn more about the Turing Machine, the ABC machine, the ENIAC, and then in 1951, the UNIVAC. All of these machines were either hard wired for each instruction or began the use of assembler language instructions.
Lecture 02 Jim Payne - University of Tulsa 5
Assembler Language
In the slides that follow, I will be using an “assembler like” computer programming language named BILLY-O. The language was developed at Iowa State University and then used by Dr. Roger Wainwright – TU, for several years in the early 1980’s to support the teaching of programming concepts and to help students understand at least the basics of what actually happens inside the computer.
My thanks to Dr. Wainwright for supporting its continued use some twenty years later.
Lecture 02 Jim Payne - University of Tulsa 6
Instructions: I/O & Memory Movement
INP InputOUT OutputLDA Load Accumulator STA Store AccumulatorLDC Load a ConstantADC Add a Constant
Lecture 02 Jim Payne - University of Tulsa 7
Instructions: Arithmetic
Operators
ADD Add to AccumulatorSUB Subtract from AccumulatorMPY Multiply AccumulatorDIV Divide Accumulator
Lecture 02 Jim Payne - University of Tulsa 8
Instructions: Branching Commands
BRU Branch UnconditionallyBPA Branch + AccumulatorBNA Branch - AccumulatorBZA Branch Zero Accumulator
Lecture 02 Jim Payne - University of Tulsa 9
Instructions: Data and Ending
HLT End of ProcedureNUM Initializing VariablesEND Last Instruction
Lecture 02 Jim Payne - University of Tulsa 10
BILLY-O LANGUAGEComplete Instruction Set
INP OUT LDA STA
LDC ADC ADD SUB
MPY DIV BRU BPA
BNA BZA HLT NUM
END
INP
Arithmetic Logic Unit
Accumulator
Memory
OUT
ADC LDC LDA
ADD
SUB
MPY
DIV
STA
BRU
BPA
BNA
BZA
Lecture 02 Jim Payne - University of Tulsa 12
Problem: Input 2 numbers, A & B. Compute C = A * B.Then Output C.
A = 5 B = 6
Answer: C = 30
FLOWCHART OF PROBLEM
START
INP A
INP B
C = A * B
OUT C
STOP
LDA A
MPY B
STA C
1 2 3 4 5 6 7 8 9
I N P A
I N P B
L D A A
M P Y B
S T A C
O U T C
H L T
E N D
INP
Arithmetic Logic Unit
Accumulator
Memory
OUT
ADC LDC LDA
ADD
SUB
MPY
DIV
STA
BRU
BPA
BNA
BZA
5,6
ABC
INP A
INP B
LDA A
MPY B
STA C
OUT C
HLT
END
56
5
30
30
30
Lecture 02 Jim Payne - University of Tulsa 16
Problem:
Input a series of exam scores between 0 and 100 until a trip value of 999 is entered.
Then print out the number of scores
processed, the average exam score, and the number of students that passed the exam (score of 60 or better).
Introduction of Bertha’s DP World
IN OUT
Typewriter
Calculator
Paper & Pencil
Lecture 02 Jim Payne - University of Tulsa 18
How Would Bertha Do This?
Pick Up from the in basket a series of exam scores between 0 and 100 until a trip value of 999 is encountered.
Then type up a report that provides the number of scores processed, the average exam score, and the number of students that passed the exam (score of 60 or better).
Then put the typed report in the out basket.
Bertha Method
IN Baske
t
70
80
100
40
10
999
Sum of Scores
Counter of Scores
Counter of Passing
0 00
STEPS: (In Pseudocode Form)Pick up a card from the in basket.
If score = 999, do what? Else do what?
NOT EQUAL 999: Add score to Sum of Scores, Add 1 to Counter of Scores. If score >= 60, Add 1 to Counter of Passing. Then go read next score.
EQUAL 999: Compute Average Score = Sum of Scores / Counter of Scores. Print out report answers. Quit Processing
Variable Naming
SCR = Individual Score
SOS = Sum of Scores
COS = Counter of Scores
COP = Counter of Passing
AVG = Average Score = SOS / COS
Pseudocode Revised
Input a value for SCR
If SCR = 999
Compute AVG = SOS / COS
Print Results and Quit
Else
Compute SOS = SOS + SCR
Compute COS = COS + 1
If SCR >= 60
Compute COP = COP + 1
EndIf
Endif
Go to Top of Program
Flowchart of Logic
Start
Stop
Billy-O Program
TOP INP SCR
LDA SCR
ADC -999
BZA MID
LDA SOS
ADD SCR
STA SOS
LDA COS
ADC 1
STA COS
LDA SCR
ADC -60
BNA TOP
LDA COP
ADC 1
STA COP
BRU TOP
MID LDA SOS
DIV COS
STA AVG
OUT AVG
OUT COS
OUT COP
HLT
SOS NUM 0
COS NUM 0
COP NUM 0
END
Billy-O Program
TOP INP SCR
LDA SCR
ADC -999
BZA MID
LDA SOS
ADD SCR
STA SOS
LDA COS
ADC 1
STA COS
LDA SCR
ADC -60
BNA TOP
LDA COP
ADC 1
STA COP
BRU TOP
MID LDA SOS
DIV COS
STA AVG
OUT AVG
OUT COS
OUT COP
HLT
SOS NUM 0
COS NUM 0
COP NUM 0
END
IN Baske
t
70
80
100
40
10
999
Lecture 02 Jim Payne - University of Tulsa 24