Download presentation
Presentation is loading. Please wait.
Published byMoris Wood Modified over 9 years ago
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 data+instructions CPU I/O External
4
Model CPU PCR2R1 IR M A RM A R M D RM D R ALU AB SR DECODER ICU TIMER C CLOCK
5
Z80 Processor Register Layout Main registers. Alternative registers. S Z - H - P/V N C Sign Zero - Half-Carry - Parity/overfl. Negate Carry Flags 8 bit Adress Registers Accumulator Registers Interupt register Memory Refresh Alternative Registers W’ B’ H’ D’ Z’ C’ L’ E’ W B H D AF’FA’ Z C L E I R IX IY SP PC
6
Negative Numbers 01110100 53 = 11110100 -53 = Using the 8-th bit as a SIGN bit 01110100 53 = 10001011 -53 = Inverting the bits
7
Two’s Complement 00101100 11010011 13 1 11010011 inv +1 Two’s Complement
8
Packed Decimals 01110100 3 5 35 = 01110100 53 = binary Binary packed decimal
9
Addition 11100000 00100101 11000111 +
10
Subtraction 11100000 00100101 11000111 -
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 LDL,A LDA,H ADCA,0 LDH,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.Investigate 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.txt Crash-course Z80 assembly-programming –http://www.ticalc.org/pub/text/z80/z80asmg.zip
17
Binary Packed 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 0E0E 01001000 00011010 00001110 + 1A1A 2828 In hexadecimal coding, each digit of one halfbyte represents a hexadecimal number
18
Binary Packed Decimal 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?) 0707 01000100 00110110 00100110 + 1717 2424 Could you develop an algorithm to make this corrections?
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.