-
Notifications
You must be signed in to change notification settings - Fork 74
/
UIFFFormat.a
156 lines (101 loc) · 2.36 KB
/
UIFFFormat.a
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
154
155
156
;Photoshop version 1.0.1, file: UIFFFormat.a
; Computer History Museum, www.computerhistory.org
; This material is (C)Copyright 1990 Adobe Systems Inc.
; It may not be distributed to third parties.
; It is licensed for non-commercial use according to
; www.computerhistory.org/softwarelicense/photoshop/
INCLUDE 'Traps.a'
; **********************************************************************
SEG 'AIFFFormat'
ExtractPlane PROC EXPORT
; Calling sequence (Pascal conventions):
;
; PROCEDURE ExtractPlane (iData: Ptr;
; pData: Ptr;
; cols: INTEGER;
; plane: INTEGER);
;
; Parameter Offsets
@iData EQU 16
@pData EQU 12
@cols EQU 10
@plane EQU 8
; Size of parameters
@params EQU 12
; Save registers
LINK A6,#0
; Extract the plane
MOVE.L @iData(A6),A0
MOVE.L @pData(A6),A1
; D0 is input bit number
MOVE.W @plane(A6),D0
; D1 is output bit number
MOVE.W #7,D1
; D2 is column counter
MOVE.W @cols(A6),D2
SUB.W #1,D2
; Get the bits
@1 BTST D0,(A0)+
BEQ.S @2
BSET D1,(A1)
; Update output pointer
@2 SUB.W #1,D1
BGE.S @3
ADD.W #8,D1
ADD.W #1,A1
; Close loop
@3 DBF D2,@1
; Clean up and exit
UNLK A6
MOVE.L (SP)+,A0
ADD.W #@params,SP
JMP (A0)
; **********************************************************************
SEG 'AIFFFormat'
StuffPlane PROC EXPORT
; Calling sequence (Pascal conventions):
;
; PROCEDURE StuffPlane (pData: Ptr;
; iData: Ptr;
; cols: INTEGER;
; plane: INTEGER);
;
; Parameter Offsets
@pData EQU 16
@iData EQU 12
@cols EQU 10
@plane EQU 8
; Size of parameters
@params EQU 12
; Save registers
LINK A6,#0
; Extract the plane
MOVE.L @pData(A6),A0
MOVE.L @iData(A6),A1
; D0 is input bit number
MOVE.W #7,D0
; D1 is output bit number
MOVE.W @plane(A6),D1
; D2 is column counter
MOVE.W @cols(A6),D2
SUB.W #1,D2
; Get the bits
@1 BTST D0,(A0)
BEQ.S @2
BSET D1,(A1)
; Update input pointer
@2 SUB.W #1,D0
BGE.S @3
ADD.W #8,D0
ADD.W #1,A0
; Update output pointer
@3 ADD.W #1,A1
; Close loop
DBF D2,@1
; Clean up and exit
UNLK A6
MOVE.L (SP)+,A0
ADD.W #@params,SP
JMP (A0)
; **********************************************************************
END