|
|
1.1 root 1: .text
2: .globl texture32
3: texture32:
4: cmph 8(%ap),4(%ap) # width in bits
5: BGB dxpos # width positive ??
6: RET # NO!, return
7: dxpos: SAVE %r3 # lets save all the registers
8: addw2 &8,%sp # local vars
9:
10: PUSHW 0(%ap) # push pointer to bitmap
11: PUSHW 4(%ap) # push rect.origin
12: call &2,addr # calculate the address of the point
13: MOVW %r0,%r8 # %r8 = addr(bitmap,rect.origin)
14:
15: movw 0(%ap),%r7 # pointer to bitmap
16: llsw3 &2,4(%r7),%r7 # width of bitmap in bytes -> r7
17:
18: movw 12(%ap),%r6 # r6 = pointer to texture
19:
20: subh3 6(%ap),10(%ap),%r4 # dy
21:
22: andh3 &0x1f,6(%ap),%r0
23: llsw3 &2,%r0,%r3 # bit index into texture = r3
24:
25: movh 4(%ap),%r2 # rec.origin.x -> r2
26: lrsw3 %r2,&-1,0(%fp) # generate mask1 -> 0(%fp)
27:
28: subh3 &1,8(%ap),%r5
29: arsw3 %r5,&0x80000000,4(%fp) # generate mask2 -> 4(%fp)
30:
31: lrsw3 &5,%r5,%r5 # (x + dx -1) >> WORDSHIFT
32: lrsw3 &5,%r2,%r2 # x >> WORDSHIFT
33: subw2 %r2,%r5
34: DECW %r5 # inner word count ii
35: BGEB notnarrow # if ii == -1 then narrow
36: andw2 4(%fp),0(%fp) # narrow, combine both masks here
37: mcomw 0(%fp),4(%fp) # mask2 = ~mask1
38: subw2 &4,%r7 # amount to get to next line
39: BRB restcode
40: notnarrow:
41: addw3 &1,%r5,%r0 # offset in words
42: llsw3 &2,%r0,%r0 # offset in bytes
43: subw2 %r0,%r7 # amount to get to next line
44: restcode:
45: ALSW3 &2,16(%ap),%r0 # code * 4 -> r0
46: BLB end # bad if code less than 0
47: cmpw %r0,&12 # see if code greater than 3
48: jle *jmptbl(%r0) # jump to correct routine if ok
49: end: subw2 &8,%sp
50: RESTORE %r3
51: RET
52:
53:
54: .data
55: jmptbl: .word FSTORE
56: .word FOR
57: .word FCLEAR
58: .word FXOR
59: .text
60: FXOR: DECW %r4 # number of lines
61: jl end # if neg. then done
62: addw3 %r6,%r3,%r2
63: movw 0(%r2),%r2 # bits = map[bitindex]
64: addw2 &4,%r3 #bitindex += 1;
65: andw2 &0x7f,%r3 # bitindex = ( bitindex + 1) & WORDMASK
66: andw3 0(%fp),%r2,%r0 #
67: xorw2 %r0,0(%r8) #screenp ^= bits & mask1
68: addw2 &4,%r8 # screenp++
69: movw %r5,%r1 # i = ii
70: BLB restloop # if i = -1 then narrow
71: BEB mask2ok # if i = 0 then no inner words
72: lrsw3 &2,%r1,%r0 # i/4
73: BLEB less4 # less than 4 inner words
74: more4: xorw2 %r2,0(%r8) # screenp ^= bits
75: xorw2 %r2,4(%r8) # screenp ^= bits
76: xorw2 %r2,8(%r8) # screenp ^= bits
77: xorw2 %r2,12(%r8) # screenp ^= bits
78: addw2 &16,%r8 # screenp += 4
79: DECW %r0
80: BGB more4 # more inner words
81: andw2 &3,%r1 # just how many are left
82: BLEB mask2ok # no more to do
83: less4: xorw2 %r2,0(%r8) # screenp ^= bits
84: addw2 &4,%r8 # screenp++
85: DECW %r1
86: BGB less4 # more inner words
87: mask2ok:
88: andw3 4(%fp),%r2,%r0
89: xorw2 %r0,0(%r8) # screenp ^= (bits & mask2)
90: restloop:
91: addw2 %r7,%r8 # screenp += width
92: BRB FXOR
93:
94: FCLEAR: mcomw 0(%fp),0(%fp)
95: mcomw 4(%fp),4(%fp)
96: FCLR: DECW %r4 # number of lines
97: jl end # if neg. then done
98: addw3 %r6,%r3,%r2
99: mcomw 0(%r2),%r2 # bits = ~map[bitindex]
100: addw2 &4,%r3 #bitindex += 1;
101: andw2 &0x7f,%r3 # bitindex = ( bitindex + 1) & WORDMASK
102: orw3 0(%fp),%r2,%r0 #
103: andw2 %r0,0(%r8) #screenp &= bits & mask1
104: addw2 &4,%r8 # screenp++
105: movw %r5,%r1 # i = ii
106: BLB restclr # if i = -1 then narrow
107: BEB msk2clr # if i = 0 then no inner words
108: lrsw3 &2,%r1,%r0 # i/4
109: BLEB less4clr # less than 4 inner words
110: Fclr_4: andw2 %r2,0(%r8) # screenp ^= bits
111: andw2 %r2,4(%r8) # screenp ^= bits
112: andw2 %r2,8(%r8) # screenp ^= bits
113: andw2 %r2,12(%r8) # screenp ^= bits
114: addw2 &16,%r8 # screenp += 4
115: DECW %r0
116: BGB Fclr_4 # more inner words
117: andw2 &3,%r1 # just how many are left
118: BLEB msk2clr # no more to do
119: less4clr:
120: andw2 %r2,0(%r8) # screenp ^= bits
121: addw2 &4,%r8 # screenp++
122: DECW %r1
123: BGB less4clr # more inner words
124: msk2clr:
125: orw3 4(%fp),%r2,%r0
126: andw2 %r0,0(%r8) # screenp ^= (bits & mask2)
127: restclr:
128: addw2 %r7,%r8 # screenp += width
129: BRB FCLR
130:
131: FOR: DECW %r4 # number of lines
132: jl end # if neg. then done
133: addw3 %r6,%r3,%r2
134: movw 0(%r2),%r2 # bits = map[bitindex]
135: addw2 &4,%r3 #bitindex += 1;
136: andw2 &0x7f,%r3 # bitindex = ( bitindex + 1) & WORDMASK
137: andw3 0(%fp),%r2,%r0 #
138: orw2 %r0,0(%r8) #screenp ^= bits & mask1
139: addw2 &4,%r8 # screenp++
140: movw %r5,%r1 # i = ii
141: BLB rest_or # if i = -1 then narrow
142: BEB mask2or # if i = 0 then no inner words
143: lrsw3 &2,%r1,%r0 # i/4
144: BLEB less4or # less than 4 inner words
145: For_4: orw2 %r2,0(%r8) # screenp ^= bits
146: orw2 %r2,4(%r8) # screenp ^= bits
147: orw2 %r2,8(%r8) # screenp ^= bits
148: orw2 %r2,12(%r8) # screenp ^= bits
149: addw2 &16,%r8 # screenp += 4
150: DECW %r0
151: BGB For_4 # more inner words
152: andw2 &3,%r1 # just how many are left
153: BLEB mask2or # no more to do
154: less4or:
155: orw2 %r2,0(%r8) # screenp ^= bits
156: addw2 &4,%r8 # screenp++
157: DECW %r1
158: BGB less4or # more inner words
159: mask2or:
160: andw3 4(%fp),%r2,%r0
161: orw2 %r0,0(%r8) # screenp ^= (bits & mask2)
162: rest_or:
163: addw2 %r7,%r8 # screenp += width
164: BRB FOR
165:
166: FSTORE: DECW %r4 # number of lines
167: jl end # if neg. then done
168: addw3 %r6,%r3,%r2
169: movw 0(%r2),%r2 # bits = map[bitindex]
170: addw2 &4,%r3 #bitindex += 1;
171: andw2 &0x7f,%r3 # bitindex = ( bitindex + 1) & WORDMASK
172: andw3 0(%fp),%r2,%r0 #
173: xorw3 0(%r8),%r2,%r0 #screenp = bits & mask1
174: andw2 0(%fp),%r0
175: xorw2 %r0,0(%r8) #
176: addw2 &4,%r8 # screenp++
177: movw %r5,%r1 # i = ii
178: BLB stoloop # if i = -1 then narrow
179: BEB sto2ok # if i = 0 then no inner words
180: lrsw3 &2,%r1,%r0 # i/4
181: BLEB st4less # less than 4 inner words
182: store4: movw %r2,0(%r8) # screenp = bits
183: movw %r2,4(%r8) # screenp = bits
184: movw %r2,8(%r8) # screenp = bits
185: movw %r2,12(%r8) # screenp = bits
186: addw2 &16,%r8 # screenp += 4
187: DECW %r0
188: BGB store4 # more inner words
189: andw2 &3,%r1 # just how many are left
190: BLEB sto2ok # no more to do
191: st4less:
192: movw %r2,0(%r8) # screenp ^= bits
193: addw2 &4,%r8 # screenp++
194: DECW %r1
195: BGB st4less # more inner words
196: sto2ok:
197: xorw3 0(%r8),%r2,%r0 #screenp = bits & mask2
198: andw2 4(%fp),%r0
199: xorw2 %r0,0(%r8) #
200: stoloop:
201: addw2 %r7,%r8 # screenp += width
202: BRB FSTORE
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.