PC Assembler - PowerPoint PPT Presentation

1 / 18
About This Presentation
Title:

PC Assembler

Description:

PC Assembler Ing. E.E. Mak MSc Cluster1 Introduction Microprocessors Numbers, Binary, Hexadecimal, ASCII Adding and subtracting Instructions and Flags Deeds Z80 ... – PowerPoint PPT presentation

Number of Views:19
Avg rating:3.0/5.0
Slides: 19
Provided by: emak7
Category:

less

Transcript and Presenter's Notes

Title: PC Assembler


1
PC Assembler
  • Ing. E.E. Mak MSc

2
Cluster1
  • Introduction
  • Microprocessors
  • Numbers, Binary, Hexadecimal, ASCII
  • Adding and subtracting
  • Instructions and Flags
  • Deeds Z80 simulator

3
Computer Lay-out
MEM datainstructions
I/O
External
CPU
4
Model CPU
PC
R2
R1
M A R
IR
A
B
ALU
M D R
DECODER
SR
C
ICU
TIMER
CLOCK
5
Z80 Processor Register Layout
A
F
F
A
I
W
Z
W
Z
R
B
C
B
C
Flags 8 bit
D
E
D
E
H
L
H
L
S
Sign
Z
Zero
-
-
I
X
H
Half-Carry
I
Y
-
-
S
P
P/V
Parity/overfl.
N
Negate
P
C
C
Carry
6
Negative Numbers
Using the 8-th bit as a SIGN bit
53
0
1
1
1
0
1
0
0
-53
1
1
1
1
0
1
0
0
Inverting the bits
53
0
1
1
1
0
1
0
0
-53
1
0
0
0
1
0
1
1
7
Twos Complement
13
0
0
1
0
1
1
0
0
inv
1
1
0
1
0
0
1
1
1
1
1
1
0
1
0
0
1
1
Twos Complement
8
Packed Decimals
binary
0
1
1
1
0
1
0
0
53
Binary packed decimal
0
1
1
1
0
1
0
0
5
3
35
9
Addition
1
1
1
0
0
0
0
0
0
0
1
0
0
1
0
1

1
1
0
0
0
1
1
1
10
Subtraction
1
1
0
0
0
1
1
1
0
0
1
0
0
1
0
1
-
1
1
1
0
0
0
0
0
11
Flags
  • Carry
  • Overflow
  • Zero
  • Negative
  • ..
  • ...

12
Generic Instructions
  • Input/output data
  • Load a value(register) into a register
  • Arithmetic
  • jumping / subroutine
  • control
  • Bitwise operators Boolean, Register shifts
  • interrupt handling
  • stacking

13
Example programs
LD A,86d ADD A,57d LD A,86d ADC A,57d
14
Example programs2
Adding 57 to HL LD A,L ADD A,57d LD L,A LD A,H
ADC A,0 LD H,A
15
Assignments
1. Write a program to store 100 into DE and 385
into BC ADD thereafter DE and BC
into HL 2. Investigate substraction using
negative numbers for all number-configurations
demonstrated in previous sheets 3. Investigate
how to multiply using binary numbers 4. Investiga
te using shift operators could facilitate the
multiplication process. 5. What are floating
point decimals , how are they implemented?
16
links
  • Simple reference list Z80 opcodes
  • http//www.ticalc.org/pub/text/z80/z80.txt
  • Lots of information about the Z80
  • http//www.z80.info/
  • full reference list op-codes Z80
  • http//www.ticalc.org/pub/text/z80/z80_reference.t
    xt
  • Crash-course Z80 assembly-programming
  • http//www.ticalc.org/pub/text/z80/z80asmg.zip

17
Binary Packed
0E
0
0
0
0
1
1
1
0
1A
0
0
0
1
1
0
1
0

28
0
1
0
0
1
0
0
0
The use of half bytes let us express two adjacent
hexadecimal numbers. As a consequence, we may use
this two-digit hexadecimal byte presentation to
perform calculations as well, whereas the
carry-mechanism while adding work accordingly
In hexadecimal coding, each digit of one halfbyte
represents a hexadecimal number
18
Binary Packed Decimal
07
0
0
1
0
0
1
1
0
17
0
0
1
1
0
1
1
0

24
0
1
0
0
0
1
0
0
The use of half bytes for numbers 0..9 only,
forces while adding special corrections to
facilitate adding of these decimal numbers. (What
would the result have been without this
corrections?)
Could you develop an algorithm to make this
corrections?
Write a Comment
User Comments (0)
About PowerShow.com