; *********************************************************************** ; * * ; * User Mode Code for the Flash Program, Second Version * ; * * ; *********************************************************************** ; Author: John Zaitseff ; Date: 28th May, 2003 ; Version: 1.2 ; This file contains the main program for the second version of Flash, as ; used in ELEC2041 Experiment 5. This code runs in User mode. The main ; feature of this program is that it uses an SWI instruction to set the ; LEDs on and off. .text ; Ordinary program code follows .include "header-v2-pub.s" ; Include various public definitions .global main ; Make this label visible to other modules ; ----------------------------------------------------------------------- ; The main program, running in User mode. Notice that the main program ; does NOT know how the SWI handler performs its duties beyond the public ; interface. In other words, this code has been written in such a way ; that it only needs to know what a given SWI function does and what are ; that function's inputs and outputs. main: ; Main program, running in User mode main_loop: mov r0, #swi_set_LEDs ; Request the SWI handler to set the LEDs mov r1, #value1 ; R1 = value to turn the LEDs on swi ; Generate a software interrupt mov r0, #swi_delay ; Request the SWI handler to delay program ldr r1, =waitval ; R1 = number of delay loops swi ; Generate a software interrupt mov r0, #swi_set_LEDs ; Request the SWI handler to set the LEDs mov r1, #value2 ; R1 = value to turn the LEDs off swi ; Generate a software interrupt mov r0, #swi_delay ; Request the SWI handler to delay program ldr r1, =waitval ; R1 = number of delay loops swi ; Generate a software interrupt b main_loop ; Repeat forever (or until stopped) .end