You are on page 1of 2

Steve E. CLar Homework No.

1
2015-8162

 
CSC 112.1-CS Computer Organization and Architecture Laboratory
First Semester, SY 2019-2020

Assignment No. 1
Due: October 9, 2019 at 11:55PM

Complete the stubbed looping delay subroutine below. The looping delay subroutine,
including the ACALL instruction for invoking it, must consume exactly 285,696 machine
cycles (310 ms) running on the 8051 trainer board hardware. You can use the simulation
facility of the MCU 8051 IDE to test and simulate your completed program.

ORG 0000H
ANIMATE_LOOP: MOV P2,#01111110B

ACALL DELAY_LOOP ; 285,696c


ACALL DELAY_LOOP ; 285,696c
MOV P2,#10000001B
ACALL DELAY_LOOP ; 285,696c
ACALL DELAY_LOOP ; 285,696c
SJMP ANIMATE_LOOP

DELAY_LOOP: ;

; ??? - complete this subroutine

;
; this subroutine, including the ACALL
; instruction for invoking it, must consume
; exactly 285,696 machine cycles (310 ms)
; running on the 8051 trainer board hardware

;
RET

END

1
Steve E. CLar Homework No. 1
2015-8162

ACALL DELAY_LOOP ; 2C

DELAY_LOOP: MOV R1, #60 ; 1C


MOV R2, #190 ;1C
LOOP1: MOV R3, #250 ;1C

LOOP2: NOP ;1C


NOP ;1C
NOP ;1C
NOP ;1C
DJNZ R3, LOOP2 ;2C (1500C)
DJNZ R2, LOOP1 ;2C (285570C)

LOOP3: DJNZ R1,LOOP3 ;2C (120C)


RET ;2C
END

You might also like