INSTRUCTION SET

Note: The mapping of port 'p'to opcode bits 0-1 is as follows:

1 0

Port

o 0

4

015

1

0

6

1

1

7

Example: ANDP4: ANLD P4,A

 

;'AND'PORT 4 CONTENTS

 

 

;WITH ACC BITS 0-3

CALL address Subroutine Call

la10a9as1101001 la7asa5a41a3a2a1aol

This is a 2-cycle instruction. The program counter and PSW bits 4-7 are saved in the stack. The stack pOinter (pSW bits 0-2) is updated. Program control is then passed to the location specified by 'address'PC.

bit 11 is determined by the most recent SEL MB instruction.

A CALL cannot begin in locations 2046-2047 or 4094-4095.

Execution continues at the instruction following the

CALL upon return from the subroutine.

((SP)) .... (PC), (PSW 4-7)

(SP) .... (SP)+1

(PCS-10) .... (addrS-10)

(PCO-7) .... addrO-7

(PC 11 ) .... DBF

Example: Add three groups of two numbers. Put subtotals in locations 50, 51 and total in location 52.

MOV RO,#50 ;MOVE '50'DEC TO ADDRESS

 

;REG 0

BEGADD: MOV A,R1

;MOVE CONTENTS OF REG 1

 

;TO ACC

ADD A,R2

;ADD REG 2 TO ACC

CALL SUBTOT;CALL SUBROUTINE 'SUBTOT'

ADD A R3

;ADD REG 3 TO ACC

ADD A,R4

;ADD REG 4 TO ACC

CALL SUBTOT ;CALL SUBROUTINE 'SUBTOT'

ADD A,R5

;ADD REG 5 TO ACC

ADD A,R6

;ADD REG 6 TO ACC

CALL SUBTOT ;CALL SUBROUTINE 'SUBTOT'

SUBTOT: MOV @RO,A

;MOVE CONTENTS OF ACC TO

 

;LOCATION ADDRESSED BY

 

;REG 0

INC RO

;INCREMENT REG 0

RET

;RETURN TO MAIN PROGRAM

Mnemonics copyright Intel Corporation 1976.

4-12

Page 85
Image 85
Intel mcs-48 manual Andport 4 Contents, With ACC Bits, MOV RO,#50 Move 50DEC to Address