539 lines
20 KiB
Plaintext
539 lines
20 KiB
Plaintext
|
; =====> SCHEMED.EQU
|
|||
|
page 60,132
|
|||
|
; TIPC Scheme Runtime Data Structure Equates
|
|||
|
; Copyright 1984,1985 by Texas Instruments Incorporated.
|
|||
|
; All Rights Reserved.
|
|||
|
;
|
|||
|
; Last Update:
|
|||
|
;
|
|||
|
; tc 10 Feb 1987 - Modified Page 5 special symbols to reflect #T
|
|||
|
; per the R^3 Report.
|
|||
|
|
|||
|
include memtype.equ
|
|||
|
|
|||
|
; The following equates set the limits on the virtual memory (paging)
|
|||
|
; system:
|
|||
|
NUMPAGES equ 128 ; Total number of pages
|
|||
|
DEDPAGES equ 8 ; Number of dedicated pages
|
|||
|
PreAlloc equ DEDPAGES+1 ; Pre-allocated pages
|
|||
|
|
|||
|
PAGEINCR equ 2
|
|||
|
PAGEMASK equ 000FEH
|
|||
|
|
|||
|
PTRMASK equ MIN_PAGESIZE-1
|
|||
|
|
|||
|
WORDSIZE equ 16 ; The computer's word size (16 bits/word)
|
|||
|
WORDINCR equ 2 ; The number of address units per word
|
|||
|
HT_SIZE equ 211 ; The oblist's hash table size
|
|||
|
OHT_SIZE equ 17 ; The object hash table's size
|
|||
|
STKSIZE equ 900 ; Length of Scheme's internal stack (bytes)
|
|||
|
NUM_REGS equ 64 ; Number of general regs in the Scheme VM
|
|||
|
SB_CHECK equ 16 ; Iteration count for shift-break checks
|
|||
|
|
|||
|
; Page attribute bits
|
|||
|
ATOM equ 08000H ; 1 = Atomic data
|
|||
|
LISTCELL equ 04000H ; 1 = List (cons) cells
|
|||
|
FIXNUMS equ 02000H ; 1 = 16-bit integer data
|
|||
|
FLONUMS equ 01000H ; 1 = 32-bit floating point data
|
|||
|
BIGNUMS equ 00800H ; 1 = big integer values
|
|||
|
SYMBOLS equ 00400H ; 1 = symbols
|
|||
|
STRINGS equ 00200H ; 1 = strings
|
|||
|
VECTORS equ 00100H ; 1 = vector (array) storage
|
|||
|
NOMEMORY equ 00080H ; 1 = no memory allocated
|
|||
|
READONLY equ 00040H ; 1 = memory is read only (constant)
|
|||
|
CONTINU equ 00020H ; 1 = continuation object
|
|||
|
CLOSURE equ 00010H ; 1 = closure object
|
|||
|
REFS equ 00008H ; 1 = ref cells
|
|||
|
PORTS equ 00004H ; 1 = I/O ports
|
|||
|
CODE equ 00002H ; 1 = code block
|
|||
|
CHARS equ 00001H ; 1 = characters
|
|||
|
NUMBERS equ FIXNUMS+FLONUMS+BIGNUMS ; number (fixnums, flonums, bignums)
|
|||
|
|
|||
|
; Data type equates (classes of data objects)
|
|||
|
NUMTYPES equ 15 ; Number of data types
|
|||
|
LISTTYPE equ 0
|
|||
|
FIXTYPE equ 1
|
|||
|
FLOTYPE equ 2
|
|||
|
BIGTYPE equ 3
|
|||
|
SYMTYPE equ 4
|
|||
|
STRTYPE equ 5
|
|||
|
VECTTYPE equ 6
|
|||
|
CONTTYPE equ 7
|
|||
|
CLOSTYPE equ 8
|
|||
|
FREETYPE equ 9
|
|||
|
CODETYPE equ 10
|
|||
|
REFTYPE equ 11
|
|||
|
PORTTYPE equ 12
|
|||
|
CHARTYPE equ 13
|
|||
|
ENVTYPE equ 14
|
|||
|
|
|||
|
; Data type lengths for fixed length objects
|
|||
|
BLK_OVHD equ 3 ; size of a block header
|
|||
|
PTRSIZE equ 3 ; size of a Scheme pointer (3 bytes)
|
|||
|
FLOSIZE equ 9
|
|||
|
|
|||
|
|
|||
|
; Special pre-allocated pages
|
|||
|
SPECCHAR equ 1
|
|||
|
SPECFIX equ 3
|
|||
|
SPECFLO equ 4
|
|||
|
SPECSYM equ 5
|
|||
|
SPECPOR equ 6
|
|||
|
SPECCODE equ 7
|
|||
|
|
|||
|
; Predefined constants
|
|||
|
T_PAGE equ SPECSYM ; symbol 't' (representing true)
|
|||
|
T_DISP equ 0000H
|
|||
|
UN_PAGE equ SPECSYM ; symbol '#!unassigned' (unbound variable)
|
|||
|
UN_DISP equ 0009H
|
|||
|
NTN_PAGE equ SPECSYM ; symbol '#!not-a-number'
|
|||
|
NTN_DISP equ 001CH
|
|||
|
DIV0_PAGE equ SPECSYM ; symbol for divide by 0
|
|||
|
DIV0_DISP equ 001CH
|
|||
|
EOF_PAGE equ SPECSYM ; symbol for '#!EOF
|
|||
|
EOF_DISP equ 00031H
|
|||
|
NPR_PAGE equ SPECSYM ; symbol for '#!unprintable'
|
|||
|
NPR_DISP equ 003DH
|
|||
|
|
|||
|
NIL_PAGE equ 0 ; symbol 'nil' (representing itself)
|
|||
|
NIL_DISP equ 0
|
|||
|
IN_PAGE equ SPECPOR ; standard input port
|
|||
|
IN_DISP equ 0
|
|||
|
OUT_PAGE equ SPECPOR ; standard output port
|
|||
|
OUT_DISP equ 0
|
|||
|
WHO_PAGE equ SPECPOR ; "who-line"
|
|||
|
WHO_DISP equ 0123H
|
|||
|
|
|||
|
; End of linked list indicator
|
|||
|
END_LIST equ 07FFFH
|
|||
|
|
|||
|
; Garbage Collector "marked" bit
|
|||
|
GC_BIT equ 080H
|
|||
|
NOT_GC_BI equ 07FH
|
|||
|
|
|||
|
; Special Characters
|
|||
|
CR equ 0DH ; ASCII Carriage Return
|
|||
|
LF equ 0AH ; ASCII Line Feed
|
|||
|
|
|||
|
; Numeric operator sub-opcodes
|
|||
|
ADD_OP equ 0 ; add
|
|||
|
SUB_OP equ 1 ; subtract
|
|||
|
MUL_OP equ 2 ; multiply
|
|||
|
DIV_OP equ 3 ; divide
|
|||
|
MOD_OP equ 4 ; modulo
|
|||
|
AND_OP equ 5 ; bitwise-and
|
|||
|
OR_OP equ 6 ; bitwise-or
|
|||
|
MINUS_OP equ 7 ; minus
|
|||
|
EQ_OP equ 8 ; = (equal comparison)
|
|||
|
NE_OP equ 9 ; <> (not equal comparison)
|
|||
|
LT_OP equ 10 ; < (less than comparison)
|
|||
|
GT_OP equ 11 ; > (greater than comparison)
|
|||
|
LE_OP equ 12 ; <= (less than or equal comparison)
|
|||
|
GE_OP equ 13 ; >= (greater than or equal comparison)
|
|||
|
ABS_OP equ 14 ; absolute value
|
|||
|
QUOT_OP equ 15 ; quotient (integer division)
|
|||
|
ZERO_OP equ 21 ; zero?
|
|||
|
POS_OP equ 22 ; positive?
|
|||
|
NEG_OP equ 23 ; negative?
|
|||
|
XOR_OP equ 24 ; bitwise-xor
|
|||
|
|
|||
|
; Numeric Error Codes
|
|||
|
REF_GLOBAL_ERROR equ 1 ; reference of unbound global variable
|
|||
|
SET_GLOBAL_ERROR equ 2 ; SET! error-- global not defined
|
|||
|
REF_LEXICAL_ERROR equ 3 ; reference of unbound lexical variable
|
|||
|
SET_LEXICAL_ERROR equ 4 ; SET! error-- lexical variable not defined
|
|||
|
REF_FLUID_ERROR equ 5 ; reference of unbound fluid variable
|
|||
|
SET_FLUID_ERROR equ 6 ; SET-FLUID! error-- fluid not bound
|
|||
|
VECTOR_OFFSET_ERROR equ 7 ; vector index out of range
|
|||
|
STRING_OFFSET_ERROR equ 8 ; string index out of range
|
|||
|
SUBSTRING_RANGE_ERROR equ 9 ; invalid substring range
|
|||
|
INVALID_OPERAND_ERROR equ 10 ; Invalid operand to VM instruction
|
|||
|
SHIFT_BREAK_CONDITION equ 11 ; SHFT-BRK key was depressed by user
|
|||
|
NON_PROCEDURE_ERROR equ 12 ; Attempted to call non-procedural object
|
|||
|
TIMEOUT_CONDITION equ 13 ; Timer interrupt
|
|||
|
WINDOW_FAULT_CONDITION equ 14 ; Attempt to do I/O to a de-exposed window
|
|||
|
FLONUM_OVERFLOW_ERROR equ 15 ; Flonum Over/Under-flow
|
|||
|
ZERO_DIVIDE_ERROR equ 16 ; Division by zero
|
|||
|
NUMERIC_OPERAND_ERROR equ 17 ; non-numeric operand
|
|||
|
APPLY_ARG_LIMIT_ERROR equ 18 ; too many arguments for APPLY to handle
|
|||
|
VECTOR_SIZE_LIMIT_ERROR equ 19 ; attempt to allocate vector which is too big
|
|||
|
STRING_SIZE_LIMIT_ERROR equ 20 ; attempt to allocate string which is too big
|
|||
|
IO_ERRORS_START equ 21 ; Errors between 21 and 84 are DOS I/O errors
|
|||
|
DOS_FATAL_ERROR equ 21 ; Generic fatal I/O error
|
|||
|
EXTEND_START_ERROR_CODE equ 1 ; Extended error codes from INT 59h
|
|||
|
EXTEND_END_ERROR_CODE equ 88
|
|||
|
DISK_FULL_ERROR equ 200 ; Our own home-grown error codes
|
|||
|
LAST_ERROR equ 200 ; Future errors should start here
|
|||
|
|
|||
|
; List Cell
|
|||
|
;
|
|||
|
; 2 2 2 2 1 1 1 1 1 1 1 1 1 1
|
|||
|
; 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
|
|||
|
; +-------------+-+-+-----+-----------------------+
|
|||
|
; | car page no.|0|g|0 0 0| car displacement |
|
|||
|
; +-------------+-+-+-----+-----------------------+
|
|||
|
; | cdr page no.|0|0 0 0 0| cdr displacement |
|
|||
|
; +-------------+-+-------+-----------------------+
|
|||
|
; where g = used during garbage collection
|
|||
|
listdef struc
|
|||
|
car_page db ? ; CAR's page number
|
|||
|
car dw ? ; CAR's displacement
|
|||
|
cdr_page db ? ; CDR's page number
|
|||
|
cdr dw ? ; CDR's displacement
|
|||
|
listdef ends
|
|||
|
list_gc equ car+1 ; High order bit used by GC
|
|||
|
LISTSIZE equ size listdef
|
|||
|
|
|||
|
|
|||
|
; Bignum
|
|||
|
;
|
|||
|
; 2 2 2 2 1 1 1 1 1 1 1 1 1 1
|
|||
|
; 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
|
|||
|
; +-+-------------+-------------------------------+
|
|||
|
; |g| type | length in bytes |
|
|||
|
; +-+-------------+-------------------------------+
|
|||
|
; | sign | least significant word |
|
|||
|
; +---------------+--------------------------------
|
|||
|
; : :
|
|||
|
; ----------------+-------------------------------+
|
|||
|
; | most significant word |
|
|||
|
; ----------------+-------------------------------+
|
|||
|
; where g = used during garbage collection
|
|||
|
bigdef struc
|
|||
|
big_type db BIGTYPE ; tag = bignum
|
|||
|
big_len dw ? ; length of entire data structure in bytes
|
|||
|
big_sign db ? ; sign of the bignum
|
|||
|
big_data dw ? ; data bits, stored with least significant
|
|||
|
; bits appearing first
|
|||
|
big_2nd dw ? ; second word of significant bits
|
|||
|
bigdef ends
|
|||
|
big_gc equ big_type
|
|||
|
|
|||
|
; Flonum
|
|||
|
;
|
|||
|
; 2 2 2 2 1 1 1 1 1 1 1 1 1 1
|
|||
|
; 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
|
|||
|
; +-+-------------+---------------+---------------+
|
|||
|
; |g| type | 64 bit IEEE floating |
|
|||
|
; +-+-------------+---------------+---------------+
|
|||
|
; | |
|
|||
|
; +---------------+---------------+---------------+
|
|||
|
; | |
|
|||
|
; +---------------+---------------+---------------+
|
|||
|
; where g = used during garbage collection
|
|||
|
flodef struc
|
|||
|
flo_type db FLOTYPE ; tag = flonum
|
|||
|
flo_data db 8 dup (?) ; IEEE floating point number
|
|||
|
flodef ends
|
|||
|
flo_gc equ flo_type
|
|||
|
|
|||
|
; Vector (Array)
|
|||
|
;
|
|||
|
; 2 2 2 2 1 1 1 1 1 1 1 1 1 1
|
|||
|
; 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
|
|||
|
; +-+-+-----------+-------------------------------+
|
|||
|
; |g|b| type | length in bytes |
|
|||
|
; +-+-+-----------+-------------------------------+
|
|||
|
; | first data element, second, ...
|
|||
|
; +------------------------------------------------
|
|||
|
; : :
|
|||
|
; ------------------------------------------------+
|
|||
|
; ..., last data element |
|
|||
|
; ------------------------------------------------+
|
|||
|
; where g = used during garbage collection
|
|||
|
; b = unboxed array (contains no type info)
|
|||
|
vecdef struc
|
|||
|
vec_type db VECTTYPE
|
|||
|
vec_len dw ?
|
|||
|
vec_page db ?
|
|||
|
vec_disp dw ?
|
|||
|
vecdef ends
|
|||
|
vec_gc equ vec_type
|
|||
|
vec_data equ vec_page
|
|||
|
|
|||
|
; Symbol
|
|||
|
;
|
|||
|
; 2 2 2 2 1 1 1 1 1 1 1 1 1 1
|
|||
|
; 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
|
|||
|
; +-+-------------+-------------------------------+
|
|||
|
; |g| SYMTYPE | length in bytes |
|
|||
|
; +-+-------------+-------------------------------+
|
|||
|
; | link page no. | link displacement |
|
|||
|
; +-+-------------+-------------------------------+
|
|||
|
; | hash value | characters ...
|
|||
|
; +---------------+-------------------------------
|
|||
|
; : :
|
|||
|
; ------------------------------------------------+
|
|||
|
; where g = used during garbage collection
|
|||
|
symdef struc
|
|||
|
sym_type db SYMTYPE ; tag = symbol
|
|||
|
sym_len dw ? ; length of symbol structure in bytes
|
|||
|
sym_page db ? ; link field page number
|
|||
|
sym_disp dw ? ; link field displacement
|
|||
|
sym_hkey db ? ; hash key
|
|||
|
sym_data db ? ; character(s) in symbol
|
|||
|
symdef ends
|
|||
|
sym_gc equ sym_type
|
|||
|
sym_ovhd equ sym_data-sym_type ; # bytes of overhead in symbol object
|
|||
|
|
|||
|
; String
|
|||
|
;
|
|||
|
; 2 2 2 2 1 1 1 1 1 1 1 1 1 1
|
|||
|
; 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
|
|||
|
; +-+-------------+-------------------------------+
|
|||
|
; |g| STRTYPE | length in bytes |
|
|||
|
; +-+-------------+-------------------------------+
|
|||
|
; | characters ...
|
|||
|
; +---------------+---------------+----------------
|
|||
|
; : :
|
|||
|
; ----------------+---------------+---------------+
|
|||
|
; where g = used during garbage collection
|
|||
|
strdef struc
|
|||
|
str_type db strTYPE ; tag = string
|
|||
|
str_len dw ? ; length of string structure in bytes
|
|||
|
str_data db ? ; character(s) in string
|
|||
|
strdef ends
|
|||
|
str_gc equ str_type
|
|||
|
str_ovhd equ str_data-str_type ; # bytes of overhead in string object
|
|||
|
|
|||
|
; Closure
|
|||
|
;
|
|||
|
; 2 2 2 2 1 1 1 1 1 1 1 1 1 1
|
|||
|
; 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
|
|||
|
; +-+-------------+-------------------------------+
|
|||
|
; |g| CLOSTYPE | length in bytes |
|
|||
|
; +-+-------------+-------------------------------+
|
|||
|
; | Information Operand Pointer |
|
|||
|
; +---------------+-------------------------------+
|
|||
|
; | heap page no. | heap environment displacement |
|
|||
|
; +---------------+-------------------------------+
|
|||
|
; | CB page no. | CB displacement |
|
|||
|
; +---------------+-------------------------------+
|
|||
|
; | SPECFIX*2 | Entry Point Displacement |
|
|||
|
; +---------------+-------------------------------+
|
|||
|
; | SPECFIX*2 | Number of Arguments |
|
|||
|
; +---------------+-------------------------------+
|
|||
|
; where g = used during garbage collection
|
|||
|
closdef struc
|
|||
|
clo_type db CLOSTYPE ; tag = closure
|
|||
|
clo_len dw ? ; length of closure object in bytes
|
|||
|
clo_ipag db ? ; information operand page number
|
|||
|
clo_idis dw ? ; information operand displacement
|
|||
|
clo_hpag db ? ; heap environment pointer page number
|
|||
|
clo_hdis dw ? ; heap environment pointer displacement
|
|||
|
clo_cb_p db ? ; code base page number
|
|||
|
clo_cb_d dw ? ; code base displacement pointer
|
|||
|
clo_etag db SPECFIX*2 ; entry point tag = immediate
|
|||
|
clo_edis dw ? ; entry point displacement
|
|||
|
clo_atag db SPECFIX*2 ; number of arguments tag = immediate
|
|||
|
clo_narg dw ? ; number of arguments
|
|||
|
clo_dbug db ? ; optional debugging information?
|
|||
|
closdef ends
|
|||
|
clo_gc equ clo_type ; garbage collection mark bit field
|
|||
|
CLO_OVHD equ clo_dbug-clo_type ; number of bytes of overhead in a closure
|
|||
|
|
|||
|
; Continuation
|
|||
|
;
|
|||
|
; 2 2 2 2 1 1 1 1 1 1 1 1 1 1
|
|||
|
; 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
|
|||
|
; +-+-------------+-------------------------------+
|
|||
|
; |g| CONTTYPE | length in bytes |
|
|||
|
; +-+-------------+-------------------------------+
|
|||
|
; | tag=fixnum | stack base of continuation |
|
|||
|
; +---------------+-------------------------------+
|
|||
|
; | return address code base pointer |\
|
|||
|
; +---------------+-------------------------------+ | return address
|
|||
|
; | tag=fixnum | return address displacement |/
|
|||
|
; +---------------+-------------------------------+
|
|||
|
; | tag=fixnum | caller's dynamic link (FP) |
|
|||
|
; +---------------+-------------------------------+
|
|||
|
; | fluid environment pointer (FNV_reg) |
|
|||
|
; +---------------+-------------------------------+
|
|||
|
; | previous stack segment (continuation) pointer |
|
|||
|
; +---------------+-------------------------------+
|
|||
|
; | global environment pointer (GNV_reg) |
|
|||
|
; +---------------+-------------------------------+
|
|||
|
; : :< - BASE
|
|||
|
; : [contents of stack at call/cc] :
|
|||
|
; : :< - TOS
|
|||
|
; +-----------------------------------------------+
|
|||
|
; where g = used during garbage collection
|
|||
|
contdef struc
|
|||
|
con_type db CONTTYPE ; tag = continuation
|
|||
|
con_len dw ? ; length of continuation structure in bytes
|
|||
|
con_btag db SPECFIX*2 ; stack base of continuation object
|
|||
|
con_base dw ?
|
|||
|
con_cb_p db ? ; return address code base pointer
|
|||
|
con_cb_d dw ?
|
|||
|
con_rtag db SPECFIX*2 ; return address displacement
|
|||
|
con_ret dw ?
|
|||
|
con_dtag db SPECFIX*2 ; caller's dynamic link
|
|||
|
con_ddis dw ?
|
|||
|
con_fl_p db ? ; fluid environment pointer
|
|||
|
con_fl_d dw ?
|
|||
|
con_spag db ? ; previous stack segment pointer
|
|||
|
con_sdis dw ?
|
|||
|
con_gl_p db ? ; global environment pointer
|
|||
|
con_gl_d dw ?
|
|||
|
con_data db ? ; contents of stack at call/cc
|
|||
|
contdef ends
|
|||
|
con_gc equ con_type
|
|||
|
|
|||
|
; Code Block
|
|||
|
;
|
|||
|
; +-----------------------------------------------------+
|
|||
|
; | 2 2 2 2 1 1 1 1 1 1 1 1 1 1 |
|
|||
|
; | 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 |
|
|||
|
; | +-+-------------+-------------------------------+ |
|
|||
|
; | |g| CODETYPE | length in bytes | |
|
|||
|
; | +-+-------------+-------------------------------+ |
|
|||
|
; | | FIXTYPE*2 | entry offset |--+
|
|||
|
; | +---------------+-------------------------------+
|
|||
|
; | | page | displacement |\
|
|||
|
; | +---------------+-------------------------------+ |
|
|||
|
; | : : : > constants
|
|||
|
; | +---------------+-------------------------------+ | area
|
|||
|
; | | page | displacement |/
|
|||
|
; | +---------------+---------------+---------------+
|
|||
|
; +->| code | code | code |\
|
|||
|
; +---------------+---------------+---------------+ |
|
|||
|
; : : : : > code
|
|||
|
; +---------------+---------------+---------------+ |
|
|||
|
; | code | code | code |/
|
|||
|
; +---------------+---------------+---------------+
|
|||
|
; where g = used during garbage collection
|
|||
|
codedef struc
|
|||
|
cod_type db CODETYPE ; tag = code block
|
|||
|
cod_len dw ? ; length of code block in bytes
|
|||
|
cod_etag db FIXTYPE*2 ; entry offset tag = fixnum
|
|||
|
cod_entr dw ? ; entry offset in bytes
|
|||
|
cod_cpag db ? ; code block constants area
|
|||
|
cod_cdis dw ?
|
|||
|
codedef ends
|
|||
|
cod_gc equ cod_type ; garbage collection tag field
|
|||
|
|
|||
|
; Environment Data Object
|
|||
|
;
|
|||
|
; 2 2 2 2 1 1 1 1 1 1 1 1 1 1
|
|||
|
; 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
|
|||
|
; +-+-------------+-------------------------------+
|
|||
|
; |g| type | length in bytes |
|
|||
|
; +-+-------------+-------------------------------+
|
|||
|
; | parent pointer |
|
|||
|
; +---------------+-------------------------------+
|
|||
|
; | list of symbols (linked through cdr field) |
|
|||
|
; +---------------+-------------------------------+
|
|||
|
; | list of values (linked through car field) |
|
|||
|
; +---------------+-------------------------------+
|
|||
|
; where g = used during garbage collection
|
|||
|
envdef struc
|
|||
|
env_tag db ENVTYPE ; tag = environment
|
|||
|
env_len dw ? ; length in bytes
|
|||
|
env_ppag db ? ; parent pointer page number
|
|||
|
env_pdis dw ? ; parent pointer displacement
|
|||
|
env_npag db ? ; list of names page number
|
|||
|
env_ndis dw ? ; list of names displacement
|
|||
|
env_vpag db ? ; list of values page number
|
|||
|
env_vdis dw ? ; list of values displacement
|
|||
|
envdef ends
|
|||
|
ENV_SIZE equ size envdef
|
|||
|
|
|||
|
; Port
|
|||
|
; +--------+--------+--------+
|
|||
|
; 0 |tag=port| length in bytes |
|
|||
|
; +--------+--------+--------+
|
|||
|
; 3 | string source pointer |
|
|||
|
; +--------+--------+--------+--------+
|
|||
|
; 6 | port flags | handle |
|
|||
|
; +-----------------+-----------------+
|
|||
|
; 10 | cursor line | cursor column |
|
|||
|
; +-----------------+-----------------+
|
|||
|
; 14 | upper left line |upper left column|
|
|||
|
; +-----------------+-----------------+
|
|||
|
; 18 | number of lines |number of columns|
|
|||
|
; +-----------------+-----------------+
|
|||
|
; 22 |border attributes| text attributes |
|
|||
|
; +-----------------+-----------------+
|
|||
|
; 26 | window flags | buffer position |
|
|||
|
; +-----------------+-----------------+
|
|||
|
; 30 | buffer end |
|
|||
|
; +--------+--------+--------+--------+----... -----+
|
|||
|
; 32 | input/output buffer |
|
|||
|
; +--------+--------+-----------------+-------...---+
|
|||
|
; | window label/file pathname |
|
|||
|
; +--------+--------+-----------------+---------...-+
|
|||
|
; where g = used during garbage collection
|
|||
|
;
|
|||
|
; 7 6 5 4 3 2 1 0
|
|||
|
; +-+-+-+-+-+-+---+
|
|||
|
;port flags: | |s|b|t|o|w|mod|
|
|||
|
; +-+-+-+-+-+-+---+
|
|||
|
;
|
|||
|
; mod - mode: 0=read
|
|||
|
; 1=write
|
|||
|
; 2=read and write
|
|||
|
; w - window/file: 0=file
|
|||
|
; 1=window
|
|||
|
; o - open/closed: 0=closed
|
|||
|
; 1=open
|
|||
|
; t - transcript: 0=disabled
|
|||
|
; 1=enabled
|
|||
|
; b - binary: 0=test file/window
|
|||
|
; 1=binary file/window
|
|||
|
; s - string I/O: 0=file/window I/O
|
|||
|
; 1=string I/O
|
|||
|
;
|
|||
|
; 7 6 5 4 3 2 1 0
|
|||
|
; +-----+-+-+-+-+-+
|
|||
|
;window flags: | |e|w|
|
|||
|
; +-----+-+-+-+-+-+
|
|||
|
;
|
|||
|
; w - wrap/clip: 0=clip
|
|||
|
; 1=wrap
|
|||
|
; e - exposed: 0=exposed
|
|||
|
; 1=(partially) covered
|
|||
|
;
|
|||
|
portdef struc
|
|||
|
pt_type db PORTTYPE ; tag = port
|
|||
|
pt_len dw ? ; length of port structure in bytes
|
|||
|
pt_ptr db ?,?,? ; pointer to string, if any
|
|||
|
pt_pflgs dw ? ; port flags
|
|||
|
pt_handl dw ? ; file's handle
|
|||
|
pt_cline dw ? ; cursor line number
|
|||
|
pt_ccol dw ? ; cursor column number
|
|||
|
pt_ullin dw ? ; upper left hand corner's line number
|
|||
|
pt_ulcol dw ? ; upper left hand corner's column number
|
|||
|
pt_nline dw ? ; number of lines
|
|||
|
pt_ncols dw ? ; number of columns/line length
|
|||
|
pt_bordr dw ? ; window's border attributes
|
|||
|
pt_text dw ? ; window's text attributes
|
|||
|
pt_wflgs dw ? ; window flags
|
|||
|
pt_bfpos dw ? ; buffer position (offset)
|
|||
|
pt_bfend dw ? ; end of buffer offset
|
|||
|
pt_buffr dw ? ; input/output buffer
|
|||
|
portdef ends
|
|||
|
|
|||
|
port_gc equ pt_type
|
|||
|
pt_chunk equ pt_ullin
|
|||
|
|
|||
|
W_CLIP equ 00h
|
|||
|
W_WRAP equ 01h
|
|||
|
|
|||
|
READ_ONLY equ 00h
|
|||
|
WRITE_ONLY equ 01h
|
|||
|
READWRITE equ 02h
|
|||
|
WINDOW equ 04h
|
|||
|
OPEN equ 08h
|
|||
|
TRANSCRI equ 10h
|
|||
|
BINARY equ 20h
|
|||
|
STRIO equ 40h
|
|||
|
DIRTY equ 80h
|
|||
|
|
|||
|
|
|||
|
; The following is the format of a scheme pointer as far as
|
|||
|
; Lattice C is concerned:
|
|||
|
C_ptr struc
|
|||
|
C_disp dw ?
|
|||
|
C_page dw ?
|
|||
|
C_ptr ends
|
|||
|
|