计算农历的函数汇编原码(4)/zz/

;===========================
Hz_NumStr       db      ‘一二三四五六七八九’
Hz_TenStr       db      ‘十’
Hz_NumHStr      db      ‘初十廿’
_GetLunarStr    proc    _lpstLunarData:dword,lpBuffer:dword
assume esi:ptr LUNARDATA
pushad


mov     esi,_lpstLunarData
mov     edi,lpBuffer
cmp     [esi].dbIsLeapMonth,1
jne     l_002
&n103fbsp;     mov     ax,0F2C8h                       ;’闰’
stosw
l_002:                  movzx   ebx,[esi].dbLunarMonth
cmp     bl,12
ja      l_005
cmp     bl,1
jb      l_005
mov     ax,0FDD5h                       ;’正’
je      l_004
cmp     bl,11
jb      l_003
mov     ax,word ptr Hz_TenStr           ;’十’
stosw
sub     bl,10
l_003:                  dec     bl
mov     ax, word ptr Hz_NumStr[2*ebx]
l_004:                  stosw
mov     ax, 0C2D4h                      ;’月’
stosw
l_005:                  mov     bl,[esi].dbLunarDay
cmp     bl,30
ja      l_008
103f                      mov     edx,9
mov     ax, word ptr Hz_NumStr[4]
je      l_007
mov     ax, word ptr Hz_NumStr[2]
cmp     bl,20
je      l_007
mov     al,bl
dec     al
js      l_008
movzx   eax,al
cdq
mov     ecx,10
div     ecx
mov     ax, word ptr Hz_NumHStr[2*eax]
l_007:                  stosw
mov     ax, word ptr Hz_NumStr[2*edx]
stosw
l_008:                  mov     al,0
stosb
popad
assume  esi:nothing
ret
_GetLunarStr    endp
;**************************************************
Tg_Str          db      ‘甲乙丙丁戊己庚辛壬癸’
Dz_Str          db      ‘子丑寅卯辰巳午未申酉戌亥’
_GetGzStr               proc    GzNumber:dword                        pushad
mov     eax,GzNumber
mov     cl,10
div     cl
movzx   ebx,ah
mov     eax,GzNumber
mov     cl,12
div     cl
movzx   edx,ah
mov     ax, word ptr Tg_Str[2*ebx]
mov     word ptr [esp+1Ch],ax
mov     ax, word ptr Dz_Str[2*edx]
mov     word ptr [esp+1Ch][2],ax
popad
ret
_GetGzStr               endp
;**************************************************
Sx_Str          db      ‘鼠牛虎免龙蛇马羊猴鸡狗猪’
Wx_Str          db      ‘金木水火土’
_GetSxStr               proc    GzNumber:dword
xor     eax,eax
pushad
mov     eax,GzNumber
mov     cl,12
div     cl
&nbs103fp;          movzx   edx,ah
mov     ax, word ptr Sx_Str[2*edx]
mov     word ptr [esp+1Ch],ax
mov     ecx,GzNumber
shr     ecx,1
cmp     cl,15
jb      l001
sub     cl,15
l001:                   mov     eax,42304130h
cmp     cl,8
jb      l002
sub     cl,8
mov     eax,2134210h
l002:                   shl     cl,2
shr     eax,cl
and     al,0Fh
movzx   eax,al
mov     ax,word ptr Wx_Str[eax*2]
mov     word ptr [esp+1Ch][2],ax
popad
ret
_GetSxStr               endp
;=======================================
Hd_str  db      ‘小寒大寒立春雨水惊蛰春分清明谷雨立夏小满芒种夏至’,\
‘小暑大暑立秋处暑白露秋分寒露霜降立冬小雪大雪冬至’
_GetHDStr       proc    HdNumb103fer:dword
mov     eax,HdNumber
or      eax,eax
jz      l001
dec     eax
mov     eax,dword ptr Hd_str[eax*4]
l001:                   ret
_GetHDStr       endp

发表评论

邮箱地址不会被公开。 必填项已用*标注