home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / scheme / pcscheme / geneva / sources.exe / SOURCES / ASM / INLINE.ASH < prev    next >
Encoding:
Text File  |  1992-12-26  |  15.9 KB  |  599 lines

  1. ;* INLINE.ASH
  2. ;************************************************************************
  3. ;*                                    *
  4. ;*        PC Scheme/Geneva 4.00 Borland TASM code            *
  5. ;*                                    *
  6. ;* (c) 1985-1988 by Texas Instruments, Inc. See COPYRIGHT.TXT        *
  7. ;* (c) 1992 by L. Bartholdi & M. Vuilleumier, University of Geneva    *
  8. ;*                                    *
  9. ;*----------------------------------------------------------------------*
  10. ;*                                    *
  11. ;*        8086 Assembly macros for creating inline FSL's        *
  12. ;*                                    *
  13. ;*----------------------------------------------------------------------*
  14. ;*                                    *
  15. ;* Created by: John Jensen        Date: 1985            *
  16. ;* Revision history:                            *
  17. ;* - 18 Jun 92:    Renaissance (Borland Compilers, ...)            *
  18. ;*                                    *
  19. ;*                    ``In nomine omnipotentii dei''    *
  20. ;************************************************************************
  21. IDEAL
  22. INCLUDE    "assembly.ash"
  23. MODEL    TINY
  24. CODESEG
  25.     db    '#!fast-load 4.0, assembly code "', ??filename, '", '
  26.     db    ??date, ' ', ??time, 0dh, 0ah
  27.  
  28. MACRO    HEXNIBBLE    datum
  29. T = datum
  30. IF    T GE 10
  31.     DB    T + 'A' - 10
  32. ELSE
  33.     DB    T + '0'
  34. ENDIF
  35. ENDM
  36.  
  37. MACRO    startinline    name, args
  38. PROC    name    FAR
  39.     db    'h0002 0015', 0dh, 0ah
  40. ARGCOUNT = args
  41.     db    'x'
  42. LABEL    @@namelen
  43.     db    '00'
  44.     db    "&name", 0dh, 0ah
  45. LABEL    @@nameend
  46. NAMESIZE = @@nameend - @@namelen - 4
  47. ORG    @@namelen
  48.     HEXNIBBLE    <(NAMESIZE shr 4) and 0fh>
  49.     HEXNIBBLE    <NAMESIZE and 0fh>
  50. ORG    @@nameend
  51.  
  52.     db    'm'
  53. LABEL    @@codelen
  54.     db    '0000'
  55. ENDM
  56.  
  57. MACRO    endinline
  58. LABEL    @@codeend
  59. CODESIZE = @@codeend - @@codelen - 4
  60. ORG    @@codelen
  61. REPT    4
  62.     HEXNIBBLE    <(CODESIZE shr 12) and 0fh>
  63.     CODESIZE = CODESIZE shl 4
  64. ENDM
  65. ORG    @@codeend
  66.     db    0dh, 0ah, 't'
  67.     VM_MVC    R1, 0
  68.     VM_CLO    R1, @@closure, ARGCOUNT
  69.     VM_DEF    R1, 0
  70.     VM_MVC    R1, 0
  71.     VM_EXIT
  72. LABEL    @@closure
  73.     VM_MVC    R62, 1
  74.     VM_EXEC    R62
  75.     VM_EXIT
  76.     DB    0dh, 0ah, 'z', 0dh, 0ah
  77. ENDP
  78. ENDM
  79.  
  80. ldpage        EQU    [DWORD di+00h]
  81. alloc_big_block    EQU    [DWORD di+04h]
  82. alloc_block    EQU    [DWORD di+08h]
  83. alloc_flonum    EQU    [DWORD di+0ch]
  84. alloc_int    EQU    [DWORD di+10h]
  85. alloc_list_cell    EQU    [DWORD di+14h]
  86. alloc_string    EQU    [DWORD di+18h]
  87. cons        EQU    [DWORD di+1ch]
  88. free        EQU    [DWORD di+20h]
  89. getch        EQU    [DWORD di+24h]
  90. get_max_cols    EQU    [DWORD di+28h]
  91. get_max_rows    EQU    [DWORD di+2ch]
  92. int2long    EQU    [DWORD di+30h]
  93. is_graph_mode    EQU    [DWORD di+34h]
  94. long2int    EQU    [DWORD di+38h]
  95. malloc        EQU    [DWORD di+3ch]
  96. nosound        EQU    [DWORD di+40h]
  97. sound        EQU    [DWORD di+44h]
  98. zcuroff        EQU    [DWORD di+48h]
  99. zcuron        EQU    [DWORD di+4ch]
  100. zprintf        EQU    [DWORD di+50h]
  101. zputc        EQU    [DWORD di+54h]
  102. zscroll        EQU    [DWORD di+58h]
  103. zscroll_d    EQU    [DWORD di+5ch]
  104.  
  105. reg0        EQU    (REG si+00h)
  106. reg1        EQU    (REG si+04h)
  107. reg2        EQU    (REG si+08h)
  108. reg3        EQU    (REG si+0ch)
  109. reg4        EQU    (REG si+10h)
  110. reg5        EQU    (REG si+14h)
  111. reg6        EQU    (REG si+18h)
  112. reg7        EQU    (REG si+1ch)
  113. reg8        EQU    (REG si+20h)
  114. reg9        EQU    (REG si+24h)
  115. reg10        EQU    (REG si+28h)
  116. reg11        EQU    (REG si+2ch)
  117. reg12        EQU    (REG si+30h)
  118. reg13        EQU    (REG si+34h)
  119. reg14        EQU    (REG si+38h)
  120. reg15        EQU    (REG si+3ch)
  121. reg16        EQU    (REG si+40h)
  122. reg17        EQU    (REG si+44h)
  123. reg18        EQU    (REG si+48h)
  124. reg19        EQU    (REG si+4ch)
  125. reg20        EQU    (REG si+50h)
  126. reg21        EQU    (REG si+54h)
  127. reg22        EQU    (REG si+58h)
  128. reg23        EQU    (REG si+5ch)
  129. reg24        EQU    (REG si+60h)
  130. reg25        EQU    (REG si+64h)
  131. reg26        EQU    (REG si+68h)
  132. reg27        EQU    (REG si+6ch)
  133. reg28        EQU    (REG si+70h)
  134. reg29        EQU    (REG si+74h)
  135. reg30        EQU    (REG si+78h)
  136. reg31        EQU    (REG si+7ch)
  137. reg32        EQU    (REG si+80h)
  138. reg33        EQU    (REG si+84h)
  139. reg34        EQU    (REG si+88h)
  140. reg35        EQU    (REG si+8ch)
  141. reg36        EQU    (REG si+90h)
  142. reg37        EQU    (REG si+94h)
  143. reg38        EQU    (REG si+98h)
  144. reg39        EQU    (REG si+9ch)
  145. reg40        EQU    (REG si+0a0h)
  146. reg41        EQU    (REG si+0a4h)
  147. reg42        EQU    (REG si+0a8h)
  148. reg43        EQU    (REG si+0ach)
  149. reg44        EQU    (REG si+0b0h)
  150. reg45        EQU    (REG si+0b4h)
  151. reg46        EQU    (REG si+0b8h)
  152. reg47        EQU    (REG si+0bch)
  153. reg48        EQU    (REG si+0c0h)
  154. reg49        EQU    (REG si+0c4h)
  155. reg50        EQU    (REG si+0c8h)
  156. reg51        EQU    (REG si+0cch)
  157. reg52        EQU    (REG si+0d0h)
  158. reg53        EQU    (REG si+0d4h)
  159. reg54        EQU    (REG si+0d8h)
  160. reg55        EQU    (REG si+0dch)
  161. reg56        EQU    (REG si+0e0h)
  162. reg57        EQU    (REG si+0e4h)
  163. reg58        EQU    (REG si+0e8h)
  164. reg59        EQU    (REG si+0ech)
  165. reg60        EQU    (REG si+0f0h)
  166. reg61        EQU    (REG si+0f4h)
  167. reg62        EQU    (REG si+0f8h)
  168. reg63        EQU    (REG si+0fch)
  169.  
  170. ; structures stolen from SCHEME.ASH
  171.  
  172. ; Page attribute bits
  173. ATOM        =    08000H         ; 1 = Atomic data
  174. LISTCELL    =    04000H        ; 1 = List (cons) cells
  175. FIXNUMS        =    02000H         ; 1 = 16-bit integer data
  176. FLONUMS        =    01000H         ; 1 = 32-bit floating point data
  177. BIGNUMS        =    00800H         ; 1 = big integer values
  178. SYMBOLS        =    00400H         ; 1 = symbols
  179. STRINGS        =    00200H         ; 1 = strings
  180. VECTORS        =    00100H         ; 1 = vector (array) storage
  181. NOMEMORY    =    00080H         ; 1 = no memory allocated
  182. READONLY    =    00040H         ; 1 = memory is read only (constant)
  183. CONTINU        =    00020H         ; 1 = continuation object
  184. CLOSURE        =    00010H         ; 1 = closure object
  185. I86CODE        =    00008H         ; 1 = inline 8086 code
  186. PORTS        =    00004H         ; 1 = I/O ports
  187. CODE        =    00002H         ; 1 = code block
  188. CHARS        =    00001H         ; 1 = characters
  189. NUMBERS        =    FIXNUMS+FLONUMS+BIGNUMS ; number (fixnums, flonums, bignums)
  190.     
  191. ; Data type equates (classes of data objects)
  192. NUMTYPES    =    15        ; Number of data types
  193. LISTTYPE    =    0
  194. FIXTYPE        =    2
  195. FLOTYPE        =    4
  196. BIGTYPE        =    6
  197. SYMBTYPE    =    8
  198. STRTYPE        =    10
  199. VECTTYPE    =    12
  200. CONTTYPE    =    14
  201. CLOSTYPE    =    16
  202. FREETYPE    =    18
  203. CODETYPE    =    20
  204. I86TYPE        =    22
  205. PORTTYPE    =    24
  206. CHARTYPE    =    26
  207. ENVTYPE        =    28
  208.     
  209. ; Special pre-allocated pages
  210. SPECCHAR    =    1
  211. SPECFREE    =    2
  212. SPECFIX        =    3
  213. SPECFLO        =    4
  214. SPECSYM        =    5
  215. SPECPOR        =    6
  216. SPECCODE    =    7
  217.     
  218. STRUC    REG
  219. disp    DW    ?
  220. LABEL    bpage    BYTE
  221. page    DW    ?
  222. ENDS    REG
  223.  
  224.  
  225. STRUC    POINTER    
  226. page    DB    ?
  227. disp    DW    ?
  228. ENDS    POINTER    
  229.     
  230. STRUC    FIXNUM        
  231. tag    DB    SPECFIX*2
  232. val    DW    ?
  233. ENDS    FIXNUM    
  234.  
  235. ; Generic object (inherited)
  236. STRUC    ANYDEF
  237.     UNION
  238. tag    DB    ?
  239. gc    DB    ?
  240.     ENDS    
  241. len    DW    ?
  242. data    POINTER <>        
  243. ENDS    ANYDEF
  244.  
  245. ; Free cell (!)
  246. STRUC    FREEDEF
  247.     UNION
  248. tag    DB    FREETYPE
  249. gc    DB    ?
  250.     ENDS    
  251. len    DW    ?
  252. ENDS    FREEDEF
  253.  
  254. ; Free linked list cell
  255. STRUC    FREELISTDEF
  256. tag    DB    SPECFREE*2
  257. next    DW    ?            ; pointer to next free cell in page
  258. ENDS    FREELISTDEF
  259.  
  260. ; List Cell
  261. ;    +-------------v-+-------------------------------+
  262. ;    | car page #  |g|    car displacement    |
  263. ;    +-------------^-+-------------------------------+
  264. ;    | cdr page #  |0|    cdr displacement    |
  265. ;    +---------------+-------------------------------+
  266. ; where g = used during garbage collection
  267. STRUC    LISTDEF    
  268.     UNION
  269. car    POINTER    <>
  270. ptr    POINTER <>
  271. gc    DB    ?
  272.     ENDS    
  273. cdr    POINTER <>
  274. ENDS    LISTDEF    
  275.  
  276. ; Bignum
  277. ;    +-------------v-+-------------------------------+
  278. ;    | BIGTYPE     |g|    length in bytes        |
  279. ;    +-------------^-+-------------------------------+
  280. ;    |    sign    |    least significant word    |
  281. ;    +---------------+--------------------------------
  282. ;            :                 :
  283. ;            +-------------------------------+
  284. ;            |    most significant word    |
  285. ;            +-------------------------------+
  286. ; where g = used during garbage collection
  287. STRUC    BIGDATA
  288. len    DW    ?             ; length of entire data structure in bytes
  289. sign    DB    ?             ; sign of the bignum
  290. lsw    DW    ?             ; data bits, with LSBs appearing first
  291. msw    DW    ?             ; second word of significant bits
  292. ENDS    BIGDATA
  293.  
  294. STRUC    BIGDEF
  295.     UNION
  296. tag    DB    BIGTYPE         ; tag = bignum
  297. gc    DB    ?
  298.     ENDS
  299. data    BIGDATA    ?
  300. ENDS    BIGDEF    
  301.  
  302. ; special structure to occupy a vacant slot in a FLONUM page
  303. STRUC    FREEFLODEF
  304. tag    DB    FREETYPE
  305. next    DW    ?            ; pointer to next free cell in page
  306. ENDS    FREEFLODEF
  307.  
  308. ; Flonum
  309. ;    +-------------v-+---+---+---+---+---+---+---+---+
  310. ;    | FLOTYPE     | | 64 bit IEEE floating point    |
  311. ;    +-------------^-+---+---+---+---+---+---+---+---+
  312. ; where g = used during garbage collection
  313. STRUC    FLODEF
  314.     UNION
  315. tag    DB    FLOTYPE         ; tag = flonum
  316. gc    DB    ?
  317.     ENDS        
  318.     UNION
  319. data    DQ    ?
  320. ptr    POINTER    <>
  321.     ENDS        
  322. ENDS    FLODEF    
  323.  
  324. ; Vector (Array)
  325. ;    +-------------v-+-------------------------------+
  326. ;    | VECTTYPE    |g|    length in bytes        |
  327. ;    +-------------^-+-------------------------------+
  328. ;    :        data #i pointer            :
  329. ;    ------------------------------------------------+
  330. ; where g = used during garbage collection
  331. STRUC    VECDEF
  332.     UNION
  333. tag    DB    VECTTYPE
  334. gc    DB    ?
  335.     ENDS        
  336. len    DW    ?
  337. LABEL    data    POINTER
  338. ENDS    VECDEF    
  339.  
  340. ; Symbol
  341. ;    +-------------v-+-------------------------------+
  342. ;    | SYMBTYPE    |g|    length in bytes        |
  343. ;    +-------------^-+-------------------------------+
  344. ;    |        link pointer            |
  345. ;    +-+-------------+---------------v---------------+
  346. ;    | hash value    : characters    :
  347. ;    +---------------+---------------+
  348. ; where g = used during garbage collection
  349. STRUC    SYMDEF
  350.     UNION
  351. tag    DB    SYMBTYPE         ; tag = symbol
  352. gc    DB    ?
  353.     ENDS        
  354. len    DW    ?             ; length of symbol structure in bytes
  355. link    POINTER <>
  356. hashkey DB    ?             ; hash key
  357. LABEL    buffer    BYTE            ; character(s) in symbol
  358. ENDS    SYMDEF    
  359.  
  360. ; String
  361. ;    +-------------v-+-------------------------------+
  362. ;    | STRTYPE     |g|    length in bytes        |
  363. ;    +-------------^-+-------------------------------+
  364. ;    : characters    :
  365. ;    +---------------+
  366. ; where g = used during garbage collection
  367. STRUC    STRDEF
  368.     UNION
  369. tag    DB    STRTYPE            ; tag = string
  370. gc    DB    ?
  371.     ENDS        
  372. len    DW    ?             ; length of string structure in bytes
  373. LABEL    buffer    BYTE            ; character(s) in string
  374. ENDS    STRDEF    
  375.  
  376. MACRO    sstrlen    dest, pntr, ohead
  377.     LOCAL    @@bigstring, @@allstrings
  378.     mov    dest, [(STRDEF pntr).len]
  379.     or    dest, dest
  380.     jge    @@bigstring
  381. IFIDN    <ohead>, <OVERHEAD>
  382.     add    dest, OFFSET (TYPE STRDEF).buffer + SIZE POINTER
  383. @@bigstring:
  384. ELSE
  385.     add    dest, SIZE POINTER
  386.     jmp    @@allstrings
  387. @@bigstring:
  388.     sub    dest, OFFSET (TYPE STRDEF).buffer
  389. @@allstrings:
  390. ENDIF
  391.     ENDM
  392.  
  393. ; Closure
  394. ;    +-------------v-+-------------------------------+
  395. ;    | CLOSTYPE    |g|    length in bytes        |
  396. ;    +-------------^-+-------------------------------+
  397. ;    |     information operand pointer        |
  398. ;    +---------------+-------------------------------+
  399. ;    |    heap environment pointer        |
  400. ;    +---------------+-------------------------------+
  401. ;    |    code block pointer            |
  402. ;    +---------------+-------------------------------+
  403. ;    | SPECFIX*2    | Entry Point Displacement    |
  404. ;    +---------------+-------------------------------+
  405. ;    | SPECFIX*2    | Number of Arguments        |
  406. ;    +---------------+-------------------------------+
  407. ; where g = used during garbage collection
  408. STRUC    CLOSDEF
  409.     UNION
  410. tag    DB    CLOSTYPE         ; tag = closure
  411. gc    DB    ?
  412.     ENDS        
  413. len    DW    ?             ; length of closure object in bytes
  414. info    POINTER <>            ; information operand
  415. heap    POINTER <>            ; heap environment pointer
  416. codeblk    POINTER    <>            ; code base
  417. entry    FIXNUM <>            ; entry point tag = immediate
  418. args    FIXNUM    <>            ; number of arguments tag = immediate
  419. LABEL    debug    BYTE            ; optional debugging information?
  420. ENDS    CLOSDEF    
  421.  
  422. ; Continuation
  423. ;    +-------------v-+-------------------------------+
  424. ;    | CONTTYPE    |g|    length in bytes        |
  425. ;    +-------------^-+-------------------------------+
  426. ;    | SPECFIX*2    | stack base of continuation    |
  427. ;    +---------------+-------------------------------+
  428. ;    |    return address code base pointer    |\
  429. ;    +---------------+-------------------------------+ | return address
  430. ;    | SPECFIX*2    | return address displacement    |/
  431. ;    +---------------+-------------------------------+
  432. ;    | SPECFIX*2    | caller's dynamic link (FP)    |
  433. ;    +---------------+-------------------------------+
  434. ;    |    fluid environment pointer (fnv_reg)    |
  435. ;    +---------------+-------------------------------+
  436. ;    | previous stack segment (continuation) pointer |
  437. ;    +---------------+-------------------------------+
  438. ;    |    global environment pointer (gnv_reg)    |
  439. ;    +---------------+-------------------------------+
  440. ;    :                         :< - BASE
  441. ;    :    [contents of stack at call/cc]        :
  442. ;    :                         :< - topofstack
  443. ;    +-----------------------------------------------+
  444. ; where g = used during garbage collection
  445. STRUC    CONTDEF
  446.     UNION
  447. tag    DB    CONTTYPE         ; tag = continuation
  448. gc    DB    ?
  449.     ENDS        
  450. len    DW    ?             ; length of continuation structure in bytes
  451. base    FIXNUM    <>
  452. codeblk    POINTER    <>            ; return address code base pointer
  453. retaddr    FIXNUM    <>            ; return address displacement
  454. dynlink    FIXNUM    <>            ; caller's dynamic link
  455. fluid    POINTER <>            ; fluid environment pointer
  456. stk    POINTER    <>            ; previous stack segment pointer
  457. globenv    POINTER <>            ; global environment pointer
  458. LABEL    data    BYTE            ; contents of stack at call/cc
  459. ENDS    CONTDEF    
  460.  
  461. ; Code Block
  462. ;    +-------------v-+-------------------------------+
  463. ;    | CODETYPE    |g|    length in bytes        |
  464. ;    +-------------^-+-------------------------------+
  465. ;    | SPECFIX*2    |    entry offset        |-\
  466. ;    +---------------+-------------------------------+ |
  467. ;    :    pointer to constant #i            : |
  468. ;    +---------------+---------------+---------------+ |
  469. ;/----->:    code    :                  |
  470. ;|    +---------------+                  |
  471. ;\--------------------------------------------------------/
  472. ; where g = used during garbage collection
  473. STRUC    CODEDEF
  474.     UNION
  475. tag    DB    CODETYPE         ; tag = code block
  476. gc    DB    ?
  477.     ENDS        
  478. len    DW    ?             ; length of code block in bytes
  479. entry    FIXNUM    <>            ; entry offset tag = fixnum
  480. consts    POINTER    <>            ; code block constants area
  481. ENDS    CODEDEF
  482.  
  483. ; Inline code block
  484. ;    +-------------v-+-------------------------------+
  485. ;    | I86TYPE     |g|    length in bytes        +
  486. ;    +-------------^-+-------------------------------+
  487. ;    : machine code    :
  488. ;    +---------------+
  489. ; where g = used during garbage collection
  490. STRUC    I86DEF
  491.     UNION
  492. tag    DB    I86TYPE
  493. gc    DB    ?
  494.     ENDS
  495. len    DW    ?
  496. LABEL    data    BYTE
  497. ENDS    I86DEF
  498.  
  499. ; Environment Data Object
  500. ;    +-------------v-+-------------------------------+
  501. ;    | ENVTYPE     |g|    length in bytes        |
  502. ;    +-------------^-+-------------------------------+
  503. ;    |         parent pointer            |
  504. ;    +---------------+-------------------------------+
  505. ;    | list of symbols (linked through cdr field)    |
  506. ;    +---------------+-------------------------------+
  507. ;    | list of values (linked through car field)    |
  508. ;    +---------------+-------------------------------+
  509. ; where g = used during garbage collection
  510. STRUC    ENVDEF
  511.     UNION
  512. tag    DB    ENVTYPE         ; tag = environment
  513. gc    DB    ?
  514.     ENDS        
  515. len    DW    ?             ; length in bytes
  516. parent    POINTER <>
  517. names    POINTER    <>            ; list of names
  518. values    POINTER    <>            ; list of values
  519. ENDS    ENVDEF
  520.  
  521. ; Port
  522. ;    +-------------v-+-------------------------------+
  523. ;    | PORTTYPE    |g|    length in bytes        |
  524. ;    +-------------^-+-------------------------------+
  525. ;    |        string source pointer        |
  526. ;    +---------------+---------------+---------------+---------------+
  527. ;    |     port flags        |         handle        |
  528. ;    +---------------+---------------+---------------+---------------+
  529. ;    |    cursor line        |    cursor column        |
  530. ;    +---------------+---------------+---------------+---------------+
  531. ;    |    upper left line        |    upper left column    |
  532. ;    +---------------+---------------+---------------+---------------+
  533. ;    |    number of lines        |    number of columns    |
  534. ;    +---------------+---------------+---------------+---------------+
  535. ;    |    border attributes    |    text attributes        |
  536. ;    +---------------+---------------+---------------+---------------+
  537. ;    |    window flags        |    buffer position        |
  538. ;    +---------------+---------------+---------------+---------------+
  539. ;    |    buffer end        : i/o buffer    :
  540. ;    +---------------+---------------+---------------+
  541. ;    : window label/file pathname    :
  542. ;    +---------------+---------------+
  543. ; where g = used during garbage collection
  544. ;         7 6 5 4 3 2 1 0
  545. ;        +-v-v-v-v-v-v---+
  546. ; port flags:    | |s|b|t|o|w|mod|
  547. ;        +-^-^-^-^-^-^---+
  548. ;
  549. ; mode:    0    read
  550. ;    1    write
  551. ;    2    read and write
  552. ; w:    0    file
  553. ;    1    window
  554. ; o:    0    closed
  555. ;    1    open
  556. ; t:    0    transcript disabled
  557. ;    1    transcript enabled
  558. ; b:    0    text file/window
  559. ;    1    binary file/window
  560. ; s:    0    file/window I/O
  561. ;    1    string I/O
  562. ;
  563. ;         7 6 5 4 3 2 1 0
  564. ;        +-----------v-v-+
  565. ;window flags:    |        |e|w|
  566. ;        +-----------^-^-+
  567. ;
  568. ; w:    0    clip
  569. ;    1    wrap
  570. ; e:    0    exposed
  571. ;    1    (partially) covered
  572. BUFFSIZE =    100h
  573. HISTSIZE =    4 * BUFFSIZE        ; history buffer length
  574.  
  575. STRUC    PORTDEF
  576.     UNION
  577. tag    DB    PORTTYPE         ; tag = port
  578. gc    DB    ?
  579.     ENDS        
  580. len    DW    ?             ; length of port structure in bytes
  581. ptr    POINTER    <>
  582. pflags    DW    ?             ; port flags
  583. handle    DW    ?             ; file's handle
  584. curline    DW    ?             ; cursor line number
  585. curcol    DW    ?             ; cursor column number
  586. LABEL    chunk    WORD            ; chunk ???
  587. ulline    DW    ?             ; upper left hand corner's line number
  588. ulcol    DW    ?             ; upper left hand corner's column number
  589. nlines    DW    ?             ; number of lines
  590. ncols    DW    ?             ; number of columns/line length
  591. border    DW    ?             ; window's border attributes
  592. text    DW    ?             ; window's text attributes
  593. flags    DW    ?             ; window flags
  594. bufpos    DW    ?             ; buffer position (offset)
  595. bufend    DW    ?             ; end of buffer offset
  596. buffer    DB    BUFFSIZE DUP (?)    ; input/output buffer
  597. ENDS    PORTDEF    
  598.  
  599.