Annotation of os2sdk/startup/fmsghdr.asm, revision 1.1

1.1     ! root        1:        TITLE   fmsghdr       - far message handler and finder
        !             2: ;***
        !             3: ;fmsghdr.asm - far message handler and finder
        !             4: ;
        !             5: ;      Copyright (c) 1986-1987, Microsoft Corporation.  All rights reserved.
        !             6: ;
        !             7: ;Purpose:
        !             8: ;      Far message handler and finder.
        !             9: ;
        !            10: ;*******************************************************************************
        !            11: 
        !            12: 
        !            13: ?DF=   1                       ; this is special for c startup
        !            14: include        version.inc
        !            15: ?PLM=  1                       ; pascal calling conventions
        !            16: .xlist
        !            17: include        cmacros.inc
        !            18: include        msdos.inc
        !            19: .list
        !            20: 
        !            21: createSeg _TEXT, code, word,   public, CODE,   <>
        !            22: 
        !            23: createSeg _DATA, data, word,   public, DATA,   DGROUP
        !            24: 
        !            25: createSeg FAR_HDR,fhdr, byte,  public, FAR_MSG,FMGROUP
        !            26: createSeg FAR_MSG,fmsg, byte,  public, FAR_MSG,FMGROUP
        !            27: createSeg FAR_PAD,fpad, byte,  common, FAR_MSG,FMGROUP
        !            28: createSeg FAR_EPAD,fepad, byte,        common, FAR_MSG,FMGROUP
        !            29: 
        !            30: defGrp DGROUP                  ; define DGROUP
        !            31: defGrp FMGROUP                 ; define FMGROUP
        !            32: 
        !            33: codeOFFSET equ offset _TEXT:
        !            34: fmsgOFFSET equ offset FMGROUP:
        !            35: 
        !            36: 
        !            37: sBegin fhdr
        !            38: assumes        ds,data
        !            39: 
        !            40:        db      '<<FMSG>>'
        !            41: stfmsg label   byte
        !            42: 
        !            43: sEnd
        !            44: 
        !            45: SBegin fpad
        !            46: assumes        ds,data
        !            47: 
        !            48:        dw      -1              ; message padding marker
        !            49: 
        !            50: sEnd
        !            51: 
        !            52: sBegin fepad
        !            53: assumes        ds,data
        !            54: 
        !            55:        db      -1
        !            56: 
        !            57: sEnd
        !            58: 
        !            59: 
        !            60: sBegin code
        !            61: assumes        cs,code
        !            62: assumes        ds,data
        !            63: 
        !            64: page
        !            65: ;***
        !            66: ;__FMSG_TEXT(messagenumber) - find message for given message number
        !            67: ;
        !            68: ;Purpose:
        !            69: ;      This routine returns a far pointer to the message associated with
        !            70: ;      messagenumber.  If the message does not exist, then a 0:0 is returned.
        !            71: ;
        !            72: ;Entry:
        !            73: ;      ==PASCAL CALLING CONVENTIONS==
        !            74: ;      messagenumber   = WORD number of desired message
        !            75: ;
        !            76: ;Exit:
        !            77: ;      DX:AX   = pointer to message text or 0:0 if message doesn't exist
        !            78: ;
        !            79: ;Uses:
        !            80: ;
        !            81: ;Exceptions:
        !            82: ;
        !            83: ;*******************************************************************************
        !            84: 
        !            85: cProc  __FMSG_TEXT,<PUBLIC>,<ds,si,di>  ; pascal calling
        !            86: 
        !            87: parmW  msgt
        !            88: 
        !            89: cBegin
        !            90:        mov     ax,FMGROUP
        !            91:        mov     ds,ax           ; ds = FMGROUP (force it always)
        !            92:        push    ds
        !            93:        pop     es
        !            94:        mov     dx,msgt         ; dx = message number
        !            95:        mov     si,fmsgOFFSET stfmsg ; start of far messages
        !            96: 
        !            97: tloop:
        !            98:        lodsw                   ; ax = current message number
        !            99:        cmp     ax,dx
        !           100:        je      found           ;   found it - return address
        !           101:        inc     ax
        !           102:        xchg    ax,si
        !           103:        jz      found           ;   at end and not found - return 0
        !           104:        xchg    di,ax
        !           105:        xor     ax,ax
        !           106:        mov     cx,-1
        !           107:        repne   scasb           ; skip until 00
        !           108:        mov     si,di
        !           109:        jmp     tloop           ; try next entry
        !           110: 
        !           111: found:
        !           112:        xchg    ax,si
        !           113:        cwd                     ; zero out dx in case NULL
        !           114:        or      ax,ax
        !           115:        jz      notfound
        !           116:        mov     dx,ds           ; remember segment selector
        !           117: notfound:
        !           118: cEnd
        !           119: 
        !           120: sEnd
        !           121: 
        !           122:        end

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.