;---------------------------------------------------------------------------; ; RS-232 Data Switch Firmware ; ; ; ; File: GLOBALS.ASM ; ; ; ; This file contains declarations which are included in the assembly of all ; ; other source files. ; ;---------------------------------------------------------------------------; ; Constants ; --------- pw_length equ 8 ; Maximum password length. maxport equ 6 ; Number of ports installed. ; External memory allocation ; -------------------------- ; Line input buffer at 2000H (must be on a page boundary due to the way it ; is accessed). Reserve 80 bytes plus one for a terminating zero. bufpage equ 20h ; Table of port names. Reserve 8 bytes plus terminating zero for each port. nametbl equ bufpage*256+81 ; Baud rate codes in most-recently-used order for each port. There are 7 ; baud rates, stored as integers 1 to 7. baudtbl equ nametbl+9*maxport ; Table of physical connections, needed because the connection registers are ; write-only. NOTE: The length of this is dependent on the hardware ; configuration. connectbl equ baudtbl+7*maxport ; Table of break timeouts, in 10 ms increments, for each port. brktimtbl equ connectbl+8 ; Table of break counters, used to keep track of how long each port has been ; in the break state. brkcnttbl equ brktimtbl+maxport ; Table of flags indicating that a break has been detected on a port. The ; interrupt service routine uses this to communicate with the mainline code. brkflagtbl equ brkcnttbl+maxport ; Table of DTR timeouts. These are used to determine if equipment connected ; to a port has been turned off. Short absences of DTR are permitted for ; control of modems, etc. dtrtimtbl equ brkflagtbl+maxport ; Table of DTR timeout counters, used to time DTR losses. dtrcnttbl equ dtrtimtbl+maxport ; Table of flags indicating DTR events. dtrflagtbl equ dtrcnttbl+maxport ; Queue of port numbers waiting for a break to be serviced. It takes the form ; of a list of port numbers terminated by a zero. Enough space is reserved ; for all ports to be on the queue. brkqueue equ dtrflagtbl+maxport ; Logical connection table (this is not always the same as the physical ; connection table). c_sourcetbl equ brkqueue+maxport+1 ; Table of logical connection "owners", indicating which port has established ; a connection. c_owntbl equ c_sourcetbl+maxport ; Table of DTR/DCD output defaults, i.e. the values to be output when a given ; port is not connected to anything. dtrdeftbl equ c_owntbl+maxport ; The maintenance password. superpwd equ dtrdeftbl+maxport ; The password required to get from restricted to normal mode. userpwd equ superpwd+pw_length+1 ; Table of flags indicating whether a given port is in restricted mode. restrictbl equ userpwd+pw_length+1 ; Table of connection masks. Each is a 16-bit binary number with one bit ; representing each port. A "1" in a bit indicates that the corresponding ; port may be connected to. masktbl equ restrictbl+maxport ; Table of autoconnects. A zero in any position means that the corresponding ; port does not have an autoconnect set up. autoconntbl equ masktbl+2*maxport ; Base address of the (memory mapped) connection registers ; -------------------------------------------------------- connregbase equ 6000h ; Internal memory allocation ; -------------------------- ; Addresses 0 - 15 are reserved for two banks of registers. The first is ; used by non-interrupt code, the second is used by interrupt code, for ; rapid context switching. ; Counters used to prescale the 3600 interrupts/sec into 10 ms and 1 second ; increments. tickcnt1 equ 10h tickcnt2 equ 11h ; The date, as maintained by the interrupt service routine. hours equ 12h minutes equ 13h seconds equ 14h day equ 15h month equ 16h year equ 25h ; Shadow copy of the date, used to access it from the mainline. The interrupt ; code will copy between the shadow copy and the main copy when requested. hours_copy equ 17h minutes_copy equ 18h seconds_copy equ 19h day_copy equ 1ah month_copy equ 1bh year_copy equ 1ch ; Buffer pointer for the input line buffer. bufptr equ 1dh ; Current column of the cursor on the terminal. Used by the "tab" function. tabpos equ 1eh ; Currently active port in command mode. myport equ 1fh ; Flag indicating that the "getnum" or "gethex" functions found an error. badflag bit 20h.0 ; Flags used to access the clock via the clock shadow registers. Set by ; the mainline, cleared by the interrupt code. date_get_flag bit 20h.1 date_set_flag bit 20h.2 ; Flag indicating that the "getnum" function should not print an error ; message when it sees an error. quietflag bit 20h.3 ; This flag is set by the interrupt code when it wishes to signal an event ; to the mainline code. The mainline code must clear the flag first, then ; process the break and DTR flag tables. attnflag bit 20h.4 ; This flag indicates that one or more break requests are queued up. queueflag bit 20h.5 ; This flag is set by subroutines to indicate to their callers that the ; current user's session should be aborted immediately due to a timeout ; and pending request. byeflag bit 20h.6 ; This flag keeps track of whether the "signon" sequence (title screen, ; initial password entry) has been executed yet. signonflag bit 20h.7 ; This flag indicates whether input being typed should be echoed back. ; This is not the case for passwords. echoflag bit 21h.0 ; Flag indicating whether the current command session is in restricted mode. restrictflag bit 21h.1 ; Flag indicating whether the current command session is in maintenance mode. maintflag bit 21h.2 ; Mask indicating whether DTR/DCD outputs should follow their corresponding ; inputs, or be forced to "true". dtr_mask_and equ 22h ; Timers used to terminate a session when a break request is waiting. waittimer equ 23h idletimer equ 24h ; Power control register (not defined by MCS-51 assembler) ; -------------------------------------------------------- pcon equ 87h extisr equ 2200h extdec equ 2203h