home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
FreeWare Collection 2
/
FreeSoftwareCollection2pd199x-jp.img
/
ms_dos
/
xscrfm51
/
xinit.asm
< prev
next >
Wrap
Assembly Source File
|
1990-06-14
|
9KB
|
432 lines
title xscript version 1.4 for FMR series
page 66, 132
;
; Transcript service for PC-9801 MS-DOS ( Ver 1.4 )
; Initialize routine.
; Written by Oka / Feb. 7, 1988.
; Modified for FMR by SHU on Jan. 1989
; Ver. 2.1 by SHU / Mar. 11, 1989
; Ver. 2.2 by SHU / Mar. 21, 1989
; Ver. 2.3 by SHU / Mar. 25, 1989
; Ver. 3.0 by SHU / Apr. 1, 1989
; Ver. 3.1 by SHU / Apr. 7, 1989
; Ver. 3.2 by SHU / Apr. 11, 1989
; Ver. 3.3 by SHU / Apr. 19, 1989
; Ver. 3.4 by SHU / May. 11, 1989
; Ver. 4.0 by SHU / May. 27, 1989
; Ver. 4.2 by SHU / Jan. 13, 1990
; Ver. 4.3 by SHU / Feb. 15, 1990
;
include xscript.h
code segment byte public
assume cs:code
;---------------------------------------;
; initialize ;
;---------------------------------------;
public init
IFNDEF FMR
extrn kbtrap_init : near
extrn restore_int09h : near
ENDIF
extrn trap18h_entry : near
extrn int18h_entry : word
extrn trap29h_entry : near
extrn int29h_entry : word
extrn xservice_entry : near
extrn org_xint_entry : word
extrn my_name : byte
extrn my_name_len : word
extrn tvram_seg : word
extrn txtbuf_seg : word
extrn tvbuf_seg : word
extrn xbank_on : byte
extrn header_char : byte
extrn always_paste : byte
IFDEF FMR
extrn use_gvram_flag : byte
extrn use_mm_flag : byte
ENDIF
IFDEF FMR
last_addr_fm label word
ENDIF
remove_flag db OFF
usage_flag db OFF
now_option db OFF
init:
call get_option
cmp remove_flag, ON ; specified remove option (-R) ?
jne init1
jmp remove_exit ; Yes
init1:
cmp usage_flag, ON
jne init2
jmp disp_usage
init2:
call check_exist ; existency check.
jne init9
jmp exist_exit ; already exist
;
init9:
IFDEF FMR
IFDEF FMR70
cmp use_gvram_flag, ON
jne init9_1
mov cs:tvbuf_seg, TVBUF_SEG_R70G
ELSE
mov cs:tvram_seg, TVRAM_SEG_R50
mov cs:tvbuf_seg, TVBUF_SEG_R50
cmp use_gvram_flag, ON
jne init9_1
mov cs:tvbuf_seg, TVBUF_SEG_R50G
ENDIF
init9_1:
ENDIF
IFDEF FMR
mov ax, offset last_addr_fm
ELSE
call kbtrap_init ; keyboard interrupt trap.
ENDIF
mov cl, 4
shr ax, cl
inc ax
mov dx, ax
cmp use_mm_flag, ON
jne init9_2
; 主記憶上にバッファを確保
mov ax, cs
add ax, dx
mov cs:tvbuf_seg, ax ; set screen buffer segment
add ax, 512 ; 8KB = 16B * 512
mov cs:txtbuf_seg, ax ; set transcript buffer segment
add dx, 512 + 4096 ; 64KB = 16B * 4096
init9_2:
mov cs:last_addr, dx
IFDEF FMR
mov ax, 3590h ; FM BIOS keyboard
ELSE
mov ax, 3518h
ENDIF
int 21h
mov int18h_entry, bx ; int 18h のエントリ・ポイントを保存
mov int18h_entry+2, es
mov ax, 3529h
int 21h
mov int29h_entry, bx ; int 29h のエントリ・ポイントを保存
mov int29h_entry+2, es
mov ah, 35h
mov al, XSERV_INT
int 21h
mov org_xint_entry, bx ; xscript int のエントリ・ポイントを保存
mov org_xint_entry+2, es
mov dx, offset trap18h_entry
IFDEF FMR
mov ax, 2590h
ELSE
mov ax, 2518h
ENDIF
int 21h ; set the keyboard bios entry address.
mov dx, offset trap29h_entry
mov ax, 2529h ; トラップ・ルーチンのエントリ・ポイントを
int 21h ; int 29h に設定する
mov dx, offset xservice_entry
mov ah, 25h
mov al, XSERV_INT ; transcript サービス・ルーチンの
int 21h ; エントリ・ポイントを設定する
mov dx, offset op_msg ; opening message.
mov ah, 9
int 21h
; mov ax, cs:last_addr ; プログラムの残りを解放して、
; mov cl, 4
; shr ax, cl
; inc ax
; mov dx, ax
mov dx, cs:last_addr
mov ax, 3100h
int 21h ; 常駐終了
;---------------------------------------;
; already exist ;
;---------------------------------------;
exist_exit:
mov dx, offset exist_msg
jmp short all_exit
;---------------------------------------;
; usage を表示 ;
;---------------------------------------;
disp_usage:
mov dx, offset help_msg
jmp short all_exit
;---------------------------------------;
; xscript を解放して終了 ;
;---------------------------------------;
remove_exit:
call check_exist
je remove1
mov dx, offset not_exist_msg
jmp short all_exit
remove1:
push ds
lds dx, dword ptr es:int18h_entry
IFDEF FMR
mov ax, 2590h ; int 90h のエントリ・ポイントを回復
ELSE
mov ax, 2518h ; int 18h のエントリ・ポイントを回復
ENDIF
int 21h
lds dx, dword ptr es:int29h_entry
mov ax, 2529h ; int 29h のエントリ・ポイントを回復
int 21h
lds dx, dword ptr es:org_xint_entry
mov ah, 25h
mov al, XSERV_INT ; xscript int のエントリ・ポイントを回復
int 21h
IFNDEF FMR
call restore_int09h
ENDIF
pop ds
IFDEF FMR
cmp es:use_gvram_flag, OFF
je remove1_1
push es
mov es, es:tvbuf_seg
xor di, di
xor ax, ax
mov cx, 2000h
cld
rep stosb ; clear tvbuf memory
IFDEF FMR70
pop es
push es
mov es, es:txtbuf_seg
xor di, di
mov cx, 8000h
rep stosw ; clear txtbuf memory
ENDIF
mov ah, 01h ; set display mode
mov al, 00h ; show char & graphic plane
int 91h ; call BIOS display
pop es
remove1_1:
ENDIF
call free_env
mov ah, 49h ; メモリー ノ カイホウ
int 21h
mov dx, offset remove_msg
;
all_exit:
mov ah, 9 ; メッセージ ヲ ヒョウジ シテ
int 21h
mov ax, 4C00h ; シュウリョウ
int 21h
free_env:
push es
mov ax, es:[2Ch] ; カンキョウ ヘンスウ リョウイキ
cmp ax, 0
je no_env
mov es, ax
mov ah, 49h ; メモリー ノ カイホウ
int 21h
no_env:
pop es
mov word ptr es:[2Ch], 0
ret
;---------------------------------------;
; existency check ;
; out ZERO on .. exist ;
; off .. not exist ;
;---------------------------------------;
check_exist:
call get_xscr_seg
mov di, offset my_name
mov si, offset my_name
; mov cx, 20
mov cx, my_name_len
cld
repe cmpsb
ret
;-----------------------------------------------;
; xscript routine のセグメントの取り出し ;
;-----------------------------------------------;
get_xscr_seg:
sub ax, ax
mov es, ax
mov es, es:[XSERV_INT*4+2]
ret
;---------------------------------------;
; オプションパラメータの取り出し ;
;---------------------------------------;
get_option:
cld
mov si, 81h ; beginning of option line.
get_opt1:
call get_1opt ; get 1 option specifier.
cmp al, ' '
jb get_opt2 ; end of line.
call opt_toupper ; convert into uppercase.
call set_opt_var ; set option variable.
jmp get_opt1 ; continue.
get_opt2:
ret
;---------------------------------------;
; オプションラインを大文字化する ;
;---------------------------------------;
opt_toupper:
cmp al, 'a'
jb opt_up2
cmp al, 'z'
ja opt_up2
sub al, 20h
opt_up2:
ret
;---------------------------------------;
; 1オプション指定文字を得る ;
;---------------------------------------;
get_1opt:
lodsb
cmp al, ' '
jb get_1opt2
jne get_1opt0
mov now_option, OFF
get_1opt0:
cmp now_option, ON
je get_1opt2
cmp al, '-'
je get_1opt1
cmp al, '/'
jne get_1opt
get_1opt1:
lodsb
mov now_option, ON
get_1opt2:
ret
;---------------------------------------;
; オプション変数に値をセット ;
;---------------------------------------;
set_opt_var:
cmp al, 'R' ; Remove option ?
jne set_opt1
mov remove_flag, ON
ret
set_opt1:
cmp al, 'M' ; Use main memory
jne set_opt2
mov use_mm_flag, ON
ret
set_opt2:
cmp al, '?'
jne set_opt4
set_opt3:
mov usage_flag, ON
ret
set_opt4:
cmp al, 'H'
je set_opt3
cmp al, 'I'
jne set_opt5
lodsb
mov cs:header_char, al
ret
set_opt5:
cmp al, 'A'
jne set_opt6
lodsb
sub al, '0'
mov cs:always_paste, al
ret
set_opt6:
cmp al, 'E'
jne set_opt7
call free_env
ret
set_opt7:
IFDEF FMR
cmp al, 'G' ; Use graphic VRAM
jne set_opt9
mov use_gvram_flag, ON
mov cs:xbank_on, BANK_R_P0
mov ah, 01h ; set display mode
mov al, 0Ah ; disable graphic plane
int 91h ; call BIOS display
ret
set_opt9:
ENDIF
dec si
mov now_option, OFF
ret
last_addr dw ?
help_msg db 'XSCRIPT(', VERSION, '): '
db 'xscript [-r|-?|-h|-[eiagm]..]',CR,LF
db ' r : remove xscript',CR,LF
db ' ? : show help',CR,LF
db ' h : show help',CR,LF
db ' e : free environment area',CR,LF
db ' iC: set C to include char',CR,LF
db ' a0: include with SHIFT key(default)',CR,LF
db ' a1: include with non-SHIFT key',CR,LF
db ' a2: include always',CR,LF
db ' g : use graphic VRAM',CR,LF
db ' m : use main memory',CR,LF
db '$'
not_exist_msg db 'The transcript service not installed',CR,LF,'$'
exist_msg db 'The transcript service already installed',CR,LF,'$'
remove_msg db 'Remove the transcript service',CR,LF,'$'
op_msg db 'Install the transcript service (Ver 1.4) by Oka, Appne, ish and Locus',CR,LF
IFDEF FMR
IFDEF FMR50
db 09,VERSIONL,' (FMR-10LT/30/50/60:16dot/FM16β) by SHU',CR,LF,'$'
ELSE
IFDEF FMTOWNS
db 09,VERSIONL,' (FMTOWNS:MS-DOS) by SHU',CR,LF,'$'
ELSE
db 09,VERSIONL,' (FMR-60/70) by SHU',CR,LF,'$'
ENDIF
ENDIF
ENDIF
code ends
end