azan

prayers time calculator written in nasm
git clone git://git.afify.dev/azan
Log | Files | Refs | README | LICENSE

commit d538831f2c18d531f9dd8c80e9df42ac13edcb07
parent 09a5cb08b8580e8bed50de71ec922dc1714e4657
Author: afify <hassan@afify.dev>
Date:   Thu, 26 Nov 2020 05:28:21 +0300

[ref] handel flags in a macro

Diffstat:
Mazan-nasm.s | 53+++++------------------------------------------------
Mmacros.s | 13+++++++++++++
2 files changed, 18 insertions(+), 48 deletions(-)

diff --git a/azan-nasm.s b/azan-nasm.s @@ -303,66 +303,23 @@ print_nfajr: print_fajr: mov [res_msg], byte 'F' - movsd xmm14, xmm3 - cmp r12b, byte 'u' - je print_unix - cmp r12b, byte 'n' - je print_24 - cmp r12b, byte 'N' - je print_12 - subsd xmm3, xmm6 ;diff = prayer time - tstamp = xmm3 - SEC_TO_HM xmm3 - PRINT_EXIT + PRINT_FLAG xmm3 print_duhr: mov [res_msg], byte 'D' - movsd xmm14, xmm0 - cmp r12b, byte 'u' - je print_unix - cmp r12b, byte 'n' - je print_24 - subsd xmm0, xmm6 ;diff = prayer time - tstamp = xmm0 - SEC_TO_HM xmm0 - PRINT_EXIT + PRINT_FLAG xmm0 print_asr: mov [res_msg], byte 'A' - movsd xmm14, xmm4 - cmp r12b, byte 'u' - je print_unix - cmp r12b, byte 'n' - je print_24 - cmp r12b, byte 'N' - je print_12 - subsd xmm4, xmm6 ;diff = prayer time - tstamp = xmm4 - SEC_TO_HM xmm4 - PRINT_EXIT + PRINT_FLAG xmm4 print_maghrib: mov [res_msg], byte 'M' - movsd xmm14, xmm5 - cmp r12b, byte 'u' - je print_unix - cmp r12b, byte 'n' - je print_24 - cmp r12b, byte 'N' - je print_12 - subsd xmm5, xmm6 ;diff = prayer time - tstamp = xmm5 - SEC_TO_HM xmm5 - PRINT_EXIT + PRINT_FLAG xmm5 print_isha: mov [res_msg], byte 'I' - movsd xmm14, xmm7 - cmp r12b, byte 'u' - je print_unix - cmp r12b, byte 'n' - je print_24 - cmp r12b, byte 'N' - je print_12 - subsd xmm7, xmm6 ;diff = prayer time - tstamp = xmm7 - SEC_TO_HM xmm7 - PRINT_EXIT + PRINT_FLAG xmm7 print_unix: PRINT_INT ;from xmm14 diff --git a/macros.s b/macros.s @@ -167,4 +167,17 @@ next_digit: EEXIT EXIT_SUCCESS %endmacro +%macro PRINT_FLAG 1 + movsd xmm14, %1 ;copy prayer to xmm14 + cmp r12b, byte 'u' + je print_unix + cmp r12b, byte 'n' + je print_24 + cmp r12b, byte 'N' + je print_12 + subsd %1, xmm6 ;print diff = prayer time - tstamp = %1 + SEC_TO_HM %1 + PRINT_EXIT +%endmacro + %endif ;MACROS_S