1 ; See LICENSE file for copyright
and license details.
10 %define ROUND_UP
10B ;toward
+inf
11 %define ROUND_DOWN
01B ;toward
-inf
14 %macro CHECK_OPENBSD
0
16 section
.note.openbsd.ident note
49 ;hours
= floor
(diff
/ sec_inhour
) = xmm10
51 divsd xmm10
, [sec_inhour
]
52 roundsd xmm10
, xmm10
, ROUND_DOWN
55 ;remaining_seconds
= diff
- (hours
* sec_inhour
) = xmm14
57 mulsd xmm10
, [sec_inhour
]
60 ;minutes
= remaining_seconds
/ sec_inmin
61 divsd xmm14
, [sec_inmin
]
62 roundsd xmm14
, xmm14
, ROUND_DOWN
87 ;p2
= cos
(convert_degrees_to_radians
(latitude
)) *
88 ; cos
(convert_degrees_to_radians
(D
)) = xmm1
89 movsd xmm1
, [latitude
]
99 ;p3
= sin
(convert_degrees_to_radians
(latitude
)) *
100 ; sin
(convert_degrees_to_radians
(D
)) = xmm2
101 movsd xmm2
, [latitude
]
104 movsd xmm3
, xmm8
, ; xmm8
= D
110 %macro NORM
2; n
= x
- (y
* floor
(x
/ y
));
113 roundsd xmm14
, xmm14
, ROUND_DOWN
118 %macro CALC_T
1;
T = p1
* p5
119 ;p4
= -1.0 * sin
(convert_degrees_to_radians
(alpha
)) = %1
124 ;p5
= convert_radians_to_degrees
(acos
((p4
- p3
) / p2
)) = %1
125 subsd
%1, xmm2 ; p4
- p3
126 divsd
%1, xmm1 ;
/ p2
128 mulsd
%1, [to_deg
] ;
%1 = p5
136 mov rsi
, tmp0+
11 ; pointer to the end of decimal number
137 mov byte
[rsi
], 0xa ;
add '\n'
138 cvttsd2si rax
, %1 ; convert double to int
139 mov rbx
, 0xa ; hex number will divide to
10
140 mov rcx
, 1 ; decimal number length
+ '\n'
144 mov rax
, SYS_write ; system call number
(sys_write
)
145 mov rdi
, STDOUT ; first argument
: file handle
(stdout
)
146 mov rdx
, rcx ; second argument
: pointer to string
151 inc rcx ; calculate output length
152 xor rdx
, rdx ; remainder storage should
be 0 before divide
153 div rbx ; divide hex number to
10
154 add rdx
, 0x30 ; calculate ascii code of remainder
155 dec rsi ; calculate decimal digit place
156 mov
[rsi
], dl ; put decimal digit into string
157 cmp rax
, 0 ; is there hex digits any more?
162 movsd xmm14
, %1 ;copy prayer to xmm14
169 subsd
%1, xmm6 ;print diff
= prayer time
- tstamp
= %1