; *********************************************************************** ; * * ; * User Mode Code for the Flash Program, First Version * ; * * ; *********************************************************************** ; Author: John Zaitseff ; Date: 28th May, 2003 ; Version: 1.2 ; This file contains the main program for the first 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-v1.s" ; Include various definitions .global main ; Make this label visible to other modules ; ----------------------------------------------------------------------- ; The main program, running in User mode. Notice that the main program ; assumes it has intimate knowledge of how the SWI handler works: it ; assumes that R0 is NOT modified by the SWI handler. Doing this sort of ; thing is generally considered a bad programming practice! main: ; Main program, running in User mode ldr r0, =portA ; Load address of Port A into R0 main_loop: mov r1, #value1 ; R1 = value to turn the LEDs on swi ; Generate a software interrupt mov r1, #value2 ; R1 = value to turn the LEDs off swi ; Generate a software interrupt b main_loop ; Repeat forever (or until stopped) .end