-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathInOut.h
153 lines (131 loc) · 3.63 KB
/
InOut.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
#include <string.h>
#include "debug.h"
#define inline __inline
static inline
unsigned char hinb(unsigned long Addr)
{
/*
moveq #0,d0
move.b (a0),d0
rts
*/
DEBUG( dprintf("0x%08lx=hinb(0x%08lx)\n",*(unsigned char *)Addr,Addr) );
return( *(unsigned char *)Addr );
}
static inline
void houtb(unsigned char value, unsigned long Addr)
{
/*
move.b d0,(a0)
rts
*/
DEBUG( dprintf("houtb(value=0x%08lx,addr=0x%08lx\n",value,Addr) );
*(unsigned char *)Addr=value;
}
static inline
unsigned short hinw(unsigned long Addr)
{
/*
moveq #0,d0
move.w (a0),d0
rts
*/
DEBUG( dprintf("0x%08lx=hinw(0x%08lx)\n",*(unsigned short *)Addr,Addr) );
return( *(unsigned short *)Addr );
}
static inline
void houtw(unsigned short value, unsigned long Addr)
{
/*
move.w d0,(a0)
rts
*/
DEBUG( dprintf("houtw(val=0x%08lx,addr=0x%08lx\n",value,Addr) );
*(unsigned short *)Addr=value;
}
static inline
unsigned long hinl(unsigned long Addr)
{
/*
moveq #0,d0
move.l (a0),d0
rts
*/
DEBUG( dprintf("0x%08lx=hinl(0x%08lx)\n",*(unsigned long *)Addr,Addr) );
return( *(unsigned long *)Addr );
}
static inline
void houtl(unsigned long value, unsigned long Addr)
{
/*
move.l d0,(a0)
rts
*/
DEBUG( dprintf("houtl(val=0x%08lx,addr=0x%08lx\n",value,Addr) );
*(unsigned long *)Addr=value;
}
static inline
void memcpyl(void *source, void *dest, unsigned long taille)
{
/*
lsr #2,d0 ; On divise d0 par 4
boucle:
move.l (a0)+,(a1)+
dbf d0,boucle
rts
*/
/*
//unsigned long tailleOrig=taille;
long *destp=dest;
long *sourcep=source;
taille>>=2;
do
{
*destp++=*sourcep++;
}while(--taille);
*/
memcpy(dest,source,taille);
//CopyMem(source,dest,taille);
}
/* C Version */
/*
//extern inline unsigned char hinb(unsigned long Addr);
unsigned char ASM hinb(REG(a0,unsigned long Addr));
void ASM houtb(REG(d0,unsigned char value), REG(a0,unsigned long Addr));
unsigned short ASM hinw(REG(a0,unsigned long Addr));
void ASM houtw(REG(d0,unsigned short value), REG(a0,unsigned long Addr));
unsigned long ASM hinl(REG(a0,unsigned long Addr));
void ASM houtl(REG(d0,unsigned long value), REG(a0,unsigned long Addr));
void ASM memcpyl( REG(a0,void *source), REG(a1,void *dest), REG(d0,unsigned long taille));
*/
/*
unsigned char hinb(unsigned long Addr);
void houtb(unsigned char value,unsigned long Addr);
unsigned short hinw(unsigned long Addr);
void houtw(unsigned short value, unsigned long Addr);
unsigned long hinl(unsigned long Addr);
void houtl(unsigned long value, unsigned long Addr);
void memcpyl(void *source, void *dest, unsigned long taille);
*/
/*
#define hinb(Addr) ( *(unsigned char *)Addr)
#define houtb(value, Addr) *(unsigned char *)Addr=value
#define hinw(Addr) ( *(unsigned short *)Addr )
#define houtw(value, Addr) *(unsigned short *)Addr=value
#define hinl(Addr) ( *(unsigned long *)Addr )
#define memcpyl(source, dest, taille) taille>>=2\
do{\
*dest++=*source++\
}while(--taille)
*/
/* ASM 68k Version */
/*
extern unsigned char __asm hinb(register __a0 unsigned long Addr);
extern void __asm houtb(register __d0 unsigned char value, register __a0 unsigned long Addr);
extern unsigned short __asm hinw(register __a0 unsigned long Addr);
extern void __asm houtw(register __d0 unsigned short value, register __a0 unsigned long Addr);
extern unsigned long __asm hinl(register __a0 unsigned long Addr);
extern void __asm houtl(register __d0 unsigned long value, register __a0 unsigned long Addr);
extern void __asm memcpyl( register __a0 void *source , register __a1 void *dest, register __d0 unsigned long taille);
*/
// outx(source,destination)