Ele22mic lecture 7
This presentation is the property of its rightful owner.
Sponsored Links
1 / 12

ELE22MIC Lecture 7 PowerPoint PPT Presentation


  • 84 Views
  • Uploaded on
  • Presentation posted in: General

ELE22MIC Lecture 7. Instruction Set Overview, Part 4 HC-COM - Lab notes Stack Pointer, Push, Pull Call / Return Data Conditional Jumps Address Bus Data Bus. Jump. JUMP address (0..$FFFF, 0..$FF) JMP J u mp to Address Loads the specified address, into the program counter.

Download Presentation

ELE22MIC Lecture 7

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.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -

Presentation Transcript


Ele22mic lecture 7

ELE22MIC Lecture 7

  • Instruction Set Overview, Part 4

    • HC-COM - Lab notes

    • Stack Pointer, Push, Pull

      • Call / Return

      • Data

    • Conditional Jumps

    • Address Bus

    • Data Bus


Ele22mic lecture 7

Jump

  • JUMP address (0..$FFFF, 0..$FF)

    • JMPJump to Address

    • Loads the specified address, into the program counter.

    • Functions like GOTO in C/BASIC/PASCAL.


Branch

Branch

  • BRANCH (PC + [-$80..$7F])

    • Jump relative to current program counter (PC)

    • Used if the destination is close to the current instruction

  • Branch

    • BRABranch Always

    • BRNBranch Never

    • BSR Branch to subroutine


Using subroutines jsr

Using Subroutines - JSR

  • JSR 16 bit address ($0..$FFFF, 0..$FF)

  • JSRJump to Subroutine

    • Push next instruction address onto stack (16 bits)

    • then jump to the address specified in the operand

  • RTSReturn from Subroutine

    • Pul the 16 bit item on the stack top into the Instruction Pointer - effectively jumps to the address on the top of stack. This address is the value pushed by the JSR (or BSR) instruction.


Using subroutines bsr

Using Subroutines - BSR

  • BSR relative address (PC + [-$80 .. +$7F])

  • BSRBranch to Subroutine

    • Push next instruction address onto stack (16 bits)

    • then branch to the specified relative address

  • How it works:

    • The program counter is incremented by 2. (as usual)

    • The PC of the next instruction is pushed onto the stack (so the stack contains the return address)

    • Then the relative displacement is added to the Program counter, and execution continues from there (i.e. within the subroutine).


Interrupts swi

INTERRUPTs SWI

  • SWI; Software Interrupt

    • Pushes all user registers (not stack pointer)

    • The interrupt mask bit is set

      • this prevent furthur interrupts being serviced immediately

    • Fetches the Vector Address from memory location

    • Jumps to the vector address from memory at FFF6..FFF7


Ele22mic lecture 7

INTERUPT VECTORS IN ROM

ORG $FFD6

*** Vectors ***

VSCI FDB JSCI

VSPI FDB JSPI

VPAIE FDB JPAIE

VPAO FDB JPAO

VTOF FDB JTOF

VTOC5 FDB JTOC5

VTOC4 FDB JTOC4

VTOC3 FDB JTOC3

VTOC2 FDB JTOC2

VTOC1 FDB JTOC1

VTIC3 FDB JTIC3

VTIC2 FDB JTIC2

VTIC1 FDB JTIC1

VRTI FDB JRTI

VIRQ FDB JIRQ

VXIRQ FDB JXIRQ

VSWI FDB JSWI

VILLOP FDB JILLOP

VCOP FDB JCOP

VCLM FDB JCLM

VRST FDB BUFFALO

PSEUDO VECTORS

IN RAM

*** Vector jump table ***

JSCI RMB 3

JSPI RMB 3

JPAIE RMB 3

JPAO RMB 3

JTOF RMB 3

JTOC5 RMB 3

JTOC4 RMB 3

JTOC3 RMB 3

JTOC2 RMB 3

JTOC1 RMB 3

JTIC3 RMB 3

JTIC2 RMB 3

JTIC1 RMB 3

JRTI RMB 3

JIRQ RMB 3

JXIRQ RMB 3

JSWI RMB 3

JILLOP RMB 3

JCOP RMB 3

JCLM RMB 3


Stack contents during interrupt service routine

Stack contents - during interrupt service routine


Interrupts rti wai

INTERRUPTs RTI/WAI

  • RTI; Return from Interrupt

  • WAI; Wait for interrupt


Interrupt masking

INTERRUPT MASKING:

  • CLI; CLear Interrupt Mask

    • Enable Interrupts on IRQ# line

  • SEI; Set interrupt Mask

    • Disable Servicing of Interrupts on IRQ# line

    • Interrupt mask does not affect SWI (Software Interrupt) nor XIRQ.


  • Ele22mic lecture 7

    References:

    BUF34.ASM - Buffalo Source Code

    AS11 Freeware Assembler help file

    Conditional jump examples

    MCU Reset sequence

    Data Bus - Tri-state

    1st Assignment Due Tuesday - Questions ?


  • Login