[Reduction] #411: ems_exist

This commit is contained in:
nmlgc 2014-08-31 10:43:56 +02:00
parent 267749bd40
commit d4f0bb7c27
3 changed files with 66 additions and 67 deletions

View File

@ -0,0 +1,62 @@
; master library - PC98 - MSDOS - EMS
;
; Description:
; EMS ドライバの存在確認
;
; Function/Procedures:
; int ems_exist(void) ;
;
; Parameters:
; none
;
; Returns:
; int 0 ... 存在しない
; 1 ... 存在する
;
; Binding Target:
; Microsoft-C / Turbo-C / Turbo Pascal
;
; Running Target:
; PC-9801
;
; Requiring Resources:
; CPU: 8086
; EMS: LIM EMS 4.0
;
; Notes:
; すべての EMS関数を実行する前にかならずこれで存在判定を行うこと。
;
; Compiler/Assembler:
; TASM 3.0
; OPTASM 1.6
;
; Author:
; 恋塚昭彦
;
; Revision History:
; 92/11/16 Initial
func EMS_EXIST
push SI
push DI
push DS
xor AX,AX
mov ES,AX
mov ES,ES:[67h*4+2]
mov DI,000ah
mov BX,CS
mov DS,BX
mov SI,offset emm_device_name
mov CX,4
repe cmpsw
jne short @@NAI
inc AX
@@NAI:
pop DS
pop DI
pop SI
ret
endfunc
emm_device_name db 'EMMXXXX0'

View File

@ -1824,39 +1824,7 @@ sub_40F4 endp
include libs/master.lib/ems_allocate.asm
include libs/master.lib/ems_enablepageframe.asm
; =============== S U B R O U T I N E =======================================
sub_418A proc far
push si
push di
push ds
xor ax, ax
mov es, ax
assume es:seg000
mov es, word ptr es:[019Eh]
assume es:nothing
mov di, 0Ah
mov bx, cs
mov ds, bx
assume ds:seg000
mov si, 41ACh
mov cx, 4
repe cmpsw
jnz short loc_41A8
inc ax
loc_41A8:
pop ds
assume ds:dseg
pop di
pop si
retf
sub_418A endp
; ---------------------------------------------------------------------------
db 45h, 2 dup(4Dh), 4 dup(58h), 30h
include libs/master.lib/ems_exist.asm
; =============== S U B R O U T I N E =======================================
@ -5822,7 +5790,7 @@ loc_B4AF:
add al, 30h ; '0'
mov es:[bx+3], al
mov word_266DE, 0
call sub_418A
call ems_exist
or ax, ax
jz short loc_B52E
call sub_4258

View File

@ -1310,38 +1310,7 @@ sub_3F6A endp
include libs/master.lib/ems_allocate.asm
include libs/master.lib/ems_enablepageframe.asm
; =============== S U B R O U T I N E =======================================
sub_4000 proc far
push si
push di
push ds
xor ax, ax
mov es, ax
mov es, word ptr es:[019Eh]
assume es:nothing
mov di, 0Ah
mov bx, cs
mov ds, bx
assume ds:seg000
mov si, 4022h
mov cx, 4
repe cmpsw
jnz short loc_401E
inc ax
loc_401E:
pop ds
assume ds:dseg
pop di
pop si
retf
sub_4000 endp
; ---------------------------------------------------------------------------
db 45h, 2 dup(4Dh), 4 dup(58h), 30h
include libs/master.lib/ems_exist.asm
; =============== S U B R O U T I N E =======================================
@ -5946,7 +5915,7 @@ loc_B843:
loc_B84E:
mov word_25FF0, 0
call sub_4000
call ems_exist
or ax, ax
jz short loc_B8C0
call sub_40CE