From 731fc36ca46d6febb28d246b48463b8746d09184 Mon Sep 17 00:00:00 2001 From: afify Date: Tue, 24 Nov 2020 19:14:58 +0300 Subject: [PATCH] [feat] add option -N print next prayer 12-hour --- azan-nasm.s | 28 +++++++++++++++++++++++++++- macros.s | 2 +- 2 files changed, 28 insertions(+), 2 deletions(-) diff --git a/azan-nasm.s b/azan-nasm.s index 44feaab..a1bec85 100644 --- a/azan-nasm.s +++ b/azan-nasm.s @@ -63,6 +63,8 @@ check_argv: je get_timestamp cmp r12b, 0x6e ;n je get_timestamp + cmp r12b, 0x4e ;N + je get_timestamp cmp r12b, 0x76 ;v jne die_usage DIE version_msg, version_len @@ -291,7 +293,10 @@ print_nfajr: movsd xmm14, xmm12 cmp r12b, byte 'u' je print_unix - + cmp r12b, byte 'n' + je print_fajr + cmp r12b, byte 'N' + je print_fajr subsd xmm12, xmm6 ;diff = prayer time - tstamp = xmm12 SEC_TO_HM xmm12 PRINT_EXIT @@ -301,6 +306,10 @@ print_fajr: 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 @@ -323,6 +332,8 @@ print_asr: 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 @@ -334,6 +345,8 @@ print_maghrib: 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 @@ -345,6 +358,8 @@ print_isha: 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 @@ -357,6 +372,17 @@ print_24: SEC_TO_HM xmm14 PRINT_EXIT +print_12: + subsd xmm14, xmm15 ;prayer timestamp - start_of_day + SEC_TO_HM xmm14 + cmp r8, 0xc + ja sub12h + PRINT_EXIT + +sub12h: + sub r8, 0xc + PRINT_EXIT + ; result_hour ;r8 ; result_min ;r9 ; duhr_ts: ;xmm0 diff --git a/macros.s b/macros.s index d50b0fc..aa5609a 100644 --- a/macros.s +++ b/macros.s @@ -12,7 +12,7 @@ %define MAX_ARGC 2 section .rodata - usage_msg: db "usage: azan-nasm [-nuv]", 10, 0 + usage_msg: db "usage: azan-nasm [-Nnuv]", 10, 0 usage_len: equ $ - usage_msg version_msg: db "azan-nasm-", VERSION, 10, 0 version_len: equ $ - version_msg -- 2.11.4.GIT