From 366031612711a00200792187ae77b8a8e134be6d Mon Sep 17 00:00:00 2001 From: nmlgc Date: Sun, 31 Aug 2014 10:51:29 +0200 Subject: [PATCH] [Reduction] #413: ems_movememoryregion --- libs/master.lib/ems_movememoryregion.asm | 55 ++++++++++++++++++++++++ th04_main.asm | 28 ++---------- th05_main.asm | 28 ++---------- 3 files changed, 61 insertions(+), 50 deletions(-) create mode 100644 libs/master.lib/ems_movememoryregion.asm diff --git a/libs/master.lib/ems_movememoryregion.asm b/libs/master.lib/ems_movememoryregion.asm new file mode 100644 index 00000000..4912e286 --- /dev/null +++ b/libs/master.lib/ems_movememoryregion.asm @@ -0,0 +1,55 @@ +; master library - PC98 - MSDOS - EMS +; +; Description: +; EMSメモリと主メモリなどの間でデータを転送する +; +; Function/Procedures: +; int ems_movememoryregion( struct const EMS_move_source_dest * block ) ; +; +; Parameters: +; struct .. * block パラメータブロック +; +; Returns: +; 0 ........... success +; 80h〜 ....... failure(EMS エラーコード) +; +; Binding Target: +; Microsoft-C / Turbo-C / Turbo Pascal +; +; Running Target: +; PC-9801 +; +; Requiring Resources: +; CPU: 8086 +; EMS: LIM EMS 4.0 +; +; Notes: +; ・NEC の EMSドライバは、このファンクションによって segment B000hの +;  メモリを VRAMでなく設定してしまいます。 +;  実行後、ems_enablepageframe()によって VRAMに戻して下さい。 +; +; Compiler/Assembler: +; TASM 3.0 +; OPTASM 1.6 +; +; Author: +; 恋塚昭彦 +; +; Revision History: +; 92/11/16 Initial + +func EMS_MOVEMEMORYREGION + push SI + mov SI,SP + + _push DS + _lds SI,SS:[SI+(RETSIZE+1)*2] + mov AX,5700h + int 67h + mov AL,AH + xor AH,AH + + _pop DS + pop SI + ret DATASIZE*2 +endfunc diff --git a/th04_main.asm b/th04_main.asm index 3a3b7b3e..bfe547fa 100644 --- a/th04_main.asm +++ b/th04_main.asm @@ -1810,8 +1810,7 @@ arg_C = word ptr 12h push ss lea ax, [bp+var_12] push ax - push cs - call near ptr sub_41C6 + call ems_movememoryregion push ax sub ax, ax push ax @@ -1826,27 +1825,7 @@ include libs/master.lib/ems_allocate.asm include libs/master.lib/ems_enablepageframe.asm include libs/master.lib/ems_exist.asm include libs/master.lib/ems_free.asm - -; =============== S U B R O U T I N E ======================================= - - -sub_41C6 proc far - push si - mov si, sp - push ds - lds si, ss:[si+6] - mov ax, 5700h - int 67h ; - LIM EMS 4.0 - MOVE/EXCHANGE MEMORY REGION - ; AL = 00h move memory region / 01h exchange memory region - ; DS:SI -> structure describing source and destination - ; Return: AH = status - mov al, ah - xor ah, ah - pop ds - pop si - retf 4 -sub_41C6 endp - +include libs/master.lib/ems_movememoryregion.asm ; =============== S U B R O U T I N E ======================================= @@ -1923,8 +1902,7 @@ arg_C = word ptr 12h push ss lea ax, [bp+var_12] push ax - push cs - call near ptr sub_41C6 + call ems_movememoryregion push ax sub ax, ax push ax diff --git a/th05_main.asm b/th05_main.asm index 71eeae97..0cf592a2 100644 --- a/th05_main.asm +++ b/th05_main.asm @@ -1296,8 +1296,7 @@ arg_C = word ptr 12h push ss lea ax, [bp+var_12] push ax - push cs - call near ptr sub_403C + call ems_movememoryregion push ax sub ax, ax push ax @@ -1312,27 +1311,7 @@ include libs/master.lib/ems_allocate.asm include libs/master.lib/ems_enablepageframe.asm include libs/master.lib/ems_exist.asm include libs/master.lib/ems_free.asm - -; =============== S U B R O U T I N E ======================================= - - -sub_403C proc far - push si - mov si, sp - push ds - lds si, ss:[si+6] - mov ax, 5700h - int 67h ; - LIM EMS 4.0 - MOVE/EXCHANGE MEMORY REGION - ; AL = 00h move memory region / 01h exchange memory region - ; DS:SI -> structure describing source and destination - ; Return: AH = status - mov al, ah - xor ah, ah - pop ds - pop si - retf 4 -sub_403C endp - +include libs/master.lib/ems_movememoryregion.asm ; =============== S U B R O U T I N E ======================================= @@ -1409,8 +1388,7 @@ arg_C = word ptr 12h push ss lea ax, [bp+var_12] push ax - push cs - call near ptr sub_403C + call ems_movememoryregion push ax sub ax, ax push ax