Heading:
Extended Alto Emulator opcodes on the Dorado and Dolphin
Page Numbers: Yes X: 527 Y: 10.5"
Inter-Office Memorandum
ToDorado and Dolphin usersDateJune 24, 1982
FromEd TaftLocationPARC/CSL
SubjectExtended Alto Emulator opcodesFile[Indigo]<DoradoDocs>ExtendedOpcodes.press
on the Dorado and Dolphin
XEROX
The Alto instruction set, as emulated on the Dorado and Dolphin, has been extended to include several additional instructions. Herewith their descriptions.
Note that some microcode configurations may not implement all these instructions. Software should be prepared for unimplemented instructions to trap in the standard manner (see Alto Hardware Manual).
1. New instructions
61022BWrite Printer [Dolphin only]
Sends AC0 to the printer interface. The Dolphin’s printer interface is incompatible with the Alto’s; refer to device-specific documentation for how to use this. (Note that this opcode replaces the Alto-II DIAGNOSE1 instruction.)
61023BRead Printer [Dolphin only]
Reads AC0 from the printer interface. (Note that this opcode replaces the Alto-II DIAGNOSE2 instruction.)
61027BDisplay Field Rate [Dorado/Dolphin]
Sets the display field rate according to a parameter passed in AC0, and returns the old value in AC0. For an LF display, the value 9 selects 77 hz (the normal rate), and 139 selects 60 hz. Only LF displays will tolerate having their field rates adjusted in this manner.
61032BDisplay Width [Dorado/Dolphin]
Permits a program to determine what type of display is connected (Alto-style or LF); and, in the case of an LF display, permits switching between Alto emulation and full-screen modes.
Entry:AC0=0Switch to Alto emulation mode.
AC0=−1Switch to full-screen mode.
Exit:AC0=maximum number of words per scan line in the new mode (38 for Alto mode, 64 for full-screen mode).
The exact effects of the instruction are machine-dependent. In some implementations, the display mode may be fixed—the instruction will not change the mode but will just return information.
61033BGet Memory Configuration [Dorado/Dolphin]
Permits a program to obtain the size of the machine’s real and virtual memory.
Exit:AC0=number of 256-word pages of usable real memory.
AC1=number of 64K-word banks of virtual memory.
Since the Alto instruction set does not include any facilities for manipulating the virtual memory, this instruction is essentially useless in Alto emulation mode. It is included for the benefit of programs running on top of other emulators (Lisp, Smalltalk), which can escape to Alto emulation mode to obtain this vital information.
61034BPower Off [Dorado/Dolphin]
Turns off the machine’s power and does not return. Manual intervention is required to turn the machine back on.
61035BChecksum [Dolphin only]
Computes a checksum over a block of memory, using the Pup ones-complement add-and-cycle checksum algorithm.
Entry:AC0=0 (initial checksum)
AC1=address of first word of block
AC3=number of words in block
Exit:AC0=result checksum
AC1=address of first word beyond end of block
AC3=0
This instruction is interruptible. If interrupted, it stores intermediate state in the accumulators and does not advance the PC. When the interrupt has been serviced, the instruction is re-executed and completes the operation.
61036BLoad RAM [Dorado/Dolphin]
Overwrites the machine’s control store with new contents, and optionally starts the machine at a new micro-PC.
Entry:AC0=address of RAM image array in main memory.
AC1[15]=mode flag (see below).
Exit:If AC1[15]=0, resumes execution at the next (macro)instruction. If AC1[15]=1, sets the micro-PC to the value given in the End block of the RAM image.
Mode 1 is used for complete microcode replacement, as in loading a new emulator. All micro-tasking is turned off (and memory refresh is done in-line on the Dolphin); and at the end the new microcode is started at its starting address.
Mode 0 is suitable for microcode overlays, where the new microcode does not conflict with any microcode presently being executed. Tasking is left on, and the starting address in the RAM image is ignored. Additionally, the address of the first word not loaded (i.e., one beyond the end of the RAM image array) is returned in AC0; if the microcode consists of multiple overlays, this is a pointer to the beginning of the next overlay.
The format of the RAM image is machine-dependent. For the Dorado format, see [Ivy] <DoradoDocs>DoradoBooting.press; for the Dolphin, [Ivy]<APilot>Microcode>D0>Private> MakeLoaderFile.press.
61037BSet Default Partition [Dorado/Dolphin]
Sets and/or returns the current default disk partition number, which is a number in [1..2] on a Dolphin and [1..5] on a Dorado.
Entry:AC0=0 just returns the current default partition.
AC0#0 attempts to set the default partition to that value.
Exit:AC0=current default partition if AC0=0 on entry; otherwise,
AC0#0 if the specified partition was legal, 0 if illegal.
The effect of this instruction is instantaneous; it is the caller’s responsibility not to have any disk activity in progress at the time.
61040BIO Input [Dorado only]
Executes an Input operation on the Dorado’s I/O bus.
Entry:AC1=IO address (TIOA) in [0..377B].
Exit:AC0=IO data read from that address
61041BIO Output [Dorado only]
Executes an Output operation on the Dorado’s I/O bus.
Entry:AC0=IO data to be sent.
AC1=IO address (TIOA) in [0..377B].
Exit:ACs unchanged.
61042BHalt [Dorado only]
Causes the machine to halt, by executing a micro-breakpoint. The machine may be resumed by a Midas ‘‘Proceed’’.
61043BSet PC Sampling Histogram [Dorado only]
Enables or disables emulator micro-PC sampling.
Entry:AC0=address of 8192-word table to be used as a PC-sampling histogram. AC0=0 disables PC sampling.
Exit:ACs unchanged.
When enabled, the microcode treats the table as an array of Mesa LONG CARDINALs (32-bit integers in which the low-order word is at the lower address). Every 32 microseconds, the microcode increments the entry whose index is the current emulator micro-PC. The caller should zero the table before enabling PC sampling.
61044BExternal Input [Dorado only]
Reads data from the Dorado’s external input connector.
Exit:AC0=input data
61045BExternal Output [Dorado only]
Sends data to the Dorado’s external output connector.
Entry:AC0=output data
2. Other extensions and incompatibilities
VERS instruction [Dorado/Dolphin]
The VERS instruction (61014B) returns the following standard information on the Alto:
AC0[0:3]Engineering number
AC0[4:7]Build number
AC0[8:15]Microcode version
The enumeration of engineering numbers has been extended as follows:
0 or 1Alto I
2
Alto II without extended memory
3
Alto II with extended memory
4
Dolphin
5
Dorado
On the Dolphin and Dorado, the build number (use of which has been discontinued on the Alto) is taken over to indicate the emulator(s) present in the current microcode:
0Alto emulator only
1
Alto plus Alto/Mesa
4
Alto plus Lisp
5
Alto plus Smalltalk 76
6
Alto plus Smalltalk 80
The microcode version field contains unspecified information which may be machine- or emulator-dependent.
Extended memory [Dorado/Dolphin]
Certain configurations of the Dorado’s and Dolphin’s Alto emulator have a limited implementation of the Alto-II extended memory option. Specifically, they support changing the emulator task’s alternate bank register and the display task’s normal bank register. The former operation permits one to make references to nonzero banks by means of the XMLDA, XMSTA, and BITBLT instructions. The latter operation permits one to move the display bit map to a nonzero bank.
The extended memory emulation does not enable switching of the emulator’s normal bank register to a nonzero bank, nor does it enable the switching of any I/O device besides the display.
On both Dolphin and Dorado, this capability is presently included only in the Smalltalk-76 microcode configurations and, in general, is useful only to Smalltalk-76. (However, see the next two sections for a more general and widely-used capability.)
Long display bit map addresses [Dorado/Dolphin]
On the Dorado and Dolphin, the display bit map may be located in extended memory. It is referenced by an ‘‘extended DCB’’ that differs from a normal DCB in the following ways:
1.The sign bit of word 3 (scan line count) is 1 instead of 0.
2.The normal bit map address in word 2 contains 177423B.
3.The DCB is extended by two words, which are a Mesa LONG POINTER to the bit map (the low-order 16 bits of the address are in the first word).
Note that the DCB itself remains in bank zero. Use of extended DCBs is the preferred method of moving the display bit map out of bank 0 on Dorados and Dolphins.
Long BITBLT [Dorado/Dolphin]
BITBLT may optionally take base bit map addresses given as LONG POINTERS specified in an ‘‘extended BBTable’’. This differs from a normal Alto-style BBTable in the following ways:
1.The sign bit of word 0 (function) is 1 instead of 0.
2.The source bit map address is given as a LONG POINTER in words 20B and 21B, and the destination bit map address in words 22B and 23B.
In an extended BBTable, the base bit map addresses in words 2B and 10B and the bank bits in word 0B are ignored. Extended BITBLT is the preferred means of referencing memory outside bank 0 on Dorados and Dolphins.
Unimplemented instructions
On the Dorado and Dolphin, the following instructions do not work the same as on the Alto:
61003BRCLKThe interpretation of the clock value returned in AC1 is the same as on an Alto-I (see Alto Hardware Manual); however, the resolution is not the same.
61007BSITSet Interval Timer: no-op.
61010BJMPRAMJump to RAM: if AC1 contains an appropriate value, enters another emulator (e.g., 420B for Mesa); otherwise it traps.
61011BRDRAMRead RAM: returns a constant value.
61012BWRTRAMWrite RAM: no-op
61015BDREADDouble Read: traps.
61016BDWRITEDouble Write: traps.
61017BDEXCHDouble Exchange: traps.
61022BDIAGNOSE1Diagnostic: replaced by Write Printer on the Dolphin; traps on the Dorado.
61023BDIAGNOSE2Diagnostic: replaced by Read Printer on the Dolphin; traps on the Dorado.
61025BXMLDAExtended Memory Load: has its normal effect if the extended memory emulation is present; otherwise it traps.
61026BXMSTAExtended Memory Store: has its normal effect if the extended memory emulation is present; otherwise it traps.
On the Dolphin, execution of unimplemented opcodes in the range [61040B..77377B] may have undefined effects rather than causing a trap.
BCPL Runtime microcode
BCPL software uses stylized calls for invoking a number of runtime operations. On the Alto, these calls invoke either some standard runtime software (part of the Alto Operating System) or some special Alto microcode (BCPL Runtime package). All the calls are of the form JSR 300 through JSR 337 or JSR @340 through JSR @377.
To improve performance, the Dorado and Dolphin intercept many of these opcodes and execute them directly—that is, they implement the semantics of the standard runtime operations, but without actually executing any of the runtime software.
Of course, this precludes the substitution of different runtime software providing non-standard semantics (such as a different stack frame allocation strategy). It is possible to construct configurations of the Dorado and Dolphin microcode in which emulation of the BCPL runtime operations is disabled.