0% found this document useful (0 votes)
10 views9 pages

Microprocessor Notes 4

The document provides an overview of the architecture and programming concepts of the 68000 microprocessor, focusing on assembly language, addressing modes, instruction sets, subroutines, stacks, and interrupts. It explains how stacks operate in a last-in, first-out manner and details the structure and function of subroutines within a program. Additionally, it covers the concept of interrupts and the necessity of associated interrupt service routines for handling external events.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views9 pages

Microprocessor Notes 4

The document provides an overview of the architecture and programming concepts of the 68000 microprocessor, focusing on assembly language, addressing modes, instruction sets, subroutines, stacks, and interrupts. It explains how stacks operate in a last-in, first-out manner and details the structure and function of subroutines within a program. Additionally, it covers the concept of interrupts and the necessity of associated interrupt service routines for handling external events.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 9

SOFTWARE

ARCHITECTURE OF
THE 68000
Microprocessor: Notes 4
CHAPTER OUTLINE

Assembly Language Programming


68000 Addressing Modes
The 68000’s Instruction Set
Subroutine and Stack
Interrupts
STACK

• A stack is a data structure that can be used to save and restore


information in a last-in, first-out (LIFO) fashion.
• Even though any address register is capable of serving as a stack
pointer, register A7 is implicitly used as the stack pointer is some
instructions such as subroutine call and return for saving and
retrieving certain implied operands. For the addressing mode, pre-
decrement and post-increment are used to push and pop the
data.
– Push (save): MOVE source, -(SP)
– Pop (retrieve) MOVE (SP)+, destination
STACK (CONT..)

• The stack pointer always points to the top of the stack, where the last saved item is
stored, which is also the first item to be retrieved.

b c
b
a b c
a a a a a a a
Stack Push Stack Push Stack Pop Stack Push Stack
with with with with 1 with
nothing 1 2 item 2
item item item

d
d d
c
c c c c
a
a a a a a a
Push Stack Pop Stack Pop Stack Pop Stack
with with with
with
3 2 1
nothing
item item item
STACK (CONT..)

• Example: This program read the word ‘HELLO’ and print it backward
(‘OLLEH’)

START ORG $1000


MOVEA #$2000, A0
MOVEA #$2010, A1
MOVEA #$2020, A2
LOOP1 MOVE.B (A0)+, (A1)+
CMP.B #0, (A0)
BNE LOOP1
LOOP2 MOVE.B -(A1), (A2)+
CMP.B #0, (A1)
BNE LOOP2

ORG $2000
DATA 'HELLO',0
DC.B
SUBROUTINE

 A subroutine is a special segment of program that can be


called for execution from any point in a program.

First instruction
 Subroutine A
:
 Main Program :
Call subroutine A Return
Next instruction
:
Subroutine B
Call subroutine B
First instruction
Next instruction
:
:
Return
SUBROUTIN
E (CONT..)
 Subroutine Concept
 A program structure where one part of the
program is called the main program.
 In addition to this, a smaller
segment attached to the main
program, known as a subroutine.
 The subroutine is written to provide a
function that must be performed at
various points in the main program.
 A return instruction must be included at the
end of the subroutine to initiate the return
sequence to the main program environment.
 The instructions provided to transfer
control from the main program to a
subroutine and return control back to
the main program are called
subroutine-handling instructions.
SUBROUTINE (CONT..)

• Subroutine control instructions


– Jump to Subroutine (JSR), Branch to Subroutine (BSR), Return
from Subroutine (RTS) and Return and Restore Condition codes
(RTR).
INTERRUPT
 An interrupt is an external event which
informs the CPU that a device needs its
service.
 For every interrupt there must be a program
associated with it. When an interrupt is
invoked it is asked to run a program to
perform a certain service. This program is
commonly referred to as an interrupt
service routine (ISR). The ISR is also called
the interrupt handler. When an interrupt is
invoked, the CPU runs the interrupt service
routine.
 Where is the address of the interrupt service
routine?
 For every interrupt there are allocated 4
bytes of memory in the interrupt vector
table. Interrupt are handled in the supervisor
mode. It will happen when S = 1.

You might also like