1 / 17

Assembly Microprocessors session 2

Assembly Microprocessors session 2. ing. Ernst E. Mak MSc. Contents:. Binary numbers, Addition, Subtraction, Two’s complement Starting Deeds, Board, Dipswitches, Editor, Debugger programming structure: Assembly directive: ORG memory designator Labels Statements Operands

perdy
Download Presentation

Assembly Microprocessors session 2

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Assembly Microprocessorssession 2 ing. Ernst E. Mak MSc

  2. Contents: • Binary numbers, Addition, Subtraction, Two’s complement • Starting Deeds, Board, Dipswitches, Editor, Debugger • programming structure: • Assembly directive: ORG memory designator • Labels • Statements • Operands • Comments • Deeds Help function • Registers, Flags, Memory, Decimal and Hexadecimal

  3. X-ary Numbers • X = base number of the number system • consist of symbols 0.......(X-1) • QUESTION: Why not 0.....X ???? Adjacent digits (from right to left) represent increasing powers of the X-ary system

  4. 0 0 0 9 9 9 1 1 1 8 8 8 2 2 2 3 3 3 7 7 7 4 4 4 6 6 6 5 5 5 MODEL : hodometer

  5. HODOMETER (2) • What was the X? • How many symbols per disc ? • Maximum number? • Now imagine a BINARY disc into the hodometer •  write down the first 20 numbers • ? how many discs did you need?

  6. 0 0 0 1 1 1 MODEL : hodometer

  7. Addition 1 0 1 0 0 0 0 1 0 1 0 0 0 1 0 1 + 1 1 1 0 0 1 1 0

  8. Negative Numbers Using the 8-th bit as a SIGN bit 53 = 0 0 1 1 0 1 0 1 -53 = 1 0 1 1 0 1 0 1 Inverting the bits 53 = 0 0 1 1 0 1 0 1 -53 = 1 1 0 0 1 0 1 0

  9. Two’s Complement 13 0 0 0 0 1 1 0 1 inv 1 1 1 1 0 0 1 0 1 +1 Two’s Complement 1 1 1 1 0 0 1 1

  10. Two’s Complement (2) 61 0 0 1 1 1 1 0 1 Two’s Complement 13 1 1 1 1 0 0 1 1 + 1 0 0 1 1 0 0 0 0 48

  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. ASSEMBLY-LAY-OUT {LABEL:} [tab] OPCODE [tab] {OPERANDS} [tab] {; remark-line} examples: start: JP 100 ; go to program start loop: JR NC,-10 ; Loop back if not carry AND A,32 ; reset 6th bit in accumulator HALT ; stop execution ; this is a remark line without operation

  14. MNEMONIC • “short-hand” • examples: • add a,10 ;add 10 into the a register • jp 155 ;jump to a location • inc H ;increase the h register by one

  15. ASSEMBLER DIRECTIVES • ORG xxx • lable DW 122 • lable2 DB 10 • organize next code starting at memory location xxxx • define a value 122 into a word type of variable called ‘lable’ • define a value 10 into a byute type variable called ‘lable2’

  16. ASSEMBLER CYCLE text file start: ORG 100 begin: jp 130 add a,3 loop: nop nop inc bc .... ..... LINK ROUTINE modules MEMORY 11010010;10011000;00011101;11101010;11101110;11110110;10100111;01000011;11110000;01100000;10101011;10111000;01111101;11000011;10110111;00010101;01111111;01000010;01000000;11000101;11011110;10110111;01000000;11011101;10011000;10110110; ASSEMBLER LINKER TEXT EDITOR DEBUGGER MICRO PROCESSOR input output

  17. Main registers. Alternative registers. Accumulator Registers Interupt register Alternative Registers Memory Refresh Adress Registers Z80 Processor Register Layout I A’ A F F’ R W Z W’ Z’ B C B’ C’ D E D’ E’ Flags 8 bit H L H’ L’ S Sign Z Zero I X - - H Half-Carry I Y - - S P P/V Parity/overfl. P C N Negate C Carry

More Related