Debian Codegraph @

test/labelchanges.asm

raw
1 ; labelchanges.asm - test various cases of labels changing location in
2 ; successive passes. Test code provided by Thomas Jentzsch.
3
4 processor 6502
5
6 ;===============================================================================
7
8 ; automatically decide whether to use a branch or a jump
9 MAC BNEJ
10 IF ({1} - .) >= -126 && ({1} - .) <= 129
11 bne {1}
12 ELSE
13 beq skip$
14 jmp {1}
15 skip$
16 ENDIF
17 ENDM
18
19 ;===============================================================================
20
21 ORG $1000
22
23 BackOk
24 ds 126, $ea
25 BNEJ BackOk
26
27 BackJmp
28 ; this has to use "jmp"
29 ; and is detected as such
30 ds 126+1, $ea
31 BNEJ BackJmp
32
33 ; this can use "bne"
34 BNEJ ForwardOk
35 ds 127, $ea
36 ForwardOk
37
38 ; this has to use "jmp"
39 ; and is detected as such
40 BNEJ ForwardJmp
41 ds 127+3, $ea
42 ForwardJmp
43
44 ; this has to use "jmp"
45 ; and is detected as such
46 BNEJ ForwardJmp2
47 ds 127+2, $ea
48 ForwardJmp2