**** interrupt.f: Some words for servicing 68010 interrupts while running stand-alone. SR! w -- Local,68000 "status-register-store" The lower 16 bits of w is stored into the 680x0 status register. SR@ -- w Local,68000 "status-register-fetch" w is the contents of the 680x0 status register, padded with zeroes to the width of the stack. .INT format&vector pclow.w pchi.w sr.w -- Local,68010 "dot-interrupt" The stack contains the 68010 exception frame. .INT prints Interrupt; Vector xx where xx is the vector on which the interrupt was taken. TAKEINT -- addr H An implementation word which is used in the servicing of interrupts. INTERRUPT-OCCURRED -- addr Local, 68000 The address of a variable which is set to TRUE (-1) when an interrupt is serviced by the low level Forth interrupt service routine. VECTOR-USED -- addr Local, 68000 The address of a variable containing a 16 bit value. That value is the vector number used by the most recent interrupt that was serviced by Forth. NOTICE-INTERRUPT -- addr Local, 68000 The address of a 68010 machine code sequence that may be used for servicing interrupts. The address should be stored in the interrupt vector location for the interrupt vector that is to be serviced. If this code sequence is executed as a result of an interrupt, the variable INTERRUPT-OCCURRED will be set to TRUE, and the word (16 bit) variable VECTOR-USED will be set to the vector number on which the interrupt occurred. For example, the following code will install NOTICE-INTERRUPT as the service routine for interrupt vector number 64: NOTICE-INTERRUPT 64 /L* L! /L* converts the vector number into a longword address. SPL priority -- Local, 68000 The processor priority is set to priority {{1..7}}, allowing the CPU to respond to interrupts on any level greater than priority. CATCHVECTOR vector-address -- Local, 68000 vector-address is the longword address of an interrupt vector. That vector is set to execute .INT , so that if an interrupt occurs on that vector, the action described by .INT will be performed. CATCH-AUTOVECTORS -- Local, 68000 Performs the action of CATCHVECTOR for autovectors 1 through 6 (interrupt numbers 25-30). Autovector 7 is not affected, since it is used by the Sun PROM monitor for keyboard scanning, and replacing it would result in keyboard input being disabled. **** map.f: Words for accessing CPU space resources in the Sun-2 architecture. 03. lconstant FC_MAP 68000 function code for Sun-2 CPU space. 05 constant SMAP_OFFSET 06. lconstant CX_ADDR 0b. lconstant LED_ADDR 0f. lconstant ENABLE_ADDR 0f0f constant CX_MASK Addresses in CPU space of several interesting resources. SPACEC@ l.address function_code -- b.value Local, Sun-2 SPACEW@ l.address function_code -- w.value Local, Sun-2 SPACEL@ l.address function_code -- l.value Local, Sun-2 Fetches a byte, word, longword respectively from l.address in the 68000 space function_code. SPACEC! b.value l.address function_code -- Local, Sun-2 SPACEW! w.value l.address function_code -- Local, Sun-2 SPACEL! l.value l.address function_code -- Local, Sun-2 Stores a byte, word, longword respectively to l.address in the 68000 space function_code. PGMAP@ l.addr -- l.pmentry Local, Sun-2 l.pmentry is the page map entry for the virtual address l.addr. PGMAP! l.pmentry l.addr -- Local, Sun-2 l.pmentry is stored into the page map entry for the virtual address l.addr. SMAP@ l.addr -- smapentry Local, Sun-2 smentry is the segment map entry for the virtual address l.addr. SMAP! smapentry l.addr -- Local, Sun-2 smapentry is stored into the page map entry for the virtual address l.addr. CONTEXT@ -- context-entry Local, Sun-2 context-entry is the contents of the context register. CONTEXT! context-entry -- Local, Sun-2 context-entry becomes the new contents of the context register. ENABLE@ -- enable-mask Local, Sun-2 enable-mask is the contents of the system enable register. ENABLE! enable-mask -- Local, Sun-2 enable-mask becomes the new contents of the system enable register. LED! led-mask -- Local, Sun-2 The lower 8 bits of led-mask is stored in the diagnostic register. A zero bit in led-mask turns on the corresponding diagnostic light-emitting-diode. PAGESIZE -- n n is the size of a page in bytes. For the Sun-2 architecture, this is 2048 bytes. PAGESIZE -- n n is the log base 2 of the page size. It can serve as the argument to a logical shift to convert addresses to page numbers and vice versa. For the Sun-2 architecture, this number is 11 bytes. OBMEM -- l ( On Board Memory ) OBIO -- l ( On Board I/O ) MBMEM -- l ( Multibus Memory ) MBIO -- l ( Multibus I/O ) VME24LOW -- l ( VME 24 Bit Space First 8 Mbytes ) VME24HIGH -- l ( VME 24 Bit Space Second 8 Mbytes ) VME16 -- l ( VME 16 Bit Space ) l is a 32 bit number which when added to the page number will result in a page map entry suitable for enabling that page in the indicated address space. PAGE# l.addr -- page_number Local page_number is the page number corresponding to the physical address l.addr ADDR->PMENTRY address-space l.paddr -- l.page_map_entry Local l.page_map_entry is a page map entry for the physical address l.paddr in the address space address_space. address_space is is one of the choices described above (e.g. OBMEM). MAPRANGE space physical_start virtual_top virtual_start -- Local Virtual addresses between virtual_start and virtual_top are mapped to consequetive physical addresses starting at physical_start in the address space space. PGMAP? virtual-address -- Local Prints the physical address and address space to which the virtual address is mapped. MBMEM -- l.addr Local l.addr is the virtual address to which the start of Multibus Memory space is normally mapped. SUN2USEMBMEM -- Local Maps in the first 3/4 Mbyte of Multibus Memory space starting at virtual address MBMEM. Obsolete. MAP-VME -- Local Maps in the VME spaces as follows: Space Size Physical Virtual VME24HIGH f0000 e00000 e00000 VME16 10000 0000 ef0000 OBMEM 100000 000000 f00000 MACHINE-TYPE -- n Local n is the machine type byte from the Sun ID PROM. If the ID PROM does not appear to be installed, prints a message to that effect and returns 0. SUN2MULTIBUS? -- flag Local flag is true if the machine is a Sun-2 Multibus machine, like a Sun-2/120 or a Sun-2/170. SUN2VME? -- flag Local flag is true if the machine is a Sun-2 VME machine, like a Sun-2/50 or a Sun-2/160. **** promwrite.f: For writing to the Monitor PROM page. This is a convenient thing to use as a scope trigger, because writing to the PROM page doesn't do anything to the state of the machine. INITPROM -- Local Enables writing to the monitor PROM by adding write permission to the appropriate page map entry. PROM -- l.addr Local,Sun-2 l.addr is the virtual address for the first location in the monitor PROM. The prom may be written with: 0 PROM W! Doing this won't affect the state of the machine, it will just strobe an unused signal on a decoder, which can be sensed with an oscilloscope or a logic analyser. *** catchberr.f SET-CPU -- Local Determines the CPU type (68010 or 68020) and installs the appropriate bus error handler for that CPU. *** set-architecture.f SET-ARCHITECTURE -- Local Sets up the memory mapping words (pgmap?, pgmap@, etc) appropriately for the architecture (Sun 2 or Sun 3) that the program is running on. set-architecture uses the CPU ID prom to automatically determine the machine type.