Describe the facility data area. Done here because the user area contains a facility.
zero
DUP CONSTANT _#facility CELL+ \ contains the user_base address
\ of claiming task.
DUP CONSTANT _#facility_link CELL+ \ link from _facility_head
DUP CONSTANT _#facility_back CELL+ \ points to previous link.
CONSTANT #facility_length
'U contains the offset of the last location allocated. uvariable uses that value as the user area offset and adds the size of a variable to the contents of U'. The above happens in the host machine. To the target machine is added the code required to implement a user address that returns an address within the user area.
forth : ucreate
HOST 'U
forth @ \ addr value(--
HOST USER
forth
;
HOST
Allocate n bytes of area in the user space
Example: HEX uvariable fred 10 uallot \ create a 14 byte user area called fred.
forth : uallot ( n --)
HOST 'U \ n addr (--
forth DUP @ \ n addr n1 (--
ROT + \ addr n2 (--
SWAP \ n1 addr (--
!
forth
;
HOST
'U contains the offset of the last location allocated. uvariable uses that value as the user area offset and adds the size of a variable to the contents of U'. The above happens in the host machine. To the target machine is added the code required to implement a user variable that returns an address within the user area. The created variable is 4 bytes long
forth : uvariable
HOST ucreate 4 uallot forth ;
HOST
'U contains the offset of the last location allocated. uvariable uses that value as the user area offset and adds the size of a variable to the contents of U'. The above happens in the host machine. To the target machine is added the code required to implement a user variable that returns an address within the user area. The created variable is 2 bytes long
forth : uwvariable
HOST forth ucreate 2 uallot forth ;
HOST
An interrupt routine will allocate a user area on the return stack. The used area includes'buffer. 'buffer is the only cell used ( get-buffer and use-buffer are interrupt code options). handler is also included so CATCH and THROW word in interrupt code. All other cells belong at the start for other reasons and are used in interrupt code to make stack decoding simpler. _user_trap_intruction and STATUS contain a magic number 494E5452this is the string "INTR". The cell _task_restart_time contains the interrupt level.
Given a tasks user_base you should be able to determine everything.
HEX
Describe the activation block, for backward compatibility this must remain unaltered. dual port locations pointing to the task must point to the status word. So we can have standard tasks and port_tasks the activation block direclty maps over the beginning of the tasks user area.
0
DUP CONSTANT #activation_trap 2+
DUP CONSTANT #activation_status 2+
DUP CONSTANT #activation_task_link 4+
DUP CONSTANT #activation_task> 4+
DUP CONSTANT #activation_^c_set 2+
CONSTANT #activation_length
Not allowed to create user variables before this point.
'U @ zero ??=
The start of the user area.
ucreate user_base
ucreate interrupt_magic_number
Activation block can be in duel port memory, or at the start of the user area.
#activation_length uallot
Points to the activation area.
uvariable _activation>
If set the task can print the load position when an abort occues.
uwvariable _error_pos?
Contains: xclock+ @ start_time +
In interrupt code this cell is unused.
uvariable _task_restart_time
Used in interrupt code, CATCH/THROW will work.
uvariable handler
Used in interrupt code you can use get_buffer and kill_buffer You don't have to keep the address of a buffer obtained with get_buffer buffer will return it ( as long as another get_buffer hasn't been used). 'buffer contains a pointer to current buffer. see:
get_buffer kill_buffer and buffer
uvariable 'buffer
Including these in the interrupt task area allows interrupt code easy access to the physical unit tables. These contains handle of the I/O object that is active.
uvariable 'output_file
uvariable 'input_file
uvariable 'abort_file
\ set to known value in interrupt: entry. Data stack is very small
\ we can check this value on exit and make sure it it valid.
uvariable data_guard
End of area set up in interrupt code.
ucreate _interrupt_end_user
forth : activation_create
HOST CREATE t,
DOES> ( user_base pfa -- addr)
@ SWAP [ _activation> user_base - ]T LITERAL + @ +
;
Once the task has been started ( the U register contains desired value) these words can be used to access the activation area.
0 activation_create activation_base
#activation_trap activation_create activation_trap
#activation_status activation_create activation_status
#activation_task_link activation_create activation_link
#activation_task> activation_create activation_task_pointer
#activation_^c_set activation_create activation_^c_set
Words such as net_queue and priority_queue allow you to queue the task for activation when items are removed from the queue, these words link the tasks through here. Note the task is still linked into the task loops, they have there activation_status set to sleep. The task consuming items from the queue set linked in tasks activation status to wake and unlink the task.
ucreate _%task_link
uvariable _%task_link_fwd
uvariable _%task_link_back
Parameter stack point saved here on a task switch.
uvariable (S)
Claim the task before destroying it. .task and .tasks also claim the task so it isn't destroyed while they work on it.
ucreate %task_facility #facility_length uallot
The child task. Children task are destoyed on an abort.
uvariable _%task_children
We are double linked back to our parent.
ucreate _%task_parent
uvariable _%task_parent_fwd
uvariable _%task_parent_back
The task name can be a reverse counted string or a forward counted string so we need to keep the start address of the characters and the count.
uvariable _%task_name_count
uvariable _%task_name>
The level task is running. Used for documentation. How the task is linked in the task loops really determines the level.
uvariable _%task_level
Points to the dictionary table used to start the task.
uvariable _%task_table
The user area base is kept in register U.
uvariable _%data_stack_base \ set if stack is a buffer
uvariable _%data_stack_end \ used on a task reset
uvariable _%return_stack_base \ set if stack is a buffer
uvariable _%return_stack_end \ used on a task reset
Execution token of word executed on an abort
uvariable 'abort
Head creation routine.
uvariable 'create
When emptying the dictionary, a child task is destroyed if the inital_action is in the dictionary area being removed.
uvariable _'task_initial_action
HEX
100 CONSTANT _#min_local_size
zero
DUP CONSTANT _#dictionary_code 1+
DUP CONSTANT _#dictionary_file 1+
DUP CONSTANT _#dictionary_local 1+
DROP
uvariable _'h> \ will contain the address of
\ _'h_task or _'h_file or _'h_local
uvariable _'h_top> \ points to cell that conains current top pointer
uvariable _'h_mode \ current dictionary mode
Points to next dictionary location to be used by the task
uvariable _'h_task \ main dictionary pointer
uvariable _'h_task_top \ main dictionary top
This dictionary can be created when you enter a file destroyed when you leave.
uvariable _'h_file
uvariable _'h_file_top \ end of buffer
uvariable _'h_file_base \ base address of buffer used to store data
uvariable _'h_file_size \ set minimum buffer size
uvariable _'h_file_wid \ wid of vocabulary
uvariable _'h_file_old_'h> \ value saved when file selected
uvariable _'h_file_old_'top>
uvariable _'h_file_old_mode
This dictionary can be creared after entry to a word,
destroyed when you leave.
uvariable _'h_local
uvariable _'h_local_top \ end of buffer
uvariable _'h_local_base \ base address of buffer used to store the data
uvariable _'h_local_size \ set minimum buffer size
uvariable _'h_local_wid \ wid of vocabulary
uvariable _'h_local_old_'h> \ values saved when local selected
uvariable _'h_local_old_'top>
uvariable _'h_local_old_mode
Ram variables
uvariable 'ram
uvariable _'ram_top
Fast memeory
uvariable 'fast
uvariable _'fast_top
Dual port memory
uvariable 'port
uvariable _'port_top
#BVP5502 #BVP5501 + #BVP5552 + #BVP5551 + [IF]
The vision processors contain a static memory area.
uvariable 'static
uvariable _'static_top
The vision processor contains banked memory that is used to communicate between processors.
uvariable 'bank
uvariable _'bank_top
[THEN]
user space, we don;t need a base address as it is always contained within U
uvariable 'user
uvariable _'user_top
CORE
( -- a-addr )
a-addr is the address of a cell containing the current number-conversion radix {{2...36}}.
uvariable BASE
The real base is a power of 2.
\ uvariable %q_base
uvariable %fractional_digits
Next 5 values are saved on return stack when stream saved. See save_stream
CORE
( -- a-addr )
a-addr is the address of a cell containing the offset in characters from the start of the input buffer to the start of the parse area.
uvariable >IN
CORE EXT
( -- a-addr )
a-addr is the address of a cell containing the number of characters in the terminal input buffer.
Note: This word is obsolescent and is included as a concession to existing implementations.
The function of #TIB has been superseded by SOURCE.
uvariable #TIB
CORE EXT
( -- 0 | -1 )
Identifies the input source as follows:
uvariable SOURCE-ID
Line number
uvariable %line
Base character address current line is stored here. See TIB
uvariable %tib
( -- a-addr )
a-addr is the address of a cell containing the compilation-state flag. STATE is true when in compilation state, false otherwise. The true value in STATE is non-zero, but is otherwise implementation-defined. Only the following standard words alter the value in STATE: : (colon), ; (semicolon), ABORT, QUIT, :NONAME, [ (left-bracket), and ] (right-bracket).
Note: A standard program shall not directly alter the contents of STATE.
uvariable STATE
Set to true if only the COMMAND> vocabulary is searched.
uwvariable seal
\ execution token of word to print the page tile when printing
uvariable 'TITLE
\ Data are for 'TITLE
uvariable TITLE_DATA
\ Host name
uvariable 'HEADING
\ Voc head last added to
uvariable last
_get_abort_buffer returns an address, you must retain this
address as it is all you have that points to the buffer.
If the task aborts all _abort_buffers will be return to the
central buffer pool. see:
ALLOCATE
FREE
RESIZE
uvariable _head_abort_buffers
Local variable compiler keeps track of the amount of local data needed using these variables.
uvariable _%local_input_bytes
uvariable _%local_output_bytes
uvariable _%local_data_bytes
uvariable _%local_use
Flag to tell EXIT and ; to compile in OP register save code.
uvariable _%save_op
When you start creating local variable these values have to be retained.
uvariable _%local_entry_state
uvariable _%local_entry_last
Current stack pointer. Set by : checked by ;
uvariable csp
\ Ilan master port
uvariable 'MLINK
\ #### both should be moved out of the user area into PU table.
\ Used by SCONNECT and MCONNECT , set in
\ _cvs_terminal_codes_decode
uvariable =decode_cnt
\ Used by _cvs_terminal_codes_decode to tell
\ ILAN that it needs to tell the other end if
\ data is present. See SCONNECT and MCONNECT
uvariable =decode_?data
\ Used by PAGE_HOLD
uvariable first_page
All assembler data stores are vectored through here) to change the assembler for a xcompile these vectors need to be altered, saveing an assembler load reset on ABORT and by MARKER child.
uvariable 'ahere
W! on an abort
uvariable 'aw!
W@ on an abort
uvariable 'aw@
ALLOT on an abort
uvariable 'agap
type of cpu we are assemblering code for
uvariable %cpu