-
Notifications
You must be signed in to change notification settings - Fork 2
/
common68k.s
116 lines (98 loc) · 2.03 KB
/
common68k.s
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
**
** Quake for AMIGA
** common.c assembler implementations by Frank Wille <[email protected]>
**
XDEF _Q_memcpy
XDEF _ShortSwap
XDEF _LongSwap
XDEF _FloatSwap
XDEF _FloatSwap__r
******************************************************************************
*
* void _Q_memcpy (void *dest, void *src, int count)
*
* fast memcopy operation
*
******************************************************************************
cnop 0,4
_Q_memcpy
rsreset
rs.l 1
.dest rs.l 1
.source rs.l 1
.count rs.l 1
move.l .dest(sp),a1
move.l .source(sp),a0
move.l a0,d1
move.l a1,d0
or.b d0,d1
move.l .count(sp),d0
beq.b .exit
or.b d0,d1
and.b #$3,d1
bne.b .loop2
.loop
move.l (a0)+,(a1)+
subq.l #4,d0
bne.b .loop
.exit
rts
.loop2
move.b (a0)+,(a1)+
subq.l #1,d0
bne.b .loop2
rts
******************************************************************************
*
* short _ShortSwap (short l)
*
* swap word (LE->BE)
*
******************************************************************************
cnop 0,4
_ShortSwap
rsreset
rs.l 1
rs.w 1
.data rs.w 1
move .data(sp),d0
ror #8,d0
rts
******************************************************************************
*
* int _LongSwap (int l)
*
* swap longword (LE->BE)
*
******************************************************************************
cnop 0,4
_LongSwap
rsreset
rs.l 1
.data rs.l 1
move.l .data(sp),d0
ror #8,d0
swap d0
ror #8,d0
rts
******************************************************************************
*
* float _FloatSwap (float f)
*
* swap float (LE->BE)
*
******************************************************************************
cnop 0,4
_FloatSwap
_FloatSwap__r
rsreset
rs.l 1
.data rs.s 1
move.l .data(sp),d0
ror #8,d0
swap d0
ror #8,d0
IFND ATARI
fmove.s d0,fp0
ENDC
rts