.586
.model flat,stdcall
option casemap:none
include C:\masm32\include\windows.inc
include C:\masm32\include\user32.inc
include C:\masm32\include\kernel32.inc
includelib C:\masm32\lib\kernel32.lib
includelib C:\masm32\lib\user32.lib

yearconv proto :DWORD,:DWORD

.data
year1	dd 1986
year2	dd 2000
year3	dd 2001
year4	dd 2345
year5	dd 2999
buffer	db 5 dup (0)
.code
start:
	invoke yearconv,year1,addr buffer
	invoke MessageBox,0,addr buffer,0,0
	invoke yearconv,year2,addr buffer
	invoke MessageBox,0,addr buffer,0,0
	invoke yearconv,year3,addr buffer
	invoke MessageBox,0,addr buffer,0,0
	invoke yearconv,year4,addr buffer
	invoke MessageBox,0,addr buffer,0,0
	invoke yearconv,year5,addr buffer
	invoke MessageBox,0,addr buffer,0,0
	call ExitProcess

yearconv proc num:DWORD,straddr:DWORD
	mov eax,num
	sub eax,2000
	jns y2k
	add eax,100
	aam
	or eax,31393030h
	jmp done
y2k:	mov ecx,-1
again:	inc ecx
	sub eax,100
	jns again
	add eax,100
	shl ecx,16
	aam
	or  ecx,32303030h
	or  eax,ecx	
done:  	mov edx,straddr
	bswap eax
        mov ,eax
	ret
yearconv endp

	end start
edit by Hiro: added tags (remove the x when using them) This message was edited by Hiroshimator, on 2/5/2001 7:37:12 PM
Posted on 2001-02-05 19:28:00 by The Svin