1 / 12

ELE22MIC Lecture 8

ELE22MIC Lecture 8. 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.

aquarius
Download Presentation

ELE22MIC Lecture 8

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. ELE22MIC Lecture 8 • Instruction Set Overview, Part 4 • HC-COM - Lab notes • Stack Pointer, Push, Pull • Call / Return • Data • Conditional Jumps • Address Bus • Data Bus

  2. Jump • JUMP address (0..$FFFF, 0..$FF) • JMP Jump to Address • Loads the specified address, into the program counter. • Functions like GOTO in C/BASIC/PASCAL.

  3. Branch • BRANCH (PC + [-$80..$7F]) • Jump relative to current program counter (PC) • Used if the destination is close to the current instruction • Branch • BRA Branch Always • BRN Branch Never • BSR Branch to subroutine

  4. Using Subroutines - JSR • JSR 16 bit address ($0..$FFFF, 0..$FF) • JSR Jump to Subroutine • Push next instruction address onto stack (16 bits) • then jump to the address specified in the operand • RTS Return 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.

  5. Using Subroutines - BSR • BSR relative address (PC + [-$80 .. +$7F]) • BSR Branch 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).

  6. 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

  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

  8. Stack contents - during interrupt service routine

  9. INTERRUPTs RTI/WAI • RTI ; Return from Interrupt • WAI ; Wait for interrupt

  10. 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.

  11. References: BUF34.ASM - Buffalo Source Code AS11 Freeware Assembler help file Conditional jump examples MCU Reset sequence Data Bus - Tri-state

More Related