About me
Home
Resumé
CV
Pictures

Course Work
CSE300-FA98

Teaching
Portfolio
CSE240-SP99
CSE207-FA03

Misc
eHarmony
Documents

Tools

External Code and Data

Within your main routine you can declare certain functions or data to be external. If you want your main routine to be able to access procedures that are part of a library module, you will need to declare them as external. The following code shows how you can declare a few functions and some data

_TEXT SEGMENT USE16 WORD PUBLIC 'CODE'
    EXTRN New09h:FAR, New08h:FAR, New2Fh:FAR, New80h:FAR

    EXTRN orig08hVector:DWORD, orig08hOffset:WORD, orig08hSegment:WORD
    EXTRN orig09hVector:DWORD, orig09hOffset:WORD, orig09hSegment:WORD
    EXTRN orig2FhVector:DWORD, orig2FhOffset:WORD, orig2FhSegment:WORD

    ASSUME cs:_TEXT, ds:_DATA
  Start:
    mov     ax, _DATA
    mov     ds, ax
     ....

And for completeness, one of the interrupt handlers is shown below. Tasks, and task_ptr are both external variables that are declared in the main routine in the _DATA segment. The orig08h... variables are placed in the code segment for convience during calling. Remember, you can put data in a data segment, text segment, or wherever.

       .....
PUBLIC New08h
PUBLIC orig08hVector, orig08hOffset, orig08hSegment

_DATA SEGMENT USE16 BYTE PUBLIC 'DATA'
    EXTRN Tasks:Task 
    EXTRN task_ptr:WORD
_DATA ENDS

_TEXT SEGMENT USE16 WORD PUBLIC 'CODE'
    ASSUME cs:_TEXT, ds:_DATA

    orig08hVector       LABEL DWORD
    orig08hOffset       DW ?
    orig08hSegment      DW ?

New08h PROC FAR
       ....
Last Modified: January 26, 1999 - Barry E. Mapen