Heading:qjk40(635)\gExtended Alto Emulator opcodes on the Dorado and Dolphiny756qk40\gPage Numbers: Yes  X: 527  Y: 10.5"qjk40\gInter-Office Memorandumz18592l4445y762\f5bgTo	Dorado and Dolphin users	Date	June 24, 1982z18592l4445d2998e21(0,65535)(1,4445)(5,11684)(6,13664)\f1g2f0t2 1t0 24t6 1f1t0 4f0t7 1t0From	Ed Taft	Location	PARC/CSLz18592l4445d2998e25\f1g4f0t2 1t0 7t6 1f1t0 8f0t7 1t0Subject	Extended Alto Emulator opcodes	File	[Indigo]<DoradoDocs>ExtendedOpcodes.presson the Dorado and Dolphinz21167l4445d2998e25\f1g7f0t2 1t0 30t6 1f1t0 4t7 1t0 41f0XEROX       z18592l508e14(2116)\f2g5f0z18697l3033e10j(1270)\gThe Alto instruction set, as emulated on the Dorado and Dolphin, has been extended to include several additional instructions.  Herewith their descriptions.z18697l3033e10jk40\g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).z18697l3033e10jk40\g178i20I1. New instructionsz18697l3033e22k80\bg19B61022B	Write Printer [Dolphin only]z18697l3033e22k80(0,5280)(1,65535)(5,65535)(6,65535)\big5f1 1f0 14B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.)z18697l3033e10jk40(1270)\g6f1 2f0 199f1 9f061023B	Read Printer [Dolphin only]z18697l3033e22k80(0,5280)\big5f1 1f0 13BReads AC0 from the printer interface.  (Note that this opcode replaces the Alto-II DIAGNOSE2 instruction.)z18697l3033e10jk40(1270)\g6f1 2f0 75f1 9f061027B	Display Field Rate [Dorado/Dolphin]z18697l3033e22k80(0,5280)\big5f1 1f0 19B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.z18697l3033e10jk40(1270)\g63f1 2f0 32f1 2f061032B	Display Width [Dorado/Dolphin]z18697l3033e22k80(0,5280)\big5f1 1f0 14B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.z18697l3033e10jk40(1270)\gEntry:	AC0=0	Switch to Alto emulation mode.AC0=1	Switch to full-screen mode.z18697l4832d3033e10jk40(0,4832)(1,7840)\g7f1 2f0 35f1 2f0Exit:	AC0=maximum number of words per scan line in the new mode (38 for Alto mode, 64 for full-screen mode).z18697l4832d3033e10jk40\g6f1 2f0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.z18697l3033e10jk40(1270)\g61033B	Get Memory Configuration [Dorado/Dolphin]z18697l3033e22k80(0,5280)(1,65535)\big5f1 1f0 25BPermits a program to obtain the size of the machine's real and virtual memory.z18697l3033e10jk40(1270)\gExit:	AC0=number of 256-word pages of usable real memory.AC1=number of 64K-word banks of virtual memory.z18697l4832d3033e10jk40(0,4832)(1,7840)\g6f1 2f0 50f1 2f0 14f1 1f0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.z18697l3033e10jk40(1270)\g61034B	Power Off [Dorado/Dolphin]z18697l3033e22k80(0,5280)(1,65535)\big5f1 1f0 10BTurns off the machine's power and does not return.  Manual intervention is required to turn the machine back on.z18697l3033e10jk40(1270)\g61035B	Checksum [Dolphin only]z18697l3033e22k80(0,5280)\big5f1 1f0 9BComputes a checksum over a block of memory, using the Pup ones-complement add-and-cycle checksum algorithm.z18697l3033e10jk40(1270)\gEntry:	AC0=0 (initial checksum)AC1=address of first word of blockAC3=number of words in blockz18697l4832d3033e10jk40(0,4832)(1,7840)\g7f1 2f0 23f1 2f0 33f1 2f0Exit:	AC0=result checksumAC1=address of first word beyond end of blockAC3=0z18697l4832d3033e10jk40\g6f1 2f0 18f1 2f0 44f1 2f0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.z18697l3033e10jk40(1270)\g61036B	Load RAM [Dorado/Dolphin]z18697l3033e22k80(0,5280)(1,65535)\big5f1 1f0 7f1 2f0BOverwrites the machine's control store with new contents, and optionally starts the machine at a new micro-PC.z18697l3033e10jk40(1270)\gEntry:	AC0=address of RAM image array in main memory.AC1[15]=mode flag (see below).z18697l4832d3033e10jk40(0,4832)(1,7840)\g7f1 2f0 14f1 2f0 29f1 2f0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.z18697l4832d3033e10jk40\g9f1 2f0 63f1 2f0 71f1 2f0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.z18697l3033e10jk40(1270)\g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.z18697l3033e10jk40\g184f1 2f0 109f1 2f0 29f1 2f0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.z18697l3033e10jk40\g19f1 2f061037B	Set Default Partition [Dorado/Dolphin]z18697l3033e22k80(0,5280)(1,65535)\big5f1 1f0 22B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.z18697l3033e10jk40(1270)\gEntry:	AC0=0 just returns the current default partition.AC0#0 attempts to set the default partition to that value.z18697l4832d3033e10jk40(0,4832)(1,7840)\g7f1 2f0 48f1 2f0Exit:	AC0=current default partition if AC0=0 on entry; otherwise,AC0#0 if the specified partition was legal, 0 if illegal.z18697l4832d3033e10jk40\g6f1 2f0 31f1 2f0 25f1 2f0The effect of this instruction is instantaneous; it is the caller's responsibility not to have any disk activity in progress at the time.z18697l3033e10jk40(1270)\g61040B	IO Input [Dorado only]z18697l3033e22k80(0,5280)(1,65535)\big5f1 1f0 9BExecutes an Input operation on the Dorado's I/O bus.z18697l3033e10jk40(1270)\gEntry:	AC1=IO address (TIOA) in [0..377B].z18697l4832d3033e10jk40(0,4832)(1,7840)\g7f1 2f0 30f1 1f0Exit:	AC0=IO data read from that addressz18697l4832d3033e10jk40\g6f1 2f061041B	IO Output [Dorado only]z18697l3033e22k80(0,5280)(1,65535)\big5f1 1f0 10BExecutes an Output operation on the Dorado's I/O bus.z18697l3033e10jk40(1270)\gEntry:	AC0=IO data to be sent.AC1=IO address (TIOA) in [0..377B].z18697l4832d3033e10jk40(0,4832)(1,7840)\g7f1 2f0 22f1 2f0 30f1 1f0Exit:	ACs unchanged.z18697l4832d3033e10jk40\g6f1 2f061042B	Halt [Dorado only]z18697l3033e22k80(0,5280)(1,65535)\big5f1 1f0 5BCauses the machine to halt, by executing a micro-breakpoint.  The machine may be resumed by a Midas Proceed''.z18697l3033e10jk40(1270)\g61043B	Set PC Sampling Histogram [Dorado only]z18697l3033e22k80(0,5280)\big5f1 1f0 26BEnables or disables emulator micro-PC sampling.z18697l3033e10jk40(1270)\gEntry:	AC0=address of 8192-word table to be used as a PC-sampling histogram.  AC0=0 disables PC sampling.z18697l4832d3033e10jk40(0,4832)(1,7840)\g7f1 2f0 69f1 2f0Exit:	ACs unchanged.z18697l4832d3033e10jk40\g6f1 2f0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.z18697l3033e10jk40(1270)\g65f1 13f061044B	External Input [Dorado only]z18697l3033e22k80(0,5280)(1,65535)\big5f1 1f0 15BReads data from the Dorado's external input connector.z18697l3033e10jk40(1270)\gExit:	AC0=input dataz18697l4832d3033e10jk40(0,4832)(1,7840)\g6f1 2f061045B	External Output [Dorado only]z18697l3033e22k80(0,5280)(1,65535)\big5f1 1f0 16BSends data to the Dorado's external output connector.z18697l3033e10jk40(1270)\gEntry:	AC0=output dataz18697l4832d3033e10jk40(0,4832)(1,7840)\g7f1 2f02. Other extensions and incompatibilitiesz18697l3033e22k80(1270)\bg41BVERS instruction [Dorado/Dolphin]z18697l3033e16k80\ig1f1 3f0 29IThe VERS instruction (61014B) returns the following standard information on the Alto:z18697l3033e10jk40\g4f1 4f0 19f1 1f0AC0[0:3]	Engineering numberAC0[4:7]	Build numberAC0[8:15]	Microcode versionz18697l4832e10jk40(0,4832)\f1g2f0 26f1 2f0 20f1 2f0The enumeration of engineering numbers has been extended as follows:z18697l3033e10jk40(1270)\g0 or 1	Alto I2	Alto II without extended memory3	Alto II with extended memory4	Dolphin5	Doradoz18697l4832e10jk40(0,4832)\g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:z18697l3033e10jk40(1270)\g0	Alto emulator only1	Alto plus Alto/Mesa4	Alto plus Lisp5	Alto plus Smalltalk 766	Alto plus Smalltalk 80z18697l4832e10jk40(0,4832)\gThe microcode version field contains unspecified information which may be machine- or emulator-dependent.z18697l3033e10jk40(1270)\gExtended memory [Dorado/Dolphin]z18697l3033e16k80\ig32I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.z18697l3033e10jk40\g348f1 5f0 2f1 5f0 6f1 6f0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.z18697l3033e10jk40\g35i3I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.)z18697l3033e10jk40\gLong display bit map addresses [Dorado/Dolphin]z18697l3033e16k80\ig47I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:z18697l3033e10jk40\g1.	The sign bit of word 3 (scan line count) is 1 instead of 0.z18697l4303d3597e10jk40\g2.	The normal bit map address in word 2 contains 177423B.z18697l4303d3597e10jk40\g55f1 1f0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).z18697l4303d3597e10jk40\g54f1 12f0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.z18697l3033e10jk40\gLong BITBLT [Dorado/Dolphin]z18697l3033e16k80\ig5f1 6f0 17I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:z18697l3033e10jk40\f1g6f0 53f1 13f01.	The sign bit of word 0 (function) is 1 instead of 0.z18697l4303d3597e10jk40\g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.z18697l4303d3597e10jk40\g44f1 12f0 12f1 1f0 7f1 1f0 49f1 1f0 7f1 1f0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.z18697l3033e10jk40\g61f1 1f0 7f1 1f0 28f1 1f0 24f1 6f0Unimplemented instructionsz18697l3033e16k80\ig26IOn the Dorado and Dolphin, the following instructions do not work the same as on the Alto:z18697l3033e10jk40\g61003B	RCLK	The 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.z18697l8672d4303e10jk40(0,6496)(1,8672)\g5f1 1f0 1f1 4f0 51f1 2f0 35i20I61007B	SIT	Set Interval Timer: no-op.z18697l8672d4303e10jk40\g5f1 1f0 1f1 3f061010B	JMPRAM	Jump to RAM: if AC1 contains an appropriate value, enters another emulator (e.g., 420B for Mesa); otherwise it traps.z18697l8672d4303e10jk40\g5f1 1f0 1f1 6f0 10f1 2f0 5f1 2f0 67f1 1f061011B	RDRAM	Read RAM: returns a constant value.z18697l8672d4303e10jk40\g5f1 1f0 1f1 5f0 7f1 2f061012B	WRTRAM	Write RAM: no-opz18697l8672d4303e10jk40\g5f1 1f0 1f1 6f0 8f1 2f061015B	DREAD	Double Read: traps.z18697l8672d4303e10jk40\g5f1 1f0 1f1 5f061016B	DWRITE	Double Write: traps.z18697l8672d4303e10jk40\g5f1 1f0 1f1 6f061017B	DEXCH	Double Exchange: traps.z18697l8672d4303e10jk40\g5f1 1f0 1f1 5f061022B	DIAGNOSE1	Diagnostic: replaced by Write Printer on the Dolphin; traps on the Dorado.z18697l8672d4303e10jk40\g5f1 1f0 1f1 9f061023B	DIAGNOSE2	Diagnostic: replaced by Read Printer on the Dolphin; traps on the Dorado.z18697l8672d4303e10jk40\g5f1 1f0 1f1 9f061025B	XMLDA	Extended Memory Load: has its normal effect if the extended memory emulation is present; otherwise it traps.z18697l8672d4303e10jk40\g5f1 1f0 1f1 5f061026B	XMSTA	Extended Memory Store: has its normal effect if the extended memory emulation is present; otherwise it traps.z18697l8672d4303e10jk40\g5f1 1f0 1f1 5f0On the Dolphin, execution of unimplemented opcodes in the range [61040B..77377B] may have undefined effects rather than causing a trap.z18697l3033e10jk40(1270)\g70f1 1f0 7f1 1f0 2i26IBCPL Runtime microcodez18697l3033e16k80\ig22I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.z18697l3033e10jk40\g272f1 3f0 13f1 3f0 8f1 3f0 14f1 3f0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.z18697l3033e10jk40\g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.z18697l3033e10jk40\g