-
Notifications
You must be signed in to change notification settings - Fork 0
/
mandel.inc
119 lines (101 loc) · 1.88 KB
/
mandel.inc
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
;-*-asm-*-
MODULE mandel,MODend_irq
;;; ----------------------------------------
genau equ 13
delta0 EQU 165
;; Register usage
delta reg 99
XLOOP reg 99
YLOOP reg 99
texture_ptr reg 99
texture_ptr2 reg 99
iter_count reg 99
temp1 reg 99
temp2 reg 99
x_count reg 99
y_count reg 99
_r1 reg 99
_i1 reg 99
_i0 reg 99
_r0 reg 99
_i reg 99
_r reg 99
moveq #128/16,y_count
shlq #4,y_count
movei #delta0,delta
movei #MandelTexture,texture_ptr
movei #-10564,_i0
move pc,YLOOP
addq #4,YLOOP
__pc move pc,XLOOP
addq #xloop-__pc,XLOOP
yloop:
moveq #128/16,x_count
movei #-16000,_r0
shlq #4,x_count
xloop:
moveq #15,iter_count
move _r0,_r1
move _i0,_i
iter_loop
move _r1,_r
move _i,_i1
imult _r1,_r1 ; r^2
imult _i1,_i1 ; i^2
move _r1,temp1
sub _i1,_r1 ; r^2-i^2
add _i1,temp1 ; r^2+i^2
shrq #2*genau+2,temp1
jr nz,iter_end
imult _r,_i
sharq #genau,_r1 ; normalize
sharq #genau-1,_i
add _r0,_r1 ; temp2 = r^2-i^2+r0
subq #1,iter_count
jr nz,iter_loop
add _i0,_i ; i = 2*i*r+i0
iter_end:
addq #16,iter_count
add delta,_r0
subq #1,x_count
storeb iter_count,(texture_ptr)
jump nz,(XLOOP)
addqt #1,texture_ptr
subq #1,y_count
jump nz,(YLOOP)
add delta,_i0
movei #127,y_count
movei #XorTexture,texture_ptr
movei #Xor2Texture,texture_ptr2
move pc,YLOOP
addq #4,YLOOP
__pc1 move pc,XLOOP
addq #xloop1-__pc1,XLOOP
yloop1:
movei #127,x_count
xloop1:
move x_count,tmp0
move y_count,tmp1
shrq #2,tmp0
shrq #2,tmp1
moveq #15,tmp2
xor tmp1,tmp0
and tmp2,tmp0
addqt #16,tmp0
storeb tmp0,(texture_ptr)
addqt #32,tmp0
addqt #16,tmp0
storeb tmp0,(texture_ptr2)
subq #1,x_count
addqt #1,texture_ptr2
jump pl,(XLOOP)
addqt #1,texture_ptr
subq #1,y_count
jump pl,(YLOOP)
add delta,_i0
jump (LR)
nop
unreg delta,XLOOP,YLOOP,texture_ptr,texture_ptr2
unreg iter_count,temp1,temp2,x_count,y_count
unreg _r1,_i1,_r0,_i0,_i,_r
ENDMODULE mandel