repo.or.cz
/
sdcc.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
struct / union in initializer, RFE #901.
[sdcc.git]
/
sdcc
/
support
/
regression
/
tests
/
z80n-push-nn.c
blob
1d999518a347a48edff64519c5ee127da7ca3ff4
1
/* z80n-push-nn
2
Invalid relocation of Z80N PUSH nn instruction value
3
*/
4
#include <testfwk.h>
5
#include <string.h>
6
7
int
x
;
8
typedef
void
* (*
memcpy_p
)(
void
*
d
,
const void
*
s
,
size_t
c
);
9
10
#ifdef __SDCC_z80n
11
int
f
(
void
)
__naked
12
{
13
__asm
14
push
#0x1234
15
push
#_x
16
pop hl
17
pop de
18
ld a
, (
hl
)
19
inc hl
20
ld h
, (
hl
)
21
ld l
,
a
22
add hl
,
de
23
ex de
,
hl
24
ret
25
;
26
.
db
#>_x, #<_x
27
.
dw
#_x
28
__endasm
;
29
}
30
memcpy_p
g
(
void
)
__naked
31
{
32
__asm
33
push
#_memcpy
34
pop de
35
ret
36
__endasm
;
37
}
38
#else
39
int
f
(
void
)
40
{
41
return
x
+
0x1234
;
42
}
43
memcpy_p
g
(
void
)
44
{
45
return
&
memcpy
;
46
}
47
#endif
48
49
void
testBug3032
(
void
)
50
{
51
x
=
0x7531
;
52
ASSERT
(
f
() ==
0x8765
);
53
ASSERT
(
g
() == &
memcpy
);
54
}
55