Files
lt16lab/programs/segments_test.prog

90 lines
1.4 KiB
Plaintext

reset:
br always >main
nop
hardfault:
reti
nop
memfault:
reti
nop
.align
number_array0:
.word 0x03020100
number_array1:
.word 0x07060504
number_array2:
.word 0x0B0A0908
number_array3:
.word 0x0F0E0D0C
segment_addr0: .word 0x000F00A0
segment_addr1: .word 0x000F00A4
// w_cnt_top: .word 0x1FC000
w_cnt_top: .word 0x100 //for simulation only
infamous_pattern0:
.word 0x0D0E0A0D
infamous_pattern1:
.word 0x0B0E0E0F
main:
ldr r8, >w_cnt_top
number_loop:
// First 4
ldr r4, >number_array0
ldr r0, >segment_addr0
st32 r0, r4
// Second 4
ldr r4, >number_array1
ldr r0, >segment_addr1
st32 r0, r4
call >wait
nop
// First 4
ldr r4, >number_array2
ldr r0, >segment_addr0
st32 r0, r4
// Second 4
ldr r4, >number_array3
ldr r0, >segment_addr1
st32 r0, r4
call >wait
nop
// 0xDEADBEEF pattern:
// First 4
ldr r4, >infamous_pattern0
ldr r0, >segment_addr0
st32 r0, r4
// Second 4
ldr r4, >infamous_pattern1
ldr r0, >segment_addr1
st32 r0, r4
call >wait
nop
br always >number_loop
nop
//subroutine to iterate until counter overflow
wait:
clr r7 //inititalize inner counter
inc_i:
cmp neq r7,r8
br true >inc_i //if i=cnt_top
addi r7,1
ret //else
nop