From 95983ca23a2d5eea50f4e0a612d1c74b02a785be Mon Sep 17 00:00:00 2001 From: n-a-c-h <> Date: Thu, 30 Dec 2004 19:50:58 +0000 Subject: [PATCH] Get_Date now actually returns proper day and month on Win32 and SDL. --- zsnes/src/linux/sdlintrf.asm | 14 ++++++++++++-- zsnes/src/win/winintrf.asm | 18 +++++++++++++----- 2 files changed, 25 insertions(+), 7 deletions(-) diff --git a/zsnes/src/linux/sdlintrf.asm b/zsnes/src/linux/sdlintrf.asm index 850e78f5..ed73a74c 100644 --- a/zsnes/src/linux/sdlintrf.asm +++ b/zsnes/src/linux/sdlintrf.asm @@ -432,8 +432,18 @@ NEWSYM Get_TimeDate NEWSYM Get_Date ; dl = day, dh = month, cx = year - mov dx,0 - mov cx,0 + pushad + call GetDate + mov [TempVarSeek],eax + popad + mov eax,[TempVarSeek] + movzx edx,al ;Move day into edx, day is in BCD + shr edx,4 ;Chop off the second digit + imul edx,10 ;Multiply first digit by 10, since we want decimal + and al,0xF ;Remove first BCD digit + add dl,al ;Add second digit to first*10 + mov dh,ah ;Copy month + ;Year still isn't done yet, although I don't think we use it anywhere -Nach ret NEWSYM Get_File_Date diff --git a/zsnes/src/win/winintrf.asm b/zsnes/src/win/winintrf.asm index 53872d69..cda52542 100644 --- a/zsnes/src/win/winintrf.asm +++ b/zsnes/src/win/winintrf.asm @@ -482,12 +482,20 @@ NEWSYM Get_TimeDate NEWSYM Get_Date ; dl = day, dh = month, cx = year - mov dx,0 - mov cx,0 -; mov ah,2Ah -; int 21h + pushad + call GetDate + mov [TempVarSeek],eax + popad + mov eax,[TempVarSeek] + movzx edx,al ;Move day into edx, day is in BCD + shr edx,4 ;Chop off the second digit + imul edx,10 ;Multiply first digit by 10, since we want decimal + and al,0xF ;Remove first BCD digit + add dl,al ;Add second digit to first*10 + mov dh,ah ;Copy month + ;Year still isn't done yet, although I don't think we use it anywhere -Nach ret - + NEWSYM Get_File_Date mov [ZFFTimeFName],edx pushad