+ initialize the SelectorInc variable on win16

git-svn-id: trunk@31549 -
This commit is contained in:
nickysn 2015-09-06 11:52:30 +00:00
parent 48e83479ef
commit 58465396db
2 changed files with 13 additions and 3 deletions

View File

@ -31,6 +31,7 @@
extern __fpc_CmdShow
extern __fpc_HInstance
extern __fpc_HPrevInst
extern __fpc_SelectorInc
extern InitTask
import InitTask KERNEL
@ -38,6 +39,8 @@
import WaitEvent KERNEL
extern InitApp
import InitApp USER
extern __AHIncr
import __AHIncr KERNEL
..start: ; Win16 applications start with the following
; values in registers:
@ -77,6 +80,13 @@
mov [__fpc_HInstance], di
mov [__fpc_HPrevInst], si
; the offset of the Win16 kernel function __AHIncr (by definition)
; gives us the value of SelectorInc. The function __AHIncr is
; otherwise useless (when called, it increments AH by one :) )
; The value of SelectorInc is usually 8 in most (all?) win16
; implementations, but it's good practice not to hardcode it.
mov word [__fpc_SelectorInc], __AHIncr
; call WaitEvent(0) to clear the event that started this task
; Windows expects this call immediately after InitTask
xor ax, ax

View File

@ -50,9 +50,6 @@ const
segA000: Word = $A000;
segB000: Word = $B000;
segB800: Word = $B800;}
{ The value that needs to be added to the segment to move the pointer by
64K bytes (BP7 compatibility) }
SelectorInc: Word = $1000;
type
LPSTR = ^Char;far;
@ -77,6 +74,9 @@ var
CmdShow: SmallInt;public name '__fpc_CmdShow';
HInstance: Word{HINST};public name '__fpc_HInstance';
HPrevInst: Word{HINST};public name '__fpc_HPrevInst';
{ The value that needs to be added to the segment to move the pointer by
64K bytes (BP7 compatibility) }
SelectorInc: Word;public name '__fpc_SelectorInc';
{ SaveInt00: FarPointer;public name '__SaveInt00';}