home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
FreeWare Collection 2
/
FreeSoftwareCollection2pd199x-jp.img
/
ms_dos
/
ish
/
ish200s
/
timezone.asm
< prev
next >
Wrap
Assembly Source File
|
1990-06-14
|
6KB
|
305 lines
;
; ish file converter for MS-DOS Ver 2.00 (90/3/27)
;
;
; Copyright (c) 1986, 1987, 1989, 1990 by M. ishizuka
; All rights reserved.
;
;-----------------------------------------------;
; ;
; get_num2 ;
; ;
; INPUT : si (pointer) ;
; bx (handle) ;
; OUTPUT: al (number) ;
; si (next pointer) ;
; ERROR : error_42 ;
; BREAK : flags, ah ;
; ;
;-----------------------------------------------;
get_num2: call get_para_char
jc error_42
sub al, '0'
jc error_42
cmp al, 10d
jnc error_42
mov ah, al
call get_para_char
jc error_42
sub al, '0'
jc error_42
cmp al, 10d
jnc error_42
add ah, ah
add al, ah
add ah, ah
add ah, ah
add al, ah
ret
;-----------------------------------------------;
; ;
; skip_cr_lf ;
; ;
; INPUT : si (pointer) ;
; bx (handle) ;
; OUTPUT: si (next pointer) ;
; al (next character) ;
; flags (NC: ok) ;
; (CY: end of file) ;
; ERROR : NON ;
; BREAK : flags ;
; ;
;-----------------------------------------------;
skip_cr_lf: call get_para_char
jc skip_cr_lf_ret
cmp al, 0dh
jz skip_cr_lf
cmp al, 0ah
jz skip_cr_lf
dec si
skip_cr_lf_ret: ret
;-----------------------------------------------;
; ;
; get_and_check ;
; ;
; INPUT : si (pointer) ;
; bx (handle) ;
; cl (check character) ;
; OUTPUT: si (next pointer) ;
; al (character) ;
; ERROR : error_42 ;
; BREAK : flags, al ;
; ;
;-----------------------------------------------;
get_and_check: call get_para_char
jc error_42
cmp al, cl
jnz error_42
ret
;-----------------------------------------------;
; ;
; skip_space2 ;
; ;
; INPUT : si (pointer) ;
; bx (handle) ;
; OUTPUT: si (next pointer) ;
; al (next character) ;
; ERROR : error_42 ;
; BREAK : flags, al ;
; ;
;-----------------------------------------------;
skip_space2:
call get_para_char
jc error_42
cmp al, ' '
jz skip_space2
cmp al, 9
jz skip_space2
dec si
ret
;-----------------------------------------------;
; ;
; skip_to_cr_lf ;
; ;
; INPUT : si (pointer) ;
; bx (handle) ;
; OUTPUT: si (next pointer) ;
; al (next character) ;
; flags (NC: ok) ;
; (CY: end of file) ;
; ERROR : NON ;
; BREAK : flags, al ;
; ;
;-----------------------------------------------;
skip_to_cr_lf: call get_para_char
jc skip_to_cr_lf_ret
cmp al, 0dh
jz skip_to_cr_lf_1
cmp al, 0ah
jnz skip_to_cr_lf
skip_to_cr_lf_1:
dec si
skip_to_cr_lf_ret:
ret
;-----------------------------------------------;
; ;
; set_utc ;
; ;
; INPUT : NON ;
; OUTPUT: NON ;
; ERROR : NON ;
; BREAK : flags, ax, bx, cx, dx, si ;
; ;
;-----------------------------------------------;
set_utc: mov ax, word ptr save_date
mov bl, al
and bl, 1fh
dec bl
mov byte ptr utc[4], bl
shr ax, 1
shr al, 1
shr al, 1
shr al, 1
shr al, 1
dec al
mov byte ptr utc[5], al
mov al, ah
xor ah, ah
add ax, 1980d
mov word ptr utc[6], ax
xor ax, ax
mov word ptr utc, ax
mov word ptr utc[2], ax
mov al, byte ptr difference_of_time[2]
cbw
mov si, ax
mov ax, word ptr save_time
mov bl, al
xor bh, bh
and bl, 1fh
shl bl, 1
shr ax, 1
shr ax, 1
shr ax, 1
shr al, 1
shr al, 1
mov cl, al
xor ch, ch
mov al, 60d
mul ah
add ax, cx
mov cx, 60d
mul cx
add ax, bx
adc dx, 0
add ax, word ptr difference_of_time
adc dx, si
mov si, offset utc
; jmp local_time_to_utc
;-----------------------------------------------;
; ;
; local_time_to_utc ;
; ;
; INPUT : ax (difference of time low) ;
; dx (difference of time high) ;
; si (pointer) ;
; (dword ptr[si]: difference of time)
; (byte ptr [si+4]: date - 1) ;
; (byte ptr [si+5]: month - 1) ;
; (word ptr [si+6]: year) ;
; OUTPUT: NON ;
; ERROR : NON ;
; BREAK : flags, ax, bx, cx, dx ;
; ;
;-----------------------------------------------;
local_time_to_utc:
mov bx, word ptr [si]
mov cx, word ptr [si+2]
or dx, dx
jns local_time_to_utc_0
add ax, 1
adc dx, 0
local_time_to_utc_0:
and ax, 0fffeh
add bx, ax
adc cx, dx
mov al, 0
js local_time_to_utc_5
local_time_to_utc_1:
cmp cx, 1
jc local_time_to_utc_3
jnz local_time_to_utc_2
cmp bx, 20864d ; 3600d*24d - 65536d
jc local_time_to_utc_3
local_time_to_utc_2:
sub bx, 20864d ; 3600d*24d - 65536d
sbb cx, 1
inc al
jmp local_time_to_utc_1
local_time_to_utc_3:
mov word ptr [si], bx
mov word ptr [si+2], cx
mov dx, word ptr [si+4]
mov cx, word ptr [si+6]
add dl, al
cmp dl, 28d
jc local_time_to_utc_9
mov bx, offset month_table
mov al, dh
xlat
test cl, 3
jnz local_time_to_utc_4
cmp al, 28d
jnz local_time_to_utc_4
inc al
local_time_to_utc_4:
cmp dl, al
jc local_time_to_utc_9
sub dl, al
inc dh
cmp dh, 12d
jc local_time_to_utc_9
sub dh, 12d
inc cx
jmp local_time_to_utc_9
local_time_to_utc_5:
inc al
add bx, 20864d ; 3600d*24d - 65536d
adc cx, 1
js local_time_to_utc_5
mov word ptr [si], bx
mov word ptr [si+2], cx
mov dx, word ptr [si+4]
mov cx, word ptr [si+6]
sub dl, al
jnc local_time_to_utc_9
sub dh, 1
jnc local_time_to_utc_7
add dh, 12d
dec cx
local_time_to_utc_7:
mov bx, offset month_table
mov al, dh
xlat
test cl, 3
jnz local_time_to_utc_8
cmp al, 28d
jnz local_time_to_utc_8
inc al
local_time_to_utc_8:
add dl, al
local_time_to_utc_9:
mov word ptr [si+4], dx
mov word ptr [si+6], cx
ret