Was mache ich bei diesem kleinen Assemblerprogramm falsch?
1 | .syntax unified
|
2 | .cpu cortex-m4
|
3 | .fpu fpv4-sp-d16
|
4 | .thumb
|
5 | .text
|
6 | .pool
|
7 | .global search,put
|
8 | .org 0x400
|
9 |
|
10 | @@@@@@@@@@@@@@@@@@@@@@@@@
|
11 | @ search list of WORDs in memory (2bytes), .asciz ... , .align 2
|
12 | @ .word 0x1234 ; .asciz "apfel" ; .align 2
|
13 | @ .word 0x2345 ; .asciz "birne" ; .align 2
|
14 | @ .word 0xaaaa ; .asciz "banane" ; .align 2
|
15 | @ .word 0
|
16 | search: push {r0-r5,lr}
|
17 | ldr r4,= dict
|
18 | 1: ldrh r1,[r4] @ test next token word
|
19 | cbz r0,5f @ not_found
|
20 | cmp r0,r1
|
21 | bne 3f
|
22 | mov r0,r4
|
23 | add r0,#2
|
24 | bl puts
|
25 | b 5f
|
26 | 2: add r4,#2 @ advance word pointer to point to asciz
|
27 | 3: ldrb r1,[r4],#1
|
28 | cbnz r1,3b @ skip until 0 >> diese Zeile macht den 28: Error: branch out of range
|
29 | mov r3,r4
|
30 | and r3,#1 @ is r4 odd?
|
31 | cbz r3,4f @ r3/4 is even on branch
|
32 | add r4,#1
|
33 | 4: b 1b
|
34 | 5:
|
35 | pop {r0-r5,pc}
|
36 |
|
37 | .pool
|
38 | .align 4
|
39 | dict: .hword 0x1234; .byte 'h','e','l','l',0 ; .align 2
|
40 | .hword 0x2345; .byte 'w','o','r','l','d',0 ; .align 2
|
41 | .hword 0
|
42 | .end
|
Es gibt in Zeile 28 den Assemblerfehler Error: branch out of range.
Aber ich springe doch lediglich zu im Kontext nahen temporären Labels?
(Programmierfehler seien jetzt mal nicht betrachtet, habe das
Progrämmchen noch nicht durchgetestet. Aber der Fehler hindert mich im
Moment daran)